Skip to content

[ENG-584] feat: always show print appointment/accounts quick action#16463

Open
Jacobjeevan wants to merge 4 commits into
developfrom
ENG-584-appointments
Open

[ENG-584] feat: always show print appointment/accounts quick action#16463
Jacobjeevan wants to merge 4 commits into
developfrom
ENG-584-appointments

Conversation

@Jacobjeevan

@Jacobjeevan Jacobjeevan commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Proposed Changes

  • ENG-584
  • Show quick actions (print appointment and accounts) all the time
  • Move token heading inside so it only shows up if token is generated/able to be generated.
image

Tagging: @ohcnetwork/care-fe-code-reviewers

Merge Checklist

  • Add specs that demonstrate the bug or test the new feature.
  • Update product documentation.
  • Ensure that UI text is placed in I18n files.
  • Prepare a screenshot or demo video for the changelog entry and attach it to the issue.
  • Request peer reviews.
  • Complete QA on mobile devices.
  • Complete QA on desktop devices.
  • Add or update Playwright tests for related changes

Summary by CodeRabbit

  • Refactor
    • Improved conditional rendering for token details, including when to show the token header and the “token not generated” prompt.
    • Updated the “token not generated” logic to rely on final status groups for more consistent visibility.
    • Reworked the quick actions section so start-consultation and planned-encounter actions appear only in the appropriate appointment states.
    • Adjusted visibility of print and accounts quick actions based on cancelled vs all other statuses.

@Jacobjeevan Jacobjeevan requested review from a team and Copilot June 18, 2026 10:37
@netlify

netlify Bot commented Jun 18, 2026

Copy link
Copy Markdown

Deploy Preview for care-ohc ready!

Name Link
🔨 Latest commit d19f0ba
🔍 Latest deploy log https://app.netlify.com/projects/care-ohc/deploys/6a351106e518b20008f45768
😎 Deploy Preview https://deploy-preview-16463.preview.ohc.network
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions

Copy link
Copy Markdown

⚠️ Merge Checklist Incomplete

Thank you for your contribution! To help us review your PR efficiently, please complete the merge checklist in your PR description.

Your PR will be reviewed once you have marked the appropriate checklist items.

To update the checklist:

  • Change - [ ] to - [x] for completed items
  • Only check items that are relevant to your PR
  • Leave items unchecked if they don't apply

The checklist helps ensure code quality, testing coverage, and documentation are properly addressed.

@greptile-apps

greptile-apps Bot commented Jun 18, 2026

Copy link
Copy Markdown

Greptile Summary

This PR makes the "Print Appointment" and "Accounts" quick actions always visible in the appointment detail view, regardless of appointment status. It also moves the "Token" heading inside its conditional block so it only renders when a token is present or can be generated, and adds encodeURIComponent to the patient name in the accounts URL query string.

  • The quick actions section is now unconditionally rendered; consultation/encounter actions remain gated by !AppointmentFinalStatuses.includes(appointment.status), print appointment is hidden only for cancelled-type statuses via CancelledAppointmentStatuses, and the accounts link is always shown.
  • The token generation guard is correctly widened from !["fulfilled"].includes(appointment.status) to !AppointmentFinalStatuses.includes(appointment.status), preventing token generation for all terminal statuses.
  • The accounts URL now encodes the patient name with encodeURIComponent, fixing potential URL breakage for names containing spaces or special characters.

Confidence Score: 5/5

Safe to merge — the change is a focused UI restructuring with no logic regressions and a minor bug fix for URL encoding.

The restructuring correctly uses the existing AppointmentFinalStatuses and CancelledAppointmentStatuses constants to gate each action appropriately. The encodeURIComponent addition fixes a real edge case. No data mutations or state management are affected.

No files require special attention.

Important Files Changed

Filename Overview
src/pages/Appointments/AppointmentDetail.tsx Restructures quick actions section to always display, moves token heading inside conditional blocks, fixes URL encoding for patient name in accounts link, and expands token generation guard from "fulfilled" only to all AppointmentFinalStatuses.

Reviews (4): Last reviewed commit: "chore: further filtering for print appt/..." | Re-trigger Greptile

@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

AppointmentDetail.tsx receives JSX structural refactoring with refined appointment status checks. The token section heading is moved inside the appointment.token?.number conditional guard, and the "token not generated" empty state is reorganized into a unified conditional fragment using AppointmentFinalStatuses. The quick actions area removes top-level final-status gating and applies fine-grained status checks per action: start-consultation and create-encounter branch under AppointmentFinalStatuses, while print visibility now uses CancelledAppointmentStatuses, and accounts renders unconditionally.

