view, search dan tambah daily monitoring
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
* ============================================
|
||||
*/
|
||||
import React, { ChangeEvent, useEffect, useRef, useState } from "react";
|
||||
import { Box, Paper, TableContainer, Table, TableHead, TableRow, TableCell, TableBody, Stack, TextField, Button, Menu, } from "@mui/material";
|
||||
import { Box, Paper, TableContainer, Table, TableHead, TableRow, TableCell, TableBody, Stack, TextField, Button, Menu, Typography, ButtonGroup, } from "@mui/material";
|
||||
|
||||
/**
|
||||
* Types & Functions
|
||||
@@ -15,9 +15,18 @@ import DailyMonitoringListRow from "./DailyMonitoringListRow";
|
||||
import { LaravelPaginatedData, LaravelPaginatedDataDefault } from "@/@types/paginated-data";
|
||||
import { Grid } from "@mui/material";
|
||||
import DataTable from '../../../../components/LaravelTable';
|
||||
import DownloadIcon from '@mui/icons-material/Download';
|
||||
import CancelIcon from '@mui/icons-material/Cancel';
|
||||
import UploadIcon from '@mui/icons-material/Upload';
|
||||
import { MenuItem } from "@mui/material";
|
||||
import { useSearchParams } from "react-router-dom";
|
||||
import { useNavigate, useSearchParams } from "react-router-dom";
|
||||
import axios from "@/utils/axios";
|
||||
import { DesktopDatePicker, LocalizationProvider } from "@mui/x-date-pickers";
|
||||
import { AdapterDateFns } from "@mui/x-date-pickers/AdapterDateFns";
|
||||
import { fDateOnly } from "@/utils/formatTime";
|
||||
import { LoadingButton } from "@mui/lab";
|
||||
import { Import } from "@/@types/claims";
|
||||
import { HeadCell, Order } from '@/@types/table';
|
||||
|
||||
export default function DailyMonitoringList() {
|
||||
const [searchParams, setSearchParams] = useSearchParams();
|
||||
@@ -34,8 +43,7 @@ export default function DailyMonitoringList() {
|
||||
fontWeight: 'bold',
|
||||
};
|
||||
|
||||
|
||||
|
||||
const [importResult, setImportResult] = useState<Import>(null);
|
||||
// Load Data
|
||||
// -------------------
|
||||
const loadDataTableData = async (appliedFilter: any | null = null) => {
|
||||
@@ -57,46 +65,156 @@ export default function DailyMonitoringList() {
|
||||
loadDataTableData(filter);
|
||||
setSearchParams(filter);
|
||||
};
|
||||
|
||||
|
||||
/* ------------------------------ handle params ----------------------------- */
|
||||
const [appliedParams, setAppliedParams] = useState({});
|
||||
|
||||
const params = {
|
||||
searchParams: searchParams,
|
||||
setSearchParams: setSearchParams,
|
||||
appliedParams: appliedParams,
|
||||
setAppliedParams: setAppliedParams,
|
||||
};
|
||||
|
||||
/* ------------------------------ handle order ------------------------------ */
|
||||
const [order, setOrder] = useState<Order>('desc');
|
||||
const [orderBy, setOrderBy] = useState('submission_date');
|
||||
|
||||
const orders = {
|
||||
order: order,
|
||||
setOrder: setOrder,
|
||||
orderBy: orderBy,
|
||||
setOrderBy: setOrderBy,
|
||||
};
|
||||
|
||||
/* ------------------------------- handle sort ------------------------------ */
|
||||
const handleRequestSort = async (event: React.MouseEvent<unknown>, property: string) => {
|
||||
const isAsc = orders?.orderBy === property && orders?.order === 'asc';
|
||||
|
||||
orders?.setOrder(isAsc ? 'desc' : 'asc');
|
||||
orders?.setOrderBy(property);
|
||||
const parameters = Object.fromEntries([
|
||||
...(params?.searchParams.entries() as IterableIterator<[string, string]>),
|
||||
['order', isAsc ? 'desc' : 'asc'],
|
||||
['orderBy', property],
|
||||
]);
|
||||
params?.setAppliedParams(parameters);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
loadDataTableData();
|
||||
}, [])
|
||||
}, [appliedParams, searchParams, order, orderBy, setSearchParams])
|
||||
|
||||
function SearchInput(props: any) {
|
||||
// SEARCH
|
||||
const searchInput = useRef<HTMLInputElement>(null);
|
||||
const [searchText, setSearchText] = useState('');
|
||||
|
||||
// Start Date
|
||||
// con
|
||||
|
||||
const handleSearchChange = (event: any) => {
|
||||
const newSearchText = event.target.value ?? '';
|
||||
setSearchText(newSearchText);
|
||||
};
|
||||
|
||||
const handleSearchSubmit = (event: any) => {
|
||||
event.preventDefault();
|
||||
props.onSearch({ search: searchText }); // Trigger to Parent
|
||||
};
|
||||
|
||||
|
||||
|
||||
const today = new Date(); // Default ke hari ini
|
||||
|
||||
const [startDate, setStartDate] = useState<Date | null>(today);
|
||||
const [endDate, setEndDate] = useState<Date | null>(today);
|
||||
|
||||
useEffect(() => {
|
||||
// Set nilai default saat pertama kali load jika searchParams kosong
|
||||
const paramStartDate = searchParams.get('start_date');
|
||||
const paramEndDate = searchParams.get('end_date');
|
||||
|
||||
if (paramStartDate) {
|
||||
setStartDate(new Date(paramStartDate));
|
||||
}
|
||||
if (paramEndDate) {
|
||||
setEndDate(new Date(paramEndDate));
|
||||
}
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
// Trigger First Search
|
||||
setSearchText(searchParams.get('search') ?? '');
|
||||
}, []);
|
||||
|
||||
|
||||
return (
|
||||
<form onSubmit={handleSearchSubmit} style={{ width: '100%' }}>
|
||||
<TextField
|
||||
id="search-input"
|
||||
ref={searchInput}
|
||||
label="Search"
|
||||
variant="outlined"
|
||||
fullWidth
|
||||
onChange={handleSearchChange}
|
||||
value={searchText}
|
||||
placeholder='Search Member Code or Member Name...'
|
||||
/>
|
||||
<form style={{ width: '100%' }}>
|
||||
<Grid container spacing={2} >
|
||||
<Grid item md={8}>
|
||||
<TextField
|
||||
id="search-input"
|
||||
ref={searchInput}
|
||||
label="Search"
|
||||
variant="outlined"
|
||||
fullWidth
|
||||
onChange={handleSearchChange}
|
||||
onKeyDown={(event) => {
|
||||
if (event.key === 'Enter') {
|
||||
// handleSearchSubmit(event);
|
||||
|
||||
const filter = Object.fromEntries([
|
||||
...searchParams.entries(),
|
||||
['search', searchText],
|
||||
]);
|
||||
setSearchParams(filter);
|
||||
loadDataTableData(filter);
|
||||
}
|
||||
}}
|
||||
value={searchText}
|
||||
placeholder='Search Code or Name...'
|
||||
/>
|
||||
</Grid>
|
||||
{/* Start Date */}
|
||||
<Grid item md={2}>
|
||||
<LocalizationProvider dateAdapter={AdapterDateFns}>
|
||||
<DesktopDatePicker
|
||||
label="Start Date"
|
||||
inputFormat="dd/MM/yyyy"
|
||||
value={startDate}
|
||||
onChange={(value) => {
|
||||
if (value) {
|
||||
setStartDate(value);
|
||||
const dateStr = fDateOnly(value);
|
||||
const filter = Object.fromEntries([...searchParams.entries(), ['start_date', dateStr]]);
|
||||
setSearchParams(filter);
|
||||
loadDataTableData(filter);
|
||||
}
|
||||
}}
|
||||
renderInput={(params) => <TextField {...params} variant="outlined" />}
|
||||
/>
|
||||
</LocalizationProvider>
|
||||
</Grid>
|
||||
|
||||
{/* End Date */}
|
||||
<Grid item md={2}>
|
||||
<LocalizationProvider dateAdapter={AdapterDateFns}>
|
||||
<DesktopDatePicker
|
||||
label="End Date"
|
||||
inputFormat="dd/MM/yyyy"
|
||||
value={endDate}
|
||||
onChange={(value) => {
|
||||
if (value) {
|
||||
setEndDate(value);
|
||||
const dateStr = fDateOnly(value);
|
||||
const filter = Object.fromEntries([...searchParams.entries(), ['end_date', dateStr]]);
|
||||
setSearchParams(filter);
|
||||
loadDataTableData(filter);
|
||||
}
|
||||
}}
|
||||
renderInput={(params) => <TextField {...params} variant="outlined" />}
|
||||
/>
|
||||
</LocalizationProvider>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
</form>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function ImportForm(props: any) {
|
||||
// IMPORT
|
||||
@@ -110,6 +228,7 @@ export default function DailyMonitoringList() {
|
||||
const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {
|
||||
setAnchorEl(event.currentTarget);
|
||||
};
|
||||
|
||||
const handleClose = () => {
|
||||
setAnchorEl(null);
|
||||
};
|
||||
@@ -124,7 +243,8 @@ export default function DailyMonitoringList() {
|
||||
};
|
||||
|
||||
const handleCancelImportButton = () => {
|
||||
|
||||
importForm.current.value = '';
|
||||
importForm.current.dispatchEvent(new Event('change', { bubbles: true }));
|
||||
};
|
||||
|
||||
const handleImportChange = (event: any) => {
|
||||
@@ -136,32 +256,146 @@ export default function DailyMonitoringList() {
|
||||
};
|
||||
|
||||
const handleUpload = () => {
|
||||
|
||||
if (importForm.current?.files.length) {
|
||||
const formData = new FormData();
|
||||
formData.append('file', importForm.current?.files[0]);
|
||||
|
||||
setImportLoading(true);
|
||||
axios
|
||||
.post(`customer-service/request/import`, formData)
|
||||
.then((response) => {
|
||||
handleCancelImportButton();
|
||||
loadDataTableData();
|
||||
setImportResult(response.data);
|
||||
// alert('Succesfully read '+ response.data.total_successed_row + ' with ' + response.data.total_failed_row + ' failed rows');
|
||||
setImportLoading(false);
|
||||
})
|
||||
.catch((response) => {
|
||||
enqueueSnackbar(
|
||||
'Looks like something went wrong. Please check your data and try again. ' +
|
||||
response.message,
|
||||
{ variant: 'error' }
|
||||
);
|
||||
setImportLoading(false);
|
||||
});
|
||||
} else {
|
||||
enqueueSnackbar('No File Selected', { variant: 'warning' });
|
||||
}
|
||||
};
|
||||
|
||||
const handleGetTemplate = (type :string) => {
|
||||
|
||||
axios.get('corporates/import-document-example/' + type)
|
||||
.then((response) => {
|
||||
const link = document.createElement('a');
|
||||
link.href = response.data.data.file_url;
|
||||
link.setAttribute('download', response.data.data.file_name);
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
handleClose();
|
||||
})
|
||||
}
|
||||
|
||||
const handleGetData = (type :string) => {
|
||||
|
||||
}
|
||||
|
||||
const navigate = useNavigate()
|
||||
|
||||
return (
|
||||
<div>
|
||||
<input
|
||||
type="file"
|
||||
id="file"
|
||||
ref={importForm}
|
||||
style={{ display: 'none' }}
|
||||
onChange={handleImportChange}
|
||||
accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel, text/plain"
|
||||
/>
|
||||
{!currentImportFileName && (
|
||||
<Stack direction={'row'} spacing={2} sx={{ p: 2 }}>
|
||||
<SearchInput onSearch={applyFilter} />
|
||||
{/* <Button
|
||||
variant="contained"
|
||||
startIcon={<AddIcon />}
|
||||
sx={{ p: 1.8 }}
|
||||
onClick={() => {
|
||||
navigate('/claim-requests/create');
|
||||
}}
|
||||
<Button
|
||||
id="import-button"
|
||||
startIcon={<DownloadIcon />}
|
||||
sx={{ p: 1.8, color: '#FFFFFF', backgroundColor: '#19BBBB', width: '125px', height: '48px' }}
|
||||
aria-controls={createMenu ? 'basic-menu' : undefined}
|
||||
aria-haspopup="true"
|
||||
aria-expanded={createMenu ? 'true' : undefined}
|
||||
onClick={handleClick}
|
||||
>
|
||||
Create
|
||||
</Button> */}
|
||||
</Button>
|
||||
<Menu
|
||||
id="import-button"
|
||||
anchorEl={anchorEl}
|
||||
open={createMenu}
|
||||
onClose={handleClose}
|
||||
MenuListProps={{
|
||||
'aria-labelledby': 'basic-button',
|
||||
}}
|
||||
>
|
||||
<MenuItem onClick={handleImportButton}>
|
||||
<Typography variant='body2'>Import</Typography>
|
||||
</MenuItem>
|
||||
<MenuItem
|
||||
onClick={() => {
|
||||
handleGetTemplate('member');
|
||||
}}
|
||||
>
|
||||
<Typography variant='body2'> Download Template</Typography>
|
||||
</MenuItem>
|
||||
<MenuItem onClick={() => navigate(`/case_management/daily_monitoring/add_monitoring`)}>
|
||||
<Typography variant='body2'>Tambah</Typography>
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
</Stack>
|
||||
)}
|
||||
|
||||
{currentImportFileName && (
|
||||
<Stack direction={'row'} spacing={2} sx={{ p: 2 }}>
|
||||
<ButtonGroup variant="outlined" aria-label="outlined button group" fullWidth>
|
||||
<Button onClick={handleImportButton} fullWidth>
|
||||
{currentImportFileName ?? 'No File Selected'}
|
||||
</Button>
|
||||
<Button
|
||||
onClick={handleCancelImportButton}
|
||||
size="small"
|
||||
fullWidth={false}
|
||||
sx={{ p: 1.8 }}
|
||||
>
|
||||
<CancelIcon color="error" />
|
||||
</Button>
|
||||
</ButtonGroup>
|
||||
|
||||
<LoadingButton
|
||||
id="upload-button"
|
||||
variant="outlined"
|
||||
startIcon={<UploadIcon />}
|
||||
sx={{ p: 1.8 }}
|
||||
onClick={handleUpload}
|
||||
loading={importLoading}
|
||||
>
|
||||
Upload
|
||||
</LoadingButton>
|
||||
</Stack>
|
||||
)}
|
||||
|
||||
{importResult && (
|
||||
<Stack direction={'row'} sx={{ px: 2, pb: 2 }}>
|
||||
<Box sx={{ color: 'text.secondary' }}>
|
||||
Last Import Result :{' '}
|
||||
<Box sx={{ color: 'success.main', display: 'inline' }}>
|
||||
{importResult.total_success_row ?? 0}
|
||||
</Box>{' '}
|
||||
Row Processed,{' '}
|
||||
<Box sx={{ color: 'error.main', display: 'inline' }}>
|
||||
{importResult.total_failed_row}
|
||||
</Box>{' '}
|
||||
Failed, Report :{' '}
|
||||
<a href={importResult.result_file?.url ?? '#'}>
|
||||
{importResult.result_file?.name ?? '-'}
|
||||
</a>
|
||||
</Box>
|
||||
</Stack>
|
||||
)}
|
||||
</div>
|
||||
@@ -175,12 +409,19 @@ export default function DailyMonitoringList() {
|
||||
<TableHead>
|
||||
<TableRow>
|
||||
<TableCell style={TableHeadStyle} align="left" width={50} />
|
||||
<TableCell style={TableHeadStyle} align="left" width={160}>Admission Date</TableCell>
|
||||
<TableCell style={TableHeadStyle} align="left" width={150}>Member ID</TableCell>
|
||||
<TableCell style={TableHeadStyle} align="left" width={'*'}>Name</TableCell>
|
||||
<TableCell style={TableHeadStyle} align="left" width={160}>Start Date</TableCell>
|
||||
<TableCell style={TableHeadStyle} align="left" width={160}>End Date</TableCell>
|
||||
<TableCell style={TableHeadStyle} align="left" width={160}>Admission Date</TableCell>
|
||||
<TableCell style={TableHeadStyle} align="left" width={160}>Provider</TableCell>
|
||||
<TableCell style={TableHeadStyle} align="left" width={160}>Tanggal Lahir</TableCell>
|
||||
<TableCell style={TableHeadStyle} align="left" width={160}>Member Type</TableCell>
|
||||
<TableCell style={TableHeadStyle} align="left" width={160}>Dokter 1</TableCell>
|
||||
<TableCell style={TableHeadStyle} align="left" width={160}>Dokter 2</TableCell>
|
||||
<TableCell style={TableHeadStyle} align="left" width={160}>Temp Diagnosa</TableCell>
|
||||
<TableCell style={TableHeadStyle} align="left" width={160}>Diagnosa Akhir</TableCell>
|
||||
<TableCell style={TableHeadStyle} align="left" width={160}>Approval Pendamping</TableCell>
|
||||
<TableCell style={TableHeadStyle} align="left" width={160}>Keterangan</TableCell>
|
||||
<TableCell style={TableHeadStyle} align="left" width={160}>Penjaminan</TableCell>
|
||||
<TableCell style={TableHeadStyle} align="left" width={160}>Catatan</TableCell>
|
||||
<TableCell align="left" width={"10"} />
|
||||
</TableRow>
|
||||
</TableHead>
|
||||
|
||||
@@ -21,6 +21,7 @@ import TableMoreMenu from '@/components/table/TableMoreMenu';
|
||||
*/
|
||||
import { fDate } from "@/utils/formatTime";
|
||||
import { DailyMonitoringListType } from "../Model/Types";
|
||||
import { Edit } from "@mui/icons-material";
|
||||
|
||||
type Props = {
|
||||
row: DailyMonitoringListType,
|
||||
@@ -29,12 +30,20 @@ type Props = {
|
||||
|
||||
export default function DailyMonitoringListRow ({ ...props }: Props) {
|
||||
const navigate = useNavigate()
|
||||
|
||||
|
||||
return (
|
||||
<React.Fragment>
|
||||
|
||||
<TableRow hover sx={{ '& > td': { borderBottom: '1' } }}>
|
||||
<TableCell align="left" />
|
||||
<TableCell align="left">
|
||||
<Label
|
||||
variant="ghost"
|
||||
color="default"
|
||||
>
|
||||
{props.row.addmision_date ? fDate(props.row.addmision_date) : '-'}
|
||||
</Label>
|
||||
</TableCell>
|
||||
<TableCell align="left">{props.row.member_id}</TableCell>
|
||||
<TableCell align="left">{props.row.name}</TableCell>
|
||||
<TableCell align="left">
|
||||
@@ -42,34 +51,44 @@ export default function DailyMonitoringListRow ({ ...props }: Props) {
|
||||
variant="ghost"
|
||||
color="default"
|
||||
>
|
||||
{fDate(props.row.start_date)}
|
||||
{props.row.birth_date ? fDate(props.row.birth_date) : '-'}
|
||||
</Label>
|
||||
</TableCell>
|
||||
<TableCell align="left">
|
||||
<Label
|
||||
variant="ghost"
|
||||
color="default"
|
||||
>
|
||||
{fDate(props.row.end_date)}
|
||||
</Label>
|
||||
{props.row.member_type}
|
||||
</TableCell>
|
||||
<TableCell align="left">{props.row.doctor_1}</TableCell>
|
||||
<TableCell align="left">{props.row.doctor_2}</TableCell>
|
||||
<TableCell align="left">{props.row.temp_diagnosis}</TableCell>
|
||||
<TableCell align="left">{props.row.final_diagnosis}</TableCell>
|
||||
<TableCell align="left">{props.row.approval_pendamping}</TableCell>
|
||||
<TableCell align="left">
|
||||
<Label
|
||||
variant="ghost"
|
||||
color="default"
|
||||
>
|
||||
{fDate(props.row.addmision_date)}
|
||||
</Label>
|
||||
{props.row.description
|
||||
? props.row.description.length > 130
|
||||
? props.row.description.substring(0, 130) + "..."
|
||||
: props.row.description
|
||||
: "-"}
|
||||
</TableCell>
|
||||
<TableCell align="left">{props.row.provider || "-"}</TableCell>
|
||||
<TableCell align="left">
|
||||
{props.row.note
|
||||
? props.row.note.length > 130
|
||||
? props.row.note.substring(0, 130) + "..."
|
||||
: props.row.note
|
||||
: "-"}
|
||||
</TableCell>
|
||||
<TableCell align="left">{props.row.provider}</TableCell>
|
||||
<TableCell align="right" onClick={(e) => e.stopPropagation()}>
|
||||
<Stack direction="row" justifyContent="flex-end" spacing={1}>
|
||||
<TableMoreMenu actions={
|
||||
<>
|
||||
<MenuItem onClick={() => navigate(`/case_management/daily_monitoring/${props.row.member_id}/${props.row.organization_id}/claims`)}>
|
||||
<MenuItem onClick={() => navigate(`/case_management/daily_monitoring/${props.row.member_id}/claims/${props.row.code}/list_monitoring`)}>
|
||||
<Visibility />
|
||||
View
|
||||
</MenuItem>
|
||||
<MenuItem onClick={() => navigate(`/case_management/daily_monitoring/${props.row.member_id}/claims/${props.row.code}/${props.row.id}`)}>
|
||||
<Edit />
|
||||
Edit
|
||||
</MenuItem>
|
||||
</>
|
||||
} />
|
||||
</Stack>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
import { useFieldArray, useForm } from 'react-hook-form';
|
||||
import { useNavigate, useParams } from 'react-router-dom';
|
||||
import { Box, IconButton, Typography, Grid, Card, Button, ButtonBase, Stack, Autocomplete } from '@mui/material';
|
||||
import { Box, IconButton, Typography, Grid, Card, Button, ButtonBase, Stack, Autocomplete, CircularProgress } from '@mui/material';
|
||||
import { LoadingButton } from "@mui/lab";
|
||||
|
||||
/**
|
||||
@@ -28,41 +28,41 @@ import InsertDriveFileIcon from '@mui/icons-material/InsertDriveFile';
|
||||
* Utils, Types, Functions
|
||||
* ============================================
|
||||
*/
|
||||
import { AddMonitoringDetail, UpdateMonitoringDetail, getMonitoringDetailById, getMonitoringDetailList, getMonitorungDetailById, getOrganizationId } from '../Model/Functions';
|
||||
import { AddMonitoringDetail, UpdateMonitoringDetail, getMonitoringDetailById, getOrganizationId } from '../Model/Functions';
|
||||
import { DetailMonitoringListType} from '../Model/Types';
|
||||
import FormCreateFilesUpload from '@/pages/CustomerService/FinalLog/Components/FormCreateFilesUpload';
|
||||
import MultiFilePreview from '@/components/upload/MultiFilePreview';
|
||||
import Iconify from '@/components/Iconify';
|
||||
import { useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { TextField } from '@mui/material';
|
||||
import axios from "@/utils/axios";
|
||||
|
||||
type Detail = {
|
||||
row : DetailMonitoringListType|undefined
|
||||
}
|
||||
|
||||
export default function DetailMonitoringList() {
|
||||
const { member_id, claim_code, id} = useParams();
|
||||
const { member_id, id} = useParams();
|
||||
const [organizationId, setOrganizationId] = useState<number|undefined>();
|
||||
const [isEdit, setIsEdit] = useState<boolean|undefined>(false);
|
||||
const [data, setData] = useState<DetailMonitoringListType>();
|
||||
|
||||
const navigate = useNavigate()
|
||||
const pageTitle = claim_code??'_ _ _ _';
|
||||
const fileInput1 = useRef<HTMLInputElement>(null);
|
||||
const fileInput2 = useRef<HTMLInputElement>(null);
|
||||
const fileInput3 = useRef<HTMLInputElement>(null);
|
||||
|
||||
const loadOrganizationID = async () => {
|
||||
const organization_id = await getOrganizationId(claim_code??'');
|
||||
setOrganizationId(organization_id);
|
||||
}
|
||||
// const loadOrganizationID = async () => {
|
||||
// const organization_id = await getOrganizationId('');
|
||||
// setOrganizationId(organization_id);
|
||||
// }
|
||||
const loadDetailDailyMonitoring = async () => {
|
||||
const monitoring = await getMonitoringDetailById(id??'')
|
||||
const monitoring = await getMonitoringDetailById('')
|
||||
setData(monitoring)
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
loadOrganizationID();
|
||||
// loadOrganizationID();
|
||||
if (id){
|
||||
loadDetailDailyMonitoring();
|
||||
setIsEdit(true)
|
||||
@@ -75,7 +75,15 @@ export default function DetailMonitoringList() {
|
||||
const defaultValues = useMemo(
|
||||
() => ({
|
||||
id : data?.id ??'',
|
||||
claim_code : data?.claim_code ?? '',
|
||||
// claim_code : data?.claim_code ?? '',
|
||||
log_code : data?.log_code ?? '',
|
||||
doctor_1 : data?.doctor_1 ?? '',
|
||||
doctor_2 : data?.doctor_2 ?? '',
|
||||
temp_diagnosis : data?.temp_diagnosis ?? '',
|
||||
final_diagnosis : data?.final_diagnosis ?? '',
|
||||
approval_pendamping : data?.approval_pendamping ?? '',
|
||||
keterangan : data?.keterangan ?? '',
|
||||
catatan : data?.catatan ?? '',
|
||||
claim_id : data?.claim_id ?? '',
|
||||
subject : data?.subject ?? '',
|
||||
objective : data?.object ?? '',
|
||||
@@ -188,7 +196,6 @@ export default function DetailMonitoringList() {
|
||||
arr_result.push(event.target.files[0]);
|
||||
|
||||
setValue('result', arr_result)
|
||||
console.log('test3')
|
||||
}
|
||||
else {
|
||||
console.log('NO FILE');
|
||||
@@ -230,35 +237,70 @@ export default function DetailMonitoringList() {
|
||||
// =====================================
|
||||
const submitHandler = async (data: DetailMonitoringListType) => {
|
||||
|
||||
const response = isEdit ? await UpdateMonitoringDetail(data) : await AddMonitoringDetail(claim_code??'', data);
|
||||
const response = isEdit ? await UpdateMonitoringDetail(data) : await AddMonitoringDetail('', data);
|
||||
|
||||
if (response == true) {
|
||||
reset();
|
||||
if (isEdit) {
|
||||
navigate('/case_management/daily_monitoring/'+member_id+'/claims/'+claim_code+'/list_monitoring', { replace: true });
|
||||
navigate('/case_management/daily_monitoring', { replace: true });
|
||||
} else {
|
||||
navigate('/case_management/daily_monitoring/'+member_id+'/'+organizationId+'/claims', { replace: true });
|
||||
navigate('/case_management/daily_monitoring', { replace: true });
|
||||
}
|
||||
// window.location.reload()
|
||||
}
|
||||
}
|
||||
|
||||
const [selectedReason, setSelectedReason] = useState({value:'-', label:''});
|
||||
const [selectedCode, setSelectedCode] = useState({value:'-', label:''});
|
||||
const reasons = [
|
||||
{ value: 'Wrong Setting', label: 'Wrong Setting' },
|
||||
{ value: 'Hospital Request', label: 'Hospital Request' }
|
||||
];
|
||||
|
||||
const [codes, setCodes] = useState([{ value: '-', label: '-' }]); // Data hasil pencarian
|
||||
const [searchTerm, setSearchTerm] = useState(''); // Nilai input pencarian
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
// Ambil data dari API dan atur opsi ICD
|
||||
axios.get('codeLog')
|
||||
.then((response) => {
|
||||
setCodes(response.data.data);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error('Error fetching Code LOG options:', error);
|
||||
});
|
||||
|
||||
}, []); // useEffect dijalankan hanya sekali saat komponen dimount
|
||||
useEffect(() => {
|
||||
const fetchCodes = async () => {
|
||||
if (searchTerm.length > 2) { // Hanya fetch jika input lebih dari 2 karakter
|
||||
try {
|
||||
const response = await axios.get(`codeLog?search=${searchTerm}`);
|
||||
setCodes(response.data.data);
|
||||
} catch (error) {
|
||||
console.error('Error fetching codes:', error);
|
||||
setCodes([]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const debounceFetch = setTimeout(fetchCodes, 500); // Debounce 500ms
|
||||
return () => clearTimeout(debounceFetch);
|
||||
}, [searchTerm]);
|
||||
const [searchCode, setSearchCode] = useState('');
|
||||
|
||||
const [error, setError] = useState(true);
|
||||
|
||||
return (
|
||||
<Page title={pageTitle}>
|
||||
<Page title=''>
|
||||
<Box sx={{ display: 'flex', alignItems: 'center', pl: '22px', mb: '40px' }}>
|
||||
<IconButton size='large' color='inherit' onClick={() => navigate(`/case_management/daily_monitoring/${member_id}/${organizationId}/claims`)} >
|
||||
<IconButton size='large' color='inherit' onClick={() => navigate(`/case_management/daily_monitoring`)} >
|
||||
<ArrowBackIosNew/>
|
||||
</IconButton>
|
||||
|
||||
<Typography variant="h5" sx={{ marginLeft: '24px' }}>
|
||||
{pageTitle}
|
||||
Tambah Daily Monitoring
|
||||
</Typography>
|
||||
</Box>
|
||||
|
||||
@@ -269,6 +311,43 @@ export default function DetailMonitoringList() {
|
||||
{/* Date */}
|
||||
<Grid item xs={12}>
|
||||
<Grid container spacing={3}>
|
||||
<Grid item xs={12}>
|
||||
<Typography variant="body1" component="div">
|
||||
Code Letter of Guarantee* :
|
||||
</Typography>
|
||||
</Grid>
|
||||
<Grid item xs={12} sx={{ display: 'flex', gap: 1 }}>
|
||||
<Autocomplete
|
||||
options={codes}
|
||||
getOptionLabel={(option) => option.label}
|
||||
fullWidth
|
||||
value={selectedCode}
|
||||
onChange={(event, newValue) => {
|
||||
setSelectedCode(newValue);
|
||||
setValue('log_code',newValue?.value)
|
||||
// Validasi jika newValue adalah null
|
||||
if (!newValue) {
|
||||
setError('Please select a code');
|
||||
} else {
|
||||
setError('');
|
||||
}
|
||||
}}
|
||||
onInputChange={(event, newInputValue) => {
|
||||
setSearchTerm(newInputValue); // Set nilai pencarian untuk fetch data
|
||||
}}
|
||||
renderInput={(params) => (
|
||||
<RHFTextField
|
||||
{...params}
|
||||
label="Code LOG"
|
||||
variant="outlined"
|
||||
id="log_code"
|
||||
name='log_code'
|
||||
error={false} // Menampilkan error jika ada
|
||||
helperText={error} // Menampilkan pesan kesalahan
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item xs={12}>
|
||||
<Typography variant="body1" component="div">
|
||||
Date* :
|
||||
@@ -285,6 +364,72 @@ export default function DetailMonitoringList() {
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
{/* Doctor 1 */}
|
||||
<Grid item xs={12}>
|
||||
<Grid container spacing={3}>
|
||||
<Grid item xs={12}>
|
||||
<Typography variant="body1" component="div">
|
||||
Dokter 1
|
||||
</Typography>
|
||||
</Grid>
|
||||
<Grid item xs={12}>
|
||||
<RHFTextField
|
||||
id="doctor_1"
|
||||
name='doctor_1'
|
||||
placeholder='Dokter 1'
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item xs={12}>
|
||||
<Typography variant="body1" component="div">
|
||||
Dokter 2
|
||||
</Typography>
|
||||
</Grid>
|
||||
<Grid item xs={12}>
|
||||
<RHFTextField
|
||||
id="doctor_2"
|
||||
name='doctor_2'
|
||||
placeholder='Dokter 2'
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item xs={12}>
|
||||
<Typography variant="body1" component="div">
|
||||
Temp Diagnosis
|
||||
</Typography>
|
||||
</Grid>
|
||||
<Grid item xs={12}>
|
||||
<RHFTextField
|
||||
id="temp_diagnosis"
|
||||
name='temp_diagnosis'
|
||||
placeholder='Temp Diagnosis'
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item xs={12}>
|
||||
<Typography variant="body1" component="div">
|
||||
Final Diagnosis
|
||||
</Typography>
|
||||
</Grid>
|
||||
<Grid item xs={12}>
|
||||
<RHFTextField
|
||||
id="final_diagnosis"
|
||||
name='final_diagnosis'
|
||||
placeholder='Final Diagnosis'
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item xs={12}>
|
||||
<Typography variant="body1" component="div">
|
||||
Approval Pendamping
|
||||
</Typography>
|
||||
</Grid>
|
||||
<Grid item xs={12}>
|
||||
<RHFTextField
|
||||
id="approval_pendamping"
|
||||
name='approval_pendamping'
|
||||
placeholder='Approval Pendamping'
|
||||
/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
{/* Subject */}
|
||||
<Grid item xs={12}>
|
||||
<Grid container spacing={3}>
|
||||
@@ -562,6 +707,28 @@ export default function DetailMonitoringList() {
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
{/* Keterangan dan Catatan */}
|
||||
<Grid item xs={12}>
|
||||
<Grid container spacing={3}>
|
||||
<Grid item xs={12}>
|
||||
<Typography variant="body1" component="div">
|
||||
Keterangan
|
||||
</Typography>
|
||||
</Grid>
|
||||
<Grid item xs={12}>
|
||||
<RHFEditor id="keterangan" name="keterangan" placeholder="Keterangan"/>
|
||||
</Grid>
|
||||
<Grid item xs={12}>
|
||||
<Typography variant="body1" component="div">
|
||||
Catatan
|
||||
</Typography>
|
||||
</Grid>
|
||||
<Grid item xs={12}>
|
||||
<RHFEditor id="catatan" name="catatan" placeholder="Catatan"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
{/* Confirmation Medical Letter */}
|
||||
<Grid item xs={12}>
|
||||
<Grid container spacing={3}>
|
||||
@@ -673,7 +840,7 @@ export default function DetailMonitoringList() {
|
||||
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
|
||||
{/* Laboratorium */}
|
||||
<Grid item xs={12}>
|
||||
<Grid container spacing={3}>
|
||||
@@ -823,7 +990,7 @@ export default function DetailMonitoringList() {
|
||||
<Grid item xs={12} md={12}>
|
||||
<Box display="flex" justifyContent={'flex-end'}>
|
||||
<Box display="flex" gap={1}>
|
||||
<Button variant="outlined" color="inherit" onClick={() => isEdit ? navigate(`/case_management/daily_monitoring/${member_id}/claims/${claim_code}/list_monitoring`) : navigate(`/case_management/daily_monitoring/${member_id}/${organizationId}/claims`)}>
|
||||
<Button variant="outlined" color="inherit" onClick={() => navigate(`/case_management/daily_monitoring`)}>
|
||||
Cancel
|
||||
</Button>
|
||||
<LoadingButton disabled={ isEdit ? error : !isDirty} type="submit" variant="contained" loading={isSubmitting}>
|
||||
|
||||
@@ -56,7 +56,7 @@ export default function DetailMonitoringList() {
|
||||
// Use Effect
|
||||
// --------------------
|
||||
useEffect(() => {
|
||||
loadDataTableData();
|
||||
// loadDataTableData();
|
||||
}, [])
|
||||
|
||||
// Dialog
|
||||
@@ -165,13 +165,13 @@ export default function DetailMonitoringList() {
|
||||
|
||||
// Load Data
|
||||
// -------------------
|
||||
const loadDataTableData = async () => {
|
||||
const response = await getMonitoringDetailList(claim_code??'');
|
||||
const organization_id = await getOrganizationId(claim_code??'');
|
||||
// const loadDataTableData = async () => {
|
||||
// const response = await getMonitoringDetailList(claim_code??'');
|
||||
// const organization_id = await getOrganizationId(claim_code??'');
|
||||
|
||||
setDetailMonitoringList(response);
|
||||
setOrganizationId(organization_id);
|
||||
}
|
||||
// setDetailMonitoringList(response);
|
||||
// setOrganizationId(organization_id);
|
||||
// }
|
||||
|
||||
const renderHTML = (data:string) => {
|
||||
return (
|
||||
|
||||
@@ -51,7 +51,7 @@ export const AddMonitoringDetail = async ( claim_code: string,data: DetailMonito
|
||||
|
||||
const formData = makeFormData({...data});
|
||||
|
||||
const response = await axios.post(`/case_management/daily_monitoring/detail/${claim_code}/add-request`, formData)
|
||||
const response = await axios.post(`/case_management/daily_monitoring/add-request`, formData)
|
||||
.then((res) =>{
|
||||
enqueueSnackbar(res.data.message, {
|
||||
variant: 'success',
|
||||
|
||||
@@ -3,12 +3,21 @@
|
||||
*/
|
||||
export type DailyMonitoringListType = {
|
||||
member_id : string,
|
||||
member_type : string,
|
||||
birth_date : string,
|
||||
name : string,
|
||||
start_date : string,
|
||||
end_date : string,
|
||||
addmision_date : string,
|
||||
provider : string,
|
||||
organization_id : number,
|
||||
start_date : string,
|
||||
end_date : string,
|
||||
description : string,
|
||||
doctor_1 : string,
|
||||
doctor_2 : string,
|
||||
temp_diagnosis : string,
|
||||
final_diagnosis : string,
|
||||
approval_pendamping : string,
|
||||
note : string,
|
||||
addmision_date : string,
|
||||
provider : string,
|
||||
organization_id : number,
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -50,7 +59,15 @@ export type ClaimListType = {
|
||||
export type DetailMonitoringListType = {
|
||||
id : number|null,
|
||||
claim_id : string|null,
|
||||
log_code : string|null,
|
||||
claim_code : string|undefined,
|
||||
doctor_1 : string|undefined,
|
||||
doctor_2 : string|undefined,
|
||||
temp_diagnosis : string|undefined,
|
||||
final_diagnosis : string|undefined,
|
||||
approval_pendamping : string|undefined,
|
||||
keterangan : string|undefined,
|
||||
catatan : string|undefined,
|
||||
subject : string|undefined,
|
||||
object : string|undefined,
|
||||
objective : string|undefined,
|
||||
|
||||
@@ -233,6 +233,10 @@ export default function Router() {
|
||||
path: 'daily_monitoring/:member_id/claims/:claim_code/add_monitoring',
|
||||
element: <DetailMonitoringForm />
|
||||
},
|
||||
{
|
||||
path: 'daily_monitoring/add_monitoring',
|
||||
element: <DetailMonitoringForm />
|
||||
},
|
||||
{
|
||||
path: 'daily_monitoring/:member_id/claims/:claim_code/:id',
|
||||
element: <DetailMonitoringForm />
|
||||
|
||||
Reference in New Issue
Block a user