@ampath/esm-dha-workflow-app 4.0.0-next.13 → 4.0.0-next.131
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/1197.js +1 -0
- package/dist/1277.js +1 -0
- package/dist/1277.js.map +1 -0
- package/dist/1558.js +2 -0
- package/dist/{198.js.LICENSE.txt → 1558.js.LICENSE.txt} +0 -10
- package/dist/1558.js.map +1 -0
- package/dist/1729.js +1 -0
- package/dist/1729.js.map +1 -0
- package/dist/182.js +1 -0
- package/dist/182.js.map +1 -0
- package/dist/1826.js +1 -0
- package/dist/1826.js.map +1 -0
- package/dist/1833.js +1 -0
- package/dist/1833.js.map +1 -0
- package/dist/1856.js +1 -0
- package/dist/1856.js.map +1 -0
- package/dist/1925.js +1 -0
- package/dist/1925.js.map +1 -0
- package/dist/2021.js +1 -0
- package/dist/2021.js.map +1 -0
- package/dist/2054.js +1 -0
- package/dist/2054.js.map +1 -0
- package/dist/2177.js +2 -0
- package/dist/2177.js.LICENSE.txt +9 -0
- package/dist/2177.js.map +1 -0
- package/dist/2364.js +2 -0
- package/dist/{200.js.LICENSE.txt → 2364.js.LICENSE.txt} +15 -0
- package/dist/2364.js.map +1 -0
- package/dist/2566.js +1 -0
- package/dist/2566.js.map +1 -0
- package/dist/2801.js +1 -0
- package/dist/2801.js.map +1 -0
- package/dist/2975.js +1 -0
- package/dist/2975.js.map +1 -0
- package/dist/3041.js +1 -0
- package/dist/3041.js.map +1 -0
- package/dist/3099.js +1 -0
- package/dist/3184.js +2 -0
- package/dist/3184.js.map +1 -0
- package/dist/3485.js +1 -0
- package/dist/3485.js.map +1 -0
- package/dist/3654.js +1 -0
- package/dist/3654.js.map +1 -0
- package/dist/4055.js +1 -0
- package/dist/4205.js +1 -0
- package/dist/4205.js.map +1 -0
- package/dist/4225.js +1 -0
- package/dist/4225.js.map +1 -0
- package/dist/4300.js +1 -0
- package/dist/4335.js +1 -0
- package/dist/4353.js +1 -0
- package/dist/4353.js.map +1 -0
- package/dist/4517.js +1 -0
- package/dist/4517.js.map +1 -0
- package/dist/4652.js +1 -0
- package/dist/4674.js +1 -0
- package/dist/4674.js.map +1 -0
- package/dist/4947.js +1 -0
- package/dist/4947.js.map +1 -0
- package/dist/5015.js +1 -0
- package/dist/5015.js.map +1 -0
- package/dist/5422.js +1 -0
- package/dist/5422.js.map +1 -0
- package/dist/5428.js +1 -0
- package/dist/5428.js.map +1 -0
- package/dist/5752.js +1 -0
- package/dist/5752.js.map +1 -0
- package/dist/5851.js +1 -0
- package/dist/5851.js.map +1 -0
- package/dist/6264.js +1 -0
- package/dist/6264.js.map +1 -0
- package/dist/6540.js +2 -0
- package/dist/6540.js.map +1 -0
- package/dist/6606.js +1 -0
- package/dist/6606.js.map +1 -0
- package/dist/693.js +1 -0
- package/dist/693.js.map +1 -0
- package/dist/6991.js +1 -0
- package/dist/6991.js.map +1 -0
- package/dist/7199.js +1 -0
- package/dist/7199.js.map +1 -0
- package/dist/7255.js +1 -0
- package/dist/7255.js.map +1 -0
- package/dist/7258.js +1 -0
- package/dist/7258.js.map +1 -0
- package/dist/7420.js +1 -0
- package/dist/7420.js.map +1 -0
- package/dist/8114.js +1 -0
- package/dist/8114.js.map +1 -0
- package/dist/8339.js +1 -0
- package/dist/8339.js.map +1 -0
- package/dist/8865.js +1 -0
- package/dist/8865.js.map +1 -0
- package/dist/8895.js +1 -0
- package/dist/8895.js.map +1 -0
- package/dist/9037.js +1 -0
- package/dist/9037.js.map +1 -0
- package/dist/9091.js +1 -0
- package/dist/9091.js.map +1 -0
- package/dist/9093.js +1 -0
- package/dist/9093.js.map +1 -0
- package/dist/9117.js +1 -0
- package/dist/9117.js.map +1 -0
- package/dist/9721.js +1 -0
- package/dist/9721.js.map +1 -0
- package/dist/esm-dha-workflow-app.js +1 -0
- package/dist/esm-dha-workflow-app.js.buildmanifest.json +1546 -0
- package/dist/esm-dha-workflow-app.js.map +1 -0
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/routes.json +1 -1
- package/package.json +11 -4
- package/src/accounting/accounting.component.tsx +13 -0
- package/src/admissions/admission-request-list/admission-request-list.scss +0 -0
- package/src/admissions/admission-request-list/admission-request-list.tsx +134 -0
- package/src/admissions/admissions-dashboard.component.scss +15 -0
- package/src/admissions/admissions-dashboard.component.tsx +160 -0
- package/src/admissions/admissions.resource.ts +101 -0
- package/src/admissions/admitted-list/admitted-patients-list.tsx +141 -0
- package/src/admissions/constants/index.ts +33 -0
- package/src/admissions/discharged-list/discharged-list.scss +0 -0
- package/src/admissions/discharged-list/discharged-list.tsx +58 -0
- package/src/admissions/inpatient/admission-history/patient-admission-history.tsx +76 -0
- package/src/admissions/inpatient/admission-requests/patient-admission-requests.scss +19 -0
- package/src/admissions/inpatient/admission-requests/patient-admission-requests.tsx +72 -0
- package/src/admissions/inpatient/inpatient-admissions.component.scss +7 -0
- package/src/admissions/inpatient/inpatient-admissions.component.tsx +46 -0
- package/src/admissions/modal/admit-elsewhere/admit-elsewhere.modal.scss +23 -0
- package/src/admissions/modal/admit-elsewhere/admit-elsewhere.modal.tsx +156 -0
- package/src/admissions/modal/admit-patient/admit-patient.modal.scss +0 -0
- package/src/admissions/modal/admit-patient/admit-patient.modal.tsx +109 -0
- package/src/admissions/modal/bed-swap/bed-swap.modal.scss +0 -0
- package/src/admissions/modal/bed-swap/bed-swap.modal.tsx +102 -0
- package/src/admissions/modal/cancel-admission-request/cancel-admission-request.scss +11 -0
- package/src/admissions/modal/cancel-admission-request/cancel-admission-request.tsx +105 -0
- package/src/admissions/modal/discharge/discharge-patient.modal.scss +13 -0
- package/src/admissions/modal/discharge/discharge-patient.modal.tsx +84 -0
- package/src/admissions/types/index.ts +192 -0
- package/src/appointments/appointments.component.tsx +13 -0
- package/src/billing/api/billing.api.ts +95 -0
- package/src/billing/billing-root.tsx +20 -0
- package/src/billing/dashboard/billingDashboard.component.scss +0 -0
- package/src/billing/dashboard/billingDashboard.component.tsx +25 -0
- package/src/billing/extensions/visit-billing/visit-billing.extension.scss +0 -0
- package/src/billing/extensions/visit-billing/visit-billing.extension.tsx +409 -0
- package/src/billing/invoice/bill.resource.ts +47 -0
- package/src/billing/invoice/invoice-header/header-card/header-card.scss +17 -0
- package/src/billing/invoice/invoice-header/header-card/header-card.tsx +21 -0
- package/src/billing/invoice/invoice.scss +113 -0
- package/src/billing/invoice/invoice.tsx +1371 -0
- package/src/billing/invoice/line-items/line-items.scss +0 -0
- package/src/billing/invoice/line-items/line-items.tsx +120 -0
- package/src/billing/invoice/modal/delete-bill-item/delete-bill-item.modal.scss +23 -0
- package/src/billing/invoice/modal/delete-bill-item/delete-bill-item.modal.tsx +114 -0
- package/src/billing/invoice/modal/edit-bill-item/edit-bill-item.modal.scss +0 -0
- package/src/billing/invoice/modal/edit-bill-item/edit-bill-item.modal.tsx +122 -0
- package/src/billing/invoice/payment-details/payment-details.scss +0 -0
- package/src/billing/invoice/payment-details/payment-details.tsx +43 -0
- package/src/billing/invoice/print-invoice/print-receipt.component.tsx +44 -0
- package/src/billing/invoice/print-invoice/print-receipt.scss +14 -0
- package/src/billing/types/index.ts +84 -0
- package/src/billing/utils/index.ts +17 -0
- package/src/billing/widgets/billingTotalsRow.component.scss +0 -0
- package/src/billing/widgets/billingTotalsRow.component.tsx +712 -0
- package/src/billing/workspaces/create-order-bill-form-workspace/create-order-bill-form.resource.ts +85 -0
- package/src/billing/workspaces/create-order-bill-form-workspace/create-order-bill-form.scss +58 -0
- package/src/billing/workspaces/create-order-bill-form-workspace/create-order-bill-form.workspace.tsx +330 -0
- package/src/billing/workspaces/create-order-bill-form-workspace/schema.ts +11 -0
- package/src/bookings/bookings.component.scss +7 -0
- package/src/bookings/bookings.component.tsx +31 -0
- package/src/bookings/daily/daily-bookings.component.scss +38 -0
- package/src/bookings/daily/daily-bookings.component.tsx +138 -0
- package/src/bookings/daily/daily-bookings.resource.ts +28 -0
- package/src/bookings/daily/filters/daily-bookings-filter.component.scss +15 -0
- package/src/bookings/daily/filters/daily-bookings-filter.component.tsx +80 -0
- package/src/bookings/daily/patient-list/daily-bookings-patient-list.component.tsx +97 -0
- package/src/bookings/types/index.ts +68 -0
- package/src/config-schema.ts +186 -32
- package/src/createDashboardLink.tsx +9 -0
- package/src/dashboard/charts/chart.component.scss +13 -0
- package/src/dashboard/charts/chart.component.tsx +54 -0
- package/src/dashboard/dashboard.component.scss +7 -0
- package/src/dashboard/dashboard.component.tsx +51 -0
- package/src/dashboard/overview/overview.component.scss +147 -0
- package/src/dashboard/overview/overview.component.tsx +115 -0
- package/src/dashboard/patient-list/patient-list.component.tsx +41 -0
- package/src/dashboard-meta/accounting-dashboard.meta.ts +6 -0
- package/src/dashboard-meta/admissions-dashboard.meta.ts +6 -0
- package/src/dashboard-meta/billing-dashboard.meta.ts +6 -0
- package/src/dashboard-meta/bookings-dashboard.meta.ts +6 -0
- package/src/dashboard-meta/consultation-dashboard.meta.ts +6 -0
- package/src/dashboard-meta/dha-workflow-dashboard.meta.ts +6 -0
- package/src/dashboard-meta/inpatient-admissions.meta.ts +6 -0
- package/src/dashboard-meta/mch-dashboard.meta.ts +6 -0
- package/src/dashboard-meta/pharmacy-dashboard.meta.ts +6 -0
- package/src/dashboard-meta/queue-dashboard.meta.ts +6 -0
- package/src/dashboard-meta/registers-dashboard.meta.ts +6 -0
- package/src/dashboard-meta/registry-dashboard.meta.ts +6 -0
- package/src/dashboard-meta/service-queue-admin.meta.ts +6 -0
- package/src/dashboard-meta/triage-dashboard.meta.ts +6 -0
- package/src/hooks/useActions.ts +165 -0
- package/src/index.ts +113 -1
- package/src/laboratory/laboratory.component.tsx +13 -0
- package/src/left-panel/left-panel.component.tsx +0 -2
- package/src/mch/mch-queues.component.scss +7 -0
- package/src/mch/mch-queues.component.tsx +32 -0
- package/src/mch/queues/consultation/mch-consultation.tsx +18 -0
- package/src/mch/queues/triage/mch-triage.tsx +15 -0
- package/src/modals/sign-off-modal.scss +7 -0
- package/src/modals/sign-off-modal.tsx +52 -0
- package/src/mortuary/mortuary.component.tsx +13 -0
- package/src/pharmacy/pharmacy.component.tsx +13 -0
- package/src/registers/registers.component.tsx +8 -0
- package/src/registry/eligibility/eliigibility-tags/eligibility-tags.scss +6 -0
- package/src/registry/eligibility/eliigibility-tags/eligibility-tags.tsx +137 -0
- package/src/registry/eligibility/modal/eligibility-details.modal.scss +38 -0
- package/src/registry/eligibility/modal/eligibility-details.modal.tsx +131 -0
- package/src/registry/modal/client-details-modal/client-details-modal.tsx +9 -26
- package/src/registry/modal/otp-verification-modal/otp-verification-modal.scss +31 -1
- package/src/registry/modal/otp-verification-modal/otp-verification-modal.tsx +145 -58
- package/src/registry/modal/send-to-triage/send-to-triage.modal.scss +16 -1
- package/src/registry/modal/send-to-triage/send-to-triage.modal.tsx +681 -97
- package/src/registry/payment-details/payment-options/payment-options.scss +13 -0
- package/src/registry/payment-details/payment-options/payment-options.tsx +61 -14
- package/src/registry/registry.component.scss +18 -1
- package/src/registry/registry.component.tsx +242 -111
- package/src/registry/registry.resource.ts +8 -5
- package/src/registry/types/index.ts +179 -1
- package/src/registry/utils/error-handler.ts +33 -0
- package/src/registry/utils/format-dependant-display-data.ts +8 -0
- package/src/registry/utils/hie-client-adapter.ts +312 -0
- package/src/registry/utils/mask-data.ts +11 -0
- package/src/resources/dashboard.resource.ts +20 -0
- package/src/resources/hie-amrs-automatic-registration.service.ts +16 -0
- package/src/resources/identifier-types.ts +29 -0
- package/src/resources/patient-resource.ts +62 -0
- package/src/resources/queue.resource.ts +23 -0
- package/src/resources/superset.resource.ts +20 -0
- package/src/resources/visit.resource.ts +19 -1
- package/src/root.component.tsx +32 -6
- package/src/routes.json +215 -7
- package/src/service-queues/action-button.component.tsx +34 -0
- package/src/service-queues/action-overflow-menu-item.component.tsx +34 -0
- package/src/service-queues/admin/queue/modal/create-queue/create-queue.modal.scss +31 -0
- package/src/service-queues/admin/queue/modal/create-queue/create-queue.modal.tsx +142 -0
- package/src/service-queues/admin/queue/modal/edit-queue/edit-queue.modal.scss +0 -0
- package/src/service-queues/admin/queue/modal/edit-queue/edit-queue.modal.tsx +150 -0
- package/src/service-queues/admin/queue/queue-list/queue-list.scss +33 -0
- package/src/service-queues/admin/queue/queue-list/queue-list.tsx +113 -0
- package/src/service-queues/admin/queue-entry/queue-entry-list.component.scss +6 -0
- package/src/service-queues/admin/queue-entry/queue-entry-list.component.tsx +137 -0
- package/src/service-queues/admin/queue-room/modal/create-queue-room/create-queue-room.modal.scss +31 -0
- package/src/service-queues/admin/queue-room/modal/create-queue-room/create-queue-room.modal.tsx +137 -0
- package/src/service-queues/admin/queue-room/modal/edit-queue-room/edit-queue-room.modal.scss +0 -0
- package/src/service-queues/admin/queue-room/modal/edit-queue-room/edit-queue-room.modal.tsx +146 -0
- package/src/service-queues/admin/queue-room/queue-room-list/queue-room-list.scss +22 -0
- package/src/service-queues/admin/queue-room/queue-room-list/queue-room-list.tsx +120 -0
- package/src/service-queues/admin/service-queue-admin-dashboard.component.scss +6 -0
- package/src/service-queues/admin/service-queue-admin-dashboard.component.tsx +34 -0
- package/src/service-queues/consultation/consultation.component.scss +7 -0
- package/src/service-queues/consultation/consultation.component.tsx +15 -0
- package/src/service-queues/extensions/service-queue-patient-banner/service-queue-patient-banner.scss +30 -0
- package/src/service-queues/extensions/service-queue-patient-banner/service-queue-patient-banner.tsx +108 -0
- package/src/service-queues/metrics/metrics-cards/attended-patients.extension.tsx +38 -0
- package/src/service-queues/metrics/metrics-cards/metrics-card.component.tsx +86 -0
- package/src/service-queues/metrics/metrics-cards/metrics-card.scss +106 -0
- package/src/service-queues/metrics/metrics-cards/waiting-patients.extension.tsx +34 -0
- package/src/service-queues/metrics/metrics-container.component.tsx +23 -0
- package/src/service-queues/metrics/metrics-container.scss +36 -0
- package/src/service-queues/metrics/metrics.resource.ts +65 -0
- package/src/service-queues/modals/daily-report-patient-list/daily-report-patient-list.scss +26 -0
- package/src/service-queues/modals/daily-report-patient-list/daily-report-patient-list.tsx +108 -0
- package/src/service-queues/modals/move/move-patient.component.scss +35 -0
- package/src/service-queues/modals/move/move-patient.component.tsx +152 -0
- package/src/service-queues/modals/serve/serve-patient.comppnent.scss +0 -0
- package/src/service-queues/modals/serve/serve-patient.comppnent.tsx +80 -0
- package/src/service-queues/modals/sign-off/sign-off.modal.scss +0 -0
- package/src/service-queues/modals/sign-off/sign-off.modal.tsx +79 -0
- package/src/service-queues/modals/transition/transition-patient.component.scss +0 -0
- package/src/service-queues/modals/transition/transition-patient.component.tsx +122 -0
- package/src/service-queues/queue-list/check-in.service.ts +26 -0
- package/src/service-queues/queue-list/queue-list.component.scss +36 -0
- package/src/service-queues/queue-list/queue-list.component.tsx +249 -0
- package/src/service-queues/queue-room.component.tsx +39 -0
- package/src/service-queues/room/room.component.tsx +58 -0
- package/src/service-queues/service-queue/service-queue.component.scss +14 -0
- package/src/service-queues/service-queue/service-queue.component.tsx +399 -0
- package/src/service-queues/service-queue/stats/stat-details/stat-details.component.scss +12 -0
- package/src/service-queues/service-queue/stats/stat-details/stat-details.component.tsx +63 -0
- package/src/service-queues/service-queue.scss +27 -0
- package/src/service-queues/service-queue.tsx +37 -0
- package/src/service-queues/service-queues.resource.ts +361 -0
- package/src/service-queues/service.resource.ts +28 -0
- package/src/shared/constants/civil-status.ts +29 -0
- package/src/shared/constants/concepts.ts +15 -0
- package/src/shared/constants/index.ts +1 -2
- package/src/shared/constants/patient-category.ts +6 -0
- package/src/shared/constants/person-attributes.ts +33 -0
- package/src/shared/constants/visit-types.ts +7 -0
- package/src/shared/services/billing.resource.ts +38 -0
- package/src/shared/services/client-payment-mode.resource.ts +27 -0
- package/src/shared/services/client-payment.resource.ts +17 -0
- package/src/shared/services/eligibility.resource.ts +19 -0
- package/src/shared/services/encounters.resource.ts +27 -0
- package/src/shared/services/location.resource.ts +9 -0
- package/src/shared/types/index.ts +152 -0
- package/src/shared/ui/aggregate-stat-card/aggregate-stat-card.scss +42 -0
- package/src/shared/ui/aggregate-stat-card/aggregate-stat-card.tsx +42 -0
- package/src/shared/ui/confirm-modal/confirm.modal.scss +18 -0
- package/src/shared/ui/confirm-modal/confirm.modal.tsx +38 -0
- package/src/shared/ui/otp-input/otp-input.component.scss +14 -0
- package/src/shared/ui/otp-input/otp-input.component.tsx +90 -0
- package/src/shared/ui/stat-card/stat-card.component.scss +10 -0
- package/src/shared/ui/stat-card/stat-card.component.tsx +26 -0
- package/src/shared/ui/timer/timer.component.scss +5 -0
- package/src/shared/ui/timer/timer.component.tsx +40 -0
- package/src/shared/utils/get-base-url.ts +27 -0
- package/src/shared/utils/get-tag-type.ts +66 -0
- package/src/side-nav-menu/nav-link-config.ts +6 -4
- package/src/triage/metrics/attended-patients.extension.tsx +42 -0
- package/src/triage/metrics/metrics.scss +36 -0
- package/src/triage/metrics/triage-metrics.component.tsx +21 -0
- package/src/triage/metrics/waiting-patients.extension.tsx +39 -0
- package/src/triage/room/room.scss +29 -0
- package/src/triage/triage.component.tsx +15 -0
- package/src/triage/triage.resource.ts +19 -0
- package/src/triage/types.ts +16 -0
- package/src/types/types.ts +180 -0
- package/dist/16.js +0 -1
- package/dist/16.js.map +0 -1
- package/dist/184.js +0 -2
- package/dist/184.js.map +0 -1
- package/dist/197.js +0 -1
- package/dist/198.js +0 -2
- package/dist/198.js.map +0 -1
- package/dist/200.js +0 -2
- package/dist/200.js.map +0 -1
- package/dist/255.js +0 -1
- package/dist/255.js.map +0 -1
- package/dist/300.js +0 -1
- package/dist/335.js +0 -1
- package/dist/353.js +0 -1
- package/dist/353.js.map +0 -1
- package/dist/420.js +0 -1
- package/dist/420.js.map +0 -1
- package/dist/540.js +0 -2
- package/dist/540.js.map +0 -1
- package/dist/55.js +0 -1
- package/dist/652.js +0 -1
- package/dist/860.js +0 -1
- package/dist/860.js.map +0 -1
- package/dist/91.js +0 -1
- package/dist/91.js.map +0 -1
- package/dist/93.js +0 -1
- package/dist/93.js.map +0 -1
- package/dist/99.js +0 -1
- package/dist/openmrs-esm-home-app.js +0 -1
- package/dist/openmrs-esm-home-app.js.buildmanifest.json +0 -626
- package/dist/openmrs-esm-home-app.js.map +0 -1
- package/src/consultation/consultation.tsx +0 -7
- /package/dist/{184.js.LICENSE.txt → 3184.js.LICENSE.txt} +0 -0
- /package/dist/{540.js.LICENSE.txt → 6540.js.LICENSE.txt} +0 -0
|
File without changes
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { type CreateQueueDto, type Queue } from '../../../../../types/types';
|
|
3
|
+
import { Modal, ModalBody, Select, SelectItem, TextInput } from '@carbon/react';
|
|
4
|
+
import styles from './edit-queue.modal.scss';
|
|
5
|
+
import { QUEUE_SERVICE_UUIDS } from '../../../../../shared/constants/concepts';
|
|
6
|
+
import { showSnackbar, useSession } from '@openmrs/esm-framework';
|
|
7
|
+
import { editQueue } from '../../../../service-queues.resource';
|
|
8
|
+
|
|
9
|
+
interface EditQueueModalProps {
|
|
10
|
+
open: boolean;
|
|
11
|
+
queue: Queue;
|
|
12
|
+
onModalClose: () => void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const EditQueueModal: React.FC<EditQueueModalProps> = ({ open, queue, onModalClose }) => {
|
|
16
|
+
const session = useSession();
|
|
17
|
+
const location = session.sessionLocation;
|
|
18
|
+
const [queueName, setQueueName] = useState<string>(queue.name);
|
|
19
|
+
const [description, setDescription] = useState<string>(queue.description);
|
|
20
|
+
const [queueService, setQueueService] = useState<string>();
|
|
21
|
+
|
|
22
|
+
const handleQueueName = (queueName: string) => {
|
|
23
|
+
setQueueName(queueName);
|
|
24
|
+
};
|
|
25
|
+
const handleQueueDescription = (queueDescription: string) => {
|
|
26
|
+
setDescription(queueDescription);
|
|
27
|
+
};
|
|
28
|
+
const handleQueueService = (queueServiceUuid: string) => {
|
|
29
|
+
setQueueService(queueServiceUuid);
|
|
30
|
+
};
|
|
31
|
+
if (!queue) {
|
|
32
|
+
return <>No Queue selected</>;
|
|
33
|
+
}
|
|
34
|
+
const handleUpdateQueue = async () => {
|
|
35
|
+
const payload = generateCreateQueuePayload();
|
|
36
|
+
if (isValidateEditQueueDto(payload)) {
|
|
37
|
+
const resp = await editQueue(queue.uuid, payload);
|
|
38
|
+
if (resp) {
|
|
39
|
+
showAlert('Queue updated successfully!', 'success');
|
|
40
|
+
onModalClose();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
const generateCreateQueuePayload = (): CreateQueueDto => {
|
|
45
|
+
return {
|
|
46
|
+
name: queueName,
|
|
47
|
+
description: description,
|
|
48
|
+
service: {
|
|
49
|
+
uuid: queueService,
|
|
50
|
+
},
|
|
51
|
+
location: {
|
|
52
|
+
uuid: location.uuid,
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
const isValidateEditQueueDto = (payload: CreateQueueDto): boolean => {
|
|
57
|
+
if (!payload.name) {
|
|
58
|
+
showAlert('Please add the queue name', 'error');
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
if (!payload.description) {
|
|
62
|
+
showAlert('Please add the queue description', 'error');
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
if (!payload.service) {
|
|
66
|
+
showAlert('Please add the queue service', 'error');
|
|
67
|
+
return false;
|
|
68
|
+
} else {
|
|
69
|
+
if (!payload.service.uuid) {
|
|
70
|
+
showAlert('Please select as service', 'error');
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return true;
|
|
75
|
+
};
|
|
76
|
+
const showAlert = (message: string, alertType: 'success' | 'error') => {
|
|
77
|
+
showSnackbar({
|
|
78
|
+
kind: alertType,
|
|
79
|
+
title: 'Queue Deleted',
|
|
80
|
+
subtitle: message,
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
return (
|
|
84
|
+
<>
|
|
85
|
+
<Modal
|
|
86
|
+
open={open}
|
|
87
|
+
size="md"
|
|
88
|
+
onSecondarySubmit={() => onModalClose()}
|
|
89
|
+
onRequestClose={() => onModalClose()}
|
|
90
|
+
onRequestSubmit={handleUpdateQueue}
|
|
91
|
+
primaryButtonText="Update Queue"
|
|
92
|
+
secondaryButtonText="Cancel"
|
|
93
|
+
>
|
|
94
|
+
<ModalBody>
|
|
95
|
+
<div className={styles.createQueueModalLayout}>
|
|
96
|
+
<div className={styles.sectionHeader}>
|
|
97
|
+
<h4 className={styles.sectionTitle}>Create Service Queue</h4>
|
|
98
|
+
</div>
|
|
99
|
+
<div className={styles.createQueueModalContentSection}>
|
|
100
|
+
<div className={styles.createQueueModalFormRow}>
|
|
101
|
+
<div className={styles.createQueueModalFormControl}>
|
|
102
|
+
<TextInput
|
|
103
|
+
id="queue-name"
|
|
104
|
+
labelText="Queue Name"
|
|
105
|
+
value={queueName}
|
|
106
|
+
onChange={(e) => handleQueueName(e.target.value)}
|
|
107
|
+
type="text"
|
|
108
|
+
/>
|
|
109
|
+
</div>
|
|
110
|
+
</div>
|
|
111
|
+
<div className={styles.createQueueModalFormRow}>
|
|
112
|
+
<div className={styles.createQueueModalFormControl}>
|
|
113
|
+
<TextInput
|
|
114
|
+
id="description"
|
|
115
|
+
value={description}
|
|
116
|
+
labelText="Description"
|
|
117
|
+
onChange={(e) => handleQueueDescription(e.target.value)}
|
|
118
|
+
type="text"
|
|
119
|
+
/>
|
|
120
|
+
</div>
|
|
121
|
+
</div>
|
|
122
|
+
<div className={styles.createQueueModalFormRow}>
|
|
123
|
+
<div className={styles.createQueueModalFormControl}>
|
|
124
|
+
<Select id="service" labelText="Service" onChange={(e) => handleQueueService(e.target.value)}>
|
|
125
|
+
<SelectItem value="" text="Select Service" />
|
|
126
|
+
<SelectItem value={QUEUE_SERVICE_UUIDS.TRIAGE_SERVICE_UUID} text="Triage Service" />
|
|
127
|
+
<SelectItem
|
|
128
|
+
value={QUEUE_SERVICE_UUIDS.CLINICAL_CONSULTATION_SERVICE_UUID}
|
|
129
|
+
text="Clinical Consultation Service"
|
|
130
|
+
/>
|
|
131
|
+
<SelectItem
|
|
132
|
+
value={QUEUE_SERVICE_UUIDS.MCH_TRIAGE_SERVICE_UUID}
|
|
133
|
+
text="Maternal Child Health Triage Service"
|
|
134
|
+
/>
|
|
135
|
+
<SelectItem
|
|
136
|
+
value={QUEUE_SERVICE_UUIDS.MCH_CLINICAL_CONSULTATION_SERVICE_UUID}
|
|
137
|
+
text="Maternal Child Health Consultation Service"
|
|
138
|
+
/>
|
|
139
|
+
</Select>
|
|
140
|
+
</div>
|
|
141
|
+
</div>
|
|
142
|
+
</div>
|
|
143
|
+
</div>
|
|
144
|
+
</ModalBody>
|
|
145
|
+
</Modal>
|
|
146
|
+
</>
|
|
147
|
+
);
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
export default EditQueueModal;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
.queueListLayout{
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
width: 100%;
|
|
5
|
+
row-gap: 10px;
|
|
6
|
+
.layoutHeader{
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: row;
|
|
9
|
+
justify-content: flex-start;
|
|
10
|
+
width: 100%;
|
|
11
|
+
}
|
|
12
|
+
.layoutAction{
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: row;
|
|
15
|
+
justify-content: flex-end;
|
|
16
|
+
width: 100%;
|
|
17
|
+
column-gap: 5px;
|
|
18
|
+
}
|
|
19
|
+
.tableSection{
|
|
20
|
+
display: flex;
|
|
21
|
+
flex-direction: column;
|
|
22
|
+
width: 100%;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.actionBtns{
|
|
27
|
+
display: flex;
|
|
28
|
+
flex-direction: row;
|
|
29
|
+
column-gap: 10px;
|
|
30
|
+
}
|
|
31
|
+
.iconBtn:hover {
|
|
32
|
+
cursor: pointer;
|
|
33
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { type Queue } from '../../../../types/types';
|
|
3
|
+
import { Button, IconButton, Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@carbon/react';
|
|
4
|
+
import { showNotification, showSnackbar, useSession } from '@openmrs/esm-framework';
|
|
5
|
+
import { deleteQueue, getQueuesByLocationUuid, useQueues } from '../../../service-queues.resource';
|
|
6
|
+
import styles from './queue-list.scss';
|
|
7
|
+
import CreateQueueModal from '../modal/create-queue/create-queue.modal';
|
|
8
|
+
import { Add, Delete, Edit } from '@carbon/react/icons';
|
|
9
|
+
import EditQueueModal from '../modal/edit-queue/edit-queue.modal';
|
|
10
|
+
|
|
11
|
+
interface QueueListProps {}
|
|
12
|
+
|
|
13
|
+
const AdminQueueList: React.FC<QueueListProps> = () => {
|
|
14
|
+
const session = useSession();
|
|
15
|
+
const locationUuid = session.sessionLocation.uuid;
|
|
16
|
+
const [queues, setQueues] = useState<Queue[]>([]);
|
|
17
|
+
const [selectedQueue,setSelectedQueue] = useState<Queue>()
|
|
18
|
+
const [displayCreateQueueModal, setDisplayCreateQueueModal] = useState<boolean>(false);
|
|
19
|
+
const [displayEditQueueModal, setDisplayEditQueueModal] = useState<boolean>(false);
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
fetchQueues();
|
|
22
|
+
}, [locationUuid]);
|
|
23
|
+
|
|
24
|
+
const fetchQueues = async () => {
|
|
25
|
+
const queues = await getQueuesByLocationUuid(locationUuid);
|
|
26
|
+
setQueues(queues);
|
|
27
|
+
};
|
|
28
|
+
const handleDeleteQueue = async (queueUuid: string) => {
|
|
29
|
+
await deleteQueue(queueUuid);
|
|
30
|
+
fetchQueues();
|
|
31
|
+
showAlert('Queue deleted successfully', 'success');
|
|
32
|
+
};
|
|
33
|
+
const handleCloseCreateQueueModal = () => {
|
|
34
|
+
setDisplayCreateQueueModal(false);
|
|
35
|
+
};
|
|
36
|
+
const handleCloseEditQueueModal = () => {
|
|
37
|
+
setDisplayEditQueueModal(false);
|
|
38
|
+
fetchQueues();
|
|
39
|
+
};
|
|
40
|
+
const handleEditQueue = async (queue: Queue) => {
|
|
41
|
+
setSelectedQueue(queue);
|
|
42
|
+
setDisplayEditQueueModal(true);
|
|
43
|
+
};
|
|
44
|
+
const handleAddQueue = async () => {
|
|
45
|
+
setDisplayCreateQueueModal(true);
|
|
46
|
+
fetchQueues();
|
|
47
|
+
};
|
|
48
|
+
const handleRefresh = ()=>{
|
|
49
|
+
fetchQueues();
|
|
50
|
+
}
|
|
51
|
+
const showAlert = (message: string, alertType: 'success' | 'error') => {
|
|
52
|
+
showSnackbar({
|
|
53
|
+
kind: alertType,
|
|
54
|
+
title: 'Queue Deleted',
|
|
55
|
+
subtitle: message,
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
return (
|
|
59
|
+
<>
|
|
60
|
+
<div className={styles.queueListLayout}>
|
|
61
|
+
<div className={styles.layoutHeader}>
|
|
62
|
+
<h4>Queue Management</h4>
|
|
63
|
+
</div>
|
|
64
|
+
<div className={styles.layoutAction}>
|
|
65
|
+
<IconButton label="Add" onClick={() => handleAddQueue()}>
|
|
66
|
+
<Add />
|
|
67
|
+
</IconButton>
|
|
68
|
+
<Button kind='ghost' onClick={handleRefresh}>
|
|
69
|
+
Refresh
|
|
70
|
+
</Button>
|
|
71
|
+
</div>
|
|
72
|
+
<div>
|
|
73
|
+
<Table>
|
|
74
|
+
<TableHead>
|
|
75
|
+
<TableRow>
|
|
76
|
+
<TableHeader>No</TableHeader>
|
|
77
|
+
<TableHeader>Name</TableHeader>
|
|
78
|
+
<TableHeader>Description</TableHeader>
|
|
79
|
+
<TableHeader>Location</TableHeader>
|
|
80
|
+
<TableHeader>Service</TableHeader>
|
|
81
|
+
<TableHeader>Action</TableHeader>
|
|
82
|
+
</TableRow>
|
|
83
|
+
</TableHead>
|
|
84
|
+
<TableBody>
|
|
85
|
+
{queues.map((queue, index) => (
|
|
86
|
+
<TableRow key={queue.uuid}>
|
|
87
|
+
<TableCell>{index + 1}</TableCell>
|
|
88
|
+
<TableCell>{queue.name}</TableCell>
|
|
89
|
+
<TableCell>{queue.description}</TableCell>
|
|
90
|
+
<TableCell>{(queue.location as any).name}</TableCell>
|
|
91
|
+
<TableCell>{queue.service.display}</TableCell>
|
|
92
|
+
<TableCell>
|
|
93
|
+
<div className={styles.actionBtns}>
|
|
94
|
+
<Delete onClick={() => handleDeleteQueue(queue.uuid)} className={styles.iconBtn} />
|
|
95
|
+
<Edit onClick={() => handleEditQueue(queue)} className={styles.iconBtn} />
|
|
96
|
+
</div>
|
|
97
|
+
</TableCell>
|
|
98
|
+
</TableRow>
|
|
99
|
+
))}
|
|
100
|
+
</TableBody>
|
|
101
|
+
</Table>
|
|
102
|
+
</div>
|
|
103
|
+
<CreateQueueModal open={displayCreateQueueModal} onModalClose={handleCloseCreateQueueModal} />
|
|
104
|
+
{
|
|
105
|
+
selectedQueue && displayEditQueueModal ? (<EditQueueModal open={displayEditQueueModal} queue={selectedQueue} onModalClose={handleCloseEditQueueModal} />): (<></>)
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
</div>
|
|
109
|
+
</>
|
|
110
|
+
);
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
export default AdminQueueList;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { formatDate, parseDate, showSnackbar, useSession } from '@openmrs/esm-framework';
|
|
2
|
+
import React, { useEffect, useState } from 'react';
|
|
3
|
+
import { deleteQueueEntry, endQueueEntry, getQueueEntryByLocationUuid } from '../../service-queues.resource';
|
|
4
|
+
import { type QueueEntry } from '../../../types/types';
|
|
5
|
+
import {
|
|
6
|
+
Link,
|
|
7
|
+
OverflowMenu,
|
|
8
|
+
OverflowMenuItem,
|
|
9
|
+
Table,
|
|
10
|
+
TableBody,
|
|
11
|
+
TableCell,
|
|
12
|
+
TableHead,
|
|
13
|
+
TableHeader,
|
|
14
|
+
TableRow,
|
|
15
|
+
} from '@carbon/react';
|
|
16
|
+
import styles from './queue-entry-list.component.scss';
|
|
17
|
+
interface QueueEntryListProps {}
|
|
18
|
+
const QueueEntryList: React.FC<QueueEntryListProps> = () => {
|
|
19
|
+
const session = useSession();
|
|
20
|
+
const locationUuid = session.sessionLocation.uuid;
|
|
21
|
+
const [queueEntryList, setQueueEntryList] = useState<QueueEntry[]>([]);
|
|
22
|
+
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
if (locationUuid) {
|
|
25
|
+
getQueueEntryList(locationUuid);
|
|
26
|
+
}
|
|
27
|
+
}, [locationUuid]);
|
|
28
|
+
|
|
29
|
+
async function getQueueEntryList(locationUuid: string) {
|
|
30
|
+
const resp = await getQueueEntryByLocationUuid(locationUuid);
|
|
31
|
+
if (resp) {
|
|
32
|
+
setQueueEntryList(resp);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
if (!queueEntryList || queueEntryList.length === 0) {
|
|
36
|
+
return <h4>No Data to display</h4>;
|
|
37
|
+
}
|
|
38
|
+
async function handleDeleteQueueEntry(queueEntry: QueueEntry) {
|
|
39
|
+
try {
|
|
40
|
+
await deleteQueueEntry(queueEntry.uuid);
|
|
41
|
+
showSnackbar({
|
|
42
|
+
kind: 'success',
|
|
43
|
+
title: 'Queue entry voided successfully',
|
|
44
|
+
subtitle: 'Queue entry voided successfully',
|
|
45
|
+
});
|
|
46
|
+
} catch (error) {
|
|
47
|
+
showSnackbar({
|
|
48
|
+
kind: 'error',
|
|
49
|
+
title: 'Error voiding Queue entry',
|
|
50
|
+
subtitle: error.message ?? 'An error occurred while voiding the queue entry',
|
|
51
|
+
});
|
|
52
|
+
} finally {
|
|
53
|
+
refreshData();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function refreshData() {
|
|
57
|
+
getQueueEntryList(locationUuid);
|
|
58
|
+
}
|
|
59
|
+
async function handleEndQueueEntry(queueEntry: QueueEntry) {
|
|
60
|
+
try {
|
|
61
|
+
const endedAt = queueEntry.visit.stopDatetime ? queueEntry.visit.stopDatetime : new Date().toISOString();
|
|
62
|
+
await endQueueEntry(queueEntry.uuid, endedAt);
|
|
63
|
+
showSnackbar({
|
|
64
|
+
kind: 'success',
|
|
65
|
+
title: 'Queue entry ended successfully',
|
|
66
|
+
subtitle: 'Queue entry ended successfully',
|
|
67
|
+
});
|
|
68
|
+
} catch (error) {
|
|
69
|
+
showSnackbar({
|
|
70
|
+
kind: 'error',
|
|
71
|
+
title: 'Error closing Queue entry',
|
|
72
|
+
subtitle: error.message ?? 'An error occurred while closing the queue entry',
|
|
73
|
+
});
|
|
74
|
+
} finally {
|
|
75
|
+
refreshData();
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return (
|
|
79
|
+
<>
|
|
80
|
+
<div className={styles.entryListLayout}>
|
|
81
|
+
<Table>
|
|
82
|
+
<TableHead>
|
|
83
|
+
<TableRow>
|
|
84
|
+
<TableHeader>No</TableHeader>
|
|
85
|
+
<TableHeader>Name</TableHeader>
|
|
86
|
+
<TableHeader>Current Queue</TableHeader>
|
|
87
|
+
<TableHeader>Coming From</TableHeader>
|
|
88
|
+
<TableHeader>Status</TableHeader>
|
|
89
|
+
<TableHeader>Priority</TableHeader>
|
|
90
|
+
<TableHeader>Started At</TableHeader>
|
|
91
|
+
<TableHeader>Ended At</TableHeader>
|
|
92
|
+
<TableHeader>Visit End At</TableHeader>
|
|
93
|
+
<TableHeader>Action</TableHeader>
|
|
94
|
+
</TableRow>
|
|
95
|
+
</TableHead>
|
|
96
|
+
<TableBody>
|
|
97
|
+
{queueEntryList &&
|
|
98
|
+
queueEntryList.map((val, index) => (
|
|
99
|
+
<TableRow id={val.uuid}>
|
|
100
|
+
<TableCell>{index + 1}</TableCell>
|
|
101
|
+
<TableCell>
|
|
102
|
+
{val.patient ? (
|
|
103
|
+
<>
|
|
104
|
+
<Link href={`${window.spaBase}/patient/${val.patient.uuid}/chart/`}>
|
|
105
|
+
{val.patient ? val.patient.person.display : val.display}
|
|
106
|
+
</Link>
|
|
107
|
+
</>
|
|
108
|
+
) : (
|
|
109
|
+
<></>
|
|
110
|
+
)}
|
|
111
|
+
</TableCell>
|
|
112
|
+
<TableCell>{val.queue.display}</TableCell>
|
|
113
|
+
<TableCell>{val.queueComingFrom ? val.queueComingFrom.display : ''}</TableCell>
|
|
114
|
+
<TableCell>{val.status.display}</TableCell>
|
|
115
|
+
<TableCell>{val.priority.display}</TableCell>
|
|
116
|
+
<TableCell>{val.startedAt ?? ''}</TableCell>
|
|
117
|
+
<TableCell>{val.endedAt ? formatDate(parseDate(val.endedAt)) : ''}</TableCell>
|
|
118
|
+
<TableCell>
|
|
119
|
+
{val.visit && val.visit.stopDatetime ? formatDate(parseDate(val.visit.stopDatetime)) : ''}
|
|
120
|
+
</TableCell>
|
|
121
|
+
<TableCell>
|
|
122
|
+
<>
|
|
123
|
+
<OverflowMenu aria-label="overflow-menu">
|
|
124
|
+
<OverflowMenuItem itemText="End" onClick={() => handleEndQueueEntry(val)} />
|
|
125
|
+
<OverflowMenuItem itemText="Delete" onClick={() => handleDeleteQueueEntry(val)} />
|
|
126
|
+
</OverflowMenu>
|
|
127
|
+
</>
|
|
128
|
+
</TableCell>
|
|
129
|
+
</TableRow>
|
|
130
|
+
))}
|
|
131
|
+
</TableBody>
|
|
132
|
+
</Table>
|
|
133
|
+
</div>
|
|
134
|
+
</>
|
|
135
|
+
);
|
|
136
|
+
};
|
|
137
|
+
export default QueueEntryList;
|
package/src/service-queues/admin/queue-room/modal/create-queue-room/create-queue-room.modal.scss
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
.createQueueModalLayout{
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
width: 100%;
|
|
5
|
+
row-gap: 10px;
|
|
6
|
+
padding: 15px 15px;
|
|
7
|
+
.sectionHeader{
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
row-gap: 15px;
|
|
11
|
+
width: 100%;
|
|
12
|
+
padding-bottom: 15px;
|
|
13
|
+
}
|
|
14
|
+
.createQueueModalContentSection{
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: column;
|
|
17
|
+
width: 100%;
|
|
18
|
+
row-gap: 10px;
|
|
19
|
+
}
|
|
20
|
+
.createQueueModalFormRow{
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: row;
|
|
23
|
+
width: 100%;
|
|
24
|
+
column-gap: 10px;
|
|
25
|
+
}
|
|
26
|
+
.createQueueModalFormControl{
|
|
27
|
+
display: flex;
|
|
28
|
+
flex-direction: column;
|
|
29
|
+
width: 100%;
|
|
30
|
+
}
|
|
31
|
+
}
|
package/src/service-queues/admin/queue-room/modal/create-queue-room/create-queue-room.modal.tsx
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { Modal, ModalBody, SelectItem, Select, TextInput } from '@carbon/react';
|
|
2
|
+
import React, { useEffect, useState } from 'react';
|
|
3
|
+
import styles from './create-queue-room.modal.scss';
|
|
4
|
+
import { useSession, showSnackbar } from '@openmrs/esm-framework';
|
|
5
|
+
import { type Queue, type CreateQueueRoomDto } from '../../../../../types/types';
|
|
6
|
+
import { createQueueRoom, getQueuesByLocationUuid } from '../../../../service-queues.resource';
|
|
7
|
+
interface CreateQueueRoomModalProps {
|
|
8
|
+
open: boolean;
|
|
9
|
+
onModalClose: () => void;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const CreateQueueRoomModal: React.FC<CreateQueueRoomModalProps> = ({ open, onModalClose }) => {
|
|
13
|
+
const session = useSession();
|
|
14
|
+
const location = session.sessionLocation;
|
|
15
|
+
const locationUuid = location.uuid;
|
|
16
|
+
const [queueRoomName, setQueueRoomName] = useState<string>();
|
|
17
|
+
const [description, setDescription] = useState<string>();
|
|
18
|
+
const [queues, setQueues] = useState<Queue[]>([]);
|
|
19
|
+
const [selectedQueueServiceUuid, setSelectedQueueServiceUuid] = useState<string>();
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
fetchQueues();
|
|
22
|
+
}, [locationUuid]);
|
|
23
|
+
const fetchQueues = async () => {
|
|
24
|
+
const queues = await getQueuesByLocationUuid(locationUuid);
|
|
25
|
+
setQueues(queues);
|
|
26
|
+
};
|
|
27
|
+
const handleQueueRoomName = (queueName: string) => {
|
|
28
|
+
setQueueRoomName(queueName);
|
|
29
|
+
};
|
|
30
|
+
const handleQueueRoomDescription = (queueDescription: string) => {
|
|
31
|
+
setDescription(queueDescription);
|
|
32
|
+
};
|
|
33
|
+
const handleQueueService = (queueServiceUuid: string) => {
|
|
34
|
+
setSelectedQueueServiceUuid(queueServiceUuid);
|
|
35
|
+
};
|
|
36
|
+
const handleCreateQueueRoom = async () => {
|
|
37
|
+
const payload = generateCreateQueueRoomPayload();
|
|
38
|
+
if (isValidateCreateQueueRoomDto(payload)) {
|
|
39
|
+
const resp = await createQueueRoom(payload);
|
|
40
|
+
if (resp) {
|
|
41
|
+
showAlert('Queue Room created successfully!', 'success');
|
|
42
|
+
onModalClose();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
const generateCreateQueueRoomPayload = (): CreateQueueRoomDto => {
|
|
47
|
+
return {
|
|
48
|
+
name: queueRoomName,
|
|
49
|
+
description: description,
|
|
50
|
+
queue: {
|
|
51
|
+
uuid: selectedQueueServiceUuid,
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
const isValidateCreateQueueRoomDto = (payload: CreateQueueRoomDto): boolean => {
|
|
56
|
+
if (!payload.name) {
|
|
57
|
+
showAlert('Please add the queue room name', 'error');
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
if (!payload.description) {
|
|
61
|
+
showAlert('Please add the queue room description', 'error');
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
if (!payload.queue) {
|
|
65
|
+
showAlert('Please add the queue service', 'error');
|
|
66
|
+
return false;
|
|
67
|
+
} else {
|
|
68
|
+
if (!payload.queue.uuid) {
|
|
69
|
+
showAlert('Please select a queue service', 'error');
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return true;
|
|
74
|
+
};
|
|
75
|
+
const showAlert = (message: string, alertType: 'success' | 'error') => {
|
|
76
|
+
showSnackbar({
|
|
77
|
+
kind: alertType,
|
|
78
|
+
title: 'Queue Deleted',
|
|
79
|
+
subtitle: message,
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
return (
|
|
83
|
+
<>
|
|
84
|
+
<Modal
|
|
85
|
+
open={open}
|
|
86
|
+
size="md"
|
|
87
|
+
onSecondarySubmit={() => onModalClose()}
|
|
88
|
+
onRequestClose={() => onModalClose()}
|
|
89
|
+
onRequestSubmit={handleCreateQueueRoom}
|
|
90
|
+
primaryButtonText="Create Queue Room"
|
|
91
|
+
secondaryButtonText="Cancel"
|
|
92
|
+
>
|
|
93
|
+
<ModalBody>
|
|
94
|
+
<div className={styles.createQueueModalLayout}>
|
|
95
|
+
<div className={styles.sectionHeader}>
|
|
96
|
+
<h4 className={styles.sectionTitle}>Create Queue Room</h4>
|
|
97
|
+
</div>
|
|
98
|
+
<div className={styles.createQueueModalContentSection}>
|
|
99
|
+
<div className={styles.createQueueModalFormRow}>
|
|
100
|
+
<div className={styles.createQueueModalFormControl}>
|
|
101
|
+
<TextInput
|
|
102
|
+
id="queue-room-name"
|
|
103
|
+
labelText="Queue Room Name"
|
|
104
|
+
onChange={(e) => handleQueueRoomName(e.target.value)}
|
|
105
|
+
type="text"
|
|
106
|
+
/>
|
|
107
|
+
</div>
|
|
108
|
+
</div>
|
|
109
|
+
<div className={styles.createQueueModalFormRow}>
|
|
110
|
+
<div className={styles.createQueueModalFormControl}>
|
|
111
|
+
<TextInput
|
|
112
|
+
id="description"
|
|
113
|
+
labelText="Description"
|
|
114
|
+
onChange={(e) => handleQueueRoomDescription(e.target.value)}
|
|
115
|
+
type="text"
|
|
116
|
+
/>
|
|
117
|
+
</div>
|
|
118
|
+
</div>
|
|
119
|
+
<div className={styles.createQueueModalFormRow}>
|
|
120
|
+
<div className={styles.createQueueModalFormControl}>
|
|
121
|
+
<Select id="service" labelText="Service Queue" onChange={(e) => handleQueueService(e.target.value)}>
|
|
122
|
+
<SelectItem value="" text="Select Queue" />
|
|
123
|
+
{queues.map((queue) => {
|
|
124
|
+
return <SelectItem value={queue.uuid} text={queue.display} />;
|
|
125
|
+
})}
|
|
126
|
+
</Select>
|
|
127
|
+
</div>
|
|
128
|
+
</div>
|
|
129
|
+
</div>
|
|
130
|
+
</div>
|
|
131
|
+
</ModalBody>
|
|
132
|
+
</Modal>
|
|
133
|
+
</>
|
|
134
|
+
);
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
export default CreateQueueRoomModal;
|
|
File without changes
|