diff --git a/frontend/client-portal/src/components/TablePagination.tsx b/frontend/client-portal/src/components/TablePagination.tsx new file mode 100755 index 00000000..5d1e8392 --- /dev/null +++ b/frontend/client-portal/src/components/TablePagination.tsx @@ -0,0 +1,24 @@ +/* ---------------------------------- @mui ---------------------------------- */ +import { TablePagination, TablePaginationProps } from '@mui/material'; +import { Box } from '@mui/system'; + +export default function BaseTablePagination({ + count, + onPageChange, + page, + rowsPerPage, + onRowsPerPageChange, +}: TablePaginationProps) { + return ( + + + + ); +} diff --git a/frontend/client-portal/src/pages/AlarmCenter/Index.tsx b/frontend/client-portal/src/pages/AlarmCenter/Index.tsx index 1f00f75f..1909d0bd 100755 --- a/frontend/client-portal/src/pages/AlarmCenter/Index.tsx +++ b/frontend/client-portal/src/pages/AlarmCenter/Index.tsx @@ -1,19 +1,105 @@ -// mui -import { Container, Grid, Card } from '@mui/material'; -// components +/* ---------------------------------- react --------------------------------- */ +import { useState, SyntheticEvent } from 'react'; +/* ---------------------------------- @mui ---------------------------------- */ +import { Box, Tabs, Tab, Container, Grid, Card, Typography } from '@mui/material'; +import { styled } from '@mui/material/styles'; +/* ------------------------------- components ------------------------------- */ import Page from '../../components/Page'; -// utils +/* ---------------------------------- hooks --------------------------------- */ import useSettings from '../../hooks/useSettings'; -// sections -// import ListTable from '../../sections/claimreports/ListTable'; -// import ClaimStatusCard from '../../sections/claimreports/ClaimStatusCard'; - import List from './List'; +/* ------------------------------ 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 ( + + ); +} + +function a11yProps(index: number) { + return { + id: `simple-tab-${index}`, + 'aria-controls': `simple-tabpanel-${index}`, + }; +} + +const StyledTabs = styled((props: StyledTabsProps) => )({ + 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) => )( + ({ 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 { corporate_id } = useParams(); + const [value, setValue] = useState(0); + const handleChange = (event: SyntheticEvent, newValue: number) => { + setValue(newValue); + }; return ( @@ -21,7 +107,22 @@ export default function Drugs() { - + + + + + + + + + + + + Item Two + + + Item Two + diff --git a/frontend/client-portal/src/pages/AlarmCenter/List.tsx b/frontend/client-portal/src/pages/AlarmCenter/List.tsx index 5b362fcd..c0df53b1 100755 --- a/frontend/client-portal/src/pages/AlarmCenter/List.tsx +++ b/frontend/client-portal/src/pages/AlarmCenter/List.tsx @@ -1,16 +1,6 @@ // @mui import { - Box, - Button, - Card, - Collapse, - IconButton, - InputLabel, - MenuItem, - OutlinedInput, Paper, - Select, - SelectChangeEvent, Table, TableBody, TableCell, @@ -18,39 +8,17 @@ import { TableHead, TableRow, TextField, - Typography, - Badge, - Tab, - Tabs, - CardHeader, Stack, - Menu, - ButtonGroup, - Pagination, - Grid, } from '@mui/material'; -import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown'; -import KeyboardArrowRightIcon from '@mui/icons-material/KeyboardArrowRight'; -import AddIcon from '@mui/icons-material/Add'; -import UploadIcon from '@mui/icons-material/Upload'; -import CancelIcon from '@mui/icons-material/Cancel'; // hooks -import React, { ChangeEvent, Component, useEffect, useRef, useState } from 'react'; -import useSettings from '../../hooks/useSettings'; -import { useNavigate, useParams, useSearchParams } from 'react-router-dom'; +import React, { ChangeEvent, useEffect, useRef, useState } from 'react'; +import { useSearchParams } from 'react-router-dom'; // components import axios from '../../utils/axios'; -import { LaravelPaginatedData } from '../../@types/paginated-data'; -import { Icd } from '../../@types/diagnosis'; import BasePagination from '../../components/BasePagination'; -import { Member } from '../../@types/member'; export default function List() { - const navigate = useNavigate(); - const { themeStretch } = useSettings(); - const { corporate_id } = useParams(); const [searchParams, setSearchParams] = useSearchParams(); - const [importResult, setImportResult] = useState(null); function SearchInput(props: any) { // SEARCH @@ -70,10 +38,10 @@ export default function List() { useEffect(() => { // Trigger First Search setSearchText(searchParams.get('search') ?? ''); - }, [searchParams]); + }, []); return ( -
+ (null); - const createMenu = Boolean(anchorEl); - const importForm = useRef(null); - const [currentImportFileName, setCurrentImportFileName] = useState(null); - - const handleClick = (event: React.MouseEvent) => { - setAnchorEl(event.currentTarget); - }; - - const handleClose = () => { - setAnchorEl(null); - }; - - const handleImportButton = () => { - if (importForm?.current) { - handleClose(); - importForm.current ? importForm.current.click() : console.log('No File selected'); - } else { - alert('No file selected'); - } - }; - - const handleCancelImportButton = () => { - importForm.current.value = ''; - importForm.current.dispatchEvent(new Event('change', { bubbles: true })); - }; - - const handleImportChange = (event: any) => { - if (event.target.files[0]) { - setCurrentImportFileName(event.target.files[0].name); - } else { - setCurrentImportFileName(null); - } - }; - - const handleUpload = () => { - if (importForm.current?.files.length) { - const formData = new FormData(); - formData.append('file', importForm.current?.files[0]); - axios - .post(`master/formularium/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'); - }) - .catch((response) => { - alert( - 'Looks like something went wrong. Please check your data and try again. ' + - response.message - ); - }); - } else { - alert('No File Selected'); - } - }; - - return ( -
- - {!currentImportFileName && ( - - - - )} - - {currentImportFileName && ( - - - - - - - - - )} - {importResult && ( - - - Last Import Result Report :{' '} - - {importResult.result_file?.name ?? '-'} - - - - )} -
- ); - } - - // Called on every row to map the data to the columns - function createData(member: Member): Member { - return { - ...member, - }; - } - - // Generate the every row of the table - function Row(props: { row: ReturnType }) { - const { row } = props; - const [open, setOpen] = React.useState(true); - - return ( - - *': { borderBottom: 'unset' } }}> - - setOpen(!open)}> - {open ? : } - - - {row.member_id} - {row.payor_id} - {row.name} - {row.nik} - {row.nric} - - - - - {/* */} - - {/* COLLAPSIBLE ROW */} - - - - - - - - - - - - - ); - } - - // Dummy Default Data - const [dataTableIsLoading, setDataTableLoading] = useState(true); - const [dataTableLastRequest, setDataTableLastRequest] = useState(0); - const [dataTableResponseState, setDataTableResponseState] = useState('idle'); - const [dataTableData, setDataTableData] = useState({ - current_page: 1, - data: [], - path: '', - first_page_url: '', - last_page: 1, - last_page_url: '', - next_page_url: '', - prev_page_url: '', - per_page: 10, - from: 0, - to: 0, - total: 0, - }); - const [dataTablePage, setDataTablePage] = useState(5); - - const loadDataTableData = async (appliedFilter: any | null = null) => { - setDataTableLoading(true); - const filter = appliedFilter ? appliedFilter : Object.fromEntries([...searchParams.entries()]); - const response = await axios.get('/members', { params: filter }); - - setDataTableData(response.data.members); - setDataTableLoading(false); - }; - const headStyle = { fontWeight: 'bold', }; - const applyFilter = async (searchFilter: string) => { - await loadDataTableData({ search: searchFilter }); - setSearchParams({ search: searchFilter }); - }; - - const handlePageChange = (event: ChangeEvent, value: number) => { - const filter = Object.fromEntries([...searchParams.entries(), ['page', value]]); - loadDataTableData(filter); - setSearchParams(filter); - }; - - useEffect(() => { - loadDataTableData(); - }, []); - return ( - - - - - + {/* Search */} + - + {/* The Main Table */} + + + + + + No + + + Name + + + Member ID + + + Service + + + Start Date + + + End Date + + + Status + + + + + + + No Data + + + +
+
- - {/* The Main Table */} - - - - - - No - - - Name - - - Member ID - - - Service - - - Start Date - - - End Date - - - Status - - - - {dataTableIsLoading ? ( - - - - Loading - - - - ) : dataTableData.data.length === 0 ? ( - - - - No Data - - - - ) : ( - - {dataTableData.data.map((row) => ( - - ))} - - )} -
-
- - -
+ {/* Pagination */} + {/* */}
); } diff --git a/frontend/client-portal/src/pages/AlarmCenter/ServiceMonitoring.tsx b/frontend/client-portal/src/pages/AlarmCenter/ServiceMonitoring.tsx index b1dca8f2..f0fe0040 100755 --- a/frontend/client-portal/src/pages/AlarmCenter/ServiceMonitoring.tsx +++ b/frontend/client-portal/src/pages/AlarmCenter/ServiceMonitoring.tsx @@ -1,6 +1,5 @@ // mui import { - Button, Box, Tabs, Tab, @@ -18,7 +17,7 @@ import Page from '../../components/Page'; import Iconify from '../../components/Iconify'; // utils import useSettings from '../../hooks/useSettings'; -import { useRef, useState, SyntheticEvent } from 'react'; +import { useState, SyntheticEvent } from 'react'; // sections // import ListTable from '../../sections/claimreports/ListTable'; // import ClaimStatusCard from '../../sections/claimreports/ClaimStatusCard';