@openmrs/esm-appointments-app 8.5.1-pre.5723 → 8.5.1-pre.5754

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/.turbo/turbo-build.log +17 -17
  2. package/dist/1431.js +1 -0
  3. package/dist/1431.js.map +1 -0
  4. package/dist/1559.js +2 -0
  5. package/dist/1559.js.map +1 -0
  6. package/dist/3379.js +1 -0
  7. package/dist/3379.js.map +1 -0
  8. package/dist/4300.js +1 -1
  9. package/dist/4599.js +1 -0
  10. package/dist/4599.js.map +1 -0
  11. package/dist/4863.js +1 -0
  12. package/dist/4863.js.map +1 -0
  13. package/dist/4889.js +1 -1
  14. package/dist/4889.js.map +1 -1
  15. package/dist/5160.js +1 -0
  16. package/dist/5160.js.map +1 -0
  17. package/dist/525.js +1 -0
  18. package/dist/525.js.map +1 -0
  19. package/dist/5449.js +1 -1
  20. package/dist/5449.js.map +1 -1
  21. package/dist/5755.js +1 -0
  22. package/dist/5755.js.map +1 -0
  23. package/dist/592.js +1 -1
  24. package/dist/592.js.map +1 -1
  25. package/dist/6467.js +1 -0
  26. package/dist/6467.js.map +1 -0
  27. package/dist/66.js +2 -0
  28. package/dist/66.js.LICENSE.txt +9 -0
  29. package/dist/66.js.map +1 -0
  30. package/dist/6766.js +2 -0
  31. package/dist/{7881.js.LICENSE.txt → 6766.js.LICENSE.txt} +0 -10
  32. package/dist/6766.js.map +1 -0
  33. package/dist/7698.js +1 -1
  34. package/dist/7698.js.map +1 -1
  35. package/dist/8784.js +1 -0
  36. package/dist/8784.js.map +1 -0
  37. package/dist/main.js +1 -1
  38. package/dist/main.js.map +1 -1
  39. package/dist/openmrs-esm-appointments-app.js +1 -1
  40. package/dist/openmrs-esm-appointments-app.js.buildmanifest.json +278 -154
  41. package/dist/openmrs-esm-appointments-app.js.map +1 -1
  42. package/dist/routes.json +1 -1
  43. package/package.json +1 -1
  44. package/src/appointments/common-components/appointments-table.component.tsx +1 -0
  45. package/src/appointments/scheduled/scheduled-appointments.component.tsx +2 -2
  46. package/src/appointments.component.tsx +7 -12
  47. package/src/appointments.test.tsx +1 -3
  48. package/src/calendar/appointments-calendar-view.component.tsx +8 -10
  49. package/src/calendar/header/calendar-header.component.tsx +2 -2
  50. package/src/calendar/monthly/monthly-calendar-view.component.tsx +2 -2
  51. package/src/calendar/monthly/monthly-header.component.tsx +4 -4
  52. package/src/calendar/monthly/monthly-workload-view.component.tsx +2 -2
  53. package/src/form/appointments-form.workspace.tsx +2 -2
  54. package/src/header/appointments-header.component.tsx +12 -18
  55. package/src/hooks/useAppointmentList.ts +3 -3
  56. package/src/hooks/useClinicalMetrics.ts +3 -3
  57. package/src/hooks/usePatientAppointmentHistory.ts +2 -2
  58. package/src/hooks/useUnscheduledAppointments.ts +2 -2
  59. package/src/index.ts +15 -0
  60. package/src/metrics/metrics-cards/highest-volume-service.extension.tsx +26 -0
  61. package/src/metrics/metrics-cards/metrics-card.component.tsx +47 -0
  62. package/src/metrics/{metrics-card.scss → metrics-cards/metrics-card.scss} +0 -7
  63. package/src/metrics/metrics-cards/metrics-error-card.component.tsx +30 -0
  64. package/src/metrics/metrics-cards/metrics-error-card.scss +33 -0
  65. package/src/metrics/metrics-cards/providers-booked.extension.tsx +21 -0
  66. package/src/metrics/metrics-cards/scheduled-appointments.extension.tsx +33 -0
  67. package/src/metrics/metrics-container.component.tsx +19 -0
  68. package/src/metrics/metrics-container.scss +22 -0
  69. package/src/metrics/metrics-header.component.tsx +2 -2
  70. package/src/routes.json +18 -0
  71. package/src/store.ts +46 -0
  72. package/src/workload/monthly-view-workload/monthly-view.component.tsx +2 -2
  73. package/translations/en.json +3 -1
  74. package/dist/1293.js +0 -1
  75. package/dist/1293.js.map +0 -1
  76. package/dist/1625.js +0 -1
  77. package/dist/1625.js.map +0 -1
  78. package/dist/2164.js +0 -2
  79. package/dist/2164.js.map +0 -1
  80. package/dist/2694.js +0 -1
  81. package/dist/2694.js.map +0 -1
  82. package/dist/6708.js +0 -1
  83. package/dist/6708.js.map +0 -1
  84. package/dist/7881.js +0 -2
  85. package/dist/7881.js.map +0 -1
  86. package/dist/8963.js +0 -1
  87. package/dist/8963.js.map +0 -1
  88. package/src/hooks/selected-date-context.ts +0 -23
  89. package/src/metrics/appointments-metrics.component.tsx +0 -72
  90. package/src/metrics/appointments-metrics.scss +0 -14
  91. package/src/metrics/appointments-metrics.test.tsx +0 -42
  92. package/src/metrics/metrics-card.component.tsx +0 -49
  93. /package/dist/{2164.js.LICENSE.txt → 1559.js.LICENSE.txt} +0 -0
