Update Approve Claim
This commit is contained in:
@@ -240,7 +240,7 @@ export default function Detail() {
|
||||
<Stack direction="row" padding={4}>
|
||||
{dataDialog && dataDialog.status === 'requested' ? (
|
||||
<>
|
||||
<Button variant="outlined" sx={{color: '#212B36', marginLeft: 'auto'}} >Cancel</Button>
|
||||
<Button variant="outlined" sx={{color: '#212B36', marginLeft: 'auto', borderColor: '#919EAB52'}} >Cancel</Button>
|
||||
<Button sx={{backgroundColor: '#19BBBB', marginLeft: 1}} variant="contained" onClick={()=> setOpenDialogSubmit(true)}>Submit</Button>
|
||||
</>
|
||||
) : ''}
|
||||
@@ -288,7 +288,7 @@ export default function Detail() {
|
||||
) : ''}
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<Button variant="outlined" sx={{color: '#212B36'}} onClick={handleCloseDialogSubmit}>Cancel</Button>
|
||||
<Button variant="outlined" sx={{color: '#212B36', borderColor: '#919EAB52'}} onClick={handleCloseDialogSubmit}>Cancel</Button>
|
||||
<Button sx={{backgroundColor: '#19BBBB'}} onClick={handleSubmitData} variant="contained">Submit</Button>
|
||||
</DialogActions>
|
||||
</Dialog>
|
||||
|
||||
@@ -61,6 +61,7 @@ export default function Detail() {
|
||||
const [requestDocumentData, setRequestDocumentData] = useState(null);
|
||||
const [serviceData, setServiceData] = useState(null);
|
||||
const [serviceBenefitData, setServiceBenefitData] = useState(null);
|
||||
const [dataDialog, setDataDialog] = useState(null);
|
||||
|
||||
const { id } = useParams();
|
||||
|
||||
@@ -73,6 +74,7 @@ export default function Detail() {
|
||||
setRequestDocumentData(response.data.data.request_documents);
|
||||
setServiceData(response.data.data.claim_services);
|
||||
setServiceBenefitData(response.data.data.claim_service_benefits);
|
||||
setDataDialog(response.data.data.dialog_submits);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error(error);
|
||||
@@ -258,6 +260,45 @@ export default function Detail() {
|
||||
})
|
||||
}
|
||||
|
||||
const [openDialogSubmit, setOpenDialogSubmit] = useState(false);
|
||||
const handleCloseDialogSubmit = () => {
|
||||
setOpenDialogSubmit(false);
|
||||
}
|
||||
|
||||
const [decline, setDeclaine] = useState('');
|
||||
|
||||
const handleSubmitData = () => {
|
||||
//approve or decline
|
||||
axios
|
||||
.post('claims/'+id+'/'+decline)
|
||||
.then((response) => {
|
||||
enqueueSnackbar('Success '+toTitleCase(decline)+' Claim Request', { variant: 'success' });
|
||||
setOpenDialogSubmit(false);
|
||||
})
|
||||
.catch(({ response }) => {
|
||||
enqueueSnackbar(response.data.message ?? 'Something went wrong!', { variant: 'error' });
|
||||
});
|
||||
|
||||
setTimeout(() =>
|
||||
{
|
||||
window.location.reload();
|
||||
}, 5000);
|
||||
|
||||
};
|
||||
|
||||
const handelDownloadLog = () => {
|
||||
axios
|
||||
.get(`final-log/${id}`, {
|
||||
responseType: 'blob',
|
||||
})
|
||||
.then((response) => {
|
||||
window.open(URL.createObjectURL(response.data));
|
||||
})
|
||||
.catch((response) => {
|
||||
enqueueSnackbar(response.message, { variant: 'error' });
|
||||
});
|
||||
}
|
||||
|
||||
return (
|
||||
<Page title='Detail'>
|
||||
<Container maxWidth={themeStretch ? false : 'xl'}>
|
||||
@@ -679,9 +720,100 @@ export default function Detail() {
|
||||
<Grid item xs={12} md={12}>
|
||||
<Stack direction="row" padding={4}>
|
||||
<>
|
||||
<Button variant="outlined" sx={{color: '#FF4842', borderColor: '#FF4842', marginLeft: 'auto'}} >Decline</Button>
|
||||
<Button sx={{backgroundColor: '#19BBBB', marginLeft: 1}} variant="contained" onClick={()=> setOpenDialogSubmit(true)}>Submit</Button>
|
||||
{(customerData && customerData.status === 'received') ? (
|
||||
<>
|
||||
<Button
|
||||
variant="outlined"
|
||||
sx={{color: '#FF4842', borderColor: '#FF4842', marginLeft: 'auto'}}
|
||||
onClick={() => {
|
||||
setOpenDialogSubmit(true);
|
||||
setDeclaine('decline');
|
||||
}}
|
||||
>
|
||||
Decline
|
||||
</Button>
|
||||
<Button
|
||||
sx={{backgroundColor: '#19BBBB', marginLeft: 1}}
|
||||
variant="contained"
|
||||
onClick={()=> {
|
||||
setOpenDialogSubmit(true);
|
||||
setDeclaine('approve');
|
||||
}}
|
||||
>
|
||||
Approve
|
||||
</Button>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Button
|
||||
variant="outlined"
|
||||
sx={{color: '#212B36', borderColor: '#919EAB52', marginLeft: 'auto'}}
|
||||
onClick={handelDownloadLog}
|
||||
>
|
||||
Download Final LOG
|
||||
</Button>
|
||||
<Button
|
||||
sx={{backgroundColor: '#19BBBB', marginLeft: 1}}
|
||||
variant="contained"
|
||||
onClick={()=> {
|
||||
setOpenDialogSubmit(true);
|
||||
setDeclaine('re-open');
|
||||
}}
|
||||
>
|
||||
Re-Open
|
||||
</Button>
|
||||
</>
|
||||
) }
|
||||
|
||||
</>
|
||||
{/* Dialog Submits */}
|
||||
<Dialog open={openDialogSubmit} onClose={handleCloseDialogSubmit} fullWidth={true}>
|
||||
<DialogTitle sx={{ backgroundColor: '#19BBBB', color: '#FFF', padding: 2 }}>
|
||||
<Stack direction="row" alignItems="center" justifyContent="space-between">
|
||||
<Stack direction="row" alignItems='center' spacing={1}>
|
||||
<Typography variant="h6">Confirmation</Typography>
|
||||
</Stack>
|
||||
<IconButton sx={{ color: '#FFF' }} onClick={handleCloseDialogSubmit}>
|
||||
<CloseIcon />
|
||||
</IconButton>
|
||||
</Stack>
|
||||
</DialogTitle>
|
||||
<DialogContent>
|
||||
{dataDialog ? (
|
||||
<Stack spacing={2} padding={2}>
|
||||
<Typography variant='body1'>Are you sure to {toTitleCase(decline)} this claim ?</Typography>
|
||||
<Card sx={{padding:2}} >
|
||||
<Stack direction='row' spacing={2}>
|
||||
<Typography variant='subtitle2' sx={{color: '#919EAB', width: '30%'}}>Code</Typography>
|
||||
<Typography variant='subtitle2' sx={{width: '70%'}}>{dataDialog.code}</Typography>
|
||||
</Stack>
|
||||
<Stack direction='row' spacing={2}>
|
||||
<Typography variant='subtitle2' sx={{color: '#919EAB', width: '30%'}}>Name</Typography>
|
||||
<Typography variant='subtitle2' sx={{width: '70%'}}>{dataDialog.name}</Typography>
|
||||
</Stack>
|
||||
<Stack direction='row' spacing={2}>
|
||||
<Typography variant='subtitle2' sx={{color: '#919EAB', width: '30%'}}>Date Submission</Typography>
|
||||
<Typography variant='subtitle2' sx={{width: '70%'}}>{fDateTime(dataDialog.submission_date)}</Typography>
|
||||
</Stack>
|
||||
<Stack direction='row' spacing={2}>
|
||||
<Typography variant='subtitle2' sx={{color: '#919EAB', width: '30%'}}>Claim Method</Typography>
|
||||
<Typography variant='subtitle2' sx={{width: '70%'}}>Service Type</Typography>
|
||||
</Stack>
|
||||
<Stack direction='row' spacing={2}>
|
||||
<Typography variant='subtitle2' sx={{color: '#919EAB', width: '30%'}}>Service Type</Typography>
|
||||
<Typography variant='subtitle2' sx={{width: '70%'}}>
|
||||
{dataDialog.service_code === 'IP' ? 'Inpatient' : 'Outpatient'}
|
||||
</Typography>
|
||||
</Stack>
|
||||
</Card>
|
||||
</Stack>
|
||||
) : ''}
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<Button variant="outlined" sx={{color: '#212B36', borderColor: '#919EAB52'}} onClick={handleCloseDialogSubmit}>Cancel</Button>
|
||||
<Button sx={{backgroundColor: (decline === 'decline' ? '' : '#19BBBB'), color: (decline === 'decline' ? '#FF4842' : ''), borderColor: '#FF4842'}} onClick={handleSubmitData} variant={(decline === 'decline' ? 'outlined' : 'contained')}>{(decline === "decline" ? 'Decline' : (decline === "approve" ? 'Approve' : 'Re-Open'))}</Button>
|
||||
</DialogActions>
|
||||
</Dialog>
|
||||
</Stack>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
Reference in New Issue
Block a user