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,250 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import {
|
|
4
|
+
ActionIcon,
|
|
5
|
+
Button,
|
|
6
|
+
Card,
|
|
7
|
+
Divider,
|
|
8
|
+
Flex,
|
|
9
|
+
Modal,
|
|
10
|
+
Paper,
|
|
11
|
+
ScrollArea,
|
|
12
|
+
Stack,
|
|
13
|
+
Text,
|
|
14
|
+
Textarea,
|
|
15
|
+
} from '@mantine/core';
|
|
16
|
+
import { createReference, formatDate, getDisplayString, getReferenceString } from '@medplum/core';
|
|
17
|
+
import type { Annotation, QuestionnaireResponse, Task, Reference } from '@medplum/fhirtypes';
|
|
18
|
+
import { Loading, useMedplum, useMedplumProfile, useResource } from '@medplum/react';
|
|
19
|
+
import { IconCheck, IconTrash } from '@tabler/icons-react';
|
|
20
|
+
import React, { useState } from 'react';
|
|
21
|
+
import { showErrorNotification } from '../../utils/notifications';
|
|
22
|
+
import { TaskQuestionnaireForm } from './encounter/TaskQuestionnaireForm';
|
|
23
|
+
import { useDebouncedUpdateResource } from '../../hooks/useDebouncedUpdateResource';
|
|
24
|
+
import { TaskNoteItem } from './TaskNoteItem';
|
|
25
|
+
import { useDebouncedCallback } from '@mantine/hooks';
|
|
26
|
+
import { SAVE_TIMEOUT_MS } from '../../config/constants';
|
|
27
|
+
|
|
28
|
+
interface TaskInputNoteProps {
|
|
29
|
+
task: Task | Reference<Task>;
|
|
30
|
+
allowEdit?: boolean;
|
|
31
|
+
onTaskChange?: (task: Task) => void;
|
|
32
|
+
onDeleteTask?: (task: Task) => void;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function TaskInputNote(props: TaskInputNoteProps): React.JSX.Element {
|
|
36
|
+
const { task: initialTask, allowEdit = true, onTaskChange, onDeleteTask } = props;
|
|
37
|
+
const medplum = useMedplum();
|
|
38
|
+
const debouncedUpdateResource = useDebouncedUpdateResource(medplum);
|
|
39
|
+
const author = useMedplumProfile();
|
|
40
|
+
const task = useResource(initialTask);
|
|
41
|
+
const [note, setNote] = useState<string>('');
|
|
42
|
+
const [showDeleteModal, setShowDeleteModal] = useState<boolean>(false);
|
|
43
|
+
|
|
44
|
+
const handleAddComment = async (): Promise<void> => {
|
|
45
|
+
if (!task) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const comment: Annotation = {
|
|
50
|
+
text: note,
|
|
51
|
+
authorReference: author && createReference(author),
|
|
52
|
+
time: new Date().toISOString(),
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const taskNotes = [...(task.note || []), comment];
|
|
56
|
+
|
|
57
|
+
try {
|
|
58
|
+
const updatedTask = {
|
|
59
|
+
...task,
|
|
60
|
+
note: taskNotes,
|
|
61
|
+
} as Task;
|
|
62
|
+
onTaskChange?.(updatedTask);
|
|
63
|
+
setNote('');
|
|
64
|
+
} catch (error) {
|
|
65
|
+
showErrorNotification(error);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const handleDeleteTask = (): void => {
|
|
70
|
+
setShowDeleteModal(true);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const confirmDeleteTask = async (): Promise<void> => {
|
|
74
|
+
if (!task) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
onDeleteTask?.(task);
|
|
78
|
+
setShowDeleteModal(false);
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const handleMarkAsCompleted = async (): Promise<void> => {
|
|
82
|
+
if (!task) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
try {
|
|
87
|
+
const result: Task = {
|
|
88
|
+
...task,
|
|
89
|
+
status: 'completed',
|
|
90
|
+
};
|
|
91
|
+
onTaskChange?.(result);
|
|
92
|
+
await debouncedUpdateResource(result);
|
|
93
|
+
} catch (error) {
|
|
94
|
+
showErrorNotification(error);
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
const saveQuestionnaireResponse = useDebouncedCallback(
|
|
99
|
+
async (task: Task, response: QuestionnaireResponse): Promise<void> => {
|
|
100
|
+
try {
|
|
101
|
+
if (response.id) {
|
|
102
|
+
await medplum.updateResource<QuestionnaireResponse>(response);
|
|
103
|
+
} else {
|
|
104
|
+
const updatedResponse = await medplum.createResource<QuestionnaireResponse>(response);
|
|
105
|
+
const updatedTask = await medplum.updateResource<Task>({
|
|
106
|
+
...task,
|
|
107
|
+
output: [
|
|
108
|
+
{
|
|
109
|
+
type: { text: 'QuestionnaireResponse' },
|
|
110
|
+
valueReference: { reference: getReferenceString(updatedResponse) },
|
|
111
|
+
},
|
|
112
|
+
],
|
|
113
|
+
});
|
|
114
|
+
onTaskChange?.(updatedTask);
|
|
115
|
+
}
|
|
116
|
+
} catch (err) {
|
|
117
|
+
showErrorNotification(err);
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
SAVE_TIMEOUT_MS
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
if (!task) {
|
|
124
|
+
return <Loading />;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return (
|
|
128
|
+
<Flex direction="column" h="100%">
|
|
129
|
+
<Paper h="100%">
|
|
130
|
+
<Flex justify="space-between" p="lg" h={72}>
|
|
131
|
+
<Flex justify="left" align="center" direction="row" pr="md">
|
|
132
|
+
<Text size="xl" fw={600} lh={1.2}>
|
|
133
|
+
{task.code?.text ?? `Task`}
|
|
134
|
+
{task?.authoredOn && ` from ${formatDate(task?.authoredOn)}`}
|
|
135
|
+
</Text>
|
|
136
|
+
</Flex>
|
|
137
|
+
|
|
138
|
+
{allowEdit && (
|
|
139
|
+
<Flex align="center" gap="md">
|
|
140
|
+
{onDeleteTask && (
|
|
141
|
+
<ActionIcon
|
|
142
|
+
variant="outline"
|
|
143
|
+
c="dimmed"
|
|
144
|
+
color="gray"
|
|
145
|
+
aria-label="Delete Task"
|
|
146
|
+
radius="xl"
|
|
147
|
+
w={36}
|
|
148
|
+
h={36}
|
|
149
|
+
onClick={() => handleDeleteTask()}
|
|
150
|
+
>
|
|
151
|
+
<IconTrash size={24} />
|
|
152
|
+
</ActionIcon>
|
|
153
|
+
)}
|
|
154
|
+
|
|
155
|
+
<ActionIcon
|
|
156
|
+
variant={task.status === 'completed' ? 'filled' : 'outline'}
|
|
157
|
+
color={task.status === 'completed' ? 'blue' : 'gray'}
|
|
158
|
+
aria-label="Mark as Completed"
|
|
159
|
+
radius="xl"
|
|
160
|
+
w={36}
|
|
161
|
+
h={36}
|
|
162
|
+
onClick={() => handleMarkAsCompleted()}
|
|
163
|
+
>
|
|
164
|
+
<IconCheck size={24} />
|
|
165
|
+
</ActionIcon>
|
|
166
|
+
</Flex>
|
|
167
|
+
)}
|
|
168
|
+
</Flex>
|
|
169
|
+
|
|
170
|
+
<ScrollArea w="100%" h="calc(100% - 70px)" p="lg">
|
|
171
|
+
{task.description && (
|
|
172
|
+
<Stack mb="lg">
|
|
173
|
+
<Text size="lg">{task.description}</Text>
|
|
174
|
+
<Divider />
|
|
175
|
+
</Stack>
|
|
176
|
+
)}
|
|
177
|
+
<Stack>
|
|
178
|
+
{task?.focus?.reference?.startsWith('Questionnaire/') && (
|
|
179
|
+
<>
|
|
180
|
+
<Stack gap={0}>
|
|
181
|
+
<Text size="lg" fw={600} mb="lg">
|
|
182
|
+
Related Questionnaire
|
|
183
|
+
</Text>
|
|
184
|
+
<Card withBorder shadow="sm" p="md">
|
|
185
|
+
<TaskQuestionnaireForm
|
|
186
|
+
key={task.focus.reference}
|
|
187
|
+
task={task}
|
|
188
|
+
onChangeResponse={(response) => saveQuestionnaireResponse(task, response)}
|
|
189
|
+
/>
|
|
190
|
+
</Card>
|
|
191
|
+
</Stack>
|
|
192
|
+
<Divider />
|
|
193
|
+
</>
|
|
194
|
+
)}
|
|
195
|
+
|
|
196
|
+
<Stack gap={0}>
|
|
197
|
+
<Text size="lg" fw={600} mb="md">
|
|
198
|
+
Notes
|
|
199
|
+
</Text>
|
|
200
|
+
|
|
201
|
+
{task.note?.map((note, index) => (
|
|
202
|
+
<TaskNoteItem key={note.id || index} note={note} index={index} />
|
|
203
|
+
))}
|
|
204
|
+
|
|
205
|
+
{allowEdit && (
|
|
206
|
+
<Stack gap="xs">
|
|
207
|
+
<Textarea
|
|
208
|
+
placeholder="Add a note..."
|
|
209
|
+
minRows={4}
|
|
210
|
+
value={note ?? ''}
|
|
211
|
+
onChange={(e) => setNote(e.currentTarget.value)}
|
|
212
|
+
autosize
|
|
213
|
+
/>
|
|
214
|
+
<Flex justify="flex-end">
|
|
215
|
+
<Button type="submit" disabled={!note || note.trim() === ''} onClick={handleAddComment}>
|
|
216
|
+
Submit
|
|
217
|
+
</Button>
|
|
218
|
+
</Flex>
|
|
219
|
+
</Stack>
|
|
220
|
+
)}
|
|
221
|
+
</Stack>
|
|
222
|
+
</Stack>
|
|
223
|
+
</ScrollArea>
|
|
224
|
+
|
|
225
|
+
<Modal
|
|
226
|
+
opened={showDeleteModal}
|
|
227
|
+
onClose={() => setShowDeleteModal(false)}
|
|
228
|
+
title="Delete Task"
|
|
229
|
+
size="md"
|
|
230
|
+
centered
|
|
231
|
+
>
|
|
232
|
+
<Stack gap="md">
|
|
233
|
+
<Text>Are you sure you want to delete this task? This action cannot be undone.</Text>
|
|
234
|
+
<Text fw={500} c="dimmed">
|
|
235
|
+
Task: {getDisplayString(task)}
|
|
236
|
+
</Text>
|
|
237
|
+
<Flex justify="flex-end" gap="sm">
|
|
238
|
+
<Button variant="outline" onClick={() => setShowDeleteModal(false)}>
|
|
239
|
+
Cancel
|
|
240
|
+
</Button>
|
|
241
|
+
<Button color="red" onClick={confirmDeleteTask}>
|
|
242
|
+
Delete
|
|
243
|
+
</Button>
|
|
244
|
+
</Flex>
|
|
245
|
+
</Stack>
|
|
246
|
+
</Modal>
|
|
247
|
+
</Paper>
|
|
248
|
+
</Flex>
|
|
249
|
+
);
|
|
250
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
.contentContainer {
|
|
2
|
+
transition: background 0.2s;
|
|
3
|
+
cursor: pointer;
|
|
4
|
+
transition: all 0.2s ease;
|
|
5
|
+
border: 1px solid transparent;
|
|
6
|
+
text-decoration: none;
|
|
7
|
+
color: light-dark(var(--mantine-color-dark-9), var(--mantine-color-gray-0));
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.content {
|
|
11
|
+
flex: 1;
|
|
12
|
+
text-overflow: ellipsis;
|
|
13
|
+
overflow: hidden;
|
|
14
|
+
word-break: ellipsis;
|
|
15
|
+
white-space: nowrap;
|
|
16
|
+
}
|
|
17
|
+
.contentContainer:hover {
|
|
18
|
+
background-color: light-dark(var(--mantine-color-gray-2), var(--mantine-color-dark-9));
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.contentContainer.selected {
|
|
22
|
+
background: light-dark(var(--mantine-color-gray-2), var(--mantine-color-dark-9));
|
|
23
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
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 } from '@testing-library/react';
|
|
5
|
+
import { MedplumProvider } from '@medplum/react';
|
|
6
|
+
import { MockClient } from '@medplum/mock';
|
|
7
|
+
import { MemoryRouter } from 'react-router';
|
|
8
|
+
import { describe, expect, test, beforeEach, vi } from 'vitest';
|
|
9
|
+
import { TaskListItem } from './TaskListItem';
|
|
10
|
+
import type { Task, Patient, Practitioner } from '@medplum/fhirtypes';
|
|
11
|
+
|
|
12
|
+
describe('TaskListItem', () => {
|
|
13
|
+
let medplum: MockClient;
|
|
14
|
+
|
|
15
|
+
beforeEach(() => {
|
|
16
|
+
medplum = new MockClient();
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const setup = (task: Task, selectedTask?: Task, getTaskUri?: (task: Task) => string): ReturnType<typeof render> => {
|
|
20
|
+
const defaultGetTaskUri = (t: Task): string => `/Task/${t.id}`;
|
|
21
|
+
return render(
|
|
22
|
+
<MemoryRouter>
|
|
23
|
+
<MedplumProvider medplum={medplum}>
|
|
24
|
+
<MantineProvider>
|
|
25
|
+
<TaskListItem task={task} selectedTask={selectedTask} getTaskUri={getTaskUri ?? defaultGetTaskUri} />
|
|
26
|
+
</MantineProvider>
|
|
27
|
+
</MedplumProvider>
|
|
28
|
+
</MemoryRouter>
|
|
29
|
+
);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const mockTask: Task = {
|
|
33
|
+
resourceType: 'Task',
|
|
34
|
+
id: 'task-123',
|
|
35
|
+
status: 'in-progress',
|
|
36
|
+
intent: 'order',
|
|
37
|
+
code: { text: 'Test Task' },
|
|
38
|
+
authoredOn: '2023-01-01T12:00:00Z',
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
test('renders task details correctly', () => {
|
|
42
|
+
setup(mockTask);
|
|
43
|
+
expect(screen.getByText('Test Task')).toBeInTheDocument();
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
test('renders status badge with correct status', () => {
|
|
47
|
+
setup(mockTask);
|
|
48
|
+
expect(screen.getByText('in progress')).toBeInTheDocument();
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
test('renders different status values correctly', () => {
|
|
52
|
+
const completedTask: Task = {
|
|
53
|
+
...mockTask,
|
|
54
|
+
status: 'completed',
|
|
55
|
+
};
|
|
56
|
+
setup(completedTask);
|
|
57
|
+
expect(screen.getByText('completed')).toBeInTheDocument();
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
test('renders due date if present', () => {
|
|
61
|
+
const taskWithDueDate: Task = {
|
|
62
|
+
...mockTask,
|
|
63
|
+
restriction: { period: { end: '2023-02-01' } },
|
|
64
|
+
};
|
|
65
|
+
setup(taskWithDueDate);
|
|
66
|
+
expect(screen.getByText(/Due/)).toBeInTheDocument();
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
test('renders patient name if present', async () => {
|
|
70
|
+
const patient: Patient = {
|
|
71
|
+
resourceType: 'Patient',
|
|
72
|
+
id: 'patient-123',
|
|
73
|
+
name: [{ given: ['John'], family: 'Doe' }],
|
|
74
|
+
};
|
|
75
|
+
await medplum.createResource(patient);
|
|
76
|
+
|
|
77
|
+
const taskWithPatient: Task = {
|
|
78
|
+
...mockTask,
|
|
79
|
+
for: { reference: 'Patient/patient-123' },
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
setup(taskWithPatient);
|
|
83
|
+
|
|
84
|
+
expect(await screen.findByText('For: John Doe')).toBeInTheDocument();
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
test('renders assignee name if present', async () => {
|
|
88
|
+
const practitioner: Practitioner = {
|
|
89
|
+
resourceType: 'Practitioner',
|
|
90
|
+
id: 'practitioner-123',
|
|
91
|
+
name: [{ given: ['Jane'], family: 'Smith' }],
|
|
92
|
+
};
|
|
93
|
+
await medplum.createResource(practitioner);
|
|
94
|
+
|
|
95
|
+
const taskWithOwner: Task = {
|
|
96
|
+
...mockTask,
|
|
97
|
+
owner: { reference: 'Practitioner/practitioner-123' },
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
setup(taskWithOwner);
|
|
101
|
+
|
|
102
|
+
expect(await screen.findByText('Assigned to Jane Smith')).toBeInTheDocument();
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
test('highlights selected task', () => {
|
|
106
|
+
setup(mockTask, mockTask);
|
|
107
|
+
expect(screen.getByText('Test Task')).toBeInTheDocument();
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
test('uses getTaskUri URL', () => {
|
|
111
|
+
setup(mockTask);
|
|
112
|
+
const link = screen.getByRole('link');
|
|
113
|
+
expect(link).toHaveAttribute('href', '/Task/task-123');
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
test('uses custom URL from getTaskUri when provided', () => {
|
|
117
|
+
const getTaskUri = (task: Task): string => {
|
|
118
|
+
return `/Patient/patient-123/Task/${task.id}`;
|
|
119
|
+
};
|
|
120
|
+
render(
|
|
121
|
+
<MemoryRouter>
|
|
122
|
+
<MedplumProvider medplum={medplum}>
|
|
123
|
+
<MantineProvider>
|
|
124
|
+
<TaskListItem task={mockTask} selectedTask={undefined} getTaskUri={getTaskUri} />
|
|
125
|
+
</MantineProvider>
|
|
126
|
+
</MedplumProvider>
|
|
127
|
+
</MemoryRouter>
|
|
128
|
+
);
|
|
129
|
+
const link = screen.getByRole('link');
|
|
130
|
+
expect(link).toHaveAttribute('href', '/Patient/patient-123/Task/task-123');
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
test('calls getTaskUri with correct task', () => {
|
|
134
|
+
const getTaskUri = vi.fn((task: Task) => `/Custom/${task.id}`);
|
|
135
|
+
render(
|
|
136
|
+
<MemoryRouter>
|
|
137
|
+
<MedplumProvider medplum={medplum}>
|
|
138
|
+
<MantineProvider>
|
|
139
|
+
<TaskListItem task={mockTask} selectedTask={undefined} getTaskUri={getTaskUri} />
|
|
140
|
+
</MantineProvider>
|
|
141
|
+
</MedplumProvider>
|
|
142
|
+
</MemoryRouter>
|
|
143
|
+
);
|
|
144
|
+
expect(getTaskUri).toHaveBeenCalledWith(mockTask);
|
|
145
|
+
expect(getTaskUri).toHaveBeenCalledTimes(1);
|
|
146
|
+
const link = screen.getByRole('link');
|
|
147
|
+
expect(link).toHaveAttribute('href', '/Custom/task-123');
|
|
148
|
+
});
|
|
149
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { Group, Stack, Text } from '@mantine/core';
|
|
4
|
+
import { formatDate, formatHumanName } from '@medplum/core';
|
|
5
|
+
import { MedplumLink, StatusBadge, useResource } from '@medplum/react';
|
|
6
|
+
import type { HumanName, Task } from '@medplum/fhirtypes';
|
|
7
|
+
import type { JSX } from 'react';
|
|
8
|
+
import classes from './TaskListItem.module.css';
|
|
9
|
+
import cx from 'clsx';
|
|
10
|
+
|
|
11
|
+
interface TaskListItemProps {
|
|
12
|
+
task: Task;
|
|
13
|
+
selectedTask: Task | undefined;
|
|
14
|
+
getTaskUri: (task: Task) => string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function TaskListItem(props: TaskListItemProps): JSX.Element {
|
|
18
|
+
const { task, selectedTask, getTaskUri } = props;
|
|
19
|
+
const isSelected = selectedTask?.id === task.id;
|
|
20
|
+
const patient = useResource(task.for);
|
|
21
|
+
const owner = useResource(task.owner);
|
|
22
|
+
const taskFrom = task?.authoredOn ? `from ${formatDate(task?.authoredOn)}` : '';
|
|
23
|
+
const taskUrl = getTaskUri(task);
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<MedplumLink to={taskUrl}>
|
|
27
|
+
<Group
|
|
28
|
+
p="xs"
|
|
29
|
+
align="center"
|
|
30
|
+
wrap="nowrap"
|
|
31
|
+
className={cx(classes.contentContainer, {
|
|
32
|
+
[classes.selected]: isSelected,
|
|
33
|
+
})}
|
|
34
|
+
>
|
|
35
|
+
<Stack gap={0} flex={1}>
|
|
36
|
+
<Group justify="space-between" align="flex-start" wrap="nowrap">
|
|
37
|
+
<Text fw={700} className={classes.content}>
|
|
38
|
+
{task.code?.text ?? `Task ${taskFrom}`}
|
|
39
|
+
</Text>
|
|
40
|
+
<StatusBadge status={task.status} variant="light" />
|
|
41
|
+
</Group>
|
|
42
|
+
<Stack gap={0} c="dimmed">
|
|
43
|
+
{task.restriction?.period && <Text fw={500}>Due {formatDate(task.restriction?.period?.end)}</Text>}
|
|
44
|
+
{patient?.resourceType === 'Patient' && <Text>For: {formatHumanName(patient.name?.[0] as HumanName)}</Text>}
|
|
45
|
+
{owner?.resourceType === 'Practitioner' && (
|
|
46
|
+
<Text size="sm">Assigned to {formatHumanName(owner.name?.[0] as HumanName)}</Text>
|
|
47
|
+
)}
|
|
48
|
+
</Stack>
|
|
49
|
+
</Stack>
|
|
50
|
+
</Group>
|
|
51
|
+
</MedplumLink>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
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 } from '@testing-library/react';
|
|
5
|
+
import { MedplumProvider } from '@medplum/react';
|
|
6
|
+
import { MockClient } from '@medplum/mock';
|
|
7
|
+
import { describe, expect, test, beforeEach } from 'vitest';
|
|
8
|
+
import { TaskNoteItem } from './TaskNoteItem';
|
|
9
|
+
import type { Annotation, Practitioner } from '@medplum/fhirtypes';
|
|
10
|
+
|
|
11
|
+
describe('TaskNoteItem', () => {
|
|
12
|
+
let medplum: MockClient;
|
|
13
|
+
|
|
14
|
+
beforeEach(() => {
|
|
15
|
+
medplum = new MockClient();
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const setup = (note: Annotation): ReturnType<typeof render> => {
|
|
19
|
+
return render(
|
|
20
|
+
<MedplumProvider medplum={medplum}>
|
|
21
|
+
<MantineProvider>
|
|
22
|
+
<TaskNoteItem note={note} index={0} />
|
|
23
|
+
</MantineProvider>
|
|
24
|
+
</MedplumProvider>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
test('renders note text', () => {
|
|
29
|
+
const note: Annotation = {
|
|
30
|
+
text: 'Test note content',
|
|
31
|
+
time: '2023-01-01T12:00:00Z',
|
|
32
|
+
};
|
|
33
|
+
setup(note);
|
|
34
|
+
expect(screen.getByText('Test note content')).toBeInTheDocument();
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
test('renders author name', async () => {
|
|
38
|
+
const practitioner: Practitioner = {
|
|
39
|
+
resourceType: 'Practitioner',
|
|
40
|
+
id: 'practitioner-123',
|
|
41
|
+
name: [{ given: ['Alice'], family: 'Wonderland' }],
|
|
42
|
+
};
|
|
43
|
+
await medplum.createResource(practitioner);
|
|
44
|
+
|
|
45
|
+
const note: Annotation = {
|
|
46
|
+
text: 'Note with author',
|
|
47
|
+
authorReference: { reference: 'Practitioner/practitioner-123' },
|
|
48
|
+
time: '2023-01-01T12:00:00Z',
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
setup(note);
|
|
52
|
+
|
|
53
|
+
expect(await screen.findByText('Alice Wonderland')).toBeInTheDocument();
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
test('renders links in text', () => {
|
|
57
|
+
const note: Annotation = {
|
|
58
|
+
text: 'Check this link: https://example.com',
|
|
59
|
+
time: '2023-01-01T12:00:00Z',
|
|
60
|
+
};
|
|
61
|
+
setup(note);
|
|
62
|
+
|
|
63
|
+
const link = screen.getByText('https://example.com');
|
|
64
|
+
expect(link).toBeInTheDocument();
|
|
65
|
+
expect(link.tagName).toBe('A');
|
|
66
|
+
expect(link).toHaveAttribute('href', 'https://example.com');
|
|
67
|
+
});
|
|
68
|
+
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { Anchor, Divider, Group, Stack, Text } from '@mantine/core';
|
|
5
|
+
import { formatDateTime, getDisplayString } from '@medplum/core';
|
|
6
|
+
import type { Annotation } from '@medplum/fhirtypes';
|
|
7
|
+
import { ResourceAvatar, useResource } from '@medplum/react';
|
|
8
|
+
import React from 'react';
|
|
9
|
+
|
|
10
|
+
interface TaskNoteItemProps {
|
|
11
|
+
note: Annotation;
|
|
12
|
+
index: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function renderTextWithLinks(text: string): React.ReactNode {
|
|
16
|
+
const urlRegex = /(https?:\/\/[^\s]+)/g;
|
|
17
|
+
const parts = text.split(urlRegex);
|
|
18
|
+
|
|
19
|
+
return parts.map((part, index) => {
|
|
20
|
+
if (urlRegex.test(part)) {
|
|
21
|
+
return (
|
|
22
|
+
<Anchor key={index} href={part} target="_blank" rel="noopener noreferrer">
|
|
23
|
+
{part}
|
|
24
|
+
</Anchor>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
return part;
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function TaskNoteItem(props: TaskNoteItemProps): React.JSX.Element {
|
|
32
|
+
const { note } = props;
|
|
33
|
+
const author = useResource(note.authorReference);
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<Stack gap="md" pt="sm" pb="sm">
|
|
37
|
+
<Group align="center" gap="xs">
|
|
38
|
+
<ResourceAvatar value={note.authorReference} radius="xl" size={36} />
|
|
39
|
+
<Text fw={500}>{author && getDisplayString(author)}</Text>
|
|
40
|
+
<Text>{formatDateTime(note.time ?? '')}</Text>
|
|
41
|
+
</Group>
|
|
42
|
+
<Text>{note.text ? renderTextWithLinks(note.text) : ''}</Text>
|
|
43
|
+
<Divider />
|
|
44
|
+
</Stack>
|
|
45
|
+
);
|
|
46
|
+
}
|