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

Allow only admins to delete a location or a bed #7671

Conversation

AnkurPrabhu
Copy link
Contributor

Proposed Changes

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

Merge Checklist

  • Add specs that demonstrate bug / test a new feature.
  • Update product documentation.
  • Ensure that UI text is kept in I18n files.
  • Prep screenshot or demo video for changelog entry, and attach it to issue.
  • Request for Peer Reviews
  • Completion of QA

Screenshots:
BedManagement.tsx
Screenshot 2024-04-21 at 1 12 21 AM

LocationManagement.tsx
Screenshot 2024-04-21 at 1 13 16 AM

@AnkurPrabhu AnkurPrabhu requested a review from a team as a code owner April 20, 2024 19:51
Copy link

vercel bot commented Apr 20, 2024

@AnkurPrabhu is attempting to deploy a commit to the Open Healthcare Network Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

netlify bot commented Apr 20, 2024

Deploy Preview for care-egov-staging ready!

Name Link
🔨 Latest commit f1bf8f9
🔍 Latest deploy log https://app.netlify.com/sites/care-egov-staging/deploys/664c6c43addf32000857d286
😎 Deploy Preview https://deploy-preview-7671--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.

@nihal467
Copy link
Member

@AnkurPrabhu
image

the tooltip is clipping-in in the mobile view

@AnkurPrabhu AnkurPrabhu force-pushed the Disable-the-delete-button-for-user-other-than-admin branch from 7fe6d26 to b359b4d Compare April 24, 2024 14:30
Copy link

github-actions bot commented May 2, 2024

Hi, This pr has been automatically marked as stale because it has not had any recent activity. It will be automatically closed if no further activity occurs for 7 more days. Thank you for your contributions.

@github-actions github-actions bot added the stale label May 2, 2024
const handleDelete = (name: string, _id: string) => {
setBedData({
show: true,
name,
});
};

const allowedUser =
["DistrictAdmin", "StateAdmin"].includes(authUser.user_type) ||
authUser.is_superuser;
Copy link
Member

Choose a reason for hiding this comment

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

need not do super user checks explicitly as all super users are state admins.

disabled={isOccupied}
tooltip={isOccupied ? "Bed is occupied" : undefined}
tooltipClassName="w-full lg:w-auto"
disabled={!allowedUser || isOccupied}
Copy link
Member

@rithviknishad rithviknishad May 4, 2024

Choose a reason for hiding this comment

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

instead of doing that, we could make use of the authorizeFor prop present in the button component

Copy link

Hi, This pr has been automatically marked as stale because it has not had any recent activity. It will be automatically closed if no further activity occurs for 7 more days. Thank you for your contributions.

@github-actions github-actions bot added the stale label May 12, 2024
@AnkurPrabhu
Copy link
Contributor Author

@rithviknishad ptal

@nihal467
Copy link
Member

LGTM

@khavinshankar khavinshankar merged commit 599359e into ohcnetwork:develop May 22, 2024
28 of 30 checks passed
Copy link

@AnkurPrabhu Your efforts have helped advance digital healthcare and TeleICU systems. 🚀 Thank you for taking the time out to make CARE better. We hope you continue to innovate and contribute; your impact is immense! 🙌

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.

Disable the delete button for user other than admin in location and bed management
4 participants