package/dist/8963.js DELETED
@@ -1 +0,0 @@
1
- (globalThis.webpackChunk_openmrs_esm_appointments_app=globalThis.webpackChunk_openmrs_esm_appointments_app||[]).push([[8963],{40515:function(n){n.exports=function(){"use strict";return function(n,r){r.prototype.isSameOrBefore=function(n,r){return this.isSame(n,r)||this.isBefore(n,r)}}}()},78285:(n,r,t)=>{"use strict";t.d(r,{vg:()=>c});var e,u,i=t(1343),o=t.n(i),f=t(9247);const c=o().forwardRef(function({children:n,size:r=16,...t},i){return o().createElement(f.A,{width:r,height:r,ref:i,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",fill:"currentColor",...t},e||(e=o().createElement("path",{d:"M21 10L17 10 17 6 15 6 15 10 11 10 11 12 15 12 15 16 17 16 17 12 21 12 21 10z"})),u||(u=o().createElement("path",{d:"M28,10H26V4a2.0023,2.0023,0,0,0-2-2H8A2.0023,2.0023,0,0,0,6,4v6H4a2.0023,2.0023,0,0,0-2,2V30H30V12A2.0023,2.0023,0,0,0,28,10ZM14,28V22h4v6Zm6,0V21a1,1,0,0,0-1-1H13a1,1,0,0,0-1,1v7H4V12H8V4H24v8h4V28Z"})),n)})},81797:(n,r,t)=>{"use strict";t.d(r,{A:()=>E});var e=t(39791),u=t(43944);var i=t(97942);const o=function(n){return n==n&&!(0,i.A)(n)};var f=t(7817);const c=function(n,r){return function(t){return null!=t&&t[n]===r&&(void 0!==r||n in Object(t))}},a=function(n){var r=function(n){for(var r=(0,f.A)(n),t=r.length;t--;){var e=r[t],u=n[e];r[t]=[e,u,o(u)]}return r}(n);return 1==r.length&&r[0][2]?c(r[0][0],r[0][1]):function(t){return t===n||function(n,r,t,i){var o=t.length,f=o,c=!i;if(null==n)return!f;for(n=Object(n);o--;){var a=t[o];if(c&&a[2]?a[1]!==n[a[0]]:!(a[0]in n))return!1}for(;++o<f;){var l=(a=t[o])[0],v=n[l],s=a[1];if(c&&a[2]){if(void 0===v&&!(l in n))return!1}else{var h=new e.A;if(i)var A=i(v,s,l,n,r,h);if(!(void 0===A?(0,u.A)(s,v,3,i,h):A))return!1}}return!0}(t,n,r)}};var l=t(55841);const v=function(n,r){return null!=n&&r in Object(n)};var s=t(85861),h=t(61697),A=t(96956),p=t(85378),g=t(47893),d=t(9322);const m=function(n,r){return null!=n&&function(n,r,t){for(var e=-1,u=(r=(0,s.A)(r,n)).length,i=!1;++e<u;){var o=(0,d.A)(r[e]);if(!(i=null!=n&&t(n,o)))break;n=n[o]}return i||++e!=u?i:!!(u=null==n?0:n.length)&&(0,g.A)(u)&&(0,p.A)(o,u)&&((0,A.A)(n)||(0,h.A)(n))}(n,r,v)};var w=t(1677);const b=function(n,r){return(0,w.A)(n)&&o(r)?c((0,d.A)(n),r):function(t){var e=function(n,r,t){var e=null==n?void 0:(0,l.A)(n,r);return void 0===e?t:e}(t,n);return void 0===e&&e===r?m(t,n):(0,u.A)(r,e,3)}};var H=t(14151);const V=function(n){return(0,w.A)(n)?(r=(0,d.A)(n),function(n){return null==n?void 0:n[r]}):function(n){return function(r){return(0,l.A)(r,n)}}(n);var r};var _=t(34149);const k=function(n){return n!=n},j=function(n,r){return!(null==n||!n.length)&&function(n,r,t){return r==r?function(n,r,t){for(var e=t-1,u=n.length;++e<u;)if(n[e]===r)return e;return-1}(n,r,t):function(n,r,t,e){for(var u=n.length,i=t+(e?1:-1);e?i--:++i<u;)if(r(n[i],i,n))return i;return-1}(n,k,t)}(n,r,0)>-1},O=function(n,r,t){for(var e=-1,u=null==n?0:n.length;++e<u;)if(t(r,n[e]))return!0;return!1};var x=t(62026),y=t(28574);var B=t(39922);const C=y.A&&1/(0,B.A)(new y.A([,-0]))[1]==1/0?function(n){return new y.A(n)}:function(){},E=function(n,r){return n&&n.length?function(n,r,t){var e=-1,u=j,i=n.length,o=!0,f=[],c=f;if(t)o=!1,u=O;else if(i>=200){var a=r?null:C(n);if(a)return(0,B.A)(a);o=!1,u=x.A,c=new _.A}else c=r?[]:f;n:for(;++e<i;){var l=n[e],v=r?r(l):l;if(l=t||0!==l?l:0,o&&v==v){for(var s=c.length;s--;)if(c[s]===v)continue n;r&&c.push(v),f.push(l)}else u(c,v,t)||(c!==f&&c.push(v),f.push(l))}return f}(n,"function"==typeof(t=r)?t:null==t?H.A:"object"==typeof t?(0,A.A)(t)?b(t[0],t[1]):a(t):V(t)):[];var t}}}]);
package/dist/8963.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"8963.js","mappings":"gJAAoEA,EAAOC,QAAwJ,WAAY,aAAa,OAAO,SAASC,EAAEC,GAAGA,EAAEC,UAAUC,eAAe,SAASH,EAAEC,GAAG,OAAOG,KAAKC,OAAOL,EAAEC,IAAIG,KAAKE,SAASN,EAAEC,EAAE,CAAC,CAAE,CAArRA,E,qDCcqlEM,EAAUC,E,6BAgpFlrE,MAAMC,EAAwB,eAAiB,UAAkB,SAC/DC,EAAQ,KACRC,EAAO,MACJC,GACFC,GACD,OAAoB,kBAAoB,IAAM,CAC5CC,MAAOH,EACPI,OAAQJ,EACRE,IAAKA,EACLG,MAAO,6BACPC,QAAS,YACTC,KAAM,kBACHN,GACFL,IAAaA,EAAwB,kBAAoB,OAAQ,CAClEY,EAAG,mFACAX,IAAaA,EAAwB,kBAAoB,OAAQ,CACpEW,EAAG,6MACAT,EACP,E,yFClqFA,QAJA,SAA4BU,GAC1B,OAAOA,GAAUA,KAAU,EAAAC,EAAA,GAASD,EACtC,E,cCWA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AvBY,IAuBgB,CACnC,IAAIwB,EAAMJ,EAAW,KAAO,EAAUN,GACtC,GAAIU,EACF,OAAO,OAAWA,GAEpBF,GAAW,EACXD,EAAW,IACXE,EAAO,IAAI,GACb,MAEEA,EAAOH,EAAW,GAAKtB,EAEzB2B,EACA,OAASvB,EAAQF,GAAQ,CACvB,IAAIX,EAAQyB,EAAMZ,GACdwB,EAAWN,EAAWA,EAAS/B,GAASA,EAG5C,GADAA,EAAS6B,GAAwB,IAAV7B,EAAeA,EAAQ,EAC1CiC,GAAYI,GAAaA,EAAU,CAErC,IADA,IAAIC,EAAYJ,EAAKvB,OACd2B,KACL,GAAIJ,EAAKI,KAAeD,EACtB,SAASD,EAGTL,GACFG,EAAKK,KAAKF,GAEZ5B,EAAO8B,KAAKvC,EACd,MACUgC,EAASE,EAAMG,EAAUR,KAC7BK,IAASzB,GACXyB,EAAKK,KAAKF,GAEZ5B,EAAO8B,KAAKvC,GAEhB,CACA,OAAOS,CACT,CD1CmC,CAASgB,EEXtB,mBAHAzB,EFc0C+B,GEVrD/B,EAEI,MAATA,EACKwC,EAAA,EAEW,iBAATxC,GACF,EAAAsB,EAAA,GAAQtB,GACX,EAAoBA,EAAM,GAAIA,EAAM,IACpC,EAAYA,GAEX,EAASA,IFA8D,GEdhF,IAAsBA,CFetB,C","sources":["webpack://@openmrs/esm-appointments-app/../../node_modules/dayjs/plugin/isSameOrBefore.js","webpack://@openmrs/esm-appointments-app/../../node_modules/@carbon/icons-react/es/generated/bucket-7.js","webpack://@openmrs/esm-appointments-app/../../node_modules/lodash-es/_isStrictComparable.js","webpack://@openmrs/esm-appointments-app/../../node_modules/lodash-es/_getMatchData.js","webpack://@openmrs/esm-appointments-app/../../node_modules/lodash-es/_matchesStrictComparable.js","webpack://@openmrs/esm-appointments-app/../../node_modules/lodash-es/_baseMatches.js","webpack://@openmrs/esm-appointments-app/../../node_modules/lodash-es/_baseIsMatch.js","webpack://@openmrs/esm-appointments-app/../../node_modules/lodash-es/get.js","webpack://@openmrs/esm-appointments-app/../../node_modules/lodash-es/_baseHasIn.js","webpack://@openmrs/esm-appointments-app/../../node_modules/lodash-es/_hasPath.js","webpack://@openmrs/esm-appointments-app/../../node_modules/lodash-es/hasIn.js","webpack://@openmrs/esm-appointments-app/../../node_modules/lodash-es/_baseMatchesProperty.js","webpack://@openmrs/esm-appointments-app/../../node_modules/lodash-es/_baseProperty.js","webpack://@openmrs/esm-appointments-app/../../node_modules/lodash-es/property.js","webpack://@openmrs/esm-appointments-app/../../node_modules/lodash-es/_basePropertyDeep.js","webpack://@openmrs/esm-appointments-app/../../node_modules/lodash-es/_baseFindIndex.js","webpack://@openmrs/esm-appointments-app/../../node_modules/lodash-es/_baseIsNaN.js","webpack://@openmrs/esm-appointments-app/../../node_modules/lodash-es/_arrayIncludes.js","webpack://@openmrs/esm-appointments-app/../../node_modules/lodash-es/_baseIndexOf.js","webpack://@openmrs/esm-appointments-app/../../node_modules/lodash-es/_strictIndexOf.js","webpack://@openmrs/esm-appointments-app/../../node_modules/lodash-es/_arrayIncludesWith.js","webpack://@openmrs/esm-appointments-app/../../node_modules/lodash-es/_createSet.js","webpack://@openmrs/esm-appointments-app/../../node_modules/lodash-es/noop.js","webpack://@openmrs/esm-appointments-app/../../node_modules/lodash-es/uniqBy.js","webpack://@openmrs/esm-appointments-app/../../node_modules/lodash-es/_baseUniq.js","webpack://@openmrs/esm-appointments-app/../../node_modules/lodash-es/_baseIteratee.js"],"names":["module","exports","e","i","prototype","isSameOrBefore","this","isSame","isBefore","_path188","_path189","Hospital","children","size","rest","ref","width","height","xmlns","viewBox","fill","d","value","isObject","key","srcValue","object","undefined","Object","source","matchData","result","keys","length","customizer","index","noCustomizer","data","objValue","stack","COMPARE_PARTIAL_FLAG","path","hasFunc","isLength","isArray","isArguments","defaultValue","array","fromIndex","predicate","fromRight","comparator","values","iteratee","includes","isCommon","seen","set","outer","computed","seenIndex","push","identity"],"sourceRoot":""}
@@ -1,23 +0,0 @@
1
- import { createContext, useContext } from 'react';
2
- import dayjs from 'dayjs';
3
- import { omrsDateFormat } from '../constants';
4
-
5
- export interface SelectedDateContextProps {
6
- selectedDate: string;
7
- setSelectedDate: (date: string) => void;
8
- }
9
-
10
- export const SelectedDateContext = createContext<SelectedDateContextProps>({
11
- selectedDate: dayjs().startOf('day').format(omrsDateFormat),
12
- setSelectedDate: (date: string) => {},
13
- });
14
-
15
- export const SelectedDateContextProvider = SelectedDateContext.Provider;
16
-
17
- export const useSelectedDateContext = () => {
18
- const context = useContext(SelectedDateContext);
19
- if (!context) {
20
- throw new Error('useSelectedDateContext must be used within a SelectedDateContextProvider');
21
- }
22
- return context;
23
- };
@@ -1,72 +0,0 @@
1
- import React from 'react';
2
- import { useTranslation } from 'react-i18next';
3
- import { ErrorState, formatDate, parseDate } from '@openmrs/esm-framework';
4
- import { useClinicalMetrics, useAllAppointmentsByDate, useScheduledAppointments } from '../hooks/useClinicalMetrics';
5
- import { useAppointmentList } from '../hooks/useAppointmentList';
6
- import { useSelectedDateContext } from '../hooks/selected-date-context';
7
- import MetricsCard from './metrics-card.component';
8
- import MetricsHeader from './metrics-header.component';
9
- import styles from './appointments-metrics.scss';
10
-
11
- interface AppointmentMetricsProps {
12
- appointmentServiceTypes: Array<string>;
13
- }
14
-
15
- const AppointmentsMetrics: React.FC<AppointmentMetricsProps> = ({ appointmentServiceTypes }) => {
16
- const { t } = useTranslation();
17
-
18
- const { highestServiceLoad, error } = useClinicalMetrics();
19
- const { totalProviders } = useAllAppointmentsByDate();
20
- const { totalScheduledAppointments } = useScheduledAppointments(appointmentServiceTypes);
21
-
22
- const { selectedDate } = useSelectedDateContext();
23
- const formattedStartDate = formatDate(parseDate(selectedDate), { mode: 'standard', time: false });
24
-
25
- // TODO we will need rework these after we discuss the logic we want to use
26
- const { appointmentList: arrivedAppointments } = useAppointmentList('CheckedIn');
27
- const { appointmentList: pendingAppointments } = useAppointmentList('Scheduled');
28
-
29
- const filteredArrivedAppointments = appointmentServiceTypes
30
- ? arrivedAppointments.filter(({ service }) => appointmentServiceTypes.includes(service.uuid))
31
- : arrivedAppointments;
32
-
33
- const filteredPendingAppointments = appointmentServiceTypes
34
- ? pendingAppointments.filter(({ service }) => appointmentServiceTypes.includes(service.uuid))
35
- : pendingAppointments;
36
-
37
- if (error) {
38
- return (
39
- <div className={styles.errorContainer}>
40
- <ErrorState headerTitle={t('appointmentMetricsLoadError', 'Metrics load error')} error={error} />
41
- </div>
42
- );
43
- }
44
-
45
- return (
46
- <>
47
- <MetricsHeader />
48
- <section className={styles.cardContainer}>
49
- <MetricsCard
50
- count={{ pendingAppointments: filteredPendingAppointments, arrivedAppointments: filteredArrivedAppointments }}
51
- headerLabel={t('scheduledAppointments', 'Scheduled appointments')}
52
- label={t('appointments', 'Appointments')}
53
- value={totalScheduledAppointments}
54
- />
55
- <MetricsCard
56
- headerLabel={t('highestServiceVolume', 'Highest volume service: {{time}}', { time: formattedStartDate })}
57
- label={
58
- highestServiceLoad?.count !== 0 ? t(highestServiceLoad?.serviceName) : t('serviceName', 'Service name')
59
- }
60
- value={highestServiceLoad?.count ?? '--'}
61
- />
62
- <MetricsCard
63
- headerLabel={t('providersBooked', 'Providers booked: {{time}}', { time: formattedStartDate })}
64
- label={t('providers', 'Providers')}
65
- value={totalProviders}
66
- />
67
- </section>
68
- </>
69
- );
70
- };
71
-
72
- export default AppointmentsMetrics;
@@ -1,14 +0,0 @@
1
- @use '@carbon/colors';
2
- @use '@carbon/layout';
3
-
4
- .cardContainer {
5
- background-color: colors.$white;
6
- display: grid;
7
- grid-template-columns: repeat(auto-fit, minmax(18.75rem, 1fr));
8
- gap: layout.$spacing-05;
9
- margin: layout.$spacing-05;
10
- }
11
-
12
- .errorContainer {
13
- margin: layout.$spacing-05;
14
- }
@@ -1,42 +0,0 @@
1
- import React from 'react';
2
- import { render, screen } from '@testing-library/react';
3
- import { type FetchResponse, openmrsFetch } from '@openmrs/esm-framework';
4
- import { mockAppointmentMetrics, mockProvidersCount, mockStartTime } from '__mocks__';
5
- import AppointmentsMetrics from './appointments-metrics.component';
6
-
7
- const mockOpenmrsFetch = jest.mocked(openmrsFetch);
8
-
9
- jest.mock('../hooks/useClinicalMetrics', () => ({
10
- ...jest.requireActual('../hooks/useClinicalMetrics'),
11
- useClinicalMetrics: jest.fn().mockReturnValue({
12
- highestServiceLoad: mockAppointmentMetrics.highestServiceLoad,
13
- isLoading: mockAppointmentMetrics.isLoading,
14
- error: mockAppointmentMetrics.error,
15
- }),
16
- useAllAppointmentsByDate: jest.fn().mockReturnValue({
17
- totalProviders: mockProvidersCount.totalProviders,
18
- isLoading: mockProvidersCount.isLoading,
19
- error: mockProvidersCount.error,
20
- }),
21
- useScheduledAppointments: jest.fn().mockReturnValue({
22
- totalScheduledAppointments: mockAppointmentMetrics.totalAppointments,
23
- }),
24
- useAppointmentDate: jest.fn().mockReturnValue({
25
- startDate: mockStartTime.startTime,
26
- }),
27
- }));
28
-
29
- describe('Appointment metrics', () => {
30
- it('should render metrics cards with the correct data', async () => {
31
- mockOpenmrsFetch.mockResolvedValueOnce({
32
- data: [],
33
- } as unknown as FetchResponse);
34
-
35
- render(<AppointmentsMetrics appointmentServiceTypes={['consultation-service-uuid']} />);
36
-
37
- expect(screen.getByText(/scheduled appointments/i)).toBeInTheDocument();
38
- expect(screen.getByText(/^appointments$/i)).toBeInTheDocument();
39
- expect(screen.getByText(/16/i)).toBeInTheDocument();
40
- expect(screen.getByText(/4/i)).toBeInTheDocument();
41
- });
42
- });
@@ -1,49 +0,0 @@
1
- import React, { useMemo } from 'react';
2
- import dayjs from 'dayjs';
3
- import isSameOrBefore from 'dayjs/plugin/isSameOrBefore';
4
- import { useTranslation } from 'react-i18next';
5
- import { isEmpty } from 'lodash-es';
6
- import { useSelectedDateContext } from '../hooks/selected-date-context';
7
- import styles from './metrics-card.scss';
8
- dayjs.extend(isSameOrBefore);
9
-
10
- interface MetricsCardProps {
11
- label: string;
12
- value: number;
13
- headerLabel: string;
14
- count?: { pendingAppointments: Array<any>; arrivedAppointments: Array<any> };
15
- }
16
-
17
- const MetricsCard: React.FC<MetricsCardProps> = ({ label, value, headerLabel, count }) => {
18
- const { t } = useTranslation();
19
- const { selectedDate } = useSelectedDateContext();
20
- const isSelectedDateInPast = useMemo(() => dayjs(selectedDate).isBefore(dayjs(), 'date'), [selectedDate]);
21
-
22
- return (
23
- <article className={styles.container}>
24
- <div className={styles.tileContainer}>
25
- <div className={styles.tileHeader}>
26
- <div className={styles.headerLabelContainer}>
27
- <span className={styles.headerLabel}>{headerLabel}</span>
28
- </div>
29
- </div>
30
- <div className={styles.metricsGrid}>
31
- <div>
32
- <span className={styles.totalsLabel}>{label}</span>
33
- <p className={styles.totalsValue}>{value}</p>
34
- </div>
35
- {!isEmpty(count) && (
36
- <div className={styles.countGrid}>
37
- <span>{t('checkedIn', 'Checked in')}</span>
38
- <span>{isSelectedDateInPast ? t('missed', 'Missed') : t('notArrived', 'Not arrived')}</span>
39
- <p style={{ color: '#22651B' }}>{count.arrivedAppointments?.length}</p>
40
- <p style={{ color: '#da1e28' }}>{count.pendingAppointments?.length}</p>
41
- </div>
42
- )}
43
- </div>
44
- </div>
45
- </article>
46
- );
47
- };
48
-
49
- export default MetricsCard;