|
1 | | -import React from 'react'; |
| 1 | +import React, { useState } from 'react'; |
2 | 2 |
|
3 | 3 | import PatientQueueHeader from './components/patient-queue-header/patient-queue-header.component'; |
4 | 4 | import MetricsCard from './components/patient-queue-metrics/metrics-card.component'; |
5 | 5 | import { useTranslation } from 'react-i18next'; |
6 | 6 | import { useSession } from '@openmrs/esm-framework'; |
7 | 7 | import styles from './components/patient-queue-metrics/clinic-metrics.scss'; |
8 | 8 | import { useParentLocation } from './active-visits/patient-queues.resource'; |
9 | | -import { usePatientQueuesList } from './active-visits/active-visits-patients-reception/active-visits-reception.resource'; |
10 | | -import { usePatientsBeingServed, usePatientsServed } from './components/patient-queue-metrics/clinic-metrics.resource'; |
11 | | -import ActiveTriageVisitsTabs from './active-visits/active-visits-triage-tab.component'; |
| 9 | +import { QueueStatus } from './utils/utils'; |
| 10 | +import { Tabs, TabPanel, TabList, Tab, TabPanels } from '@carbon/react'; |
| 11 | +import ActiveTriageVisitsTable from './active-visits/active-visits-patients-triage/active-visits-triage-table.component'; |
12 | 12 |
|
13 | 13 | const TriageHome: React.FC = () => { |
14 | 14 | const { t } = useTranslation(); |
15 | 15 |
|
16 | | - const session = useSession(); |
| 16 | + const [selectedTab, setSelectedTab] = useState(0); |
17 | 17 |
|
18 | | - const { location } = useParentLocation(session?.sessionLocation?.uuid); |
19 | | - const { servedCount } = usePatientsServed(session?.sessionLocation?.uuid, 'picked'); |
20 | | - const { patientQueueCount: pendingCount } = usePatientQueuesList(location?.parentLocation?.uuid); |
21 | | - const { patientQueueCount } = usePatientsBeingServed( |
22 | | - session?.sessionLocation?.uuid, |
23 | | - 'pending', |
24 | | - session?.user?.person?.display, |
25 | | - ); |
| 18 | + const getTabStatus = (selectedIndex) => { |
| 19 | + return selectedIndex === 0 ? '' : QueueStatus.Completed; |
| 20 | + }; |
26 | 21 |
|
27 | 22 | return ( |
28 | 23 | <div> |
29 | 24 | <PatientQueueHeader title="Triage" /> |
30 | 25 | <div className={styles.cardContainer}> |
| 26 | + <MetricsCard values={[{ label: 'In Queue', value: 0 }]} headerLabel={t('inQueueTriage', 'Patients Waiting')} /> |
31 | 27 | <MetricsCard |
32 | | - values={[{ label: 'In Queue', value: pendingCount }]} |
33 | | - headerLabel={t('inQueueTriage', 'Patients Waiting')} |
34 | | - /> |
35 | | - <MetricsCard |
36 | | - values={[{ label: t('byTriage', 'By you'), value: patientQueueCount }]} |
| 28 | + values={[{ label: t('byTriage', 'By you'), value: 0 }]} |
37 | 29 | headerLabel={t('pendingTriageServing', 'Patients waiting to be Served')} |
38 | 30 | /> |
39 | 31 | <MetricsCard |
40 | | - values={[{ label: 'Patients Served', value: servedCount }]} |
| 32 | + values={[{ label: 'Patients Served', value: 0 }]} |
41 | 33 | headerLabel={t('noOfPatientsServed', 'No. of Patients Served')} |
42 | 34 | /> |
43 | 35 | </div> |
44 | | - <ActiveTriageVisitsTabs /> |
| 36 | + |
| 37 | + <div className={styles.container}> |
| 38 | + <Tabs |
| 39 | + selectedIndex={selectedTab} |
| 40 | + onChange={({ selectedIndex }) => setSelectedTab(selectedIndex)} |
| 41 | + className={styles.tabs} |
| 42 | + > |
| 43 | + <TabList style={{ paddingLeft: '1rem' }} aria-label="triage outpatient tabs" contained> |
| 44 | + <Tab style={{ width: '150px' }}>{t('pending', 'In Queue')}</Tab> |
| 45 | + <Tab style={{ width: '150px' }}>{t('completed', 'Completed')}</Tab> |
| 46 | + </TabList> |
| 47 | + <TabPanels> |
| 48 | + <TabPanel style={{ padding: 0 }}> |
| 49 | + <ActiveTriageVisitsTable status={getTabStatus(selectedTab)} /> |
| 50 | + </TabPanel> |
| 51 | + <TabPanel style={{ padding: 0 }}> |
| 52 | + <ActiveTriageVisitsTable status={getTabStatus(selectedTab)} /> |
| 53 | + </TabPanel> |
| 54 | + </TabPanels> |
| 55 | + </Tabs> |
| 56 | + </div> |
45 | 57 | </div> |
46 | 58 | ); |
47 | 59 | }; |
|
0 commit comments