From 758d431d3c6a3de10eed290e32eb07de5ba6d9d9 Mon Sep 17 00:00:00 2001 From: Rugute Date: Tue, 23 Jul 2024 15:26:03 +0300 Subject: [PATCH 1/2] sorted Defaulter Tracing --- packages/esm-patient-clinical-view-app/src/config-schema.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/esm-patient-clinical-view-app/src/config-schema.ts b/packages/esm-patient-clinical-view-app/src/config-schema.ts index d05df70..88aa59b 100755 --- a/packages/esm-patient-clinical-view-app/src/config-schema.ts +++ b/packages/esm-patient-clinical-view-app/src/config-schema.ts @@ -16,7 +16,7 @@ export const configSchema = { antenatal: 'e8f98494-af35-4bb8-9fc7-c409c8fed843', postNatal: '72aa78e0-ee4b-47c3-9073-26f3b9ecc4a7', labourAndDelivery: '496c7cc3-0eea-4e84-a04c-2292949e2f7f', - defaulterTracingFormUuid: 'a1a62d1e-2def-11e9-b210-d663bd873d93', + defaulterTracingFormUuid: 'f3ba9242-9bbb-4284-a0c0-56ac6f0cec65', htsScreening: '7a16a346-0991-48ac-b339-aacd463a7845', htsInitialTest: 'edb264d4-91fc-4d16-bb34-a413eef2b865', htsRetest: 'ef3d58b9-7186-40f2-b601-3d568259d392', @@ -28,7 +28,7 @@ export const configSchema = { defaulterTracingEncounterUuid: { _type: Type.String, _description: 'Encounter UUID for defaulter tracing', - _default: '1495edf8-2df2-11e9-b210-d663bd873d93', + _default: 'df5547bc-1350-11df-a1f1-0026b9348838', }, clinicalEncounterUuid: { _type: Type.String, From 31b343653fc360f8bc0aa55cfbe7ca83ef4b6603 Mon Sep 17 00:00:00 2001 From: Rugute Date: Wed, 24 Jul 2024 11:29:28 +0300 Subject: [PATCH 2/2] sorted HTS Encounters --- .DS_Store | Bin 6148 -> 6148 bytes package.json | 7 +- packages/esm-ampath-core-app/jest.config.js | 3 - packages/esm-ampath-core-app/package.json | 55 - .../ampath-dashboard.component.tsx | 80 -- .../ampath-dashboard/ampath-dashboard.scss | 47 - .../ampath-dashboard-side-nav.component.tsx | 22 - .../side-menu/ampath-dashboard-side-nav.scss | 35 - .../stock-management-dashboard.component.tsx | 8 - packages/esm-ampath-core-app/src/api/api.ts | 0 packages/esm-ampath-core-app/src/api/type.ts | 0 .../src/clinical-view-section.component.tsx | 36 - .../src/clinical-view-section.scss | 20 - .../esm-ampath-core-app/src/config-schema.ts | 12 - .../src/dashboard-group.component.tsx | 39 - .../src/dashboard-group.scss | 21 - .../src/dashboard.meta.tsx | 9 - .../esm-ampath-core-app/src/declarations.d.ts | 4 - packages/esm-ampath-core-app/src/index.ts | 27 - .../src/root.component.tsx | 15 - packages/esm-ampath-core-app/src/root.scss | 0 packages/esm-ampath-core-app/src/root.tsx | 15 - packages/esm-ampath-core-app/src/routes.json | 17 - .../esm-ampath-core-app/translations/en.json | 5 - packages/esm-ampath-core-app/tsconfig.json | 5 - .../esm-ampath-core-app/webpack.config.js | 1 - packages/esm-billing-app/README.md | 5 - .../esm-billing-app/__mocks__/visit.mock.ts | 151 --- packages/esm-billing-app/jest.config.js | 8 - packages/esm-billing-app/package.json | 54 - .../bill-history/bill-history.component.tsx | 210 --- .../src/bill-history/bill-history.scss | 165 --- ...ble-services-admin-card-link.component.tsx | 24 - .../bill-waiver/bill-selection.component.tsx | 74 -- .../bill-waiver-form.component.tsx | 105 -- .../bill-waiver/bill-waiver-form.scss | 34 - .../bill-waiver/bill-waiver.component.tsx | 33 - .../bill-waiver/bill-waiver.scss | 10 - .../bill-waiver/patient-bills.component.tsx | 135 -- .../billable-service.resource.tsx | 55 - .../billable-services-home.component.tsx | 59 - .../billable-services.component.tsx | 255 ---- .../billable-services/billable-services.scss | 219 ---- .../drug-order/drug-order.component.tsx | 64 - .../billiable-item/drug-order/drug-order.scss | 31 - .../test-order/imaging-order.component.tsx | 33 - .../test-order/lab-order.component.tsx | 33 - .../test-order/price-info-order.componet.tsx | 62 - .../test-order/price-info-order.scss | 20 - .../test-order/procedure-order.component.tsx | 33 - .../test-order-action.component.tsx | 50 - .../test-order/test-order-action.resource.tsx | 54 - .../billiable-item/useBillableItem.tsx | 49 - .../add-billing-tariffs-service.scss | 164 --- ...add-billings-tariffs-service.component.tsx | 183 --- .../billing-tariffs-admin-card.tsx | 0 .../billing-tariffs-services.scss | 219 ---- .../billing-tariffs.component.tsx | 286 ---- .../billing-tariffs.resource.tsx | 55 - .../add-billable-service.component.tsx | 354 ----- .../create-edit/add-billable-service.scss | 164 --- .../dashboard/dashboard.component.tsx | 18 - .../dashboard/dashboard.scss | 27 - .../dashboard/service-metrics.component.tsx | 40 - .../billing-dashboard.component.tsx | 19 - .../billing-dashboard/billing-dashboard.scss | 27 - .../billing-checkin-form.component.tsx | 137 -- .../billing-form/billing-checkin-form.scss | 14 - .../billing-form/billing-form.component.tsx | 301 ----- .../src/billing-form/billing-form.scss | 28 - .../src/billing-form/helper.ts | 2 - .../sha-number-validity.component.tsx | 77 -- .../visit-attributes-form.component.tsx | 206 --- .../visit-attributes-form.scss | 18 - .../billing-header.component.tsx | 43 - .../src/billing-header/billing-header.scss | 83 -- .../billing-illustration.component.tsx | 30 - .../billing-prompt.resource.tsx | 45 - .../src/billing-tabs/billing-tab.scss | 0 .../billing-tabs/billling-tabs.component.tsx | 38 - .../esm-billing-app/src/billing.resource.ts | 225 ---- .../src/bills-table/bills-table.component.tsx | 288 ---- .../src/bills-table/bills-table.scss | 181 --- .../claims-wrap/claims-main-component.tsx | 35 - .../src/claims/claims-wrap/claims-main.scss | 25 - .../claims-breakdown.component.tsx | 19 - .../claims-breakdown/claims-breakdown.scss | 35 - .../dashboard/claims-dashboard.component.tsx | 41 - .../dashboard/form/claims-form.component.tsx | 396 ------ .../dashboard/form/claims-form.resource.ts | 49 - .../claims/dashboard/form/claims-form.scss | 145 --- .../header/claims-header.component.tsx | 23 - .../dashboard/header/claims-header.scss | 23 - .../table/claims-table.component.tsx | 212 --- .../claims/dashboard/table/claims-table.scss | 108 -- .../src/claims/make-claims.component.tsx | 28 - .../src/claims/make-claims.scss | 7 - .../claims/metrics/metrics-card.component.tsx | 36 - .../src/claims/metrics/metrics-card.scss | 76 -- .../metrics/metrics-header.component.tsx | 16 - .../src/claims/metrics/metrics-header.scss | 16 - .../src/claims/metrics/metrics.component.tsx | 47 - .../src/claims/metrics/metrics.scss | 10 - packages/esm-billing-app/src/config-schema.ts | 133 -- packages/esm-billing-app/src/constants.ts | 3 - .../esm-billing-app/src/dashboard.meta.ts | 6 - .../esm-billing-app/src/declarations.d.ts | 4 - .../esm-billing-app/src/helpers/functions.ts | 97 -- packages/esm-billing-app/src/helpers/index.ts | 1 - .../esm-billing-app/src/hooks/getMflCode.tsx | 19 - .../src/hooks/usePatientAttributes.tsx | 26 - .../src/hooks/useRequestStatus.tsx | 55 - packages/esm-billing-app/src/index.ts | 62 - .../src/invoice/invoice-table.component.tsx | 193 --- .../src/invoice/invoice-table.scss | 91 -- .../src/invoice/invoice.component.tsx | 168 --- .../esm-billing-app/src/invoice/invoice.scss | 111 -- .../initiate-payment.component.tsx | 159 --- .../initiate-payment/initiate-payment.scss | 38 - .../invoice-breakdown.component.tsx | 17 - .../invoice-breakdown/invoice-breakdown.scss | 29 - .../payment-form/payment-form.component.tsx | 125 -- .../payments/payment-form/payment-form.scss | 54 - .../payment-history.component.tsx | 64 - .../invoice/payments/payments.component.tsx | 129 -- .../src/invoice/payments/payments.resource.ts | 35 - .../src/invoice/payments/payments.scss | 46 - .../src/invoice/payments/utils.ts | 83 -- .../visit-tags/visit-attribute.component.tsx | 21 - .../print-receipt.component.tsx | 28 - .../printable-invoice/print-receipt.scss | 10 - .../printable-footer.component.tsx | 33 - .../printable-invoice/printable-footer.scss | 24 - .../printable-footer.test.tsx | 19 - .../printable-invoice-header.component.tsx | 63 - .../printable-invoice-header.scss | 61 - .../printable-invoice-header.test.tsx | 56 - .../printable-invoice.component.tsx | 134 -- .../printable-invoice/printable-invoice.scss | 60 - .../src/left-panel-link.component.tsx | 40 - .../src/m-pesa/mpesa-resource.tsx | 81 -- .../src/metrics-cards/card.component.tsx | 11 - .../src/metrics-cards/card.scss | 20 - .../metrics-cards/metrics-cards.component.tsx | 42 - .../src/metrics-cards/metrics-cards.scss | 12 - .../src/metrics-cards/metrics.resource.ts | 45 - .../modal/require-payment-modal.component.tsx | 112 -- .../src/modal/require-payment.scss | 18 - .../filtered-patient-bills.component.tsx | 119 -- .../patient-bills-dashboard.scss | 11 - .../patient-bills-dashboard.tsx | 34 - .../src/past-patient-bills/patient-bills.scss | 11 - .../esm-billing-app/src/root.component.tsx | 21 - packages/esm-billing-app/src/root.scss | 30 - packages/esm-billing-app/src/routes.json | 114 -- packages/esm-billing-app/src/types/index.ts | 278 ---- packages/esm-billing-app/src/utils.ts | 87 -- packages/esm-billing-app/translations/en.json | 166 --- packages/esm-billing-app/tsconfig.json | 5 - packages/esm-billing-app/webpack.config.js | 1 - packages/esm-hts-app/jest.config.js | 3 - packages/esm-hts-app/package.json | 54 - packages/esm-hts-app/src/config-schema.ts | 12 - packages/esm-hts-app/src/dashboard.meta.tsx | 37 - packages/esm-hts-app/src/dashboard.scss | 27 - packages/esm-hts-app/src/declarations.d.ts | 4 - .../src/header/hts-header.component.tsx | 32 - .../esm-hts-app/src/header/hts-header.scss | 68 - .../src/header/hts-illustration.component.tsx | 13 - packages/esm-hts-app/src/hts.component.tsx | 31 - packages/esm-hts-app/src/hts.scss | 9 - packages/esm-hts-app/src/index.ts | 67 - .../src/left-panel-link.component.tsx | 32 - packages/esm-hts-app/src/root.component.tsx | 17 - packages/esm-hts-app/src/root.scss | 3 - packages/esm-hts-app/src/routes.json | 94 -- .../src/views/dashboard/common.scss | 34 - .../hts-program-services/common.scss | 34 - .../hts-initial.component.tsx | 17 - .../hts-linkage.component.tsx | 17 - .../hts-program-services.tsx | 39 - .../hts-program-services/hts-program.scss | 34 - .../hts-referred.component.tsx | 17 - .../hts-retest.component.tsx | 17 - .../hts-screening.component.tsx | 17 - .../empty-data-illustration.component.tsx | 39 - .../empty-state/empty-state.component.tsx | 44 - .../empty-state/empty-state.scss | 70 - .../due-for-linkage.component.tsx | 55 - .../due-for-retest.component.tsx | 55 - .../eligible.component.tsx | 76 -- .../hts-screening.component.tsx | 84 -- .../invalid-result.component.tsx | 55 - .../module-uptake.component.tsx | 120 -- .../tested.component.tsx | 55 - .../hts-patient-list-tabs.component.tsx | 56 - .../hts-patient-list-tabs.scss | 3 - .../patient-summary/hts-patientsummary.scss | 24 - .../patient-summary.component.tsx | 23 - .../summary-tiles/hts-summary-tile.scss | 34 - ...summary-tiles-overall-uptake.component.tsx | 28 - .../hts-summary-tiles.component.tsx | 28 - packages/esm-hts-app/translations/en.json | 36 - packages/esm-hts-app/tsconfig.json | 5 - packages/esm-hts-app/webpack.config.js | 1 - .../esm-lab-order-manifest-app/jest.config.js | 3 - .../esm-lab-order-manifest-app/package.json | 55 - .../src/config-schema.ts | 8 - .../src/declarations.d.ts | 4 - .../esm-lab-order-manifest-app/src/index.ts | 32 - .../dialog/post-orde-to-eid-dialog.scss | 14 - .../dialog/post-to-eid-dialog.component.tsx | 110 -- .../dialog/post-to-eid-dialog.resource.ts | 14 - .../dialog/verification-modal.scss | 20 - .../dialog/verification.component.tsx | 48 - .../manifest-orders-list-resource.ts | 130 -- .../manifest-orders-list.tsx | 230 ---- .../manifest-orders.component.tsx | 33 - .../lab-order-manifest/manifest-styles.scss | 212 --- .../post-to-eid-action.component.tsx | 33 - .../lab-order-manifest/pre-appointment.scss | 12 - .../src/root.component.tsx | 8 - .../esm-lab-order-manifest-app/src/root.scss | 0 .../src/routes.json | 29 - .../src/types/index.ts | 0 .../src/utils/function.ts | 9 - .../translations/en.json | 14 - .../esm-lab-order-manifest-app/tsconfig.json | 5 - .../webpack.config.js | 1 - packages/esm-otz-app/jest.config.js | 3 - packages/esm-otz-app/package.json | 54 - packages/esm-otz-app/src/config-schema.ts | 12 - packages/esm-otz-app/src/dashboard.meta.tsx | 37 - packages/esm-otz-app/src/dashboard.scss | 27 - packages/esm-otz-app/src/declarations.d.ts | 4 - .../src/header/otz-header.component.tsx | 32 - .../esm-otz-app/src/header/otz-header.scss | 68 - .../src/header/otz-illustration.component.tsx | 13 - packages/esm-otz-app/src/index.ts | 67 - .../src/left-panel-link.component.tsx | 32 - packages/esm-otz-app/src/otz.component.tsx | 26 - packages/esm-otz-app/src/otz.scss | 9 - packages/esm-otz-app/src/root.component.tsx | 17 - packages/esm-otz-app/src/root.scss | 3 - packages/esm-otz-app/src/routes.json | 95 -- .../src/views/dashboard/common.scss | 34 - .../otz-program-services/common.scss | 34 - .../otz-enrolment.component.tsx | 16 - .../otz-program-services.tsx | 27 - .../otz-program-services/otz-program.scss | 34 - .../empty-data-illustration.component.tsx | 39 - .../empty-state/empty-state.component.tsx | 44 - .../empty-state/empty-state.scss | 70 - .../eligible-for-vl-testing.component.tsx | 76 -- .../eligible-not-enrolled.component.tsx | 55 - .../missed-appointments.component.tsx | 84 -- .../total-active.component.tsx | 55 - .../total-enrolled.component.tsx | 55 - .../otz-patient-list-tabs.component.tsx | 46 - .../otz-patient-list-tabs.scss | 3 - .../patient-summary/otz-patientsummary.scss | 24 - .../patient-summary.component.tsx | 23 - .../summary-tiles/otz-summary-tile.scss | 34 - .../otz-summary-tiles.component.tsx | 28 - packages/esm-otz-app/translations/en.json | 22 - packages/esm-otz-app/tsconfig.json | 5 - packages/esm-otz-app/webpack.config.js | 1 - .../hiv-testing-services/constants.ts | 28 +- .../hiv-testing/hiv-screening-constants.ts | 2 +- .../hiv-testing/hiv-testing-constants.ts | 4 +- yarn.lock | 1153 ++--------------- 271 files changed, 150 insertions(+), 15631 deletions(-) delete mode 100755 packages/esm-ampath-core-app/jest.config.js delete mode 100755 packages/esm-ampath-core-app/package.json delete mode 100755 packages/esm-ampath-core-app/src/ampath-dashboard/ampath-dashboard.component.tsx delete mode 100755 packages/esm-ampath-core-app/src/ampath-dashboard/ampath-dashboard.scss delete mode 100755 packages/esm-ampath-core-app/src/ampath-dashboard/side-menu/ampath-dashboard-side-nav.component.tsx delete mode 100755 packages/esm-ampath-core-app/src/ampath-dashboard/side-menu/ampath-dashboard-side-nav.scss delete mode 100755 packages/esm-ampath-core-app/src/ampath-dashboard/stock-management/stock-management-dashboard.component.tsx delete mode 100755 packages/esm-ampath-core-app/src/api/api.ts delete mode 100755 packages/esm-ampath-core-app/src/api/type.ts delete mode 100755 packages/esm-ampath-core-app/src/clinical-view-section.component.tsx delete mode 100755 packages/esm-ampath-core-app/src/clinical-view-section.scss delete mode 100755 packages/esm-ampath-core-app/src/config-schema.ts delete mode 100755 packages/esm-ampath-core-app/src/dashboard-group.component.tsx delete mode 100755 packages/esm-ampath-core-app/src/dashboard-group.scss delete mode 100755 packages/esm-ampath-core-app/src/dashboard.meta.tsx delete mode 100755 packages/esm-ampath-core-app/src/declarations.d.ts delete mode 100755 packages/esm-ampath-core-app/src/index.ts delete mode 100755 packages/esm-ampath-core-app/src/root.component.tsx delete mode 100755 packages/esm-ampath-core-app/src/root.scss delete mode 100755 packages/esm-ampath-core-app/src/root.tsx delete mode 100755 packages/esm-ampath-core-app/src/routes.json delete mode 100755 packages/esm-ampath-core-app/translations/en.json delete mode 100755 packages/esm-ampath-core-app/tsconfig.json delete mode 100755 packages/esm-ampath-core-app/webpack.config.js delete mode 100755 packages/esm-billing-app/README.md delete mode 100755 packages/esm-billing-app/__mocks__/visit.mock.ts delete mode 100755 packages/esm-billing-app/jest.config.js delete mode 100755 packages/esm-billing-app/package.json delete mode 100755 packages/esm-billing-app/src/bill-history/bill-history.component.tsx delete mode 100755 packages/esm-billing-app/src/bill-history/bill-history.scss delete mode 100755 packages/esm-billing-app/src/billable-services-admin-card-link.component.tsx delete mode 100755 packages/esm-billing-app/src/billable-services/bill-waiver/bill-selection.component.tsx delete mode 100755 packages/esm-billing-app/src/billable-services/bill-waiver/bill-waiver-form.component.tsx delete mode 100755 packages/esm-billing-app/src/billable-services/bill-waiver/bill-waiver-form.scss delete mode 100755 packages/esm-billing-app/src/billable-services/bill-waiver/bill-waiver.component.tsx delete mode 100755 packages/esm-billing-app/src/billable-services/bill-waiver/bill-waiver.scss delete mode 100755 packages/esm-billing-app/src/billable-services/bill-waiver/patient-bills.component.tsx delete mode 100755 packages/esm-billing-app/src/billable-services/billable-service.resource.tsx delete mode 100755 packages/esm-billing-app/src/billable-services/billable-services-home.component.tsx delete mode 100755 packages/esm-billing-app/src/billable-services/billable-services.component.tsx delete mode 100755 packages/esm-billing-app/src/billable-services/billable-services.scss delete mode 100755 packages/esm-billing-app/src/billable-services/billiable-item/drug-order/drug-order.component.tsx delete mode 100755 packages/esm-billing-app/src/billable-services/billiable-item/drug-order/drug-order.scss delete mode 100755 packages/esm-billing-app/src/billable-services/billiable-item/test-order/imaging-order.component.tsx delete mode 100755 packages/esm-billing-app/src/billable-services/billiable-item/test-order/lab-order.component.tsx delete mode 100755 packages/esm-billing-app/src/billable-services/billiable-item/test-order/price-info-order.componet.tsx delete mode 100755 packages/esm-billing-app/src/billable-services/billiable-item/test-order/price-info-order.scss delete mode 100755 packages/esm-billing-app/src/billable-services/billiable-item/test-order/procedure-order.component.tsx delete mode 100755 packages/esm-billing-app/src/billable-services/billiable-item/test-order/test-order-action.component.tsx delete mode 100755 packages/esm-billing-app/src/billable-services/billiable-item/test-order/test-order-action.resource.tsx delete mode 100755 packages/esm-billing-app/src/billable-services/billiable-item/useBillableItem.tsx delete mode 100755 packages/esm-billing-app/src/billable-services/billing-tariffs/add-billing-tariffs-service.scss delete mode 100755 packages/esm-billing-app/src/billable-services/billing-tariffs/add-billings-tariffs-service.component.tsx delete mode 100644 packages/esm-billing-app/src/billable-services/billing-tariffs/billing-tariffs-admin-card.tsx delete mode 100755 packages/esm-billing-app/src/billable-services/billing-tariffs/billing-tariffs-services.scss delete mode 100755 packages/esm-billing-app/src/billable-services/billing-tariffs/billing-tariffs.component.tsx delete mode 100755 packages/esm-billing-app/src/billable-services/billing-tariffs/billing-tariffs.resource.tsx delete mode 100755 packages/esm-billing-app/src/billable-services/create-edit/add-billable-service.component.tsx delete mode 100755 packages/esm-billing-app/src/billable-services/create-edit/add-billable-service.scss delete mode 100755 packages/esm-billing-app/src/billable-services/dashboard/dashboard.component.tsx delete mode 100755 packages/esm-billing-app/src/billable-services/dashboard/dashboard.scss delete mode 100755 packages/esm-billing-app/src/billable-services/dashboard/service-metrics.component.tsx delete mode 100755 packages/esm-billing-app/src/billing-dashboard/billing-dashboard.component.tsx delete mode 100755 packages/esm-billing-app/src/billing-dashboard/billing-dashboard.scss delete mode 100755 packages/esm-billing-app/src/billing-form/billing-checkin-form.component.tsx delete mode 100755 packages/esm-billing-app/src/billing-form/billing-checkin-form.scss delete mode 100755 packages/esm-billing-app/src/billing-form/billing-form.component.tsx delete mode 100755 packages/esm-billing-app/src/billing-form/billing-form.scss delete mode 100755 packages/esm-billing-app/src/billing-form/helper.ts delete mode 100755 packages/esm-billing-app/src/billing-form/social-health-authority/sha-number-validity.component.tsx delete mode 100755 packages/esm-billing-app/src/billing-form/visit-attributes/visit-attributes-form.component.tsx delete mode 100755 packages/esm-billing-app/src/billing-form/visit-attributes/visit-attributes-form.scss delete mode 100755 packages/esm-billing-app/src/billing-header/billing-header.component.tsx delete mode 100755 packages/esm-billing-app/src/billing-header/billing-header.scss delete mode 100755 packages/esm-billing-app/src/billing-header/billing-illustration.component.tsx delete mode 100755 packages/esm-billing-app/src/billing-prompt/billing-prompt.resource.tsx delete mode 100755 packages/esm-billing-app/src/billing-tabs/billing-tab.scss delete mode 100755 packages/esm-billing-app/src/billing-tabs/billling-tabs.component.tsx delete mode 100755 packages/esm-billing-app/src/billing.resource.ts delete mode 100755 packages/esm-billing-app/src/bills-table/bills-table.component.tsx delete mode 100755 packages/esm-billing-app/src/bills-table/bills-table.scss delete mode 100755 packages/esm-billing-app/src/claims/claims-wrap/claims-main-component.tsx delete mode 100755 packages/esm-billing-app/src/claims/claims-wrap/claims-main.scss delete mode 100755 packages/esm-billing-app/src/claims/dashboard/claims-breakdown/claims-breakdown.component.tsx delete mode 100755 packages/esm-billing-app/src/claims/dashboard/claims-breakdown/claims-breakdown.scss delete mode 100755 packages/esm-billing-app/src/claims/dashboard/claims-dashboard.component.tsx delete mode 100755 packages/esm-billing-app/src/claims/dashboard/form/claims-form.component.tsx delete mode 100755 packages/esm-billing-app/src/claims/dashboard/form/claims-form.resource.ts delete mode 100755 packages/esm-billing-app/src/claims/dashboard/form/claims-form.scss delete mode 100755 packages/esm-billing-app/src/claims/dashboard/header/claims-header.component.tsx delete mode 100755 packages/esm-billing-app/src/claims/dashboard/header/claims-header.scss delete mode 100755 packages/esm-billing-app/src/claims/dashboard/table/claims-table.component.tsx delete mode 100755 packages/esm-billing-app/src/claims/dashboard/table/claims-table.scss delete mode 100755 packages/esm-billing-app/src/claims/make-claims.component.tsx delete mode 100755 packages/esm-billing-app/src/claims/make-claims.scss delete mode 100755 packages/esm-billing-app/src/claims/metrics/metrics-card.component.tsx delete mode 100755 packages/esm-billing-app/src/claims/metrics/metrics-card.scss delete mode 100755 packages/esm-billing-app/src/claims/metrics/metrics-header.component.tsx delete mode 100755 packages/esm-billing-app/src/claims/metrics/metrics-header.scss delete mode 100755 packages/esm-billing-app/src/claims/metrics/metrics.component.tsx delete mode 100755 packages/esm-billing-app/src/claims/metrics/metrics.scss delete mode 100755 packages/esm-billing-app/src/config-schema.ts delete mode 100755 packages/esm-billing-app/src/constants.ts delete mode 100755 packages/esm-billing-app/src/dashboard.meta.ts delete mode 100755 packages/esm-billing-app/src/declarations.d.ts delete mode 100755 packages/esm-billing-app/src/helpers/functions.ts delete mode 100755 packages/esm-billing-app/src/helpers/index.ts delete mode 100755 packages/esm-billing-app/src/hooks/getMflCode.tsx delete mode 100755 packages/esm-billing-app/src/hooks/usePatientAttributes.tsx delete mode 100755 packages/esm-billing-app/src/hooks/useRequestStatus.tsx delete mode 100755 packages/esm-billing-app/src/index.ts delete mode 100755 packages/esm-billing-app/src/invoice/invoice-table.component.tsx delete mode 100755 packages/esm-billing-app/src/invoice/invoice-table.scss delete mode 100755 packages/esm-billing-app/src/invoice/invoice.component.tsx delete mode 100755 packages/esm-billing-app/src/invoice/invoice.scss delete mode 100755 packages/esm-billing-app/src/invoice/payments/initiate-payment/initiate-payment.component.tsx delete mode 100755 packages/esm-billing-app/src/invoice/payments/initiate-payment/initiate-payment.scss delete mode 100755 packages/esm-billing-app/src/invoice/payments/invoice-breakdown/invoice-breakdown.component.tsx delete mode 100755 packages/esm-billing-app/src/invoice/payments/invoice-breakdown/invoice-breakdown.scss delete mode 100755 packages/esm-billing-app/src/invoice/payments/payment-form/payment-form.component.tsx delete mode 100755 packages/esm-billing-app/src/invoice/payments/payment-form/payment-form.scss delete mode 100755 packages/esm-billing-app/src/invoice/payments/payment-history/payment-history.component.tsx delete mode 100755 packages/esm-billing-app/src/invoice/payments/payments.component.tsx delete mode 100755 packages/esm-billing-app/src/invoice/payments/payments.resource.ts delete mode 100755 packages/esm-billing-app/src/invoice/payments/payments.scss delete mode 100755 packages/esm-billing-app/src/invoice/payments/utils.ts delete mode 100755 packages/esm-billing-app/src/invoice/payments/visit-tags/visit-attribute.component.tsx delete mode 100755 packages/esm-billing-app/src/invoice/printable-invoice/print-receipt.component.tsx delete mode 100755 packages/esm-billing-app/src/invoice/printable-invoice/print-receipt.scss delete mode 100755 packages/esm-billing-app/src/invoice/printable-invoice/printable-footer.component.tsx delete mode 100755 packages/esm-billing-app/src/invoice/printable-invoice/printable-footer.scss delete mode 100755 packages/esm-billing-app/src/invoice/printable-invoice/printable-footer.test.tsx delete mode 100755 packages/esm-billing-app/src/invoice/printable-invoice/printable-invoice-header.component.tsx delete mode 100755 packages/esm-billing-app/src/invoice/printable-invoice/printable-invoice-header.scss delete mode 100755 packages/esm-billing-app/src/invoice/printable-invoice/printable-invoice-header.test.tsx delete mode 100755 packages/esm-billing-app/src/invoice/printable-invoice/printable-invoice.component.tsx delete mode 100755 packages/esm-billing-app/src/invoice/printable-invoice/printable-invoice.scss delete mode 100755 packages/esm-billing-app/src/left-panel-link.component.tsx delete mode 100755 packages/esm-billing-app/src/m-pesa/mpesa-resource.tsx delete mode 100755 packages/esm-billing-app/src/metrics-cards/card.component.tsx delete mode 100755 packages/esm-billing-app/src/metrics-cards/card.scss delete mode 100755 packages/esm-billing-app/src/metrics-cards/metrics-cards.component.tsx delete mode 100755 packages/esm-billing-app/src/metrics-cards/metrics-cards.scss delete mode 100755 packages/esm-billing-app/src/metrics-cards/metrics.resource.ts delete mode 100755 packages/esm-billing-app/src/modal/require-payment-modal.component.tsx delete mode 100755 packages/esm-billing-app/src/modal/require-payment.scss delete mode 100755 packages/esm-billing-app/src/past-patient-bills/filtered-patient-bills.component.tsx delete mode 100755 packages/esm-billing-app/src/past-patient-bills/patient-bills-dashboard/patient-bills-dashboard.scss delete mode 100755 packages/esm-billing-app/src/past-patient-bills/patient-bills-dashboard/patient-bills-dashboard.tsx delete mode 100755 packages/esm-billing-app/src/past-patient-bills/patient-bills.scss delete mode 100755 packages/esm-billing-app/src/root.component.tsx delete mode 100755 packages/esm-billing-app/src/root.scss delete mode 100755 packages/esm-billing-app/src/routes.json delete mode 100755 packages/esm-billing-app/src/types/index.ts delete mode 100755 packages/esm-billing-app/src/utils.ts delete mode 100755 packages/esm-billing-app/translations/en.json delete mode 100755 packages/esm-billing-app/tsconfig.json delete mode 100755 packages/esm-billing-app/webpack.config.js delete mode 100755 packages/esm-hts-app/jest.config.js delete mode 100755 packages/esm-hts-app/package.json delete mode 100755 packages/esm-hts-app/src/config-schema.ts delete mode 100755 packages/esm-hts-app/src/dashboard.meta.tsx delete mode 100755 packages/esm-hts-app/src/dashboard.scss delete mode 100755 packages/esm-hts-app/src/declarations.d.ts delete mode 100755 packages/esm-hts-app/src/header/hts-header.component.tsx delete mode 100755 packages/esm-hts-app/src/header/hts-header.scss delete mode 100755 packages/esm-hts-app/src/header/hts-illustration.component.tsx delete mode 100755 packages/esm-hts-app/src/hts.component.tsx delete mode 100755 packages/esm-hts-app/src/hts.scss delete mode 100755 packages/esm-hts-app/src/index.ts delete mode 100755 packages/esm-hts-app/src/left-panel-link.component.tsx delete mode 100755 packages/esm-hts-app/src/root.component.tsx delete mode 100755 packages/esm-hts-app/src/root.scss delete mode 100755 packages/esm-hts-app/src/routes.json delete mode 100755 packages/esm-hts-app/src/views/dashboard/common.scss delete mode 100755 packages/esm-hts-app/src/views/dashboard/hts-program-services/common.scss delete mode 100755 packages/esm-hts-app/src/views/dashboard/hts-program-services/hts-initial.component.tsx delete mode 100755 packages/esm-hts-app/src/views/dashboard/hts-program-services/hts-linkage.component.tsx delete mode 100755 packages/esm-hts-app/src/views/dashboard/hts-program-services/hts-program-services.tsx delete mode 100755 packages/esm-hts-app/src/views/dashboard/hts-program-services/hts-program.scss delete mode 100755 packages/esm-hts-app/src/views/dashboard/hts-program-services/hts-referred.component.tsx delete mode 100755 packages/esm-hts-app/src/views/dashboard/hts-program-services/hts-retest.component.tsx delete mode 100755 packages/esm-hts-app/src/views/dashboard/hts-program-services/hts-screening.component.tsx delete mode 100755 packages/esm-hts-app/src/views/dashboard/patient-list-tabs/empty-state/empty-data-illustration.component.tsx delete mode 100755 packages/esm-hts-app/src/views/dashboard/patient-list-tabs/empty-state/empty-state.component.tsx delete mode 100755 packages/esm-hts-app/src/views/dashboard/patient-list-tabs/empty-state/empty-state.scss delete mode 100755 packages/esm-hts-app/src/views/dashboard/patient-list-tabs/hts-patient-list-tables/due-for-linkage.component.tsx delete mode 100755 packages/esm-hts-app/src/views/dashboard/patient-list-tabs/hts-patient-list-tables/due-for-retest.component.tsx delete mode 100755 packages/esm-hts-app/src/views/dashboard/patient-list-tabs/hts-patient-list-tables/eligible.component.tsx delete mode 100755 packages/esm-hts-app/src/views/dashboard/patient-list-tabs/hts-patient-list-tables/hts-screening.component.tsx delete mode 100755 packages/esm-hts-app/src/views/dashboard/patient-list-tabs/hts-patient-list-tables/invalid-result.component.tsx delete mode 100755 packages/esm-hts-app/src/views/dashboard/patient-list-tabs/hts-patient-list-tables/module-uptake.component.tsx delete mode 100755 packages/esm-hts-app/src/views/dashboard/patient-list-tabs/hts-patient-list-tables/tested.component.tsx delete mode 100755 packages/esm-hts-app/src/views/dashboard/patient-list-tabs/hts-patient-list-tabs.component.tsx delete mode 100755 packages/esm-hts-app/src/views/dashboard/patient-list-tabs/hts-patient-list-tabs.scss delete mode 100755 packages/esm-hts-app/src/views/dashboard/patient-summary/hts-patientsummary.scss delete mode 100755 packages/esm-hts-app/src/views/dashboard/patient-summary/patient-summary.component.tsx delete mode 100755 packages/esm-hts-app/src/views/dashboard/summary-tiles/hts-summary-tile.scss delete mode 100755 packages/esm-hts-app/src/views/dashboard/summary-tiles/hts-summary-tiles-overall-uptake.component.tsx delete mode 100755 packages/esm-hts-app/src/views/dashboard/summary-tiles/hts-summary-tiles.component.tsx delete mode 100755 packages/esm-hts-app/translations/en.json delete mode 100755 packages/esm-hts-app/tsconfig.json delete mode 100755 packages/esm-hts-app/webpack.config.js delete mode 100755 packages/esm-lab-order-manifest-app/jest.config.js delete mode 100755 packages/esm-lab-order-manifest-app/package.json delete mode 100755 packages/esm-lab-order-manifest-app/src/config-schema.ts delete mode 100755 packages/esm-lab-order-manifest-app/src/declarations.d.ts delete mode 100755 packages/esm-lab-order-manifest-app/src/index.ts delete mode 100755 packages/esm-lab-order-manifest-app/src/lab-order-manifest/dialog/post-orde-to-eid-dialog.scss delete mode 100755 packages/esm-lab-order-manifest-app/src/lab-order-manifest/dialog/post-to-eid-dialog.component.tsx delete mode 100755 packages/esm-lab-order-manifest-app/src/lab-order-manifest/dialog/post-to-eid-dialog.resource.ts delete mode 100755 packages/esm-lab-order-manifest-app/src/lab-order-manifest/dialog/verification-modal.scss delete mode 100755 packages/esm-lab-order-manifest-app/src/lab-order-manifest/dialog/verification.component.tsx delete mode 100755 packages/esm-lab-order-manifest-app/src/lab-order-manifest/manifest-orders-list-resource.ts delete mode 100755 packages/esm-lab-order-manifest-app/src/lab-order-manifest/manifest-orders-list.tsx delete mode 100755 packages/esm-lab-order-manifest-app/src/lab-order-manifest/manifest-orders.component.tsx delete mode 100755 packages/esm-lab-order-manifest-app/src/lab-order-manifest/manifest-styles.scss delete mode 100755 packages/esm-lab-order-manifest-app/src/lab-order-manifest/order-actions/post-to-eid-action.component.tsx delete mode 100755 packages/esm-lab-order-manifest-app/src/lab-order-manifest/pre-appointment.scss delete mode 100755 packages/esm-lab-order-manifest-app/src/root.component.tsx delete mode 100755 packages/esm-lab-order-manifest-app/src/root.scss delete mode 100755 packages/esm-lab-order-manifest-app/src/routes.json delete mode 100755 packages/esm-lab-order-manifest-app/src/types/index.ts delete mode 100755 packages/esm-lab-order-manifest-app/src/utils/function.ts delete mode 100755 packages/esm-lab-order-manifest-app/translations/en.json delete mode 100755 packages/esm-lab-order-manifest-app/tsconfig.json delete mode 100755 packages/esm-lab-order-manifest-app/webpack.config.js delete mode 100755 packages/esm-otz-app/jest.config.js delete mode 100755 packages/esm-otz-app/package.json delete mode 100755 packages/esm-otz-app/src/config-schema.ts delete mode 100755 packages/esm-otz-app/src/dashboard.meta.tsx delete mode 100755 packages/esm-otz-app/src/dashboard.scss delete mode 100755 packages/esm-otz-app/src/declarations.d.ts delete mode 100755 packages/esm-otz-app/src/header/otz-header.component.tsx delete mode 100755 packages/esm-otz-app/src/header/otz-header.scss delete mode 100755 packages/esm-otz-app/src/header/otz-illustration.component.tsx delete mode 100755 packages/esm-otz-app/src/index.ts delete mode 100755 packages/esm-otz-app/src/left-panel-link.component.tsx delete mode 100755 packages/esm-otz-app/src/otz.component.tsx delete mode 100755 packages/esm-otz-app/src/otz.scss delete mode 100755 packages/esm-otz-app/src/root.component.tsx delete mode 100755 packages/esm-otz-app/src/root.scss delete mode 100755 packages/esm-otz-app/src/routes.json delete mode 100755 packages/esm-otz-app/src/views/dashboard/common.scss delete mode 100755 packages/esm-otz-app/src/views/dashboard/otz-program-services/common.scss delete mode 100755 packages/esm-otz-app/src/views/dashboard/otz-program-services/otz-enrolment.component.tsx delete mode 100755 packages/esm-otz-app/src/views/dashboard/otz-program-services/otz-program-services.tsx delete mode 100755 packages/esm-otz-app/src/views/dashboard/otz-program-services/otz-program.scss delete mode 100755 packages/esm-otz-app/src/views/dashboard/patient-list-tabs/empty-state/empty-data-illustration.component.tsx delete mode 100755 packages/esm-otz-app/src/views/dashboard/patient-list-tabs/empty-state/empty-state.component.tsx delete mode 100755 packages/esm-otz-app/src/views/dashboard/patient-list-tabs/empty-state/empty-state.scss delete mode 100755 packages/esm-otz-app/src/views/dashboard/patient-list-tabs/otz-patient-list-tables/eligible-for-vl-testing.component.tsx delete mode 100755 packages/esm-otz-app/src/views/dashboard/patient-list-tabs/otz-patient-list-tables/eligible-not-enrolled.component.tsx delete mode 100755 packages/esm-otz-app/src/views/dashboard/patient-list-tabs/otz-patient-list-tables/missed-appointments.component.tsx delete mode 100755 packages/esm-otz-app/src/views/dashboard/patient-list-tabs/otz-patient-list-tables/total-active.component.tsx delete mode 100755 packages/esm-otz-app/src/views/dashboard/patient-list-tabs/otz-patient-list-tables/total-enrolled.component.tsx delete mode 100755 packages/esm-otz-app/src/views/dashboard/patient-list-tabs/otz-patient-list-tabs.component.tsx delete mode 100755 packages/esm-otz-app/src/views/dashboard/patient-list-tabs/otz-patient-list-tabs.scss delete mode 100755 packages/esm-otz-app/src/views/dashboard/patient-summary/otz-patientsummary.scss delete mode 100755 packages/esm-otz-app/src/views/dashboard/patient-summary/patient-summary.component.tsx delete mode 100755 packages/esm-otz-app/src/views/dashboard/summary-tiles/otz-summary-tile.scss delete mode 100755 packages/esm-otz-app/src/views/dashboard/summary-tiles/otz-summary-tiles.component.tsx delete mode 100755 packages/esm-otz-app/translations/en.json delete mode 100755 packages/esm-otz-app/tsconfig.json delete mode 100755 packages/esm-otz-app/webpack.config.js mode change 100755 => 100644 yarn.lock diff --git a/.DS_Store b/.DS_Store index a821b6129e0e94e2b6ee75a7df0c232271fbc912..2fd35c1b30583e982379cac75123db02affc3a7e 100755 GIT binary patch delta 31 ncmZoMXfc@J&&azmU^g=(?_?g9$(xU`I5SUdP~FVV@s}R}pkxXj delta 61 zcmZoMXfc@J&&aniU^g=(-(((^$qIQ4`3xxxsSNQ9xnNc)Lk^HvoKl>ela!yI!?<}C MiwE;&c8 { - const { view } = useParams(); - const [dashboards, setDashboards] = useState([]); - const metaLinks = useExtensionSlotMeta('dashboard-links-slot') as Record; - const metaFolders = useExtensionSlotMeta('dashboard-slot') as Record; - const [currentDashboard, setCurrentDashboard] = useState(null); - const layout = useLayoutType(); - - useEffect(() => { - if (view) { - setCurrentDashboard(dashboards.find((db) => db.name == view)); - } else if (!currentDashboard) { - setCurrentDashboard(dashboards[0]); - } - }, [view, dashboards]); - - useEffect(() => { - if (!isDesktop(layout)) { - attach('nav-menu-slot', 'ampath-nav-items-ext'); - } - return () => detach('nav-menu-slot', 'ampath-nav-items-ext'); - }, [layout]); - - useEffect(() => { - const programSpecificLinks = metaFolders ? Object.values(metaFolders).filter((link) => link.isLink) : []; - const linksWithDashboardMeta = [ - ...Object.values(metaLinks).filter((link) => Object.keys(link).length), - ...programSpecificLinks, - ]; - if (linksWithDashboardMeta.length) { - setDashboards([...dashboards, ...linksWithDashboardMeta]); - } - }, [metaLinks, metaFolders]); - - const state = useMemo(() => { - if (currentDashboard) { - return { programme: currentDashboard?.config?.programme, dashboardTitle: currentDashboard.title }; - } - return null; - }, [currentDashboard]); - - return ( -
- {Object.values(metaFolders).map((f, index) => { - return ( - - ); - })} - {isDesktop(layout) && } -
- {currentDashboard && } -
-
- ); -}; - -const GroupAbleMenuItem = ({ groupSlot, dashboards, setDashboards, updateDashboardState }) => { - const meta = useExtensionSlotMeta(groupSlot); - useEffect(() => { - if (meta && Object.keys(meta).length) { - dashboards.push(...Object.values(meta).filter((entry) => Object.keys(entry).length)); - updateDashboardState && setDashboards([...dashboards]); - } - }, [meta]); - - return <>; -}; - -export default AmpathDashboard; diff --git a/packages/esm-ampath-core-app/src/ampath-dashboard/ampath-dashboard.scss b/packages/esm-ampath-core-app/src/ampath-dashboard/ampath-dashboard.scss deleted file mode 100755 index fc50a90..0000000 --- a/packages/esm-ampath-core-app/src/ampath-dashboard/ampath-dashboard.scss +++ /dev/null @@ -1,47 +0,0 @@ -@import '../root.scss'; - -.dashboardContainer { - display: -webkit-flex; - height: 90vh; - position: relative; - overflow-y: hidden; -} - -.dashboardContent { - margin: 0; - flex-basis: 75%; - flex-grow: 1; - flex-shrink: 1; - position: relative; - overflow-y: auto; - margin-left: 16rem; - padding-left: 0; - padding-right: 0; - max-width: 100% !important; -} - -.noMarker { - list-style-type: none; -} - -.noMarker ul li a { - padding-left: 40px !important; - font: lighter; -} - -.currentNavItem > a { - background-color: #cecece !important; - color: #161616 !important; - border-left-color: var(--brand-01) !important; - font: bolder; -} - -.hide { - display: none; -} - -@media (max-width: 1200px) { - .dashboardContent { - margin-left: 0; - } -} diff --git a/packages/esm-ampath-core-app/src/ampath-dashboard/side-menu/ampath-dashboard-side-nav.component.tsx b/packages/esm-ampath-core-app/src/ampath-dashboard/side-menu/ampath-dashboard-side-nav.component.tsx deleted file mode 100755 index e38e2ce..0000000 --- a/packages/esm-ampath-core-app/src/ampath-dashboard/side-menu/ampath-dashboard-side-nav.component.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import React from 'react'; -import { SideNav, SideNavItems } from '@carbon/react'; -import styles from './ampath-dashboard-side-nav.scss'; -import { ExtensionSlot } from '@openmrs/esm-framework'; -import { useTranslation } from 'react-i18next'; - -const AMPATHDashboardSideNav = () => { - const { t } = useTranslation(); - return ( - - - - -

{t('programmes', 'Programmes')}

- - -
-
- ); -}; - -export default AMPATHDashboardSideNav; diff --git a/packages/esm-ampath-core-app/src/ampath-dashboard/side-menu/ampath-dashboard-side-nav.scss b/packages/esm-ampath-core-app/src/ampath-dashboard/side-menu/ampath-dashboard-side-nav.scss deleted file mode 100755 index 3fa02b2..0000000 --- a/packages/esm-ampath-core-app/src/ampath-dashboard/side-menu/ampath-dashboard-side-nav.scss +++ /dev/null @@ -1,35 +0,0 @@ -@import '../../root.scss'; - -.sideNav { - width: 16rem; - // padding-top: 2rem; - min-height: 8rem; - overscroll-behavior: contain; - margin: 48px 13px 15px 0; - border-right: 1px #e0e0e0; -} - -.sideNavTextHeader { - font-size: 14px; - padding: 0.5rem 1rem 0.5rem; -} - -.sideNav :global(a.cds--side-nav__link[aria-current='page']:before), -.sideNav :global(.cds--side-nav__submenu[aria-expanded='false']:before) { - // background-color: $brand-teal-01; -} - -.sideNav :global(ul.cds--side-nav__items) { - border-style: solid !important; - border-right: 1px #e0e0e0; -} - -@media (max-width: 1200px) { - .sideNav :global(.cds--side-nav) { - z-index: -100 !important; - } - - .sideNav :global(.cds--side-nav__items) { - padding: 0 !important; - } -} diff --git a/packages/esm-ampath-core-app/src/ampath-dashboard/stock-management/stock-management-dashboard.component.tsx b/packages/esm-ampath-core-app/src/ampath-dashboard/stock-management/stock-management-dashboard.component.tsx deleted file mode 100755 index 2a9a6c4..0000000 --- a/packages/esm-ampath-core-app/src/ampath-dashboard/stock-management/stock-management-dashboard.component.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import React, { useEffect } from 'react'; -import { ExtensionSlot } from '@openmrs/esm-framework'; - -const StockManagementDashboard = () => { - return ; -}; - -export default StockManagementDashboard; diff --git a/packages/esm-ampath-core-app/src/api/api.ts b/packages/esm-ampath-core-app/src/api/api.ts deleted file mode 100755 index e69de29..0000000 diff --git a/packages/esm-ampath-core-app/src/api/type.ts b/packages/esm-ampath-core-app/src/api/type.ts deleted file mode 100755 index e69de29..0000000 diff --git a/packages/esm-ampath-core-app/src/clinical-view-section.component.tsx b/packages/esm-ampath-core-app/src/clinical-view-section.component.tsx deleted file mode 100755 index 48b4204..0000000 --- a/packages/esm-ampath-core-app/src/clinical-view-section.component.tsx +++ /dev/null @@ -1,36 +0,0 @@ -import React, { useEffect } from 'react'; -import styles from './clinical-view-section.scss'; -import { useTranslation } from 'react-i18next'; -import { Information } from '@carbon/react/icons'; -import { Tooltip } from '@carbon/react'; -import { ExtensionSlot } from '@openmrs/esm-framework'; -import { type DashboardGroupExtensionProps } from './dashboard-group.component'; -import { registerNavGroup } from '@openmrs/esm-patient-common-lib'; - -export const ClinicalViewSection: React.FC = ({ title, basePath }) => { - const slotName = 'clinical-view-section'; - const { t } = useTranslation(); - useEffect(() => { - registerNavGroup(slotName); - }, [slotName]); - return ( - <> -
- {t('clinicalViews', 'Clinical views')} - - - -
- - - ); -}; - -export default ClinicalViewSection; diff --git a/packages/esm-ampath-core-app/src/clinical-view-section.scss b/packages/esm-ampath-core-app/src/clinical-view-section.scss deleted file mode 100755 index 2dc4fa0..0000000 --- a/packages/esm-ampath-core-app/src/clinical-view-section.scss +++ /dev/null @@ -1,20 +0,0 @@ -@use '@carbon/colors'; -@use '@carbon/layout'; -@use '@carbon/type'; - -.container { - height: layout.$layout-03; - display: flex; - align-items: center; - padding: layout.$layout-02 layout.$layout-01; - @include type.type-style('label-02'); - color: colors.$gray-70; - column-gap: layout.$layout-01; - background-color: colors.$gray-10; - margin-top: layout.$layout-05; -} - -.dividerText { - font-size: 1rem; - font-weight: 650; -} diff --git a/packages/esm-ampath-core-app/src/config-schema.ts b/packages/esm-ampath-core-app/src/config-schema.ts deleted file mode 100755 index 11a9cc5..0000000 --- a/packages/esm-ampath-core-app/src/config-schema.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { Type } from '@openmrs/esm-framework'; -export const configSchema = { - basicAuthBase64: { - _type: Type.String, - _description: 'Basic auth base64 string for the API call e.g Basic someBase64String==', - _default: '', - }, -}; - -export type PreAppointmentsConfig = { - basicAuthBase64: string; -}; diff --git a/packages/esm-ampath-core-app/src/dashboard-group.component.tsx b/packages/esm-ampath-core-app/src/dashboard-group.component.tsx deleted file mode 100755 index 38dcc33..0000000 --- a/packages/esm-ampath-core-app/src/dashboard-group.component.tsx +++ /dev/null @@ -1,39 +0,0 @@ -import React, { useEffect } from 'react'; -import { ExtensionSlot, useLayoutType } from '@openmrs/esm-framework'; -import { SideNavItems, SideNavMenu, SideNavDivider } from '@carbon/react'; -import { Add } from '@carbon/react/icons'; -import { registerNavGroup } from '@openmrs/esm-patient-common-lib'; -import styles from './dashboard-group.scss'; - -export interface DashboardGroupExtensionProps { - title: string; - slotName?: string; - basePath: string; - isExpanded?: boolean; - isChild?: boolean; -} - -export const DashboardGroupExtension: React.FC = ({ - title, - slotName, - basePath, - isExpanded, - isChild, -}) => { - const isTablet = useLayoutType() === 'tablet'; - useEffect(() => { - registerNavGroup(slotName); - }, [slotName]); - - return ( - - - - - - ); -}; diff --git a/packages/esm-ampath-core-app/src/dashboard-group.scss b/packages/esm-ampath-core-app/src/dashboard-group.scss deleted file mode 100755 index d153724..0000000 --- a/packages/esm-ampath-core-app/src/dashboard-group.scss +++ /dev/null @@ -1,21 +0,0 @@ -@use '@carbon/layout'; -@use '@carbon/colors'; -@use '@carbon/type'; - -.sideMenuItems { - padding: 0; - - :global(.cds--side-nav__link.active-left-nav-link) { - padding: 0 1.75rem; - } -} - -.childMenuItems { - padding-left: layout.$spacing-02; -} - -.sideNavMenu { - :global(.cds--side-nav__submenu) { - padding-left: layout.$spacing-06; - } -} diff --git a/packages/esm-ampath-core-app/src/dashboard.meta.tsx b/packages/esm-ampath-core-app/src/dashboard.meta.tsx deleted file mode 100755 index cb723b3..0000000 --- a/packages/esm-ampath-core-app/src/dashboard.meta.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { InventoryManagement } from '@carbon/react/icons'; - -export const stockManagementDashboardMeta = { - name: 'stock-management', - slot: 'ampath-dashboard-stock-management-slot', - config: { columns: 1, type: 'grid', icon: InventoryManagement }, - isLink: true, - title: 'Stock Management', -}; diff --git a/packages/esm-ampath-core-app/src/declarations.d.ts b/packages/esm-ampath-core-app/src/declarations.d.ts deleted file mode 100755 index 8539186..0000000 --- a/packages/esm-ampath-core-app/src/declarations.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -declare module '@carbon/react'; -declare module '*.css'; -declare module '*.scss'; -declare type SideNavProps = {}; diff --git a/packages/esm-ampath-core-app/src/index.ts b/packages/esm-ampath-core-app/src/index.ts deleted file mode 100755 index edaeee5..0000000 --- a/packages/esm-ampath-core-app/src/index.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { defineConfigSchema, getAsyncLifecycle, getSyncLifecycle } from '@openmrs/esm-framework'; -import { configSchema } from './config-schema'; -import ClinicalViewSection from './clinical-view-section.component'; - -const moduleName = '@ampath/esm-ampath-core-app'; - -const options = { - featureName: 'esm-ampath-core-app', - moduleName, -}; -export const importTranslation = require.context('../translations', false, /.json$/, 'lazy'); - -export function startupApp() { - defineConfigSchema(moduleName, configSchema); -} - -export const dashboard = getAsyncLifecycle(() => import('./root'), options); - -export const ampathNavItems = getAsyncLifecycle( - () => import('./ampath-dashboard/side-menu/ampath-dashboard-side-nav.component'), - { - featureName: 'nav-items', - moduleName, - }, -); - -export const clinicalViewPatientDashboard = getSyncLifecycle(ClinicalViewSection, options); diff --git a/packages/esm-ampath-core-app/src/root.component.tsx b/packages/esm-ampath-core-app/src/root.component.tsx deleted file mode 100755 index 65db3f5..0000000 --- a/packages/esm-ampath-core-app/src/root.component.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import React from 'react'; -import { BrowserRouter, Navigate, Route, Routes } from 'react-router-dom'; -import AmpathDashboard from './ampath-dashboard/ampath-dashboard.component'; - -export default function Root() { - return ( - - - } /> - } /> - } /> - - - ); -} diff --git a/packages/esm-ampath-core-app/src/root.scss b/packages/esm-ampath-core-app/src/root.scss deleted file mode 100755 index e69de29..0000000 diff --git a/packages/esm-ampath-core-app/src/root.tsx b/packages/esm-ampath-core-app/src/root.tsx deleted file mode 100755 index 193dab0..0000000 --- a/packages/esm-ampath-core-app/src/root.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import React from 'react'; -import { BrowserRouter, Navigate, Route, Routes } from 'react-router-dom'; -import AMPATHDashboard from './ampath-dashboard/ampath-dashboard.component'; - -export default function Root() { - return ( - - - } /> - } /> - } /> - - - ); -} diff --git a/packages/esm-ampath-core-app/src/routes.json b/packages/esm-ampath-core-app/src/routes.json deleted file mode 100755 index 2bfa533..0000000 --- a/packages/esm-ampath-core-app/src/routes.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "$schema": "https://json.openmrs.org/routes.schema.json", - "backendDependencies": { - "webservices.rest": "^2.24.0" - }, - "pages": [ - - ], - "extensions": [ - { - "name": "clinical-view-section", - "component": "clinicalViewPatientDashboard", - "slot": "patient-chart-dashboard-slot", - "order": 20 - } - ] - } diff --git a/packages/esm-ampath-core-app/translations/en.json b/packages/esm-ampath-core-app/translations/en.json deleted file mode 100755 index dcbe419..0000000 --- a/packages/esm-ampath-core-app/translations/en.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "clinicalViews": "Clinical views", - "customViews": "In this section, you'll find custom clinical views tailored to patients' conditions and enrolled care programs.", - "programmes": "Programmes" -} diff --git a/packages/esm-ampath-core-app/tsconfig.json b/packages/esm-ampath-core-app/tsconfig.json deleted file mode 100755 index 54ce28c..0000000 --- a/packages/esm-ampath-core-app/tsconfig.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "include": ["src/**/*"], - "exclude": ["src/**/*.test.tsx"] -} diff --git a/packages/esm-ampath-core-app/webpack.config.js b/packages/esm-ampath-core-app/webpack.config.js deleted file mode 100755 index 2c74029..0000000 --- a/packages/esm-ampath-core-app/webpack.config.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('openmrs/default-webpack-config'); diff --git a/packages/esm-billing-app/README.md b/packages/esm-billing-app/README.md deleted file mode 100755 index 00dc2c0..0000000 --- a/packages/esm-billing-app/README.md +++ /dev/null @@ -1,5 +0,0 @@ -![Node.js CI](https://github.com/palladiumkenya/kenyaemr-esm-3.x/workflows/Node.js%20CI/badge.svg) - -# ESM Billing App - -This is a frontend module that provides billing functionality. diff --git a/packages/esm-billing-app/__mocks__/visit.mock.ts b/packages/esm-billing-app/__mocks__/visit.mock.ts deleted file mode 100755 index 1d1b0e8..0000000 --- a/packages/esm-billing-app/__mocks__/visit.mock.ts +++ /dev/null @@ -1,151 +0,0 @@ -export const mockCurrentVisit = { - uuid: 'ee527f74-7373-4494-98bc-002c979971d1', - encounters: [], - patient: { uuid: '0b25b92a-add3-4d52-8491-778bec556e02' }, - visitType: { uuid: '3371a4d4-f66f-4454-a86d-92c7b3da990c', name: 'Outpatient', display: 'Outpatient' }, - attributes: [ - { - uuid: 'e1522ecb-d027-4c30-aa25-38698ba18020', - display: 'Source form: 13', - attributeType: { - name: 'Source form', - datatypeClassname: 'org.openmrs.module.kenyaemr.datatype.FormDatatype', - uuid: '8bfab185-6947-4958-b7ab-dfafae1a3e3d', - }, - value: { - uuid: '23b4ebbd-29ad-455e-be0e-04aa6bc30798', - display: 'MOH 257 Visit Summary', - name: 'MOH 257 Visit Summary', - description: null, - encounterType: { - uuid: 'a0034eee-1940-4e35-847f-97537a35d05e', - display: 'HIV Consultation', - }, - version: '1', - build: null, - published: true, - formFields: [], - retired: false, - resourceVersion: '1.9', - }, - }, - { - uuid: '5dbb093d-b377-4684-9583-05074ae7187a', - display: 'Payment Method: 28989582-e8c3-46b0-96d0-c249cb06d5c6', - attributeType: { - name: 'Payment Method', - datatypeClassname: 'org.openmrs.customdatatype.datatype.FreeTextDatatype', - uuid: 'e6cb0c3b-04b0-4117-9bc6-ce24adbda802', - }, - value: '28989582-e8c3-46b0-96d0-c249cb06d5c6', - }, - { - uuid: '85abc096-8524-4c2e-863c-b44c99c144f7', - display: 'Patient Type: false', - attributeType: { - name: 'Patient Type', - datatypeClassname: 'org.openmrs.customdatatype.datatype.FreeTextDatatype', - uuid: '3b9dfac8-9e4d-11ee-8c90-0242ac120002', - }, - value: 'false', - }, - { - uuid: '7eb402bb-2bf8-43b7-91aa-ee3f5c753de1', - display: 'Visit queue number: CLI-090', - attributeType: { - name: 'Visit queue number', - datatypeClassname: 'org.openmrs.customdatatype.datatype.FreeTextDatatype', - uuid: 'c61ce16f-272a-41e7-9924-4c555d0932c5', - }, - value: 'CLI-090', - }, - ], - location: { - uuid: '233de33e-2778-4f9a-a398-fa09da9daa14', - name: 'Wamagana Health Centre', - display: 'Wamagana Health Centre', - }, - startDatetime: '2024-05-29T15:19:00.000+0300', - stopDatetime: '', -}; - -export const mockBills = [ - { - id: 1888, - uuid: '3b784fa7-c124-4710-9152-cad3dbaa19e8', - patientName: ' Test Unit patient', - identifier: 'MGTKYE ', - patientUuid: '0b25b92a-add3-4d52-8491-778bec556e02', - status: 'PENDING', - receiptNumber: '1916-6', - cashier: { - uuid: '693acc9b-734f-488d-b6d2-60368d02cec0', - display: '23797304 - Test Patient', - }, - cashPointUuid: '54065383-b4d4-42d2-af4d-d250a1fd2590', - cashPointName: 'OPD Cash Point', - cashPointLocation: 'Moi Teaching Refferal Hospital', - dateCreated: '29 — May — 2024', - lineItems: [ - { - uuid: '528c3411-b3b8-41dc-bf88-174b4adc1b5b', - display: 'BillLineItem', - voided: false, - voidReason: null, - item: '', - billableService: '3f5d0684-a280-477e-a67b-2a956a1f6dca:Registration Revist', - quantity: 1, - price: 50, - priceName: 'Default', - priceUuid: '', - lineItemOrder: 0, - paymentStatus: 'PENDING', - order: null, - resourceVersion: '1.8', - }, - ], - billingService: '3f5d0684-a280-477e-a67b-2a956a1f6dca:Registration Revist', - payments: [], - display: '1916-6', - totalAmount: 50, - }, - { - id: 1213, - uuid: '5b633220-9a99-4517-bcdf-c06a7d38dd23', - patientName: ' peter ndungu mairo', - identifier: 'MGTKYE ', - patientUuid: '0b25b92a-add3-4d52-8491-778bec556e02', - status: 'PENDING', - receiptNumber: '1228-6', - cashier: { - uuid: '48b55692-e061-4ffa-b1f2-fd4aaf506224', - display: 'admin - Super User', - }, - cashPointUuid: '54065383-b4d4-42d2-af4d-d250a1fd2590', - cashPointName: 'OPD Cash Point', - cashPointLocation: 'Moi Teaching Refferal Hospital', - dateCreated: '15 — May — 2024', - lineItems: [ - { - uuid: '16cc8b90-f2d4-4907-a3d5-0f57486e5dcf', - display: 'BillLineItem', - voided: false, - voidReason: null, - item: '', - billableService: '3f5d0684-a280-477e-a67b-2a956a1f6dca:Registration Revist', - quantity: 1, - price: 50, - priceName: 'Default', - priceUuid: '', - lineItemOrder: 0, - paymentStatus: 'PENDING', - order: null, - resourceVersion: '1.8', - }, - ], - billingService: '3f5d0684-a280-477e-a67b-2a956a1f6dca:Registration Revist', - payments: [], - display: '1228-6', - totalAmount: 50, - }, -]; diff --git a/packages/esm-billing-app/jest.config.js b/packages/esm-billing-app/jest.config.js deleted file mode 100755 index e53fc90..0000000 --- a/packages/esm-billing-app/jest.config.js +++ /dev/null @@ -1,8 +0,0 @@ -const rootConfig = require('../../jest.config.js'); - -const packageConfig = { - ...rootConfig, - collectCoverage: false, -}; - -module.exports = packageConfig; diff --git a/packages/esm-billing-app/package.json b/packages/esm-billing-app/package.json deleted file mode 100755 index bb437e5..0000000 --- a/packages/esm-billing-app/package.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "@ampath/esm-billing-app", - "version": "5.2.0", - "description": "Billing app for AMPATH", - "browser": "dist/ampath-esm-billing-app.js", - "main": "src/index.ts", - "source": true, - "license": "MPL-2.0", - "homepage": "https://github.com/palladiumkenya/ampath-esm-core#readme", - "scripts": { - "start": "openmrs develop", - "serve": "webpack serve --mode=development", - "debug": "npm run serve", - "build": "webpack --mode production", - "analyze": "webpack --mode=production --env.analyze=true", - "lint": "eslint src --ext ts,tsx", - "typescript": "tsc", - "extract-translations": "i18next 'src/**/*.component.tsx' 'src/index.ts' --config ../../tools/i18next-parser.config.js", - "test": "cross-env TZ=UTC jest --config jest.config.js --verbose false --passWithNoTests", - "test:watch": "cross-env TZ=UTC jest --watch --config jest.config.js", - "coverage": "yarn test --coverage" - }, - "browserslist": [ - "extends browserslist-config-openmrs" - ], - "keywords": [ - "openmrs" - ], - "publishConfig": { - "access": "public" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/palladiumkenya/kenyaemr-esm-core#readme" - }, - "bugs": { - "url": "https://github.com/palladiumkenya/kenyaemr-esm-core/issues" - }, - "dependencies": { - "@carbon/react": "^1.42.1", - "lodash-es": "^4.17.15", - "react-to-print": "^2.14.13" - }, - "peerDependencies": { - "@openmrs/esm-framework": "5.x", - "react": "^18.1.0", - "react-i18next": "11.x", - "react-router-dom": "6.x", - "swr": "2.x" - }, - "devDependencies": { - "webpack": "^5.74.0" - } -} diff --git a/packages/esm-billing-app/src/bill-history/bill-history.component.tsx b/packages/esm-billing-app/src/bill-history/bill-history.component.tsx deleted file mode 100755 index 811daa8..0000000 --- a/packages/esm-billing-app/src/bill-history/bill-history.component.tsx +++ /dev/null @@ -1,210 +0,0 @@ -import React from 'react'; -import { useTranslation } from 'react-i18next'; -import { - DataTableSkeleton, - Layer, - DataTable, - TableContainer, - Table, - TableHead, - TableHeader, - TableRow, - TableBody, - TableCell, - Tile, - Pagination, - TableExpandHeader, - TableExpandRow, - TableExpandedRow, - Button, -} from '@carbon/react'; -import { Add } from '@carbon/react/icons'; -import { isDesktop, useLayoutType, usePagination } from '@openmrs/esm-framework'; -import { - EmptyDataIllustration, - ErrorState, - usePaginationInfo, - CardHeader, - useLaunchWorkspaceRequiringVisit, -} from '@openmrs/esm-patient-common-lib'; -import { useBills } from '../billing.resource'; -import InvoiceTable from '../invoice/invoice-table.component'; -import styles from './bill-history.scss'; - -interface BillHistoryProps { - patientUuid: string; -} - -const BillHistory: React.FC = ({ patientUuid }) => { - const { t } = useTranslation(); - const { bills, isLoading, error } = useBills(patientUuid); - const launchPatientWorkspace = useLaunchWorkspaceRequiringVisit('billing-form'); - const layout = useLayoutType(); - const [pageSize, setPageSize] = React.useState(10); - const responsiveSize = isDesktop(layout) ? 'sm' : 'lg'; - const { paginated, goTo, results, currentPage } = usePagination(bills, pageSize); - const { pageSizes } = usePaginationInfo(pageSize, bills?.length, currentPage, results?.length); - - const handleLaunchBillForm = () => { - launchPatientWorkspace({ workspaceTitle: t('billingForm', 'Billing Form') }); - }; - - const headerData = [ - { - header: t('visitTime', 'Visit time'), - key: 'visitTime', - }, - { - header: t('identifier', 'Identifier'), - key: 'identifier', - }, - { - header: t('billedItems', 'Billed Items'), - key: 'billedItems', - }, - { - header: t('billTotal', 'Bill total'), - key: 'billTotal', - }, - ]; - - const setBilledItems = (bill) => - bill.lineItems?.reduce( - (acc, item) => acc + (acc ? ' & ' : '') + (item.billableService?.split(':')[1] || item.item?.split(':')[1] || ''), - '', - ); - - const rowData = results?.map((bill) => ({ - id: bill.uuid, - uuid: bill.uuid, - billTotal: bill.totalAmount, - visitTime: bill.dateCreated, - identifier: bill.identifier, - billedItems: setBilledItems(bill), - })); - - if (isLoading) { - return ( -
- -
- ); - } - - if (error) { - return ( -
- - - -
- ); - } - - if (bills.length === 0) { - return ( - <> - - <> - - - -
- -
-

There are no bills to display.

- -
-
- - ); - } - - return ( -
- - - -
- - {({ - rows, - headers, - getExpandHeaderProps, - getTableProps, - getTableContainerProps, - getHeaderProps, - getRowProps, - }) => ( - - - - - - {headers.map((header, i) => ( - - {header.header} - - ))} - - - - {rows.map((row, i) => { - const currentBill = bills?.find((bill) => bill.uuid === row.id); - - return ( - - - {row.cells.map((cell) => ( - {cell.value} - ))} - - {row.isExpanded ? ( - -
- -
-
- ) : ( - - )} -
- ); - })} -
-
-
- )} -
- {paginated && ( - { - if (newPage !== currentPage) { - goTo(newPage); - } - setPageSize(pageSize); - }} - /> - )} -
-
- ); -}; - -export default BillHistory; diff --git a/packages/esm-billing-app/src/bill-history/bill-history.scss b/packages/esm-billing-app/src/bill-history/bill-history.scss deleted file mode 100755 index 786f905..0000000 --- a/packages/esm-billing-app/src/bill-history/bill-history.scss +++ /dev/null @@ -1,165 +0,0 @@ -@use '@carbon/layout'; -@use '@carbon/type'; -@import '~@openmrs/esm-styleguide/src/vars'; - -.container { - margin: 2rem 0; -} - -.billHistoryContainer { - background-color: $ui-02; - border: 1px solid $ui-03; - border-bottom: none; - width: 100%; - margin: 0 auto; - max-width: 95vw; - padding-bottom: 0; -} - -.headerContainer { - display: flex; - justify-content: space-between; - align-items: center; - padding: layout.$spacing-04 0 layout.$spacing-04 layout.$spacing-05; - background-color: $ui-02; -} - -.backgroundDataFetchingIndicator { - align-items: center; - display: flex; - flex: 1 1 0%; - justify-content: center; -} - -.tableContainer section { - position: relative; -} - -.tableContainer a { - text-decoration: none; -} - -.pagination { - overflow: hidden; - - &:global(.cds--pagination) { - border-top: none; - } -} - -.hiddenRow { - display: none; -} - -.emptyRow { - padding: 0 1rem; - display: flex; - align-items: center; -} - -.visitSummaryContainer { - width: 100%; - max-width: 768px; - margin: 1rem auto; -} - -.expandedActiveVisitRow > td > div { - max-height: max-content !important; -} - -.expandedActiveVisitRow td { - padding: 0 2rem; -} - -.expandedActiveVisitRow th[colspan] td[colspan] > div:first-child { - padding: 0 1rem; -} - -.action { - margin-bottom: layout.$spacing-03; -} - -.illo { - margin-top: layout.$spacing-05; -} - -.content { - @include type.type-style('heading-compact-01'); - color: $text-02; - margin-top: layout.$spacing-05; - margin-bottom: layout.$spacing-03; -} - -.desktopHeading, -.tabletHeading { - text-align: left; - text-transform: capitalize; - - h4 { - @include type.type-style('heading-compact-02'); - color: $text-02; - - &:after { - content: ''; - display: block; - width: 2rem; - padding-top: 3px; - border-bottom: 0.375rem solid; - @include brand-03(border-bottom-color); - } - } -} - -.tile { - text-align: center; - // border: 1px solid $ui-03; -} - -.filterEmptyState { - display: flex; - justify-content: center; - align-items: center; - padding: layout.$spacing-05; - margin: layout.$spacing-09; - text-align: center; -} - -.filterEmptyStateTile { - margin: auto; -} - -.filterEmptyStateContent { - @include type.type-style('heading-compact-02'); - color: $text-02; - margin-bottom: 0.5rem; -} - -.filterEmptyStateHelper { - @include type.type-style('body-compact-01'); - color: $text-02; -} - -.table { - tr[data-child-row] td { - padding-left: 2rem !important; - } -} - -.billingHeading { - position: relative; - max-width: 400px; - text-align: 'left'; - margin-bottom: 40px; -} - -.billingHeading::after { - position: absolute; - bottom: -10px; - width: 50px; - height: 5px; - background: green; - content: ''; - display: block; - left: 6%; - transform: translatex(-50%); -} diff --git a/packages/esm-billing-app/src/billable-services-admin-card-link.component.tsx b/packages/esm-billing-app/src/billable-services-admin-card-link.component.tsx deleted file mode 100755 index b385dd3..0000000 --- a/packages/esm-billing-app/src/billable-services-admin-card-link.component.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import React from 'react'; -import { useTranslation } from 'react-i18next'; -import { Layer, ClickableTile } from '@carbon/react'; -import { ArrowRight } from '@carbon/react/icons'; - -const BillableServicesCardLink: React.FC = () => { - const { t } = useTranslation(); - const header = t('manageBillableServices', 'Manage billable services'); - return ( - - -
-
{header}
-
{t('billableServices', 'Billable Services')}
-
-
- -
-
-
- ); -}; - -export default BillableServicesCardLink; diff --git a/packages/esm-billing-app/src/billable-services/bill-waiver/bill-selection.component.tsx b/packages/esm-billing-app/src/billable-services/bill-waiver/bill-selection.component.tsx deleted file mode 100755 index 65f2301..0000000 --- a/packages/esm-billing-app/src/billable-services/bill-waiver/bill-selection.component.tsx +++ /dev/null @@ -1,74 +0,0 @@ -import React from 'react'; -import { - StructuredListHead, - StructuredListRow, - StructuredListCell, - StructuredListBody, - StructuredListWrapper, - Layer, - Checkbox, -} from '@carbon/react'; -import { useTranslation } from 'react-i18next'; -import { convertToCurrency, extractString } from '../../helpers'; -import { type MappedBill, type LineItem } from '../../types'; -import styles from './bill-waiver.scss'; -import BillWaiverForm from './bill-waiver-form.component'; - -const PatientBillsSelections: React.FC<{ bills: MappedBill; setPatientUuid: (patientUuid) => void }> = ({ - bills, - setPatientUuid, -}) => { - const { t } = useTranslation(); - const [selectedBills, setSelectedBills] = React.useState>([]); - - const checkBoxLabel = (lineItem) => { - return `${lineItem.item === '' ? lineItem.billableService : lineItem.item} ${convertToCurrency(lineItem.price)}`; - }; - - const handleOnCheckBoxChange = (event, { checked, id }) => { - const selectedLineItem = bills.lineItems.find((lineItem) => lineItem.uuid === id); - if (checked) { - setSelectedBills([...selectedBills, selectedLineItem]); - } else { - setSelectedBills(selectedBills.filter((lineItem) => lineItem.uuid !== id)); - } - }; - return ( - - - - - {t('billItem', 'Bill item')} - {t('quantity', 'Quantity')} - {t('unitPrice', 'Unit Price')} - {t('total', 'Total')} - {t('actions', 'Actions')} - - - - {bills?.lineItems.map((lineItem) => ( - - - {lineItem.item === '' ? extractString(lineItem.billableService) : extractString(lineItem.item)} - - {lineItem.quantity} - {convertToCurrency(lineItem.price)} - {convertToCurrency(lineItem.price * lineItem.quantity)} - - handleOnCheckBoxChange(event, { checked, id })} - labelText={checkBoxLabel(lineItem)} - id={lineItem.uuid} - /> - - - ))} - - - - - ); -}; - -export default PatientBillsSelections; diff --git a/packages/esm-billing-app/src/billable-services/bill-waiver/bill-waiver-form.component.tsx b/packages/esm-billing-app/src/billable-services/bill-waiver/bill-waiver-form.component.tsx deleted file mode 100755 index 5c0dd52..0000000 --- a/packages/esm-billing-app/src/billable-services/bill-waiver/bill-waiver-form.component.tsx +++ /dev/null @@ -1,105 +0,0 @@ -import React, { useState } from 'react'; -import { Form, Stack, FormGroup, Layer, Button, NumberInput } from '@carbon/react'; -import { TaskAdd } from '@carbon/react/icons'; -import { useTranslation } from 'react-i18next'; -import styles from './bill-waiver-form.scss'; -import { type LineItem, type MappedBill } from '../../types'; -import { createBillWaiverPayload, extractErrorMessagesFromResponse } from '../../utils'; -import { convertToCurrency, extractString } from '../../helpers'; -import { processBillPayment, usePaymentModes } from '../../billing.resource'; -import { showSnackbar } from '@openmrs/esm-framework'; -import { mutate } from 'swr'; - -type BillWaiverFormProps = { - bill: MappedBill; - lineItems: Array; - setPatientUuid: (patientUuid) => void; -}; - -const BillWaiverForm: React.FC = ({ bill, lineItems, setPatientUuid }) => { - const { t } = useTranslation(); - const [waiverAmount, setWaiverAmount] = useState(0); - - const totalAmount = lineItems.reduce((acc, curr) => acc + curr.price * curr.quantity, 0); - const { paymentModes } = usePaymentModes(false); - - if (lineItems?.length === 0) { - return null; - } - - const handleProcessPayment = () => { - const waiverEndPointPayload = createBillWaiverPayload(bill, waiverAmount, totalAmount, lineItems, paymentModes); - - processBillPayment(waiverEndPointPayload, bill.uuid).then( - (resp) => { - showSnackbar({ - title: t('billWaiver', 'Bill waiver'), - subtitle: t('billWaiverSuccess', 'Bill waiver successful'), - kind: 'success', - timeoutInMs: 3500, - isLowContrast: true, - }); - setPatientUuid(''); - mutate((key) => typeof key === 'string' && key.startsWith('/ws/rest/v1/cashier/bill?v=full'), undefined, { - revalidate: true, - }); - }, - (error) => { - showSnackbar({ - title: t('billWaiver', 'Bill waiver'), - subtitle: t('billWaiverError', 'Bill waiver failed {{error}}', { - error: extractErrorMessagesFromResponse(error?.responseBody), - }), - kind: 'error', - timeoutInMs: 3500, - isLowContrast: true, - }); - }, - ); - }; - - return ( -
-
- - -
- -

- {t('billName', ' {{billName}} ', { - billName: lineItems.map((item) => extractString(item.item || item.billableService)).join(', ') ?? '--', - })} -

-
-
- -

{convertToCurrency(totalAmount)}

-
- - - setWaiverAmount(event.target.value)} - /> - -
-
- -
-
-
- ); -}; - -export default BillWaiverForm; diff --git a/packages/esm-billing-app/src/billable-services/bill-waiver/bill-waiver-form.scss b/packages/esm-billing-app/src/billable-services/bill-waiver/bill-waiver-form.scss deleted file mode 100755 index 36742cb..0000000 --- a/packages/esm-billing-app/src/billable-services/bill-waiver/bill-waiver-form.scss +++ /dev/null @@ -1,34 +0,0 @@ -@use '@carbon/layout'; -@use '@carbon/type'; - -.billWaiverForm { - margin-top: layout.$spacing-05; - padding: 0 layout.$spacing-05; -} - -.buttonContainer { - display: flex; - justify-content: flex-end; - margin-top: -1rem; -} - -.formControlLayer { - padding: layout.$spacing-05 0; -} - -.billWaiverDescription { - display: grid; - grid-template-columns: 5rem 1fr; - column-gap: 1rem; - align-items: center; - margin-top: 0.125rem; - margin-bottom: 0.5rem; -} - -.label { - @include type.type-style('heading-compact-01'); -} - -.value { - @include type.type-style('body-01'); -} diff --git a/packages/esm-billing-app/src/billable-services/bill-waiver/bill-waiver.component.tsx b/packages/esm-billing-app/src/billable-services/bill-waiver/bill-waiver.component.tsx deleted file mode 100755 index ec8b2d1..0000000 --- a/packages/esm-billing-app/src/billable-services/bill-waiver/bill-waiver.component.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import React from 'react'; -import { ExtensionSlot, UserHasAccess } from '@openmrs/esm-framework'; -import PatientBills from './patient-bills.component'; -import styles from './bill-waiver.scss'; -import BillWaiverForm from './bill-waiver-form.component'; -import { useBills } from '../../billing.resource'; - -type BillWaiverProps = {}; - -const BillWaiver: React.FC = () => { - const [patientUuid, setPatientUuid] = React.useState(''); - const { bills } = useBills(patientUuid); - const filterBills = bills.filter((bill) => bill.status !== 'PAID' && patientUuid === bill.patientUuid) ?? []; - return ( - -
- setPatientUuid(patientUuid), - buttonProps: { - kind: 'primary', - }, - }} - /> - - -
-
- ); -}; - -export default BillWaiver; diff --git a/packages/esm-billing-app/src/billable-services/bill-waiver/bill-waiver.scss b/packages/esm-billing-app/src/billable-services/bill-waiver/bill-waiver.scss deleted file mode 100755 index f2e4a57..0000000 --- a/packages/esm-billing-app/src/billable-services/bill-waiver/bill-waiver.scss +++ /dev/null @@ -1,10 +0,0 @@ -@use '@carbon/layout'; - -.billWaiverContainer { - margin: layout.$layout-01; - row-gap: layout.$layout-01; -} - -.billListContainer { - background-color: white; -} diff --git a/packages/esm-billing-app/src/billable-services/bill-waiver/patient-bills.component.tsx b/packages/esm-billing-app/src/billable-services/bill-waiver/patient-bills.component.tsx deleted file mode 100755 index 93070d0..0000000 --- a/packages/esm-billing-app/src/billable-services/bill-waiver/patient-bills.component.tsx +++ /dev/null @@ -1,135 +0,0 @@ -import React from 'react'; -import { - Layer, - DataTable, - TableContainer, - Table, - TableHead, - TableRow, - TableExpandHeader, - TableHeader, - TableBody, - TableExpandRow, - TableCell, - TableExpandedRow, - Tile, -} from '@carbon/react'; -import { convertToCurrency, extractString } from '../../helpers'; -import { useTranslation } from 'react-i18next'; -import { EmptyDataIllustration } from '@openmrs/esm-patient-common-lib'; -import PatientBillsSelections from './bill-selection.component'; -import { type MappedBill } from '../../types'; -import styles from '../../bills-table/bills-table.scss'; - -type PatientBillsProps = { - patientUuid: string; - bills: Array; - setPatientUuid: (patientUuid: string) => void; -}; - -const PatientBills: React.FC = ({ patientUuid, bills, setPatientUuid }) => { - const { t } = useTranslation(); - - if (!patientUuid) { - return; - } - - const tableHeaders = [ - { header: 'Date', key: 'date' }, - { header: 'Billable Service', key: 'billableService' }, - { header: 'Total Amount', key: 'totalAmount' }, - ]; - - const tableRows = bills.map((bill) => ({ - id: `${bill.uuid}`, - date: bill.dateCreated, - billableService: extractString(bill.billingService), - totalAmount: convertToCurrency(bill.totalAmount), - })); - - if (bills.length === 0 && patientUuid !== '') { - return ( - <> -
- - -
- -
-

{t('noBillDisplay', 'There are no bills to display for this patient')}

-
-
-
- - ); - } - - return ( -
- ( - - - - - - {headers.map((header, i) => ( - - {header.header} - - ))} - - - - {rows.map((row, index) => ( - - - {row.cells.map((cell) => ( - {cell.value} - ))} - - -
- -
-
-
- ))} -
-
-
- )} - /> -
- ); -}; - -export default PatientBills; diff --git a/packages/esm-billing-app/src/billable-services/billable-service.resource.tsx b/packages/esm-billing-app/src/billable-services/billable-service.resource.tsx deleted file mode 100755 index c19a27f..0000000 --- a/packages/esm-billing-app/src/billable-services/billable-service.resource.tsx +++ /dev/null @@ -1,55 +0,0 @@ -import { type OpenmrsResource, openmrsFetch } from '@openmrs/esm-framework'; -import useSWR from 'swr'; -import { type ServiceConcept } from '../types'; - -type ResponseObject = { - results: Array; -}; - -type ServiceTypesResponse = { - setMembers: { uuid: string; display: string }[]; -}; - -export const useBillableServices = () => { - const url = `/ws/rest/v1/cashier/billableService?v=custom:(uuid,name,shortName,serviceStatus,serviceType:(display),servicePrices:(uuid,name,price))`; - const { data, isLoading, isValidating, error, mutate } = useSWR<{ data: ResponseObject }>(url, openmrsFetch, {}); - return { billableServices: data?.data.results ?? [], isLoading, isValidating, error, mutate }; -}; - -export function useServiceTypes() { - const url = `/ws/rest/v1/concept/d2ece9e9-3907-440d-b5c3-5d3b148594f5?v=custom:(setMembers:(uuid,display))`; - const { data, error, isLoading } = useSWR<{ data: ServiceTypesResponse }>(url, openmrsFetch, {}); - return { serviceTypes: data?.data.setMembers ?? [], error, isLoading }; -} - -export const usePaymentModes = () => { - const url = `/ws/rest/v1/cashier/paymentMode`; - const { data, error, isLoading } = useSWR<{ data: ResponseObject }>(url, openmrsFetch, {}); - return { paymentModes: data?.data.results ?? [], error, isLoading }; -}; - -export const createBillableService = (payload: any) => { - const url = `/ws/rest/v1/cashier/api/billable-service`; - return openmrsFetch(url, { - method: 'POST', - body: payload, - headers: { - 'Content-Type': 'application/json', - }, - }); -}; - -export function useConceptsSearch(conceptToLookup: string) { - const conditionsSearchUrl = `/ws/rest/v1/conceptsearch?q=${conceptToLookup}`; - - const { data, error, isLoading } = useSWR<{ data: { results: Array } }, Error>( - conceptToLookup ? conditionsSearchUrl : null, - openmrsFetch, - ); - - return { - searchResults: data?.data?.results ?? [], - error: error, - isSearching: isLoading, - }; -} diff --git a/packages/esm-billing-app/src/billable-services/billable-services-home.component.tsx b/packages/esm-billing-app/src/billable-services/billable-services-home.component.tsx deleted file mode 100755 index ee6c885..0000000 --- a/packages/esm-billing-app/src/billable-services/billable-services-home.component.tsx +++ /dev/null @@ -1,59 +0,0 @@ -import React from 'react'; -import { BrowserRouter, Routes, Route } from 'react-router-dom'; -import { useTranslation } from 'react-i18next'; -import { BillableServicesDashboard } from './dashboard/dashboard.component'; -import AddBillableService from './create-edit/add-billable-service.component'; -import { SideNav, SideNavItems, SideNavLink } from '@carbon/react'; -import styles from './billable-services.scss'; -import BillingHeader from '../billing-header/billing-header.component'; -import { Wallet, Money } from '@carbon/react/icons'; -import { UserHasAccess, navigate } from '@openmrs/esm-framework'; -import BillWaiver from './bill-waiver/bill-waiver.component'; -import BillingTariffs from './billing-tariffs/billing-tariffs.component'; -import AddTariffsService from './billing-tariffs/add-billings-tariffs-service.component'; -const basePath = `${window.spaBase}/billable-services`; -const BillableServiceHome: React.FC = () => { - const { t } = useTranslation(); - - const handleNavigation = (path: string) => { - navigate({ to: `${basePath}/${path}` }); - }; - - return ( - -
-
- - - handleNavigation('')} renderIcon={Wallet} isActive> - {t('billableServices', 'Billable Services')} - - - handleNavigation('waive-bill')} renderIcon={Money}> - {t('billWaiver', 'Bill Waiver')} - - - - handleNavigation('bill-tariffs')} renderIcon={Money}> - {t('billTariffs', 'Insurance Tariffs')} - - - - -
-
- - - } /> - } /> - } /> - } /> - } /> - -
-
-
- ); -}; - -export default BillableServiceHome; diff --git a/packages/esm-billing-app/src/billable-services/billable-services.component.tsx b/packages/esm-billing-app/src/billable-services/billable-services.component.tsx deleted file mode 100755 index c0c3bb2..0000000 --- a/packages/esm-billing-app/src/billable-services/billable-services.component.tsx +++ /dev/null @@ -1,255 +0,0 @@ -import React, { useCallback, useMemo, useState } from 'react'; -import classNames from 'classnames'; -import { - DataTable, - InlineLoading, - Layer, - Pagination, - Search, - Table, - TableBody, - TableCell, - TableContainer, - TableHead, - TableHeader, - TableRow, - Tile, - Button, -} from '@carbon/react'; -import { useLayoutType, isDesktop, useConfig, usePagination, ErrorState, navigate } from '@openmrs/esm-framework'; -import { EmptyState } from '@openmrs/esm-patient-common-lib'; -import styles from './billable-services.scss'; -import { useTranslation } from 'react-i18next'; -import { useBillableServices } from './billable-service.resource'; -import { ArrowRight } from '@carbon/react/icons'; - -const BillableServices = () => { - const { t } = useTranslation(); - const { billableServices, isLoading, isValidating, error, mutate } = useBillableServices(); - const layout = useLayoutType(); - const config = useConfig(); - const [searchString, setSearchString] = useState(''); - const responsiveSize = isDesktop(layout) ? 'lg' : 'sm'; - const pageSizes = config?.billableServices?.pageSizes ?? [10, 20, 30, 40, 50]; - const [pageSize, setPageSize] = useState(config?.billableServices?.pageSize ?? 10); - - //creating service state - const [showOverlay, setShowOverlay] = useState(false); - const [overlayHeader, setOverlayTitle] = useState(''); - - const headerData = [ - { - header: t('serviceName', 'Service Name'), - key: 'serviceName', - }, - { - header: t('shortName', 'Short Name'), - key: 'shortName', - }, - { - header: t('serviceType', 'Service Type'), - key: 'serviceType', - }, - { - header: t('status', 'Service Status'), - key: 'status', - }, - { - header: t('prices', 'Prices'), - key: 'prices', - }, - { - header: t('actions', 'Actions'), - key: 'actions', - }, - ]; - - const launchBillableServiceForm = useCallback(() => { - navigate({ to: window.getOpenmrsSpaBase() + 'billable-services/add-service' }); - }, []); - - const searchResults = useMemo(() => { - if (billableServices !== undefined && billableServices.length > 0) { - if (searchString && searchString.trim() !== '') { - const search = searchString.toLowerCase(); - return billableServices?.filter((service) => - Object.entries(service).some(([header, value]) => { - return header === 'uuid' ? false : `${value}`.toLowerCase().includes(search); - }), - ); - } - } - return billableServices; - }, [searchString, billableServices]); - - const { paginated, goTo, results, currentPage } = usePagination(searchResults, pageSize); - - let rowData = []; - if (results) { - results.forEach((service, index) => { - const s = { - id: `${index}`, - uuid: service.uuid, - serviceName: service.name, - shortName: service.shortName, - serviceType: service?.serviceType?.display, - status: service.serviceStatus, - prices: '--', - actions: '--', - }; - let cost = ''; - service.servicePrices.forEach((price) => { - cost += `${price.name} (${price.price}) `; - }); - s.prices = cost; - rowData.push(s); - }); - } - - const handleSearch = useCallback( - (e) => { - goTo(1); - setSearchString(e.target.value); - }, - [goTo, setSearchString], - ); - - if (isLoading) { - ; - } - if (error) { - ; - } - if (billableServices.length === 0) { - ; - } - - return ( - <> - {billableServices?.length > 0 ? ( -
- - 1 ? true : false}> - {({ rows, headers, getRowProps, getTableProps }) => ( - - - - - {headers.map((header) => ( - {header.header} - ))} - - - - {rows.map((row) => ( - - {row.cells.map((cell) => ( - {cell.value} - ))} - - ))} - -
-
- )} -
- {searchResults?.length === 0 && ( -
- - -

- {t('noMatchingServicesToDisplay', 'No matching services to display')} -

-

{t('checkFilters', 'Check the filters above')}

-
-
-
- )} - {paginated && ( - { - if (newPageSize !== pageSize) { - setPageSize(newPageSize); - } - if (newPage !== currentPage) { - goTo(newPage); - } - }} - /> - )} -
- ) : ( - - )} - - ); -}; - -function FilterableTableHeader({ layout, handleSearch, isValidating, responsiveSize, t }) { - return ( - <> -
-
-

{t('servicesList', 'Services list')}

-
-
- {isValidating ? : null} -
-
-
- - -
- - ); -} -export default BillableServices; diff --git a/packages/esm-billing-app/src/billable-services/billable-services.scss b/packages/esm-billing-app/src/billable-services/billable-services.scss deleted file mode 100755 index 2f2691f..0000000 --- a/packages/esm-billing-app/src/billable-services/billable-services.scss +++ /dev/null @@ -1,219 +0,0 @@ -@use '@carbon/layout'; -@use '@carbon/type'; -@use '@carbon/styles/scss/spacing'; -@import '~@openmrs/esm-styleguide/src/vars'; - -.container { - margin: 2rem 0; -} - -.emptyStateContainer, -.loaderContainer { - @extend .container; -} - -.serviceContainer { - background-color: $ui-02; - border: 1px solid $ui-03; - width: 100%; - margin: 0 auto; - max-width: 95vw; - padding-bottom: 0; - - :has(.filterEmptyState) { - border-bottom: none; - } -} -.left-justified-items { - display: flex; - flex-direction: row; - align-items: center; - cursor: pointer; - align-items: center; -} - -.filterContainer { - flex: 1; - - :global(.cds--dropdown__wrapper--inline) { - gap: 0; - } - - :global(.cds--list-box__menu-icon) { - height: 1rem; - } - - :global(.cds--list-box__menu) { - min-width: max-content; - } - - :global(.cds--list-box) { - margin-left: layout.$spacing-03; - } -} - -.menu { - margin-left: layout.$spacing-03; -} - -.headerContainer { - display: flex; - justify-content: space-between; - align-items: center; - padding: layout.$spacing-04 layout.$spacing-05; - background-color: $ui-02; -} - -.backgroundDataFetchingIndicator { - align-items: center; - display: flex; - flex: 1; - justify-content: space-between; - - &:global(.cds--inline-loading) { - max-height: 1rem; - } -} - -.tableContainer section { - position: relative; -} - -.tableContainer a { - text-decoration: none; -} - -.pagination { - overflow: hidden; - - &:global(.cds--pagination) { - border-top: none; - } -} - -.hiddenRow { - display: none; -} - -.emptyRow { - padding: 0 1rem; - display: flex; - align-items: center; -} - -.visitSummaryContainer { - width: 100%; - max-width: 768px; - margin: 1rem auto; -} - -.expandedActiveVisitRow > td > div { - max-height: max-content !important; -} - -.expandedActiveVisitRow td { - padding: 0 2rem; -} - -.expandedActiveVisitRow th[colspan] td[colspan] > div:first-child { - padding: 0 1rem; -} - -.action { - margin-bottom: layout.$spacing-03; -} - -.illo { - margin-top: layout.$spacing-05; -} - -.content { - @include type.type-style('heading-compact-01'); - color: $text-02; - margin-top: layout.$spacing-05; - margin-bottom: layout.$spacing-03; -} - -.desktopHeading, -.tabletHeading { - text-align: left; - text-transform: capitalize; - flex: 1; - - h4 { - @include type.type-style('heading-compact-02'); - color: $text-02; - - &:after { - content: ''; - display: block; - width: 2rem; - padding-top: 3px; - border-bottom: 0.375rem solid; - @include brand-03(border-bottom-color); - } - } -} - -.tile { - text-align: center; - border: 1px solid $ui-03; -} - -.menuitem { - max-width: none; -} - -.filterEmptyState { - display: flex; - justify-content: center; - align-items: center; - padding: layout.$spacing-05; - margin: layout.$spacing-09; - text-align: center; -} - -.filterEmptyStateTile { - margin: auto; -} - -.filterEmptyStateContent { - @include type.type-style('heading-compact-02'); - color: $text-02; - margin-bottom: 0.5rem; -} - -.filterEmptyStateHelper { - @include type.type-style('body-compact-01'); - color: $text-02; -} - -.metricsContainer { - display: flex; - justify-content: space-between; - background-color: $ui-02; - height: spacing.$spacing-10; - align-items: center; - padding: 0 spacing.$spacing-05; -} - -.metricsTitle { - @include type.type-style('heading-03'); - color: $ui-05; -} - -.actionsContainer { - display: flex; - justify-content: space-between; - align-items: center; - background-color: $ui-02; -} -.actionBtn { - display: flex; - column-gap: 0.5rem; -} - -.mainSection { - display: grid; - grid-template-columns: 16rem 1fr; -} diff --git a/packages/esm-billing-app/src/billable-services/billiable-item/drug-order/drug-order.component.tsx b/packages/esm-billing-app/src/billable-services/billiable-item/drug-order/drug-order.component.tsx deleted file mode 100755 index 66cd0c6..0000000 --- a/packages/esm-billing-app/src/billable-services/billiable-item/drug-order/drug-order.component.tsx +++ /dev/null @@ -1,64 +0,0 @@ -import React from 'react'; -import { type Drug } from '@openmrs/esm-patient-common-lib'; -import { type DosingUnit, type MedicationFrequency, type MedicationRoute, type QuantityUnit } from '../../../types'; -import { useBillableItem, useSockItemInventory } from '../useBillableItem'; -import { useTranslation } from 'react-i18next'; -import styles from './drug-order.scss'; -import { convertToCurrency } from '../../../helpers'; - -type DrugOrderProps = { - order: { - drug: Drug; - unit: DosingUnit; - commonMedicationName: string; - dosage: number; - frequency: MedicationFrequency; - route: MedicationRoute; - quantityUnits: QuantityUnit; - patientInstructions: string; - asNeeded: boolean; - asNeededCondition: string; - }; -}; - -const DrugOrder: React.FC = ({ order }) => { - const { t } = useTranslation(); - const { stockItem, isLoading: isLoadingInventory } = useSockItemInventory(order?.drug?.uuid); - const { billableItem, isLoading } = useBillableItem(order?.drug.concept.uuid); - if (isLoading || isLoadingInventory) { - return null; - } - - return ( -
- {stockItem && stockItem.length > 0 ? ( - <> -
{'In Stock'}
- {stockItem.map((item, index) => ( -
- {item.partyName} - - {' '} - {Math.round(item.quantity)} {item.quantityUoM}(s){' '} - -
- ))} - - ) : ( -
{'Drug Is Not Available / Out of Stock'}
- )} - -
- {billableItem && - billableItem?.servicePrices.map((item) => ( -
- {t('unitPrice', 'Unit price ')} - {convertToCurrency(item.price)} -
- ))} -
-
- ); -}; - -export default DrugOrder; diff --git a/packages/esm-billing-app/src/billable-services/billiable-item/drug-order/drug-order.scss b/packages/esm-billing-app/src/billable-services/billiable-item/drug-order/drug-order.scss deleted file mode 100755 index d969ad7..0000000 --- a/packages/esm-billing-app/src/billable-services/billiable-item/drug-order/drug-order.scss +++ /dev/null @@ -1,31 +0,0 @@ -@use '@carbon/type'; -@use '@carbon/colors'; -@use '@carbon/layout'; -@use '@carbon/styles/scss/spacing'; - -.drugOrderContainer { - margin: spacing.$spacing-03 0; - - & > div { - margin: spacing.$spacing-03 0; - } -} - -.bold { - font-weight: bold; -} - -.itemInfo { - @include type.type-style('body-01'); -} - -.itemContainer { - display: grid; - grid-template-columns: 1fr 1fr; - padding-left: spacing.$spacing-03; -} - -.red { - color: red; - font-weight: normal; -} diff --git a/packages/esm-billing-app/src/billable-services/billiable-item/test-order/imaging-order.component.tsx b/packages/esm-billing-app/src/billable-services/billiable-item/test-order/imaging-order.component.tsx deleted file mode 100755 index 1cb5534..0000000 --- a/packages/esm-billing-app/src/billable-services/billiable-item/test-order/imaging-order.component.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import React from 'react'; -import { useBillableItem } from '../useBillableItem'; -import { useTranslation } from 'react-i18next'; -import { InlineLoading } from '@carbon/react'; -import PriceInfoOrder from './price-info-order.componet'; - -type ImagingOrderProps = { - order: { - testType?: { - label: string; - conceptUuid: string; - }; - }; -}; - -const ImagingOrder: React.FC = ({ order }) => { - const { t } = useTranslation(); - const { billableItem, isLoading, error } = useBillableItem(order?.testType?.conceptUuid); - - if (isLoading) { - return ( - - ); - } - - return ; -}; - -export default ImagingOrder; diff --git a/packages/esm-billing-app/src/billable-services/billiable-item/test-order/lab-order.component.tsx b/packages/esm-billing-app/src/billable-services/billiable-item/test-order/lab-order.component.tsx deleted file mode 100755 index 4a0003b..0000000 --- a/packages/esm-billing-app/src/billable-services/billiable-item/test-order/lab-order.component.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import React from 'react'; -import { useBillableItem } from '../useBillableItem'; -import { useTranslation } from 'react-i18next'; -import { InlineLoading } from '@carbon/react'; -import PriceInfoOrder from './price-info-order.componet'; - -type LabOrderProps = { - order: { - testType?: { - label: string; - conceptUuid: string; - }; - }; -}; - -const LabOrder: React.FC = ({ order }) => { - const { t } = useTranslation(); - const { billableItem, isLoading, error } = useBillableItem(order?.testType?.conceptUuid); - - if (isLoading) { - return ( - - ); - } - - return ; -}; - -export default LabOrder; diff --git a/packages/esm-billing-app/src/billable-services/billiable-item/test-order/price-info-order.componet.tsx b/packages/esm-billing-app/src/billable-services/billiable-item/test-order/price-info-order.componet.tsx deleted file mode 100755 index 658cc99..0000000 --- a/packages/esm-billing-app/src/billable-services/billiable-item/test-order/price-info-order.componet.tsx +++ /dev/null @@ -1,62 +0,0 @@ -import React from 'react'; -import { convertToCurrency } from '../../../helpers'; -import { useTranslation } from 'react-i18next'; -import styles from './price-info-order.scss'; -import { - StructuredListWrapper, - StructuredListHead, - StructuredListRow, - StructuredListCell, - StructuredListBody, - Tile, - InlineNotification, -} from '@carbon/react'; - -type PriceInfoOrderProps = { - billableItem: any; - error?: boolean; -}; - -const PriceInfoOrder: React.FC = ({ billableItem, error }) => { - const { t } = useTranslation(); - - if (error || !billableItem) { - return ( - - ); - } - - return ( - -
- - - - - {t('paymentMethods', 'Payment methods')} - - - {t('prices', 'Prices(Ksh)')} - - - - - {billableItem.servicePrices.map((priceItem) => ( - - {priceItem.paymentMode.name} - {convertToCurrency(priceItem.price)} - - ))} - - -
-
- ); -}; - -export default PriceInfoOrder; diff --git a/packages/esm-billing-app/src/billable-services/billiable-item/test-order/price-info-order.scss b/packages/esm-billing-app/src/billable-services/billiable-item/test-order/price-info-order.scss deleted file mode 100755 index 00a745b..0000000 --- a/packages/esm-billing-app/src/billable-services/billiable-item/test-order/price-info-order.scss +++ /dev/null @@ -1,20 +0,0 @@ -@use '@carbon/styles/scss/type'; -@use '@carbon/styles/scss/spacing'; -@use '@carbon/layout'; -@use '@carbon/colors'; - -.prices { - justify-content: center; - align-items: center; - margin: layout.$spacing-03; -} - -.listContainer { - display: flex; - flex-direction: column; - align-items: center; -} - -.cell { - padding: spacing.$spacing-05; -} diff --git a/packages/esm-billing-app/src/billable-services/billiable-item/test-order/procedure-order.component.tsx b/packages/esm-billing-app/src/billable-services/billiable-item/test-order/procedure-order.component.tsx deleted file mode 100755 index 92291e0..0000000 --- a/packages/esm-billing-app/src/billable-services/billiable-item/test-order/procedure-order.component.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import React from 'react'; -import { useBillableItem } from '../useBillableItem'; -import { useTranslation } from 'react-i18next'; -import { InlineLoading } from '@carbon/react'; -import PriceInfoOrder from './price-info-order.componet'; - -type ProcedureOrderProps = { - order: { - testType?: { - label: string; - conceptUuid: string; - }; - }; -}; - -const ProcedureOrder: React.FC = ({ order }) => { - const { t } = useTranslation(); - const { billableItem, isLoading, error } = useBillableItem(order?.testType?.conceptUuid); - - if (isLoading) { - return ( - - ); - } - - return ; -}; - -export default ProcedureOrder; diff --git a/packages/esm-billing-app/src/billable-services/billiable-item/test-order/test-order-action.component.tsx b/packages/esm-billing-app/src/billable-services/billiable-item/test-order/test-order-action.component.tsx deleted file mode 100755 index 1e8b4ee..0000000 --- a/packages/esm-billing-app/src/billable-services/billiable-item/test-order/test-order-action.component.tsx +++ /dev/null @@ -1,50 +0,0 @@ -import { OverflowMenuItem } from '@carbon/react'; -import { type Order } from '@openmrs/esm-patient-common-lib'; -import React, { useCallback } from 'react'; -import { useTranslation } from 'react-i18next'; -import { useTestOrderBillStatus } from './test-order-action.resource'; -import { showModal } from '@openmrs/esm-framework'; - -type TestOrderProps = { order: Order }; - -enum FulfillerStatus { - IN_PROGRESS = 'IN_PROGRESS', -} - -const TestOrderAction: React.FC = ({ order }) => { - const { t } = useTranslation(); - const { isLoading, hasPendingPayment } = useTestOrderBillStatus(order.uuid, order.patient.uuid); - - const launchModal = useCallback(() => { - const dispose = showModal('pickup-lab-request-modal', { - closeModal: () => dispose(), - order, - }); - }, [order]); - - // Show the test order if the following conditions are met: - // 1. The current visit is in-patient - // 2. The test order has been paid in full - // 3. The patient is an emergency patient - - // If the order is in progress, do not show the action - if (order.fulfillerStatus === FulfillerStatus.IN_PROGRESS) { - return null; - } - - if (isLoading) { - return ; - } - - return ( - - ); -}; - -export default TestOrderAction; diff --git a/packages/esm-billing-app/src/billable-services/billiable-item/test-order/test-order-action.resource.tsx b/packages/esm-billing-app/src/billable-services/billiable-item/test-order/test-order-action.resource.tsx deleted file mode 100755 index 7a23f55..0000000 --- a/packages/esm-billing-app/src/billable-services/billiable-item/test-order/test-order-action.resource.tsx +++ /dev/null @@ -1,54 +0,0 @@ -import { openmrsFetch, restBaseUrl, useConfig, useVisit } from '@openmrs/esm-framework'; -import useSWR from 'swr'; -import { type LineItem, type QueueEntry } from '../../../types'; -import { type BillingConfig } from '../../../config-schema'; - -export const useTestOrderBillStatus = (orderUuid: string, patientUuid: string) => { - const config = useConfig(); - const { currentVisit } = useVisit(patientUuid); - const { isEmergencyPatient, isLoading: isLoadingQueue } = usePatientQueue(patientUuid); - const { isLoading: isLoadingBill, hasPendingPayment } = usePatientBill(orderUuid); - - if (isLoadingQueue || isLoadingBill) { - return { hasPendingPayment: false, isLoading: true }; - } - - // If current visit type is inpatient or the patient is in the emergency queue, we should allow the patient to receive services without paying the bill - if (currentVisit?.visitType?.uuid === config?.inPatientVisitTypeUuid || isEmergencyPatient) { - return { hasPendingPayment: false, isLoading: false }; - } - - // If the patient is not in the queue then we should check if the patient has a pending bill - return { hasPendingPayment, isLoading: false }; -}; - -export const usePatientQueue = (patientUuid: string) => { - const config = useConfig({ externalModuleName: '@ampath/esm-service-queues-app' }); - const url = `${restBaseUrl}/visit-queue-entry?patient=${patientUuid}`; - const { data, isLoading, error } = useSWR<{ - data: { results: Array }; - }>(url, openmrsFetch); - - const isEmergencyPatient = - data?.data?.results?.[0]?.queueEntry?.priority?.uuid === config?.concepts?.emergencyPriorityConceptUuid; - const isInQueue = data?.data?.results?.length > 0; - return { isInQueue, isLoading, error, isEmergencyPatient }; -}; - -export const usePatientBill = (orderUuid: string) => { - const { billingStatusQueryUrl } = useConfig(); - const billUrl = createUrl(restBaseUrl, orderUuid, billingStatusQueryUrl); - const { data, isLoading, error } = useSWR<{ - data: { results: Array }; - }>(billUrl, openmrsFetch); - - const hasPendingPayment = data?.data?.results?.some( - (lineItem) => lineItem.paymentStatus === 'PENDING' || lineItem.paymentStatus === 'POSTED', - ); - - return { hasPendingPayment, isLoading, error }; -}; - -function createUrl(restBaseUrl: string, orderUuid: string, templateUrl: string): string { - return templateUrl.replace('${restBaseUrl}', restBaseUrl).replace('${orderUuid}', orderUuid); -} diff --git a/packages/esm-billing-app/src/billable-services/billiable-item/useBillableItem.tsx b/packages/esm-billing-app/src/billable-services/billiable-item/useBillableItem.tsx deleted file mode 100755 index 44eaa26..0000000 --- a/packages/esm-billing-app/src/billable-services/billiable-item/useBillableItem.tsx +++ /dev/null @@ -1,49 +0,0 @@ -import useSWRImmutable from 'swr/immutable'; -import { openmrsFetch, restBaseUrl } from '@openmrs/esm-framework'; -import useSWR from 'swr'; -import first from 'lodash-es/first'; - -type BillableItemResponse = { - uuid: string; - name: string; - concept: { - uuid: string; - display: string; - }; - servicePrices: Array<{ - uuid: string; - price: number; - paymentMode: { - uuid: string; - name: string; - }; - }>; -}; - -export const useBillableItem = (billableItemId: string) => { - const customRepresentation = `v=custom:(uuid,name,concept:(uuid,display),servicePrices:(uuid,price,paymentMode:(uuid,name)))`; - const { data, error, isLoading } = useSWRImmutable<{ data: { results: Array } }>( - `${restBaseUrl}/cashier/billableService?${customRepresentation}`, - openmrsFetch, - ); - const billableItem = data?.data?.results?.find((item) => item?.concept?.uuid === billableItemId); - - return { - billableItem: billableItem, - isLoading: isLoading, - error, - }; -}; - -export const useSockItemInventory = (stockItemId: string) => { - const url = `/ws/rest/v1/stockmanagement/stockiteminventory?v=default&limit=10&totalCount=true&drugUuid=${stockItemId}`; - const { data, error, isLoading } = useSWR<{ - data: { results: Array<{ quantityUoM: string; quantity: number; partyName: string }> }; - }>(url, openmrsFetch); - - return { - stockItem: (data?.data?.results as Array) ?? [], - isLoading: isLoading, - error, - }; -}; diff --git a/packages/esm-billing-app/src/billable-services/billing-tariffs/add-billing-tariffs-service.scss b/packages/esm-billing-app/src/billable-services/billing-tariffs/add-billing-tariffs-service.scss deleted file mode 100755 index 5c52a1c..0000000 --- a/packages/esm-billing-app/src/billable-services/billing-tariffs/add-billing-tariffs-service.scss +++ /dev/null @@ -1,164 +0,0 @@ -@use '@carbon/styles/scss/spacing'; -@use '@carbon/styles/scss/type'; -@use '@carbon/colors'; -@use '@carbon/layout'; -@import '~@openmrs/esm-styleguide/src/vars'; - -.form { - display: flex; - flex-direction: column; - justify-content: space-between; - height: 100%; - padding: spacing.$spacing-06; -} - -.subTitle { - font-weight: 600; - font-size: 14px; -} - -.sectionTitle { - @include type.type-style('heading-compact-02'); - color: $text-02; - margin-bottom: spacing.$spacing-04; -} - -.modalBody { - padding-bottom: spacing.$spacing-05; -} - -.container { - margin: 1rem; -} - -.paymentContainer { - margin: layout.$layout-01; - padding: layout.$layout-01; - width: 70%; - border-right: 1px solid colors.$cool-gray-40; -} - -.paymentButtons { - margin: layout.$layout-01 0; -} - -.paymentMethodContainer { - display: grid; - grid-template-columns: repeat(4, minmax(auto, 1fr)); - column-gap: 1rem; - margin: 0.625rem 0; - width: 100%; -} - -.paymentTotals { - margin-top: layout.$spacing-01; -} - -.processPayments { - display: flex; - justify-content: flex-end; - margin: layout.$spacing-05; - column-gap: layout.$spacing-04; -} - -.errorPaymentContainer { - margin: layout.$spacing-04; - min-height: layout.$spacing-09; -} - -.removeButtonContainer { - display: flex; - align-self: center; - cursor: pointer; - margin-left: layout.$spacing-07; -} - -.removeButton { - color: colors.$red-60; -} - -.service { - padding: 1rem 0.75rem; -} - -.conceptsList { - background-color: $ui-02; - max-height: 14rem; - overflow-y: auto; - border: 1px solid $ui-03; - - li:hover { - background-color: $ui-03; - } -} - -.emptyResults { - @include type.type-style('body-compact-01'); - color: $text-02; - min-height: 1rem; - border: 1px solid $ui-03; -} - -.conceptLabel { - @include type.type-style('label-02'); - margin-bottom: 0.6rem; -} - -.errorContainer { - margin: 1rem; -} - -.serviceError { - :global(.cds--search-input):focus { - outline: 2.5px solid $danger; - } - - :global(.cds--search-magnifier) { - svg { - fill: $danger; - } - } -} - -.errorMessage { - @include type.type-style('label-02'); - color: $danger; - margin-top: 0.5rem; -} - -.spinner { - &:global(.cds--inline-loading) { - min-height: 1rem; - } -} - -.loader { - margin-top: 1rem; - margin-bottom: 1rem; - margin-left: auto; - margin-right: auto; - width: max-content; -} - -.searchWrapper { - display: flex; - flex-direction: column; - align-items: center; - justify-items: center; -} - -.nameSection { - display: flex; - gap: 20px; - align-items: flex-start; -} - -.secondSection { - display: flex; - gap: 20px; - align-items: flex-start; -} - -.serviceName { - width: 50%; -} diff --git a/packages/esm-billing-app/src/billable-services/billing-tariffs/add-billings-tariffs-service.component.tsx b/packages/esm-billing-app/src/billable-services/billing-tariffs/add-billings-tariffs-service.component.tsx deleted file mode 100755 index 9379553..0000000 --- a/packages/esm-billing-app/src/billable-services/billing-tariffs/add-billings-tariffs-service.component.tsx +++ /dev/null @@ -1,183 +0,0 @@ -import React, { useCallback, useRef, useState } from 'react'; -import styles from './add-billing-tariffs-service.scss'; -import { - Form, - Button, - TextInput, - ComboBox, - Dropdown, - Layer, - InlineLoading, - Search, - Tile, - FormLabel, - NumberInput, -} from '@carbon/react'; -import { useTranslation } from 'react-i18next'; -import { - createBillableService, - useConceptsSearch, - usePaymentModes, - useServiceTypes, -} from '../billable-service.resource'; -import { Controller, useFieldArray, useForm } from 'react-hook-form'; -import { Add, TrashCan, WarningFilled } from '@carbon/react/icons'; -import { z } from 'zod'; -import { zodResolver } from '@hookform/resolvers/zod'; -import { navigate, showSnackbar, useDebounce, useLayoutType } from '@openmrs/esm-framework'; -import { type ServiceConcept } from '../../types'; -import { extractErrorMessagesFromResponse } from '../../utils'; - -const servicePriceSchema = z.object({ - paymentMode: z.string({ required_error: 'Payment method is required' }), - price: z - .string() - .refine((value) => !isNaN(Number(value)), 'Value must be a number') - .refine((value) => parseInt(value) > 0, 'Price should be a number more than zero') - .refine((value) => !!value, 'Price is required'), -}); - -const paymentFormSchema = z.object({ - payment: z.array(servicePriceSchema).min(1, 'At least one payment method is required'), - serviceName: z.string({ - required_error: 'Service name is required', - }), - shortName: z.string({ required_error: 'A valid short name is required.' }), - serviceTypeName: z.string({ required_error: 'A service type is required' }), - concept: z.string({ required_error: 'Concept search is required.' }), -}); - -type FormData = z.infer; -const DEFAULT_PAYMENT_OPTION = { paymentMode: '', price: '1' }; - -const AddTariffsService: React.FC = () => { - const { t } = useTranslation(); - - const { paymentModes, isLoading: isLoadingPaymentModes } = usePaymentModes(); - const { serviceTypes, isLoading: isLoadingServicesTypes } = useServiceTypes(); - - const { - control, - handleSubmit, - formState: { errors, isValid }, - } = useForm({ - mode: 'all', - defaultValues: {}, - resolver: zodResolver(paymentFormSchema), - }); - - const { fields, remove, append } = useFieldArray({ name: 'payment', control: control }); - - const handleAppendPaymentMode = useCallback(() => append(DEFAULT_PAYMENT_OPTION), [append]); - const handleRemovePaymentMode = useCallback((index) => remove(index), [remove]); - - const isTablet = useLayoutType() === 'tablet'; - const searchInputRef = useRef(null); - const handleSearchTermChange = (event: React.ChangeEvent) => setSearchTerm(event.target.value); - - const [selectedConcept, setSelectedConcept] = useState(null); - const [searchTerm, setSearchTerm] = useState(''); - const debouncedSearchTerm = useDebounce(searchTerm); - const { searchResults, isSearching } = useConceptsSearch(debouncedSearchTerm); - - const handleConceptChange = useCallback((selectedConcept: ServiceConcept) => { - setSelectedConcept(selectedConcept); - }, []); - - const handleNavigateToServiceDashboard = () => - navigate({ - to: window.getOpenmrsSpaBase() + 'billable-services', - }); - - const onSubmit = (data: FormData) => { - const payload: any = {}; - - let servicePrices = data.payment.map((element) => { - return { - name: paymentModes.filter((p) => p.uuid === element.paymentMode)[0].name, - price: element.price, - paymentMode: element.paymentMode, - }; - }); - - payload.name = data.serviceName; - payload.shortName = data.shortName; - payload.serviceType = data.serviceTypeName; - payload.servicePrices = servicePrices; - payload.serviceStatus = 'ENABLED'; - payload.concept = selectedConcept?.concept?.uuid; - - createBillableService(payload).then( - (resp) => { - showSnackbar({ - title: t('billableService', 'Billable service'), - subtitle: 'Billable service created successfully', - kind: 'success', - isLowContrast: true, - timeoutInMs: 3000, - }); - handleNavigateToServiceDashboard(); - }, - (error) => { - showSnackbar({ - title: 'Error adding billable service', - kind: 'error', - subtitle: extractErrorMessagesFromResponse(error.responseBody), - isLowContrast: true, - }); - }, - ); - }; - - if (isLoadingServicesTypes || isLoadingPaymentModes) { - return ( -
- -
- ); - } - - return ( -
-

{t('addTariffsServices', 'Add Insurance Tariffs')}

- -
-
- ( - (item ? item.display : '')} - placeholder="Select service type" - required - {...field} - onChange={({ selectedItem }) => field.onChange(selectedItem ? selectedItem.display : '')} - invalidText={errors.serviceTypeName?.message || ''} - invalid={!!errors.serviceTypeName} - /> - )} - /> -
-
- -
- - -
-
- ); -}; - -function ResponsiveWrapper({ children, isTablet }: { children: React.ReactNode; isTablet: boolean }) { - return isTablet ? {children} : <>{children}; -} - -export default AddTariffsService; diff --git a/packages/esm-billing-app/src/billable-services/billing-tariffs/billing-tariffs-admin-card.tsx b/packages/esm-billing-app/src/billable-services/billing-tariffs/billing-tariffs-admin-card.tsx deleted file mode 100644 index e69de29..0000000 diff --git a/packages/esm-billing-app/src/billable-services/billing-tariffs/billing-tariffs-services.scss b/packages/esm-billing-app/src/billable-services/billing-tariffs/billing-tariffs-services.scss deleted file mode 100755 index 2f2691f..0000000 --- a/packages/esm-billing-app/src/billable-services/billing-tariffs/billing-tariffs-services.scss +++ /dev/null @@ -1,219 +0,0 @@ -@use '@carbon/layout'; -@use '@carbon/type'; -@use '@carbon/styles/scss/spacing'; -@import '~@openmrs/esm-styleguide/src/vars'; - -.container { - margin: 2rem 0; -} - -.emptyStateContainer, -.loaderContainer { - @extend .container; -} - -.serviceContainer { - background-color: $ui-02; - border: 1px solid $ui-03; - width: 100%; - margin: 0 auto; - max-width: 95vw; - padding-bottom: 0; - - :has(.filterEmptyState) { - border-bottom: none; - } -} -.left-justified-items { - display: flex; - flex-direction: row; - align-items: center; - cursor: pointer; - align-items: center; -} - -.filterContainer { - flex: 1; - - :global(.cds--dropdown__wrapper--inline) { - gap: 0; - } - - :global(.cds--list-box__menu-icon) { - height: 1rem; - } - - :global(.cds--list-box__menu) { - min-width: max-content; - } - - :global(.cds--list-box) { - margin-left: layout.$spacing-03; - } -} - -.menu { - margin-left: layout.$spacing-03; -} - -.headerContainer { - display: flex; - justify-content: space-between; - align-items: center; - padding: layout.$spacing-04 layout.$spacing-05; - background-color: $ui-02; -} - -.backgroundDataFetchingIndicator { - align-items: center; - display: flex; - flex: 1; - justify-content: space-between; - - &:global(.cds--inline-loading) { - max-height: 1rem; - } -} - -.tableContainer section { - position: relative; -} - -.tableContainer a { - text-decoration: none; -} - -.pagination { - overflow: hidden; - - &:global(.cds--pagination) { - border-top: none; - } -} - -.hiddenRow { - display: none; -} - -.emptyRow { - padding: 0 1rem; - display: flex; - align-items: center; -} - -.visitSummaryContainer { - width: 100%; - max-width: 768px; - margin: 1rem auto; -} - -.expandedActiveVisitRow > td > div { - max-height: max-content !important; -} - -.expandedActiveVisitRow td { - padding: 0 2rem; -} - -.expandedActiveVisitRow th[colspan] td[colspan] > div:first-child { - padding: 0 1rem; -} - -.action { - margin-bottom: layout.$spacing-03; -} - -.illo { - margin-top: layout.$spacing-05; -} - -.content { - @include type.type-style('heading-compact-01'); - color: $text-02; - margin-top: layout.$spacing-05; - margin-bottom: layout.$spacing-03; -} - -.desktopHeading, -.tabletHeading { - text-align: left; - text-transform: capitalize; - flex: 1; - - h4 { - @include type.type-style('heading-compact-02'); - color: $text-02; - - &:after { - content: ''; - display: block; - width: 2rem; - padding-top: 3px; - border-bottom: 0.375rem solid; - @include brand-03(border-bottom-color); - } - } -} - -.tile { - text-align: center; - border: 1px solid $ui-03; -} - -.menuitem { - max-width: none; -} - -.filterEmptyState { - display: flex; - justify-content: center; - align-items: center; - padding: layout.$spacing-05; - margin: layout.$spacing-09; - text-align: center; -} - -.filterEmptyStateTile { - margin: auto; -} - -.filterEmptyStateContent { - @include type.type-style('heading-compact-02'); - color: $text-02; - margin-bottom: 0.5rem; -} - -.filterEmptyStateHelper { - @include type.type-style('body-compact-01'); - color: $text-02; -} - -.metricsContainer { - display: flex; - justify-content: space-between; - background-color: $ui-02; - height: spacing.$spacing-10; - align-items: center; - padding: 0 spacing.$spacing-05; -} - -.metricsTitle { - @include type.type-style('heading-03'); - color: $ui-05; -} - -.actionsContainer { - display: flex; - justify-content: space-between; - align-items: center; - background-color: $ui-02; -} -.actionBtn { - display: flex; - column-gap: 0.5rem; -} - -.mainSection { - display: grid; - grid-template-columns: 16rem 1fr; -} diff --git a/packages/esm-billing-app/src/billable-services/billing-tariffs/billing-tariffs.component.tsx b/packages/esm-billing-app/src/billable-services/billing-tariffs/billing-tariffs.component.tsx deleted file mode 100755 index e1923f9..0000000 --- a/packages/esm-billing-app/src/billable-services/billing-tariffs/billing-tariffs.component.tsx +++ /dev/null @@ -1,286 +0,0 @@ -import React, { useCallback, useMemo, useState } from 'react'; -import classNames from 'classnames'; -import { - DataTable, - InlineLoading, - Layer, - Pagination, - Search, - Table, - TableBody, - TableCell, - TableContainer, - TableHead, - TableHeader, - TableRow, - Tile, - Button, -} from '@carbon/react'; -import { useLayoutType, isDesktop, useConfig, usePagination, ErrorState, navigate } from '@openmrs/esm-framework'; -import { EmptyState } from '@openmrs/esm-patient-common-lib'; -import styles from './billing-tariffs-services.scss'; -import { useTranslation } from 'react-i18next'; -import { useBillableServices } from './billing-tariffs.resource'; -import { ArrowRight, RadioButton } from '@carbon/react/icons'; -import { RadioButtonGroup } from '@carbon/react'; -import { OverflowMenu, OverflowMenuItem } from '@carbon/react'; - -const BillingTariffs = () => { - const { t } = useTranslation(); - const { billableServices, isLoading, isValidating, error, mutate } = useBillableServices(); - const layout = useLayoutType(); - const config = useConfig(); - const [searchString, setSearchString] = useState(''); - const responsiveSize = isDesktop(layout) ? 'lg' : 'sm'; - const pageSizes = config?.billableServices?.pageSizes ?? [10, 20, 30, 40, 50]; - const [pageSize, setPageSize] = useState(config?.billableServices?.pageSize ?? 10); - - //creating service state - const [showOverlay, setShowOverlay] = useState(false); - const [overlayHeader, setOverlayTitle] = useState(''); - const [category, setCategory] = useState(''); - - const toggleSearch = (choiceSelected) => { - (document.getElementById('searchField') as HTMLInputElement).disabled = false; - - if (choiceSelected == 'Stock Item') { - setCategory('Stock Item'); - } else { - setCategory('Service'); - } - }; - - const headerData = [ - { - header: t('serviceName', 'Service Name'), - key: 'serviceName', - }, - { - header: t('shortName', 'Short Name'), - key: 'shortName', - }, - { - header: t('serviceType', 'Service Type'), - key: 'serviceType', - }, - { - header: t('status', 'Service Status'), - key: 'status', - }, - { - header: t('prices', 'Prices'), - key: 'prices', - }, - { - header: t('tariffs', 'Tariffs'), - key: 'tariffs', - }, - { - header: t('actions', 'Actions'), - key: 'actions', - }, - ]; - - const launchBillableServiceForm = useCallback(() => { - navigate({ to: window.getOpenmrsSpaBase() + 'billable-services/add-service' }); - }, []); - - const searchResults = useMemo(() => { - if (billableServices !== undefined && billableServices.length > 0) { - if (searchString && searchString.trim() !== '') { - const search = searchString.toLowerCase(); - return billableServices?.filter((service) => - Object.entries(service).some(([header, value]) => { - return header === 'uuid' ? false : `${value}`.toLowerCase().includes(search); - }), - ); - } - } - return billableServices; - }, [searchString, billableServices]); - - const { paginated, goTo, results, currentPage } = usePagination(searchResults, pageSize); - - let rowData = []; - if (results) { - results.forEach((service, index) => { - const s = { - id: `${index}`, - uuid: service.uuid, - serviceName: service.name, - shortName: service.shortName, - serviceType: service?.serviceType?.display, - status: service.serviceStatus, - prices: '--', - tariffs: 'T1, T2, T3', - actions: ( - - - - - ), - }; - let cost = ''; - service.servicePrices.forEach((price) => { - cost += `${price.name} (${price.price}) `; - }); - s.prices = cost; - rowData.push(s); - }); - } - - const handleSearch = useCallback( - (e) => { - goTo(1); - setSearchString(e.target.value); - }, - [goTo, setSearchString], - ); - - if (isLoading) { - ; - } - if (error) { - ; - } - if (billableServices.length === 0) { - ; - } - - function filterItems(value: any) { - throw new Error('Function not implemented.'); - } - - return ( - <> - {billableServices?.length > 0 ? ( -
- - - - - -
- 1 ? true : false}> - {({ rows, headers, getRowProps, getTableProps }) => ( - - - - - {headers.map((header) => ( - {header.header} - ))} - - - - {rows.map((row) => ( - - {row.cells.map((cell) => ( - {cell.value} - ))} - - ))} - -
-
- )} -
- {searchResults?.length === 0 && ( -
- - -

- {t('noMatchingServicesToDisplay', 'No matching services to display')} -

-

{t('checkFilters', 'Check the filters above')}

-
-
-
- )} - {paginated && ( - { - if (newPageSize !== pageSize) { - setPageSize(newPageSize); - } - if (newPage !== currentPage) { - goTo(newPage); - } - }} - /> - )} -
- ) : ( - - )} - - ); -}; - -function FilterableTableHeader({ layout, handleSearch, isValidating, responsiveSize, t }) { - return ( - <> -
-
-

{t('servicesList', 'Services list')}

-
-
- {isValidating ? : null} -
-
-
- - -
- - ); -} -export default BillingTariffs; diff --git a/packages/esm-billing-app/src/billable-services/billing-tariffs/billing-tariffs.resource.tsx b/packages/esm-billing-app/src/billable-services/billing-tariffs/billing-tariffs.resource.tsx deleted file mode 100755 index 90cba6e..0000000 --- a/packages/esm-billing-app/src/billable-services/billing-tariffs/billing-tariffs.resource.tsx +++ /dev/null @@ -1,55 +0,0 @@ -import { type OpenmrsResource, openmrsFetch } from '@openmrs/esm-framework'; -import useSWR from 'swr'; -import { type ServiceConcept } from '../../types'; - -type ResponseObject = { - results: Array; -}; - -type ServiceTypesResponse = { - setMembers: { uuid: string; display: string }[]; -}; - -export const useBillableServices = () => { - const url = `/ws/rest/v1/cashier/billableService?v=custom:(uuid,name,shortName,serviceStatus,serviceType:(display),servicePrices:(uuid,name,price))`; - const { data, isLoading, isValidating, error, mutate } = useSWR<{ data: ResponseObject }>(url, openmrsFetch, {}); - return { billableServices: data?.data.results ?? [], isLoading, isValidating, error, mutate }; -}; - -export function useServiceTypes() { - const url = `/ws/rest/v1/concept/d7bd4cc0-90b1-4f22-90f2-ab7fde936727?v=custom:(setMembers:(uuid,display))`; - const { data, error, isLoading } = useSWR<{ data: ServiceTypesResponse }>(url, openmrsFetch, {}); - return { serviceTypes: data?.data.setMembers ?? [], error, isLoading }; -} - -export const usePaymentModes = () => { - const url = `/ws/rest/v1/cashier/paymentMode`; - const { data, error, isLoading } = useSWR<{ data: ResponseObject }>(url, openmrsFetch, {}); - return { paymentModes: data?.data.results ?? [], error, isLoading }; -}; - -export const createBillableService = (payload: any) => { - const url = `/ws/rest/v1/cashier/api/billable-service`; - return openmrsFetch(url, { - method: 'POST', - body: payload, - headers: { - 'Content-Type': 'application/json', - }, - }); -}; - -export function useConceptsSearch(conceptToLookup: string) { - const conditionsSearchUrl = `/ws/rest/v1/conceptsearch?q=${conceptToLookup}`; - - const { data, error, isLoading } = useSWR<{ data: { results: Array } }, Error>( - conceptToLookup ? conditionsSearchUrl : null, - openmrsFetch, - ); - - return { - searchResults: data?.data?.results ?? [], - error: error, - isSearching: isLoading, - }; -} diff --git a/packages/esm-billing-app/src/billable-services/create-edit/add-billable-service.component.tsx b/packages/esm-billing-app/src/billable-services/create-edit/add-billable-service.component.tsx deleted file mode 100755 index aaed930..0000000 --- a/packages/esm-billing-app/src/billable-services/create-edit/add-billable-service.component.tsx +++ /dev/null @@ -1,354 +0,0 @@ -import React, { useCallback, useRef, useState } from 'react'; -import styles from './add-billable-service.scss'; -import { - Form, - Button, - TextInput, - ComboBox, - Dropdown, - Layer, - InlineLoading, - Search, - Tile, - FormLabel, - NumberInput, -} from '@carbon/react'; -import { useTranslation } from 'react-i18next'; -import { - createBillableService, - useConceptsSearch, - usePaymentModes, - useServiceTypes, -} from '../billable-service.resource'; -import { Controller, useFieldArray, useForm } from 'react-hook-form'; -import { Add, TrashCan, WarningFilled } from '@carbon/react/icons'; -import { z } from 'zod'; -import { zodResolver } from '@hookform/resolvers/zod'; -import { navigate, showSnackbar, useDebounce, useLayoutType } from '@openmrs/esm-framework'; -import { type ServiceConcept } from '../../types'; -import { extractErrorMessagesFromResponse } from '../../utils'; - -const servicePriceSchema = z.object({ - paymentMode: z.string({ required_error: 'Payment method is required' }), - price: z - .string() - .refine((value) => !isNaN(Number(value)), 'Value must be a number') - .refine((value) => parseInt(value) > 0, 'Price should be a number more than zero') - .refine((value) => !!value, 'Price is required'), -}); - -const paymentFormSchema = z.object({ - payment: z.array(servicePriceSchema).min(1, 'At least one payment method is required'), - serviceName: z.string({ - required_error: 'Service name is required', - }), - shortName: z.string({ required_error: 'A valid short name is required.' }), - serviceTypeName: z.string({ required_error: 'A service type is required' }), - concept: z.string({ required_error: 'Concept search is required.' }), -}); - -type FormData = z.infer; -const DEFAULT_PAYMENT_OPTION = { paymentMode: '', price: '1' }; - -const AddBillableService: React.FC = () => { - const { t } = useTranslation(); - - const { paymentModes, isLoading: isLoadingPaymentModes } = usePaymentModes(); - const { serviceTypes, isLoading: isLoadingServicesTypes } = useServiceTypes(); - - const { - control, - handleSubmit, - formState: { errors, isValid }, - } = useForm({ - mode: 'all', - defaultValues: {}, - resolver: zodResolver(paymentFormSchema), - }); - - const { fields, remove, append } = useFieldArray({ name: 'payment', control: control }); - - const handleAppendPaymentMode = useCallback(() => append(DEFAULT_PAYMENT_OPTION), [append]); - const handleRemovePaymentMode = useCallback((index) => remove(index), [remove]); - - const isTablet = useLayoutType() === 'tablet'; - const searchInputRef = useRef(null); - const handleSearchTermChange = (event: React.ChangeEvent) => setSearchTerm(event.target.value); - - const [selectedConcept, setSelectedConcept] = useState(null); - const [searchTerm, setSearchTerm] = useState(''); - const debouncedSearchTerm = useDebounce(searchTerm); - const { searchResults, isSearching } = useConceptsSearch(debouncedSearchTerm); - - const handleConceptChange = useCallback((selectedConcept: ServiceConcept) => { - setSelectedConcept(selectedConcept); - }, []); - - const handleNavigateToServiceDashboard = () => - navigate({ - to: window.getOpenmrsSpaBase() + 'billable-services', - }); - - const onSubmit = (data: FormData) => { - const payload: any = {}; - - let servicePrices = data.payment.map((element) => { - return { - name: paymentModes.filter((p) => p.uuid === element.paymentMode)[0].name, - price: element.price, - paymentMode: element.paymentMode, - }; - }); - - payload.name = data.serviceName; - payload.shortName = data.shortName; - payload.serviceType = data.serviceTypeName; - payload.servicePrices = servicePrices; - payload.serviceStatus = 'ENABLED'; - payload.concept = selectedConcept?.concept?.uuid; - - createBillableService(payload).then( - (resp) => { - showSnackbar({ - title: t('billableService', 'Billable service'), - subtitle: 'Billable service created successfully', - kind: 'success', - isLowContrast: true, - timeoutInMs: 3000, - }); - handleNavigateToServiceDashboard(); - }, - (error) => { - showSnackbar({ - title: 'Error adding billable service', - kind: 'error', - subtitle: extractErrorMessagesFromResponse(error.responseBody), - isLowContrast: true, - }); - }, - ); - }; - - if (isLoadingServicesTypes || isLoadingPaymentModes) { - return ( -
- -
- ); - } - - return ( -
-

{t('addBillableServices', 'Add Billable Services')}

-
-
- ( - - - - )} - /> -
-
- ( - - - - )} - /> -
-
-
-
- Associated Concept - ( - - { - onChange(e); - handleSearchTermChange(e); - }} - renderIcon={errors?.concept && } - onBlur={onBlur} - onClear={() => { - setSearchTerm(''); - setSelectedConcept(null); - }} - value={(() => { - if (selectedConcept) { - return selectedConcept.display; - } - if (debouncedSearchTerm) { - return value; - } - })()} - /> - - )} - /> - {(() => { - if (!debouncedSearchTerm || selectedConcept) { - return null; - } - if (isSearching) { - return ( -
- -
- ); - } - if (searchResults && searchResults.length) { - return ( -
    - {searchResults?.map((searchResult, index) => ( -
  • handleConceptChange(searchResult)}> - {searchResult.display} -
  • - ))} -
- ); - } - return ( - - - - {t('noResultsFor', 'No results for')} "{debouncedSearchTerm}" - - - - ); - })()} -
-
- ( - (item ? item.display : '')} - placeholder="Select service type" - required - {...field} - onChange={({ selectedItem }) => field.onChange(selectedItem ? selectedItem.display : '')} - invalidText={errors.serviceTypeName?.message || ''} - invalid={!!errors.serviceTypeName} - /> - )} - /> -
-
-
- {fields.map((field, index) => ( -
- ( - - field.onChange(selectedItem?.uuid)} - titleText={t('paymentMode', 'Payment Mode')} - label={t('selectPaymentMethod', 'Select payment method')} - items={paymentModes ?? []} - itemToString={(item) => (item ? item.name : '')} - invalid={!!errors?.payment?.[index]?.paymentMode} - invalidText={errors?.payment?.[index]?.paymentMode?.message} - /> - - )} - /> - ( - - - - )} - /> -
- handleRemovePaymentMode(index)} - className={styles.removeButton} - size={20} - /> -
-
- ))} - - -
-
- - -
-
- ); -}; - -function ResponsiveWrapper({ children, isTablet }: { children: React.ReactNode; isTablet: boolean }) { - return isTablet ? {children} : <>{children}; -} - -export default AddBillableService; diff --git a/packages/esm-billing-app/src/billable-services/create-edit/add-billable-service.scss b/packages/esm-billing-app/src/billable-services/create-edit/add-billable-service.scss deleted file mode 100755 index 5c52a1c..0000000 --- a/packages/esm-billing-app/src/billable-services/create-edit/add-billable-service.scss +++ /dev/null @@ -1,164 +0,0 @@ -@use '@carbon/styles/scss/spacing'; -@use '@carbon/styles/scss/type'; -@use '@carbon/colors'; -@use '@carbon/layout'; -@import '~@openmrs/esm-styleguide/src/vars'; - -.form { - display: flex; - flex-direction: column; - justify-content: space-between; - height: 100%; - padding: spacing.$spacing-06; -} - -.subTitle { - font-weight: 600; - font-size: 14px; -} - -.sectionTitle { - @include type.type-style('heading-compact-02'); - color: $text-02; - margin-bottom: spacing.$spacing-04; -} - -.modalBody { - padding-bottom: spacing.$spacing-05; -} - -.container { - margin: 1rem; -} - -.paymentContainer { - margin: layout.$layout-01; - padding: layout.$layout-01; - width: 70%; - border-right: 1px solid colors.$cool-gray-40; -} - -.paymentButtons { - margin: layout.$layout-01 0; -} - -.paymentMethodContainer { - display: grid; - grid-template-columns: repeat(4, minmax(auto, 1fr)); - column-gap: 1rem; - margin: 0.625rem 0; - width: 100%; -} - -.paymentTotals { - margin-top: layout.$spacing-01; -} - -.processPayments { - display: flex; - justify-content: flex-end; - margin: layout.$spacing-05; - column-gap: layout.$spacing-04; -} - -.errorPaymentContainer { - margin: layout.$spacing-04; - min-height: layout.$spacing-09; -} - -.removeButtonContainer { - display: flex; - align-self: center; - cursor: pointer; - margin-left: layout.$spacing-07; -} - -.removeButton { - color: colors.$red-60; -} - -.service { - padding: 1rem 0.75rem; -} - -.conceptsList { - background-color: $ui-02; - max-height: 14rem; - overflow-y: auto; - border: 1px solid $ui-03; - - li:hover { - background-color: $ui-03; - } -} - -.emptyResults { - @include type.type-style('body-compact-01'); - color: $text-02; - min-height: 1rem; - border: 1px solid $ui-03; -} - -.conceptLabel { - @include type.type-style('label-02'); - margin-bottom: 0.6rem; -} - -.errorContainer { - margin: 1rem; -} - -.serviceError { - :global(.cds--search-input):focus { - outline: 2.5px solid $danger; - } - - :global(.cds--search-magnifier) { - svg { - fill: $danger; - } - } -} - -.errorMessage { - @include type.type-style('label-02'); - color: $danger; - margin-top: 0.5rem; -} - -.spinner { - &:global(.cds--inline-loading) { - min-height: 1rem; - } -} - -.loader { - margin-top: 1rem; - margin-bottom: 1rem; - margin-left: auto; - margin-right: auto; - width: max-content; -} - -.searchWrapper { - display: flex; - flex-direction: column; - align-items: center; - justify-items: center; -} - -.nameSection { - display: flex; - gap: 20px; - align-items: flex-start; -} - -.secondSection { - display: flex; - gap: 20px; - align-items: flex-start; -} - -.serviceName { - width: 50%; -} diff --git a/packages/esm-billing-app/src/billable-services/dashboard/dashboard.component.tsx b/packages/esm-billing-app/src/billable-services/dashboard/dashboard.component.tsx deleted file mode 100755 index 15540d4..0000000 --- a/packages/esm-billing-app/src/billable-services/dashboard/dashboard.component.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import React from 'react'; -import { useTranslation } from 'react-i18next'; -import styles from './dashboard.scss'; -import ServiceMetrics from './service-metrics.component'; -import BillableServices from '../billable-services.component'; - -export function BillableServicesDashboard() { - const { t } = useTranslation(); - - return ( -
- -
- -
-
- ); -} diff --git a/packages/esm-billing-app/src/billable-services/dashboard/dashboard.scss b/packages/esm-billing-app/src/billable-services/dashboard/dashboard.scss deleted file mode 100755 index cd10b1b..0000000 --- a/packages/esm-billing-app/src/billable-services/dashboard/dashboard.scss +++ /dev/null @@ -1,27 +0,0 @@ -@use '@carbon/colors'; -@use '@carbon/layout'; -@use '@carbon/type'; - -.container { - height: calc(100vh - 3rem); -} - -.servicesTableContainer { - margin: 2rem 1rem; -} - -.illo { - margin-top: layout.$spacing-05; -} - -.content { - @include type.type-style('heading-compact-01'); - color: colors.$gray-70; - margin-top: layout.$spacing-05; -} - -.tile { - border: 1px solid colors.$gray-20; - padding: 1.5rem 0; - text-align: center; -} diff --git a/packages/esm-billing-app/src/billable-services/dashboard/service-metrics.component.tsx b/packages/esm-billing-app/src/billable-services/dashboard/service-metrics.component.tsx deleted file mode 100755 index 8d5dbbc..0000000 --- a/packages/esm-billing-app/src/billable-services/dashboard/service-metrics.component.tsx +++ /dev/null @@ -1,40 +0,0 @@ -import React, { useMemo } from 'react'; -import Card from '../../metrics-cards/card.component'; -import styles from '../../metrics-cards/metrics-cards.scss'; -import { useTranslation } from 'react-i18next'; -import { ErrorState } from '@openmrs/esm-patient-common-lib'; -import { InlineLoading } from '@carbon/react'; -import { useBillableServices } from '../billable-service.resource'; - -export default function ServiceMetrics() { - const { t } = useTranslation(); - const { isLoading, error } = useBillableServices(); - - const cards = useMemo( - () => [ - { title: 'Cash Revenue', count: '--' }, - { title: 'Insurance Revenue', count: '--' }, - { title: 'Pending Claims', count: '--' }, - ], - [], - ); - - if (isLoading) { - return ( -
- -
- ); - } - - if (error) { - return ; - } - return ( -
- {cards.map((card) => ( - - ))} -
- ); -} diff --git a/packages/esm-billing-app/src/billing-dashboard/billing-dashboard.component.tsx b/packages/esm-billing-app/src/billing-dashboard/billing-dashboard.component.tsx deleted file mode 100755 index 6008d2a..0000000 --- a/packages/esm-billing-app/src/billing-dashboard/billing-dashboard.component.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import React from 'react'; -import { useTranslation } from 'react-i18next'; -import BillingHeader from '../billing-header/billing-header.component'; -import MetricsCards from '../metrics-cards/metrics-cards.component'; -import BillsTable from '../bills-table/bills-table.component'; -import styles from './billing-dashboard.scss'; -import BillingTabs from '../billing-tabs/billling-tabs.component'; - -export function BillingDashboard() { - const { t } = useTranslation(); - - return ( -
- - - -
- ); -} diff --git a/packages/esm-billing-app/src/billing-dashboard/billing-dashboard.scss b/packages/esm-billing-app/src/billing-dashboard/billing-dashboard.scss deleted file mode 100755 index 3155807..0000000 --- a/packages/esm-billing-app/src/billing-dashboard/billing-dashboard.scss +++ /dev/null @@ -1,27 +0,0 @@ -@use '@carbon/colors'; -@use '@carbon/layout'; -@use '@carbon/type'; - -.container { - height: calc(100vh - 3rem); -} - -.billsTableContainer { - margin: 2rem 1rem; -} - -.illo { - margin-top: layout.$spacing-05; -} - -.content { - @include type.type-style('heading-compact-01'); - color: colors.$gray-70; - margin-top: layout.$spacing-05; -} - -.tile { - border: 1px solid colors.$gray-20; - padding: 1.5rem 0; - text-align: center; -} diff --git a/packages/esm-billing-app/src/billing-form/billing-checkin-form.component.tsx b/packages/esm-billing-app/src/billing-form/billing-checkin-form.component.tsx deleted file mode 100755 index 24595d9..0000000 --- a/packages/esm-billing-app/src/billing-form/billing-checkin-form.component.tsx +++ /dev/null @@ -1,137 +0,0 @@ -import React, { useCallback, useEffect, useState } from 'react'; -import { InlineLoading, InlineNotification, FilterableMultiSelect } from '@carbon/react'; -import { useTranslation } from 'react-i18next'; -import { showSnackbar, useConfig } from '@openmrs/esm-framework'; -import styles from './billing-checkin-form.scss'; -import VisitAttributesForm from './visit-attributes/visit-attributes-form.component'; -import { type BillingConfig } from '../config-schema'; -import { hasPatientBeenExempted } from './helper'; -import { EXEMPTED_PAYMENT_STATUS, PENDING_PAYMENT_STATUS } from '../constants'; -import { type BillingService } from '../types'; -import SHANumberValidity from './social-health-authority/sha-number-validity.component'; -import { createPatientBill, useBillableItems, useCashPoint } from '../billing.resource'; - -type BillingCheckInFormProps = { - patientUuid: string; - setExtraVisitInfo: (state) => void; -}; - -const BillingCheckInForm: React.FC = ({ patientUuid, setExtraVisitInfo }) => { - const { t } = useTranslation(); - const { - visitAttributeTypes: { isPatientExempted }, - } = useConfig(); - const { cashPoints, isLoading: isLoadingCashPoints, error: cashError } = useCashPoint(); - const { lineItems, isLoading: isLoadingLineItems, error: lineError } = useBillableItems(); - const [attributes, setAttributes] = useState([]); - const [paymentMethod, setPaymentMethod] = useState(); - const [isPatientExemptedValue, setIsPatientExemptedValue] = useState(null); - - const handleCreateBill = useCallback((createBillPayload) => { - createPatientBill(createBillPayload).then( - () => { - showSnackbar({ title: 'Patient Bill', subtitle: 'Patient has been billed successfully', kind: 'success' }); - }, - (error) => { - const errorMessage = JSON.stringify(error?.responseBody?.error?.message?.replace(/\[/g, '').replace(/\]/g, '')); - showSnackbar({ - title: 'Patient Bill Error', - subtitle: `An error has occurred while creating patient bill, Contact system administrator quoting this error ${errorMessage}`, - kind: 'error', - isLowContrast: true, - }); - }, - ); - }, []); - - const handleBillingService = (selectedItems: Array) => { - const cashPointUuid = cashPoints?.[0]?.uuid ?? ''; - const billStatus = hasPatientBeenExempted(attributes, isPatientExempted) - ? EXEMPTED_PAYMENT_STATUS - : PENDING_PAYMENT_STATUS; - - const lineItems = selectedItems.map((item, index) => { - const priceForPaymentMode = - item.servicePrices.find((p) => p.paymentMode?.uuid === paymentMethod) || item?.servicePrices[0]; - return { - billableService: item?.uuid ?? '', - quantity: 1, - price: priceForPaymentMode ? priceForPaymentMode.price : '0.000', - priceName: 'Default', - priceUuid: priceForPaymentMode ? priceForPaymentMode.uuid : '', - lineItemOrder: index, - paymentStatus: billStatus, - }; - }); - - const billPayload = { - lineItems: lineItems, - cashPoint: cashPointUuid, - patient: patientUuid, - status: billStatus, - payments: [], - }; - - setExtraVisitInfo({ - handleCreateExtraVisitInfo: () => handleCreateBill(billPayload), - attributes, - }); - }; - - useEffect(() => { - setExtraVisitInfo({ - handleCreateExtraVisitInfo: () => {}, - attributes, - }); - }, [attributes, setExtraVisitInfo]); - - if (isLoadingLineItems || isLoadingCashPoints) { - return ( - - ); - } - - if (cashError || lineError) { - return ( - - ); - } - - return ( - <> - - - {paymentMethod && ( -
-
{t('billing', 'Billing')}
-
- (item ? item?.name : '')} - onChange={({ selectedItems }) => handleBillingService(selectedItems)} - disabled={isPatientExemptedValue === ''} - /> -
-
- )} - - ); -}; - -export default React.memo(BillingCheckInForm); diff --git a/packages/esm-billing-app/src/billing-form/billing-checkin-form.scss b/packages/esm-billing-app/src/billing-form/billing-checkin-form.scss deleted file mode 100755 index 3cf04ff..0000000 --- a/packages/esm-billing-app/src/billing-form/billing-checkin-form.scss +++ /dev/null @@ -1,14 +0,0 @@ -@use '@carbon/layout'; -@use '@carbon/type'; -@use '@carbon/colors'; - -.sectionTitle { - @include type.type-style('heading-compact-02'); - color: colors.$gray-70; - margin: 0 0 layout.$spacing-03 0; - flex-basis: 30%; -} - -.sectionField { - flex-basis: 70%; -} diff --git a/packages/esm-billing-app/src/billing-form/billing-form.component.tsx b/packages/esm-billing-app/src/billing-form/billing-form.component.tsx deleted file mode 100755 index cbeb959..0000000 --- a/packages/esm-billing-app/src/billing-form/billing-form.component.tsx +++ /dev/null @@ -1,301 +0,0 @@ -import React, { useState } from 'react'; -import { - ButtonSet, - Button, - RadioButtonGroup, - RadioButton, - Search, - Table, - TableHead, - TableBody, - TableHeader, - TableRow, - TableCell, -} from '@carbon/react'; -import styles from './billing-form.scss'; -import { useTranslation } from 'react-i18next'; -import { useFetchSearchResults, processBillItems } from '../billing.resource'; -import { getPatientUuidFromUrl } from '@openmrs/esm-patient-common-lib'; -import { showSnackbar } from '@openmrs/esm-framework'; -import { mutate } from 'swr'; - -type BillingFormProps = { - patientUuid: string; - closeWorkspace: () => void; -}; - -const BillingForm: React.FC = ({ closeWorkspace }) => { - const { t } = useTranslation(); - const patientUuid = getPatientUuidFromUrl(); - - const [GrandTotal, setGrandTotal] = useState(0); - - const [searchOptions, setsearchOptions] = useState([]); - const [defaultSearchItems, setdefaultSearchItems] = useState([]); - - const [BillItems, setBillItems] = useState([]); - - const [searchVal, setsearchVal] = useState(''); - const [category, setCategory] = useState(''); - - const toggleSearch = (choiceSelected) => { - (document.getElementById('searchField') as HTMLInputElement).disabled = false; - - if (choiceSelected == 'Stock Item') { - setCategory('Stock Item'); - } else { - setCategory('Service'); - } - }; - - const calculateTotal = (event, itemName) => { - const Qnty = event.target.value; - const price = (document.getElementById(event.target.id + 'Price') as HTMLInputElement).innerHTML; - const total = parseInt(price) * Qnty; - (document.getElementById(event.target.id + 'Total') as HTMLInputElement).innerHTML = total.toString(); - - const updateItem = BillItems.filter((o) => o.Item.toLowerCase().includes(itemName.toLowerCase())); - - updateItem.map((o) => (o.Qnty = Qnty)); - updateItem.map((o) => (o.Total = total)); - - const totals = Array.from(document.querySelectorAll('[id$="Total"]')); - - let addUpTotals = 0; - totals.forEach((tot) => { - let getTot = (tot as HTMLInputElement).innerHTML; - addUpTotals += parseInt(getTot); - }); - setGrandTotal(addUpTotals); - }; - - const CalculateTotalAfteraddBillItem = () => { - let sum = 0; - BillItems.map((o) => (sum += o.Price)); - - setGrandTotal(sum); - }; - - const addItemToBill = (event, itemid, itemname, itemcategory, itemPrice) => { - BillItems.push({ - uuid: itemid, - Item: itemname, - Qnty: 1, - Price: itemPrice, - Total: itemPrice, - category: itemcategory, - }); - setBillItems(BillItems); - setsearchOptions([]); - CalculateTotalAfteraddBillItem(); - (document.getElementById('searchField') as HTMLInputElement).value = ''; - }; - - // filter items - const { data, error, isLoading, isValidating } = useFetchSearchResults(searchVal, category); - - const filterItems = (val) => { - setsearchVal(val); - - if (isLoading) { - /* empty */ - } else { - if (typeof data !== 'undefined') { - //set to null then repopulate - while (searchOptions.length > 0) { - searchOptions.pop(); - } - - const res = data as { results: any[] }; - - res.results.map((o) => { - if ( - o.commonName && - (o.commonName != '' || o.commonName != null) && - (o.purchasePrice != '' || o.purchasePrice != null) - ) { - searchOptions.push({ - uuid: o.uuid, - Item: o.commonName, - Qnty: 1, - Price: o?.purchasePrice, - Total: o?.purchasePrice, - category: 'StockItem', - }); - } else { - if (o.name.toLowerCase().includes(searchVal.toLowerCase())) { - searchOptions.push({ - uuid: o.uuid, - Item: o.name, - Qnty: 1, - Price: o.servicePrices[0]?.price, - Total: o.servicePrices[0]?.price, - category: 'Service', - }); - } - } - setsearchOptions(searchOptions); - }); - } - } - }; - - const postBillItems = () => { - const bill = { - cashPoint: '54065383-b4d4-42d2-af4d-d250a1fd2590', - cashier: 'f9badd80-ab76-11e2-9e96-0800200c9a66', - lineItems: [], - payments: [], - patient: patientUuid, - status: 'PENDING', - }; - - BillItems.map((o) => { - if (o.category == 'StockItem') { - bill.lineItems.push({ - item: o.uuid, - quantity: parseInt(o.Qnty), - price: o.Price, - priceName: 'Default', - priceUuid: '7b9171ac-d3c1-49b4-beff-c9902aee5245', - lineItemOrder: 0, - paymentStatus: 'PENDING', - }); - } else { - bill.lineItems.push({ - billableService: o.uuid, - quantity: parseInt(o.Qnty), - price: o.Price, - priceName: 'Default', - priceUuid: '7b9171ac-d3c1-49b4-beff-c9902aee5245', - lineItemOrder: 0, - paymentStatus: 'PENDING', - }); - } - }); - - const url = `/ws/rest/v1/cashier/bill`; - processBillItems(bill).then( - (resp) => { - closeWorkspace(); - mutate((key) => typeof key === 'string' && key.startsWith(url), undefined, { revalidate: true }); - showSnackbar({ - title: t('billItems', 'Save Bill'), - subtitle: 'Bill processing has been successful', - kind: 'success', - timeoutInMs: 3000, - }); - }, - (error) => { - showSnackbar({ title: 'Bill processing error', kind: 'error', subtitle: error }); - }, - ); - }; - - return ( -
- - - - -
- -
- {}} - className={styles.billingItem} - onKeyUp={(e) => { - filterItems(e.target.value); - }} - /> - -
    - {searchOptions.map((row) => ( -
  • - -
  • - ))} -
