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,133 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { Box, Paper, ScrollArea, SegmentedControl, Text } from '@mantine/core';
|
|
4
|
+
import type { MedplumClient } from '@medplum/core';
|
|
5
|
+
import type { Patient, Reference, ResourceType, Task } from '@medplum/fhirtypes';
|
|
6
|
+
import { PatientSummary, ResourceTimeline, useMedplum, useResource } from '@medplum/react';
|
|
7
|
+
import { useEffect, useState } from 'react';
|
|
8
|
+
import type { JSX } from 'react';
|
|
9
|
+
import { TaskInputNote } from './TaskInputNote';
|
|
10
|
+
import { TaskProperties } from './TaskProperties';
|
|
11
|
+
import classes from './TaskBoard.module.css';
|
|
12
|
+
import { showErrorNotification } from '../../utils/notifications';
|
|
13
|
+
|
|
14
|
+
interface TaskDetailPanelProps {
|
|
15
|
+
task: Task | Reference<Task>;
|
|
16
|
+
onTaskChange?: (task: Task) => void;
|
|
17
|
+
onDeleteTask?: (task: Task) => void;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function TaskDetailPanel(props: TaskDetailPanelProps): JSX.Element | null {
|
|
21
|
+
const { task: taskProp, onTaskChange, onDeleteTask } = props;
|
|
22
|
+
const medplum = useMedplum();
|
|
23
|
+
const resolvedTask = useResource(taskProp);
|
|
24
|
+
const [task, setTask] = useState<Task | undefined>(resolvedTask);
|
|
25
|
+
const [activeTab, setActiveTab] = useState<string>('properties');
|
|
26
|
+
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if (resolvedTask) {
|
|
29
|
+
setTask(resolvedTask);
|
|
30
|
+
}
|
|
31
|
+
}, [resolvedTask]);
|
|
32
|
+
|
|
33
|
+
const patientRef = task?.for as Reference<Patient>;
|
|
34
|
+
const selectedPatient = useResource<Patient>(patientRef);
|
|
35
|
+
|
|
36
|
+
if (!task) {
|
|
37
|
+
return (
|
|
38
|
+
<Box h="100%" style={{ display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
|
|
39
|
+
<Text c="dimmed">No task selected</Text>
|
|
40
|
+
</Box>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const handleTaskChange = async (updatedTask: Task): Promise<void> => {
|
|
45
|
+
await medplum.updateResource(updatedTask);
|
|
46
|
+
setTask(updatedTask);
|
|
47
|
+
onTaskChange?.(updatedTask);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const handleDeleteTask = async (deletedTask: Task): Promise<void> => {
|
|
51
|
+
try {
|
|
52
|
+
await medplum.deleteResource('Task', deletedTask.id as string);
|
|
53
|
+
onDeleteTask?.(deletedTask);
|
|
54
|
+
} catch (error) {
|
|
55
|
+
showErrorNotification(error);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const handleTabChange = (value: string): void => {
|
|
60
|
+
setActiveTab(value);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const getTabData = (): { label: string; value: string }[] => {
|
|
64
|
+
const tabs = [
|
|
65
|
+
{ label: 'Properties', value: 'properties' },
|
|
66
|
+
{ label: 'Activity Log', value: 'activity-log' },
|
|
67
|
+
];
|
|
68
|
+
|
|
69
|
+
if (selectedPatient) {
|
|
70
|
+
tabs.push({ label: 'Patient Summary', value: 'patient-summary' });
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return tabs;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
return (
|
|
77
|
+
<>
|
|
78
|
+
<Box
|
|
79
|
+
h="100%"
|
|
80
|
+
style={{
|
|
81
|
+
flex: 1,
|
|
82
|
+
}}
|
|
83
|
+
className={classes.borderRight}
|
|
84
|
+
>
|
|
85
|
+
<TaskInputNote
|
|
86
|
+
task={task}
|
|
87
|
+
onTaskChange={handleTaskChange}
|
|
88
|
+
onDeleteTask={onDeleteTask ? handleDeleteTask : undefined}
|
|
89
|
+
/>
|
|
90
|
+
</Box>
|
|
91
|
+
|
|
92
|
+
<Box h="100%" w="400px">
|
|
93
|
+
<Paper h="100%" style={{ overflow: 'hidden' }}>
|
|
94
|
+
<Box px="md" pb="md" pt="md">
|
|
95
|
+
<SegmentedControl
|
|
96
|
+
value={activeTab}
|
|
97
|
+
onChange={handleTabChange}
|
|
98
|
+
data={getTabData()}
|
|
99
|
+
fullWidth
|
|
100
|
+
radius="md"
|
|
101
|
+
color="gray"
|
|
102
|
+
size="sm"
|
|
103
|
+
className={classes.segmentedControl}
|
|
104
|
+
/>
|
|
105
|
+
</Box>
|
|
106
|
+
|
|
107
|
+
<Box>
|
|
108
|
+
{activeTab === 'properties' && (
|
|
109
|
+
<ScrollArea h="calc(100vh - 120px)">
|
|
110
|
+
<TaskProperties key={task.id} p="md" task={task} onTaskChange={handleTaskChange} />
|
|
111
|
+
</ScrollArea>
|
|
112
|
+
)}
|
|
113
|
+
{activeTab === 'activity-log' && (
|
|
114
|
+
<ScrollArea h="calc(100vh - 120px)">
|
|
115
|
+
<ResourceTimeline
|
|
116
|
+
value={task}
|
|
117
|
+
loadTimelineResources={async (medplum: MedplumClient, _resourceType: ResourceType, id: string) => {
|
|
118
|
+
return Promise.allSettled([medplum.readHistory('Task', id)]);
|
|
119
|
+
}}
|
|
120
|
+
/>
|
|
121
|
+
</ScrollArea>
|
|
122
|
+
)}
|
|
123
|
+
{activeTab === 'patient-summary' && selectedPatient?.resourceType === 'Patient' && (
|
|
124
|
+
<ScrollArea h="calc(100vh - 120px)">
|
|
125
|
+
<PatientSummary patient={selectedPatient} />
|
|
126
|
+
</ScrollArea>
|
|
127
|
+
)}
|
|
128
|
+
</Box>
|
|
129
|
+
</Paper>
|
|
130
|
+
</Box>
|
|
131
|
+
</>
|
|
132
|
+
);
|
|
133
|
+
}
|
package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskDetailsModal.module.css
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
.footer {
|
|
2
|
+
display: flex;
|
|
3
|
+
justify-content: flex-end;
|
|
4
|
+
padding: var(--mantine-spacing-md);
|
|
5
|
+
height: 70px;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
[data-mantine-color-scheme='dark'] .taskDetails,
|
|
9
|
+
[data-mantine-color-scheme='dark'] .footer {
|
|
10
|
+
background-color: var(--mantine-color-dark-8);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
[data-mantine-color-scheme='light'] .taskDetails,
|
|
14
|
+
[data-mantine-color-scheme='light'] .footer {
|
|
15
|
+
background-color: var(--mantine-color-gray-1);
|
|
16
|
+
}
|
package/dist/examples/vintasend-medplum-example/src/components/tasks/TaskDetailsModal.test.tsx
ADDED
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { MantineProvider } from '@mantine/core';
|
|
4
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
5
|
+
import userEvent from '@testing-library/user-event';
|
|
6
|
+
import { MedplumProvider } from '@medplum/react';
|
|
7
|
+
import type { Task, Patient } from '@medplum/fhirtypes';
|
|
8
|
+
import { MockClient } from '@medplum/mock';
|
|
9
|
+
import { MemoryRouter, Route, Routes } from 'react-router';
|
|
10
|
+
import { describe, expect, test, vi, beforeEach } from 'vitest';
|
|
11
|
+
import { TaskDetailsModal } from './TaskDetailsModal';
|
|
12
|
+
import * as usePatientModule from '../../hooks/usePatient';
|
|
13
|
+
|
|
14
|
+
describe('TaskDetailsModal', () => {
|
|
15
|
+
let medplum: MockClient;
|
|
16
|
+
|
|
17
|
+
beforeEach(() => {
|
|
18
|
+
medplum = new MockClient();
|
|
19
|
+
vi.clearAllMocks();
|
|
20
|
+
vi.spyOn(medplum, 'updateResource').mockResolvedValue({ id: 'task-123', resourceType: 'Task' } as Task & {
|
|
21
|
+
id: string;
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const mockPatient: Patient = {
|
|
26
|
+
resourceType: 'Patient',
|
|
27
|
+
id: 'patient-123',
|
|
28
|
+
name: [{ given: ['John'], family: 'Doe' }],
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const mockTask: Task = {
|
|
32
|
+
resourceType: 'Task',
|
|
33
|
+
id: 'task-123',
|
|
34
|
+
status: 'in-progress',
|
|
35
|
+
intent: 'order',
|
|
36
|
+
code: { text: 'Test Task' },
|
|
37
|
+
description: 'Test task description',
|
|
38
|
+
for: { reference: 'Patient/patient-123' },
|
|
39
|
+
authoredOn: '2023-01-01T12:00:00Z',
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const setup = (): ReturnType<typeof render> => {
|
|
43
|
+
vi.spyOn(usePatientModule, 'usePatient').mockReturnValue(mockPatient);
|
|
44
|
+
|
|
45
|
+
return render(
|
|
46
|
+
<MemoryRouter initialEntries={['/Patient/patient-123/Encounter/encounter-123/Task/task-123']}>
|
|
47
|
+
<MedplumProvider medplum={medplum}>
|
|
48
|
+
<MantineProvider>
|
|
49
|
+
<Routes>
|
|
50
|
+
<Route path="/Patient/:patientId/Encounter/:encounterId/Task/:taskId" element={<TaskDetailsModal />} />
|
|
51
|
+
</Routes>
|
|
52
|
+
</MantineProvider>
|
|
53
|
+
</MedplumProvider>
|
|
54
|
+
</MemoryRouter>
|
|
55
|
+
);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
test('renders task details modal', async () => {
|
|
59
|
+
await medplum.createResource(mockTask);
|
|
60
|
+
setup();
|
|
61
|
+
|
|
62
|
+
await waitFor(() => {
|
|
63
|
+
expect(screen.getByText('Test Task')).toBeInTheDocument();
|
|
64
|
+
expect(screen.getByText('Test task description')).toBeInTheDocument();
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
test('displays patient information', async () => {
|
|
69
|
+
await medplum.createResource(mockTask);
|
|
70
|
+
await medplum.createResource(mockPatient);
|
|
71
|
+
setup();
|
|
72
|
+
|
|
73
|
+
await waitFor(() => {
|
|
74
|
+
expect(screen.getByText('View Patient')).toBeInTheDocument();
|
|
75
|
+
expect(screen.getByText('John Doe')).toBeInTheDocument();
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
test('allows changing due date', async () => {
|
|
80
|
+
await medplum.createResource(mockTask);
|
|
81
|
+
setup();
|
|
82
|
+
|
|
83
|
+
await waitFor(() => {
|
|
84
|
+
expect(screen.getByLabelText('Due Date')).toBeInTheDocument();
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
test('allows changing task status', async () => {
|
|
89
|
+
await medplum.createResource(mockTask);
|
|
90
|
+
setup();
|
|
91
|
+
|
|
92
|
+
await waitFor(() => {
|
|
93
|
+
expect(screen.getByText('Status')).toBeInTheDocument();
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
test('allows adding a note', async () => {
|
|
98
|
+
const user = userEvent.setup();
|
|
99
|
+
await medplum.createResource(mockTask);
|
|
100
|
+
setup();
|
|
101
|
+
|
|
102
|
+
await waitFor(() => {
|
|
103
|
+
expect(screen.getByPlaceholderText('Add note to this task')).toBeInTheDocument();
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
const noteInput = screen.getByPlaceholderText('Add note to this task');
|
|
107
|
+
await user.type(noteInput, 'This is a test note');
|
|
108
|
+
|
|
109
|
+
expect(noteInput).toHaveValue('This is a test note');
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
test('saves changes when Save Changes button is clicked', async () => {
|
|
113
|
+
const user = userEvent.setup();
|
|
114
|
+
await medplum.createResource(mockTask);
|
|
115
|
+
setup();
|
|
116
|
+
|
|
117
|
+
await waitFor(() => {
|
|
118
|
+
expect(screen.getByText('Save Changes')).toBeInTheDocument();
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
const noteInput = screen.getByPlaceholderText('Add note to this task');
|
|
122
|
+
await user.type(noteInput, 'Updated note');
|
|
123
|
+
|
|
124
|
+
const saveButton = screen.getByText('Save Changes');
|
|
125
|
+
await user.click(saveButton);
|
|
126
|
+
|
|
127
|
+
await waitFor(() => {
|
|
128
|
+
expect(medplum.updateResource).toHaveBeenCalled();
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
test('shows success notification after saving', async () => {
|
|
133
|
+
const user = userEvent.setup();
|
|
134
|
+
await medplum.createResource(mockTask);
|
|
135
|
+
setup();
|
|
136
|
+
|
|
137
|
+
await waitFor(() => {
|
|
138
|
+
expect(screen.getByText('Save Changes')).toBeInTheDocument();
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
const saveButton = screen.getByText('Save Changes');
|
|
142
|
+
await user.click(saveButton);
|
|
143
|
+
|
|
144
|
+
await waitFor(() => {
|
|
145
|
+
expect(medplum.updateResource).toHaveBeenCalled();
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
test('handles save error gracefully', async () => {
|
|
150
|
+
const user = userEvent.setup();
|
|
151
|
+
await medplum.createResource(mockTask);
|
|
152
|
+
|
|
153
|
+
vi.spyOn(medplum, 'updateResource').mockRejectedValueOnce(new Error('Update failed'));
|
|
154
|
+
|
|
155
|
+
setup();
|
|
156
|
+
|
|
157
|
+
await waitFor(() => {
|
|
158
|
+
expect(screen.getByText('Save Changes')).toBeInTheDocument();
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
const saveButton = screen.getByText('Save Changes');
|
|
162
|
+
await user.click(saveButton);
|
|
163
|
+
|
|
164
|
+
await waitFor(() => {
|
|
165
|
+
expect(medplum.updateResource).toHaveBeenCalled();
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
test('closes modal when close button is clicked', async () => {
|
|
170
|
+
const user = userEvent.setup();
|
|
171
|
+
await medplum.createResource(mockTask);
|
|
172
|
+
setup();
|
|
173
|
+
|
|
174
|
+
await waitFor(() => {
|
|
175
|
+
expect(screen.getByText('Test Task')).toBeInTheDocument();
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
const closeButton = document.querySelector('.mantine-Modal-close');
|
|
179
|
+
expect(closeButton).toBeInTheDocument();
|
|
180
|
+
if (closeButton) {
|
|
181
|
+
await user.click(closeButton);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
await waitFor(() => {
|
|
185
|
+
expect(screen.queryByText('Test Task')).not.toBeInTheDocument();
|
|
186
|
+
});
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
test('handles task fetch error', async () => {
|
|
190
|
+
vi.spyOn(medplum, 'readResource').mockRejectedValueOnce(new Error('Task not found'));
|
|
191
|
+
|
|
192
|
+
setup();
|
|
193
|
+
|
|
194
|
+
await waitFor(() => {
|
|
195
|
+
expect(medplum.readResource).toHaveBeenCalled();
|
|
196
|
+
});
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
test('updates task with all fields', async () => {
|
|
200
|
+
const user = userEvent.setup();
|
|
201
|
+
const taskWithAllFields: Task = {
|
|
202
|
+
...mockTask,
|
|
203
|
+
owner: { reference: 'Practitioner/prac-123' },
|
|
204
|
+
restriction: { period: { end: '2023-12-31' } },
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
await medplum.createResource(taskWithAllFields);
|
|
208
|
+
setup();
|
|
209
|
+
|
|
210
|
+
await waitFor(() => {
|
|
211
|
+
expect(screen.getByText('Save Changes')).toBeInTheDocument();
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
const noteInput = screen.getByPlaceholderText('Add note to this task');
|
|
215
|
+
await user.type(noteInput, 'Comprehensive update');
|
|
216
|
+
|
|
217
|
+
const saveButton = screen.getByText('Save Changes');
|
|
218
|
+
await user.click(saveButton);
|
|
219
|
+
|
|
220
|
+
await waitFor(() => {
|
|
221
|
+
expect(medplum.updateResource).toHaveBeenCalled();
|
|
222
|
+
const calls = (medplum.updateResource as any).mock.calls;
|
|
223
|
+
expect(calls.length).toBeGreaterThan(0);
|
|
224
|
+
const updatedTask = calls[calls.length - 1][0] as Task;
|
|
225
|
+
expect(updatedTask.note).toBeDefined();
|
|
226
|
+
expect(updatedTask.note?.[0].text).toBe('Comprehensive update');
|
|
227
|
+
});
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
test('does not add empty notes', async () => {
|
|
231
|
+
const user = userEvent.setup();
|
|
232
|
+
await medplum.createResource(mockTask);
|
|
233
|
+
setup();
|
|
234
|
+
|
|
235
|
+
await waitFor(() => {
|
|
236
|
+
expect(screen.getByText('Save Changes')).toBeInTheDocument();
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
const noteInput = screen.getByPlaceholderText('Add note to this task');
|
|
240
|
+
await user.type(noteInput, 'Test');
|
|
241
|
+
await user.clear(noteInput);
|
|
242
|
+
|
|
243
|
+
const saveButton = screen.getByText('Save Changes');
|
|
244
|
+
await user.click(saveButton);
|
|
245
|
+
|
|
246
|
+
await waitFor(() => {
|
|
247
|
+
expect(medplum.updateResource).toHaveBeenCalled();
|
|
248
|
+
const calls = (medplum.updateResource as any).mock.calls;
|
|
249
|
+
if (calls.length > 0) {
|
|
250
|
+
const updatedTask = calls[calls.length - 1][0] as Task;
|
|
251
|
+
expect(updatedTask.note).toBeUndefined();
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
});
|
|
255
|
+
});
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { Box, Button, Card, Grid, Modal, Stack, Text, Textarea } from '@mantine/core';
|
|
4
|
+
import { notifications } from '@mantine/notifications';
|
|
5
|
+
import { createReference, formatHumanName, getReferenceString, normalizeErrorString } from '@medplum/core';
|
|
6
|
+
import type { Practitioner, Reference, Task } from '@medplum/fhirtypes';
|
|
7
|
+
import { CodeInput, DateTimeInput, Loading, ResourceInput, useMedplum, useMedplumProfile } from '@medplum/react';
|
|
8
|
+
import { IconCircleCheck, IconCircleOff } from '@tabler/icons-react';
|
|
9
|
+
import { useEffect, useState } from 'react';
|
|
10
|
+
import type { JSX } from 'react';
|
|
11
|
+
import { Link, useNavigate, useParams } from 'react-router';
|
|
12
|
+
import { usePatient } from '../../hooks/usePatient';
|
|
13
|
+
import classes from './TaskDetailsModal.module.css';
|
|
14
|
+
|
|
15
|
+
export const TaskDetailsModal = (): JSX.Element => {
|
|
16
|
+
const { patientId, encounterId, taskId } = useParams();
|
|
17
|
+
const patient = usePatient();
|
|
18
|
+
const medplum = useMedplum();
|
|
19
|
+
const navigate = useNavigate();
|
|
20
|
+
const author = useMedplumProfile();
|
|
21
|
+
const [task, setTask] = useState<Task | undefined>(undefined);
|
|
22
|
+
const [isOpened, setIsOpened] = useState(true);
|
|
23
|
+
const [practitioner, setPractitioner] = useState<Practitioner | undefined>();
|
|
24
|
+
const [dueDate, setDueDate] = useState<string | undefined>();
|
|
25
|
+
const [status, setStatus] = useState<Task['status'] | undefined>();
|
|
26
|
+
const [note, setNote] = useState<string>('');
|
|
27
|
+
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
const fetchTask = async (): Promise<void> => {
|
|
30
|
+
const task = await medplum.readResource('Task', taskId as string);
|
|
31
|
+
setStatus(task.status as typeof status);
|
|
32
|
+
setTask(task);
|
|
33
|
+
setDueDate(task.restriction?.period?.end);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
fetchTask().catch((err) => {
|
|
37
|
+
notifications.show({
|
|
38
|
+
color: 'red',
|
|
39
|
+
icon: <IconCircleOff />,
|
|
40
|
+
title: 'Error',
|
|
41
|
+
message: normalizeErrorString(err),
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
}, [medplum, taskId]);
|
|
45
|
+
|
|
46
|
+
const handleOnSubmit = async (): Promise<void> => {
|
|
47
|
+
if (!task) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const updatedTask: Task = {
|
|
52
|
+
...task,
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const trimmedNote = note.trim();
|
|
56
|
+
if (trimmedNote !== '') {
|
|
57
|
+
updatedTask.note = [
|
|
58
|
+
...(task.note || []),
|
|
59
|
+
{
|
|
60
|
+
text: trimmedNote,
|
|
61
|
+
authorReference: author && createReference(author),
|
|
62
|
+
time: new Date().toISOString(),
|
|
63
|
+
},
|
|
64
|
+
];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (status) {
|
|
68
|
+
updatedTask.status = status;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (dueDate) {
|
|
72
|
+
updatedTask.restriction = {
|
|
73
|
+
...updatedTask.restriction,
|
|
74
|
+
period: {
|
|
75
|
+
...updatedTask.restriction?.period,
|
|
76
|
+
end: dueDate,
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (practitioner) {
|
|
82
|
+
updatedTask.owner = { reference: getReferenceString(practitioner) } as Reference<Practitioner>;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
try {
|
|
86
|
+
await medplum.updateResource(updatedTask);
|
|
87
|
+
notifications.show({
|
|
88
|
+
icon: <IconCircleCheck />,
|
|
89
|
+
title: 'Success',
|
|
90
|
+
message: 'Task updated',
|
|
91
|
+
});
|
|
92
|
+
setTask(updatedTask);
|
|
93
|
+
navigate(`/Patient/${patientId}/Encounter/${encounterId}`)?.catch(console.error);
|
|
94
|
+
} catch {
|
|
95
|
+
notifications.show({
|
|
96
|
+
color: 'red',
|
|
97
|
+
icon: <IconCircleOff />,
|
|
98
|
+
title: 'Error',
|
|
99
|
+
message: 'Failed to update the task.',
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
if (!task) {
|
|
105
|
+
return <Loading />;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return (
|
|
109
|
+
<Modal
|
|
110
|
+
opened={isOpened}
|
|
111
|
+
onClose={() => {
|
|
112
|
+
navigate(-1)?.catch(console.error);
|
|
113
|
+
setIsOpened(false);
|
|
114
|
+
}}
|
|
115
|
+
size="xl"
|
|
116
|
+
styles={{
|
|
117
|
+
body: {
|
|
118
|
+
padding: 0,
|
|
119
|
+
height: '60vh',
|
|
120
|
+
},
|
|
121
|
+
}}
|
|
122
|
+
>
|
|
123
|
+
<Stack h="100%" justify="space-between" gap={0}>
|
|
124
|
+
<Box flex={1} miw={0}>
|
|
125
|
+
<Grid p="md" h="100%">
|
|
126
|
+
<Grid.Col span={6} pr="lg">
|
|
127
|
+
<Stack gap="sm">
|
|
128
|
+
<Card p="md" radius="md" className={classes.taskDetails}>
|
|
129
|
+
<Stack gap="sm">
|
|
130
|
+
<Text fz="lg" fw={700}>
|
|
131
|
+
{task?.code?.text}
|
|
132
|
+
</Text>
|
|
133
|
+
{task?.description && <Text>{task.description}</Text>}
|
|
134
|
+
{patient?.name && (
|
|
135
|
+
<div style={{ display: 'flex', alignItems: 'center', gap: '0.5rem' }}>
|
|
136
|
+
<Text>View Patient</Text>
|
|
137
|
+
<Button variant="subtle" component={Link} to={`/Patient/${patient.id}`}>
|
|
138
|
+
{formatHumanName(patient.name?.[0])}
|
|
139
|
+
</Button>
|
|
140
|
+
</div>
|
|
141
|
+
)}
|
|
142
|
+
</Stack>
|
|
143
|
+
</Card>
|
|
144
|
+
|
|
145
|
+
<ResourceInput<Practitioner>
|
|
146
|
+
name="practitioner"
|
|
147
|
+
resourceType="Practitioner"
|
|
148
|
+
label="Assigned to"
|
|
149
|
+
defaultValue={task?.owner ? { reference: task.owner.reference } : undefined}
|
|
150
|
+
onChange={(value) => {
|
|
151
|
+
setPractitioner(value as Practitioner);
|
|
152
|
+
}}
|
|
153
|
+
/>
|
|
154
|
+
|
|
155
|
+
<DateTimeInput
|
|
156
|
+
name="Due Date"
|
|
157
|
+
placeholder="End"
|
|
158
|
+
label="Due Date"
|
|
159
|
+
defaultValue={dueDate}
|
|
160
|
+
onChange={setDueDate}
|
|
161
|
+
/>
|
|
162
|
+
|
|
163
|
+
{task?.status && (
|
|
164
|
+
<CodeInput
|
|
165
|
+
name="status"
|
|
166
|
+
label="Status"
|
|
167
|
+
binding="http://hl7.org/fhir/ValueSet/task-status|4.0.1"
|
|
168
|
+
maxValues={1}
|
|
169
|
+
defaultValue={status}
|
|
170
|
+
onChange={(value) => {
|
|
171
|
+
if (value) {
|
|
172
|
+
setStatus(value as typeof status);
|
|
173
|
+
}
|
|
174
|
+
}}
|
|
175
|
+
/>
|
|
176
|
+
)}
|
|
177
|
+
</Stack>
|
|
178
|
+
</Grid.Col>
|
|
179
|
+
|
|
180
|
+
<Grid.Col span={6} pr="md">
|
|
181
|
+
<Stack gap="sm">
|
|
182
|
+
<Text>Note</Text>
|
|
183
|
+
<Text c="dimmed">Optional free form details about this task</Text>
|
|
184
|
+
<Textarea
|
|
185
|
+
placeholder="Add note to this task"
|
|
186
|
+
minRows={3}
|
|
187
|
+
value={note}
|
|
188
|
+
onChange={(event) => setNote(event.currentTarget.value)}
|
|
189
|
+
/>
|
|
190
|
+
</Stack>
|
|
191
|
+
</Grid.Col>
|
|
192
|
+
</Grid>
|
|
193
|
+
</Box>
|
|
194
|
+
|
|
195
|
+
<Box className={classes.footer} h={70} p="md">
|
|
196
|
+
<Button variant="filled" onClick={handleOnSubmit}>
|
|
197
|
+
Save Changes
|
|
198
|
+
</Button>
|
|
199
|
+
</Box>
|
|
200
|
+
</Stack>
|
|
201
|
+
</Modal>
|
|
202
|
+
);
|
|
203
|
+
};
|