update import benefit
This commit is contained in:
@@ -177,6 +177,16 @@ class RequestLogService
|
|||||||
$serviceCode = 'Unk';
|
$serviceCode = 'Unk';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$benefit = Benefit::where('code', $row['benefit_id'])->first();
|
||||||
|
|
||||||
|
if (!$benefit){
|
||||||
|
$statusFinalLog = 'requested';
|
||||||
|
$final_log = 0;
|
||||||
|
} else {
|
||||||
|
$statusFinalLog = $status;
|
||||||
|
$final_log = 1;
|
||||||
|
}
|
||||||
|
|
||||||
$requestLog = RequestLog::updateOrCreate(
|
$requestLog = RequestLog::updateOrCreate(
|
||||||
[
|
[
|
||||||
'code' => $code
|
'code' => $code
|
||||||
@@ -188,8 +198,8 @@ class RequestLogService
|
|||||||
'discharge_date' => $row['submission_date'],
|
'discharge_date' => $row['submission_date'],
|
||||||
'payment_type' => 'cashless',
|
'payment_type' => 'cashless',
|
||||||
'status' => $status,
|
'status' => $status,
|
||||||
'status_final_log' => $row['status_final_log'] == 'Y' ? 1 : 0,
|
'status_final_log' => $statusFinalLog,
|
||||||
'final_log' =>$row['status_final_log'] == 'Y' ? 1 : 0,
|
'final_log' =>$final_log,
|
||||||
'import_system' =>TRUE,
|
'import_system' =>TRUE,
|
||||||
'catatan' => $row['catatan'],
|
'catatan' => $row['catatan'],
|
||||||
'policy_id' => $member->currentPolicy->id ?? null,
|
'policy_id' => $member->currentPolicy->id ?? null,
|
||||||
@@ -198,7 +208,7 @@ class RequestLogService
|
|||||||
'approved_final_log_at' => $row['approved_final_log_at'],
|
'approved_final_log_at' => $row['approved_final_log_at'],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$benefit = Benefit::where('code', $row['benefit_id'])->first();
|
|
||||||
if ($benefit) { // jika tidak ada benefit nya maka belum ngisi benefit nya
|
if ($benefit) { // jika tidak ada benefit nya maka belum ngisi benefit nya
|
||||||
RequestLogBenefit::updateOrCreate(
|
RequestLogBenefit::updateOrCreate(
|
||||||
[
|
[
|
||||||
|
|||||||
@@ -105,5 +105,7 @@ export type Import = {
|
|||||||
result_file: {
|
result_file: {
|
||||||
url: string,
|
url: string,
|
||||||
name: string,
|
name: string,
|
||||||
|
total_success_row: number,
|
||||||
|
total_failed_row: number
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -265,10 +265,19 @@ export default function List() {
|
|||||||
</LoadingButton>
|
</LoadingButton>
|
||||||
</Stack>
|
</Stack>
|
||||||
)}
|
)}
|
||||||
{importResult && (
|
|
||||||
|
{importResult && (
|
||||||
<Stack direction={'row'} sx={{ px: 2, pb: 2 }}>
|
<Stack direction={'row'} sx={{ px: 2, pb: 2 }}>
|
||||||
<Box sx={{ color: 'text.secondary' }}>
|
<Box sx={{ color: 'text.secondary' }}>
|
||||||
Last Import Result Report :{' '}
|
Last Import Result :{' '}
|
||||||
|
<Box sx={{ color: 'success.main', display: 'inline' }}>
|
||||||
|
{importResult.total_success_row ?? 0}
|
||||||
|
</Box>{' '}
|
||||||
|
Row Processed,{' '}
|
||||||
|
<Box sx={{ color: 'error.main', display: 'inline' }}>
|
||||||
|
{importResult.total_failed_row}
|
||||||
|
</Box>{' '}
|
||||||
|
Failed, Report :{' '}
|
||||||
<a href={importResult.result_file?.url ?? '#'}>
|
<a href={importResult.result_file?.url ?? '#'}>
|
||||||
{importResult.result_file?.name ?? '-'}
|
{importResult.result_file?.name ?? '-'}
|
||||||
</a>
|
</a>
|
||||||
@@ -365,7 +374,7 @@ export default function List() {
|
|||||||
<TableCell align="left">
|
<TableCell align="left">
|
||||||
{ row.status == "requested" ?
|
{ row.status == "requested" ?
|
||||||
(<Label variant='ghost' color='primary'>{capitalizeFirstLetter(row.status)}</Label>) :
|
(<Label variant='ghost' color='primary'>{capitalizeFirstLetter(row.status)}</Label>) :
|
||||||
row.status == "declined" ?
|
row.status == "declined" ?
|
||||||
(<Label color='error'> {capitalizeFirstLetter(row.status)}</Label>)
|
(<Label color='error'> {capitalizeFirstLetter(row.status)}</Label>)
|
||||||
:
|
:
|
||||||
(<Label color='success'> {capitalizeFirstLetter(row.status)}</Label>)
|
(<Label color='success'> {capitalizeFirstLetter(row.status)}</Label>)
|
||||||
@@ -378,7 +387,7 @@ export default function List() {
|
|||||||
<FindInPageOutlinedIcon />
|
<FindInPageOutlinedIcon />
|
||||||
Detail
|
Detail
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
|
|
||||||
</>
|
</>
|
||||||
} />
|
} />
|
||||||
</TableCell>
|
</TableCell>
|
||||||
|
|||||||
Reference in New Issue
Block a user