update approval di list approval
This commit is contained in:
@@ -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