Merge remote-tracking branch 'origin/staging' into origin/production
This commit is contained in:
@@ -312,6 +312,7 @@ class ClaimController extends Controller
|
|||||||
->leftJoin('corporate_employees','corporate_employees.member_id','=','members.id')
|
->leftJoin('corporate_employees','corporate_employees.member_id','=','members.id')
|
||||||
->where('corporate_employees.corporate_id', '=', $corporate_id)
|
->where('corporate_employees.corporate_id', '=', $corporate_id)
|
||||||
->where('request_logs.status_final_log', '=', 'approved')
|
->where('request_logs.status_final_log', '=', 'approved')
|
||||||
|
->where('request_logs.deleted_at', '=', null)
|
||||||
->when($start != 'all' && $end != 'all', function ($query) use ($start, $end) {
|
->when($start != 'all' && $end != 'all', function ($query) use ($start, $end) {
|
||||||
$query->where('request_logs.submission_date', '>=', $start)
|
$query->where('request_logs.submission_date', '>=', $start)
|
||||||
->where('request_logs.submission_date', '<=', $end);
|
->where('request_logs.submission_date', '<=', $end);
|
||||||
|
|||||||
@@ -163,6 +163,7 @@ class RequestLogController extends Controller
|
|||||||
|
|
||||||
$results = DB::table('request_logs')
|
$results = DB::table('request_logs')
|
||||||
->leftJoin('members', 'request_logs.member_id', '=', 'members.id')
|
->leftJoin('members', 'request_logs.member_id', '=', 'members.id')
|
||||||
|
->where('request_logs.deleted_at', null)
|
||||||
->when($request->input('search'), function ($query, $search) {
|
->when($request->input('search'), function ($query, $search) {
|
||||||
$query->where(function ($query) use ($search) {
|
$query->where(function ($query) use ($search) {
|
||||||
$query->orWhere('request_logs.code', 'like', "%" . $search . "%")
|
$query->orWhere('request_logs.code', 'like', "%" . $search . "%")
|
||||||
|
|||||||
@@ -142,11 +142,29 @@ class CorporateMemberController extends Controller
|
|||||||
* @param int $id
|
* @param int $id
|
||||||
* @return Renderable
|
* @return Renderable
|
||||||
*/
|
*/
|
||||||
public function update(Request $request, $id)
|
public function update(Request $request)
|
||||||
{
|
{
|
||||||
//
|
$member = Member::where('member_id', $request->member_id)->first();
|
||||||
|
|
||||||
|
if ($member) {
|
||||||
|
$member->update([
|
||||||
|
'birth_date' => $request->birth_date,
|
||||||
|
'gender' => $request->gender,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'member' => $member,
|
||||||
|
'message' => 'Status by member id Updated Successfully'
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
return response()->json([
|
||||||
|
'member' => null,
|
||||||
|
'message' => 'Gagal update, member tidak ditemukan'
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the specified resource from storage.
|
* Remove the specified resource from storage.
|
||||||
* @param int $id
|
* @param int $id
|
||||||
|
|||||||
@@ -52,6 +52,10 @@ class RequestLogController extends Controller
|
|||||||
public function index(Request $request)
|
public function index(Request $request)
|
||||||
{
|
{
|
||||||
$requestLog = RequestLog::query()
|
$requestLog = RequestLog::query()
|
||||||
|
->where('deleted_at', null)
|
||||||
|
->when($request->final_log, function($q, $final_log) {
|
||||||
|
$q->where('final_log', $final_log);
|
||||||
|
})
|
||||||
->when($request->search, function ($q, $search) {
|
->when($request->search, function ($q, $search) {
|
||||||
$q->where('code', 'LIKE', "%".$search."%");
|
$q->where('code', 'LIKE', "%".$search."%");
|
||||||
$q->orWhereHas('member', function ($subQuery) use ($search) {
|
$q->orWhereHas('member', function ($subQuery) use ($search) {
|
||||||
@@ -60,14 +64,11 @@ class RequestLogController extends Controller
|
|||||||
})
|
})
|
||||||
->when($request->orderBy, function ($q, $orderBy) use ($request) {
|
->when($request->orderBy, function ($q, $orderBy) use ($request) {
|
||||||
if (in_array($orderBy, ['submission_date', 'code'])) {
|
if (in_array($orderBy, ['submission_date', 'code'])) {
|
||||||
$q->orderBy($orderBy, $request->order);
|
$q->orderBy($orderBy, $request->orderBy);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
->when(empty($request->orderBy), function ($q) {
|
->when(empty($request->orderBy), function ($q) {
|
||||||
$q->orderBy('created_at', 'desc');
|
$q->orderBy('submission_date', 'desc');
|
||||||
})
|
|
||||||
->when($request->final_log, function($q, $final_log) {
|
|
||||||
$q->where('final_log', $final_log);
|
|
||||||
})
|
})
|
||||||
->when($request->service_code, function($q, $service_code) {
|
->when($request->service_code, function($q, $service_code) {
|
||||||
if ($service_code == 'IP'){ // Penjagaan sementara agar ini hanya muncul di inpatient monitoring
|
if ($service_code == 'IP'){ // Penjagaan sementara agar ini hanya muncul di inpatient monitoring
|
||||||
@@ -252,16 +253,12 @@ class RequestLogController extends Controller
|
|||||||
$requestLog->reason = $request->reason;
|
$requestLog->reason = $request->reason;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Simpan perubahan pada entitas
|
|
||||||
$requestLog->save();
|
|
||||||
|
|
||||||
|
|
||||||
if ($request->status){
|
if ($request->status){
|
||||||
$requestLog->status = $request->status;
|
$requestLog->status = $request->status;
|
||||||
|
$requestLog->approved_by = auth()->user()->id;
|
||||||
|
$requestLog->approved_at = Carbon::now();
|
||||||
}
|
}
|
||||||
|
|
||||||
$requestLog->approved_by = auth()->user()->id;
|
|
||||||
$requestLog->approved_at = Carbon::now();
|
|
||||||
$requestLog->save();
|
$requestLog->save();
|
||||||
|
|
||||||
// update nirc member
|
// update nirc member
|
||||||
@@ -284,9 +281,27 @@ class RequestLogController extends Controller
|
|||||||
* @param int $id
|
* @param int $id
|
||||||
* @return Renderable
|
* @return Renderable
|
||||||
*/
|
*/
|
||||||
public function destroy($id)
|
public function destroy(Request $request, $id)
|
||||||
{
|
{
|
||||||
//
|
$requestLog = RequestLog::findOrFail($id);
|
||||||
|
$requestLog->reason = 'Reason Delete ' .$request->reason;
|
||||||
|
$requestLog->deleted_at = Carbon::now();
|
||||||
|
$requestLog->deleted_by = auth()->user()->id;
|
||||||
|
// Delete the record
|
||||||
|
$requestLog->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteFinalLog(Request $request, $id){
|
||||||
|
$requestLog = RequestLog::findOrFail($id);
|
||||||
|
$requestLog->status_final_log = null;
|
||||||
|
$requestLog->final_log = 0;
|
||||||
|
$requestLog->reason_final = 'Reason Delete ' .$request->reason;
|
||||||
|
$requestLog->save();
|
||||||
|
return response()->json([
|
||||||
|
'error' => false,
|
||||||
|
'message' => 'Delete Final LOG',
|
||||||
|
'data' => $requestLog],
|
||||||
|
200);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -123,6 +123,7 @@ Route::prefix('internal')->group(function () {
|
|||||||
Route::get('corporates/{corporate_id}/members/list', [CorporateMemberController::class, 'generateMemberList']);
|
Route::get('corporates/{corporate_id}/members/list', [CorporateMemberController::class, 'generateMemberList']);
|
||||||
Route::post('corporates/{corporate_id}/members/import', [CorporateMemberController::class, 'import']);
|
Route::post('corporates/{corporate_id}/members/import', [CorporateMemberController::class, 'import']);
|
||||||
Route::put('members/{member_id}/activation', [CorporateMemberController::class, 'activation']);
|
Route::put('members/{member_id}/activation', [CorporateMemberController::class, 'activation']);
|
||||||
|
Route::post('members/update', [CorporateMemberController::class, 'update']);
|
||||||
|
|
||||||
|
|
||||||
Route::get('corporates/{corporate_id}/diagnosis', [DiagnosisExclusionController::class, 'listDiagnosis']);
|
Route::get('corporates/{corporate_id}/diagnosis', [DiagnosisExclusionController::class, 'listDiagnosis']);
|
||||||
@@ -258,6 +259,8 @@ Route::prefix('internal')->group(function () {
|
|||||||
Route::post('customer-service/request', [RequestLogController::class, 'createNew']);
|
Route::post('customer-service/request', [RequestLogController::class, 'createNew']);
|
||||||
Route::put('customer-service/request/{id}', [RequestLogController::class, 'update']);
|
Route::put('customer-service/request/{id}', [RequestLogController::class, 'update']);
|
||||||
Route::get('customer-service/request/{id}', [RequestLogController::class, 'show']);
|
Route::get('customer-service/request/{id}', [RequestLogController::class, 'show']);
|
||||||
|
Route::put('customer-service/request/delete/{id}', [RequestLogController::class, 'destroy']);
|
||||||
|
Route::put('customer-service/request/final_log/{id}', [RequestLogController::class, 'deleteFinalLog']);
|
||||||
Route::get('customer-service/request/{id}/download', [RequestLogController::class, 'generateRequestLog']);
|
Route::get('customer-service/request/{id}/download', [RequestLogController::class, 'generateRequestLog']);
|
||||||
Route::post('customer-service/request/import', [RequestLogController::class, 'importRequestLog']);
|
Route::post('customer-service/request/import', [RequestLogController::class, 'importRequestLog']);
|
||||||
Route::get('customer-service/request/data', [RequestLogController::class, 'generateDataRequestLogExcel']);
|
Route::get('customer-service/request/data', [RequestLogController::class, 'generateDataRequestLogExcel']);
|
||||||
|
|||||||
@@ -50,6 +50,8 @@ import TableMoreMenu from '@/components/table/TableMoreMenu';
|
|||||||
import { Import } from '@/@types/claims';
|
import { Import } from '@/@types/claims';
|
||||||
|
|
||||||
import { FinalLogType } from '../../CustomerService/FinalLog/Model/Types';
|
import { FinalLogType } from '../../CustomerService/FinalLog/Model/Types';
|
||||||
|
import DialogDeleteFinalLOG from '@/pages/CustomerService/FinalLog/Components/DialogDeleteFinalLOG';
|
||||||
|
import { Delete } from '@mui/icons-material';
|
||||||
// import LoadingButton from '@/theme/overrides/LoadingButton';
|
// import LoadingButton from '@/theme/overrides/LoadingButton';
|
||||||
|
|
||||||
export default function List() {
|
export default function List() {
|
||||||
@@ -301,17 +303,9 @@ export default function List() {
|
|||||||
setSearchParams(filter);
|
setSearchParams(filter);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleApprove = (claimRequest) => {
|
// Handel Delete Final LOG
|
||||||
axios
|
const [idFinalLog, setidFinalLog] = useState<number>();
|
||||||
.post(`claim-requests/${claimRequest.id}/approve`)
|
const [openDialogDeleteFinalLog, setDialogDeleteFinalLog] = useState(false)
|
||||||
.then((response) => {
|
|
||||||
enqueueSnackbar('Success Approve', { variant: 'success' });
|
|
||||||
loadDataTableData();
|
|
||||||
})
|
|
||||||
.catch(({ response }) => {
|
|
||||||
enqueueSnackbar(response.data.message ?? 'Something went wrong!', { variant: 'error' });
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
loadDataTableData();
|
loadDataTableData();
|
||||||
@@ -379,6 +373,14 @@ export default function List() {
|
|||||||
<FindInPageOutlinedIcon />
|
<FindInPageOutlinedIcon />
|
||||||
Detail
|
Detail
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
|
<MenuItem onClick={() => {
|
||||||
|
setidFinalLog(row.id)
|
||||||
|
setDialogDeleteFinalLog(true)
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Delete color='error'/>
|
||||||
|
Delete
|
||||||
|
</MenuItem>
|
||||||
</>
|
</>
|
||||||
} />
|
} />
|
||||||
</TableCell>
|
</TableCell>
|
||||||
@@ -534,30 +536,6 @@ export default function List() {
|
|||||||
</Table>
|
</Table>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------
|
|
||||||
// Dialog Detail Claim Request
|
|
||||||
const [openDialogDetailClaim, setOpenDialogDetailClaim] = useState(false);
|
|
||||||
const [loadingClaimDetail, setLoadingClaimDetail] = useState(true);
|
|
||||||
const [currentClaim, setCurrentClaim] = useState(null);
|
|
||||||
|
|
||||||
function handleShowClaim(claimRequest) {
|
|
||||||
setLoadingClaimDetail(true);
|
|
||||||
setOpenDialogDetailClaim(true);
|
|
||||||
|
|
||||||
axios
|
|
||||||
.get(`/claim-requests/${claimRequest.id}`)
|
|
||||||
.then(({ data }) => {
|
|
||||||
setCurrentClaim(data.data);
|
|
||||||
setLoadingClaimDetail(false);
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
enqueueSnackbar(err.message, { variant: 'error' });
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleDownloadLog() {}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Grid container>
|
<Grid container>
|
||||||
<Grid item sm={12}>
|
<Grid item sm={12}>
|
||||||
@@ -574,12 +552,12 @@ export default function List() {
|
|||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item sm={12}>
|
<Grid item sm={12}>
|
||||||
<DialogDetailClaim
|
{/* Dialog Delete */}
|
||||||
openDialog={openDialogDetailClaim}
|
<DialogDeleteFinalLOG
|
||||||
setOpenDialog={setOpenDialogDetailClaim}
|
id={idFinalLog}
|
||||||
title={{ name: 'Claim Request Detail' }}
|
openDialog={openDialogDeleteFinalLog}
|
||||||
data={{ claim: currentClaim, isLoading: loadingClaimDetail, handleDownloadLog }}
|
setOpenDialog={setDialogDeleteFinalLog}
|
||||||
></DialogDetailClaim>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -62,6 +62,8 @@ import CachedOutlinedIcon from '@mui/icons-material/CachedOutlined';
|
|||||||
import { Dialog, DialogTitle, DialogContent, DialogActions } from '@mui/material';
|
import { Dialog, DialogTitle, DialogContent, DialogActions } from '@mui/material';
|
||||||
import CloseIcon from '@mui/icons-material/Close';
|
import CloseIcon from '@mui/icons-material/Close';
|
||||||
import Label from '../../../components/Label';
|
import Label from '../../../components/Label';
|
||||||
|
import DialogEditMember from './sections/DialogEditMember';
|
||||||
|
import { Edit } from '@mui/icons-material';
|
||||||
|
|
||||||
export default function CorporatePlanList({handleSubmitSuccess}) {
|
export default function CorporatePlanList({handleSubmitSuccess}) {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
@@ -566,6 +568,10 @@ export default function CorporatePlanList({handleSubmitSuccess}) {
|
|||||||
<CachedOutlinedIcon />
|
<CachedOutlinedIcon />
|
||||||
Update Status
|
Update Status
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
|
<MenuItem onClick={() => handleEditMember(row)}>
|
||||||
|
<Edit />
|
||||||
|
Update Member
|
||||||
|
</MenuItem>
|
||||||
<MenuItem onClick={() => handleDownloadEcard(row.id)}>
|
<MenuItem onClick={() => handleDownloadEcard(row.id)}>
|
||||||
<DownloadIcon />
|
<DownloadIcon />
|
||||||
Download E-card
|
Download E-card
|
||||||
@@ -747,6 +753,8 @@ export default function CorporatePlanList({handleSubmitSuccess}) {
|
|||||||
const [idUpdate, setIdUpdate] = useState('');
|
const [idUpdate, setIdUpdate] = useState('');
|
||||||
|
|
||||||
const [openDialogStatus, setOpenDialogStatus] = useState(false);
|
const [openDialogStatus, setOpenDialogStatus] = useState(false);
|
||||||
|
const [member, setMember] = useState();
|
||||||
|
|
||||||
|
|
||||||
const handleCloseDialogUpdate = () => {
|
const handleCloseDialogUpdate = () => {
|
||||||
setNameUpdate('');
|
setNameUpdate('');
|
||||||
@@ -790,6 +798,14 @@ export default function CorporatePlanList({handleSubmitSuccess}) {
|
|||||||
setIdUpdate(data.id);
|
setIdUpdate(data.id);
|
||||||
setOpenDialogStatus(true);
|
setOpenDialogStatus(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Handle Update data member
|
||||||
|
const [openDialogEdit, setOpenDialogUpdate] = useState(false);
|
||||||
|
const handleEditMember = (member: any) => {
|
||||||
|
setOpenDialogUpdate(true)
|
||||||
|
setMember(member)
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack>
|
<Stack>
|
||||||
<ImportForm />
|
<ImportForm />
|
||||||
@@ -899,6 +915,15 @@ export default function CorporatePlanList({handleSubmitSuccess}) {
|
|||||||
title={{ name: 'Reason For Update' }}
|
title={{ name: 'Reason For Update' }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{/* Dialog for update birthdate member */}
|
||||||
|
<DialogEditMember
|
||||||
|
openDialog= {openDialogEdit}
|
||||||
|
setOpenDialog = {setOpenDialogUpdate}
|
||||||
|
member = {member}
|
||||||
|
>
|
||||||
|
|
||||||
|
</DialogEditMember>
|
||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,213 @@
|
|||||||
|
import MuiDialog from "@/components/MuiDialog";
|
||||||
|
import { Button, Card, Checkbox, DialogActions, Grid, TextField, TextareaAutosize, Typography, Select } from "@mui/material";
|
||||||
|
import { Paper } from "@mui/material";
|
||||||
|
import { Stack } from '@mui/material';
|
||||||
|
import React, { useEffect, useState } from 'react';
|
||||||
|
import { fDateOnly, fDateTimesecond, toTitleCase } from "@/utils/formatTime";
|
||||||
|
import axios from "@/utils/axios";
|
||||||
|
import { enqueueSnackbar } from "notistack";
|
||||||
|
import { useNavigate, useParams } from "react-router";
|
||||||
|
import { RHFSelect, RHFTextField, RHFEditor } from "@/components/hook-form";
|
||||||
|
import { Autocomplete } from "@mui/material";
|
||||||
|
// import { RHFEditor } from "@/components/hook-form/v2";
|
||||||
|
|
||||||
|
|
||||||
|
type DialogConfirmationType = {
|
||||||
|
openDialog: boolean;
|
||||||
|
setOpenDialog: any;
|
||||||
|
onSubmit?: void;
|
||||||
|
member: {
|
||||||
|
member_id:string,
|
||||||
|
birth_date:string,
|
||||||
|
gender:string,
|
||||||
|
reason:string
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function DialogEditMember({member, setOpenDialog, openDialog, onSubmit} : DialogConfirmationType ) {
|
||||||
|
const navigate = useNavigate();
|
||||||
|
const { corporate_id } = useParams();
|
||||||
|
|
||||||
|
const [formData, setFormData] = useState({
|
||||||
|
member_id: member?.member_id,
|
||||||
|
gender: member?.gender,
|
||||||
|
birth_date: member?.birth_date,
|
||||||
|
reason: member?.reason,
|
||||||
|
});
|
||||||
|
|
||||||
|
const [isReasonSelected, setIsReasonSelected] = useState(true);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
// Update formData setiap kali requestLog berubah
|
||||||
|
setFormData({
|
||||||
|
member_id: member?.member_id || '',
|
||||||
|
gender: member?.gender || '',
|
||||||
|
birth_date: member?.birth_date || '',
|
||||||
|
reason: member?.reason || '',
|
||||||
|
|
||||||
|
});
|
||||||
|
}, [member]);
|
||||||
|
|
||||||
|
const handleChange = (field, value) => {
|
||||||
|
setFormData((prevData) => ({
|
||||||
|
...prevData,
|
||||||
|
[field]: value,
|
||||||
|
}));
|
||||||
|
if (field === 'reason') {
|
||||||
|
setIsReasonSelected(!!value);
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleApprove = () => {
|
||||||
|
setFormData((prevData) => ({
|
||||||
|
...prevData,
|
||||||
|
}));
|
||||||
|
handleSubmit();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const handleSubmit = () => {
|
||||||
|
if (isReasonSelected && formData.reason !== '') {
|
||||||
|
axios
|
||||||
|
.post(`members/update`, formData)
|
||||||
|
.then((response) => {
|
||||||
|
enqueueSnackbar('Update Member Success', { variant: 'success' });
|
||||||
|
setOpenDialog(false);
|
||||||
|
navigate(`/corporates/${corporate_id}/members`)
|
||||||
|
window.location.reload()
|
||||||
|
})
|
||||||
|
.catch(({ response }) => {
|
||||||
|
enqueueSnackbar(response.data.message ?? 'Something went wrong!', { variant: 'error' });
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
setIsReasonSelected(false);
|
||||||
|
alert('Silakan pilih alasan sebelum mengirimkan data.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const style1 = {
|
||||||
|
color: '#919EAB',
|
||||||
|
width: '30%'
|
||||||
|
}
|
||||||
|
const style2 = {
|
||||||
|
width: '70%'
|
||||||
|
}
|
||||||
|
const marginBottom1 = {
|
||||||
|
marginBottom: 1,
|
||||||
|
}
|
||||||
|
|
||||||
|
const marginBottom2 = {
|
||||||
|
marginBottom: 2,
|
||||||
|
}
|
||||||
|
|
||||||
|
const resetForm = () => {
|
||||||
|
setFormData({
|
||||||
|
member_id: member?.member_id ?? '',
|
||||||
|
gender: member?.gender ?? '',
|
||||||
|
birth_date: member?.birth_date ?? '',
|
||||||
|
reason: member?.reason ?? '',
|
||||||
|
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleCloseDialog = () => {
|
||||||
|
setOpenDialog(false);
|
||||||
|
resetForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleNumericInput = (input: any) => {
|
||||||
|
const numericInput = input.replace(/\D/g, '');
|
||||||
|
return numericInput;
|
||||||
|
};
|
||||||
|
|
||||||
|
const reasons = [
|
||||||
|
{ value: 'agreement', label: 'Agreement changed' },
|
||||||
|
{ value: 'endorsement', label: 'Endorsement' },
|
||||||
|
{ value: 'renewal', label: 'Renewal' },
|
||||||
|
{ value: 'wrong_setting', label: 'Wrong Setting' },
|
||||||
|
// Add more options as needed
|
||||||
|
];
|
||||||
|
|
||||||
|
const gender = [
|
||||||
|
{ value: 'male', label: 'Male' },
|
||||||
|
{ value: 'female', label: 'Female' },
|
||||||
|
{ value: '-', label: 'Other' },
|
||||||
|
// Add more options as needed
|
||||||
|
];
|
||||||
|
|
||||||
|
const getContent = () => (
|
||||||
|
<Stack spacing={1} marginTop={2}>
|
||||||
|
<Typography variant="subtitle2">Are you sure to update this member ?</Typography>
|
||||||
|
<Grid item xs={12} md={12} marginTop={4}>
|
||||||
|
<Card sx={{padding:2, marginTop:2}} >
|
||||||
|
<Stack direction='row' spacing={2} sx={marginBottom2}>
|
||||||
|
<Typography variant='subtitle2' sx={style1} gutterBottom>Birth Date</Typography>
|
||||||
|
<TextField
|
||||||
|
label="Brith Date"
|
||||||
|
variant="outlined"
|
||||||
|
fullWidth
|
||||||
|
type="date"
|
||||||
|
value={formData.birth_date ? fDateOnly(formData.birth_date) : ''}
|
||||||
|
onChange={(e) => handleChange('birth_date', e.target.value)}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
|
<Stack direction='row' spacing={2} sx={marginBottom2}>
|
||||||
|
<Typography variant='subtitle2' sx={style1} gutterBottom>Gender</Typography>
|
||||||
|
<Autocomplete
|
||||||
|
options={gender}
|
||||||
|
getOptionLabel={(option) => option.label}
|
||||||
|
fullWidth
|
||||||
|
value={gender.find((r) => r.value === formData.gender) || null} // Use find to match the default value
|
||||||
|
onChange={(e, newValue) => handleChange('gender', newValue?.value)}
|
||||||
|
renderInput={(params) => (
|
||||||
|
<TextField
|
||||||
|
{...params}
|
||||||
|
label="Gender"
|
||||||
|
variant="outlined"
|
||||||
|
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
|
<Stack direction='row' spacing={2} sx={marginBottom2}>
|
||||||
|
<Typography variant='subtitle2' sx={style1} gutterBottom>Reason*</Typography>
|
||||||
|
<Autocomplete
|
||||||
|
options={reasons}
|
||||||
|
getOptionLabel={(option) => option.label}
|
||||||
|
fullWidth
|
||||||
|
value={reasons.find((r) => r.value === formData.reason) || null} // Use find to match the default value
|
||||||
|
onChange={(e, newValue) => handleChange('reason', newValue?.value)}
|
||||||
|
renderInput={(params) => (
|
||||||
|
<TextField
|
||||||
|
{...params}
|
||||||
|
label="Reason"
|
||||||
|
variant="outlined"
|
||||||
|
required
|
||||||
|
error={!isReasonSelected} // Menandai input sebagai salah jika opsi tidak dipilih
|
||||||
|
helperText={!isReasonSelected ? 'Alasan harus dipilih' : ''}
|
||||||
|
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
|
</Card>
|
||||||
|
</Grid>
|
||||||
|
<DialogActions>
|
||||||
|
<Button variant="outlined" sx={{color: '#212B36', borderColor: '#919EAB52'}} onClick={handleCloseDialog}>Cancel</Button>
|
||||||
|
<Button color="primary" variant="contained" onClick={() => handleApprove()}>Update</Button>
|
||||||
|
</DialogActions>
|
||||||
|
</Stack>
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
return (
|
||||||
|
<MuiDialog
|
||||||
|
title={{name: "Update Information Member"}}
|
||||||
|
openDialog={openDialog}
|
||||||
|
setOpenDialog={setOpenDialog}
|
||||||
|
content={getContent()}
|
||||||
|
maxWidth="xl"
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,132 @@
|
|||||||
|
import MuiDialog from "@/components/MuiDialog";
|
||||||
|
import { Autocomplete, Button, Card, Checkbox, DialogActions, Grid, Typography } from "@mui/material";
|
||||||
|
import { Paper } from "@mui/material";
|
||||||
|
import { Stack } from '@mui/material';
|
||||||
|
import React, { useState } from 'react';
|
||||||
|
import { fDateTimesecond, toTitleCase } from "@/utils/formatTime";
|
||||||
|
import axios from "@/utils/axios";
|
||||||
|
import { enqueueSnackbar } from "notistack";
|
||||||
|
import { useNavigate } from "react-router";
|
||||||
|
import { TextField } from "@mui/material";
|
||||||
|
|
||||||
|
|
||||||
|
type DialogDeleteType = {
|
||||||
|
openDialog: boolean;
|
||||||
|
setOpenDialog: any;
|
||||||
|
onSubmit?: void;
|
||||||
|
id: number|undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function DialogDeleteFinalLOG({id, setOpenDialog, openDialog,onSubmit} : DialogDeleteType ) {
|
||||||
|
const style1 = {
|
||||||
|
color: '#919EAB',
|
||||||
|
width: '30%'
|
||||||
|
}
|
||||||
|
const style2 = {
|
||||||
|
width: '70%'
|
||||||
|
}
|
||||||
|
const marginBottom2 = {
|
||||||
|
marginBottom: 2,
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleCloseDialog = () => {
|
||||||
|
setOpenDialog(false);
|
||||||
|
resetForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
const [isReasonSelected, setIsReasonSelected] = useState(false);
|
||||||
|
|
||||||
|
const reasons = [
|
||||||
|
{ value: 'agreement', label: 'Agreement changed' },
|
||||||
|
{ value: 'endorsement', label: 'Endorsement' },
|
||||||
|
{ value: 'renewal', label: 'Renewal' },
|
||||||
|
{ value: 'wrong_setting', label: 'Wrong Setting' },
|
||||||
|
// Add more options as needed
|
||||||
|
];
|
||||||
|
const [formData, setFormData] = useState({
|
||||||
|
reason: null
|
||||||
|
});
|
||||||
|
|
||||||
|
const resetForm = () => {
|
||||||
|
setFormData({
|
||||||
|
reason: null
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleChange = (field, value) => {
|
||||||
|
setFormData((prevData) => ({
|
||||||
|
...prevData,
|
||||||
|
[field]: value,
|
||||||
|
}));
|
||||||
|
if (field === 'reason') {
|
||||||
|
setIsReasonSelected(!!value);
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleSubmit = () => {
|
||||||
|
if (isReasonSelected && formData.reason !== '') {
|
||||||
|
axios
|
||||||
|
.put(`customer-service/request/final_log/${id}`, formData)
|
||||||
|
.then((response) => {
|
||||||
|
enqueueSnackbar('Request LOG has Deleted', { variant: 'success' });
|
||||||
|
setOpenDialog(false);
|
||||||
|
window.location.reload()
|
||||||
|
})
|
||||||
|
.catch(({ response }) => {
|
||||||
|
enqueueSnackbar(response.data.message ?? 'Something went wrong!', { variant: 'error' });
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
setIsReasonSelected(false);
|
||||||
|
alert('Silakan pilih alasan sebelum menghapus data.');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const getContent = () => (
|
||||||
|
<Stack spacing={1} marginTop={2}>
|
||||||
|
<Typography variant="subtitle2">Are you sure to delete this detail LOG ?</Typography>
|
||||||
|
<Grid item xs={12} md={12} marginTop={4}>
|
||||||
|
<Card sx={{padding:2, marginTop:2}} >
|
||||||
|
<Stack direction='row' spacing={2} sx={marginBottom2}>
|
||||||
|
<Typography variant='subtitle2' sx={style1} gutterBottom>Reason*</Typography>
|
||||||
|
<Autocomplete
|
||||||
|
options={reasons}
|
||||||
|
getOptionLabel={(option) => option.label}
|
||||||
|
fullWidth
|
||||||
|
value={reasons.find((r) => r.value === formData.reason) || null} // Use find to match the default value
|
||||||
|
onChange={(e, newValue) => handleChange('reason', newValue?.value)}
|
||||||
|
renderInput={(params) => (
|
||||||
|
<TextField
|
||||||
|
{...params}
|
||||||
|
label="Reason"
|
||||||
|
variant="outlined"
|
||||||
|
required
|
||||||
|
error={!isReasonSelected} // Menandai input sebagai salah jika opsi tidak dipilih
|
||||||
|
helperText={!isReasonSelected ? 'Alasan harus dipilih' : ''}
|
||||||
|
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
|
</Card>
|
||||||
|
</Grid>
|
||||||
|
<DialogActions>
|
||||||
|
<Button variant="outlined" sx={{color: '#212B36', borderColor: '#919EAB52'}} onClick={handleCloseDialog}>Cancel</Button>
|
||||||
|
<Button color="error" variant="contained" onClick={handleSubmit}>Delete</Button>
|
||||||
|
</DialogActions>
|
||||||
|
</Stack>
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
return (
|
||||||
|
<MuiDialog
|
||||||
|
title={{name: "Delete Final LOG"}}
|
||||||
|
openDialog={openDialog}
|
||||||
|
setOpenDialog={setOpenDialog}
|
||||||
|
content={getContent()}
|
||||||
|
maxWidth="xs"
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -149,6 +149,7 @@ export default function Detail() {
|
|||||||
Detail
|
Detail
|
||||||
</Typography>
|
</Typography>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
{requestLog?.status_final_log != 'requested' ? (
|
||||||
<Grid item xs={6} sx={{ display: 'flex', placeContent: 'end' }}>
|
<Grid item xs={6} sx={{ display: 'flex', placeContent: 'end' }}>
|
||||||
<MoreMenu
|
<MoreMenu
|
||||||
actions={
|
actions={
|
||||||
@@ -162,7 +163,7 @@ export default function Detail() {
|
|||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>) : null }
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
<Stack direction='row' spacing={2} sx={marginBottom1}>
|
<Stack direction='row' spacing={2} sx={marginBottom1}>
|
||||||
|
|||||||
@@ -50,6 +50,8 @@ import TableMoreMenu from '@/components/table/TableMoreMenu';
|
|||||||
import { Import } from '@/@types/claims';
|
import { Import } from '@/@types/claims';
|
||||||
|
|
||||||
import { FinalLogType } from '../FinalLog/Model/Types';
|
import { FinalLogType } from '../FinalLog/Model/Types';
|
||||||
|
import DialogDeleteFinalLOG from './Components/DialogDeleteFinalLOG';
|
||||||
|
import { Delete } from '@mui/icons-material';
|
||||||
// import LoadingButton from '@/theme/overrides/LoadingButton';
|
// import LoadingButton from '@/theme/overrides/LoadingButton';
|
||||||
|
|
||||||
export default function List() {
|
export default function List() {
|
||||||
@@ -301,17 +303,9 @@ export default function List() {
|
|||||||
setSearchParams(filter);
|
setSearchParams(filter);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleApprove = (claimRequest) => {
|
// Handel Delete Final LOG
|
||||||
axios
|
const [idFinalLog, setidFinalLog] = useState<number>();
|
||||||
.post(`claim-requests/${claimRequest.id}/approve`)
|
const [openDialogDeleteFinalLog, setDialogDeleteFinalLog] = useState(false)
|
||||||
.then((response) => {
|
|
||||||
enqueueSnackbar('Success Approve', { variant: 'success' });
|
|
||||||
loadDataTableData();
|
|
||||||
})
|
|
||||||
.catch(({ response }) => {
|
|
||||||
enqueueSnackbar(response.data.message ?? 'Something went wrong!', { variant: 'error' });
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
loadDataTableData();
|
loadDataTableData();
|
||||||
@@ -379,6 +373,14 @@ export default function List() {
|
|||||||
<FindInPageOutlinedIcon />
|
<FindInPageOutlinedIcon />
|
||||||
Detail
|
Detail
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
|
<MenuItem onClick={() => {
|
||||||
|
setidFinalLog(row.id)
|
||||||
|
setDialogDeleteFinalLog(true)
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Delete color='error'/>
|
||||||
|
Delete
|
||||||
|
</MenuItem>
|
||||||
</>
|
</>
|
||||||
} />
|
} />
|
||||||
</TableCell>
|
</TableCell>
|
||||||
@@ -574,12 +576,12 @@ export default function List() {
|
|||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item sm={12}>
|
<Grid item sm={12}>
|
||||||
<DialogDetailClaim
|
{/* Dialog Delete */}
|
||||||
openDialog={openDialogDetailClaim}
|
<DialogDeleteFinalLOG
|
||||||
setOpenDialog={setOpenDialogDetailClaim}
|
id={idFinalLog}
|
||||||
title={{ name: 'Claim Request Detail' }}
|
openDialog={openDialogDeleteFinalLog}
|
||||||
data={{ claim: currentClaim, isLoading: loadingClaimDetail, handleDownloadLog }}
|
setOpenDialog={setDialogDeleteFinalLog}
|
||||||
></DialogDetailClaim>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -0,0 +1,132 @@
|
|||||||
|
import MuiDialog from "@/components/MuiDialog";
|
||||||
|
import { Button, Card, Checkbox, DialogActions, Grid, TextField, Typography } from "@mui/material";
|
||||||
|
import { Paper } from "@mui/material";
|
||||||
|
import { Stack } from '@mui/material';
|
||||||
|
import React, { useState } from 'react';
|
||||||
|
import { fDateTimesecond, toTitleCase } from "@/utils/formatTime";
|
||||||
|
import axios from "@/utils/axios";
|
||||||
|
import { enqueueSnackbar } from "notistack";
|
||||||
|
import { useNavigate } from "react-router";
|
||||||
|
import { Autocomplete } from "@mui/material";
|
||||||
|
|
||||||
|
|
||||||
|
type DialogDeleteType = {
|
||||||
|
openDialog: boolean;
|
||||||
|
setOpenDialog: any;
|
||||||
|
onSubmit?: void;
|
||||||
|
id: number|undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function DialogDeleteRequestLOG({id, setOpenDialog, openDialog,onSubmit} : DialogDeleteType ) {
|
||||||
|
const style1 = {
|
||||||
|
color: '#919EAB',
|
||||||
|
width: '30%'
|
||||||
|
}
|
||||||
|
const style2 = {
|
||||||
|
width: '70%'
|
||||||
|
}
|
||||||
|
const marginBottom2 = {
|
||||||
|
marginBottom: 2,
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleCloseDialog = () => {
|
||||||
|
setOpenDialog(false);
|
||||||
|
resetForm();
|
||||||
|
}
|
||||||
|
const [isReasonSelected, setIsReasonSelected] = useState(false);
|
||||||
|
|
||||||
|
const reasons = [
|
||||||
|
{ value: 'agreement', label: 'Agreement changed' },
|
||||||
|
{ value: 'endorsement', label: 'Endorsement' },
|
||||||
|
{ value: 'renewal', label: 'Renewal' },
|
||||||
|
{ value: 'wrong_setting', label: 'Wrong Setting' },
|
||||||
|
// Add more options as needed
|
||||||
|
];
|
||||||
|
const [formData, setFormData] = useState({
|
||||||
|
reason: null
|
||||||
|
});
|
||||||
|
|
||||||
|
const resetForm = () => {
|
||||||
|
setFormData({
|
||||||
|
reason: null
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleChange = (field, value) => {
|
||||||
|
setFormData((prevData) => ({
|
||||||
|
...prevData,
|
||||||
|
[field]: value,
|
||||||
|
}));
|
||||||
|
if (field === 'reason') {
|
||||||
|
setIsReasonSelected(!!value);
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleSubmit = () => {
|
||||||
|
if (isReasonSelected && formData.reason !== '') {
|
||||||
|
axios
|
||||||
|
.put(`customer-service/request/delete/${id}`, formData)
|
||||||
|
.then((response) => {
|
||||||
|
enqueueSnackbar('Request LOG has Deleted', { variant: 'success' });
|
||||||
|
setOpenDialog(false);
|
||||||
|
window.location.reload()
|
||||||
|
})
|
||||||
|
.catch(({ response }) => {
|
||||||
|
enqueueSnackbar(response.data.message ?? 'Something went wrong!', { variant: 'error' });
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
setIsReasonSelected(false);
|
||||||
|
alert('Silakan pilih alasan sebelum menghapus data.');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const getContent = () => (
|
||||||
|
<Stack spacing={1} marginTop={2}>
|
||||||
|
<Typography variant="subtitle2">Are you sure to delete this detail LOG ?</Typography>
|
||||||
|
<Grid item xs={12} md={12} marginTop={4}>
|
||||||
|
<Card sx={{padding:2, marginTop:2}} >
|
||||||
|
<Stack direction='row' spacing={2} sx={marginBottom2}>
|
||||||
|
<Typography variant='subtitle2' sx={style1} gutterBottom>Reason*</Typography>
|
||||||
|
<Autocomplete
|
||||||
|
options={reasons}
|
||||||
|
getOptionLabel={(option) => option.label}
|
||||||
|
fullWidth
|
||||||
|
value={reasons.find((r) => r.value === formData.reason) || null} // Use find to match the default value
|
||||||
|
onChange={(e, newValue) => handleChange('reason', newValue?.value)}
|
||||||
|
renderInput={(params) => (
|
||||||
|
<TextField
|
||||||
|
{...params}
|
||||||
|
label="Reason"
|
||||||
|
variant="outlined"
|
||||||
|
required
|
||||||
|
error={!isReasonSelected} // Menandai input sebagai salah jika opsi tidak dipilih
|
||||||
|
helperText={!isReasonSelected ? 'Alasan harus dipilih' : ''}
|
||||||
|
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
|
</Card>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<DialogActions>
|
||||||
|
<Button variant="outlined" sx={{color: '#212B36', borderColor: '#919EAB52'}} onClick={handleCloseDialog}>Cancel</Button>
|
||||||
|
<Button color="error" variant="contained" onClick={handleSubmit}>Delete</Button>
|
||||||
|
</DialogActions>
|
||||||
|
</Stack>
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
return (
|
||||||
|
<MuiDialog
|
||||||
|
title={{name: "Delete Request LOG"}}
|
||||||
|
openDialog={openDialog}
|
||||||
|
setOpenDialog={setOpenDialog}
|
||||||
|
content={getContent()}
|
||||||
|
maxWidth="xs"
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -225,7 +225,7 @@ export default function DialogEditInformation({requestLog, setOpenDialog, openDi
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<MuiDialog
|
<MuiDialog
|
||||||
title={{name: "Confirmation"}}
|
title={{name: "Edit Request LOG"}}
|
||||||
openDialog={openDialog}
|
openDialog={openDialog}
|
||||||
setOpenDialog={setOpenDialog}
|
setOpenDialog={setOpenDialog}
|
||||||
content={getContent()}
|
content={getContent()}
|
||||||
|
|||||||
@@ -90,20 +90,22 @@ export default function Detail() {
|
|||||||
Detail
|
Detail
|
||||||
</Typography>
|
</Typography>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={6} sx={{ display: 'flex', placeContent: 'end' }}>
|
{requestLog?.status != 'requested' ? (
|
||||||
<MoreMenu
|
<Grid item xs={6} sx={{ display: 'flex', placeContent: 'end' }}>
|
||||||
actions={
|
<MoreMenu
|
||||||
<>
|
actions={
|
||||||
<MenuItem onClick={() => {
|
<>
|
||||||
setOpenDialogEdit(true);
|
<MenuItem onClick={() => {
|
||||||
}}>
|
setOpenDialogEdit(true);
|
||||||
<EditOutlined />
|
}}>
|
||||||
Edit
|
<EditOutlined />
|
||||||
</MenuItem>
|
Edit
|
||||||
</>
|
</MenuItem>
|
||||||
}
|
</>
|
||||||
/>
|
}
|
||||||
</Grid>
|
/>
|
||||||
|
</Grid>
|
||||||
|
) : null}
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
<Stack direction='row' spacing={2} sx={marginBottom1}>
|
<Stack direction='row' spacing={2} sx={marginBottom1}>
|
||||||
|
|||||||
@@ -55,6 +55,8 @@ import { Import } from '@/@types/claims';
|
|||||||
import { RequestLogType } from '../Request/Model/Types';
|
import { RequestLogType } from '../Request/Model/Types';
|
||||||
// import SvgIconStyle from '@/components/SvgIconStyle';
|
// import SvgIconStyle from '@/components/SvgIconStyle';
|
||||||
import SvgIconStyle from '../../../components/SvgIconStyle';
|
import SvgIconStyle from '../../../components/SvgIconStyle';
|
||||||
|
import { Delete } from '@mui/icons-material';
|
||||||
|
import DialogDeleteRequestLOG from '../Request/Components/DialogDeleteRequestLOG';
|
||||||
// import LoadingButton from '@/theme/overrides/LoadingButton';
|
// import LoadingButton from '@/theme/overrides/LoadingButton';
|
||||||
|
|
||||||
export default function List() {
|
export default function List() {
|
||||||
@@ -313,17 +315,9 @@ export default function List() {
|
|||||||
setSearchParams(filter);
|
setSearchParams(filter);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleApprove = (claimRequest) => {
|
// Handel Delete Request LOG
|
||||||
axios
|
const [idRequestLog, setidRequestLog] = useState<number>();
|
||||||
.post(`claim-requests/${claimRequest.id}/approve`)
|
const [openDialogDeleteRequestLog, setDialogDeleteRequestLog] = useState(false)
|
||||||
.then((response) => {
|
|
||||||
enqueueSnackbar('Success Approve', { variant: 'success' });
|
|
||||||
loadDataTableData();
|
|
||||||
})
|
|
||||||
.catch(({ response }) => {
|
|
||||||
enqueueSnackbar(response.data.message ?? 'Something went wrong!', { variant: 'error' });
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
loadDataTableData();
|
loadDataTableData();
|
||||||
@@ -390,6 +384,14 @@ export default function List() {
|
|||||||
<FindInPageOutlinedIcon />
|
<FindInPageOutlinedIcon />
|
||||||
Detail
|
Detail
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
|
<MenuItem onClick={() => {
|
||||||
|
setidRequestLog(row.id)
|
||||||
|
setDialogDeleteRequestLog(true)
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Delete color='error'/>
|
||||||
|
Delete
|
||||||
|
</MenuItem>
|
||||||
|
|
||||||
</>
|
</>
|
||||||
} />
|
} />
|
||||||
@@ -548,28 +550,6 @@ export default function List() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------
|
// ---------------------------------------------------------
|
||||||
// Dialog Detail Claim Request
|
|
||||||
const [openDialogDetailClaim, setOpenDialogDetailClaim] = useState(false);
|
|
||||||
const [loadingClaimDetail, setLoadingClaimDetail] = useState(true);
|
|
||||||
const [currentClaim, setCurrentClaim] = useState(null);
|
|
||||||
|
|
||||||
function handleShowClaim(claimRequest) {
|
|
||||||
setLoadingClaimDetail(true);
|
|
||||||
setOpenDialogDetailClaim(true);
|
|
||||||
|
|
||||||
axios
|
|
||||||
.get(`/claim-requests/${claimRequest.id}`)
|
|
||||||
.then(({ data }) => {
|
|
||||||
setCurrentClaim(data.data);
|
|
||||||
setLoadingClaimDetail(false);
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
enqueueSnackbar(err.message, { variant: 'error' });
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleDownloadLog() {}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Grid container>
|
<Grid container>
|
||||||
<Grid item sm={12}>
|
<Grid item sm={12}>
|
||||||
@@ -586,12 +566,12 @@ export default function List() {
|
|||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item sm={12}>
|
<Grid item sm={12}>
|
||||||
<DialogDetailClaim
|
{/* Dialog Delete */}
|
||||||
openDialog={openDialogDetailClaim}
|
<DialogDeleteRequestLOG
|
||||||
setOpenDialog={setOpenDialogDetailClaim}
|
id={idRequestLog}
|
||||||
title={{ name: 'Claim Request Detail' }}
|
openDialog={openDialogDeleteRequestLog}
|
||||||
data={{ claim: currentClaim, isLoading: loadingClaimDetail, handleDownloadLog }}
|
setOpenDialog={setDialogDeleteRequestLog}
|
||||||
></DialogDetailClaim>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user