Update Claim Request
This commit is contained in:
@@ -4,7 +4,6 @@ import { useContext, useEffect, useState } from 'react';
|
||||
import { Container, Grid } from '@mui/material';
|
||||
/* ------------------------------- components ------------------------------- */
|
||||
import Page from '../../components/Page';
|
||||
import TableList from '../../components/Table';
|
||||
/* ---------------------------------- hooks --------------------------------- */
|
||||
import useSettings from '../../hooks/useSettings';
|
||||
/* -------------------------------- sections -------------------------------- */
|
||||
@@ -13,13 +12,7 @@ import CardClaimStatus from '../../sections/claim-report/CardClaimStatus';
|
||||
import axios from '../../utils/axios';
|
||||
/* --------------------------------- context -------------------------------- */
|
||||
import { UserCurrentCorporateContext } from '../../contexts/UserCurrentCorporate';
|
||||
/* --------------------------------- orders --------------------------------- */
|
||||
import { HeadCell, Order, PaginationTableProps } from '../../@types/table';
|
||||
import { useSearchParams } from 'react-router-dom';
|
||||
import List from './List';
|
||||
import ClaimItems from '../Claims/components/ClaimItems';
|
||||
import DiagnosisHistory from '../Claims/components/DiagnosisHistory';
|
||||
import Documents from '../Claims/components/Documents';
|
||||
// theme
|
||||
import palette from '../../theme/palette';
|
||||
|
||||
@@ -32,115 +25,10 @@ interface ClaimStatusType {
|
||||
export default function Drugs() {
|
||||
const { themeStretch } = useSettings();
|
||||
const { corporateValue } = useContext(UserCurrentCorporateContext);
|
||||
|
||||
const [listClaimStatusItems, setListClaimStatusItems] = useState<ClaimStatusType[]>([]);
|
||||
const [listAllMemberByClaimStatus, setListAllMemberByClaimStatus] = useState([]);
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* setTable */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
|
||||
const loadings = {
|
||||
isLoading: isLoading,
|
||||
setIsLoading: setIsLoading,
|
||||
};
|
||||
|
||||
/* ------------------------------ handle params ----------------------------- */
|
||||
const [searchParams, setSearchParams] = useSearchParams();
|
||||
const [appliedParams, setAppliedParams] = useState({});
|
||||
|
||||
const params = {
|
||||
searchParams: searchParams,
|
||||
setSearchParams: setSearchParams,
|
||||
appliedParams: appliedParams,
|
||||
setAppliedParams: setAppliedParams,
|
||||
};
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
/* ------------------------------ handle order ------------------------------ */
|
||||
const [order, setOrder] = useState<Order>('asc');
|
||||
const [orderBy, setOrderBy] = useState('fullName');
|
||||
|
||||
const orders = {
|
||||
order: order,
|
||||
setOrder: setOrder,
|
||||
orderBy: orderBy,
|
||||
setOrderBy: setOrderBy,
|
||||
};
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
/* ---------------------------- handle pagination --------------------------- */
|
||||
const [page, setPage] = useState(0);
|
||||
const [rowsPerPage, setRowsPerPage] = useState(10);
|
||||
|
||||
const [paginationTable, setPaginationTable] = useState<PaginationTableProps>({
|
||||
current_page: 0,
|
||||
from: 0,
|
||||
last_page: 0,
|
||||
links: [],
|
||||
path: '',
|
||||
per_page: 0,
|
||||
to: 0,
|
||||
total: 0,
|
||||
});
|
||||
|
||||
const paginations = {
|
||||
page: page,
|
||||
setPage: setPage,
|
||||
rowsPerPage: rowsPerPage,
|
||||
setRowsPerPage: setRowsPerPage,
|
||||
paginationTable: paginationTable,
|
||||
setPaginationTable: setPaginationTable,
|
||||
};
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
/* -------------------------------- headCell -------------------------------- */
|
||||
const headCells: HeadCell<never>[] = [
|
||||
{
|
||||
id: 'memberId',
|
||||
align: 'left',
|
||||
label: 'Member ID',
|
||||
isSort: true,
|
||||
},
|
||||
{
|
||||
id: 'codeRequest',
|
||||
align: 'left',
|
||||
label: 'Code Request',
|
||||
isSort: true,
|
||||
},
|
||||
{
|
||||
id: 'fullName',
|
||||
align: 'center',
|
||||
label: 'Name',
|
||||
isSort: true,
|
||||
},
|
||||
{
|
||||
id: 'division',
|
||||
align: 'center',
|
||||
label: 'Divisi',
|
||||
isSort: true,
|
||||
},
|
||||
{
|
||||
id: 'submissionDate',
|
||||
align: 'center',
|
||||
label: 'Submission Date',
|
||||
isSort: true,
|
||||
},
|
||||
{
|
||||
id: 'status',
|
||||
align: 'center',
|
||||
label: 'Status',
|
||||
isSort: true,
|
||||
},
|
||||
];
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
setIsLoading(true);
|
||||
|
||||
const claimStatus = await axios.get(`${corporateValue}/claim-report/claim-status`);
|
||||
|
||||
setListClaimStatusItems([
|
||||
@@ -160,28 +48,8 @@ export default function Drugs() {
|
||||
color: palette.dark.error.dark,
|
||||
},
|
||||
]);
|
||||
|
||||
const parameters =
|
||||
Object.keys(appliedParams).length !== 0
|
||||
? appliedParams
|
||||
: Object.fromEntries([
|
||||
...searchParams.entries(),
|
||||
['order', orders.order],
|
||||
['orderBy', orders.orderBy],
|
||||
]);
|
||||
|
||||
const claim = await axios.get(`${corporateValue}/members`, {
|
||||
params: { ...parameters, type: 'claim-report' },
|
||||
});
|
||||
|
||||
setSearchParams(parameters);
|
||||
|
||||
setListAllMemberByClaimStatus(claim.data.data.allMembersByClaimStatus.data);
|
||||
setPaginationTable(claim.data.data.allMembersByClaimStatus);
|
||||
|
||||
setIsLoading(false);
|
||||
})();
|
||||
}, [appliedParams, searchParams, order, orderBy, setSearchParams, corporateValue]);
|
||||
}, [corporateValue]);
|
||||
|
||||
return (
|
||||
<Page title="Claim Reports">
|
||||
@@ -192,15 +60,6 @@ export default function Drugs() {
|
||||
</Grid>
|
||||
<Grid item xs={12} lg={12} md={12}>
|
||||
<List />
|
||||
|
||||
{/* <TableList
|
||||
headCells={headCells}
|
||||
rows={listAllMemberByClaimStatus}
|
||||
orders={orders}
|
||||
paginations={paginations}
|
||||
loadings={loadings}
|
||||
params={params}
|
||||
/> */}
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Container>
|
||||
|
||||
Reference in New Issue
Block a user