feat(frontend): room occupancy + invoice-to-client checkout and workspace task unification - #1749
Merged
Conversation
added 14 commits
July 1, 2026 19:07
ghost
requested a review
from harshvardhan-yc
July 1, 2026 14:21
added 5 commits
July 1, 2026 20:08
…l instructions/notes sections
harshvardhan-yc
approved these changes
Jul 1, 2026
harshvardhan-yc
left a comment
Contributor
There was a problem hiding this comment.
LGTM. Ready to merge
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Checklist
What is the current behavior?
POST /:invoiceId/checkout-sessionruns without a billing-edit permission check.InvoiceStep.tsx/lib/forms.ts, duplicate@yosemite-crew/typesimports inDocumentsPanel.tsx. Two brokenreporoster.comimage embeds in the README.What is the new behavior?
1. Room-unit occupancy (backend + types + frontend)
backend/room-unit.service.ts:getOccupiedUnitIds()queries active, non-discharged admissions with aunitId;toDomain()setsisOccupiedand list results are enriched per org (service test updated).types/roomUnit.ts: optionalisOccupiedwithroom-unit-occupiedFHIR extension intoFHIRRoomUnit/fromFHIRRoomUnit.features/appointments/lib/roomUnitAvailability.ts(isAssignableRoomUnit,getAssignableRoomUnits,getFirstAssignableRoomUnitId,toAssignableRoomOptions) — treats a unit as assignable unless occupied (a unit keeps its own current occupant). Consumed byChangeRoom,AppointmentWorkspace,InpatientSchedule, and workspace services/store.2. Invoice → client checkout & double-bill safety (backend + frontend)
backend/invoice.router.ts: checkout-session route now requireswithInvoiceOrgPermissions()+requirePermission("billing:edit:any")(router test updated).billing/invoiceService.ts: newsendInvoiceToClient(invoiceId)returning{ checkout, emailSent }.InvoiceStep.tsx: send-to-client flow gated on "Ready for billing"; state-correct payment controls (Abort while checking, Done when confirmed, Abort + Check again when delayed);printInvoicenow returns success so a popup-blocked download surfaces instead of failing silently; settled-line guard — any line name on a settled/paid past invoice is excluded from the editable bill regardless of thebilledflag.3. Workspace task/schedule unification
TreatmentStep.tsx: the task store is the single source of truth for schedule rows (no local duplicates); workspace task load forcesincludeCompletedso completed rows survive refresh.InpatientSchedule.tsxsimplified to a template-search + read model;SummaryStep, workspace aggregate/template services, store, andtypes/workspace.tsupdated to match.4. Chat appointment actions
ChatContainer.tsx/ChatHeaderContext.tsx: Reschedule, Mark complete (changeAppointmentStatus → COMPLETEDwith success/error toasts), and Book follow-up from the chat appointment header.5. Forms task-template summary + UI polish
FormInfo.tsx:TaskTemplateSummaryrenders multi-task template blocks (labels resolved from taxonomy);AddFormDetails/Review/index andlib/forms.ts/taskService.tsnormalize task-blockinstructions.CompanionsTable.tsx+DataTable.css,UserHeader.tsx(route-change reset moved into an effect to avoid cross-component render warning).6. Cleanup
InvoiceStep.tsx,lib/forms.ts), deduped type imports (DocumentsPanel.tsx).apps/frontend/README.md); replaced brokenreporoster.comimage embeds with working GitHub stargazer/forker links.__tests__files added/updated across all workstreams.Related Issue(s)
Fixes #1748
Validation performed
npx tsc --noemit(frontend) — clean.room-unit.serviceandinvoice.routersuites updated and passing.Impact area
frontend(appointment workspace, room mgmt, billing, forms, tasks, chat, UI),backend(room-unit service, invoice router),types(roomUnit). Additive shared type; no Merck paths; no breaking changes.