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

feat/Added bed number in location card (#8131) #8677

Conversation

noufalrahim
Copy link
Contributor

Proposed Changes

  • Fixes Show Bed no. of location card #8131
  • Created a function BedsData to retrieve total count of beds for each loactionId and facilityId
  • Displayed Beds count on the button "Manage beds" and added justifyContent style such that it will be styled appropriately
    Screenshot from 2024-10-01 06-44-57

@ohcnetwork/care-fe-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

@noufalrahim noufalrahim requested a review from a team as a code owner October 1, 2024 01:15
Copy link

netlify bot commented Oct 1, 2024

Deploy Preview for care-ohc ready!

Name Link
🔨 Latest commit 28f08bc
🔍 Latest deploy log https://app.netlify.com/sites/care-ohc/deploys/66fb4d2a8b4c3e0008dfff14
😎 Deploy Preview https://deploy-preview-8677--care-ohc.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.

Comment on lines +78 to +90
function BedsData(facilityId: string, locationId: string) {
const { loading, data } = useQuery(routes.listFacilityBeds, {
query: {
facility: facilityId,
location: locationId,
},
});

return {
loading,
totalBeds: data?.results.length || 0,
};
}
Copy link
Member

Choose a reason for hiding this comment

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

let's not create a function that wraps a hook

@@ -216,6 +242,7 @@ export default function LocationManagement({ facilityId }: Props) {
const Location = ({
Copy link
Member

Choose a reason for hiding this comment

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

Instead call that hook inside this component without wrapping

Comment on lines +132 to +153
{(item) => {
const { loading, totalBeds } = BedsData(facilityId, item.id);

if (loading) {
return <Loading />;
}
return (
<Location
setShowDeletePopup={setShowDeletePopup}
facilityId={facilityId}
{...item}
totalBeds={totalBeds}
disabled={
["DistrictAdmin", "StateAdmin"].includes(
authUser.user_type,
)
? false
: true
}
/>
);
}}
Copy link
Member

Choose a reason for hiding this comment

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

That way these changes also can be reverted

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.

Show Bed no. of location card
2 participants