diff --git a/packages/esm-report-app/src/registers/MOH-405/MOH_405_component.tsx b/packages/esm-report-app/src/registers/MOH-405/MOH_405_component.tsx index fc8d6f83..b0b5a1b0 100644 --- a/packages/esm-report-app/src/registers/MOH-405/MOH_405_component.tsx +++ b/packages/esm-report-app/src/registers/MOH-405/MOH_405_component.tsx @@ -307,88 +307,97 @@ const RenderMOH405: React.FC<{ reportData: any }> = ({ reportData }) => ( - {Array.from({ length: 2 }, (_, i) => ( - - - - {/* a */} - {/* b */} - - {/* c */} - - {/* d */} - - {/* e */} - - {/* f */} - - {/* g */} - - {/* h */} - - {/* i */} - - {/* j */} - - {/* k */} - - {/* l */} - - {/* m */} - - {/* n */} - - {/* o */} - - {/* p */} - - {/* q */} - - {/* r */} - - {/* s */} - - {/* t */} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ))} + {reportData && reportData.length > 0 ? ( + reportData.map((item, i) => ( + + + {item.visit_date} + {/* a */} + + {item.marital_status} + {' '} + {/* b */} + {item.anc_number_nupi_revisit} + {/* c */} + {item.visit_date} + {/* d */} + {item.visit_date} + {/* e */} + {item.visit_date} + {/* f */} + {item.visit_date} + {/* g */} + {item.visit_date} + {/* h */} + {item.visit_date} + {/* i */} + {item.visit_date} + {/* j */} + {item.visit_date} + {/* k */} + {item.visit_date} + {/* l */} + {item.visit_date} + {/* m */} + {item.visit_date} + {/* n */} + {item.visit_date} + {/* o */} + {item.visit_date} + {/* p */} + {item.visit_date} + {/* q */} + {item.visit_date} + {/* r */} + {item.visit_date} + {/* s */} + {item.visit_date} + {/* t */} + {item.visit_date} + {item.visit_date} + {item.visit_date} + {item.visit_date} + {item.visit_date} + {item.visit_date} + {item.visit_date} + {item.visit_date} + {item.visit_date} + {item.visit_date} + {item.visit_date} + {item.visit_date} + {item.visit_date} + {item.visit_date} + {item.visit_date} + {item.visit_date} + {item.visit_date} + {item.visit_date} + {item.visit_date} + {item.visit_date} + {item.visit_date} + {item.visit_date} + {item.visit_date} + {item.visit_date} + {item.visit_date} + + + + + + + + + + + + + + + )) + ) : ( + + No data available + + )} diff --git a/packages/esm-report-app/src/registers/MOH-406/MOH_406_component.tsx b/packages/esm-report-app/src/registers/MOH-406/MOH_406_component.tsx index 6c641c83..e6c7a62c 100644 --- a/packages/esm-report-app/src/registers/MOH-406/MOH_406_component.tsx +++ b/packages/esm-report-app/src/registers/MOH-406/MOH_406_component.tsx @@ -331,62 +331,72 @@ const RenderMOH406: React.FC<{ reportData: any }> = ({ reportData }) => ( - {Array.from({ length: 2 }, (_, i) => ( - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ))} + {reportData && reportData.length > 0 ? ( + reportData.map((item, i) => ( + + + {item.patient_id} + + {item.patient_id} + + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + + {item.patient_id} + + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + + + + + + + + + + + )) + ) : ( + + No data available + + )} diff --git a/packages/esm-report-app/src/registers/MOH-407/clientFollowUp/ClientFollowUp_component.tsx b/packages/esm-report-app/src/registers/MOH-407/clientFollowUp/ClientFollowUp_component.tsx index 3d1a1795..80bb89e4 100644 --- a/packages/esm-report-app/src/registers/MOH-407/clientFollowUp/ClientFollowUp_component.tsx +++ b/packages/esm-report-app/src/registers/MOH-407/clientFollowUp/ClientFollowUp_component.tsx @@ -202,89 +202,95 @@ const ClientFollowUpRegister: React.FC<{ reportData: any }> = ({ reportData }) = - {Array.from({ length: 2 }, (_, i) => ( - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ))} + {reportData && reportData.length > 0 ? ( + reportData.map((item, i) => ( + + + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + + + )) + ) : ( + + No data available + + )} diff --git a/packages/esm-report-app/src/registers/MOH-407/nutrition/Nutrition_component.tsx b/packages/esm-report-app/src/registers/MOH-407/nutrition/Nutrition_component.tsx index 8d88e959..c7c58b8c 100644 --- a/packages/esm-report-app/src/registers/MOH-407/nutrition/Nutrition_component.tsx +++ b/packages/esm-report-app/src/registers/MOH-407/nutrition/Nutrition_component.tsx @@ -124,33 +124,43 @@ const NutritionRegister: React.FC<{ reportData: any }> = ({ reportData }) => ( - {Array.from({ length: 2 }, (_, i) => ( - - - - - - - - - - - - - - - - - - - - - - - - - - ))} + {reportData && reportData.length > 0 ? ( + reportData.map((item, i) => ( + + + {item.patient_id} + {item.patient_id} + + {item.patient_id} + + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + + {item.patient_id} + + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + {item.patient_id} + + + + + + + )) + ) : ( + + No data available + + )} diff --git a/packages/esm-report-app/src/registers/MOH-408/MOH-408-component.tsx b/packages/esm-report-app/src/registers/MOH-408/MOH-408-component.tsx index 83d4ecfa..84e4a56a 100644 --- a/packages/esm-report-app/src/registers/MOH-408/MOH-408-component.tsx +++ b/packages/esm-report-app/src/registers/MOH-408/MOH-408-component.tsx @@ -214,70 +214,76 @@ const RenderMOH408: React.FC<{ reportData: any }> = ({ reportData }) => { - {Array.from({ length: 2 }, (_, i) => ( - - - - {/* a */} - {/* b */} - - {/* c */} - - {/* d */} - - {/* e */} - - {/* f */} - - {/* g */} - - {/* h */} - - {/* i */} - - {/* j */} - - {/* k */} - - {/* l */} - - {/* m */} - - {/* n */} - - {/* o */} - - {/* p */} - - {/* q */} - - {/* r */} - - {/* s */} - - {/* t */} - - - - - - {/* */} - - - - - - - - - - - - - - - - ))} + {reportData && reportData.length > 0 ? ( + reportData.map((item, i) => ( + + + {item.patient_id} + {/* a */} + {/* b */} + + {/* c */} + + {/* d */} + + {/* e */} + + {/* f */} + + {/* g */} + + {/* h */} + + {/* i */} + + {/* j */} + + {/* k */} + + {/* l */} + + {/* m */} + + {/* n */} + + {/* o */} + + {/* p */} + + {/* q */} + + {/* r */} + + {/* s */} + + {/* t */} + + + + + + {/* */} + + + + + + + + + + + + + + + + )) + ) : ( + + No data available + + )} diff --git a/packages/esm-report-app/src/reports-dashboard/report-summary/ReportSummary.css b/packages/esm-report-app/src/reports-dashboard/report-summary/ReportSummary.css index 24f28aa4..2713df7c 100644 --- a/packages/esm-report-app/src/reports-dashboard/report-summary/ReportSummary.css +++ b/packages/esm-report-app/src/reports-dashboard/report-summary/ReportSummary.css @@ -48,3 +48,13 @@ overflow: auto; max-height: 300px; } + +.buttonContainer { + display: flex; + align-items: center; + margin-bottom: 1rem; +} + +.buttonContainer > button { + margin-right: 1rem; +} diff --git a/packages/esm-report-app/src/reports-dashboard/report-summary/ReportSummary.tsx b/packages/esm-report-app/src/reports-dashboard/report-summary/ReportSummary.tsx index 7baad0c1..a93a94b1 100644 --- a/packages/esm-report-app/src/reports-dashboard/report-summary/ReportSummary.tsx +++ b/packages/esm-report-app/src/reports-dashboard/report-summary/ReportSummary.tsx @@ -1,4 +1,4 @@ -import React, { useState } from 'react'; +import React, { useEffect, useState } from 'react'; import { DataTable, TableContainer, @@ -11,14 +11,18 @@ import { TableSelectAll, TableSelectRow, Loading, + Button, } from '@carbon/react'; import { useNavigate } from 'react-router-dom'; import styles from './ReportSummary.css'; import reportMapping from '../report-loader/reportMapping.json'; -import { generateReportData } from '../../api/api'; +import { generateReportData, getSPReports } from '../../api/api'; const ReportSummary: React.FC = ({ rows }) => { const [loading, setLoading] = useState(false); + const [refreshLoading, setRefreshLoading] = useState(false); + const [currentRows, setCurrentRows] = useState([]); + const navigate = useNavigate(); const headers = [ { key: 'status', header: 'Status' }, @@ -30,7 +34,23 @@ const ReportSummary: React.FC = ({ rows }) => { { key: 'download', header: 'Download' }, ]; - const navigate = useNavigate(); + useEffect(() => { + const rowsWithButtons = rows.map((row) => { + const reportMappingEntry = reportMapping.find((entry) => entry.report_uuid === row.uuid); + return { + ...row, + view: reportMappingEntry ? ( + + ) : null, + download: , + }; + }); + setCurrentRows(rowsWithButtons); + }, [rows]); const handleViewClick = async (report_uuid, report_id) => { setLoading(true); @@ -46,27 +66,43 @@ const ReportSummary: React.FC = ({ rows }) => { } }; - const rowsWithButtons = rows.map((row) => { - const reportMappingEntry = reportMapping.find((entry) => entry.report_uuid === row.uuid); - return { - ...row, - view: reportMappingEntry ? ( - - ) : null, - download: , - }; - }); + const handleRefresh = () => { + setRefreshLoading(true); + try { + const rowsWithButtons = rows.map((row) => { + const reportMappingEntry = reportMapping.find((entry) => entry.report_uuid === row.uuid); + return { + ...row, + view: reportMappingEntry ? ( + + ) : null, + download: , + }; + }); + window.location.reload(); + setCurrentRows(rowsWithButtons); + } catch (error) { + console.error('Error refreshing data:', error); + } finally { + setRefreshLoading(false); + } + }; return (
{loading && } + {/*
+ +
*/} ( diff --git a/packages/esm-report-app/src/reports-dashboard/tab-panel/tab-panel-component.tsx b/packages/esm-report-app/src/reports-dashboard/tab-panel/tab-panel-component.tsx index e4406328..53ffb86b 100644 --- a/packages/esm-report-app/src/reports-dashboard/tab-panel/tab-panel-component.tsx +++ b/packages/esm-report-app/src/reports-dashboard/tab-panel/tab-panel-component.tsx @@ -160,7 +160,7 @@ const RenderTabPanel: React.FC<{ rows: any[] }> = ({ rows }) => { /> {loading ? (