From ac9a4ee6a60bce858e0eaa56a0f47380f8d255df Mon Sep 17 00:00:00 2001 From: Ashesh <3626859+Ashesh3@users.noreply.github.com> Date: Mon, 11 Sep 2023 19:19:44 +0530 Subject: [PATCH 01/16] Add validation for average working hours (#6243) * Add validation for average working hours * Fix error message --- src/Components/Users/ManageUsers.tsx | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/Components/Users/ManageUsers.tsx b/src/Components/Users/ManageUsers.tsx index d2e0ca415e3..8625d442f52 100644 --- a/src/Components/Users/ManageUsers.tsx +++ b/src/Components/Users/ManageUsers.tsx @@ -73,6 +73,8 @@ export default function ManageUsers() { name: string; }>({ show: false, username: "", name: "" }); + const [weeklyHoursError, setWeeklyHoursError] = useState(""); + const extremeSmallScreenBreakpoint = 320; const isExtremeSmallScreen = width <= extremeSmallScreenBreakpoint ? true : false; @@ -144,7 +146,10 @@ export default function ManageUsers() { const handleWorkingHourSubmit = async () => { const username = selectedUser; - if (!username || weeklyHours < 0 || weeklyHours > 168) return; + if (!username || !weeklyHours || weeklyHours < 0 || weeklyHours > 168) { + setWeeklyHoursError("Value should be between 0 and 168"); + return; + } const res = await dispatch( partialUpdateUser(username, { weekly_working_hours: weeklyHours, @@ -163,6 +168,7 @@ export default function ManageUsers() { }); } setWeeklyHours(0); + setWeeklyHoursError(""); fetchData({ aborted: false }); }; @@ -493,13 +499,14 @@ export default function ManageUsers() { { + setExpandWorkingHours(state); + setWeeklyHours(0); + setWeeklyHoursError(""); + }} slideFrom="right" title="Average weekly working hours" dialogClass="md:w-[400px]" - onCloseClick={() => { - setWeeklyHours(0); - }} >
@@ -512,11 +519,7 @@ export default function ManageUsers() { onChange={(e) => { setWeeklyHours(e.value); }} - error={ - weeklyHours < 0 || weeklyHours > 168 - ? "Average weekly working hours should be between 0 and 168" - : "" - } + error={weeklyHoursError} required label="" type="number" From 3d73c69b4d9f8ca094bbc93407274a3b80da53a6 Mon Sep 17 00:00:00 2001 From: Kshitij Verma <101321276+kshitijv256@users.noreply.github.com> Date: Mon, 11 Sep 2023 19:20:41 +0530 Subject: [PATCH 02/16] changed priority of backUrl and history for back button in pageTitle (#6251) --- src/Common/hooks/useAppHistory.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Common/hooks/useAppHistory.ts b/src/Common/hooks/useAppHistory.ts index 893b1a06cfd..70ad92692de 100644 --- a/src/Common/hooks/useAppHistory.ts +++ b/src/Common/hooks/useAppHistory.ts @@ -10,14 +10,12 @@ export default function useAppHistory() { const resetHistory = useContext(ResetHistoryContext); const goBack = (fallbackUrl?: string) => { - if (history.length > 1) - // Navigate to history present in the app navigation history stack. - return navigate(history[1]); - if (fallbackUrl) - // Otherwise, use provided fallback url if provided. + // use provided fallback url if provided. return navigate(fallbackUrl); - + if (history.length > 1) + // Otherwise, navigate to history present in the app navigation history stack. + return navigate(history[1]); // Otherwise, fallback to browser's go back behaviour. window.history.back(); }; From baecaab94b617302fb20cf4aa7766325defb8870 Mon Sep 17 00:00:00 2001 From: print-Sathvik <113630200+print-Sathvik@users.noreply.github.com> Date: Mon, 11 Sep 2023 19:21:27 +0530 Subject: [PATCH 03/16] Asset filter parameters reset on unselect (#6255) --- src/Components/Assets/AssetFilter.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Components/Assets/AssetFilter.tsx b/src/Components/Assets/AssetFilter.tsx index b0a870d0e31..299d67e5ab0 100644 --- a/src/Components/Assets/AssetFilter.tsx +++ b/src/Components/Assets/AssetFilter.tsx @@ -108,9 +108,9 @@ function AssetFilter(props: any) { const applyFilter = () => { const data = { facility: facilityId, - asset_type: asset_type, - asset_class: asset_class, - status: asset_status, + asset_type: asset_type ?? "", + asset_class: asset_class ?? "", + status: asset_status ?? "", location: locationId, }; onChange(data); From 4e8005c96bda7baa03442d21f5b18bb592426d59 Mon Sep 17 00:00:00 2001 From: Pranshu Aggarwal <70687348+Pranshu1902@users.noreply.github.com> Date: Mon, 11 Sep 2023 19:23:25 +0530 Subject: [PATCH 04/16] Make the form consistent (#6238) * shift right * Update src/Components/Facility/AddLocationForm.tsx Co-authored-by: Rithvik Nishad --------- Co-authored-by: Rithvik Nishad --- src/Components/Facility/AddLocationForm.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Components/Facility/AddLocationForm.tsx b/src/Components/Facility/AddLocationForm.tsx index d3c64ec9e04..f0dd7893aca 100644 --- a/src/Components/Facility/AddLocationForm.tsx +++ b/src/Components/Facility/AddLocationForm.tsx @@ -158,7 +158,7 @@ export const AddLocationForm = (props: LocationFormProps) => { />
-
+
navigate(`/facility/${facilityId}/location`, { From 7cda789169e188d377134596aaae81731a523acd Mon Sep 17 00:00:00 2001 From: "Tasnimul H. Tauhid" Date: Mon, 11 Sep 2023 19:25:00 +0530 Subject: [PATCH 05/16] Disabled asset config for user other than admin (#6259) --- src/Components/Assets/AssetManage.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Components/Assets/AssetManage.tsx b/src/Components/Assets/AssetManage.tsx index 825cee1c848..25f879ddd09 100644 --- a/src/Components/Assets/AssetManage.tsx +++ b/src/Components/Assets/AssetManage.tsx @@ -29,7 +29,7 @@ import { useTranslation } from "react-i18next"; const PageTitle = lazy(() => import("../Common/PageTitle")); const Loading = lazy(() => import("../Common/Loading")); import * as Notification from "../../Utils/Notifications.js"; -import { NonReadOnlyUsers } from "../../Utils/AuthorizeFor"; +import AuthorizeFor, { NonReadOnlyUsers } from "../../Utils/AuthorizeFor"; import Uptime from "../Common/Uptime"; import useAuthUser from "../../Common/hooks/useAuthUser"; import dayjs from "dayjs"; @@ -452,7 +452,7 @@ const AssetManage = (props: AssetManageProps) => { } id="configure-asset" data-testid="asset-configure-button" - authorizeFor={NonReadOnlyUsers} + authorizeFor={AuthorizeFor(["DistrictAdmin", "StateAdmin"])} > {t("configure")} From 2da1eeeee8788e6c38d5ba1a590da8cd0ee3ae50 Mon Sep 17 00:00:00 2001 From: Mohammed Nihal <57055998+nihal467@users.noreply.github.com> Date: Tue, 12 Sep 2023 09:36:39 +0530 Subject: [PATCH 06/16] add test to search asset by qr and serial number (#6266) * add search by qr and ID * made variables values dynamic --- .../{asset_tab.cy.ts => asset_homepage.cy.ts} | 28 +++++++++-- cypress/pageobject/Asset/AssetSearch.ts | 47 +++++++++++++++++-- 2 files changed, 65 insertions(+), 10 deletions(-) rename cypress/e2e/assets_spec/{asset_tab.cy.ts => asset_homepage.cy.ts} (55%) diff --git a/cypress/e2e/assets_spec/asset_tab.cy.ts b/cypress/e2e/assets_spec/asset_homepage.cy.ts similarity index 55% rename from cypress/e2e/assets_spec/asset_tab.cy.ts rename to cypress/e2e/assets_spec/asset_homepage.cy.ts index 0abf11fcaf0..6e9ceb9676b 100644 --- a/cypress/e2e/assets_spec/asset_tab.cy.ts +++ b/cypress/e2e/assets_spec/asset_homepage.cy.ts @@ -5,15 +5,21 @@ import { AssetSearchPage } from "../../pageobject/Asset/AssetSearch"; import { AssetQRScanPage } from "../../pageobject/Asset/AssetQRScan"; import { AssetPagination } from "../../pageobject/Asset/AssetPagination"; import { AssetFilters } from "../../pageobject/Asset/AssetFilters"; +import LoginPage from "../../pageobject/Login/LoginPage"; +import { v4 as uuidv4 } from "uuid"; describe("Asset Tab", () => { const assetSearchPage = new AssetSearchPage(); const assetQRScanPage = new AssetQRScanPage(); const assetPagination = new AssetPagination(); const assetFilters = new AssetFilters(); + const loginPage = new LoginPage(); + const assetName = "Dummy Camera 10"; + const qrCode = uuidv4(); + const serialNumber = Math.floor(Math.random() * 10 ** 10).toString(); before(() => { - cy.loginByApi("devdistrictadmin", "Coronasafe@123"); + loginPage.loginAsDisctrictAdmin(); cy.saveLocalStorage(); }); @@ -24,11 +30,23 @@ describe("Asset Tab", () => { // search for a element - it("Search Asset Name", () => { - const initialUrl = cy.url(); - assetSearchPage.typeSearchKeyword("dummy camera 30"); + it("Search Asset Name/QR_ID/Serial_number", () => { + assetSearchPage.typeSearchKeyword(assetName); assetSearchPage.pressEnter(); - assetSearchPage.verifyUrlChanged(initialUrl); + assetSearchPage.verifyBadgeContent(assetName); + assetSearchPage.clickAssetByName(assetName); + assetSearchPage.clickUpdateButton(); + assetSearchPage.clearAndTypeQRCode(qrCode); + assetSearchPage.clearAndTypeSerialNumber(serialNumber); + assetSearchPage.clickAssetSubmitButton(); + assetSearchPage.visitAssetsPage(); + assetSearchPage.typeSearchKeyword(qrCode); + assetSearchPage.pressEnter(); + assetSearchPage.verifyAssetListContains(assetName); + assetSearchPage.verifyBadgeContent(qrCode); + assetSearchPage.typeSearchKeyword(serialNumber); + assetSearchPage.verifyAssetListContains(assetName); + assetSearchPage.verifyBadgeContent(serialNumber); }); // scan a asset qr code diff --git a/cypress/pageobject/Asset/AssetSearch.ts b/cypress/pageobject/Asset/AssetSearch.ts index 315a414a62b..fea6a975983 100644 --- a/cypress/pageobject/Asset/AssetSearch.ts +++ b/cypress/pageobject/Asset/AssetSearch.ts @@ -1,16 +1,22 @@ export class AssetSearchPage { typeSearchKeyword(keyword: string) { - cy.get("[name='search']").type(keyword); + cy.get("#search").clear(); + cy.get("#search").click().type(keyword); } pressEnter() { cy.get("[name='search']").type("{enter}"); } - verifyUrlChanged(initialUrl: string) { - cy.url().should((currentUrl) => { - expect(currentUrl).not.to.equal(initialUrl); - }); + clickAssetByName(assetName: string) { + cy.get("[data-testid='created-asset-list']").contains(assetName).click(); + } + + verifyBadgeContent(expectedText: string) { + cy.get("[data-testid='Name/Serial No./QR ID']").should( + "contain", + expectedText + ); } verifyAssetIsPresent(assetName: string) { @@ -18,4 +24,35 @@ export class AssetSearchPage { .first() .should("contain", assetName); } + + clickUpdateButton() { + cy.get("[data-testid='asset-update-button']").contains("Update").click(); + } + + clearAndTypeQRCode(qrCode: string) { + cy.get("#qr_code_id").clear(); + cy.get("#qr_code_id").click().type(qrCode); + } + + clearAndTypeSerialNumber(serialNumber: string) { + cy.get("#serial-number").clear(); + cy.get("#serial-number").click().type(serialNumber); + } + + clickAssetSubmitButton() { + cy.intercept("GET", "**/api/v1/asset/**").as("getAssets"); + cy.get("#submit").click(); + cy.wait("@getAssets").its("response.statusCode").should("eq", 200); + } + + visitAssetsPage() { + cy.visit("/assets"); + } + + verifyAssetListContains(dummyCameraText: string) { + cy.get("[data-testid='created-asset-list']").should( + "contain", + dummyCameraText + ); + } } From 203288eaae5392cb4ad4bfd49205233efa1119c2 Mon Sep 17 00:00:00 2001 From: Rithvik Nishad Date: Tue, 12 Sep 2023 10:27:31 +0530 Subject: [PATCH 07/16] remove quotes from `.env`, gitignore bun lock file (#6263) --- .env | 8 ++++---- .gitignore | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.env b/.env index fcabed6db34..61d4177305c 100644 --- a/.env +++ b/.env @@ -1,11 +1,11 @@ # Whitelabelling envs -REACT_APP_TITLE="CARE" -REACT_APP_META_DESCRIPTION="CoronaSafe Network is an open-source public utility designed by a multi-disciplinary team of innovators and volunteers. CoronaSafe Care is a Digital Public Good recognised by United Nations." +REACT_APP_TITLE=CARE +REACT_APP_META_DESCRIPTION=CoronaSafe Network is an open-source public utility designed by a multi-disciplinary team of innovators and volunteers. CoronaSafe Care is a Digital Public Good recognised by United Nations. REACT_APP_COVER_IMAGE=https://cdn.coronasafe.network/care_logo.svg REACT_APP_COVER_IMAGE_ALT=https://cdn.coronasafe.network/care_logo.svg -REACT_APP_CONFIG="" -REACT_PUBLIC_URL="https://care.coronasafe.in" +REACT_APP_CONFIG= +REACT_PUBLIC_URL=https://care.coronasafe.in # Dev envs ESLINT_NO_DEV_ERRORS=true diff --git a/.gitignore b/.gitignore index b97356ed20f..4ca589aab39 100644 --- a/.gitignore +++ b/.gitignore @@ -54,6 +54,7 @@ public/build-meta.json # Using NPM yarn.lock pnpm-lock.yaml +bun.lockb # Cypress cypress/downloads From f7ac3338956bff973afeeec5c4ec6e8eb5eca35d Mon Sep 17 00:00:00 2001 From: Rithvik Nishad Date: Tue, 12 Sep 2023 10:39:11 +0530 Subject: [PATCH 08/16] remove `REACT_APP_CONFIG` from `.env` (#6268) --- .env | 1 - src/Redux/api.tsx | 2 +- src/vite-env.d.ts | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.env b/.env index 61d4177305c..38fd950b0d8 100644 --- a/.env +++ b/.env @@ -4,7 +4,6 @@ REACT_APP_TITLE=CARE REACT_APP_META_DESCRIPTION=CoronaSafe Network is an open-source public utility designed by a multi-disciplinary team of innovators and volunteers. CoronaSafe Care is a Digital Public Good recognised by United Nations. REACT_APP_COVER_IMAGE=https://cdn.coronasafe.network/care_logo.svg REACT_APP_COVER_IMAGE_ALT=https://cdn.coronasafe.network/care_logo.svg -REACT_APP_CONFIG= REACT_PUBLIC_URL=https://care.coronasafe.in # Dev envs diff --git a/src/Redux/api.tsx b/src/Redux/api.tsx index 393b9372ca5..01a91d4ce3a 100644 --- a/src/Redux/api.tsx +++ b/src/Redux/api.tsx @@ -10,7 +10,7 @@ interface Routes { const routes: Routes = { config: { - path: import.meta.env.REACT_APP_CONFIG || "/config.json", + path: import.meta.env.REACT_APP_CONFIG ?? "/config.json", method: "GET", noAuth: true, }, diff --git a/src/vite-env.d.ts b/src/vite-env.d.ts index 529c2689aed..c899d453626 100644 --- a/src/vite-env.d.ts +++ b/src/vite-env.d.ts @@ -5,7 +5,7 @@ interface ImportMetaEnv { readonly REACT_APP_META_DESCRIPTION: string; readonly REACT_APP_COVER_IMAGE: string; readonly REACT_APP_COVER_IMAGE_ALT: string; - readonly REACT_APP_CONFIG: string; + readonly REACT_APP_CONFIG: string | undefined; readonly REACT_PUBLIC_URL: string; readonly REACT_APP_SITE_URL: string; readonly REACT_APP_ANALYTICS_SERVER_URL: string; From dd1dcc3e5af7cdf9ced3b71c264614d78614243a Mon Sep 17 00:00:00 2001 From: Aakash Singh Date: Tue, 12 Sep 2023 15:16:48 +0530 Subject: [PATCH 09/16] fix load dummy data command (#6270) * fix load dummy data command * fix --- .github/workflows/cypress.yaml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cypress.yaml b/.github/workflows/cypress.yaml index 4f23fbe4937..f66f9a37bd8 100644 --- a/.github/workflows/cypress.yaml +++ b/.github/workflows/cypress.yaml @@ -25,12 +25,13 @@ jobs: path: care - name: Run docker compose up on care 🐳 - run: cd care && touch .env && make docker_config_file=docker-compose.pre-built.yaml up && cd .. && sleep 60s - # Voluntarily kept 60 seconds delay to wait for migrations to complete. - - - name: Run Django collectstatic and load dummy data on care 🐍 run: | - docker exec care python manage.py load_dummy_data + cd care + make docker_config_file=docker-compose.pre-built.yaml up + sleep 60s + docker compose exec backend bash -c "python manage.py load_dummy_data" + cd .. + # Voluntarily kept 60 seconds delay to wait for migrations to complete. - name: Check care is up ♻ run: curl -o /dev/null -s -w "%{http_code}\n" http://localhost:9000 From d0ffbd5955f34755d077ff8d57e2e5c22ceafe8b Mon Sep 17 00:00:00 2001 From: Ashesh <3626859+Ashesh3@users.noreply.github.com> Date: Tue, 12 Sep 2023 17:40:58 +0530 Subject: [PATCH 10/16] Refactor workflow to properly wait for migrations (#6272) * Refactor workflow to properly wait for migrations * use while * Fix command and remove cypress videos --- .github/workflows/cypress.yaml | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/.github/workflows/cypress.yaml b/.github/workflows/cypress.yaml index f66f9a37bd8..130f360d2ef 100644 --- a/.github/workflows/cypress.yaml +++ b/.github/workflows/cypress.yaml @@ -24,14 +24,22 @@ jobs: repository: coronasafe/care path: care - - name: Run docker compose up on care 🐳 + - name: Start care docker containers 🐳 run: | - cd care + cd care make docker_config_file=docker-compose.pre-built.yaml up - sleep 60s + while docker compose exec backend bash -c "python manage.py showmigrations 2>/dev/null | cat | grep -q '\[ \]'"; do + >&2 echo "Migrations are not yet applied - sleeping" + sleep 5 + done + echo "Migrations are applied" + cd .. + + - name: Load dummy data into care backend 📂 + run: | + cd care docker compose exec backend bash -c "python manage.py load_dummy_data" cd .. - # Voluntarily kept 60 seconds delay to wait for migrations to complete. - name: Check care is up ♻ run: curl -o /dev/null -s -w "%{http_code}\n" http://localhost:9000 @@ -93,10 +101,3 @@ jobs: name: cypress-screenshots path: cypress/screenshots - # Test run video was always captured, so this action uses "always()" condition - - name: Upload cypress videos 📹 - uses: actions/upload-artifact@v3 - if: always() - with: - name: cypress-videos - path: cypress/videos From 8c242d650395990170ef5ee21b8a104c89bf4f51 Mon Sep 17 00:00:00 2001 From: Ashesh <3626859+Ashesh3@users.noreply.github.com> Date: Tue, 12 Sep 2023 19:21:04 +0530 Subject: [PATCH 11/16] Asset CSV export (#6262) --- src/Common/constants.tsx | 2 +- src/Components/Assets/AssetsList.tsx | 20 ++++++++++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/Common/constants.tsx b/src/Common/constants.tsx index e8ab4867764..72a939b92fd 100644 --- a/src/Common/constants.tsx +++ b/src/Common/constants.tsx @@ -993,7 +993,7 @@ export const XLSXAssetImportSchema = { return ip; }, }, - "Config: Camera Access Key": { + "Config - Camera Access Key": { prop: "camera_access_key", type: String, }, diff --git a/src/Components/Assets/AssetsList.tsx b/src/Components/Assets/AssetsList.tsx index 6183a47783c..3789d7cfd51 100644 --- a/src/Components/Assets/AssetsList.tsx +++ b/src/Components/Assets/AssetsList.tsx @@ -324,7 +324,7 @@ const AssetsList = () => { }, }, { - label: "Export Assets", + label: "Export Assets (JSON)", action: () => authorizedForImportExport && listAssets({ @@ -333,7 +333,23 @@ const AssetsList = () => { limit: totalCount, }), type: "json", - filePrefix: `assets_${facility?.name}`, + filePrefix: `assets_${facility?.name ?? "all"}`, + options: { + icon: , + disabled: totalCount === 0 || !authorizedForImportExport, + }, + }, + { + label: "Export Assets (CSV)", + action: () => + authorizedForImportExport && + listAssets({ + ...qParams, + csv: true, + limit: totalCount, + }), + type: "csv", + filePrefix: `assets_${facility?.name ?? "all"}`, options: { icon: , disabled: totalCount === 0 || !authorizedForImportExport, From 87f36ba0332f69fce09ef08dc182449513fa2059 Mon Sep 17 00:00:00 2001 From: Rithvik Nishad Date: Tue, 12 Sep 2023 19:24:12 +0530 Subject: [PATCH 12/16] add readmission (#6239) --- src/Components/Facility/ConsultationCard.tsx | 10 ++++++++++ src/Components/Facility/models.tsx | 1 + src/Components/Patient/ManagePatients.tsx | 9 +++++++++ src/Components/Patient/PatientInfoCard.tsx | 17 +++++++++++++---- 4 files changed, 33 insertions(+), 4 deletions(-) diff --git a/src/Components/Facility/ConsultationCard.tsx b/src/Components/Facility/ConsultationCard.tsx index 467729f0f73..f6b4484b477 100644 --- a/src/Components/Facility/ConsultationCard.tsx +++ b/src/Components/Facility/ConsultationCard.tsx @@ -5,6 +5,7 @@ import ButtonV2 from "../Common/components/ButtonV2"; import { NonReadOnlyUsers } from "../../Utils/AuthorizeFor"; import RelativeDateUserMention from "../Common/RelativeDateUserMention"; import useConfig from "../../Common/hooks/useConfig"; +import Chip from "../../CAREUI/display/Chip"; interface ConsultationProps { itemData: ConsultationModel; @@ -70,6 +71,15 @@ export const ConsultationCard = (props: ConsultationProps) => {
{formatDateTime(itemData.admission_date)} + {itemData.is_readmission && ( + + )}
diff --git a/src/Components/Facility/models.tsx b/src/Components/Facility/models.tsx index 012ca1d68b2..cc34140e7a9 100644 --- a/src/Components/Facility/models.tsx +++ b/src/Components/Facility/models.tsx @@ -142,6 +142,7 @@ export interface ConsultationModel { cause_of_death?: string; death_datetime?: string; death_confirmed_doctor?: string; + is_readmission?: boolean; } export interface PatientStatsModel { id?: number; diff --git a/src/Components/Patient/ManagePatients.tsx b/src/Components/Patient/ManagePatients.tsx index b29c112c5a1..54d22b5f54c 100644 --- a/src/Components/Patient/ManagePatients.tsx +++ b/src/Components/Patient/ManagePatients.tsx @@ -603,6 +603,15 @@ export const PatientManager = () => { text="Review Missed" /> )} + {patient.last_consultation?.is_readmission && ( + + )} {patient.disease_status === "POSITIVE" && ( )} -
+
- - Domiciliary Care{" "} - + + + Domiciliary Care + + + )} + {consultation?.is_readmission && ( + <> + + + + Readmitted )} From 3fdf1d503d7f2ad7e46e03e5fc0e1bf87bf26426 Mon Sep 17 00:00:00 2001 From: "Tasnimul H. Tauhid" Date: Tue, 12 Sep 2023 19:25:19 +0530 Subject: [PATCH 13/16] Add Consultation button is now conditionally active (#6260) * Add Consultation button is now conditionally active * updated logic for add consultation button to be active --- src/Components/Patient/PatientHome.tsx | 31 +++++++++++++++++++------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/src/Components/Patient/PatientHome.tsx b/src/Components/Patient/PatientHome.tsx index 34e5ed1cb01..3d39f377462 100644 --- a/src/Components/Patient/PatientHome.tsx +++ b/src/Components/Patient/PatientHome.tsx @@ -374,6 +374,13 @@ export const PatientHome = (props: any) => { ); }; + const isPatientEligibleForNewConsultation = (patientData: PatientModel) => { + return !patientData.last_consultation || + patientData.last_consultation?.discharge_date + ? true + : false; + }; + return ( {
- patientData.is_active && - (!patientData?.last_consultation || - patientData?.last_consultation?.discharge_date) && + isPatientEligibleForNewConsultation(patientData) && navigate( `/facility/${patientData?.facility}/patient/${id}/consultation` ) } > -
-
+
+
From 8a704af2abe62a73cfa4e27d80fc0c573c30163e Mon Sep 17 00:00:00 2001 From: yaswanth sai vendra <75136628+yaswanthsaivendra@users.noreply.github.com> Date: Tue, 12 Sep 2023 19:26:13 +0530 Subject: [PATCH 14/16] Added None option in admitted_to bed filters so that we can filter for patient who are admitted but no bed assigned (#5550) * added None option in admitted_to bed filters * changed the id from 8 to None * make text user friendly --------- Co-authored-by: Rithvik Nishad --- src/Common/constants.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Common/constants.tsx b/src/Common/constants.tsx index 72a939b92fd..f5801e97e4b 100644 --- a/src/Common/constants.tsx +++ b/src/Common/constants.tsx @@ -345,6 +345,7 @@ export const ADMITTED_TO = [ { id: "2", text: "ICU" }, { id: "6", text: "Bed with oxygen support" }, { id: "7", text: "Regular" }, + { id: "None", text: "No bed assigned" }, ]; export const RESPIRATORY_SUPPORT = [ From f72a1cf12f6ba80bf03c1df6ce5cfb2c90fc150c Mon Sep 17 00:00:00 2001 From: Mohammed Nihal <57055998+nihal467@users.noreply.github.com> Date: Wed, 13 Sep 2023 07:49:18 +0530 Subject: [PATCH 15/16] verify asset filter (#6275) --- cypress/e2e/assets_spec/asset_homepage.cy.ts | 12 +++++- cypress/pageobject/Asset/AssetFilters.ts | 39 +++++++++++++++++++- cypress/pageobject/Asset/AssetSearch.ts | 4 +- src/CAREUI/interactive/SlideOver.tsx | 1 + src/Components/Assets/AssetFilter.tsx | 2 +- 5 files changed, 54 insertions(+), 4 deletions(-) diff --git a/cypress/e2e/assets_spec/asset_homepage.cy.ts b/cypress/e2e/assets_spec/asset_homepage.cy.ts index 6e9ceb9676b..fa24adf5b21 100644 --- a/cypress/e2e/assets_spec/asset_homepage.cy.ts +++ b/cypress/e2e/assets_spec/asset_homepage.cy.ts @@ -62,8 +62,18 @@ describe("Asset Tab", () => { "Dummy Facility 1", "INTERNAL", "ACTIVE", - "ONVIF Camera" + "ONVIF Camera", + "Camera Loc" ); + assetFilters.clickadvancefilter(); + assetFilters.clickslideoverbackbutton(); // to verify the back button doesn't clear applied filters + assetFilters.assertFacilityText("Dummy Facility 1"); + assetFilters.assertAssetTypeText("INTERNAL"); + assetFilters.assertAssetClassText("ONVIF"); + assetFilters.assertStatusText("ACTIVE"); + assetFilters.assertLocationText("Camera Locations"); + assetFilters.clickadvancefilter(); + assetFilters.clearFilters(); }); // Verify the pagination in the page diff --git a/cypress/pageobject/Asset/AssetFilters.ts b/cypress/pageobject/Asset/AssetFilters.ts index 57cc893bdb7..a16b61f4fc5 100644 --- a/cypress/pageobject/Asset/AssetFilters.ts +++ b/cypress/pageobject/Asset/AssetFilters.ts @@ -3,7 +3,8 @@ export class AssetFilters { facilityName: string, assetType: string, assetStatus: string, - assetClass: string + assetClass: string, + assetLocation: string ) { cy.contains("Advanced Filters").click(); cy.get("input[name='Facilities']") @@ -27,6 +28,42 @@ export class AssetFilters { .then(() => { cy.get("[role='option']").contains(assetClass).click(); }); + cy.get("#Facilities-location") + .click() + .type(assetLocation) + .then(() => { + cy.get("[role='option']").contains(assetLocation).click(); + }); cy.contains("Apply").click(); } + clearFilters() { + cy.intercept("GET", "**/api/v1/asset/**").as("clearAssets"); + cy.get("#clear-filter").click(); + cy.wait("@clearAssets").its("response.statusCode").should("eq", 200); + cy.url().should("match", /\/assets$/); + } + clickadvancefilter() { + cy.intercept("GET", "**/api/v1/getallfacilities/**").as("advancefilter"); + cy.get("#advanced-filter").click(); + cy.wait("@advancefilter").its("response.statusCode").should("eq", 200); + } + clickslideoverbackbutton() { + cy.get("#close-slide-over").click(); + } + // Assertions + assertFacilityText(text) { + cy.get("[data-testid=Facility]").should("contain", text); + } + assertAssetTypeText(text) { + cy.get("[data-testid='Asset Type']").should("contain", text); + } + assertAssetClassText(text) { + cy.get("[data-testid='Asset Class']").should("contain", text); + } + assertStatusText(text) { + cy.get("[data-testid=Status]").should("contain", text); + } + assertLocationText(text) { + cy.get("[data-testid=Location]").should("contain", text); + } } diff --git a/cypress/pageobject/Asset/AssetSearch.ts b/cypress/pageobject/Asset/AssetSearch.ts index fea6a975983..b1ccb2f71c9 100644 --- a/cypress/pageobject/Asset/AssetSearch.ts +++ b/cypress/pageobject/Asset/AssetSearch.ts @@ -1,6 +1,6 @@ export class AssetSearchPage { typeSearchKeyword(keyword: string) { - cy.get("#search").clear(); + cy.get("#search").click().clear(); cy.get("#search").click().type(keyword); } @@ -9,7 +9,9 @@ export class AssetSearchPage { } clickAssetByName(assetName: string) { + cy.intercept("GET", "**/api/v1/asset/**").as("clearAssets"); cy.get("[data-testid='created-asset-list']").contains(assetName).click(); + cy.wait("@clearAssets").its("response.statusCode").should("eq", 200); } verifyBadgeContent(expectedText: string) { diff --git a/src/CAREUI/interactive/SlideOver.tsx b/src/CAREUI/interactive/SlideOver.tsx index 3eae13869cb..34e1c615f94 100644 --- a/src/CAREUI/interactive/SlideOver.tsx +++ b/src/CAREUI/interactive/SlideOver.tsx @@ -109,6 +109,7 @@ export default function SlideOver({ >