Merge remote-tracking branch 'origin/staging' into origin/production

This commit is contained in:
Linksehat Staging Server
2024-02-01 17:03:55 +07:00
3 changed files with 37 additions and 10 deletions

View File

@@ -3,6 +3,7 @@
namespace Modules\Internal\Transformers;
use Illuminate\Http\Resources\Json\JsonResource;
use App\Models\Corporate;
class OrganizationResource extends JsonResource
{
@@ -14,7 +15,20 @@ class OrganizationResource extends JsonResource
*/
public function toArray($request)
{
$corporateId = $this->corporate_id_partner;
$corporateIds = explode(',', $corporateId);
$corporatePartner = '-';
if (count($corporateIds) > 0){
$corporatePartnerNames = Corporate::whereIn('id', $corporateIds)->get();
if (count($corporatePartnerNames)>0){
$corporateName = [];
foreach($corporatePartnerNames as $corporatePartnerName){
array_push($corporateName, $corporatePartnerName->name);
}
$corporatePartner = implode(', ', $corporateName);
}
}
$organization = [
'id' => $this->id,
'name' => $this->name,
@@ -32,6 +46,7 @@ class OrganizationResource extends JsonResource
'village_id' => $this->currentAddress->village_id ?? null,
'postal_code' => $this->currentAddress->postal_code ?? null,
'corporate_id_partner' => $this->corporate_id_partner ?? null,
'corporate_name' => $corporatePartner,
'active' => $this->status == 'active' ? 1 : 0,
];

View File

@@ -22,6 +22,7 @@ export type Organizations = {
image_url: string;
region_groups: string;
corporate_id_partner: string;
corporate_name: string;
};
export type Provinces = {

View File

@@ -260,6 +260,7 @@ export default function List() {
</IconButton>
</TableCell>
<TableCell align="left">{row.name}</TableCell>
<TableCell align="left">{row.corporate_id_partner ? 'Rekanan' : 'Non Rekanan'}</TableCell>
<TableCell align="left">{row.phone}</TableCell>
<TableCell align="left">{row.address}</TableCell>
@@ -292,26 +293,33 @@ export default function List() {
<Collapse in={open} timeout="auto" unmountOnExit>
<Box sx={{ margin: 1, pb: 2, pl: 4 }}>
<Grid container>
<Grid item xs={6} sx={{ padding: 2 }}>
<Grid item xs={12} sx={{ padding: 2 }}>
<Grid container>
<Grid item xs={6}>
<Grid item xs={2}>
Kode Rumah Sakit
</Grid>
<Grid item xs={6}>
<Grid item xs={10}>
: {row.code ? row.code : '-'}
</Grid>
<Grid item xs={6}>
<Grid item xs={2}>
Rekanan
</Grid>
<Grid item xs={10}>
: {row.corporate_name ? row.corporate_name : '-'}
</Grid>
<Grid item xs={2}>
Longitude
</Grid>
<Grid item xs={6}>
<Grid item xs={10}>
: {row.lng ? row.lng : '-'}
</Grid>
<Grid item xs={6}>
<Grid item xs={2}>
Latittude
</Grid>
<Grid item xs={6}>
<Grid item xs={10}>
: {row.lat ? row.lat : '-'}
</Grid>
</Grid>
@@ -443,15 +451,18 @@ export default function List() {
<TableCell style={headStyle} align="left">
Rumah Sakit
</TableCell>
<TableCell style={headStyle} align="left">
Rekanan (Partner)
</TableCell>
<TableCell style={headStyle} align="left">
Nomor IGD
</TableCell>
<TableCell style={headStyle} align="left">
Alamat
</TableCell>
{/* <TableCell style={headStyle} align="center">
<TableCell style={headStyle} align="center">
Aksi
</TableCell> */}
</TableCell>
</TableRow>
</TableBody>
{dataTableIsLoading ? (