Skip to content
New issue

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

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

Already on GitHub? # to your account

(fix) O3-4353: Fix pagination on ward allocation and ward summary #1445

Conversation

Muppasanipraneeth
Copy link
Contributor

Requirements

  • This PR has a title that briefly describes the work done including the ticket number. If there is a ticket, make sure your PR title includes a conventional commit label. See existing PR titles for inspiration.
  • My work conforms to the OpenMRS 3.0 Styleguide and design documentation.
  • My work includes tests or is validated by existing tests.

Summary

problem

1 Even though the items per page is set to 10 the page automatically shows all items available. It should show only 10 and allow the user to change the pages
2 Even though there are more than 10 beds for a ward, the pagination does not allow you to go to the next page and shows only the first ten items. You have to manually change the number of items to a larger number to see all the items.

solution

passed the filtereddata correctly to hook usePagination() and
it returns data correctly

Screenshots

Before for Inpatient ward

Screenshot 2025-01-16 at 11 42 34 AM

After for Inpatient ward

Screenshot 2025-01-16 at 10 25 25 AM

Before ward allocation

wardallocatinbefore

after ward allocation

wardallocation wardallocation1

Related Issue

Other

@Muppasanipraneeth
Copy link
Contributor Author

Copy link
Collaborator

@NethmiRodrigo NethmiRodrigo left a comment

Choose a reason for hiding this comment

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

Thanks @Muppasanipraneeth! I haven't tested this out yet, but minor typo fix:

@@ -67,14 +67,12 @@ const BedAdministrationTable: React.FC = () => {

const handleBedStatusChange = ({ selectedItem }: { selectedItem: string }) =>
setFilterOption(selectedItem.trim().toUpperCase());

const filteredData = useMemo(() => {
const flatendData = Array.isArray(bedsGroupedByLocation) ? bedsGroupedByLocation.flat() : [];
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
const flatendData = Array.isArray(bedsGroupedByLocation) ? bedsGroupedByLocation.flat() : [];
const flattenedData = Array.isArray(bedsGroupedByLocation) ? bedsGroupedByLocation.flat() : [];

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated changes


const filteredData = useMemo(() => {
const flatendData = Array.isArray(bedsGroupedByLocation) ? bedsGroupedByLocation.flat() : [];
return filterOption === 'ALL' ? flatendData : flatendData.filter((bed) => bed.status === filterOption);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
return filterOption === 'ALL' ? flatendData : flatendData.filter((bed) => bed.status === filterOption);
return filterOption === 'ALL' ? flattenedData : flattenedData.filter((bed) => bed.status === filterOption);

@Muppasanipraneeth Muppasanipraneeth changed the title (fix) : O3 4353 pagination does not work on ward allocation page (fix) O3-4353 : pagination does not work on ward allocation page Jan 16, 2025
Copy link
Collaborator

@NethmiRodrigo NethmiRodrigo left a comment

Choose a reason for hiding this comment

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

Thanks @Muppasanipraneeth! LGTM!

@NethmiRodrigo NethmiRodrigo changed the title (fix) O3-4353 : pagination does not work on ward allocation page (fix) O3-4353: pagination does not work on ward allocation page Jan 16, 2025
@NethmiRodrigo NethmiRodrigo changed the title (fix) O3-4353: pagination does not work on ward allocation page (fix) O3-4353: Fix pagination on ward allocation and ward summary Jan 16, 2025
@NethmiRodrigo NethmiRodrigo merged commit 417b918 into openmrs:main Jan 16, 2025
6 checks passed
@Muppasanipraneeth
Copy link
Contributor Author

Thanks @NethmiRodrigo 😊

harshthakkr pushed a commit to harshthakkr/openmrs-esm-patient-management that referenced this pull request Jan 17, 2025
…enmrs#1445)

* fixed pagination in ward allocation

* make changes to allow to go nextpage and previous page

* make changes to allow to go nextpage and previous page

* fixed typo

---------

Co-authored-by: Nethmi Rodrigo <34070216+NethmiRodrigo@users.noreply.github.com>
@Muppasanipraneeth Muppasanipraneeth deleted the O3-4353-pagination-does-not-work-on-ward-allocation-page branch February 25, 2025 15:32
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants