From 890271852359c7a74078553da90ef4a6a0348d60 Mon Sep 17 00:00:00 2001 From: R Date: Fri, 24 Feb 2023 10:45:03 +0700 Subject: [PATCH] Add Dummy Notification Data --- .../hospital-portal/src/pages/Dashboard.tsx | 32 +++++++++++++++---- .../sections/dashboard/CardNotification.tsx | 4 +-- .../src/sections/dashboard/TableList.tsx | 4 +++ 3 files changed, 31 insertions(+), 9 deletions(-) diff --git a/frontend/hospital-portal/src/pages/Dashboard.tsx b/frontend/hospital-portal/src/pages/Dashboard.tsx index a214a4f2..c9a9d56a 100755 --- a/frontend/hospital-portal/src/pages/Dashboard.tsx +++ b/frontend/hospital-portal/src/pages/Dashboard.tsx @@ -13,17 +13,18 @@ import { Stack } from '@mui/system'; import { Input } from '@mui/material'; //sections import TableList from '@/sections/dashboard/TableList'; +import { fDate } from '@/utils/formatTime'; // ---------------------------------------------------------------------- // const [notifications, setNotifications] = useState([]) -const itemList = [ - // { info: 'Mohon lengkapi dokumen Mahen sadarsa', date: 'Selasa, 20 April 22', time: '08:00 WIB' }, - // { info: 'Mohon lengkapi dokumen Mahen sadarsa', date: 'Selasa, 20 April 22', time: '09:00 WIB' }, - // { info: 'Mohon lengkapi dokumen Mahen sadarsa', date: 'Selasa, 20 April 22', time: '10:00 WIB' }, - // { info: 'Mohon lengkapi dokumen Mahen sadarsa', date: 'Selasa, 20 April 22', time: '11:00 WIB' }, -]; +// const itemList = [ +// // { info: 'Mohon lengkapi dokumen Mahen sadarsa', date: 'Selasa, 20 April 22', time: '08:00 WIB' }, +// // { info: 'Mohon lengkapi dokumen Mahen sadarsa', date: 'Selasa, 20 April 22', time: '09:00 WIB' }, +// // { info: 'Mohon lengkapi dokumen Mahen sadarsa', date: 'Selasa, 20 April 22', time: '10:00 WIB' }, +// // { info: 'Mohon lengkapi dokumen Mahen sadarsa', date: 'Selasa, 20 April 22', time: '11:00 WIB' }, +// ]; // ---------------------------------------------------------------------- @@ -63,6 +64,23 @@ export default function Dashboard() { // const [tableData, setTableData] = useState([]); const [policyData, setPolicyData] = useState(defaultPolicyData); + // TODO Remove This + const [itemList, setItemList] = useState([]); + function handleDataLoaded(dataTable) { + let dummyData = []; + dataTable.map(function(data) { + if (data.status == 'approved') { + dummyData.push({ + info: `LOG Approved for member ${data.member.full_name}`, + date: fDate(data.created_at, "dd MMMM"), + time: fDate(data.created_at, "HH:mm") + }) + } + }) + + setItemList(dummyData); + } + return ( @@ -74,7 +92,7 @@ export default function Dashboard() { - + diff --git a/frontend/hospital-portal/src/sections/dashboard/CardNotification.tsx b/frontend/hospital-portal/src/sections/dashboard/CardNotification.tsx index 6ce297c4..635d24a2 100644 --- a/frontend/hospital-portal/src/sections/dashboard/CardNotification.tsx +++ b/frontend/hospital-portal/src/sections/dashboard/CardNotification.tsx @@ -28,7 +28,7 @@ const RootNotificationStyle = styled(Card)(({ theme }) => ({ padding: '1rem 0.5rem', color: 'black', backgroundColor: theme.palette.grey[200], - maxHeight: '240px', + // maxHeight: '240px', })); const ItemNotificationStyle = styled(Card)(({ theme }) => ({ @@ -94,7 +94,7 @@ export default function CardNotification({ data }: NotificationProps) { - + {(data && data.length) ? data.map(({ info, date, time }, key) => (
diff --git a/frontend/hospital-portal/src/sections/dashboard/TableList.tsx b/frontend/hospital-portal/src/sections/dashboard/TableList.tsx index 9448654f..adc9dad5 100755 --- a/frontend/hospital-portal/src/sections/dashboard/TableList.tsx +++ b/frontend/hospital-portal/src/sections/dashboard/TableList.tsx @@ -176,6 +176,7 @@ function EnhancedTableHead({ order, orderBy, onRequestSort }: EnhancedTableProps } /* -------------------------------------------------------------------------- */ +// TODO Don't use emit export default function TableList(props: any) { const [dataTable, setDataTable] = useState([]); const [paginationTable, setPaginationTable] = useState({ @@ -306,6 +307,9 @@ export default function TableList(props: any) { setPaginationTable(response.data.data); setRowsPerPage(response.data.data.per_page); setIsLoading(false); + + // TODO Remove This + props.dataLoaded(response.data.data.data); })(); }, [appliedParams, searchParams, order, orderBy, setSearchParams]);