update approval di list approval
This commit is contained in:
@@ -346,6 +346,11 @@ class RequestLogController extends Controller
|
||||
$requestLog->approved_at = Carbon::now();
|
||||
}
|
||||
|
||||
if ($request->status_approval){
|
||||
$requestLog->status_approval = $request->status_approval;
|
||||
$requestLog->approval_nominal_by = auth()->user()->id;
|
||||
}
|
||||
|
||||
$requestLog->save();
|
||||
|
||||
// update nirc member
|
||||
|
||||
@@ -31,6 +31,8 @@ class RequestLogResource extends JsonResource
|
||||
'status' => $this->status ?? 'unknown',
|
||||
'provider' => $provider ? $provider->name : '-',
|
||||
'status_final_log' => $this->status_final_log ?? 'unknown',
|
||||
'nominal' => $this->nominal ?? 'unknown',
|
||||
'status_approval' => $this->status_approval ?? 'requested',
|
||||
'service_name' => $this->service ? $this->service->name : '',
|
||||
'payment_type' => $this->payment_type,
|
||||
'payment_type_name' => $this->payment_type_name,
|
||||
|
||||
@@ -175,10 +175,11 @@ class RequestLogShowResource extends JsonResource
|
||||
'hak_kamar_pasien' => $requestLog['hak_kamar_pasien'],
|
||||
'penempatan_kamar' => $requestLog['penempatan_kamar'],
|
||||
'nominal' => $requestLog['nominal'],
|
||||
'status_approval' => $requestLog['status_approval'],
|
||||
'catatan' => $requestLog['catatan'],
|
||||
'reason' => $requestLog['reason'],
|
||||
'diagnosis' => $icd,
|
||||
'url_approval' => env('LMS_WEB_URL') . '/custormer-service/final-log/detail/'.$requestLog['id'],
|
||||
'url_approval' => env('LMS_WEB_URL') . '/custormer-service/final-log/detail/'.$requestLog['id'] . '/' . auth()->user()->id,
|
||||
'is_reversal' => $isReversal, // untuk penjagaan, jika true tidak bisa di edit/hapus lagi
|
||||
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ class RequestLog extends Model
|
||||
'final_log',
|
||||
'status',
|
||||
'status_final_log',
|
||||
'status_approval',
|
||||
'source',
|
||||
'claim_id',
|
||||
'organization_id',
|
||||
@@ -55,6 +56,7 @@ class RequestLog extends Model
|
||||
'dppj',
|
||||
'type_of_member',
|
||||
'nominal',
|
||||
'approval_nominal_by',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
|
||||
@@ -15,6 +15,8 @@ return new class extends Migration
|
||||
{
|
||||
Schema::table('request_logs', function (Blueprint $table) {
|
||||
$table->integer('nominal')->default(0)->after('total_cob');
|
||||
$table->string('status_approval')->nullable()->after('status_final_log');
|
||||
$table->integer('approval_nominal_by')->nullable()->after('status_approval');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -27,6 +29,8 @@ return new class extends Migration
|
||||
{
|
||||
Schema::table('table_request_log', function (Blueprint $table) {
|
||||
$table->dropColumn('nominal');
|
||||
$table->dropColumn('status_approval');
|
||||
$table->dropColumn('approval_nominal_by');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -367,6 +367,39 @@ export default function List() {
|
||||
};
|
||||
}
|
||||
|
||||
const updateApproval = async (id:any) => {
|
||||
axios
|
||||
.put(`/customer-service/request/${id}`, {
|
||||
status_approval: 'approved',
|
||||
})
|
||||
.then((response) => {
|
||||
enqueueSnackbar('Berhasil Approve', { variant: 'success' });
|
||||
window.location.reload();
|
||||
})
|
||||
.catch(({ response }) => {
|
||||
enqueueSnackbar(response?.data?.message || 'Something Went Wrong', { variant: 'error' });
|
||||
})
|
||||
.finally(() => {
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
const updateDecline = async (id:any) => {
|
||||
axios
|
||||
.put(`/customer-service/request/${id}`, {
|
||||
status_approval: 'declined',
|
||||
})
|
||||
.then((response) => {
|
||||
enqueueSnackbar('Berhasil Approve', { variant: 'success' });
|
||||
window.location.reload();
|
||||
})
|
||||
.catch(({ response }) => {
|
||||
enqueueSnackbar(response?.data?.message || 'Something Went Wrong', { variant: 'error' });
|
||||
})
|
||||
.finally(() => {
|
||||
});
|
||||
}
|
||||
|
||||
{
|
||||
/* ------------------ TABLE ROW ------------------ */
|
||||
}
|
||||
@@ -423,14 +456,38 @@ export default function List() {
|
||||
)}
|
||||
</TableCell>
|
||||
<TableCell align="left">
|
||||
{ row.status_final_log == "requested" ?
|
||||
(<Label variant='ghost' color='primary'>{capitalizeFirstLetter(row.status_final_log)}</Label>) :
|
||||
row.status_final_log == "declined" ?
|
||||
(<Label color='error'> {capitalizeFirstLetter(row.status_final_log)}</Label>)
|
||||
{ row.status_approval == "requested" ?
|
||||
(<Label variant='ghost' color='primary'>{capitalizeFirstLetter(row.status_approval)}</Label>) :
|
||||
row.status_approval == "declined" ?
|
||||
(<Label color='error'> {capitalizeFirstLetter(row.status_approval)}</Label>)
|
||||
:
|
||||
(<Label color='success'> {capitalizeFirstLetter(row.status_final_log)}</Label>)
|
||||
(<Label color='success'> {capitalizeFirstLetter(row.status_approval)}</Label>)
|
||||
}
|
||||
</TableCell>
|
||||
<TableCell align="left">{fCurrency(row.nominal)}</TableCell>
|
||||
<TableCell align="left">
|
||||
{row.status_approval !== "approved" && (
|
||||
<Stack direction="row" spacing={1.5} mt={2}>
|
||||
<Button
|
||||
color="error"
|
||||
variant="outlined"
|
||||
size="small"
|
||||
onClick={() => updateDecline(row.id)}
|
||||
>
|
||||
Decline
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
variant="contained"
|
||||
size="small"
|
||||
color="primary"
|
||||
onClick={() => updateApproval(row.id)}
|
||||
>
|
||||
Approve
|
||||
</Button>
|
||||
</Stack>
|
||||
)}
|
||||
</TableCell>
|
||||
<TableCell align="right">
|
||||
<TableMoreMenu actions={
|
||||
<>
|
||||
@@ -575,6 +632,12 @@ export default function List() {
|
||||
<TableCell style={headStyle} align="left">
|
||||
Status
|
||||
</TableCell>
|
||||
<TableCell style={headStyle} align="left">
|
||||
Nominal
|
||||
</TableCell>
|
||||
<TableCell style={headStyle} align="left">
|
||||
Action
|
||||
</TableCell>
|
||||
<TableCell style={headStyle} align="right"></TableCell>
|
||||
</TableRow>
|
||||
</TableHead>
|
||||
|
||||
@@ -117,6 +117,43 @@ export default function Detail() {
|
||||
});
|
||||
}
|
||||
|
||||
const updateApproval = async () => {
|
||||
setSubmitLoading(true);
|
||||
axios
|
||||
.put(`/customer-service/request/${id}`, {
|
||||
status_approval: 'approved',
|
||||
})
|
||||
.then((response) => {
|
||||
enqueueSnackbar('Berhasil Approve', { variant: 'success' });
|
||||
window.location.reload();
|
||||
})
|
||||
.catch(({ response }) => {
|
||||
enqueueSnackbar(response?.data?.message || 'Something Went Wrong', { variant: 'error' });
|
||||
})
|
||||
.finally(() => {
|
||||
setSubmitLoading(false);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
const updateDecline = async () => {
|
||||
setSubmitLoading(true);
|
||||
axios
|
||||
.put(`/customer-service/request/${id}`, {
|
||||
status_approval: 'declined',
|
||||
})
|
||||
.then((response) => {
|
||||
enqueueSnackbar('Berhasil Approve', { variant: 'success' });
|
||||
window.location.reload();
|
||||
})
|
||||
.catch(({ response }) => {
|
||||
enqueueSnackbar(response?.data?.message || 'Something Went Wrong', { variant: 'error' });
|
||||
})
|
||||
.finally(() => {
|
||||
setSubmitLoading(false);
|
||||
});
|
||||
}
|
||||
|
||||
const { id, approval } = useParams();
|
||||
|
||||
useEffect(() => {
|
||||
@@ -457,13 +494,14 @@ export default function Detail() {
|
||||
/>
|
||||
</ButtonBase>
|
||||
</Stack>
|
||||
<RHFTextFieldMoney
|
||||
id='nominal'
|
||||
name={`nominal`}
|
||||
<RHFTextFieldMoney
|
||||
id="nominal"
|
||||
name="nominal"
|
||||
label="Nominal"
|
||||
required
|
||||
placeholder="Nominal"
|
||||
value={requestLog?.nominal || 0}
|
||||
disabled={!!approval}
|
||||
/>
|
||||
|
||||
{/* <LoadingButton
|
||||
@@ -474,81 +512,77 @@ export default function Detail() {
|
||||
>
|
||||
Simpan
|
||||
</LoadingButton> */}
|
||||
<Stack direction="row" spacing={2} sx={{ mt: 6 }}>
|
||||
<Stack direction="row" spacing={2} sx={{ mt: 6 }}>
|
||||
{approval ? (
|
||||
<>
|
||||
<Box sx={{ flexGrow: 1 }} />
|
||||
{/* GRUP TOMBOL DI KANAN */}
|
||||
<Stack direction="row" spacing={1.5} mt={2}>
|
||||
<Button
|
||||
color='error'
|
||||
variant="outlined"
|
||||
size="small"
|
||||
onClick={() => {
|
||||
setDialogSendWa(true);
|
||||
setShareLink(false);
|
||||
}}
|
||||
>
|
||||
Decline
|
||||
</Button>
|
||||
<Box sx={{ flexGrow: 1 }} />
|
||||
{/* GRUP TOMBOL DI KANAN */}
|
||||
{requestLog?.status_approval !== 'approved' && (
|
||||
<Stack direction="row" spacing={1.5} mt={2}>
|
||||
<Button
|
||||
color="error"
|
||||
variant="outlined"
|
||||
size="small"
|
||||
onClick={updateDecline}
|
||||
>
|
||||
Decline
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
variant="contained"
|
||||
size="small"
|
||||
color='primary'
|
||||
onClick={() => {
|
||||
setDialogSendWa(true);
|
||||
setShareLink(true);
|
||||
}}
|
||||
>
|
||||
Approve
|
||||
</Button>
|
||||
</Stack>
|
||||
<Button
|
||||
variant="contained"
|
||||
size="small"
|
||||
color="primary"
|
||||
onClick={updateApproval}
|
||||
>
|
||||
Approve
|
||||
</Button>
|
||||
</Stack>
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
) : (
|
||||
<>
|
||||
{/* TOMBOL SIMPAN DI KIRI */}
|
||||
<LoadingButton
|
||||
{/* TOMBOL SIMPAN DI KIRI */}
|
||||
<LoadingButton
|
||||
type="submit"
|
||||
variant="contained"
|
||||
sx={{ p: 2, backgroundColor: "#19BBBB" }}
|
||||
loading={false}
|
||||
size="small"
|
||||
>
|
||||
>
|
||||
Simpan
|
||||
</LoadingButton>
|
||||
</LoadingButton>
|
||||
|
||||
{/* Ini adalah spacer untuk mendorong tombol berikutnya ke kanan */}
|
||||
<Box sx={{ flexGrow: 1 }} />
|
||||
{/* Ini adalah spacer untuk mendorong tombol berikutnya ke kanan */}
|
||||
<Box sx={{ flexGrow: 1 }} />
|
||||
|
||||
{/* GRUP TOMBOL DI KANAN */}
|
||||
<Stack direction="row" spacing={1.5} mt={2}>
|
||||
{/* GRUP TOMBOL DI KANAN */}
|
||||
<Stack direction="row" spacing={1.5} mt={2}>
|
||||
<Button
|
||||
variant="contained"
|
||||
size="small"
|
||||
sx={{ p: 2, backgroundColor: "#19BBBB" }}
|
||||
onClick={() => {
|
||||
variant="contained"
|
||||
size="small"
|
||||
sx={{ p: 2, backgroundColor: "#19BBBB" }}
|
||||
onClick={() => {
|
||||
setDialogSendWa(true);
|
||||
setShareLink(false);
|
||||
}}
|
||||
}}
|
||||
>
|
||||
Kirim (WA Chatbot)
|
||||
Kirim (WA Chatbot)
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
variant="contained"
|
||||
size="small"
|
||||
sx={{ p: 2, backgroundColor: "#19BBBB" }}
|
||||
onClick={() => {
|
||||
variant="contained"
|
||||
size="small"
|
||||
sx={{ p: 2, backgroundColor: "#19BBBB" }}
|
||||
onClick={() => {
|
||||
setDialogSendWa(true);
|
||||
setShareLink(true);
|
||||
}}
|
||||
}}
|
||||
>
|
||||
Share Link
|
||||
Share Link
|
||||
</Button>
|
||||
</Stack>
|
||||
</Stack>
|
||||
</>
|
||||
)}
|
||||
)}
|
||||
</Stack>
|
||||
|
||||
</Stack>
|
||||
@@ -1009,8 +1043,7 @@ export default function Detail() {
|
||||
variant="outlined"
|
||||
sx={{ color: '#FF4842', borderColor: '#FF4842' }}
|
||||
onClick={() => {
|
||||
setOpenDialogSubmit(true);
|
||||
setApprove('declined');
|
||||
|
||||
}}
|
||||
>
|
||||
Decline
|
||||
|
||||
@@ -21,6 +21,8 @@ export type FinalLogType = {
|
||||
service_name : string,
|
||||
payment_type_name : string,
|
||||
status_final_log : string,
|
||||
status_approval : string,
|
||||
nominal : number,
|
||||
provider : string,
|
||||
status : string,
|
||||
files_by_type : files_by_type,
|
||||
@@ -43,12 +45,12 @@ export type DetailFinalLogType = {
|
||||
marital_status : string,
|
||||
admission_date : string,
|
||||
submission_date : string,
|
||||
admission_date : string,
|
||||
approved_final_log_at : string,
|
||||
service_type : string,
|
||||
claim_method : string,
|
||||
status : string,
|
||||
status_final_log : string,
|
||||
status_approval : string,
|
||||
no_identitas : string,
|
||||
keterangan : string,
|
||||
hak_kamar_pasien : string,
|
||||
|
||||
Reference in New Issue
Block a user