Merge branch 'origin/production' of https://dev.sismedika.online/febio/aso into origin/production
This commit is contained in:
@@ -196,6 +196,26 @@ export default function Table<T>({
|
||||
/>
|
||||
</form>
|
||||
</Grid>
|
||||
) : exportReport && exportReport.useExport && filterStatus === undefined ? (
|
||||
<Grid item xs={12} lg={10} xl={10}>
|
||||
<form onSubmit={searchs.handleSearchSubmit}>
|
||||
<TextField
|
||||
id="search-input"
|
||||
variant="outlined"
|
||||
onChange={(event) => searchs.setSearchText(event.target.value)}
|
||||
value={searchs.searchText}
|
||||
fullWidth
|
||||
InputProps={{
|
||||
startAdornment: (
|
||||
<InputAdornment position="start">
|
||||
<SearchIcon />
|
||||
</InputAdornment>
|
||||
),
|
||||
}}
|
||||
placeholder="Search Name or Member ID... "
|
||||
/>
|
||||
</form>
|
||||
</Grid>
|
||||
) : (
|
||||
<Grid item xs={12} lg={searchs.fullWidth ? 12 : 6} xl={searchs.fullWidth ? 12 : 6}>
|
||||
<form onSubmit={searchs.handleSearchSubmit}>
|
||||
|
||||
@@ -32,16 +32,18 @@ export default function NavSectionVertical({
|
||||
<Box {...other}>
|
||||
{navConfig.map((group, index) => (
|
||||
<List key={index} disablePadding sx={{ px: 2 }}>
|
||||
<ListSubheaderStyle
|
||||
key={index}
|
||||
sx={{
|
||||
...(isCollapse && {
|
||||
opacity: 0,
|
||||
}),
|
||||
}}
|
||||
>
|
||||
{group.subheader}
|
||||
</ListSubheaderStyle>
|
||||
{group.subheader && (
|
||||
<ListSubheaderStyle
|
||||
key={index}
|
||||
sx={{
|
||||
...(isCollapse && {
|
||||
opacity: 0,
|
||||
}),
|
||||
}}
|
||||
>
|
||||
{group.subheader}
|
||||
</ListSubheaderStyle>
|
||||
)}
|
||||
|
||||
{group.items.map((list) => (
|
||||
<NavListRoot key={list.title} list={list} isCollapse={isCollapse} />
|
||||
|
||||
@@ -7,7 +7,7 @@ const navConfig = [
|
||||
items: [{ title: 'Dashboard', path: '/dashboard' }],
|
||||
},
|
||||
|
||||
// Corporate
|
||||
// Corporate
|
||||
// ----------------------------------------------------------------------
|
||||
{
|
||||
subheader: 'Corporate',
|
||||
@@ -15,21 +15,19 @@ const navConfig = [
|
||||
{
|
||||
title: 'Corporate',
|
||||
path: '/corporate',
|
||||
// icon: ICONS.default,
|
||||
},
|
||||
{
|
||||
title: 'Employee Data',
|
||||
path: '/employee-data',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
|
||||
// Alarm Center
|
||||
// ----------------------------------------------------------------------
|
||||
{
|
||||
subheader: 'Case Management',
|
||||
items: [
|
||||
{
|
||||
title: 'Employee Data',
|
||||
path: '/employee-data',
|
||||
},
|
||||
{
|
||||
title: 'Alarm Center',
|
||||
path: '/alarm-center',
|
||||
@@ -45,7 +43,6 @@ const navConfig = [
|
||||
],
|
||||
},
|
||||
|
||||
|
||||
// User Management
|
||||
// ----------------------------------------------------------------------
|
||||
// {
|
||||
|
||||
@@ -1,105 +1,15 @@
|
||||
/* ---------------------------------- react --------------------------------- */
|
||||
import { useState, SyntheticEvent } from 'react';
|
||||
/* ---------------------------------- @mui ---------------------------------- */
|
||||
import { Box, Tabs, Tab, Container, Grid, Card } from '@mui/material';
|
||||
import { styled } from '@mui/material/styles';
|
||||
import { Container, Grid } from '@mui/material';
|
||||
/* ------------------------------- components ------------------------------- */
|
||||
import Page from '../../components/Page';
|
||||
/* ---------------------------------- hooks --------------------------------- */
|
||||
import useSettings from '../../hooks/useSettings';
|
||||
import List from './List';
|
||||
import ServiceMonitoring from './ServiceMonitoring';
|
||||
import UserProfile from './UserProfile';
|
||||
import HeaderBreadcrumbs from '../../components/HeaderBreadcrumbs';
|
||||
|
||||
/* ------------------------------ tabs setting ------------------------------ */
|
||||
|
||||
/* ---------------------------------- types --------------------------------- */
|
||||
|
||||
interface TabPanelProps {
|
||||
children?: React.ReactNode;
|
||||
index: number;
|
||||
value: number;
|
||||
}
|
||||
|
||||
interface StyledTabsProps {
|
||||
children?: React.ReactNode;
|
||||
value: number;
|
||||
onChange: (event: React.SyntheticEvent, newValue: number) => void;
|
||||
}
|
||||
|
||||
interface StyledTabProps {
|
||||
label: string;
|
||||
icon?: string | React.ReactElement;
|
||||
}
|
||||
|
||||
/* -------------------------------- tab style ------------------------------- */
|
||||
|
||||
function TabPanel(props: TabPanelProps) {
|
||||
const { children, value, index, ...other } = props;
|
||||
|
||||
return (
|
||||
<div
|
||||
role="tabpanel"
|
||||
hidden={value !== index}
|
||||
id={`simple-tabpanel-${index}`}
|
||||
aria-labelledby={`simple-tab-${index}`}
|
||||
{...other}
|
||||
>
|
||||
{value === index && <Box>{children}</Box>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function a11yProps(index: number) {
|
||||
return {
|
||||
id: `simple-tab-${index}`,
|
||||
'aria-controls': `simple-tabpanel-${index}`,
|
||||
};
|
||||
}
|
||||
|
||||
const StyledTabs = styled((props: StyledTabsProps) => <Tabs {...props} />)({
|
||||
backgroundColor: '#F4F6F8',
|
||||
padding: '0 24px',
|
||||
'& .MuiTabs-indicator': {
|
||||
display: 'flex',
|
||||
justifyContent: 'space-between',
|
||||
backgroundColor: 'transparent',
|
||||
},
|
||||
'& .MuiTabs-indicatorSpan': {
|
||||
maxWidth: 40,
|
||||
backgroundColor: '#635ee7',
|
||||
},
|
||||
});
|
||||
|
||||
const StyledTab = styled((props: StyledTabProps) => <Tab disableRipple {...props} />)(
|
||||
({ theme }) => ({
|
||||
textTransform: 'none',
|
||||
fontWeight: 600,
|
||||
color: theme.palette.grey[600],
|
||||
marginRight: '5rem',
|
||||
'&.Mui-selected': {
|
||||
color: '#212B36',
|
||||
borderBottom: '2px solid ' + theme.palette.primary.main,
|
||||
},
|
||||
'&:hover': {
|
||||
color: '#212B36',
|
||||
opacity: 1,
|
||||
borderBottom: '2px solid ' + theme.palette.primary.main,
|
||||
},
|
||||
})
|
||||
);
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
export default function Drugs() {
|
||||
const { themeStretch } = useSettings();
|
||||
|
||||
const [value, setValue] = useState(0);
|
||||
const handleChange = (event: SyntheticEvent, newValue: number) => {
|
||||
setValue(newValue);
|
||||
};
|
||||
|
||||
return (
|
||||
<Page title="Alarm Center">
|
||||
<Container maxWidth={themeStretch ? false : 'xl'}>
|
||||
@@ -107,29 +17,12 @@ export default function Drugs() {
|
||||
heading={'Alarm Center'}
|
||||
links={[
|
||||
{ name: 'Case Management', href: '/alarm-center' },
|
||||
{ name: 'Alarm Center', href: '/alarm-center'}
|
||||
{ name: 'Alarm Center', href: '/alarm-center' },
|
||||
]}
|
||||
/>
|
||||
<Grid container>
|
||||
<Grid item xs={12} lg={12} md={12}>
|
||||
{/* <Card> */}
|
||||
{/* <Box sx={{ borderBottom: 1, borderColor: 'divider' }}>
|
||||
<StyledTabs value={value} onChange={handleChange} aria-label="basic tabs example">
|
||||
<StyledTab label="All Data" {...a11yProps(0)} />
|
||||
<StyledTab label="Ongoing" {...a11yProps(1)} />
|
||||
<StyledTab label="Done" {...a11yProps(2)} />
|
||||
</StyledTabs>
|
||||
</Box> */}
|
||||
<TabPanel value={value} index={0}>
|
||||
<List />
|
||||
</TabPanel>
|
||||
{/* <TabPanel value={value} index={1}>
|
||||
<ServiceMonitoring/>
|
||||
</TabPanel>
|
||||
<TabPanel value={value} index={2}>
|
||||
<UserProfile />
|
||||
</TabPanel> */}
|
||||
{/* </Card> */}
|
||||
<List />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Container>
|
||||
|
||||
@@ -1,149 +1,23 @@
|
||||
/* ---------------------------------- @mui ---------------------------------- */
|
||||
import {
|
||||
Paper,
|
||||
Table,
|
||||
TableBody,
|
||||
TableCell,
|
||||
TableContainer,
|
||||
TableHead,
|
||||
TableRow,
|
||||
TextField,
|
||||
Stack,
|
||||
Button,
|
||||
TableSortLabel,
|
||||
Box,
|
||||
SelectChangeEvent,
|
||||
Typography,
|
||||
MenuItem
|
||||
} from '@mui/material';
|
||||
import { visuallyHidden } from '@mui/utils';
|
||||
import { SelectChangeEvent, MenuItem } from '@mui/material';
|
||||
/* ---------------------------------- axios --------------------------------- */
|
||||
// import axios from 'axios';
|
||||
import axios from '../../utils/axios';
|
||||
/* ---------------------------------- react --------------------------------- */
|
||||
import { useContext, useEffect, useState } from 'react';
|
||||
|
||||
/* -------------------------------- component ------------------------------- */
|
||||
import Iconify from '../../components/Iconify';
|
||||
import BaseTablePagination from '../../components/BaseTablePagination';
|
||||
import TableComponent from '../../components/Table';
|
||||
|
||||
/* ---------------------------------- hooks --------------------------------- */
|
||||
import useMap from '../../hooks/useMap';
|
||||
/* ---------------------------------- theme --------------------------------- */
|
||||
import palette from '../../theme/palette';
|
||||
import { UserCurrentCorporateContext } from '../../contexts/UserCurrentCorporate';
|
||||
import { HeadCell, Order, PaginationTableProps } from '../../@types/table';
|
||||
import { useSearchParams, useNavigate, Link } from 'react-router-dom';
|
||||
import { useSearchParams, useNavigate } from 'react-router-dom';
|
||||
import { fDateSuffix } from '../../utils/formatTime';
|
||||
import TableMoreMenu from '../../components/table/TableMoreMenu';
|
||||
import VisibilityOutlinedIcon from '@mui/icons-material/VisibilityOutlined';
|
||||
import { enqueueSnackbar } from 'notistack';
|
||||
|
||||
import DetailDataMember from './ListMember';
|
||||
import Label from '../../components/Label';
|
||||
|
||||
|
||||
/* ---------------------------------- types --------------------------------- */
|
||||
|
||||
// type PaginationTableProps = {
|
||||
// current_page: number;
|
||||
// from: number;
|
||||
// last_page: number;
|
||||
// links: [];
|
||||
// path: string;
|
||||
// per_page: number;
|
||||
// to: number;
|
||||
// total: number;
|
||||
// };
|
||||
|
||||
// type DataTableProps = {
|
||||
// fullName: string;
|
||||
// memberId: string;
|
||||
// service: string;
|
||||
// start_date: string;
|
||||
// end_date: string;
|
||||
// status: boolean | number;
|
||||
// };
|
||||
|
||||
// /* -------------------------------------------------------------------------- */
|
||||
|
||||
// /* -------------------------- enchanced table head -------------------------- */
|
||||
|
||||
// type Order = 'asc' | 'desc';
|
||||
|
||||
// interface HeadCell {
|
||||
// id: string;
|
||||
// label: string;
|
||||
// }
|
||||
|
||||
// const headCells: readonly HeadCell[] = [
|
||||
// {
|
||||
// id: 'name',
|
||||
// label: 'Name',
|
||||
// },
|
||||
// {
|
||||
// id: 'member_id',
|
||||
// label: 'Member ID',
|
||||
// },
|
||||
// {
|
||||
// id: 'service',
|
||||
// label: 'Service',
|
||||
// },
|
||||
// {
|
||||
// id: 'start_date',
|
||||
// label: 'Start Date',
|
||||
// },
|
||||
// {
|
||||
// id: 'end_date',
|
||||
// label: 'End Date',
|
||||
// },
|
||||
// {
|
||||
// id: 'status',
|
||||
// label: 'Status',
|
||||
// },
|
||||
// ];
|
||||
|
||||
// interface EnhancedTableProps {
|
||||
// onRequestSort: (event: React.MouseEvent<unknown>, property: string) => void;
|
||||
// order: Order;
|
||||
// orderBy: string;
|
||||
// }
|
||||
|
||||
// function EnhancedTableHead(props: EnhancedTableProps) {
|
||||
// const { order, orderBy, onRequestSort } = props;
|
||||
// const createSortHandler = (property: string) => (event: React.MouseEvent<unknown>) => {
|
||||
// onRequestSort(event, property);
|
||||
// };
|
||||
|
||||
// return (
|
||||
// <TableHead>
|
||||
// <TableRow>
|
||||
// <TableCell align="center">No</TableCell>
|
||||
// {headCells.map((headCell) => (
|
||||
// <TableCell
|
||||
// key={headCell.id}
|
||||
// sortDirection={orderBy === headCell.id ? order : false}
|
||||
// align="center"
|
||||
// >
|
||||
// <TableSortLabel
|
||||
// active={orderBy === headCell.id}
|
||||
// direction={orderBy === headCell.id ? order : 'asc'}
|
||||
// onClick={createSortHandler(headCell.id)}
|
||||
// >
|
||||
// {headCell.label}
|
||||
// {orderBy === headCell.id ? (
|
||||
// <Box component="span" sx={visuallyHidden}>
|
||||
// {order === 'desc' ? 'sorted descending' : 'sorted ascending'}
|
||||
// </Box>
|
||||
// ) : null}
|
||||
// </TableSortLabel>
|
||||
// </TableCell>
|
||||
// ))}
|
||||
// </TableRow>
|
||||
// </TableHead>
|
||||
// );
|
||||
// }
|
||||
import { Stack } from '@mui/material';
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
@@ -237,7 +111,7 @@ export default function List() {
|
||||
handleSearchSubmit: handleSearchSubmit,
|
||||
};
|
||||
|
||||
/* ------------------------------ handle filter ----------------------------- */
|
||||
/* ------------------------------ handle filter ----------------------------- */
|
||||
const [statusValue, setStatusValue] = useState('all');
|
||||
const [filterData, setStatusData] = useState([]);
|
||||
|
||||
@@ -263,7 +137,7 @@ export default function List() {
|
||||
config: {
|
||||
label: 'Status',
|
||||
statusValue: statusValue,
|
||||
filterData: filterData,
|
||||
statusData: filterData,
|
||||
handleStatusChange: handleStatusChanges,
|
||||
},
|
||||
};
|
||||
@@ -273,13 +147,16 @@ export default function List() {
|
||||
|
||||
const handleStartDateChanges = async (event: React.FormEvent<HTMLFormElement>) => {
|
||||
event.preventDefault();
|
||||
console.log(startDateValue)
|
||||
console.log(startDateValue);
|
||||
if (startDateValue === '') {
|
||||
searchParams.delete('start_date');
|
||||
const params = Object.fromEntries([...searchParams.entries()]);
|
||||
setAppliedParams(params);
|
||||
} else {
|
||||
const params = Object.fromEntries([...searchParams.entries(), ['start_date', startDateValue]]);
|
||||
const params = Object.fromEntries([
|
||||
...searchParams.entries(),
|
||||
['start_date', startDateValue],
|
||||
]);
|
||||
setAppliedParams(params);
|
||||
}
|
||||
};
|
||||
@@ -314,7 +191,7 @@ export default function List() {
|
||||
};
|
||||
|
||||
/* -------------------------------- handle export --------------------------- */
|
||||
const handleExportReport = async () => {
|
||||
const handleExportReport = async () => {
|
||||
var filter = Object.fromEntries([...searchParams.entries()]);
|
||||
|
||||
await axios
|
||||
@@ -339,8 +216,8 @@ export default function List() {
|
||||
startDate: startDateValue,
|
||||
endDate: endDateValue,
|
||||
status: statusValue,
|
||||
handleExportReport: handleExportReport
|
||||
}
|
||||
handleExportReport: handleExportReport,
|
||||
};
|
||||
|
||||
/* -------------------------------- headCell -------------------------------- */
|
||||
const headCells: HeadCell<never>[] = [
|
||||
@@ -356,7 +233,7 @@ export default function List() {
|
||||
label: 'Name',
|
||||
isSort: true,
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
id: 'start_date',
|
||||
align: 'center',
|
||||
@@ -400,72 +277,34 @@ export default function List() {
|
||||
});
|
||||
|
||||
const status = [
|
||||
{"id": 1, "name": "Done" },
|
||||
{"id": 0, "name": "On Going" },
|
||||
|
||||
]
|
||||
setStatusData(status)
|
||||
{ id: 1, name: 'Done' },
|
||||
{ id: 0, name: 'On Going' },
|
||||
];
|
||||
setStatusData(status);
|
||||
|
||||
setData(
|
||||
response.data.data.map((obj: any) => {
|
||||
return {
|
||||
...obj,
|
||||
// memberId:
|
||||
// // <Link to={'/user-profile/'+obj.personId} >
|
||||
// <Button
|
||||
// onClick={() => navigate ('/user-profile/'+obj.personId)}
|
||||
// >{obj.memberId}</Button>
|
||||
// ,
|
||||
start_date:
|
||||
<Label>{ fDateSuffix(obj.start_date) }</Label>
|
||||
,
|
||||
end_date:
|
||||
<Label> { fDateSuffix(obj.end_date) }</Label>
|
||||
,
|
||||
// status:
|
||||
// obj.status === 1 ? (
|
||||
// <Typography
|
||||
// sx={{
|
||||
// background: 'rgba(84, 214, 44, 0.16)',
|
||||
// color: '#229A16',
|
||||
// paddingX: 1.5,
|
||||
// paddingY: 1,
|
||||
// borderRadius: 3,
|
||||
// }} variant='overline'
|
||||
// >
|
||||
// Done
|
||||
// </Typography>
|
||||
// ) : (
|
||||
// <Typography
|
||||
// sx={{
|
||||
// background: 'rgba(255, 193, 7, 0.16)',
|
||||
// color: '#BF6919',
|
||||
// paddingX: 1.5,
|
||||
// paddingY: 1,
|
||||
// borderRadius: 3,
|
||||
// }} variant='overline'
|
||||
// >
|
||||
// Ongoing
|
||||
// </Typography>
|
||||
// ),
|
||||
action:
|
||||
<TableMoreMenu actions={
|
||||
response.data.data.map((obj: any) => ({
|
||||
...obj,
|
||||
start_date: <Label>{fDateSuffix(obj.start_date)}</Label>,
|
||||
end_date: <Label> {fDateSuffix(obj.end_date)}</Label>,
|
||||
action: (
|
||||
<TableMoreMenu
|
||||
actions={
|
||||
<>
|
||||
<MenuItem onClick={() => navigate('member/'+obj.id )}>
|
||||
<MenuItem onClick={() => navigate('member/' + obj.id)}>
|
||||
<VisibilityOutlinedIcon />
|
||||
View
|
||||
</MenuItem>
|
||||
</>
|
||||
} />
|
||||
};
|
||||
})
|
||||
}
|
||||
/>
|
||||
),
|
||||
}))
|
||||
);
|
||||
|
||||
setPaginationTable(response.data);
|
||||
setRowsPerPage(response.data.per_page);
|
||||
|
||||
|
||||
|
||||
if (searchParams.get('page')) {
|
||||
//@ts-ignore
|
||||
const currentPage = parseInt(searchParams.get('page')) - 1;
|
||||
@@ -488,7 +327,6 @@ export default function List() {
|
||||
loadings={loadings}
|
||||
params={params}
|
||||
searchs={searchs}
|
||||
// filters={filters}
|
||||
filterStatus={filterStatus}
|
||||
filterStartDate={filterStartDate}
|
||||
filterEndDate={filterEndDate}
|
||||
|
||||
@@ -1,23 +1,5 @@
|
||||
/* ---------------------------------- @mui ---------------------------------- */
|
||||
import {
|
||||
Paper,
|
||||
Table,
|
||||
TableBody,
|
||||
TableCell,
|
||||
TableContainer,
|
||||
TableHead,
|
||||
TableRow,
|
||||
TextField,
|
||||
Stack,
|
||||
Button,
|
||||
TableSortLabel,
|
||||
Box,
|
||||
SelectChangeEvent,
|
||||
Typography,
|
||||
MenuItem,
|
||||
Grid
|
||||
} from '@mui/material';
|
||||
import { visuallyHidden } from '@mui/utils';
|
||||
import { Stack, Typography, MenuItem, Grid } from '@mui/material';
|
||||
/* ---------------------------------- axios --------------------------------- */
|
||||
// import axios from 'axios';
|
||||
import axios from '../../utils/axios';
|
||||
@@ -25,137 +7,27 @@ import axios from '../../utils/axios';
|
||||
import { useContext, useEffect, useState } from 'react';
|
||||
|
||||
/* -------------------------------- component ------------------------------- */
|
||||
import Iconify from '../../components/Iconify';
|
||||
import BaseTablePagination from '../../components/BaseTablePagination';
|
||||
import TableComponent from '../../components/Table';
|
||||
import ArrowBackIosIcon from '@mui/icons-material/ArrowBackIos';
|
||||
|
||||
/* ---------------------------------- hooks --------------------------------- */
|
||||
import useMap from '../../hooks/useMap';
|
||||
/* ---------------------------------- theme --------------------------------- */
|
||||
import palette from '../../theme/palette';
|
||||
import { UserCurrentCorporateContext } from '../../contexts/UserCurrentCorporate';
|
||||
import { HeadCell, Order, PaginationTableProps } from '../../@types/table';
|
||||
import { useSearchParams, useNavigate, Link, useParams } from 'react-router-dom';
|
||||
import { fDateSuffix, fPostFormat } from '../../utils/formatTime';
|
||||
import { useSearchParams, useNavigate, useParams } from 'react-router-dom';
|
||||
import { fDateSuffix } from '../../utils/formatTime';
|
||||
import TableMoreMenu from '../../components/table/TableMoreMenu';
|
||||
import VisibilityOutlinedIcon from '@mui/icons-material/VisibilityOutlined';
|
||||
import Label from '../../components/Label';
|
||||
|
||||
|
||||
/* ---------------------------------- types --------------------------------- */
|
||||
|
||||
type DataList = {
|
||||
name: string;
|
||||
};
|
||||
|
||||
// type PaginationTableProps = {
|
||||
// current_page: number;
|
||||
// from: number;
|
||||
// last_page: number;
|
||||
// links: [];
|
||||
// path: string;
|
||||
// per_page: number;
|
||||
// to: number;
|
||||
// total: number;
|
||||
// };
|
||||
|
||||
// type DataTableProps = {
|
||||
// fullName: string;
|
||||
// memberId: string;
|
||||
// service: string;
|
||||
// start_date: string;
|
||||
// end_date: string;
|
||||
// status: boolean | number;
|
||||
// };
|
||||
|
||||
// /* -------------------------------------------------------------------------- */
|
||||
|
||||
// /* -------------------------- enchanced table head -------------------------- */
|
||||
|
||||
// type Order = 'asc' | 'desc';
|
||||
|
||||
// interface HeadCell {
|
||||
// id: string;
|
||||
// label: string;
|
||||
// }
|
||||
|
||||
// const headCells: readonly HeadCell[] = [
|
||||
// {
|
||||
// id: 'name',
|
||||
// label: 'Name',
|
||||
// },
|
||||
// {
|
||||
// id: 'member_id',
|
||||
// label: 'Member ID',
|
||||
// },
|
||||
// {
|
||||
// id: 'service',
|
||||
// label: 'Service',
|
||||
// },
|
||||
// {
|
||||
// id: 'start_date',
|
||||
// label: 'Start Date',
|
||||
// },
|
||||
// {
|
||||
// id: 'end_date',
|
||||
// label: 'End Date',
|
||||
// },
|
||||
// {
|
||||
// id: 'status',
|
||||
// label: 'Status',
|
||||
// },
|
||||
// ];
|
||||
|
||||
// interface EnhancedTableProps {
|
||||
// onRequestSort: (event: React.MouseEvent<unknown>, property: string) => void;
|
||||
// order: Order;
|
||||
// orderBy: string;
|
||||
// }
|
||||
|
||||
// function EnhancedTableHead(props: EnhancedTableProps) {
|
||||
// const { order, orderBy, onRequestSort } = props;
|
||||
// const createSortHandler = (property: string) => (event: React.MouseEvent<unknown>) => {
|
||||
// onRequestSort(event, property);
|
||||
// };
|
||||
|
||||
// return (
|
||||
// <TableHead>
|
||||
// <TableRow>
|
||||
// <TableCell align="center">No</TableCell>
|
||||
// {headCells.map((headCell) => (
|
||||
// <TableCell
|
||||
// key={headCell.id}
|
||||
// sortDirection={orderBy === headCell.id ? order : false}
|
||||
// align="center"
|
||||
// >
|
||||
// <TableSortLabel
|
||||
// active={orderBy === headCell.id}
|
||||
// direction={orderBy === headCell.id ? order : 'asc'}
|
||||
// onClick={createSortHandler(headCell.id)}
|
||||
// >
|
||||
// {headCell.label}
|
||||
// {orderBy === headCell.id ? (
|
||||
// <Box component="span" sx={visuallyHidden}>
|
||||
// {order === 'desc' ? 'sorted descending' : 'sorted ascending'}
|
||||
// </Box>
|
||||
// ) : null}
|
||||
// </TableSortLabel>
|
||||
// </TableCell>
|
||||
// ))}
|
||||
// </TableRow>
|
||||
// </TableHead>
|
||||
// );
|
||||
// }
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
export default function List() {
|
||||
const navigate = useNavigate();
|
||||
|
||||
const { corporateValue } = useContext(UserCurrentCorporateContext);
|
||||
|
||||
const [data, setData] = useState([]);
|
||||
const [data, setData] = useState({
|
||||
full_name: '',
|
||||
paginations: [],
|
||||
});
|
||||
const { id } = useParams();
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
@@ -182,7 +54,7 @@ export default function List() {
|
||||
|
||||
/* ------------------------------ handle order ------------------------------ */
|
||||
const [order, setOrder] = useState<Order>('asc');
|
||||
const [orderBy, setOrderBy] = useState('fullName');
|
||||
const [orderBy, setOrderBy] = useState('admission_date');
|
||||
|
||||
const orders = {
|
||||
order: order,
|
||||
@@ -215,141 +87,10 @@ export default function List() {
|
||||
paginationTable: paginationTable,
|
||||
setPaginationTable: setPaginationTable,
|
||||
};
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
/* ------------------------------ handle search ----------------------------- */
|
||||
const [searchText, setSearchText] = useState('');
|
||||
const [name, setName] = useState('');
|
||||
|
||||
const handleSearchSubmit = async (event: React.FormEvent<HTMLFormElement>) => {
|
||||
event.preventDefault();
|
||||
|
||||
if (searchText === '') {
|
||||
searchParams.delete('search');
|
||||
const params = Object.fromEntries([...searchParams.entries()]);
|
||||
setAppliedParams(params);
|
||||
} else {
|
||||
const params = Object.fromEntries([...searchParams.entries(), ['search', searchText]]);
|
||||
setAppliedParams(params);
|
||||
}
|
||||
};
|
||||
|
||||
const searchs = {
|
||||
useSearchs: false,
|
||||
searchText: searchText,
|
||||
setSearchText: setSearchText,
|
||||
handleSearchSubmit: handleSearchSubmit,
|
||||
};
|
||||
|
||||
/* ------------------------------ handle filter ----------------------------- */
|
||||
const [statusValue, setStatusValue] = useState('all');
|
||||
const [filterData, setStatusData] = useState([]);
|
||||
|
||||
// handle status
|
||||
const handleStatusChanges = (event: SelectChangeEvent) => {
|
||||
setStatusValue(event.target.value as string);
|
||||
|
||||
if (event.target.value === 'all') {
|
||||
searchParams.delete('status');
|
||||
const params = Object.fromEntries([...searchParams.entries()]);
|
||||
setAppliedParams(params);
|
||||
} else {
|
||||
const params = Object.fromEntries([
|
||||
...searchParams.entries(),
|
||||
['status', event.target.value as string],
|
||||
]);
|
||||
setAppliedParams(params);
|
||||
}
|
||||
};
|
||||
|
||||
const filterStatus = {
|
||||
useFilter: false,
|
||||
config: {
|
||||
label: 'Status',
|
||||
statusValue: statusValue,
|
||||
filterData: filterData,
|
||||
handleStatusChange: handleStatusChanges,
|
||||
},
|
||||
};
|
||||
|
||||
// handle start date
|
||||
const [startDateValue, setStartDateValue] = useState('');
|
||||
|
||||
const handleStartDateChanges = async (event: React.FormEvent<HTMLFormElement>) => {
|
||||
event.preventDefault();
|
||||
console.log(startDateValue)
|
||||
if (startDateValue === '') {
|
||||
searchParams.delete('start_date');
|
||||
const params = Object.fromEntries([...searchParams.entries()]);
|
||||
setAppliedParams(params);
|
||||
} else {
|
||||
const params = Object.fromEntries([...searchParams.entries(), ['start_date', startDateValue]]);
|
||||
setAppliedParams(params);
|
||||
}
|
||||
};
|
||||
|
||||
const filterStartDate = {
|
||||
useFilter: false,
|
||||
startDate: startDateValue,
|
||||
setStartDate: setStartDateValue,
|
||||
handleStartDateChange: handleStartDateChanges,
|
||||
};
|
||||
|
||||
// handle end date
|
||||
const [endDateValue, setEndDateValue] = useState('');
|
||||
|
||||
const handleEndDateChanges = async (event: React.FormEvent<HTMLFormElement>) => {
|
||||
event.preventDefault();
|
||||
if (endDateValue === '') {
|
||||
searchParams.delete('end_date');
|
||||
const params = Object.fromEntries([...searchParams.entries()]);
|
||||
setAppliedParams(params);
|
||||
} else {
|
||||
const params = Object.fromEntries([...searchParams.entries(), ['end_date', endDateValue]]);
|
||||
setAppliedParams(params);
|
||||
}
|
||||
};
|
||||
|
||||
const filterEndDate = {
|
||||
useFilter: false,
|
||||
endDate: endDateValue,
|
||||
setEndDate: setEndDateValue,
|
||||
handleEndDateChange: handleEndDateChanges,
|
||||
};
|
||||
|
||||
/* -------------------------------- handle export --------------------------- */
|
||||
const handleExportReport = async () => {
|
||||
var filter = Object.fromEntries([...searchParams.entries()]);
|
||||
|
||||
await axios
|
||||
.get('claims/export', { params: filter })
|
||||
.then((res) => {
|
||||
enqueueSnackbar('Data berhasil di Export', {
|
||||
variant: 'success',
|
||||
anchorOrigin: { horizontal: 'right', vertical: 'top' },
|
||||
});
|
||||
|
||||
document.location.href = res.data.data.file_url;
|
||||
})
|
||||
.catch((err) =>
|
||||
enqueueSnackbar('Data Gagal di Export', {
|
||||
variant: 'error',
|
||||
anchorOrigin: { horizontal: 'right', vertical: 'top' },
|
||||
})
|
||||
);
|
||||
};
|
||||
|
||||
const exportReport = {
|
||||
useExport: false,
|
||||
startDate: startDateValue,
|
||||
endDate: endDateValue,
|
||||
status: statusValue,
|
||||
handleExportReport: handleExportReport
|
||||
}
|
||||
|
||||
/* -------------------------------- headCell -------------------------------- */
|
||||
const headCells: HeadCell<never>[] = [
|
||||
const headCells: HeadCell<never>[] = [
|
||||
{
|
||||
id: 'admission_date',
|
||||
align: 'center',
|
||||
@@ -368,6 +109,12 @@ export default function List() {
|
||||
label: 'Code',
|
||||
isSort: true,
|
||||
},
|
||||
{
|
||||
id: 'service_type',
|
||||
align: 'center',
|
||||
label: 'Service Type',
|
||||
isSort: false,
|
||||
},
|
||||
{
|
||||
id: 'status',
|
||||
align: 'center',
|
||||
@@ -398,59 +145,45 @@ export default function List() {
|
||||
params: { ...parameters },
|
||||
});
|
||||
|
||||
const status = [
|
||||
{"id": 1, "name": "Done" },
|
||||
{"id": 0, "name": "On Going" },
|
||||
setSearchParams(parameters);
|
||||
|
||||
]
|
||||
setStatusData(status)
|
||||
const datatable = response.data.data;
|
||||
|
||||
// if (response.data.data.length > 0){
|
||||
// setIsLoading(true);
|
||||
// } else {
|
||||
// setIsLoading(false);
|
||||
// }
|
||||
|
||||
const dataName = response.data.data[0].fullName
|
||||
setName(dataName)
|
||||
setData(
|
||||
datatable.map((obj: any) => {
|
||||
return {
|
||||
...obj,
|
||||
admission_date:
|
||||
<Label>{ fDateSuffix(obj.admission_date) }</Label>
|
||||
,
|
||||
discharge_date:
|
||||
<Label>{ fDateSuffix(obj.discharge_date) }</Label>
|
||||
,
|
||||
status:
|
||||
obj.status === 'Done' ? (
|
||||
<Label color='success'>
|
||||
Done
|
||||
</Label>
|
||||
) : (
|
||||
<Label color='warning'>
|
||||
Ongoing
|
||||
</Label>
|
||||
),
|
||||
action:
|
||||
<TableMoreMenu actions={
|
||||
setData({
|
||||
full_name: response.data.full_name,
|
||||
paginations: response.data.paginations.data.map((obj: any) => ({
|
||||
...obj,
|
||||
admission_date: obj.admission_date ? (
|
||||
<Label> {fDateSuffix(obj.admission_date)} </Label>
|
||||
) : (
|
||||
''
|
||||
),
|
||||
discharge_date: obj.discharge_date ? (
|
||||
<Label> {fDateSuffix(obj.discharge_date)} </Label>
|
||||
) : (
|
||||
''
|
||||
),
|
||||
status:
|
||||
obj.status === 'Done' ? (
|
||||
<Label color="success">Done</Label>
|
||||
) : (
|
||||
<Label color="warning">Ongoing</Label>
|
||||
),
|
||||
action: (
|
||||
<TableMoreMenu
|
||||
actions={
|
||||
<>
|
||||
<MenuItem onClick={() => navigate('service-monitoring/'+obj.claim_id )}>
|
||||
<MenuItem onClick={() => navigate('service-monitoring/' + obj.id)}>
|
||||
<VisibilityOutlinedIcon />
|
||||
View
|
||||
</MenuItem>
|
||||
</>
|
||||
} />
|
||||
};
|
||||
})
|
||||
);
|
||||
}
|
||||
/>
|
||||
),
|
||||
})),
|
||||
});
|
||||
|
||||
setPaginationTable(response.data);
|
||||
setRowsPerPage(response.data.per_page);
|
||||
|
||||
|
||||
setPaginationTable(response.data.paginations);
|
||||
setRowsPerPage(response.data.paginations.per_page);
|
||||
|
||||
if (searchParams.get('page')) {
|
||||
//@ts-ignore
|
||||
@@ -463,17 +196,14 @@ export default function List() {
|
||||
setIsLoading(false);
|
||||
})();
|
||||
}, [appliedParams, searchParams, order, orderBy, setSearchParams, corporateValue]);
|
||||
console.log(loadings);
|
||||
|
||||
return (
|
||||
<Grid container spacing={8}>
|
||||
<Grid item xs={12} paddingX="24px" >
|
||||
<Stack direction="row" alignItems="center">
|
||||
<ArrowBackIosIcon
|
||||
onClick={() => navigate(`/alarm-center`)}
|
||||
sx={{ cursor: 'pointer' }}
|
||||
/>
|
||||
<Grid container spacing={8} padding={3}>
|
||||
<Grid item xs={12}>
|
||||
<Stack direction="row" alignItems="center" gap={3}>
|
||||
<ArrowBackIosIcon onClick={() => navigate(`/alarm-center`)} sx={{ cursor: 'pointer' }} />
|
||||
<Typography variant="h5" sx={{ flexGrow: 1 }}>
|
||||
{name}
|
||||
{data.full_name}
|
||||
</Typography>
|
||||
</Stack>
|
||||
</Grid>
|
||||
@@ -481,24 +211,14 @@ export default function List() {
|
||||
<Stack>
|
||||
<TableComponent
|
||||
headCells={headCells}
|
||||
rows={data}
|
||||
rows={data.paginations}
|
||||
orders={orders}
|
||||
paginations={paginations}
|
||||
loadings={loadings}
|
||||
params={params}
|
||||
searchs={searchs}
|
||||
// filters={filters}
|
||||
filterStatus={filterStatus}
|
||||
filterStartDate={filterStartDate}
|
||||
filterEndDate={filterEndDate}
|
||||
exportReport={exportReport}
|
||||
/>
|
||||
</Stack>
|
||||
|
||||
</Grid>
|
||||
|
||||
</Grid>
|
||||
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -39,15 +39,12 @@ export default function UserProfile() {
|
||||
});
|
||||
}, []);
|
||||
|
||||
// console.log('data', data);
|
||||
// console.log('data', data);
|
||||
|
||||
return (
|
||||
<Page title="Profile">
|
||||
<Container maxWidth={themeStretch ? false : 'xl'}>
|
||||
<Stack direction="row" alignItems="center" sx={{ marginBottom: 2 }}>
|
||||
{/* <IconButton sx={{ marginRight: '10px', color: '#424242' }} onClick={() => navigate()}>
|
||||
<Iconify icon="heroicons-outline:arrow-narrow-left" />
|
||||
</IconButton> */}
|
||||
<ButtonBack />
|
||||
<Typography variant="h5">Profil Peserta</Typography>
|
||||
</Stack>
|
||||
@@ -74,7 +71,7 @@ export default function UserProfile() {
|
||||
</Grid>
|
||||
{/* Item 2 */}
|
||||
<Grid item xs={12}>
|
||||
<CardClaimHistory data={data}/>
|
||||
<CardClaimHistory data={data} />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
@@ -121,14 +121,14 @@ export default function ServiceMonitoring() {
|
||||
const { corporateValue } = useContext(UserCurrentCorporateContext);
|
||||
const { id } = useParams();
|
||||
const claimId = '2';
|
||||
// console.log('id', id);
|
||||
// console.log('id', id);
|
||||
|
||||
useEffect(() => {
|
||||
console.log('fetching data...');
|
||||
axios
|
||||
.get('/data/' + id)
|
||||
.then((response) => {
|
||||
// console.log('data fetched...', response.data);
|
||||
// console.log('data fetched...', response.data);
|
||||
setData(response.data);
|
||||
})
|
||||
.catch((error) => {
|
||||
@@ -138,7 +138,7 @@ export default function ServiceMonitoring() {
|
||||
axios
|
||||
.get('/corporate-manage/' + corporateValue)
|
||||
.then((response) => {
|
||||
// console.log('corporate fetched...', response.data);
|
||||
// console.log('corporate fetched...', response.data);
|
||||
setCorporate(response.data);
|
||||
})
|
||||
.catch((error) => {
|
||||
@@ -146,15 +146,15 @@ export default function ServiceMonitoring() {
|
||||
});
|
||||
}, []);
|
||||
|
||||
// console.log('Data:', data);
|
||||
// console.log('Data:', data);
|
||||
const [encounterData, setEncounterData] = useState({});
|
||||
|
||||
useEffect(() => {
|
||||
// console.log('fetching encounter data...');
|
||||
// console.log('fetching encounter data...');
|
||||
axios
|
||||
.get('/claims/${claim_id}/encounters')
|
||||
.then((response) => {
|
||||
// console.log('encounter data fetched...', response.data);
|
||||
// console.log('encounter data fetched...', response.data);
|
||||
setEncounterData(response.data);
|
||||
})
|
||||
.catch((error) => {
|
||||
|
||||
@@ -89,8 +89,8 @@ export default function Router() {
|
||||
},
|
||||
{
|
||||
path: '/employee-data/user-profile/:id',
|
||||
element: <EmployeeDataUserProfile/>,
|
||||
}
|
||||
element: <EmployeeDataUserProfile />,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
@@ -112,13 +112,12 @@ export default function Router() {
|
||||
element: <AlarmCenterMemberPerList />,
|
||||
},
|
||||
{
|
||||
path: 'member/:id/service-monitoring/:id',
|
||||
path: 'member/:memberId/service-monitoring/:requestLogId',
|
||||
element: <AlarmCenterServiceMonitoring />,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
|
||||
|
||||
{
|
||||
path: '/claim-submit',
|
||||
element: (
|
||||
@@ -135,7 +134,7 @@ export default function Router() {
|
||||
},
|
||||
{
|
||||
path: 'dialog-detail',
|
||||
element: <DialogDetailClaim/>
|
||||
element: <DialogDetailClaim />,
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -155,7 +154,7 @@ export default function Router() {
|
||||
},
|
||||
{
|
||||
path: 'dialog-detail',
|
||||
element: <DialogDetailClaim/>
|
||||
element: <DialogDetailClaim />,
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -180,7 +179,7 @@ export default function Router() {
|
||||
{
|
||||
path: '/claim-report/detail-history/:id',
|
||||
element: <DetailHitoryClaimReport />,
|
||||
}
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
@@ -262,9 +261,9 @@ const AlarmCenterUserProfile = Loadable(lazy(() => import('../pages/AlarmCenter/
|
||||
const ClaimReport = Loadable(lazy(() => import('../pages/ClaimReport/Index')));
|
||||
const Claims = Loadable(lazy(() => import('../pages/Claims/Index')));
|
||||
const ClaimShow = Loadable(lazy(() => import('../pages/Claims/Show')));
|
||||
const DialogDetailClaim = Loadable(lazy(()=> import('../pages/ClaimReport/DialogDetailClaim')));
|
||||
const DetailClaimReport = Loadable(lazy(()=> import('../pages/ClaimReport/Detail')));
|
||||
const DetailHitoryClaimReport = Loadable(lazy(()=> import('../pages/ClaimReport/DetailHistory')));
|
||||
const DialogDetailClaim = Loadable(lazy(() => import('../pages/ClaimReport/DialogDetailClaim')));
|
||||
const DetailClaimReport = Loadable(lazy(() => import('../pages/ClaimReport/Detail')));
|
||||
const DetailHitoryClaimReport = Loadable(lazy(() => import('../pages/ClaimReport/DetailHistory')));
|
||||
|
||||
// Claim submit
|
||||
const ClaimSubmit = Loadable(lazy(() => import('../pages/ClaimSubmit/Index')));
|
||||
|
||||
Reference in New Issue
Block a user