tambah informasi partner / rekanan hospital

This commit is contained in:
2024-02-01 15:54:29 +07:00
parent 0657448ef8
commit 1dc7b99d42
3 changed files with 37 additions and 10 deletions

View File

@@ -3,6 +3,7 @@
namespace Modules\Internal\Transformers; namespace Modules\Internal\Transformers;
use Illuminate\Http\Resources\Json\JsonResource; use Illuminate\Http\Resources\Json\JsonResource;
use App\Models\Corporate;
class OrganizationResource extends JsonResource class OrganizationResource extends JsonResource
{ {
@@ -14,7 +15,20 @@ class OrganizationResource extends JsonResource
*/ */
public function toArray($request) 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 = [ $organization = [
'id' => $this->id, 'id' => $this->id,
'name' => $this->name, 'name' => $this->name,
@@ -32,6 +46,7 @@ class OrganizationResource extends JsonResource
'village_id' => $this->currentAddress->village_id ?? null, 'village_id' => $this->currentAddress->village_id ?? null,
'postal_code' => $this->currentAddress->postal_code ?? null, 'postal_code' => $this->currentAddress->postal_code ?? null,
'corporate_id_partner' => $this->corporate_id_partner ?? null, 'corporate_id_partner' => $this->corporate_id_partner ?? null,
'corporate_name' => $corporatePartner,
'active' => $this->status == 'active' ? 1 : 0, 'active' => $this->status == 'active' ? 1 : 0,
]; ];

View File

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

View File

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