fitur is reversal
This commit is contained in:
@@ -71,6 +71,17 @@ class ClaimRequestShowResource extends JsonResource
|
||||
'total_excess_paid' => $total_excess_paid,
|
||||
];
|
||||
|
||||
$isReversal = false;
|
||||
$isRole = auth()->user()->role_id;
|
||||
if ($data['request_log']['status'] == 'approved' &&
|
||||
$data['request_log']['status_final_log'] == 'approved' &&
|
||||
$data['status'] == 'approved' &&
|
||||
$data['status_claim_management'] == 'approved' &&
|
||||
$isRole != 1 // is admin
|
||||
){
|
||||
$isReversal = true;
|
||||
}
|
||||
|
||||
|
||||
$response = [
|
||||
'id' => $data['id'],
|
||||
@@ -101,6 +112,7 @@ class ClaimRequestShowResource extends JsonResource
|
||||
'files' => $data['request_log']['files'],
|
||||
'reason_decline' => $data['reason_decline'],
|
||||
// 'benefit_data' => $benefitDetailLog,
|
||||
'is_reversal' => $isReversal, // untuk penjagaan, jika true tidak bisa di edit/hapus lagi
|
||||
];
|
||||
|
||||
|
||||
|
||||
@@ -40,8 +40,19 @@ class RequestLogShowResource extends JsonResource
|
||||
$claimRequest = ClaimRequest::where('request_log_id', $requestLog['id'])->first();
|
||||
if ($claimRequest) {
|
||||
$claimCode = $claimRequest->code;
|
||||
$isReversal = false;
|
||||
$isRole = auth()->user()->role_id;
|
||||
if ($requestLog['status'] == 'approved' &&
|
||||
$requestLog['status_final_log'] == 'approved' &&
|
||||
$claimRequest->status == 'approved' &&
|
||||
$claimRequest->status_claim_management == 'approved' &&
|
||||
$isRole != 1
|
||||
){
|
||||
$isReversal = true;
|
||||
}
|
||||
} else {
|
||||
$claimCode = '-';
|
||||
$isReversal = false;
|
||||
}
|
||||
|
||||
if ($provider){
|
||||
@@ -97,7 +108,7 @@ class RequestLogShowResource extends JsonResource
|
||||
->whereIn('code', $diagnosis)
|
||||
->select('code', 'name')
|
||||
->get();
|
||||
}
|
||||
}
|
||||
|
||||
$data = [
|
||||
'id' => $requestLog['id'],
|
||||
@@ -136,6 +147,7 @@ class RequestLogShowResource extends JsonResource
|
||||
'catatan' => $requestLog['catatan'],
|
||||
'reason' => $requestLog['reason'],
|
||||
'diagnosis' => $icd,
|
||||
'is_reversal' => $isReversal, // untuk penjagaan, jika true tidak bisa di edit/hapus lagi
|
||||
|
||||
];
|
||||
|
||||
|
||||
@@ -78,15 +78,13 @@ export default function FormEdit({ isEdit, currentClaim }: Props) {
|
||||
);
|
||||
|
||||
|
||||
const [date, setDate] = useState(currentClaim?.submission_date)
|
||||
const [date, setDate] = useState(currentClaim?.submission_date ? fDateTimesecond(currentClaim?.submission_date) : null)
|
||||
const id = currentClaim?.id
|
||||
|
||||
useEffect(() => {
|
||||
setDate(currentClaim?.submission_date)
|
||||
}, [currentClaim]);
|
||||
|
||||
console.log(date);
|
||||
|
||||
useEffect(() => {
|
||||
if (isEdit && currentClaim) {
|
||||
reset(defaultValues);
|
||||
@@ -254,7 +252,6 @@ export default function FormEdit({ isEdit, currentClaim }: Props) {
|
||||
</Stack>
|
||||
)
|
||||
|
||||
|
||||
return (
|
||||
<FormProvider methods={methods} onSubmit={handleSubmit(onSubmit)}>
|
||||
<Stack direction="row" alignItems="center" sx={{ mb: 5 }}>
|
||||
@@ -310,10 +307,14 @@ export default function FormEdit({ isEdit, currentClaim }: Props) {
|
||||
<RHFDateTimePicker
|
||||
{...field}
|
||||
label="Date of Submission"
|
||||
value={field.value || null}
|
||||
onChange={() => setDate(field.value)}
|
||||
value={field.value}
|
||||
onChange={() =>
|
||||
setDate(field.value)
|
||||
}
|
||||
dateFormat='dd MMM yyyy HH:mm:ss'
|
||||
/>
|
||||
)}
|
||||
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item xs={3}>
|
||||
|
||||
@@ -52,6 +52,7 @@ export default function Detail() {
|
||||
const { themeStretch } = useSettings();
|
||||
const [claimRequests, setClaimRequest] = useState<DetailClaimRequest>();
|
||||
const [openDialogSubmit, setOpenDialogSubmit] = useState(false);
|
||||
const [isReversal, setIsReversal] = useState(false);
|
||||
|
||||
const { id } = useParams();
|
||||
|
||||
@@ -60,6 +61,7 @@ export default function Detail() {
|
||||
.get('claim-requests/detail/'+id)
|
||||
.then((response) => {
|
||||
setClaimRequest(response.data.data)
|
||||
setIsReversal(response.data.data.is_reversal)
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error(error);
|
||||
@@ -226,13 +228,18 @@ export default function Detail() {
|
||||
<Stack direction="column" spacing={2} sx={{marginBottom: 2}}>
|
||||
<Typography variant='subtitle1' sx={{color: '#19BBBB'}} gutterBottom>Document </Typography>
|
||||
</Stack>
|
||||
<Stack direction="column" spacing={2} sx={{marginBottom: 2}}>
|
||||
<Button variant="outlined" startIcon={<AddIcon/>} sx={{marginLeft: 'auto'}} onClick={() => {
|
||||
setDialogUploadFileLog(true)
|
||||
}} >
|
||||
<Typography variant="button" display="block">File</Typography>
|
||||
</Button>
|
||||
</Stack>
|
||||
{
|
||||
!isReversal ? (
|
||||
<Stack direction="column" spacing={2} sx={{marginBottom: 2}}>
|
||||
<Button variant="outlined" startIcon={<AddIcon/>} sx={{marginLeft: 'auto'}} onClick={() => {
|
||||
setDialogUploadFileLog(true)
|
||||
}} >
|
||||
<Typography variant="button" display="block">File</Typography>
|
||||
</Button>
|
||||
</Stack>
|
||||
) : null
|
||||
}
|
||||
|
||||
</Stack>
|
||||
{claimRequests?.files?.map((documentType, index) => (
|
||||
<Stack direction="row" alignItems="center" justifyContent="space-between" sx={{marginBottom: 2}} key={index}>
|
||||
@@ -253,14 +260,19 @@ export default function Detail() {
|
||||
<Typography variant="body1" gutterBottom>{documentType.original_name ? documentType.original_name : '-'}</Typography>
|
||||
</a>
|
||||
</Stack>
|
||||
<Stack direction="column" spacing={2}>
|
||||
<IconButton onClick={() => {
|
||||
setDialogDeleteFileLog(true)
|
||||
setPathFile(documentType.path)
|
||||
}} aria-label="delete" size="small" sx={{ marginLeft: 'auto' }}>
|
||||
<Delete color='error' fontSize="small" />
|
||||
</IconButton>
|
||||
</Stack>
|
||||
{
|
||||
!isReversal ? (
|
||||
<Stack direction="column" spacing={2}>
|
||||
<IconButton onClick={() => {
|
||||
setDialogDeleteFileLog(true)
|
||||
setPathFile(documentType.path)
|
||||
}} aria-label="delete" size="small" sx={{ marginLeft: 'auto' }}>
|
||||
<Delete color='error' fontSize="small" />
|
||||
</IconButton>
|
||||
</Stack>
|
||||
) : null
|
||||
}
|
||||
|
||||
</Stack>
|
||||
))}
|
||||
|
||||
@@ -284,11 +296,15 @@ export default function Detail() {
|
||||
<Card sx={{padding:2}} >
|
||||
<Stack direction="row" alignItems="center" sx={{marginBottom: 4}}>
|
||||
<Typography variant='subtitle1' sx={{color: '#19BBBB'}} gutterBottom>Benefit</Typography>
|
||||
<Button variant="outlined" startIcon={<AddIcon/>} sx={{marginLeft: 'auto'}} onClick={() => {
|
||||
setDialogBenefit(true);
|
||||
}} >
|
||||
<Typography variant="button" display="block">Benefit</Typography>
|
||||
</Button>
|
||||
{
|
||||
!isReversal ? (
|
||||
<Button variant="outlined" startIcon={<AddIcon/>} sx={{marginLeft: 'auto'}} onClick={() => {
|
||||
setDialogBenefit(true);
|
||||
}} >
|
||||
<Typography variant="button" display="block">Benefit</Typography>
|
||||
</Button>
|
||||
) : null
|
||||
}
|
||||
</Stack>
|
||||
|
||||
<Box sx={{ border: '1px solid rgba(0,0,0,0.125)', px: '24px', py: '20px', marginBottom: '24px', borderRadius: '12px'}}>
|
||||
@@ -301,29 +317,34 @@ export default function Detail() {
|
||||
{item.benefit?.description}
|
||||
</Typography>
|
||||
</Grid>
|
||||
<Grid item xs={6} sx={{ display: 'flex', placeContent: 'end' }}>
|
||||
<MoreMenu actions={
|
||||
<>
|
||||
<MenuItem onClick={() => {
|
||||
setDialogEditBenefit(true)
|
||||
setIdBenefitData(item.id)
|
||||
setBenefitConfigurationData(item)
|
||||
}}
|
||||
>
|
||||
<EditOutlined />
|
||||
Edit
|
||||
</MenuItem>
|
||||
<MenuItem onClick={() => {
|
||||
setIdBenefitData(item.id)
|
||||
setDialogDeleteBenefit(true)
|
||||
}}
|
||||
>
|
||||
<Delete color='error'/>
|
||||
Delete
|
||||
</MenuItem>
|
||||
</>
|
||||
} />
|
||||
</Grid>
|
||||
{
|
||||
!isReversal ? (
|
||||
<Grid item xs={6} sx={{ display: 'flex', placeContent: 'end' }}>
|
||||
<MoreMenu actions={
|
||||
<>
|
||||
<MenuItem onClick={() => {
|
||||
setDialogEditBenefit(true)
|
||||
setIdBenefitData(item.id)
|
||||
setBenefitConfigurationData(item)
|
||||
}}
|
||||
>
|
||||
<EditOutlined />
|
||||
Edit
|
||||
</MenuItem>
|
||||
<MenuItem onClick={() => {
|
||||
setIdBenefitData(item.id)
|
||||
setDialogDeleteBenefit(true)
|
||||
}}
|
||||
>
|
||||
<Delete color='error'/>
|
||||
Delete
|
||||
</MenuItem>
|
||||
</>
|
||||
} />
|
||||
</Grid>
|
||||
) : null
|
||||
}
|
||||
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid item xs={12} py={2}>
|
||||
|
||||
@@ -68,6 +68,7 @@ export default function Detail() {
|
||||
const navigate = useNavigate();
|
||||
const { themeStretch } = useSettings();
|
||||
const [requestLog, setRequestLog] = useState<DetailFinalLogType>();
|
||||
const [isReversal, setIsReversal] = useState(false);
|
||||
|
||||
|
||||
const { id } = useParams();
|
||||
@@ -77,6 +78,7 @@ export default function Detail() {
|
||||
.get('customer-service/request/'+id)
|
||||
.then((response) => {
|
||||
setRequestLog(response.data.data)
|
||||
setIsReversal(response.data.data.is_reversal)
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error(error);
|
||||
@@ -283,11 +285,15 @@ export default function Detail() {
|
||||
<Card sx={{padding:2}} >
|
||||
<Stack direction="row" alignItems="center" sx={{marginBottom: 4}}>
|
||||
<Typography variant='subtitle1' sx={{color: '#19BBBB'}} gutterBottom>Benefit</Typography>
|
||||
<Button variant="outlined" startIcon={<AddIcon/>} sx={{marginLeft: 'auto'}} onClick={() => {
|
||||
setDialogBenefit(true);
|
||||
}} >
|
||||
<Typography variant="button" display="block">Benefit</Typography>
|
||||
</Button>
|
||||
{
|
||||
!isReversal ? (
|
||||
<Button variant="outlined" startIcon={<AddIcon/>} sx={{marginLeft: 'auto'}} onClick={() => {
|
||||
setDialogBenefit(true);
|
||||
}} >
|
||||
<Typography variant="button" display="block">Benefit</Typography>
|
||||
</Button>
|
||||
) : null
|
||||
}
|
||||
</Stack>
|
||||
|
||||
{requestLog?.benefit_data?.map((item, index) => (
|
||||
@@ -300,29 +306,33 @@ export default function Detail() {
|
||||
{item.benefit?.description}
|
||||
</Typography>
|
||||
</Grid>
|
||||
<Grid item xs={6} sx={{ display: 'flex', placeContent: 'end' }}>
|
||||
<MoreMenu actions={
|
||||
<>
|
||||
<MenuItem onClick={() => {
|
||||
setDialogEditBenefit(true)
|
||||
setIdBenefitData(item.id)
|
||||
setBenefitConfigurationData(item)
|
||||
}}
|
||||
>
|
||||
<EditOutlined />
|
||||
Edit
|
||||
</MenuItem>
|
||||
<MenuItem onClick={() => {
|
||||
setIdBenefitData(item.id)
|
||||
setDialogDeleteBenefit(true)
|
||||
}}
|
||||
>
|
||||
<Delete color='error'/>
|
||||
Delete
|
||||
</MenuItem>
|
||||
</>
|
||||
} />
|
||||
</Grid>
|
||||
{
|
||||
!isReversal ? (
|
||||
<Grid item xs={6} sx={{ display: 'flex', placeContent: 'end' }}>
|
||||
<MoreMenu actions={
|
||||
<>
|
||||
<MenuItem onClick={() => {
|
||||
setDialogEditBenefit(true)
|
||||
setIdBenefitData(item.id)
|
||||
setBenefitConfigurationData(item)
|
||||
}}
|
||||
>
|
||||
<EditOutlined />
|
||||
Edit
|
||||
</MenuItem>
|
||||
<MenuItem onClick={() => {
|
||||
setIdBenefitData(item.id)
|
||||
setDialogDeleteBenefit(true)
|
||||
}}
|
||||
>
|
||||
<Delete color='error'/>
|
||||
Delete
|
||||
</MenuItem>
|
||||
</>
|
||||
} />
|
||||
</Grid>
|
||||
) : null
|
||||
}
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid item xs={12}>
|
||||
@@ -598,13 +608,16 @@ export default function Detail() {
|
||||
<Stack direction="column" spacing={2} sx={{marginBottom: 2}}>
|
||||
<Typography variant='subtitle1' sx={{color: '#19BBBB'}} gutterBottom>Files </Typography>
|
||||
</Stack>
|
||||
<Stack direction="column" spacing={2} sx={{marginBottom: 2}}>
|
||||
<Button variant="outlined" startIcon={<AddIcon/>} sx={{marginLeft: 'auto'}} onClick={() => {
|
||||
setDialogUploadFileLog(true)
|
||||
}} >
|
||||
<Typography variant="button" display="block">Files</Typography>
|
||||
</Button>
|
||||
</Stack>
|
||||
{ !isReversal ? (
|
||||
<Stack direction="column" spacing={2} sx={{marginBottom: 2}}>
|
||||
<Button variant="outlined" startIcon={<AddIcon/>} sx={{marginLeft: 'auto'}} onClick={() => {
|
||||
setDialogUploadFileLog(true)
|
||||
}} >
|
||||
<Typography variant="button" display="block">Files</Typography>
|
||||
</Button>
|
||||
</Stack>
|
||||
) : null }
|
||||
|
||||
</Stack>
|
||||
{requestLog?.files?.map((documentType, index) => (
|
||||
<Stack direction="row" alignItems="center" justifyContent="space-between" sx={{marginBottom: 2}} key={index}>
|
||||
@@ -617,14 +630,17 @@ export default function Detail() {
|
||||
<Typography variant="body2" gutterBottom>{documentType.original_name ? documentType.original_name : '-'}</Typography>
|
||||
</a>
|
||||
</Stack>
|
||||
<Stack direction="column" spacing={2}>
|
||||
<IconButton onClick={() => {
|
||||
setDialogDeleteFileLog(true)
|
||||
setPathFile(documentType.path)
|
||||
}} aria-label="delete" size="small" sx={{ marginLeft: 'auto' }}>
|
||||
<Delete color='error' fontSize="small" />
|
||||
</IconButton>
|
||||
</Stack>
|
||||
{ !isReversal ? (
|
||||
<Stack direction="column" spacing={2}>
|
||||
<IconButton onClick={() => {
|
||||
setDialogDeleteFileLog(true)
|
||||
setPathFile(documentType.path)
|
||||
}} aria-label="delete" size="small" sx={{ marginLeft: 'auto' }}>
|
||||
<Delete color='error' fontSize="small" />
|
||||
</IconButton>
|
||||
</Stack>
|
||||
) : null }
|
||||
|
||||
</Stack>
|
||||
))}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user