Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable clearing 'referred to' in discharge modal #6337

Merged
merged 1 commit into from
Sep 26, 2023
Merged

Conversation

Ashesh3
Copy link
Member

@Ashesh3 Ashesh3 commented Sep 25, 2023

WHAT

🤖 Generated by Copilot at 7c387da

This pull request enhances the user interface and functionality of the discharge modal and the AutoCompleteAsync component. It fixes a bug in the facility selection, adds internationalization and validation support, and allows clearing the selected option. The changes affect the files DischargeModal.tsx and AutoCompleteAsync.tsx.

Proposed Changes

This PR resolves the issue #6301, where users were unable to clear the 'referred to' field in the discharge pop-up.

Previously, when discharging a patient and marking the reason for discharge as 'referred', users were unable to clear the selected hospital in the 'referred to' field. This behavior was inconsistent with the field's non-mandatory nature.

With this fix, users can now clear the 'referred to' field as expected. This change improves the user experience by providing the necessary flexibility in the discharge process.

image

@coronasafe/care-fe-code-reviewers @coronasafe/code-reviewers

HOW

🤖 Generated by Copilot at 7c387da

  • Add useTranslation hook and t function to AutoCompleteAsync component to enable internationalization of text strings (link, link)
  • Add required prop to AutoCompleteAsync component to allow parent component to indicate mandatory or optional selection (link, link)
  • Render clear icon with tooltip in AutoCompleteAsync component when selection is not loading or required, and use t function to translate icon and tooltip text (link)
  • Use optional chaining operator in optionLabel function of AutoCompleteAsync component to avoid errors when function is undefined or null (link)
  • Change initial state of facility variable in DischargeModal component from default object to undefined to avoid blank option in facility select component (link)
  • Change logic of handleFacilitySelect function in DischargeModal component to handle null or undefined selection and set or null referred_to and referred_to_external fields of preDischargeForm state accordingly (link)
  • Simplify boolean props showAll and freeText of AutoCompleteAsync component to use shorthand syntax without explicit values (link)

@Ashesh3 Ashesh3 requested a review from a team September 25, 2023 06:33
@Ashesh3 Ashesh3 requested a review from a team as a code owner September 25, 2023 06:33
@Ashesh3 Ashesh3 requested a review from vigneshhari September 25, 2023 06:33
@vercel
Copy link

vercel bot commented Sep 25, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
care-storybook ✅ Ready (Inspect) Visit Preview Sep 25, 2023 6:33am

@netlify
Copy link

netlify bot commented Sep 25, 2023

Deploy Preview for care-egov-staging ready!

Name Link
🔨 Latest commit 7c387da
🔍 Latest deploy log https://app.netlify.com/sites/care-egov-staging/deploys/651129d14a86f20008290e00
😎 Deploy Preview https://deploy-preview-6337--care-egov-staging.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

@cypress
Copy link

cypress bot commented Sep 25, 2023

Passing run #1304 ↗︎

0 75 0 0 Flakiness 0

Details:

Enable clearing 'referred to' in discharge modal
Project: CARE Commit: 7c387da87b
Status: Passed Duration: 02:23 💡
Started: Sep 25, 2023 6:38 AM Ended: Sep 25, 2023 6:40 AM

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings.

@nihal467
Copy link
Member

LGTM

@khavinshankar khavinshankar merged commit f0d3470 into develop Sep 26, 2023
34 checks passed
@khavinshankar khavinshankar deleted the fix-6301 branch September 26, 2023 09:54
@github-actions
Copy link

@Ashesh3 We truly appreciate your efforts. Thank you for taking the time to contribute; this is a very valuable contribution to us 🥇. We always welcome your contribution 🙂, so feel free to contribute to anything anytime, and never lose that spirit of innovation 🙌.

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.

Bug: Unable to erase "referred to" hospital
3 participants