Permissions for 'Transfer to Rec. Facility button' #5422
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 7603075
This pull request updates the shifting logic and UI for the patient and shifting components. It uses the global state for the user and facility data, and adds localization support for the transfer button text. It also restricts the transfer button visibility and functionality based on the shift status and the user's role and permissions.
Proposed Changes
Fixes #5399
The updates made to the code include importing 'useSelector' from 'react-redux', adding state variables to capture user details such as userType and userHomeFacilityId, and disabling the transfer button if the user is not authorized or if the transfer is not allowed. Additionally, changes were made to conditional statements to show the transfer button only if the filter is "COMPLETED" and the shift is assigned to a facility.
The purpose of this implementation is to enable the transfer of patients when authorized and allow for restrictions when transferring is not allowed based on user type, facility assignment, or patient settings.
@coronasafe/care-fe-code-reviewers @coronasafe/code-reviewers
HOW
🤖 Generated by Copilot at 7603075
useSelector
hook to access global state inPatientHome
,ListView
, andShiftCard
components (link, link, link)useSelector
hook inPatientHome
,ListView
, andShiftCard
components (link, link, link)t
to support localization inPatientHome
andListView
components (link, link)shift.status === "TRANSFER IN PROGRESS"
toshift.status === "COMPLETED"
to allow transfers after shift is completed inPatientHome
,ListView
, andShiftCard
components (link, link, link)disabled
prop for transfer button with condition that checks if patient is allowed to be transferred and if current user is authorized to transfer inPatientHome
,ListView
, andShiftCard
components (link, link, link)