-
- - {/* alert((numberRef.current as HTMLInputElement).value)} - className="testingNumberInput" label="NumberInput label" helperText="Optional helper text." invalidText="Number is not valid" /> */} - - - - - Item - Quantity - Price - Total - - - - {BillItems && Array.isArray(BillItems) ? ( - BillItems.map((row) => ( - - {row.Item} - - { - calculateTotal(e, row.Item); - row.Qnty = e.target.value; - }} - /> - {/* alert((numberRef.current as HTMLInputElement).value)} /> */} - - {row.Price} - - {row.Total} - - - )) - ) : ( -

Loading...

- )} - - - - Grand Total: - {GrandTotal} - -
-
- - - - - -
- ); -}; - -export default BillingForm; diff --git a/packages/esm-billing-app/src/billing-form/billing-form.scss b/packages/esm-billing-app/src/billing-form/billing-form.scss deleted file mode 100755 index b8719c1..0000000 --- a/packages/esm-billing-app/src/billing-form/billing-form.scss +++ /dev/null @@ -1,28 +0,0 @@ -@use '@carbon/layout'; - -.billingFormContainer { - padding: layout.$spacing-05; -} - -.billingItem { - // padding: layout.$spacing-05; - margin-top: 30px; -} - -.searchContent { - // display: none; - position: absolute; - background-color: #fff; - min-width: 230px; - overflow: auto; - border: 1px solid #ddd; - z-index: 1; - width: 92%; -} - -.searchItem { - border-bottom: 0.1rem solid; - border-bottom-color: silver; - // padding: 10px; - cursor: pointer; -} diff --git a/packages/esm-billing-app/src/billing-form/helper.ts b/packages/esm-billing-app/src/billing-form/helper.ts deleted file mode 100755 index 55edb5a..0000000 --- a/packages/esm-billing-app/src/billing-form/helper.ts +++ /dev/null @@ -1,2 +0,0 @@ -export const hasPatientBeenExempted = (attributes: Array, isPatientExempted: string): boolean => - attributes.find(({ attributeType }) => attributeType === isPatientExempted)?.value === true; diff --git a/packages/esm-billing-app/src/billing-form/social-health-authority/sha-number-validity.component.tsx b/packages/esm-billing-app/src/billing-form/social-health-authority/sha-number-validity.component.tsx deleted file mode 100755 index 8a238bf..0000000 --- a/packages/esm-billing-app/src/billing-form/social-health-authority/sha-number-validity.component.tsx +++ /dev/null @@ -1,77 +0,0 @@ -import React, { useState } from 'react'; -import { useTranslation } from 'react-i18next'; -import { Form, TextInput, Button, InlineLoading, InlineNotification } from '@carbon/react'; - -type SHANumberValidityProps = { - paymentMethod: any; -}; - -const SHANumberValidity: React.FC = ({ paymentMethod }) => { - const { t } = useTranslation(); - const [shaNumber, setNumber] = useState(''); - const [message, setMessage] = useState(''); - const [isLoading, setIsLoading] = useState(false); - const [validity, setValidity] = useState(false); // TODO: set validity based on api response - const isSHA = paymentMethod?.name === 'Social Health Insurance Fund (SHA)'; - - const handleValidateSHANumber = () => { - setIsLoading(true); - const randomNumber = Math.floor(Math.random() * 10) + 1; - // TODO call api to validate sha number - setTimeout(() => { - // TODO: set validity based on api response and update the expiry date based on the response as visit attribute - randomNumber % 2 === 0 ? setValidity(false) : setValidity(true); - setMessage( - randomNumber % 2 === 0 - ? t('invalidSHANumber', 'SHA number is invalid, advice patient to update payment or contact SHA') - : t('validSHANumber', 'SHA number is valid, proceed with care'), - ); - setIsLoading(false); - }, 1500); - }; - - if (!isSHA) { - return null; - } - - return ( -
- setNumber(e.target.value)} - labelText={t('shaNumber', 'SHA Number')} - placeholder={t('enterSHANumber', 'Enter SHA Number')} - /> - {isLoading ? ( - - ) : ( - - )} - {message !== '' && ( -

- -

- )} - - ); -}; - -export default SHANumberValidity; diff --git a/packages/esm-billing-app/src/billing-form/visit-attributes/visit-attributes-form.component.tsx b/packages/esm-billing-app/src/billing-form/visit-attributes/visit-attributes-form.component.tsx deleted file mode 100755 index 71db914..0000000 --- a/packages/esm-billing-app/src/billing-form/visit-attributes/visit-attributes-form.component.tsx +++ /dev/null @@ -1,206 +0,0 @@ -import React, { useCallback, useEffect } from 'react'; -import { useTranslation } from 'react-i18next'; -import { TextInput, InlineLoading, ComboBox, RadioButtonGroup, RadioButton } from '@carbon/react'; -import { Controller, useForm } from 'react-hook-form'; -import { zodResolver } from '@hookform/resolvers/zod'; -import { z } from 'zod'; -import { useConfig } from '@openmrs/esm-framework'; -import { type BillingConfig } from '../../config-schema'; -import { usePaymentModes } from '../../billing.resource'; -import styles from './visit-attributes-form.scss'; - -type VisitAttributesFormProps = { - setAttributes: (state) => void; - setPaymentMethod?: (value: any) => void; - setIsPatientExempted: (value: string) => void; -}; - -type VisitAttributesFormValue = { - isPatientExempted: string; - paymentMethods: { uuid: string; name: string } | null; - insuranceScheme: string; - policyNumber: string; - exemptionCategory: string; -}; - -const visitAttributesFormSchema = z.object({ - isPatientExempted: z.string(), - paymentMethods: z.object({ uuid: z.string(), name: z.string() }).nullable(), - insuranceScheme: z.string().optional(), - policyNumber: z.string().optional(), - exemptionCategory: z.string().optional(), -}); - -const VisitAttributesForm: React.FC = ({ - setAttributes, - setPaymentMethod, - setIsPatientExempted, -}) => { - const { t } = useTranslation(); - const { visitAttributeTypes, patientExemptionCategories } = useConfig(); - const { control, getValues, watch, setValue } = useForm({ - mode: 'all', - defaultValues: { - isPatientExempted: '', - paymentMethods: null, - insuranceScheme: '', - policyNumber: '', - exemptionCategory: '', - }, - resolver: zodResolver(visitAttributesFormSchema), - }); - - const { paymentModes, isLoading: isLoadingPaymentModes } = usePaymentModes(); - const [isPatientExempted, paymentMethods] = watch(['isPatientExempted', 'paymentMethods']); - - const resetFormFieldsForNonExemptedPatients = useCallback(() => { - setValue('insuranceScheme', ''); - setValue('policyNumber', ''); - setValue('exemptionCategory', ''); - setValue('paymentMethods', null); - }, [setValue]); - - useEffect(() => { - if (isPatientExempted === 'true') { - resetFormFieldsForNonExemptedPatients(); - } - setIsPatientExempted(isPatientExempted); - }, [isPatientExempted, resetFormFieldsForNonExemptedPatients, setIsPatientExempted]); - - const createVisitAttributesPayload = useCallback(() => { - const values = getValues(); - setPaymentMethod?.(values.paymentMethods); - const formPayload = [ - { uuid: visitAttributeTypes.isPatientExempted, value: values.isPatientExempted }, - { uuid: visitAttributeTypes.paymentMethods, value: values.paymentMethods?.uuid }, - { uuid: visitAttributeTypes.policyNumber, value: values.policyNumber }, - { uuid: visitAttributeTypes.insuranceScheme, value: values.insuranceScheme }, - { uuid: visitAttributeTypes.exemptionCategory, value: values.exemptionCategory }, - ]; - const visitAttributesPayload = formPayload.filter( - (item) => item.value !== undefined && item.value !== null && item.value !== '', - ); - return visitAttributesPayload.map(({ uuid, value }) => ({ - attributeType: uuid, - value, - })); - }, [getValues, visitAttributeTypes, setPaymentMethod]); - - useEffect(() => { - setAttributes(createVisitAttributesPayload()); - }, [isPatientExempted, paymentMethods, getValues, createVisitAttributesPayload, setAttributes]); - - if (isLoadingPaymentModes) { - return ( - - ); - } - - return ( -
-
{t('billing', 'Billing')}
-
-
- ( - { - field.onChange(selected); - setValue('isPatientExempted', selected); - }} - orientation="horizontal" - legendText={t('isPatientExemptedLegend', 'Is patient exempted from payment?')} - name="patientExemption"> - - - - )} - /> -
- - {isPatientExempted === 'true' && ( -
- ( - field.onChange(selectedItem?.uuid)} - id="exemptionCategory" - items={patientExemptionCategories} - itemToString={(item) => (item ? item.label : '')} - titleText={t('exemptionCategory', 'Exemption category')} - placeholder={t('selectExemptionCategory', 'Select exemption category')} - /> - )} - /> -
- )} - - {isPatientExempted === 'false' && ( -
- ( - field.onChange(selectedItem)} - id="paymentMethods" - items={paymentModes} - itemToString={(item) => (item ? item.name : '')} - titleText={t('paymentMethodsTitle', 'Payment method')} - placeholder={t('selectPaymentMethod', 'Select payment method')} - /> - )} - /> -
- )} - - {paymentMethods?.name?.toLowerCase() === 'insurance' && isPatientExempted === 'false' && ( - <> -
- ( - field.onChange(e.target.value)} - id="insurance-scheme" - type="text" - labelText={t('insuranceScheme', 'Insurance scheme')} - /> - )} - /> -
-
- ( - field.onChange(e.target.value)} - id="policy-number" - type="text" - labelText={t('policyNumber', 'Policy number')} - /> - )} - /> -
- - )} -
-
- ); -}; - -export default VisitAttributesForm; diff --git a/packages/esm-billing-app/src/billing-form/visit-attributes/visit-attributes-form.scss b/packages/esm-billing-app/src/billing-form/visit-attributes/visit-attributes-form.scss deleted file mode 100755 index 47c7f7e..0000000 --- a/packages/esm-billing-app/src/billing-form/visit-attributes/visit-attributes-form.scss +++ /dev/null @@ -1,18 +0,0 @@ -@use '@carbon/layout'; -@use '@carbon/type'; -@use '@carbon/colors'; - -.sectionTitle { - @include type.type-style('heading-compact-02'); - color: colors.$gray-70; - margin: 0 0 layout.$spacing-03 0; - flex-basis: 30%; -} - -.sectionField { - flex-basis: 70%; -} - -.sectionFieldLayer { - margin-bottom: 0.5rem; -} diff --git a/packages/esm-billing-app/src/billing-header/billing-header.component.tsx b/packages/esm-billing-app/src/billing-header/billing-header.component.tsx deleted file mode 100755 index 99fb9f5..0000000 --- a/packages/esm-billing-app/src/billing-header/billing-header.component.tsx +++ /dev/null @@ -1,43 +0,0 @@ -import React from 'react'; -import { useTranslation } from 'react-i18next'; -import { Calendar, Location, UserFollow } from '@carbon/react/icons'; -import { formatDate, useSession } from '@openmrs/esm-framework'; -import BillingIllustration from './billing-illustration.component'; -import styles from './billing-header.scss'; - -interface BillingHeaderProps { - title: string; -} - -const BillingHeader: React.FC = ({ title }) => { - const { t } = useTranslation(); - const session = useSession(); - const location = session?.sessionLocation?.display; - - return ( -
-
- -
-

{t('billing', 'Billing')}

-

{title}

-
-
-
-
-

{session?.user?.person?.display}

- -
-
- - {location} - · - - {formatDate(new Date(), { mode: 'standard' })} -
-
-
- ); -}; - -export default BillingHeader; diff --git a/packages/esm-billing-app/src/billing-header/billing-header.scss b/packages/esm-billing-app/src/billing-header/billing-header.scss deleted file mode 100755 index 78916f3..0000000 --- a/packages/esm-billing-app/src/billing-header/billing-header.scss +++ /dev/null @@ -1,83 +0,0 @@ -@use '@carbon/layout'; -@use '@carbon/type'; -@import '~@openmrs/esm-styleguide/src/vars'; - -.header { - @include type.type-style('body-compact-02'); - color: $text-02; - height: layout.$spacing-12; - background-color: $ui-02; - border-bottom: 1px solid $ui-03; - display: flex; - justify-content: space-between; - padding: layout.$spacing-05; -} - -.left-justified-items { - display: flex; - flex-direction: row; - align-items: center; - cursor: pointer; - align-items: center; -} - -.right-justified-items { - @include type.type-style('body-compact-02'); - color: $text-02; - display: flex; - flex-direction: column; - justify-content: space-between; -} - -.page-name { - @include type.type-style('heading-04'); -} - -.page-labels { - margin: layout.$spacing-05; - - p:first-of-type { - margin-bottom: layout.$spacing-02; - } -} - -.date-and-location { - display: flex; - justify-content: flex-end; - align-items: center; -} - -.userContainer { - display: flex; - justify-content: flex-end; - gap: layout.$spacing-05; -} - -.value { - margin-left: layout.$spacing-02; -} - -.middot { - margin: 0 layout.$spacing-03; -} - -.view { - @include type.type-style('label-01'); -} - -// Overriding styles for RTL support -html[dir='rtl'] { - .date-and-location { - & > svg { - order: -1; - } - & > span:nth-child(2) { - order: -2; - } - } -} - -.userIcon { - fill: $ui-05; - margin: layout.$spacing-01; -} diff --git a/packages/esm-billing-app/src/billing-header/billing-illustration.component.tsx b/packages/esm-billing-app/src/billing-header/billing-illustration.component.tsx deleted file mode 100755 index 8c67cb6..0000000 --- a/packages/esm-billing-app/src/billing-header/billing-illustration.component.tsx +++ /dev/null @@ -1,30 +0,0 @@ -import React from 'react'; - -const BillingIllustration: React.FC = () => { - return ( - - Billing module illustration - - - - - - - - ); -}; - -export default BillingIllustration; diff --git a/packages/esm-billing-app/src/billing-prompt/billing-prompt.resource.tsx b/packages/esm-billing-app/src/billing-prompt/billing-prompt.resource.tsx deleted file mode 100755 index 1d216bf..0000000 --- a/packages/esm-billing-app/src/billing-prompt/billing-prompt.resource.tsx +++ /dev/null @@ -1,45 +0,0 @@ -import { type Visit, useConfig, useVisit } from '@openmrs/esm-framework'; -import { useBills } from '../billing.resource'; -import { type BillingConfig } from '../config-schema'; - -const INPATIENT_VISIT_TYPE = 'a73e2ac6-263b-47fc-99fc-e0f2c09fc914'; -const INSURANCE_PAYMENT_METHOD = 'beac329b-f1dc-4a33-9e7c-d95821a137a6'; - -// helper functions -const isCurrentVisitInPatient = (currentVisit: Visit) => currentVisit?.visitType?.uuid === INPATIENT_VISIT_TYPE; -const isPaymentMethodInsurance = (currentVisit: Visit, insurancePaymentMethod: string) => - currentVisit?.attributes.find((attr) => attr.attributeType.uuid === insurancePaymentMethod)?.value === - INSURANCE_PAYMENT_METHOD; - -export const useBillingPrompt = (patientUuid: string) => { - const { - visitAttributeTypes: { paymentMethods }, - } = useConfig(); - const { currentVisit, isLoading: isLoadingVisit } = useVisit(patientUuid); - const { bills, isLoading, error } = useBills(patientUuid); - - const flattenBills = bills - .flatMap((bill) => bill.lineItems) - .filter((lineItem) => lineItem.paymentStatus !== 'EXEMPTED'); - const flattenPayments = bills.flatMap((bill) => bill.payments); - - const totalBill = flattenBills.reduce((acc, curr) => acc + curr.price * curr.quantity, 0); - const totalPayments = flattenPayments.reduce((acc, curr) => acc + curr.amountTendered, 0); - const patientBillBalance = totalBill - totalPayments; - - // Should show billing prompt if the following conditions are met: - // 1. The current visit is not an inpatient visit - // 2. The patient has a bill balance - // 3. The payment method is not insurances - - return { - shouldShowBillingPrompt: - !isCurrentVisitInPatient(currentVisit) && - patientBillBalance > 0 && - !isPaymentMethodInsurance(currentVisit, paymentMethods), - isLoading: isLoading || isLoadingVisit, - error, - currentVisit, - bills, - }; -}; diff --git a/packages/esm-billing-app/src/billing-tabs/billing-tab.scss b/packages/esm-billing-app/src/billing-tabs/billing-tab.scss deleted file mode 100755 index e69de29..0000000 diff --git a/packages/esm-billing-app/src/billing-tabs/billling-tabs.component.tsx b/packages/esm-billing-app/src/billing-tabs/billling-tabs.component.tsx deleted file mode 100755 index 3adf271..0000000 --- a/packages/esm-billing-app/src/billing-tabs/billling-tabs.component.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import React, { useState } from 'react'; -import { useTranslation } from 'react-i18next'; -import { Tab, TabList, Tabs, TabPanel, TabPanels } from '@carbon/react'; -import styles from './billing-tab.scss'; -import PatientBillsScreen from '../past-patient-bills/patient-bills-dashboard/patient-bills-dashboard'; -import BillsTable from '../bills-table/bills-table.component'; - -const BillingTabs = () => { - const { t } = useTranslation(); - const [activeTabIndex, setActiveTabIndex] = useState(0); - - const handleTabChange = ({ selectedIndex }: { selectedIndex: number }) => { - setActiveTabIndex(selectedIndex); - }; - - return ( -
- -
- - {"Today's bills"} - {t('patientBills', 'Patient Bill')} - -
- - - - - - - - -
-
- ); -}; - -export default BillingTabs; diff --git a/packages/esm-billing-app/src/billing.resource.ts b/packages/esm-billing-app/src/billing.resource.ts deleted file mode 100755 index d9c3c1c..0000000 --- a/packages/esm-billing-app/src/billing.resource.ts +++ /dev/null @@ -1,225 +0,0 @@ -import useSWR from 'swr'; -import { - formatDate, - parseDate, - openmrsFetch, - useSession, - useVisit, - useConfig, - type OpenmrsResource, -} from '@openmrs/esm-framework'; -import { type FacilityDetail, type MappedBill, type PatientInvoice, type PaymentMethod } from './types'; -import isEmpty from 'lodash-es/isEmpty'; -import sortBy from 'lodash-es/sortBy'; -import dayjs from 'dayjs'; -import { type BillingConfig } from './config-schema'; -import { useState } from 'react'; - -export const useBills = (patientUuid: string = '', billStatus: string = '') => { - // TODO: Should be provided from the UI - const defaultCreatedOnOrAfterDateTime = dayjs().startOf('day').toISOString(); - const url = `/ws/rest/v1/cashier/bill?status=${billStatus}&v=custom:(uuid,display,voided,voidReason,adjustedBy,cashPoint:(uuid,name),cashier:(uuid,display),dateCreated,lineItems,patient:(uuid,display))&createdOnOrAfter=${defaultCreatedOnOrAfterDateTime}`; - - const { data, error, isLoading, isValidating, mutate } = useSWR<{ data: { results: Array } }>( - patientUuid ? `${url}&patientUuid=${patientUuid}` : url, - openmrsFetch, - { - errorRetryCount: 2, - }, - ); - - const mapBillProperties = (bill: PatientInvoice): MappedBill => { - // create base object - const mappedBill: MappedBill = { - id: bill?.id, - uuid: bill?.uuid, - patientName: bill?.patient?.display.split('-')?.[1], - identifier: bill?.patient?.display.split('-')?.[0], - patientUuid: bill?.patient?.uuid, - status: bill.lineItems.some((item) => item.paymentStatus === 'PENDING') ? 'PENDING' : 'PAID', - receiptNumber: bill?.receiptNumber, - cashier: bill?.cashier, - cashPointUuid: bill?.cashPoint?.uuid, - cashPointName: bill?.cashPoint?.name, - cashPointLocation: bill?.cashPoint?.location?.display, - dateCreated: bill?.dateCreated ? formatDate(parseDate(bill.dateCreated), { mode: 'wide' }) : '--', - lineItems: bill.lineItems, - billingService: bill.lineItems.map((bill) => bill.item || bill.billableService || '--').join(' '), - payments: bill.payments, - display: bill.display, - totalAmount: bill?.lineItems?.map((item) => item.price * item.quantity).reduce((prev, curr) => prev + curr, 0), - }; - - return mappedBill; - }; - - const sortBills = sortBy(data?.data?.results ?? [], ['dateCreated']).reverse(); - const filteredBills = billStatus === '' ? sortBills : sortBills?.filter((bill) => bill.status === billStatus); - const mappedResults = filteredBills?.map((bill) => mapBillProperties(bill)); - const filteredResults = mappedResults?.filter((res) => res.patientUuid === patientUuid); - const formattedBills = isEmpty(patientUuid) ? mappedResults : filteredResults || []; - - return { - bills: formattedBills, - error, - isLoading, - isValidating, - mutate, - }; -}; - -export const useBill = (billUuid: string) => { - const url = `/ws/rest/v1/cashier/bill/${billUuid}`; - const { data, error, isLoading, isValidating, mutate } = useSWR<{ data: PatientInvoice }>( - billUuid ? url : null, - openmrsFetch, - { - errorRetryCount: 2, - }, - ); - - const mapBillProperties = (bill: PatientInvoice): MappedBill => { - // create base object - const mappedBill: MappedBill = { - id: bill?.id, - uuid: bill?.uuid, - patientName: bill?.patient?.display.split('-')?.[1], - identifier: bill?.patient?.display.split('-')?.[0], - patientUuid: bill?.patient?.uuid, - status: - bill.lineItems.length > 1 - ? bill.lineItems.some((item) => item.paymentStatus === 'PENDING') - ? 'PENDING' - : 'PAID' - : bill.status, - receiptNumber: bill?.receiptNumber, - cashier: bill?.cashier, - cashPointUuid: bill?.cashPoint?.uuid, - cashPointName: bill?.cashPoint?.name, - cashPointLocation: bill?.cashPoint?.location?.display, - dateCreated: bill?.dateCreated ?? '--', - lineItems: bill.lineItems, - billingService: bill.lineItems.map((bill) => bill.item).join(' '), - payments: bill.payments, - totalAmount: bill?.lineItems?.map((item) => item.price * item.quantity).reduce((prev, curr) => prev + curr, 0), - tenderedAmount: bill?.payments?.map((item) => item.amountTendered).reduce((prev, curr) => prev + curr, 0), - }; - - return mappedBill; - }; - - const formattedBill = data?.data ? mapBillProperties(data?.data) : ({} as MappedBill); - - return { - bill: formattedBill, - error, - isLoading, - isValidating, - mutate, - }; -}; - -export const processBillPayment = (payload, billUuid: string) => { - const url = `/ws/rest/v1/cashier/bill/${billUuid}`; - return openmrsFetch(url, { - method: 'POST', - body: payload, - headers: { - 'Content-Type': 'application/json', - }, - }); -}; - -export function useDefaultFacility() { - const { authenticated } = useSession(); - const url = '/ws/rest/v1/kenyaemr/default-facility'; - const { data, isLoading } = useSWR<{ data: FacilityDetail }>(authenticated ? url : null, openmrsFetch, {}); - return { data: data?.data, isLoading: isLoading }; -} - -export function useFetchSearchResults(searchVal, category) { - let url = ``; - if (category == 'Stock Item') { - url = `/ws/rest/v1/stockmanagement/stockitem?v=default&limit=10&q=${searchVal}`; - } else { - url = `/ws/rest/v1/cashier/billableService?v=custom:(uuid,name,shortName,serviceStatus,serviceType:(display),servicePrices:(uuid,name,price,paymentMode))`; - } - const { data, error, isLoading, isValidating } = useSWR(searchVal ? url : null, openmrsFetch, {}); - - return { data: data?.data, error, isLoading: isLoading, isValidating }; -} - -export const usePatientPaymentInfo = (patientUuid: string) => { - const { currentVisit } = useVisit(patientUuid); - const attributes = currentVisit?.attributes ?? []; - const paymentInformation = attributes - .map((attribute) => ({ - name: attribute.attributeType.name, - value: attribute.value, - })) - .filter(({ name }) => name === 'Insurance scheme' || name === 'Policy Number'); - - return paymentInformation; -}; - -export const processBillItems = (payload) => { - const url = `/ws/rest/v1/cashier/bill`; - return openmrsFetch(url, { - method: 'POST', - body: payload, - headers: { - 'Content-Type': 'application/json', - }, - }); -}; - -export const usePaymentModes = (excludeWaiver: boolean = true) => { - const { excludedPaymentMode } = useConfig(); - const url = `/ws/rest/v1/cashier/paymentMode`; - const { data, isLoading, error, mutate } = useSWR<{ data: { results: Array } }>(url, openmrsFetch, { - errorRetryCount: 2, - }); - const allowedPaymentModes = - excludedPaymentMode?.length > 0 - ? (data?.data?.results.filter((mode) => !excludedPaymentMode.some((excluded) => excluded.uuid === mode.uuid)) ?? - []) - : (data?.data?.results ?? []); - return { - paymentModes: excludeWaiver ? allowedPaymentModes : data?.data?.results, - isLoading, - mutate, - error, - }; -}; - -export const useBillableItems = () => { - const url = `/ws/rest/v1/cashier/billableService?v=custom:(uuid,name,shortName,serviceStatus,serviceType:(display),servicePrices:(uuid,name,price,paymentMode))`; - const { data, isLoading, error } = useSWR<{ data: { results: Array } }>(url, openmrsFetch); - const [searchTerm, setSearchTerm] = useState(''); - const filteredItems = - data?.data?.results?.filter((item) => item.name.toLowerCase().includes(searchTerm.toLowerCase())) ?? []; - return { - lineItems: filteredItems, - isLoading, - error, - searchTerm, - setSearchTerm, - }; -}; -export const useCashPoint = () => { - const url = `/ws/rest/v1/cashier/cashPoint`; - const { data, isLoading, error } = useSWR<{ data: { results: Array } }>(url, openmrsFetch); - - return { isLoading, error, cashPoints: data?.data?.results ?? [] }; -}; - -export const createPatientBill = (payload) => { - const postUrl = `/ws/rest/v1/cashier/bill`; - return openmrsFetch(postUrl, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: payload }); -}; - -export const useConceptAnswers = (conceptUuid: string) => { - const url = `/ws/rest/v1/concept/${conceptUuid}`; - const { data, isLoading, error } = useSWR<{ data: { answers: Array } }>(url, openmrsFetch); - return { conceptAnswers: data?.data?.answers, isLoading, error }; -}; diff --git a/packages/esm-billing-app/src/bills-table/bills-table.component.tsx b/packages/esm-billing-app/src/bills-table/bills-table.component.tsx deleted file mode 100755 index 7ea7559..0000000 --- a/packages/esm-billing-app/src/bills-table/bills-table.component.tsx +++ /dev/null @@ -1,288 +0,0 @@ -import React, { useCallback, useId, useMemo, useState } from 'react'; -import classNames from 'classnames'; -import { - DataTable, - DataTableSkeleton, - Dropdown, - InlineLoading, - Layer, - Pagination, - Search, - Table, - TableBody, - TableCell, - TableContainer, - TableHead, - TableHeader, - TableRow, - Tile, -} from '@carbon/react'; -import { useTranslation } from 'react-i18next'; -import { - useLayoutType, - isDesktop, - useConfig, - usePagination, - ErrorState, - ConfigurableLink, -} from '@openmrs/esm-framework'; -import { EmptyDataIllustration } from '@openmrs/esm-patient-common-lib'; -import { useBills } from '../billing.resource'; -import styles from './bills-table.scss'; - -const filterItems = [ - { id: '', text: 'All bills' }, - { id: 'PENDING', text: 'Pending bills' }, - { id: 'PAID', text: 'Paid bills' }, - { id: 'POSTED', text: 'Posted bills' }, -]; - -type BillTableProps = { - defaultBillPaymentStatus?: string; -}; - -const BillsTable: React.FC = ({ defaultBillPaymentStatus = '' }) => { - const { t } = useTranslation(); - const id = useId(); - const config = useConfig(); - const layout = useLayoutType(); - const responsiveSize = isDesktop(layout) ? 'sm' : 'lg'; - const [billPaymentStatus, setBillPaymentStatus] = useState(defaultBillPaymentStatus); - const pageSizes = config?.bills?.pageSizes ?? [10, 20, 30, 40, 50]; - const [pageSize, setPageSize] = useState(config?.bills?.pageSize ?? 10); - const { bills, isLoading, isValidating, error } = useBills('', billPaymentStatus); - const [searchString, setSearchString] = useState(''); - - const headerData = [ - { - header: t('visitTime', 'Visit time'), - key: 'visitTime', - }, - { - header: t('identifier', 'Identifier'), - key: 'identifier', - }, - { - header: t('name', 'Name'), - key: 'patientName', - }, - { - header: t('billedItems', 'Billed Items'), - key: 'billedItems', - }, - ]; - - const searchResults = useMemo(() => { - if (bills !== undefined && bills.length > 0) { - if (searchString && searchString.trim() !== '') { - const search = searchString.toLowerCase(); - return bills?.filter((activeBillRow) => - Object.entries(activeBillRow).some(([header, value]) => { - if (header === 'patientUuid') { - return false; - } - return `${value}`.toLowerCase().includes(search); - }), - ); - } - } - - return bills; - }, [searchString, bills]); - - const { paginated, goTo, results, currentPage } = usePagination(searchResults, pageSize); - - const setBilledItems = (bill) => - bill?.lineItems?.reduce( - (acc, item) => acc + (acc ? ' & ' : '') + (item.billableService.split(':')[1] || item.item.split(':')[1] || ''), - '', - ); - - const billingUrl = '${openmrsSpaBase}/home/billing/patient/${patientUuid}/${uuid}'; - - const rowData = results?.map((bill, index) => ({ - id: `${index}`, - uuid: bill.uuid, - patientName: ( - - {bill.patientName} - - ), - visitTime: bill.dateCreated, - identifier: bill.identifier, - department: '--', - billedItems: setBilledItems(bill), - billingPrice: '--', - })); - - const handleSearch = useCallback( - (e) => { - goTo(1); - setSearchString(e.target.value); - }, - [goTo, setSearchString], - ); - - const handleFilterChange = ({ selectedItem }) => setBillPaymentStatus(selectedItem.id); - - if (isLoading) { - return ( -
- -
- ); - } - - if (error) { - return ( -
- - - -
- ); - } - - return ( - <> -
- item.id === billPaymentStatus)} - items={filterItems} - itemToString={(item) => (item ? item.text : '')} - label="" - onChange={handleFilterChange} - size={responsiveSize} - titleText={t('filterBy', 'Filter by') + ':'} - type="inline" - /> -
- - {bills?.length > 0 ? ( -
- - 1 ? true : false}> - {({ rows, headers, getRowProps, getTableProps }) => ( - - - - - {headers.map((header) => ( - {header.header} - ))} - - - - {rows.map((row) => ( - - {row.cells.map((cell) => ( - {cell.value} - ))} - - ))} - -
-
- )} -
- {searchResults?.length === 0 && ( -
- - -

- {t('noMatchingBillsToDisplay', 'No matching bills to display')} -

-

{t('checkFilters', 'Check the filters above')}

-
-
-
- )} - {paginated && ( - { - if (newPageSize !== pageSize) { - setPageSize(newPageSize); - } - if (newPage !== currentPage) { - goTo(newPage); - } - }} - /> - )} -
- ) : ( - - -
- -
-

There are no bills to display.

-
-
- )} - - ); -}; - -function FilterableTableHeader({ layout, handleSearch, isValidating, responsiveSize, t }) { - return ( - <> -
-
-

{t('billList', 'Bill list')}

-
-
- {isValidating ? : null} -
-
- - - ); -} - -export default BillsTable; diff --git a/packages/esm-billing-app/src/bills-table/bills-table.scss b/packages/esm-billing-app/src/bills-table/bills-table.scss deleted file mode 100755 index bbb9af0..0000000 --- a/packages/esm-billing-app/src/bills-table/bills-table.scss +++ /dev/null @@ -1,181 +0,0 @@ -@use '@carbon/layout'; -@use '@carbon/type'; -@import '~@openmrs/esm-styleguide/src/vars'; - -.container { - margin: 2rem 0; -} - -.emptyStateContainer, -.loaderContainer { - @extend .container; -} - -.billListContainer { - background-color: $ui-02; - border: 1px solid $ui-03; - width: 100%; - margin: 0 auto; - max-width: 95vw; - padding-bottom: 0; - - :has(.filterEmptyState) { - border-bottom: none; - } -} - -.filterContainer { - flex: 1; - - :global(.cds--dropdown__wrapper--inline) { - gap: 0; - } - - :global(.cds--list-box__menu-icon) { - height: 1rem; - } - - :global(.cds--list-box__menu) { - min-width: max-content; - } - - :global(.cds--list-box) { - margin-left: layout.$spacing-03; - } -} - -.menu { - margin-left: layout.$spacing-03; -} - -.headerContainer { - display: flex; - justify-content: space-between; - align-items: center; - padding: layout.$spacing-04 layout.$spacing-05; - background-color: $ui-02; -} - -.backgroundDataFetchingIndicator { - align-items: center; - display: flex; - flex: 1; - justify-content: space-between; - - &:global(.cds--inline-loading) { - max-height: 1rem; - } -} - -.tableContainer section { - position: relative; -} - -.tableContainer a { - text-decoration: none; -} - -.pagination { - overflow: hidden; - - &:global(.cds--pagination) { - border-top: none; - } -} - -.hiddenRow { - display: none; -} - -.emptyRow { - padding: 0 1rem; - display: flex; - align-items: center; -} - -.visitSummaryContainer { - width: 100%; - max-width: 768px; - margin: 1rem auto; -} - -.expandedActiveVisitRow > td > div { - max-height: max-content !important; -} - -.expandedActiveVisitRow td { - padding: 0 2rem; -} - -.expandedActiveVisitRow th[colspan] td[colspan] > div:first-child { - padding: 0 1rem; -} - -.action { - margin-bottom: layout.$spacing-03; -} - -.illo { - margin-top: layout.$spacing-05; -} - -.content { - @include type.type-style('heading-compact-01'); - color: $text-02; - margin-top: layout.$spacing-05; - margin-bottom: layout.$spacing-03; -} - -.desktopHeading, -.tabletHeading { - text-align: left; - text-transform: capitalize; - flex: 1; - - h4 { - @include type.type-style('heading-compact-02'); - color: $text-02; - - &:after { - content: ''; - display: block; - width: 2rem; - padding-top: 3px; - border-bottom: 0.375rem solid; - @include brand-03(border-bottom-color); - } - } -} - -.tile { - text-align: center; - border: 1px solid $ui-03; -} - -.menuitem { - max-width: none; -} - -.filterEmptyState { - display: flex; - justify-content: center; - align-items: center; - padding: layout.$spacing-05; - margin: layout.$spacing-09; - text-align: center; -} - -.filterEmptyStateTile { - margin: auto; -} - -.filterEmptyStateContent { - @include type.type-style('heading-compact-02'); - color: $text-02; - margin-bottom: 0.5rem; -} - -.filterEmptyStateHelper { - @include type.type-style('body-compact-01'); - color: $text-02; -} diff --git a/packages/esm-billing-app/src/claims/claims-wrap/claims-main-component.tsx b/packages/esm-billing-app/src/claims/claims-wrap/claims-main-component.tsx deleted file mode 100755 index 65b5fd6..0000000 --- a/packages/esm-billing-app/src/claims/claims-wrap/claims-main-component.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import React, { useEffect, useState } from 'react'; -import styles from './claims-main.scss'; -import { type LineItem, type MappedBill } from '../../types'; -import ClaimsTable from '../dashboard/table/claims-table.component'; -import { useBill } from '../../billing.resource'; -import { useTranslation } from 'react-i18next'; -import ClaimsForm from '../dashboard/form/claims-form.component'; -import MainMetrics from '../metrics/metrics.component'; - -interface ClaimsMainProps { - bill: MappedBill; -} - -const ClaimMainComponent: React.FC = ({ bill }) => { - const [selectedLineItems, setSelectedLineItems] = useState([]); - const { isLoading: isLoadingBill, error } = useBill(bill.uuid); - - const handleSelectItem = (lineItems: Array) => { - setSelectedLineItems(lineItems); - }; - - return ( - <> - -
-
- - -
-
- - ); -}; - -export default ClaimMainComponent; diff --git a/packages/esm-billing-app/src/claims/claims-wrap/claims-main.scss b/packages/esm-billing-app/src/claims/claims-wrap/claims-main.scss deleted file mode 100755 index 001553f..0000000 --- a/packages/esm-billing-app/src/claims/claims-wrap/claims-main.scss +++ /dev/null @@ -1,25 +0,0 @@ -.mainContainer { - display: flex; - margin: 0 auto; - padding: 0 1rem; -} - -.content { - display: flex; - width: 100%; -} - -:global(.omrs-breakpoint-lt-desktop) { - .mainContainer { - flex-direction: column; - } - - .content { - flex-direction: column; - } -} - -.claimContainer, -.form { - flex: 1; -} diff --git a/packages/esm-billing-app/src/claims/dashboard/claims-breakdown/claims-breakdown.component.tsx b/packages/esm-billing-app/src/claims/dashboard/claims-breakdown/claims-breakdown.component.tsx deleted file mode 100755 index bd43261..0000000 --- a/packages/esm-billing-app/src/claims/dashboard/claims-breakdown/claims-breakdown.component.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import React from 'react'; -import styles from './claims-breakdown.scss'; - -type ClaimsBreakDownProps = { - label: string; - value: string; - hasBalance?: Boolean; -}; - -export const ClaimsBreakDown: React.FC = ({ label, value, hasBalance }) => { - return ( -
-
- {label}: - {value} -
-
- ); -}; diff --git a/packages/esm-billing-app/src/claims/dashboard/claims-breakdown/claims-breakdown.scss b/packages/esm-billing-app/src/claims/dashboard/claims-breakdown/claims-breakdown.scss deleted file mode 100755 index 086d74c..0000000 --- a/packages/esm-billing-app/src/claims/dashboard/claims-breakdown/claims-breakdown.scss +++ /dev/null @@ -1,35 +0,0 @@ -@use '@carbon/colors'; -@use '@carbon/layout'; -@use '@carbon/type'; - -.claimsBreakdownContainer { - display: flex; - justify-content: flex-end; - padding: layout.$spacing-09 !important; -} - -.claimsBreakdown { - display: grid; - grid-template-columns: 1fr 1fr; - align-items: flex-end; - margin-right: auto; -} - -.label { - @include type.type-style('heading-03'); - color: colors.$gray-100; - text-align: end; -} - -.value { - @extend .label; - font-weight: bold; - margin-left: layout.$spacing-03; - text-align: start; -} - -.extendedLabel { - @extend .label; - font-weight: bold; - color: crimson; -} diff --git a/packages/esm-billing-app/src/claims/dashboard/claims-dashboard.component.tsx b/packages/esm-billing-app/src/claims/dashboard/claims-dashboard.component.tsx deleted file mode 100755 index dc87cbe..0000000 --- a/packages/esm-billing-app/src/claims/dashboard/claims-dashboard.component.tsx +++ /dev/null @@ -1,41 +0,0 @@ -import React from 'react'; -import { useParams } from 'react-router-dom'; -import { useTranslation } from 'react-i18next'; -import { usePatient, ErrorState } from '@openmrs/esm-framework'; -import styles from './header/claims-header.scss'; -import { InlineLoading } from '@carbon/react'; -import { useBill } from '../../billing.resource'; -import ClaimsHeader from './header/claims-header.component'; - -const ClaimScreen: React.FC = () => { - const { billUuid, patientUuid } = useParams(); - const { t } = useTranslation(); - - const { patient, isLoading: isLoadingPatient } = usePatient(patientUuid); - const { bill, isLoading: isLoadingBill, error } = useBill(billUuid); - - if (isLoadingPatient && isLoadingBill) { - return ( -
- -
- ); - } - - if (error) { - return ( -
- -
- ); - } - - return ; -}; - -export default ClaimScreen; diff --git a/packages/esm-billing-app/src/claims/dashboard/form/claims-form.component.tsx b/packages/esm-billing-app/src/claims/dashboard/form/claims-form.component.tsx deleted file mode 100755 index 8c315d9..0000000 --- a/packages/esm-billing-app/src/claims/dashboard/form/claims-form.component.tsx +++ /dev/null @@ -1,396 +0,0 @@ -import React, { useEffect, useMemo, useState } from 'react'; -import { useTranslation } from 'react-i18next'; -import { - Column, - TextArea, - Form, - Layer, - Stack, - TextInput, - Row, - ButtonSet, - Button, - FilterableMultiSelect, - MultiSelect, - InlineLoading, -} from '@carbon/react'; -import styles from './claims-form.scss'; -import { type MappedBill, type LineItem } from '../../../types'; -import { navigate, showSnackbar } from '@openmrs/esm-framework'; -import { useSystemSetting } from '../../../hooks/getMflCode'; -import { useParams } from 'react-router-dom'; -import { processClaims, useProviders, useVisit } from './claims-form.resource'; -import { useForm, Controller } from 'react-hook-form'; -import { z } from 'zod'; -import { zodResolver } from '@hookform/resolvers/zod'; -import { extractNameString, formatDate } from '../../../helpers/functions'; - -type ClaimsFormProps = { - bill: MappedBill; - selectedLineItems: LineItem[]; -}; - -const ClaimsFormSchema = z.object({ - claimCode: z.string().nonempty({ message: 'Claim code is required' }), - guaranteeId: z.string().nonempty({ message: 'Guarantee Id is required' }), - claimExplanation: z.string().nonempty({ message: 'Claim explanation is required' }), - claimJustification: z.string().nonempty({ message: 'Claim justification is required' }), - providerName: z - .array( - z.object({ - id: z.string(), - text: z.string(), - }), - ) - .nonempty({ message: 'At least one provider is required' }), - diagnoses: z - .array( - z.object({ - id: z.string(), - text: z.string(), - }), - ) - .nonempty({ message: 'At least one diagnosis is required' }), - visitType: z.string().nonempty({ message: 'Visit type is required' }), - facility: z.string().nonempty({ message: 'Facility is required' }), - treatmentStart: z.string().nonempty({ message: 'Treatment start date is required' }), - treatmentEnd: z.string().nonempty({ message: 'Treatment end date is required' }), -}); - -const ClaimsForm: React.FC = ({ bill, selectedLineItems }) => { - const { t } = useTranslation(); - const { mflCodeValue } = useSystemSetting('facility.mflcode'); - const { patientUuid, billUuid } = useParams(); - const { visits: recentVisit } = useVisit(patientUuid); - const visitUuid = recentVisit?.visitType.uuid; - - const { data } = useProviders(); - const [loading, setLoading] = useState(false); - const providers = data?.data.results.map((provider) => ({ id: provider.uuid, text: provider.display })) || []; - - const handleNavigateToBillingOptions = () => - navigate({ - to: window.getOpenmrsSpaBase() + `home/billing/patient/${patientUuid}/${billUuid}`, - }); - - const diagnoses = useMemo(() => { - return ( - recentVisit?.encounters?.flatMap( - (encounter) => - encounter.diagnoses.map((diagnosis) => ({ - id: diagnosis.diagnosis.coded.uuid, - text: diagnosis.display, - certainty: diagnosis.certainty, - })) || [], - ) || [] - ); - }, [recentVisit]); - - const confirmedDiagnoses = useMemo(() => { - return diagnoses.filter((diagnosis) => diagnosis.certainty === 'CONFIRMED'); - }, [diagnoses]); - - const { - control, - handleSubmit, - formState: { errors, isValid }, - setValue, - reset, - } = useForm({ - mode: 'all', - resolver: zodResolver(ClaimsFormSchema), - defaultValues: { - claimCode: '', - guaranteeId: '', - claimExplanation: '', - claimJustification: '', - providerName: [], - diagnoses: [], - visitType: recentVisit?.visitType?.display || '', - facility: `${recentVisit?.location?.display || ''} - ${mflCodeValue || ''}`, - treatmentStart: recentVisit?.startDatetime ? formatDate(recentVisit.startDatetime) : '', - treatmentEnd: recentVisit?.stopDatetime ? formatDate(recentVisit.stopDatetime) : '', - }, - }); - - const onSubmit = async (data) => { - setLoading(true); - const providedItems = selectedLineItems.reduce((acc, item) => { - acc[item.uuid] = { - items: [ - { - uuid: item.itemOrServiceConceptUuid, - price: item.price, - quantity: item.quantity, - }, - ], - explanation: data.claimExplanation, - justification: data.claimJustification, - }; - return acc; - }, {}); - - const payload = { - providedItems, - claimExplanation: data.claimExplanation, - claimJustification: data.claimJustification, - startDate: data.treatmentStart, - endDate: data.treatmentEnd, - location: mflCodeValue, - diagnoses: data.diagnoses.map((diagnosis) => diagnosis.id), - paidInFacility: true, - patient: patientUuid, - visitType: visitUuid, - guaranteeId: data.guaranteeId, - providers: data.providerName.map((provider) => provider.id), - claimCode: data.claimCode, - use: 'claim', - insurer: 'SHA', - billNumber: billUuid, - }; - try { - await processClaims(payload); - showSnackbar({ - kind: 'success', - title: t('processClaim', 'Process Claim'), - subtitle: t('sendClaim', 'Claim sent successfully'), - timeoutInMs: 3000, - isLowContrast: true, - }); - reset(); - setTimeout(() => { - navigate({ - to: window.getOpenmrsSpaBase() + `home/billing/`, - }); - }, 2000); - } catch (err) { - console.error(err); - showSnackbar({ - kind: 'error', - title: t('claimError', 'Claim Error'), - subtitle: t('sendClaimError', 'Request Failed, Please try later........'), - timeoutInMs: 2500, - isLowContrast: true, - }); - } finally { - setLoading(false); - } - }; - - useEffect(() => { - setValue('diagnoses', confirmedDiagnoses); - setValue('visitType', recentVisit?.visitType?.display || ''); - setValue('facility', `${recentVisit?.location?.display || ''} - ${mflCodeValue || ''}`); - setValue('treatmentStart', recentVisit?.startDatetime ? formatDate(recentVisit.startDatetime) : ''); - setValue('treatmentEnd', recentVisit?.stopDatetime ? formatDate(recentVisit.stopDatetime) : ''); - }, [confirmedDiagnoses, recentVisit, mflCodeValue, setValue]); - return ( -
- - {t('formTitle', 'Fill in the form details')} - - - - ( - - )} - /> - - - - - ( - - )} - /> - - - - - - - ( - - )} - /> - - - - - ( - - )} - /> - - - - - - ( - (item ? item.text : '')} - selectionFeedback="top-after-reopen" - selectedItems={field.value} - onChange={({ selectedItems }) => field.onChange(selectedItems)} - /> - )} - /> - - - - - ( - (item ? extractNameString(item.text) : '')} - selectionFeedback="top-after-reopen" - selectedItems={field.value} - onChange={({ selectedItems }) => field.onChange(selectedItems)} - /> - )} - /> - - - - - - ( - - )} - /> - - - - - ( - - )} - /> - - - - - - ( -