vintasend 0.4.0 → 0.4.7
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/README.md +5 -0
- package/dist/examples/vintasend-medplum-example/.env.example +11 -0
- package/dist/examples/vintasend-medplum-example/IMPLEMENTATION_PLAN_FILE_ATTACHMENTS.md +597 -0
- package/dist/examples/vintasend-medplum-example/README.md +190 -0
- package/dist/examples/vintasend-medplum-example/TUTORIAL_EMAIL_NOTIFICATIONS.md +2596 -0
- package/dist/examples/vintasend-medplum-example/bots/handlers/send-pending-notifications-bot.ts +39 -0
- package/dist/examples/vintasend-medplum-example/bots/handlers/send-task-assignment-email.ts +41 -0
- package/dist/examples/vintasend-medplum-example/bots/handlers/task-due-soon-notification-bot.ts +86 -0
- package/dist/examples/vintasend-medplum-example/bots/index.ts +53 -0
- package/dist/examples/vintasend-medplum-example/bots/services/emails/schedule-task-due-soon-email.ts +84 -0
- package/dist/examples/vintasend-medplum-example/bots/services/emails/send-task-assignment-email.test.ts +388 -0
- package/dist/examples/vintasend-medplum-example/bots/services/emails/send-task-assignment-email.ts +113 -0
- package/dist/examples/vintasend-medplum-example/bots/shared/task-due-soon-helpers.ts +115 -0
- package/dist/examples/vintasend-medplum-example/bots/task-assignment-bot.ts +41 -0
- package/dist/examples/vintasend-medplum-example/compiled-notification-templates.json +6 -0
- package/dist/examples/vintasend-medplum-example/esbuild-script.mjs +71 -0
- package/dist/examples/vintasend-medplum-example/index.html +14 -0
- package/dist/examples/vintasend-medplum-example/lib/constants.ts +32 -0
- package/dist/examples/vintasend-medplum-example/lib/extensions.ts +1 -0
- package/dist/examples/vintasend-medplum-example/lib/file-upload.test.ts +389 -0
- package/dist/examples/vintasend-medplum-example/lib/file-upload.ts +222 -0
- package/dist/examples/vintasend-medplum-example/lib/medplum-singleton.ts +18 -0
- package/dist/examples/vintasend-medplum-example/lib/notification-service.test.ts +293 -0
- package/dist/examples/vintasend-medplum-example/lib/notification-service.ts +284 -0
- package/dist/examples/vintasend-medplum-example/lib/patients.ts +20 -0
- package/dist/examples/vintasend-medplum-example/notification-templates/emails/task-assignment/body.html.pug +37 -0
- package/dist/examples/vintasend-medplum-example/notification-templates/emails/task-assignment/subject.txt.pug +4 -0
- package/dist/examples/vintasend-medplum-example/notification-templates/emails/task-due-soon/body.html.pug +34 -0
- package/dist/examples/vintasend-medplum-example/notification-templates/emails/task-due-soon/subject.txt.pug +4 -0
- package/dist/examples/vintasend-medplum-example/package.json +75 -0
- package/dist/examples/vintasend-medplum-example/plugins/gql-plugin.mjs +31 -0
- package/dist/examples/vintasend-medplum-example/postcss.config.mjs +21 -0
- package/dist/examples/vintasend-medplum-example/public/favicon.ico +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/acuity.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/auth0.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/azure.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/calcom.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/candid.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/claude.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/datadog.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/deepseek.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/entra.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/epic.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/google.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/healthgorilla.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/healthie.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/labcorp.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/okta.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/openai.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/particle.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/quest.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/recaptcha.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/snowflake.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/stedi.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/stripe.png +0 -0
- package/dist/examples/vintasend-medplum-example/public/img/integrations/sumo.png +0 -0
- package/dist/examples/vintasend-medplum-example/scripts/README.md +162 -0
- package/dist/examples/vintasend-medplum-example/scripts/client.ts +18 -0
- package/dist/examples/vintasend-medplum-example/scripts/deploy-bots.ts +171 -0
- package/dist/examples/vintasend-medplum-example/src/App.tsx +185 -0
- package/dist/examples/vintasend-medplum-example/src/components/ChargeItem/ChargeItemList.test.tsx +350 -0
- package/dist/examples/vintasend-medplum-example/src/components/ChargeItem/ChargeItemList.tsx +241 -0
- package/dist/examples/vintasend-medplum-example/src/components/ChargeItem/ChargeItemPanel.test.tsx +616 -0
- package/dist/examples/vintasend-medplum-example/src/components/ChargeItem/ChargeItemPanel.tsx +138 -0
- package/dist/examples/vintasend-medplum-example/src/components/Conditions/ConditionItem.test.tsx +92 -0
- package/dist/examples/vintasend-medplum-example/src/components/Conditions/ConditionItem.tsx +47 -0
- package/dist/examples/vintasend-medplum-example/src/components/Conditions/ConditionList.test.tsx +464 -0
- package/dist/examples/vintasend-medplum-example/src/components/Conditions/ConditionList.tsx +186 -0
- package/dist/examples/vintasend-medplum-example/src/components/Conditions/ConditionModal.test.tsx +80 -0
- package/dist/examples/vintasend-medplum-example/src/components/Conditions/ConditionModal.tsx +82 -0
- package/dist/examples/vintasend-medplum-example/src/components/DoseSpotIcon.test.tsx +100 -0
- package/dist/examples/vintasend-medplum-example/src/components/DoseSpotIcon.tsx +20 -0
- package/dist/examples/vintasend-medplum-example/src/components/IntegrationCard.module.css +3 -0
- package/dist/examples/vintasend-medplum-example/src/components/IntegrationCard.tsx +62 -0
- package/dist/examples/vintasend-medplum-example/src/components/MessageWithLinks.tsx +47 -0
- package/dist/examples/vintasend-medplum-example/src/components/PerformingLabInput.test.tsx +299 -0
- package/dist/examples/vintasend-medplum-example/src/components/PerformingLabInput.tsx +52 -0
- package/dist/examples/vintasend-medplum-example/src/components/ResourceFormWithRequiredProfile.tsx +82 -0
- package/dist/examples/vintasend-medplum-example/src/components/encounter/BillingTab.test.tsx +1016 -0
- package/dist/examples/vintasend-medplum-example/src/components/encounter/BillingTab.tsx +298 -0
- package/dist/examples/vintasend-medplum-example/src/components/encounter/EncounterChart.test.tsx +732 -0
- package/dist/examples/vintasend-medplum-example/src/components/encounter/EncounterChart.tsx +282 -0
- package/dist/examples/vintasend-medplum-example/src/components/encounter/EncounterHeader.test.tsx +268 -0
- package/dist/examples/vintasend-medplum-example/src/components/encounter/EncounterHeader.tsx +224 -0
- package/dist/examples/vintasend-medplum-example/src/components/encounter/SignAddendum.test.tsx +255 -0
- package/dist/examples/vintasend-medplum-example/src/components/encounter/SignAddendum.tsx +212 -0
- package/dist/examples/vintasend-medplum-example/src/components/encounter/SignLockDialog.test.tsx +120 -0
- package/dist/examples/vintasend-medplum-example/src/components/encounter/SignLockDialog.tsx +57 -0
- package/dist/examples/vintasend-medplum-example/src/components/encounter/VisitDetailsPanel.test.tsx +224 -0
- package/dist/examples/vintasend-medplum-example/src/components/encounter/VisitDetailsPanel.tsx +100 -0
- package/dist/examples/vintasend-medplum-example/src/components/labs/CoverageInput.test.tsx +431 -0
- package/dist/examples/vintasend-medplum-example/src/components/labs/CoverageInput.tsx +130 -0
- package/dist/examples/vintasend-medplum-example/src/components/labs/LabListItem.module.css +31 -0
- package/dist/examples/vintasend-medplum-example/src/components/labs/LabListItem.test.tsx +234 -0
- package/dist/examples/vintasend-medplum-example/src/components/labs/LabListItem.tsx +143 -0
- package/dist/examples/vintasend-medplum-example/src/components/labs/LabOrderDetails.module.css +11 -0
- package/dist/examples/vintasend-medplum-example/src/components/labs/LabOrderDetails.test.tsx +875 -0
- package/dist/examples/vintasend-medplum-example/src/components/labs/LabOrderDetails.tsx +943 -0
- package/dist/examples/vintasend-medplum-example/src/components/labs/LabResultDetails.test.tsx +413 -0
- package/dist/examples/vintasend-medplum-example/src/components/labs/LabResultDetails.tsx +203 -0
- package/dist/examples/vintasend-medplum-example/src/components/labs/LabSelectEmpty.tsx +22 -0
- package/dist/examples/vintasend-medplum-example/src/components/labs/README.md +104 -0
- package/dist/examples/vintasend-medplum-example/src/components/labs/TestMetadataCardInput.test.tsx +318 -0
- package/dist/examples/vintasend-medplum-example/src/components/labs/TestMetadataCardInput.tsx +87 -0
- package/dist/examples/vintasend-medplum-example/src/components/messages/ChatList.test.tsx +126 -0
- package/dist/examples/vintasend-medplum-example/src/components/messages/ChatList.tsx +38 -0
- package/dist/examples/vintasend-medplum-example/src/components/messages/ChatListItem.module.css +23 -0
- package/dist/examples/vintasend-medplum-example/src/components/messages/ChatListItem.test.tsx +167 -0
- package/dist/examples/vintasend-medplum-example/src/components/messages/ChatListItem.tsx +53 -0
- package/dist/examples/vintasend-medplum-example/src/components/messages/NewTopicDialog.test.tsx +94 -0
- package/dist/examples/vintasend-medplum-example/src/components/messages/NewTopicDialog.tsx +165 -0
- package/dist/examples/vintasend-medplum-example/src/components/messages/ParticipantFilter.module.css +8 -0
- package/dist/examples/vintasend-medplum-example/src/components/messages/ParticipantFilter.test.tsx +523 -0
- package/dist/examples/vintasend-medplum-example/src/components/messages/ParticipantFilter.tsx +230 -0
- package/dist/examples/vintasend-medplum-example/src/components/messages/ThreadInbox.module.css +23 -0
- package/dist/examples/vintasend-medplum-example/src/components/messages/ThreadInbox.test.tsx +567 -0
- package/dist/examples/vintasend-medplum-example/src/components/messages/ThreadInbox.tsx +358 -0
- package/dist/examples/vintasend-medplum-example/src/components/plandefinition/AddPlanDefinition.module.css +40 -0
- package/dist/examples/vintasend-medplum-example/src/components/plandefinition/AddPlanDefinition.tsx +257 -0
- package/dist/examples/vintasend-medplum-example/src/components/schedule/CreateVisit.module.css +7 -0
- package/dist/examples/vintasend-medplum-example/src/components/schedule/CreateVisit.test.tsx +279 -0
- package/dist/examples/vintasend-medplum-example/src/components/schedule/CreateVisit.tsx +156 -0
- package/dist/examples/vintasend-medplum-example/src/components/spaces/HistoryList.module.css +45 -0
- package/dist/examples/vintasend-medplum-example/src/components/spaces/HistoryList.test.tsx +90 -0
- package/dist/examples/vintasend-medplum-example/src/components/spaces/HistoryList.tsx +84 -0
- package/dist/examples/vintasend-medplum-example/src/components/spaces/ResourceBox.module.css +26 -0
- package/dist/examples/vintasend-medplum-example/src/components/spaces/ResourceBox.tsx +90 -0
- package/dist/examples/vintasend-medplum-example/src/components/spaces/ResourcePanel.test.tsx +305 -0
- package/dist/examples/vintasend-medplum-example/src/components/spaces/ResourcePanel.tsx +46 -0
- package/dist/examples/vintasend-medplum-example/src/components/spaces/SpacesInbox.module.css +262 -0
- package/dist/examples/vintasend-medplum-example/src/components/spaces/SpacesInbox.test.tsx +622 -0
- package/dist/examples/vintasend-medplum-example/src/components/spaces/SpacesInbox.tsx +286 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/NewTaskModal.tsx +275 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskAttachmentList.tsx +132 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskBoard.module.css +45 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskBoard.test.tsx +749 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskBoard.tsx +416 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskDetailPanel.test.tsx +278 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskDetailPanel.tsx +133 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskDetailsModal.module.css +16 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskDetailsModal.test.tsx +255 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskDetailsModal.tsx +203 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskFileUpload.tsx +129 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskFilterMenu.test.tsx +156 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskFilterMenu.tsx +142 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskFilterMenu.utils.ts +28 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskInputNote.test.tsx +134 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskInputNote.tsx +250 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskListItem.module.css +23 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskListItem.test.tsx +149 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskListItem.tsx +53 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskNoteItem.test.tsx +68 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskNoteItem.tsx +46 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskProperties.test.tsx +555 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskProperties.tsx +170 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskSelectEmpty.test.tsx +32 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskSelectEmpty.tsx +34 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/encounter/SimpleTask.test.tsx +47 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/encounter/SimpleTask.tsx +29 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/encounter/TaskPanel.test.tsx +285 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/encounter/TaskPanel.tsx +129 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/encounter/TaskQuestionnaireForm.test.tsx +455 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/encounter/TaskQuestionnaireForm.tsx +167 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/encounter/TaskServiceRequest.test.tsx +435 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/encounter/TaskServiceRequest.tsx +116 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/encounter/TaskStatusPanel.module.css +38 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/encounter/TaskStatusPanel.test.tsx +200 -0
- package/dist/examples/vintasend-medplum-example/src/components/tasks/encounter/TaskStatusPanel.tsx +84 -0
- package/dist/examples/vintasend-medplum-example/src/components/utils.test.ts +176 -0
- package/dist/examples/vintasend-medplum-example/src/components/utils.ts +17 -0
- package/dist/examples/vintasend-medplum-example/src/config/constants.ts +3 -0
- package/dist/examples/vintasend-medplum-example/src/hooks/useDebouncedUpdateResource.test.tsx +166 -0
- package/dist/examples/vintasend-medplum-example/src/hooks/useDebouncedUpdateResource.ts +28 -0
- package/dist/examples/vintasend-medplum-example/src/hooks/useEncounter.test.tsx +94 -0
- package/dist/examples/vintasend-medplum-example/src/hooks/useEncounter.ts +11 -0
- package/dist/examples/vintasend-medplum-example/src/hooks/useEncounterChart.test.tsx +477 -0
- package/dist/examples/vintasend-medplum-example/src/hooks/useEncounterChart.ts +191 -0
- package/dist/examples/vintasend-medplum-example/src/hooks/usePatient.test.tsx +100 -0
- package/dist/examples/vintasend-medplum-example/src/hooks/usePatient.ts +18 -0
- package/dist/examples/vintasend-medplum-example/src/hooks/useThreadInbox.test.tsx +379 -0
- package/dist/examples/vintasend-medplum-example/src/hooks/useThreadInbox.ts +194 -0
- package/dist/examples/vintasend-medplum-example/src/index.css +8 -0
- package/dist/examples/vintasend-medplum-example/src/main.tsx +57 -0
- package/dist/examples/vintasend-medplum-example/src/pages/SearchPage.module.css +6 -0
- package/dist/examples/vintasend-medplum-example/src/pages/SearchPage.test.tsx +295 -0
- package/dist/examples/vintasend-medplum-example/src/pages/SearchPage.tsx +124 -0
- package/dist/examples/vintasend-medplum-example/src/pages/SignInPage.test.tsx +77 -0
- package/dist/examples/vintasend-medplum-example/src/pages/SignInPage.tsx +22 -0
- package/dist/examples/vintasend-medplum-example/src/pages/encounter/EncounterChartPage.test.tsx +87 -0
- package/dist/examples/vintasend-medplum-example/src/pages/encounter/EncounterChartPage.tsx +27 -0
- package/dist/examples/vintasend-medplum-example/src/pages/encounter/EncounterModal.module.css +16 -0
- package/dist/examples/vintasend-medplum-example/src/pages/encounter/EncounterModal.test.tsx +287 -0
- package/dist/examples/vintasend-medplum-example/src/pages/encounter/EncounterModal.tsx +151 -0
- package/dist/examples/vintasend-medplum-example/src/pages/integrations/DoseSpotFavoritesPage.test.tsx +519 -0
- package/dist/examples/vintasend-medplum-example/src/pages/integrations/DoseSpotFavoritesPage.tsx +179 -0
- package/dist/examples/vintasend-medplum-example/src/pages/integrations/FavoriteMedicationsTable.tsx +76 -0
- package/dist/examples/vintasend-medplum-example/src/pages/integrations/IntegrationsPage.test.tsx +234 -0
- package/dist/examples/vintasend-medplum-example/src/pages/integrations/IntegrationsPage.tsx +222 -0
- package/dist/examples/vintasend-medplum-example/src/pages/labs/OrderLabsPage.test.tsx +356 -0
- package/dist/examples/vintasend-medplum-example/src/pages/labs/OrderLabsPage.tsx +275 -0
- package/dist/examples/vintasend-medplum-example/src/pages/messages/MessagesPage.module.css +8 -0
- package/dist/examples/vintasend-medplum-example/src/pages/messages/MessagesPage.test.tsx +103 -0
- package/dist/examples/vintasend-medplum-example/src/pages/messages/MessagesPage.tsx +78 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/CommunicationTab.test.tsx +84 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/CommunicationTab.tsx +82 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/DoseSpotAdvancedOptions.test.tsx +364 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/DoseSpotAdvancedOptions.tsx +149 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/DoseSpotTab.test.tsx +159 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/DoseSpotTab.tsx +37 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/EditTab.test.tsx +140 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/EditTab.tsx +72 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/ExportTab.test.tsx +57 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/ExportTab.tsx +14 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/IntakeFormPage.test.tsx +241 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/IntakeFormPage.tsx +710 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/LabsPage.module.css +37 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/LabsPage.test.tsx +428 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/LabsPage.tsx +334 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/PatientPage.module.css +24 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/PatientPage.test.tsx +154 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/PatientPage.tsx +115 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/PatientPage.utils.test.ts +223 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/PatientPage.utils.ts +89 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/PatientSearchPage.test.tsx +147 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/PatientSearchPage.tsx +79 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/PatientTabsNavigation.tsx +35 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/TasksTab.test.tsx +185 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/TasksTab.tsx +115 -0
- package/dist/examples/vintasend-medplum-example/src/pages/patient/TimelineTab.tsx +14 -0
- package/dist/examples/vintasend-medplum-example/src/pages/resource/ResourceCreatePage.test.tsx +170 -0
- package/dist/examples/vintasend-medplum-example/src/pages/resource/ResourceCreatePage.tsx +117 -0
- package/dist/examples/vintasend-medplum-example/src/pages/resource/ResourceDetailPage.tsx +28 -0
- package/dist/examples/vintasend-medplum-example/src/pages/resource/ResourceEditPage.test.tsx +131 -0
- package/dist/examples/vintasend-medplum-example/src/pages/resource/ResourceEditPage.tsx +65 -0
- package/dist/examples/vintasend-medplum-example/src/pages/resource/ResourceHistoryPage.test.tsx +108 -0
- package/dist/examples/vintasend-medplum-example/src/pages/resource/ResourceHistoryPage.tsx +16 -0
- package/dist/examples/vintasend-medplum-example/src/pages/resource/ResourcePage.module.css +7 -0
- package/dist/examples/vintasend-medplum-example/src/pages/resource/ResourcePage.test.tsx +37 -0
- package/dist/examples/vintasend-medplum-example/src/pages/resource/ResourcePage.tsx +44 -0
- package/dist/examples/vintasend-medplum-example/src/pages/resource/useResourceType.ts +44 -0
- package/dist/examples/vintasend-medplum-example/src/pages/resource/utils.ts +9 -0
- package/dist/examples/vintasend-medplum-example/src/pages/schedule/SchedulePage.test.tsx +302 -0
- package/dist/examples/vintasend-medplum-example/src/pages/schedule/SchedulePage.tsx +416 -0
- package/dist/examples/vintasend-medplum-example/src/pages/spaces/ChatInput.tsx +91 -0
- package/dist/examples/vintasend-medplum-example/src/pages/spaces/SpacesPage.module.css +6 -0
- package/dist/examples/vintasend-medplum-example/src/pages/spaces/SpacesPage.test.tsx +102 -0
- package/dist/examples/vintasend-medplum-example/src/pages/spaces/SpacesPage.tsx +44 -0
- package/dist/examples/vintasend-medplum-example/src/pages/tasks/TasksPage.module.css +7 -0
- package/dist/examples/vintasend-medplum-example/src/pages/tasks/TasksPage.test.tsx +133 -0
- package/dist/examples/vintasend-medplum-example/src/pages/tasks/TasksPage.tsx +91 -0
- package/dist/examples/vintasend-medplum-example/src/test-utils/render.tsx +20 -0
- package/dist/examples/vintasend-medplum-example/src/test.setup.ts +49 -0
- package/dist/examples/vintasend-medplum-example/src/types/encounter.ts +8 -0
- package/dist/examples/vintasend-medplum-example/src/types/spaces.ts +10 -0
- package/dist/examples/vintasend-medplum-example/src/utils/chargeitems.test.ts +141 -0
- package/dist/examples/vintasend-medplum-example/src/utils/chargeitems.ts +59 -0
- package/dist/examples/vintasend-medplum-example/src/utils/claims.test.ts +153 -0
- package/dist/examples/vintasend-medplum-example/src/utils/claims.ts +65 -0
- package/dist/examples/vintasend-medplum-example/src/utils/communication-search.ts +47 -0
- package/dist/examples/vintasend-medplum-example/src/utils/coverage.test.ts +48 -0
- package/dist/examples/vintasend-medplum-example/src/utils/coverage.ts +33 -0
- package/dist/examples/vintasend-medplum-example/src/utils/documentReference.test.ts +102 -0
- package/dist/examples/vintasend-medplum-example/src/utils/documentReference.ts +55 -0
- package/dist/examples/vintasend-medplum-example/src/utils/encounter.test.ts +169 -0
- package/dist/examples/vintasend-medplum-example/src/utils/encounter.ts +261 -0
- package/dist/examples/vintasend-medplum-example/src/utils/intake-form.test.ts +154 -0
- package/dist/examples/vintasend-medplum-example/src/utils/intake-form.ts +272 -0
- package/dist/examples/vintasend-medplum-example/src/utils/intake-utils.test.ts +1137 -0
- package/dist/examples/vintasend-medplum-example/src/utils/intake-utils.ts +827 -0
- package/dist/examples/vintasend-medplum-example/src/utils/notifications.test.ts +27 -0
- package/dist/examples/vintasend-medplum-example/src/utils/notifications.ts +15 -0
- package/dist/examples/vintasend-medplum-example/src/utils/spaceMessaging.ts +249 -0
- package/dist/examples/vintasend-medplum-example/src/utils/spacePersistence.test.ts +450 -0
- package/dist/examples/vintasend-medplum-example/src/utils/spacePersistence.ts +147 -0
- package/dist/examples/vintasend-medplum-example/src/utils/task-search.ts +63 -0
- package/dist/examples/vintasend-medplum-example/src/vite-env.d.ts +3 -0
- package/dist/examples/vintasend-medplum-example/tsconfig.bots.json +4 -0
- package/dist/examples/vintasend-medplum-example/tsconfig.json +19 -0
- package/dist/examples/vintasend-medplum-example/vercel.json +3 -0
- package/dist/examples/vintasend-medplum-example/vite.config.ts +44 -0
- package/dist/services/notification-backends/base-notification-backend.d.ts +5 -0
- package/dist/services/notification-service.js +11 -1
- package/dist/services/notification-template-renderers/base-email-template-renderer.d.ts +5 -0
- package/package.json +1 -1
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import type { DiagnosticReport, Encounter, Reference, ServiceRequest, Task } from '@medplum/fhirtypes';
|
|
4
|
+
import { useMedplum, useResource } from '@medplum/react';
|
|
5
|
+
import { useEffect, useState } from 'react';
|
|
6
|
+
import type { JSX } from 'react';
|
|
7
|
+
import { Button, Group, Modal, Stack, Text, Title } from '@mantine/core';
|
|
8
|
+
import { getDisplayString } from '@medplum/core';
|
|
9
|
+
import { IconPlus } from '@tabler/icons-react';
|
|
10
|
+
import { OrderLabsPage } from '../../../pages/labs/OrderLabsPage';
|
|
11
|
+
import type { LabOrganization, TestCoding } from '@medplum/health-gorilla-core';
|
|
12
|
+
import { showErrorNotification } from '../../../utils/notifications';
|
|
13
|
+
|
|
14
|
+
interface TaskServiceRequestProps {
|
|
15
|
+
task: Task;
|
|
16
|
+
saveDiagnosticReport: (diagnosticReport: DiagnosticReport) => void;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const SNOMED_SYSTEM = 'http://snomed.info/sct';
|
|
20
|
+
const SNOMED_DIAGNOSTIC_REPORT_CODE = '108252007';
|
|
21
|
+
|
|
22
|
+
export const TaskServiceRequest = (props: TaskServiceRequestProps): JSX.Element => {
|
|
23
|
+
const { task } = props;
|
|
24
|
+
const medplum = useMedplum();
|
|
25
|
+
const serviceRequest = useResource(task.focus as Reference<ServiceRequest>);
|
|
26
|
+
const [newOrderModalOpened, setNewOrderModalOpened] = useState(false);
|
|
27
|
+
const [labServiceRequest, setLabServiceRequest] = useState<ServiceRequest | undefined>(undefined);
|
|
28
|
+
const performingLab: LabOrganization = {
|
|
29
|
+
resourceType: 'Organization',
|
|
30
|
+
id: '258a1dbb-ccec-4cb3-b9ff-4dc28f8f28a0',
|
|
31
|
+
name: 'HGDX LabCorp',
|
|
32
|
+
identifier: [
|
|
33
|
+
{
|
|
34
|
+
system: 'https://www.healthgorilla.com',
|
|
35
|
+
value: 'f-388554647b89801ea5e8320b',
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const tests: TestCoding[] | undefined = serviceRequest?.code?.coding
|
|
41
|
+
?.filter((coding) => coding.system === SNOMED_SYSTEM && coding.code !== SNOMED_DIAGNOSTIC_REPORT_CODE)
|
|
42
|
+
.map((coding) => ({
|
|
43
|
+
system: 'urn:uuid:f:388554647b89801ea5e8320b',
|
|
44
|
+
code: coding.code,
|
|
45
|
+
display: coding.display,
|
|
46
|
+
})) as TestCoding[];
|
|
47
|
+
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
const fetchServiceRequest = async (): Promise<void> => {
|
|
50
|
+
const serviceRequest = await medplum.readReference(task.focus as Reference<ServiceRequest>);
|
|
51
|
+
setLabServiceRequest(serviceRequest);
|
|
52
|
+
};
|
|
53
|
+
fetchServiceRequest().catch(showErrorNotification);
|
|
54
|
+
}, [medplum, task.focus]);
|
|
55
|
+
|
|
56
|
+
const handleNewOrderCreated = async (serviceRequest?: ServiceRequest): Promise<void> => {
|
|
57
|
+
setNewOrderModalOpened(false);
|
|
58
|
+
setLabServiceRequest(serviceRequest);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
if (!serviceRequest) {
|
|
62
|
+
return <div>Loading...</div>;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<>
|
|
67
|
+
<Stack p={0}>
|
|
68
|
+
<Stack gap={0}>
|
|
69
|
+
<Title>{getDisplayString(task)}</Title>
|
|
70
|
+
</Stack>
|
|
71
|
+
|
|
72
|
+
{(labServiceRequest?.status === 'draft' || labServiceRequest?.status === 'on-hold') && (
|
|
73
|
+
<Group>
|
|
74
|
+
<Button onClick={() => setNewOrderModalOpened(true)} variant="outline" leftSection={<IconPlus size={16} />}>
|
|
75
|
+
Request Labs
|
|
76
|
+
</Button>
|
|
77
|
+
</Group>
|
|
78
|
+
)}
|
|
79
|
+
|
|
80
|
+
{task.for &&
|
|
81
|
+
labServiceRequest?.status !== 'draft' &&
|
|
82
|
+
labServiceRequest?.status !== 'on-hold' &&
|
|
83
|
+
labServiceRequest?.id && (
|
|
84
|
+
<>
|
|
85
|
+
<Text> ✅ Order Sent | Requisition: {labServiceRequest?.requisition?.value} </Text>
|
|
86
|
+
<Group>
|
|
87
|
+
<Button
|
|
88
|
+
component="a"
|
|
89
|
+
target="_blank"
|
|
90
|
+
href={`/${task.for.reference}/ServiceRequest/${labServiceRequest.id}`}
|
|
91
|
+
>
|
|
92
|
+
View in Labs
|
|
93
|
+
</Button>
|
|
94
|
+
</Group>
|
|
95
|
+
</>
|
|
96
|
+
)}
|
|
97
|
+
</Stack>
|
|
98
|
+
|
|
99
|
+
<Modal
|
|
100
|
+
opened={newOrderModalOpened}
|
|
101
|
+
onClose={() => setNewOrderModalOpened(false)}
|
|
102
|
+
size="xl"
|
|
103
|
+
centered
|
|
104
|
+
title="Order Labs"
|
|
105
|
+
>
|
|
106
|
+
<OrderLabsPage
|
|
107
|
+
encounter={task.encounter as Reference<Encounter>}
|
|
108
|
+
task={task as Reference<Task>}
|
|
109
|
+
tests={tests}
|
|
110
|
+
performingLab={performingLab}
|
|
111
|
+
onSubmitLabOrder={handleNewOrderCreated}
|
|
112
|
+
/>
|
|
113
|
+
</Modal>
|
|
114
|
+
</>
|
|
115
|
+
);
|
|
116
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
.completed {
|
|
2
|
+
background-color: var(--mantine-color-green-0) !important;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.ready {
|
|
6
|
+
background-color: var(--mantine-color-blue-0) !important;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.menu {
|
|
10
|
+
padding: 8px;
|
|
11
|
+
margin: -8px;
|
|
12
|
+
cursor: pointer;
|
|
13
|
+
display: flex;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.submenu {
|
|
17
|
+
position: absolute;
|
|
18
|
+
top: 0;
|
|
19
|
+
left: 100%;
|
|
20
|
+
background: var(--mantine-color-white);
|
|
21
|
+
border: 1px solid var(--mantine-color-gray-3);
|
|
22
|
+
box-shadow: var(--mantine-shadow-md);
|
|
23
|
+
z-index: 1000;
|
|
24
|
+
min-width: 150px;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
[data-mantine-color-scheme='dark'] .ready,
|
|
28
|
+
[data-mantine-color-scheme='dark'] .completed {
|
|
29
|
+
color: var(--mantine-color-dark-8);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
[data-mantine-color-scheme='dark'] .panel {
|
|
33
|
+
background-color: var(--mantine-color-dark-8);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
[data-mantine-color-scheme='light'] .panel {
|
|
37
|
+
background-color: var(--mantine-color-gray-1);
|
|
38
|
+
}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { MantineProvider } from '@mantine/core';
|
|
4
|
+
import type { Task } from '@medplum/fhirtypes';
|
|
5
|
+
import { act, cleanup, render, screen, waitFor } from '@testing-library/react';
|
|
6
|
+
import userEvent from '@testing-library/user-event';
|
|
7
|
+
import { describe, expect, test, vi, beforeEach, afterEach } from 'vitest';
|
|
8
|
+
import { TaskStatusPanel } from './TaskStatusPanel';
|
|
9
|
+
|
|
10
|
+
const mockTask: Task = {
|
|
11
|
+
resourceType: 'Task',
|
|
12
|
+
id: 'task-123',
|
|
13
|
+
status: 'in-progress',
|
|
14
|
+
intent: 'order',
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const mockOnActionButtonClicked = vi.fn();
|
|
18
|
+
const mockOnChangeStatus = vi.fn();
|
|
19
|
+
|
|
20
|
+
describe('TaskStatusPanel', () => {
|
|
21
|
+
let renderResult: ReturnType<typeof render> | null = null;
|
|
22
|
+
|
|
23
|
+
beforeEach(() => {
|
|
24
|
+
cleanup();
|
|
25
|
+
vi.clearAllMocks();
|
|
26
|
+
renderResult = null;
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
afterEach(() => {
|
|
30
|
+
if (renderResult) {
|
|
31
|
+
renderResult.unmount();
|
|
32
|
+
renderResult = null;
|
|
33
|
+
}
|
|
34
|
+
cleanup();
|
|
35
|
+
vi.restoreAllMocks();
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const setup = async (task: Task, enabled = true): Promise<void> => {
|
|
39
|
+
await act(async () => {
|
|
40
|
+
render(
|
|
41
|
+
<MantineProvider>
|
|
42
|
+
<TaskStatusPanel
|
|
43
|
+
task={task}
|
|
44
|
+
enabled={enabled}
|
|
45
|
+
onActionButtonClicked={mockOnActionButtonClicked}
|
|
46
|
+
onChangeStatus={mockOnChangeStatus}
|
|
47
|
+
/>
|
|
48
|
+
</MantineProvider>
|
|
49
|
+
);
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
test('renders task status label', async () => {
|
|
54
|
+
await setup(mockTask);
|
|
55
|
+
expect(screen.getByText('Task Status:')).toBeInTheDocument();
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
test('renders formatted task status when enabled', async () => {
|
|
59
|
+
await setup(mockTask, true);
|
|
60
|
+
expect(screen.getByText('In Progress')).toBeInTheDocument();
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
test('renders formatted task status when disabled', async () => {
|
|
64
|
+
await setup(mockTask, false);
|
|
65
|
+
expect(screen.getByText('In Progress')).toBeInTheDocument();
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
test('shows edit button when enabled', async () => {
|
|
69
|
+
await setup(mockTask, true);
|
|
70
|
+
const editButton = screen.getByRole('button', { name: 'Edit Task' });
|
|
71
|
+
expect(editButton).toBeInTheDocument();
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
test('does not show edit button when disabled', async () => {
|
|
75
|
+
await setup(mockTask, false);
|
|
76
|
+
expect(screen.queryByRole('button', { name: 'Edit Task' })).not.toBeInTheDocument();
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
test('calls onActionButtonClicked when edit button is clicked', async () => {
|
|
80
|
+
const user = userEvent.setup();
|
|
81
|
+
await setup(mockTask, true);
|
|
82
|
+
|
|
83
|
+
const editButton = screen.getByRole('button', { name: 'Edit Task' });
|
|
84
|
+
await user.click(editButton);
|
|
85
|
+
|
|
86
|
+
expect(mockOnActionButtonClicked).toHaveBeenCalledTimes(1);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
test('shows menu dropdown when badge is clicked', async () => {
|
|
90
|
+
const user = userEvent.setup();
|
|
91
|
+
await setup(mockTask, true);
|
|
92
|
+
|
|
93
|
+
const badge = screen.getAllByText('In Progress')[0];
|
|
94
|
+
await user.click(badge);
|
|
95
|
+
|
|
96
|
+
await waitFor(
|
|
97
|
+
() => {
|
|
98
|
+
const menuItems = screen.getAllByRole('menuitem');
|
|
99
|
+
expect(menuItems.length).toBe(5);
|
|
100
|
+
},
|
|
101
|
+
{ timeout: 5000 }
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
expect(screen.getByText('Completed')).toBeInTheDocument();
|
|
105
|
+
expect(screen.getByText('Ready')).toBeInTheDocument();
|
|
106
|
+
expect(screen.getByText('On Hold')).toBeInTheDocument();
|
|
107
|
+
expect(screen.getByText('Cancelled')).toBeInTheDocument();
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
test('calls onChangeStatus when menu item is clicked', async () => {
|
|
111
|
+
const user = userEvent.setup();
|
|
112
|
+
await setup(mockTask, true);
|
|
113
|
+
|
|
114
|
+
const badge = screen.getByText('In Progress');
|
|
115
|
+
await user.click(badge);
|
|
116
|
+
|
|
117
|
+
await waitFor(
|
|
118
|
+
() => {
|
|
119
|
+
expect(screen.getByText('Completed')).toBeInTheDocument();
|
|
120
|
+
},
|
|
121
|
+
{ timeout: 5000 }
|
|
122
|
+
);
|
|
123
|
+
|
|
124
|
+
const completedItem = screen.getByText('Completed');
|
|
125
|
+
await user.click(completedItem);
|
|
126
|
+
|
|
127
|
+
expect(mockOnChangeStatus).toHaveBeenCalledWith('completed');
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
test('shows checkmark for current status in menu', async () => {
|
|
131
|
+
const user = userEvent.setup();
|
|
132
|
+
await setup(mockTask, true);
|
|
133
|
+
|
|
134
|
+
const badge = screen.getAllByText('In Progress')[0];
|
|
135
|
+
await user.click(badge);
|
|
136
|
+
|
|
137
|
+
let menuItems: HTMLElement[] = [];
|
|
138
|
+
await waitFor(
|
|
139
|
+
() => {
|
|
140
|
+
menuItems = screen.getAllByRole('menuitem');
|
|
141
|
+
expect(menuItems.length).toBeGreaterThan(0);
|
|
142
|
+
// Verify menu is visible by checking opacity or display style
|
|
143
|
+
const menuDropdown = document.querySelector('[role="menu"]');
|
|
144
|
+
if (menuDropdown) {
|
|
145
|
+
const style = window.getComputedStyle(menuDropdown);
|
|
146
|
+
expect(style.display).not.toBe('none');
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
{ timeout: 5000 }
|
|
150
|
+
);
|
|
151
|
+
|
|
152
|
+
const inProgressItem = menuItems.find((item) => item.textContent?.includes('In Progress'));
|
|
153
|
+
expect(inProgressItem).toBeDefined();
|
|
154
|
+
// Check that the menu item has an SVG icon (IconCheck renders as SVG)
|
|
155
|
+
const icon = inProgressItem?.querySelector('svg');
|
|
156
|
+
expect(icon).toBeInTheDocument();
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
test('handles all status options in menu', async () => {
|
|
160
|
+
const user = userEvent.setup();
|
|
161
|
+
await setup(mockTask, true);
|
|
162
|
+
|
|
163
|
+
const badge = screen.getAllByText('In Progress')[0];
|
|
164
|
+
await user.click(badge);
|
|
165
|
+
|
|
166
|
+
await waitFor(
|
|
167
|
+
() => {
|
|
168
|
+
const menuItems = screen.getAllByRole('menuitem');
|
|
169
|
+
expect(menuItems.length).toBe(5);
|
|
170
|
+
|
|
171
|
+
const statusOptions = ['Completed', 'Ready', 'In Progress', 'On Hold', 'Cancelled'];
|
|
172
|
+
statusOptions.forEach((status) => {
|
|
173
|
+
const menuItem = menuItems.find((item) => item.textContent?.includes(status));
|
|
174
|
+
expect(menuItem).toBeInTheDocument();
|
|
175
|
+
});
|
|
176
|
+
},
|
|
177
|
+
{ timeout: 5000 }
|
|
178
|
+
);
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
test('calls onChangeStatus with correct status for each menu item', async () => {
|
|
182
|
+
const user = userEvent.setup();
|
|
183
|
+
await setup(mockTask, true);
|
|
184
|
+
|
|
185
|
+
const badge = screen.getByText('In Progress');
|
|
186
|
+
await user.click(badge);
|
|
187
|
+
|
|
188
|
+
await waitFor(
|
|
189
|
+
() => {
|
|
190
|
+
expect(screen.getByText('Ready')).toBeInTheDocument();
|
|
191
|
+
},
|
|
192
|
+
{ timeout: 5000 }
|
|
193
|
+
);
|
|
194
|
+
|
|
195
|
+
const readyItem = screen.getByText('Ready');
|
|
196
|
+
await user.click(readyItem);
|
|
197
|
+
|
|
198
|
+
expect(mockOnChangeStatus).toHaveBeenCalledWith('ready');
|
|
199
|
+
});
|
|
200
|
+
});
|
package/dist/examples/vintasend-medplum-example/src/components/tasks/encounter/TaskStatusPanel.tsx
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { Flex, Menu, Text, Box, Badge, ActionIcon, Tooltip } from '@mantine/core';
|
|
4
|
+
import type { Task } from '@medplum/fhirtypes';
|
|
5
|
+
import { IconChevronDown, IconPencil, IconCheck } from '@tabler/icons-react';
|
|
6
|
+
import type { JSX } from 'react';
|
|
7
|
+
|
|
8
|
+
interface TaskStatusPanelProps {
|
|
9
|
+
task: Task;
|
|
10
|
+
enabled?: boolean;
|
|
11
|
+
onActionButtonClicked: () => void;
|
|
12
|
+
onChangeStatus: (status: Task['status']) => void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const TaskStatusPanel = (props: TaskStatusPanelProps): JSX.Element => {
|
|
16
|
+
const { task, enabled = true, onActionButtonClicked, onChangeStatus } = props;
|
|
17
|
+
const badgeColor = getBadgeColor(task.status);
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<Box p="md" style={{ borderTop: '1px solid #eee', margin: 0 }}>
|
|
21
|
+
<Flex justify="space-between" align="center" w="100%" m={0}>
|
|
22
|
+
<Flex align="center" gap={8}>
|
|
23
|
+
<Text>Task Status:</Text>
|
|
24
|
+
{enabled ? (
|
|
25
|
+
<Menu position="bottom-start">
|
|
26
|
+
<Menu.Target>
|
|
27
|
+
<Badge
|
|
28
|
+
variant="light"
|
|
29
|
+
color={badgeColor}
|
|
30
|
+
size="lg"
|
|
31
|
+
style={{ cursor: 'pointer', display: 'flex', alignItems: 'center', gap: 0 }}
|
|
32
|
+
rightSection={<IconChevronDown size={16} />}
|
|
33
|
+
>
|
|
34
|
+
{task.status.replaceAll('-', ' ').replaceAll(/\b\w/g, (char) => char.toUpperCase())}
|
|
35
|
+
</Badge>
|
|
36
|
+
</Menu.Target>
|
|
37
|
+
<Menu.Dropdown style={{ width: 140 }}>
|
|
38
|
+
{statuses.map((status) => (
|
|
39
|
+
<Menu.Item
|
|
40
|
+
key={status.value}
|
|
41
|
+
rightSection={
|
|
42
|
+
task.status === status.value ? (
|
|
43
|
+
<div style={{ marginLeft: 4, display: 'flex', alignItems: 'center' }}>
|
|
44
|
+
<IconCheck size={16} color="gray" />
|
|
45
|
+
</div>
|
|
46
|
+
) : null
|
|
47
|
+
}
|
|
48
|
+
onClick={() => onChangeStatus(status.value as Task['status'])}
|
|
49
|
+
>
|
|
50
|
+
{status.label}
|
|
51
|
+
</Menu.Item>
|
|
52
|
+
))}
|
|
53
|
+
</Menu.Dropdown>
|
|
54
|
+
</Menu>
|
|
55
|
+
) : (
|
|
56
|
+
<Badge variant="light" color={badgeColor} size="lg">
|
|
57
|
+
{task.status.replaceAll('-', ' ').replaceAll(/\b\w/g, (char) => char.toUpperCase())}
|
|
58
|
+
</Badge>
|
|
59
|
+
)}
|
|
60
|
+
</Flex>
|
|
61
|
+
{enabled && (
|
|
62
|
+
<Tooltip label="Edit Task" openDelay={500}>
|
|
63
|
+
<ActionIcon onClick={onActionButtonClicked} color="gray" variant="subtle" aria-label="Edit Task" size="lg">
|
|
64
|
+
<IconPencil size={20} />
|
|
65
|
+
</ActionIcon>
|
|
66
|
+
</Tooltip>
|
|
67
|
+
)}
|
|
68
|
+
</Flex>
|
|
69
|
+
</Box>
|
|
70
|
+
);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const statuses = [
|
|
74
|
+
{ value: 'completed', label: 'Completed' },
|
|
75
|
+
{ value: 'ready', label: 'Ready' },
|
|
76
|
+
{ value: 'in-progress', label: 'In Progress' },
|
|
77
|
+
{ value: 'on-hold', label: 'On Hold' },
|
|
78
|
+
{ value: 'cancelled', label: 'Cancelled' },
|
|
79
|
+
];
|
|
80
|
+
|
|
81
|
+
const getBadgeColor = (status: Task['status']): string => {
|
|
82
|
+
const colors = { completed: 'green', cancelled: 'red' };
|
|
83
|
+
return colors[status as keyof typeof colors] ?? 'blue';
|
|
84
|
+
};
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import type { ProjectMembership } from '@medplum/fhirtypes';
|
|
4
|
+
import { describe, expect, test } from 'vitest';
|
|
5
|
+
import { hasDoseSpotIdentifier } from './utils';
|
|
6
|
+
|
|
7
|
+
describe('utils', () => {
|
|
8
|
+
describe('hasDoseSpotIdentifier', () => {
|
|
9
|
+
test('returns true when membership has DoseSpot identifier', () => {
|
|
10
|
+
const membership: ProjectMembership = {
|
|
11
|
+
resourceType: 'ProjectMembership',
|
|
12
|
+
id: 'membership-1',
|
|
13
|
+
identifier: [
|
|
14
|
+
{
|
|
15
|
+
system: 'http://dosespot.com/identifier',
|
|
16
|
+
value: 'dosespot-user-123',
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
project: { id: 'project-1' },
|
|
20
|
+
user: { id: 'user-1' },
|
|
21
|
+
profile: { id: 'profile-1' },
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
expect(hasDoseSpotIdentifier(membership)).toBe(true);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
test('returns false when identifier system contains "DOSESPOT" in uppercase (case-sensitive)', () => {
|
|
28
|
+
const membership: ProjectMembership = {
|
|
29
|
+
resourceType: 'ProjectMembership',
|
|
30
|
+
id: 'membership-1',
|
|
31
|
+
identifier: [
|
|
32
|
+
{
|
|
33
|
+
system: 'http://DOSESPOT.COM/identifier',
|
|
34
|
+
value: 'user-123',
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
project: { id: 'project-1' },
|
|
38
|
+
user: { id: 'user-1' },
|
|
39
|
+
profile: { id: 'profile-1' },
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
expect(hasDoseSpotIdentifier(membership)).toBe(false);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
test('returns true when identifier system contains "dosespot" as substring', () => {
|
|
46
|
+
const membership: ProjectMembership = {
|
|
47
|
+
resourceType: 'ProjectMembership',
|
|
48
|
+
id: 'membership-1',
|
|
49
|
+
identifier: [
|
|
50
|
+
{
|
|
51
|
+
system: 'http://example.com/dosespot-integration/user',
|
|
52
|
+
value: 'user-123',
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
project: { id: 'project-1' },
|
|
56
|
+
user: { id: 'user-1' },
|
|
57
|
+
profile: { id: 'profile-1' },
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
expect(hasDoseSpotIdentifier(membership)).toBe(true);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
test('returns false when membership has no DoseSpot identifier', () => {
|
|
64
|
+
const membership: ProjectMembership = {
|
|
65
|
+
resourceType: 'ProjectMembership',
|
|
66
|
+
id: 'membership-1',
|
|
67
|
+
identifier: [
|
|
68
|
+
{
|
|
69
|
+
system: 'http://example.com/identifier',
|
|
70
|
+
value: 'user-123',
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
project: { id: 'project-1' },
|
|
74
|
+
user: { id: 'user-1' },
|
|
75
|
+
profile: { id: 'profile-1' },
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
expect(hasDoseSpotIdentifier(membership)).toBe(false);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
test('returns false when membership has no identifiers', () => {
|
|
82
|
+
const membership: ProjectMembership = {
|
|
83
|
+
resourceType: 'ProjectMembership',
|
|
84
|
+
id: 'membership-1',
|
|
85
|
+
project: { id: 'project-1' },
|
|
86
|
+
user: { id: 'user-1' },
|
|
87
|
+
profile: { id: 'profile-1' },
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
expect(hasDoseSpotIdentifier(membership)).toBe(false);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
test('returns false when membership is undefined', () => {
|
|
94
|
+
expect(hasDoseSpotIdentifier(undefined)).toBe(false);
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
test('returns false when identifier array is empty', () => {
|
|
98
|
+
const membership: ProjectMembership = {
|
|
99
|
+
resourceType: 'ProjectMembership',
|
|
100
|
+
id: 'membership-1',
|
|
101
|
+
identifier: [],
|
|
102
|
+
project: { id: 'project-1' },
|
|
103
|
+
user: { id: 'user-1' },
|
|
104
|
+
profile: { id: 'profile-1' },
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
expect(hasDoseSpotIdentifier(membership)).toBe(false);
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
test('returns true when one of multiple identifiers contains "dosespot"', () => {
|
|
111
|
+
const membership: ProjectMembership = {
|
|
112
|
+
resourceType: 'ProjectMembership',
|
|
113
|
+
id: 'membership-1',
|
|
114
|
+
identifier: [
|
|
115
|
+
{
|
|
116
|
+
system: 'http://example.com/identifier',
|
|
117
|
+
value: 'user-123',
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
system: 'http://dosespot.com/user',
|
|
121
|
+
value: 'dosespot-user-123',
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
system: 'http://other.com/identifier',
|
|
125
|
+
value: 'other-123',
|
|
126
|
+
},
|
|
127
|
+
],
|
|
128
|
+
project: { id: 'project-1' },
|
|
129
|
+
user: { id: 'user-1' },
|
|
130
|
+
profile: { id: 'profile-1' },
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
expect(hasDoseSpotIdentifier(membership)).toBe(true);
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
test('handles identifier with undefined system', () => {
|
|
137
|
+
const membership: ProjectMembership = {
|
|
138
|
+
resourceType: 'ProjectMembership',
|
|
139
|
+
id: 'membership-1',
|
|
140
|
+
identifier: [
|
|
141
|
+
{
|
|
142
|
+
system: undefined,
|
|
143
|
+
value: 'user-123',
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
system: 'http://dosespot.com/user',
|
|
147
|
+
value: 'dosespot-user-123',
|
|
148
|
+
},
|
|
149
|
+
],
|
|
150
|
+
project: { id: 'project-1' },
|
|
151
|
+
user: { id: 'user-1' },
|
|
152
|
+
profile: { id: 'profile-1' },
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
expect(hasDoseSpotIdentifier(membership)).toBe(true);
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
test('handles identifier with null system', () => {
|
|
159
|
+
const membership: ProjectMembership = {
|
|
160
|
+
resourceType: 'ProjectMembership',
|
|
161
|
+
id: 'membership-1',
|
|
162
|
+
identifier: [
|
|
163
|
+
{
|
|
164
|
+
system: null as any,
|
|
165
|
+
value: 'user-123',
|
|
166
|
+
},
|
|
167
|
+
],
|
|
168
|
+
project: { id: 'project-1' },
|
|
169
|
+
user: { id: 'user-1' },
|
|
170
|
+
profile: { id: 'profile-1' },
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
expect(hasDoseSpotIdentifier(membership)).toBe(false);
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import type { ProjectMembership } from '@medplum/fhirtypes';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Returns true if the profile has a DoseSpot identifier.
|
|
7
|
+
*
|
|
8
|
+
* This is a crude approximation for demonstration purposes.
|
|
9
|
+
*
|
|
10
|
+
* In your application, you may want to make this distinction based on user groups, access control lists, etc.
|
|
11
|
+
*
|
|
12
|
+
* @param membership - The current user's project membership.
|
|
13
|
+
* @returns True if the profile has a DoseSpot identifier.
|
|
14
|
+
*/
|
|
15
|
+
export function hasDoseSpotIdentifier(membership: ProjectMembership | undefined): boolean {
|
|
16
|
+
return !!membership?.identifier?.some((i) => i.system?.includes('dosespot'));
|
|
17
|
+
}
|