From f4194937eeb5eeb4353c4043f1faf3901e4af0e1 Mon Sep 17 00:00:00 2001
From: Mohammed Nihal <57055998+nihal467@users.noreply.github.com>
Date: Wed, 9 Oct 2024 01:29:43 +0200
Subject: [PATCH 1/5] patient export test (#8745)
---
.../e2e/patient_spec/PatientHomepage.cy.ts | 12 +++++++
cypress/pageobject/Patient/PatientHome.ts | 31 +++++++++++++++++++
src/Components/Patient/ManagePatients.tsx | 2 +-
3 files changed, 44 insertions(+), 1 deletion(-)
diff --git a/cypress/e2e/patient_spec/PatientHomepage.cy.ts b/cypress/e2e/patient_spec/PatientHomepage.cy.ts
index c1575057fe4..0cf5936594d 100644
--- a/cypress/e2e/patient_spec/PatientHomepage.cy.ts
+++ b/cypress/e2e/patient_spec/PatientHomepage.cy.ts
@@ -16,6 +16,18 @@ describe("Patient Homepage present functionalities", () => {
cy.awaitUrl("/patients");
});
+ it("Export the live patient list based on a date range", () => {
+ patientHome.clickPatientExport();
+ cy.verifyNotification("Please select a seven day period");
+ cy.closeNotification();
+ patientHome.typePatientModifiedBeforeDate("01122023");
+ patientHome.typePatientModifiedAfterDate("07122023");
+ patientHome.clickPatientFilterApply();
+ patientHome.interceptPatientExportRequest();
+ patientHome.clickPatientExport();
+ patientHome.verifyPatientExportRequest();
+ });
+
it("Verify the functionality of the patient tab pagination", () => {
let firstPatientPageOne: string;
cy.get('[data-cy="patient"]')
diff --git a/cypress/pageobject/Patient/PatientHome.ts b/cypress/pageobject/Patient/PatientHome.ts
index 94801cd4bb8..d2f4efdc877 100644
--- a/cypress/pageobject/Patient/PatientHome.ts
+++ b/cypress/pageobject/Patient/PatientHome.ts
@@ -10,5 +10,36 @@ class PatientHome {
clickPreviousPage() {
cy.get("#prev-pages").click();
}
+
+ clickPatientExport() {
+ cy.get("#patient-export").click();
+ }
+
+ clickPatientFilterApply() {
+ cy.get("#apply-filter").click();
+ }
+
+ interceptPatientExportRequest() {
+ cy.intercept({
+ method: "GET",
+ url: "/api/v1/patient/*",
+ }).as("getPatients");
+ }
+
+ verifyPatientExportRequest() {
+ cy.wait("@getPatients").then((interception) => {
+ expect(interception.request.url).to.include("/api/v1/patient/");
+ expect(interception.request.url).to.include("&csv");
+ expect(interception.response.statusCode).to.eq(200);
+ });
+ }
+
+ typePatientModifiedBeforeDate(startDate: string) {
+ cy.clickAndTypeDate("input[name='modified_date_start']", startDate);
+ }
+
+ typePatientModifiedAfterDate(endDate: string) {
+ cy.clickAndTypeDate("input[name='modified_date_end']", endDate);
+ }
}
export default PatientHome;
diff --git a/src/Components/Patient/ManagePatients.tsx b/src/Components/Patient/ManagePatients.tsx
index 3f15544a50a..e5ee70163ea 100644
--- a/src/Components/Patient/ManagePatients.tsx
+++ b/src/Components/Patient/ManagePatients.tsx
@@ -891,7 +891,7 @@ export const PatientManager = () => {
selected={qParams.ordering}
onSelect={updateQuery}
/>
-
+
{!isExportAllowed ? (
{
From 207365a990a04884eef77771ffe1ce51749c8e38 Mon Sep 17 00:00:00 2001
From: Jacob John Jeevan <40040905+Jacobjeevan@users.noreply.github.com>
Date: Wed, 9 Oct 2024 06:18:34 +0530
Subject: [PATCH 2/5] hide spoke heading on facility create page (#8730)
---
src/Components/Facility/FacilityCreate.tsx | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/Components/Facility/FacilityCreate.tsx b/src/Components/Facility/FacilityCreate.tsx
index c68aa9ec0db..81bc6f48125 100644
--- a/src/Components/Facility/FacilityCreate.tsx
+++ b/src/Components/Facility/FacilityCreate.tsx
@@ -850,14 +850,14 @@ export const FacilityCreate = (props: FacilityProps) => {
required
types={["mobile", "landline"]}
/>
-
-
{t("spokes")}
- {facilityId && (
+ {facilityId && (
+
+
{t("spokes")}
- )}
-
+
+ )}
Date: Wed, 9 Oct 2024 15:46:43 +0530
Subject: [PATCH 3/5] Fix: Error Messages Persist in UserAdd Component (#8721)
---
src/Components/Users/UserAdd.tsx | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/Components/Users/UserAdd.tsx b/src/Components/Users/UserAdd.tsx
index 855e2cb8f9a..6a87e64425c 100644
--- a/src/Components/Users/UserAdd.tsx
+++ b/src/Components/Users/UserAdd.tsx
@@ -294,6 +294,7 @@ export const UserAdd = (props: UserProps) => {
const handleDateChange = (e: FieldChangeEvent) => {
if (dayjs(e.value).isValid()) {
+ const errors = { ...state.errors, [e.name]: "" };
dispatch({
type: "set_form",
form: {
@@ -301,10 +302,12 @@ export const UserAdd = (props: UserProps) => {
[e.name]: dayjs(e.value).format("YYYY-MM-DD"),
},
});
+ dispatch({ type: "set_errors", errors });
}
};
const handleFieldChange = (event: FieldChangeEvent) => {
+ const errors = { ...state.errors, [event.name]: "" };
dispatch({
type: "set_form",
form: {
@@ -312,6 +315,7 @@ export const UserAdd = (props: UserProps) => {
[event.name]: event.value,
},
});
+ dispatch({ type: "set_errors", errors });
};
useAbortableEffect(() => {
From 4b2c827ed434b3eac22ac72582d3fdb863bcd670 Mon Sep 17 00:00:00 2001
From: Shaurya Gupta
Date: Wed, 9 Oct 2024 16:04:13 +0530
Subject: [PATCH 4/5] fix: Add user media ready and camera permission denied
notifications (#8688)
---
.../Facility/CoverImageEditModal.tsx | 64 +++++++++++++------
src/Locale/en.json | 3 +-
src/Locale/hi.json | 3 +-
src/Locale/kn.json | 1 +
src/Locale/ml.json | 1 +
src/Locale/ta.json | 1 +
6 files changed, 53 insertions(+), 20 deletions(-)
diff --git a/src/Components/Facility/CoverImageEditModal.tsx b/src/Components/Facility/CoverImageEditModal.tsx
index d65a1d0ebfd..f3b2b3ab761 100644
--- a/src/Components/Facility/CoverImageEditModal.tsx
+++ b/src/Components/Facility/CoverImageEditModal.tsx
@@ -1,11 +1,11 @@
-import {
+import React, {
+ useState,
ChangeEventHandler,
useCallback,
useEffect,
useRef,
- useState,
} from "react";
-import { Success } from "../../Utils/Notifications";
+import { Success, Warn } from "../../Utils/Notifications";
import useDragAndDrop from "../../Utils/useDragAndDrop";
import { sleep } from "../../Utils/utils";
import ButtonV2, { Cancel, Submit } from "../Common/components/ButtonV2";
@@ -67,9 +67,11 @@ const CoverImageEditModal = ({
const LaptopScreenBreakpoint = 640;
const isLaptopScreen = width >= LaptopScreenBreakpoint;
const { t } = useTranslation();
+ const [isDragging, setIsDragging] = useState(false);
+
const handleSwitchCamera = useCallback(() => {
- setConstraint((prev) =>
- prev.facingMode === "user"
+ setConstraint(
+ constraint.facingMode === "user"
? VideoConstraints.environment
: VideoConstraints.user,
);
@@ -85,6 +87,7 @@ const CoverImageEditModal = ({
setSelectedFile(myFile);
});
};
+
const closeModal = () => {
setPreview(undefined);
setSelectedFile(undefined);
@@ -162,11 +165,25 @@ const CoverImageEditModal = ({
const onDrop = (e: React.DragEvent) => {
e.preventDefault();
dragProps.setDragOver(false);
- const dropedFile = e?.dataTransfer?.files[0];
- if (dropedFile.type.split("/")[0] !== "image")
+ setIsDragging(false);
+ const droppedFile = e?.dataTransfer?.files[0];
+ if (droppedFile.type.split("/")[0] !== "image")
return dragProps.setFileDropError("Please drop an image file to upload!");
- setSelectedFile(dropedFile);
+ setSelectedFile(droppedFile);
+ };
+
+ const onDragOver = (e: React.DragEvent) => {
+ e.preventDefault();
+ dragProps.onDragOver(e);
+ setIsDragging(true);
+ };
+
+ const onDragLeave = (e: React.DragEvent) => {
+ e.preventDefault();
+ dragProps.onDragLeave();
+ setIsDragging(false);
};
+
const commonHint = (
<>
{t("max_size_for_image_uploaded_should_be")} 1mb.
@@ -202,16 +219,16 @@ const CoverImageEditModal = ({
>
) : (