Changes

AppointmentDetail UI Restructure

Layer / File(s) Summary
Token heading and empty-state conditional reorganization
src/pages/Appointments/AppointmentDetail.tsx
Token section heading is moved inside the appointment.token?.number conditional so it renders only when a token number exists. The "token not generated" block wraps the heading and empty-state content together under a single !AppointmentFinalStatuses.includes(appointment.status) guard; the TokenGenerationSheet trigger and query invalidation on success are preserved.
Quick actions status-based visibility refactor
src/pages/Appointments/AppointmentDetail.tsx
Quick actions container and heading remove top-level final-status gating. Start-consultation and create-encounter branching are gated by !AppointmentFinalStatuses.includes(appointment.status). Print action visibility changes to !CancelledAppointmentStatuses.includes(appointment.status) while accounts action renders regardless. CancelledAppointmentStatuses is imported to support the refined print gating.

Suggested labels

needs testing, needs review

Suggested reviewers

  • bodhish
  • rithviknishad
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main change: ensuring print appointment and accounts quick actions are always visible, with a secondary focus on token heading reorganization.
Description check ✅ Passed The description covers the main changes and includes a visual reference, but most merge checklist items are unchecked and appear incomplete.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ENG-584-appointments

Comment @coderabbitai help to get the list of available commands and usage tips.

Comment thread src/pages/Appointments/AppointmentDetail.tsx Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the Appointment Detail page to keep key “quick actions” (printing the appointment and navigating to accounts) visible regardless of appointment status, and to only show the “Token” heading when a token exists or can be generated.

Changes:

  • Always display “Print Appointment” and “Accounts” quick actions (even for final statuses).
  • Move the “Token” section heading inside conditional branches so it only renders when relevant.
  • Restructure the quick-actions rendering logic to separate always-available actions from status-dependent actions.

Comment thread src/pages/Appointments/AppointmentDetail.tsx Outdated
Comment thread src/pages/Appointments/AppointmentDetail.tsx Outdated
Comment thread src/pages/Appointments/AppointmentDetail.tsx Outdated
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 18, 2026

Copy link
Copy Markdown

Deploying care-preview with  Cloudflare Pages  Cloudflare Pages

Latest commit: d19f0ba
Status: ✅  Deploy successful!
Preview URL: https://c2ee5095.care-preview-a7w.pages.dev
Branch Preview URL: https://eng-584-appointments.care-preview-a7w.pages.dev

View logs

@github-actions

github-actions Bot commented Jun 18, 2026

Copy link
Copy Markdown

🎭 Playwright Test Results

Status: ✅ Passed
Test Shards: 3

Metric Count
Total Tests 325
✅ Passed 325
❌ Failed 0
⏭️ Skipped 0

📊 Detailed results are available in the playwright-final-report artifact.

Run: #9632

Copilot AI review requested due to automatic review settings June 19, 2026 08:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread src/pages/Appointments/AppointmentDetail.tsx

@nihal467 nihal467 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image

as per our discussion, we shouldn't show print appointment button when the appointment is enterred in error and cancelled

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/pages/Appointments/AppointmentDetail.tsx`:
- Around line 540-548: The QuickAction component with actionId
"print-appointment" is wrapped in a conditional check that uses
CancelledAppointmentStatuses to hide the Print Appointment tile for
cancelled/no-show appointments. Remove the conditional wrapper (the line
checking `!CancelledAppointmentStatuses.includes(appointment.status)`) and
render the QuickAction component unconditionally so that the Print Appointment
action remains visible for all appointment statuses including cancelled and
no-show states.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 8ac06a39-3605-48e4-b4d2-ee3ee36900f3

📥 Commits

Reviewing files that changed from the base of the PR and between f159c12 and d19f0ba.

📒 Files selected for processing (1)
  • src/pages/Appointments/AppointmentDetail.tsx

Comment thread src/pages/Appointments/AppointmentDetail.tsx

@nihal467 nihal467 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image
  • you're hiding print for mark no show, & reschedule appointments too, was this intentional ?

@Jacobjeevan

Copy link
Copy Markdown
Contributor Author
Image
* you're hiding print for mark no show, & reschedule appointments too, was this intentional ?

Intentional 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants