diff --git a/cypress/e2e/assets_spec/AssetHomepage.cy.ts b/cypress/e2e/assets_spec/AssetHomepage.cy.ts index 57c315bb0c4..bf608cdab9f 100644 --- a/cypress/e2e/assets_spec/AssetHomepage.cy.ts +++ b/cypress/e2e/assets_spec/AssetHomepage.cy.ts @@ -78,7 +78,9 @@ describe("Asset Tab", () => { it("Next/Previous Page", () => { assetPagination.navigateToNextPage(); + assetPagination.verifyNextUrl(); assetPagination.navigateToPreviousPage(); + assetPagination.verifyPreviousUrl(); }); it("Import new asset", () => { diff --git a/cypress/e2e/facility_spec/FacilityHomepage.cy.ts b/cypress/e2e/facility_spec/FacilityHomepage.cy.ts index e2a12b01a05..b8fb0afd9d9 100644 --- a/cypress/e2e/facility_spec/FacilityHomepage.cy.ts +++ b/cypress/e2e/facility_spec/FacilityHomepage.cy.ts @@ -81,7 +81,9 @@ describe("Facility Homepage Function", () => { it("Search a facility in homepage and pagination", () => { // pagination of the facility page assetPagination.navigateToNextPage(); + assetPagination.verifyNextUrl(); assetPagination.navigateToPreviousPage(); + assetPagination.verifyPreviousUrl(); // search for a facility manageUserPage.typeFacilitySearch(facilityName); facilityPage.verifyFacilityBadgeContent(facilityName); diff --git a/cypress/pageobject/Asset/AssetPagination.ts b/cypress/pageobject/Asset/AssetPagination.ts index 3fff457d8cf..f2a4103b065 100644 --- a/cypress/pageobject/Asset/AssetPagination.ts +++ b/cypress/pageobject/Asset/AssetPagination.ts @@ -2,12 +2,18 @@ export class AssetPagination { navigateToNextPage() { // only works for desktop mode cy.get("button#next-pages").click(); + } + + verifyNextUrl() { cy.url().should("include", "page=2"); } navigateToPreviousPage() { // only works for desktop mode cy.get("button#prev-pages").click(); + } + + verifyPreviousUrl() { cy.url().should("include", "page=1"); } } diff --git a/src/Components/Facility/BedManagement.tsx b/src/Components/Facility/BedManagement.tsx index 5816ff58d4b..628e273b883 100644 --- a/src/Components/Facility/BedManagement.tsx +++ b/src/Components/Facility/BedManagement.tsx @@ -1,7 +1,6 @@ import { useState } from "react"; import ButtonV2 from "../Common/components/ButtonV2"; import { BedModel } from "./models"; -import { ReactElement } from "react"; import * as Notification from "../../Utils/Notifications.js"; import { LOCATION_BED_TYPES } from "../../Common/constants"; import BedDeleteDialog from "./BedDeleteDialog"; @@ -14,6 +13,8 @@ import useQuery from "../../Utils/request/useQuery"; import useFilters from "../../Common/hooks/useFilters"; import useAuthUser from "../../Common/hooks/useAuthUser"; import Loading from "@/Components/Common/Loading"; +import PaginatedList from "@/CAREUI/misc/PaginatedList"; +import { useTranslation } from "react-i18next"; interface BedManagementProps { facilityId: string; locationId: string; @@ -30,17 +31,16 @@ interface BedRowProps { isOccupied: boolean; } -const BedRow = (props: BedRowProps) => { - const { - id, - facilityId, - name, - description, - triggerRerender, - locationId, - bedType, - isOccupied, - } = props; +const BedCard = ({ + id, + facilityId, + name, + description, + triggerRerender, + locationId, + bedType, + isOccupied, +}: BedRowProps) => { const [bedData, setBedData] = useState<{ show: boolean; name: string; @@ -52,6 +52,7 @@ const BedRow = (props: BedRowProps) => { name, }); }; + const { t } = useTranslation(); const allowedUser = ["DistrictAdmin", "StateAdmin"].includes( authUser.user_type, @@ -80,19 +81,17 @@ const BedRow = (props: BedRowProps) => { handleCancel={handleDeleteCancel} handleOk={handleDeleteConfirm} /> -
- {name} -
{" "} - ++ {name} +
+@@ -108,45 +107,55 @@ const BedRow = (props: BedRowProps) => { : "bg-primary-100 text-primary-600" } mb-1 ml-1 inline-flex w-fit items-center rounded-md px-2.5 py-0.5 text-sm font-medium capitalize leading-5`} > - {isOccupied ? "Occupied" : "Vacant"} + {isOccupied ? t("occupied") : t("vacant")}
{description}
+ {description && ( ++ {description} +
+ )}- No beds available in this location -
- ); - } - - bed = ( - <> -