Enable clearing 'referred to' in discharge modal #6337
Merged
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.
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 filesDischargeModal.tsx
andAutoCompleteAsync.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.
@coronasafe/care-fe-code-reviewers @coronasafe/code-reviewers
HOW
🤖 Generated by Copilot at 7c387da
useTranslation
hook andt
function toAutoCompleteAsync
component to enable internationalization of text strings (link, link)required
prop toAutoCompleteAsync
component to allow parent component to indicate mandatory or optional selection (link, link)AutoCompleteAsync
component when selection is not loading or required, and uset
function to translate icon and tooltip text (link)optionLabel
function ofAutoCompleteAsync
component to avoid errors when function is undefined or null (link)facility
variable inDischargeModal
component from default object to undefined to avoid blank option in facility select component (link)handleFacilitySelect
function inDischargeModal
component to handle null or undefined selection and set or nullreferred_to
andreferred_to_external
fields ofpreDischargeForm
state accordingly (link)showAll
andfreeText
ofAutoCompleteAsync
component to use shorthand syntax without explicit values (link)