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
package/dist/examples/vintasend-medplum-example/src/components/encounter/SignLockDialog.test.tsx
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { MantineProvider } from '@mantine/core';
|
|
4
|
+
import { act, render, screen, waitFor } from '@testing-library/react';
|
|
5
|
+
import userEvent from '@testing-library/user-event';
|
|
6
|
+
import { MedplumProvider } from '@medplum/react';
|
|
7
|
+
import { MockClient } from '@medplum/mock';
|
|
8
|
+
import { MemoryRouter } from 'react-router';
|
|
9
|
+
import { describe, expect, test, beforeEach, vi } from 'vitest';
|
|
10
|
+
import { SignLockDialog } from './SignLockDialog';
|
|
11
|
+
|
|
12
|
+
describe('SignLockDialog', () => {
|
|
13
|
+
let medplum: MockClient;
|
|
14
|
+
|
|
15
|
+
beforeEach(async () => {
|
|
16
|
+
medplum = new MockClient();
|
|
17
|
+
vi.clearAllMocks();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const setup = (props: Partial<Parameters<typeof SignLockDialog>[0]> = {}): ReturnType<typeof render> => {
|
|
21
|
+
return render(
|
|
22
|
+
<MemoryRouter>
|
|
23
|
+
<MedplumProvider medplum={medplum}>
|
|
24
|
+
<MantineProvider>
|
|
25
|
+
<SignLockDialog onSign={vi.fn()} {...props} />
|
|
26
|
+
</MantineProvider>
|
|
27
|
+
</MedplumProvider>
|
|
28
|
+
</MemoryRouter>
|
|
29
|
+
);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
test('renders sign and lock button', () => {
|
|
33
|
+
setup();
|
|
34
|
+
|
|
35
|
+
expect(screen.getByText('Sign & Lock Note')).toBeInTheDocument();
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
test('renders just sign button', () => {
|
|
39
|
+
setup();
|
|
40
|
+
|
|
41
|
+
expect(screen.getByText('Just Sign')).toBeInTheDocument();
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
test('displays practitioner information', async () => {
|
|
45
|
+
await act(async () => {
|
|
46
|
+
setup();
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
await waitFor(() => {
|
|
50
|
+
expect(screen.getByText(/Alice Smith/i)).toBeInTheDocument();
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
test('calls onSign with lock=true when sign and lock is clicked', async () => {
|
|
55
|
+
const user = userEvent.setup();
|
|
56
|
+
const onSign = vi.fn();
|
|
57
|
+
await act(async () => {
|
|
58
|
+
setup({ onSign });
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
await waitFor(() => {
|
|
62
|
+
expect(screen.getByText('Sign & Lock Note')).toBeInTheDocument();
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
await user.click(screen.getByText('Sign & Lock Note'));
|
|
66
|
+
|
|
67
|
+
await waitFor(() => {
|
|
68
|
+
expect(onSign).toHaveBeenCalled();
|
|
69
|
+
const call = onSign.mock.calls[0];
|
|
70
|
+
expect(call[1]).toBe(true);
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
test('calls onSign with lock=false when just sign is clicked', async () => {
|
|
75
|
+
const user = userEvent.setup();
|
|
76
|
+
const onSign = vi.fn();
|
|
77
|
+
await act(async () => {
|
|
78
|
+
setup({ onSign });
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
await waitFor(() => {
|
|
82
|
+
expect(screen.getByText('Just Sign')).toBeInTheDocument();
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
await user.click(screen.getByText('Just Sign'));
|
|
86
|
+
|
|
87
|
+
await waitFor(() => {
|
|
88
|
+
expect(onSign).toHaveBeenCalled();
|
|
89
|
+
const call = onSign.mock.calls[0];
|
|
90
|
+
expect(call[1]).toBe(false);
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
test('handles error gracefully when no author is found', async () => {
|
|
95
|
+
const user = userEvent.setup();
|
|
96
|
+
const onSign = vi.fn();
|
|
97
|
+
const medplumWithoutProfile = new MockClient({ profile: null });
|
|
98
|
+
|
|
99
|
+
render(
|
|
100
|
+
<MemoryRouter>
|
|
101
|
+
<MedplumProvider medplum={medplumWithoutProfile}>
|
|
102
|
+
<MantineProvider>
|
|
103
|
+
<SignLockDialog onSign={onSign} />
|
|
104
|
+
</MantineProvider>
|
|
105
|
+
</MedplumProvider>
|
|
106
|
+
</MemoryRouter>
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
await waitFor(() => {
|
|
110
|
+
expect(screen.getByText('Sign & Lock Note')).toBeInTheDocument();
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
await user.click(screen.getByText('Sign & Lock Note'));
|
|
114
|
+
|
|
115
|
+
// Verify that onSign is not called when there's no author
|
|
116
|
+
await waitFor(() => {
|
|
117
|
+
expect(onSign).not.toHaveBeenCalled();
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
});
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { Button, Group, Paper, Stack, Text } from '@mantine/core';
|
|
4
|
+
import { createReference } from '@medplum/core';
|
|
5
|
+
import type { Practitioner, Reference } from '@medplum/fhirtypes';
|
|
6
|
+
import { ResourceAvatar, useMedplumProfile } from '@medplum/react';
|
|
7
|
+
import { IconLock, IconSignature } from '@tabler/icons-react';
|
|
8
|
+
import type { JSX } from 'react';
|
|
9
|
+
import { showErrorNotification } from '../../utils/notifications';
|
|
10
|
+
|
|
11
|
+
interface SignLockDialogProps {
|
|
12
|
+
onSign: (practitioner: Reference<Practitioner>, lock: boolean) => void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const SignLockDialog = (props: SignLockDialogProps): JSX.Element => {
|
|
16
|
+
const { onSign } = props;
|
|
17
|
+
const author = useMedplumProfile();
|
|
18
|
+
const authorReference = author ? (createReference(author) as Reference<Practitioner>) : undefined;
|
|
19
|
+
|
|
20
|
+
const handleSign = (lock: boolean): void => {
|
|
21
|
+
if (!authorReference) {
|
|
22
|
+
showErrorNotification('No author information found');
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
onSign(authorReference, lock);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<Stack gap="md">
|
|
31
|
+
<Paper p="sm" withBorder radius="md">
|
|
32
|
+
<Group gap="sm">
|
|
33
|
+
<ResourceAvatar value={authorReference} radius="xl" size={36} />
|
|
34
|
+
<Text size="sm" fw={500}>
|
|
35
|
+
{authorReference?.display}
|
|
36
|
+
</Text>
|
|
37
|
+
</Group>
|
|
38
|
+
</Paper>
|
|
39
|
+
|
|
40
|
+
<Stack gap={0}>
|
|
41
|
+
<Button fullWidth leftSection={<IconLock size={18} />} onClick={() => handleSign(true)} mt="md">
|
|
42
|
+
Sign & Lock Note
|
|
43
|
+
</Button>
|
|
44
|
+
|
|
45
|
+
<Button
|
|
46
|
+
variant="outline"
|
|
47
|
+
fullWidth
|
|
48
|
+
leftSection={<IconSignature size={18} />}
|
|
49
|
+
onClick={() => handleSign(false)}
|
|
50
|
+
mt="md"
|
|
51
|
+
>
|
|
52
|
+
Just Sign
|
|
53
|
+
</Button>
|
|
54
|
+
</Stack>
|
|
55
|
+
</Stack>
|
|
56
|
+
);
|
|
57
|
+
};
|
package/dist/examples/vintasend-medplum-example/src/components/encounter/VisitDetailsPanel.test.tsx
ADDED
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { MantineProvider } from '@mantine/core';
|
|
4
|
+
import { act, fireEvent, render, screen, waitFor } from '@testing-library/react';
|
|
5
|
+
import userEvent from '@testing-library/user-event';
|
|
6
|
+
import { MedplumProvider } from '@medplum/react';
|
|
7
|
+
import type { Encounter, Practitioner } from '@medplum/fhirtypes';
|
|
8
|
+
import { MockClient } from '@medplum/mock';
|
|
9
|
+
import { MemoryRouter } from 'react-router';
|
|
10
|
+
import { describe, expect, test, beforeEach, vi } from 'vitest';
|
|
11
|
+
import { VisitDetailsPanel } from './VisitDetailsPanel';
|
|
12
|
+
|
|
13
|
+
const mockEncounter: Encounter = {
|
|
14
|
+
resourceType: 'Encounter',
|
|
15
|
+
id: 'encounter-123',
|
|
16
|
+
status: 'in-progress',
|
|
17
|
+
class: { code: 'AMB', system: 'http://terminology.hl7.org/CodeSystem/v3-ActCode' },
|
|
18
|
+
period: {
|
|
19
|
+
start: '2024-01-01T10:00:00Z',
|
|
20
|
+
end: '2024-01-01T11:00:00Z',
|
|
21
|
+
},
|
|
22
|
+
subject: { reference: 'Patient/patient-123' },
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const mockPractitioner: Practitioner = {
|
|
26
|
+
resourceType: 'Practitioner',
|
|
27
|
+
id: 'practitioner-123',
|
|
28
|
+
name: [{ given: ['Dr.'], family: 'Test' }],
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
describe('VisitDetailsPanel', () => {
|
|
32
|
+
let medplum: MockClient;
|
|
33
|
+
|
|
34
|
+
beforeEach(async () => {
|
|
35
|
+
medplum = new MockClient();
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const setup = (props: Partial<Parameters<typeof VisitDetailsPanel>[0]> = {}): ReturnType<typeof render> => {
|
|
39
|
+
return render(
|
|
40
|
+
<MemoryRouter>
|
|
41
|
+
<MedplumProvider medplum={medplum}>
|
|
42
|
+
<MantineProvider>
|
|
43
|
+
<VisitDetailsPanel encounter={mockEncounter} onEncounterChange={vi.fn()} {...props} />
|
|
44
|
+
</MantineProvider>
|
|
45
|
+
</MedplumProvider>
|
|
46
|
+
</MemoryRouter>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
test('renders visit details title', () => {
|
|
51
|
+
setup();
|
|
52
|
+
|
|
53
|
+
expect(screen.getByText('Visit Details')).toBeInTheDocument();
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
test('renders practitioner input', () => {
|
|
57
|
+
setup();
|
|
58
|
+
|
|
59
|
+
expect(screen.getByText(/Practitioner/i)).toBeInTheDocument();
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
test('renders check in date input', () => {
|
|
63
|
+
setup();
|
|
64
|
+
|
|
65
|
+
expect(screen.getByLabelText(/Check in/i)).toBeInTheDocument();
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
test('renders check out date input', () => {
|
|
69
|
+
setup();
|
|
70
|
+
|
|
71
|
+
expect(screen.getByLabelText(/Check out/i)).toBeInTheDocument();
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
test('calls onEncounterChange when practitioner is changed', async () => {
|
|
75
|
+
const onEncounterChange = vi.fn();
|
|
76
|
+
|
|
77
|
+
const mockPractitioner1: Practitioner = {
|
|
78
|
+
resourceType: 'Practitioner',
|
|
79
|
+
id: 'practitioner-1',
|
|
80
|
+
name: [{ given: ['Dr.'], family: 'Test' }],
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const mockPractitioner2: Practitioner = {
|
|
84
|
+
resourceType: 'Practitioner',
|
|
85
|
+
id: 'practitioner-2',
|
|
86
|
+
name: [{ given: ['Dr.'], family: 'Smith' }],
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
await medplum.createResource(mockPractitioner1);
|
|
90
|
+
await medplum.createResource(mockPractitioner2);
|
|
91
|
+
|
|
92
|
+
// Mock search to return practitioners
|
|
93
|
+
vi.spyOn(medplum, 'searchResources').mockResolvedValue([mockPractitioner1, mockPractitioner2] as any);
|
|
94
|
+
|
|
95
|
+
// Start without a practitioner selected so ResourceInput shows a searchbox
|
|
96
|
+
setup({ onEncounterChange });
|
|
97
|
+
|
|
98
|
+
await waitFor(() => {
|
|
99
|
+
expect(screen.getByText(/Practitioner/i)).toBeInTheDocument();
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
// Find the ResourceInput searchbox (ResourceInput uses AsyncAutocomplete which renders a searchbox)
|
|
103
|
+
await waitFor(
|
|
104
|
+
() => {
|
|
105
|
+
const searchbox = screen.queryByRole('searchbox');
|
|
106
|
+
expect(searchbox).toBeInTheDocument();
|
|
107
|
+
},
|
|
108
|
+
{ timeout: 3000 }
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
const practitionerInput = screen.getByRole('searchbox');
|
|
112
|
+
|
|
113
|
+
// Type to search for a practitioner using fireEvent.change (like PlanDefinitionBuilder)
|
|
114
|
+
await act(async () => {
|
|
115
|
+
fireEvent.change(practitionerInput, { target: { value: 'Smith' } });
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
// Wait for search to be called
|
|
119
|
+
await waitFor(
|
|
120
|
+
() => {
|
|
121
|
+
expect(medplum.searchResources).toHaveBeenCalledWith(
|
|
122
|
+
'Practitioner',
|
|
123
|
+
expect.any(URLSearchParams),
|
|
124
|
+
expect.any(Object)
|
|
125
|
+
);
|
|
126
|
+
},
|
|
127
|
+
{ timeout: 3000 }
|
|
128
|
+
);
|
|
129
|
+
|
|
130
|
+
// Wait for the dropdown option to appear and click it (like PlanDefinitionBuilder)
|
|
131
|
+
// The display string for Practitioner is typically "Dr. Smith" or just "Smith"
|
|
132
|
+
await waitFor(
|
|
133
|
+
() => {
|
|
134
|
+
const smithOption = screen.queryByText(/Smith/i);
|
|
135
|
+
expect(smithOption).toBeInTheDocument();
|
|
136
|
+
},
|
|
137
|
+
{ timeout: 3000 }
|
|
138
|
+
);
|
|
139
|
+
|
|
140
|
+
await act(async () => {
|
|
141
|
+
const smithOption = screen.getByText(/Smith/i);
|
|
142
|
+
fireEvent.click(smithOption);
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
// Verify onEncounterChange was called with updated encounter
|
|
146
|
+
await waitFor(
|
|
147
|
+
() => {
|
|
148
|
+
expect(onEncounterChange).toHaveBeenCalled();
|
|
149
|
+
const call = onEncounterChange.mock.calls[onEncounterChange.mock.calls.length - 1];
|
|
150
|
+
const updatedEncounter = call[0] as Encounter;
|
|
151
|
+
expect(updatedEncounter.participant).toBeDefined();
|
|
152
|
+
expect(updatedEncounter.participant?.[0]?.individual?.reference).toBe('Practitioner/practitioner-2');
|
|
153
|
+
},
|
|
154
|
+
{ timeout: 5000 }
|
|
155
|
+
);
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
test('calls onEncounterChange when check in time is changed', async () => {
|
|
159
|
+
const user = userEvent.setup();
|
|
160
|
+
const onEncounterChange = vi.fn();
|
|
161
|
+
setup({ onEncounterChange });
|
|
162
|
+
|
|
163
|
+
const checkinInput = screen.getByLabelText(/Check in/i);
|
|
164
|
+
await user.clear(checkinInput);
|
|
165
|
+
await user.type(checkinInput, '2024-01-02T10:00:00Z');
|
|
166
|
+
|
|
167
|
+
await waitFor(() => {
|
|
168
|
+
expect(onEncounterChange).toHaveBeenCalled();
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
test('calls onEncounterChange when check out time is changed', async () => {
|
|
173
|
+
const user = userEvent.setup();
|
|
174
|
+
const onEncounterChange = vi.fn();
|
|
175
|
+
setup({ onEncounterChange });
|
|
176
|
+
|
|
177
|
+
const checkoutInput = screen.getByLabelText(/Check out/i);
|
|
178
|
+
await user.clear(checkoutInput);
|
|
179
|
+
await user.type(checkoutInput, '2024-01-02T11:00:00Z');
|
|
180
|
+
|
|
181
|
+
await waitFor(() => {
|
|
182
|
+
expect(onEncounterChange).toHaveBeenCalled();
|
|
183
|
+
});
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
test('displays default practitioner value', async () => {
|
|
187
|
+
await medplum.createResource(mockPractitioner);
|
|
188
|
+
setup({ practitioner: mockPractitioner });
|
|
189
|
+
|
|
190
|
+
await waitFor(() => {
|
|
191
|
+
expect(screen.getByText(/Practitioner/i)).toBeInTheDocument();
|
|
192
|
+
expect(screen.getByText(/Dr\. Test/i)).toBeInTheDocument();
|
|
193
|
+
});
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
test('displays default check in time', () => {
|
|
197
|
+
setup();
|
|
198
|
+
|
|
199
|
+
const checkinInput = screen.getByLabelText(/Check in/i);
|
|
200
|
+
// DateTimeInput converts UTC to local time, so we need to format in local time
|
|
201
|
+
const utcDate = new Date('2024-01-01T10:00:00Z');
|
|
202
|
+
const year = utcDate.getFullYear();
|
|
203
|
+
const month = String(utcDate.getMonth() + 1).padStart(2, '0');
|
|
204
|
+
const day = String(utcDate.getDate()).padStart(2, '0');
|
|
205
|
+
const hours = String(utcDate.getHours()).padStart(2, '0');
|
|
206
|
+
const minutes = String(utcDate.getMinutes()).padStart(2, '0');
|
|
207
|
+
const localTimeString = `${year}-${month}-${day}T${hours}:${minutes}`;
|
|
208
|
+
expect(checkinInput).toHaveValue(localTimeString);
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
test('displays default check out time', () => {
|
|
212
|
+
setup();
|
|
213
|
+
|
|
214
|
+
const checkoutInput = screen.getByLabelText(/Check out/i);
|
|
215
|
+
const utcDate = new Date('2024-01-01T11:00:00Z');
|
|
216
|
+
const year = utcDate.getFullYear();
|
|
217
|
+
const month = String(utcDate.getMonth() + 1).padStart(2, '0');
|
|
218
|
+
const day = String(utcDate.getDate()).padStart(2, '0');
|
|
219
|
+
const hours = String(utcDate.getHours()).padStart(2, '0');
|
|
220
|
+
const minutes = String(utcDate.getMinutes()).padStart(2, '0');
|
|
221
|
+
const localTimeString = `${year}-${month}-${day}T${hours}:${minutes}`;
|
|
222
|
+
expect(checkoutInput).toHaveValue(localTimeString);
|
|
223
|
+
});
|
|
224
|
+
});
|
package/dist/examples/vintasend-medplum-example/src/components/encounter/VisitDetailsPanel.tsx
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { Card, Stack, Text } from '@mantine/core';
|
|
4
|
+
import { getReferenceString } from '@medplum/core';
|
|
5
|
+
import type { Encounter, Practitioner } from '@medplum/fhirtypes';
|
|
6
|
+
import { DateTimeInput, ResourceInput } from '@medplum/react';
|
|
7
|
+
import type { JSX } from 'react';
|
|
8
|
+
|
|
9
|
+
interface VisitDetailsPanelProps {
|
|
10
|
+
practitioner?: Practitioner;
|
|
11
|
+
encounter: Encounter;
|
|
12
|
+
onEncounterChange: (encounter: Encounter) => void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const VisitDetailsPanel = (props: VisitDetailsPanelProps): JSX.Element => {
|
|
16
|
+
const { practitioner, encounter, onEncounterChange } = props;
|
|
17
|
+
|
|
18
|
+
const handlePractitionerChange = async (practitioner: Practitioner | undefined): Promise<void> => {
|
|
19
|
+
if (!encounter || !practitioner) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const updatedEncounter = {
|
|
24
|
+
...encounter,
|
|
25
|
+
participant: [
|
|
26
|
+
{
|
|
27
|
+
individual: {
|
|
28
|
+
reference: getReferenceString(practitioner),
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
onEncounterChange(updatedEncounter);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const handleCheckinChange = async (checkin: string): Promise<void> => {
|
|
38
|
+
if (!encounter || !checkin) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const updatedEncounter = {
|
|
43
|
+
...encounter,
|
|
44
|
+
period: {
|
|
45
|
+
start: checkin,
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
onEncounterChange(updatedEncounter);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const handleCheckoutChange = async (checkout: string): Promise<void> => {
|
|
53
|
+
if (!encounter || !checkout) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const updatedEncounter = {
|
|
58
|
+
...encounter,
|
|
59
|
+
period: {
|
|
60
|
+
end: checkout,
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
onEncounterChange(updatedEncounter);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<Stack gap={0}>
|
|
69
|
+
<Text fw={600} size="lg" mb="md">
|
|
70
|
+
Visit Details
|
|
71
|
+
</Text>
|
|
72
|
+
<Card withBorder shadow="sm" p="md">
|
|
73
|
+
<Stack gap="md">
|
|
74
|
+
<ResourceInput
|
|
75
|
+
resourceType="Practitioner"
|
|
76
|
+
name="practitioner"
|
|
77
|
+
label="Practitioner"
|
|
78
|
+
placeholder="Search for practitioner"
|
|
79
|
+
defaultValue={practitioner}
|
|
80
|
+
onChange={handlePractitionerChange}
|
|
81
|
+
/>
|
|
82
|
+
|
|
83
|
+
<DateTimeInput
|
|
84
|
+
name="checkin"
|
|
85
|
+
label="Check in"
|
|
86
|
+
defaultValue={encounter.period?.start}
|
|
87
|
+
onChange={handleCheckinChange}
|
|
88
|
+
/>
|
|
89
|
+
|
|
90
|
+
<DateTimeInput
|
|
91
|
+
name="checkout"
|
|
92
|
+
label="Check out"
|
|
93
|
+
defaultValue={encounter.period?.end}
|
|
94
|
+
onChange={handleCheckoutChange}
|
|
95
|
+
/>
|
|
96
|
+
</Stack>
|
|
97
|
+
</Card>
|
|
98
|
+
</Stack>
|
|
99
|
+
);
|
|
100
|
+
};
|