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M6iEB2;@^5u%e<3l|rHf!W04T@#F6dz-y$9bJ53~bNpYD6r
z{%DpS9#jC-Ir%QYI_3xEO}Q%HYcuPP(d2@$^q#YZGIZno-ss*RtNpm}K#)CYdFU?l
vU5@GFNyS0;obLmelmK1szDrmZ|IPScw{jhIPWohB3})&pFeTg*XvO~z%H;CA
literal 0
HcmV?d00001
diff --git a/cypress/pageobject/Asset/AssetCreation.ts b/cypress/pageobject/Asset/AssetCreation.ts
index d24c93d0197..fdaf802d4b7 100644
--- a/cypress/pageobject/Asset/AssetCreation.ts
+++ b/cypress/pageobject/Asset/AssetCreation.ts
@@ -1,4 +1,5 @@
// assetPage.ts
+import { cy, expect } from "local-cypress";
export class AssetPage {
createAsset() {
@@ -74,6 +75,14 @@ export class AssetPage {
cy.get("[data-testid=asset-notes-input] textarea").type(notes);
}
+ interceptAssetCreation() {
+ cy.intercept("POST", "**/api/v1/asset/").as("createAsset");
+ }
+
+ verifyAssetCreation() {
+ cy.wait("@createAsset").its("response.statusCode").should("eq", 201);
+ }
+
clickCreateAsset() {
cy.get("#submit").contains("Create Asset").click();
}
@@ -87,7 +96,9 @@ export class AssetPage {
}
openCreatedAsset() {
+ cy.intercept("GET", "**/api/v1/asset/**").as("getAsset");
cy.get("[data-testid=created-asset-list]").first().click();
+ cy.wait("@getAsset").its("response.statusCode").should("eq", 200);
}
editAssetDetails(
@@ -97,7 +108,8 @@ export class AssetPage {
manufacturer: string,
supportName: string,
vendorName: string,
- notes: string
+ notes: string,
+ lastServicedOn: string
) {
cy.get("[data-testid=asset-update-button]").click();
cy.get("[data-testid=asset-name-input] input").clear().type(name);
@@ -114,18 +126,71 @@ export class AssetPage {
cy.get("[data-testid=asset-vendor-name-input] input")
.clear()
.type(vendorName);
+ cy.get(
+ "[data-testid=asset-last-serviced-on-input] input[type='text']"
+ ).click();
+ cy.get("#date-input").click().type(lastServicedOn);
cy.get("[data-testid=asset-notes-input] textarea").clear().type(notes);
}
+ configureAsset(
+ hostName: string,
+ localIp: string,
+ userName: string,
+ password: string,
+ streamUuid: string
+ ) {
+ cy.get("[data-testid=asset-configure-button]").click();
+ cy.get("[name=middleware_hostname]").type(hostName);
+ cy.get("[name=camera_address]").type(localIp);
+ cy.get("[name=username]").type(userName);
+ cy.get("[name=password]").type(password);
+ cy.get("[name=stream_uuid]").type(streamUuid);
+ }
+
+ configureVitalAsset(hostName: string, localIp: string) {
+ cy.get("[data-testid=asset-configure-button]").click();
+ cy.get("#middlewareHostname").type(hostName);
+ cy.get("#localipAddress").type(localIp);
+ }
+
+ spyAssetConfigureApi() {
+ cy.intercept(/\/api\/v1\/asset/).as("asset");
+ }
+
+ verifyAssetConfiguration(statusCode: number) {
+ cy.wait("@asset").then((interception) => {
+ expect(interception.response.statusCode).to.equal(statusCode);
+ });
+ }
+
+ clickConfigureAsset() {
+ cy.get("#submit").contains("Set Configuration").click();
+ }
+
+ clickConfigureVital() {
+ cy.intercept("PATCH", "**/api/v1/asset/**").as("postConfiguration");
+ cy.get("#submit").contains("Save Configuration").click();
+ cy.wait("@postConfiguration").its("response.statusCode").should("eq", 200);
+ }
+
clickUpdateAsset() {
cy.get("#submit").contains("Update").click();
}
+ interceptDeleteAssetApi() {
+ cy.intercept("DELETE", "**/api/v1/asset/**").as("deleteAsset");
+ }
+
deleteAsset() {
cy.get("[data-testid=asset-delete-button]").click();
cy.get("#submit").contains("Confirm").click();
}
+ verifyDeleteStatus() {
+ cy.wait("@deleteAsset").its("response.statusCode").should("eq", 204);
+ }
+
verifyEmptyAssetNameError() {
cy.get("[data-testid=asset-name-input] span").should(
"contain",
@@ -160,4 +225,34 @@ export class AssetPage {
"Please enter valid phone number"
);
}
+
+ selectImportFacility(facilityName: string) {
+ cy.get("input[name='facilities']")
+ .type(facilityName)
+ .then(() => {
+ cy.get("[role='option']").contains(facilityName).click();
+ });
+ }
+
+ selectImportOption() {
+ cy.get("[data-testid=import-asset-button]").click();
+ cy.get(".import-assets-button").click();
+ }
+
+ importAssetFile() {
+ cy.get("[data-testid=import-asset-file]")
+ .selectFile("cypress/fixtures/sampleAsset.xlsx", { force: true })
+ .wait(100);
+ }
+
+ selectImportLocation(locationName: string) {
+ cy.get("[data-testid=select-import-location]").click();
+ cy.get("li[role=option]").contains(locationName).click();
+ }
+
+ clickImportAsset() {
+ cy.intercept("POST", "**/api/v1/asset/").as("importAsset");
+ cy.get("#submit").contains("Import").click();
+ cy.wait("@importAsset").its("response.statusCode").should("eq", 201);
+ }
}
diff --git a/cypress/pageobject/Patient/PatientConsultation.ts b/cypress/pageobject/Patient/PatientConsultation.ts
new file mode 100644
index 00000000000..315ef455aaa
--- /dev/null
+++ b/cypress/pageobject/Patient/PatientConsultation.ts
@@ -0,0 +1,108 @@
+export class PatientConsultationPage {
+ selectConsultationStatus(status: string) {
+ cy.get("#consultation_status")
+ .click()
+ .then(() => {
+ cy.get("[role='option']").contains(status).click();
+ });
+ }
+
+ selectSymptoms(symptoms: string) {
+ cy.get("#symptoms")
+ .click()
+ .then(() => {
+ cy.get("[role='option']").contains(symptoms).click();
+ });
+ }
+
+ fillIllnessHistory(history: string) {
+ cy.get("#history_of_present_illness").scrollIntoView;
+ cy.get("#history_of_present_illness").should("be.visible");
+ cy.get("#history_of_present_illness").click().type(history);
+ }
+
+ enterConsultationDetails(
+ examinationDetails: string,
+ weight: string,
+ height: string,
+ ipNumber: string,
+ consulationNotes: string,
+ verificationBy: string
+ ) {
+ cy.get("#symptoms").click();
+ cy.get("#examination_details").click().type(examinationDetails);
+ cy.get("#weight").click().type(height);
+ cy.get("#height").click().type(weight);
+ cy.get("#patient_no").type(ipNumber);
+ cy.intercept("GET", "**/icd/**").as("getIcdResults");
+ cy.get(
+ "#icd11_diagnoses_object input[placeholder='Select'][role='combobox']"
+ )
+ .click()
+ .type("1A");
+ cy.get("#icd11_diagnoses_object [role='option']")
+ .contains("1A03 Intestinal infections due to Escherichia coli")
+ .click();
+ cy.get("label[for='icd11_diagnoses_object']").click();
+ cy.wait("@getIcdResults").its("response.statusCode").should("eq", 200);
+
+ cy.get("#icd11_principal_diagnosis [role='combobox']").click().type("1A");
+ cy.get("#icd11_principal_diagnosis [role='option']")
+ .contains("1A03 Intestinal infections due to Escherichia coli")
+ .click();
+
+ cy.get("#consultation_notes").click().type(consulationNotes);
+ cy.get("#verified_by").click().type(verificationBy);
+ }
+
+ submitConsultation() {
+ cy.get("#submit").click();
+ }
+
+ clickAddPrescription() {
+ cy.contains("button", "Add Prescription Medication")
+ .should("be.visible")
+ .click();
+ }
+
+ interceptMediaBase() {
+ cy.intercept("GET", "**/api/v1/medibase/**").as("getMediaBase");
+ }
+
+ prescribeMedicine() {
+ cy.get("div#medicine_object input[placeholder='Select'][role='combobox']")
+ .click()
+ .type("dolo{enter}");
+ }
+
+ selectMedicinebox() {
+ cy.get(
+ "div#medicine_object input[placeholder='Select'][role='combobox']"
+ ).click();
+ }
+
+ waitForMediabaseStatusCode() {
+ cy.wait("@getMediaBase").its("response.statusCode").should("eq", 200);
+ }
+
+ enterDosage(doseAmount: string) {
+ cy.get("#dosage").type(doseAmount, { force: true });
+ }
+
+ selectDosageFrequency(frequency: string) {
+ cy.get("#frequency")
+ .click()
+ .then(() => {
+ cy.get("div#frequency [role='option']").contains(frequency).click();
+ });
+ }
+
+ submitPrescriptionAndReturn() {
+ cy.intercept("POST", "**/api/v1/consultation/*/prescriptions/").as(
+ "submitPrescription"
+ );
+ cy.get("button#submit").should("be.visible").click();
+ cy.get("[data-testid='return-to-patient-dashboard']").click();
+ cy.wait("@submitPrescription").its("response.statusCode").should("eq", 201);
+ }
+}
diff --git a/cypress/pageobject/Patient/PatientCreation.ts b/cypress/pageobject/Patient/PatientCreation.ts
new file mode 100644
index 00000000000..9b8df4a287e
--- /dev/null
+++ b/cypress/pageobject/Patient/PatientCreation.ts
@@ -0,0 +1,127 @@
+// PatientPage.ts
+
+let patient_url = "";
+
+export class PatientPage {
+ createPatient() {
+ cy.intercept("GET", "**/api/v1/facility/**").as("getFacilities");
+ cy.get("#add-patient-details").should("be.visible");
+ cy.get("#add-patient-details").click();
+ cy.wait("@getFacilities").its("response.statusCode").should("eq", 200);
+ }
+
+ selectFacility(facilityName: string) {
+ cy.get("input[name='facilities']")
+ .type(facilityName)
+ .then(() => {
+ cy.get("[role='option']").first().click();
+ });
+ cy.get("button").should("contain", "Select");
+ cy.get("button").get("#submit").click();
+ }
+
+ interceptCreatePatientAPI() {
+ cy.intercept("GET", "**/facility/*/patient/**").as("createPatient");
+ }
+
+ verifyCreatedPatientResponse() {
+ cy.wait("@createPatient").its("response.statusCode").should("eq", 200);
+ }
+
+ enterPatientDetails(
+ phoneNumber: string,
+ emergencyPhoneNumber: string,
+ patientName: string,
+ gender: string,
+ address: string,
+ pincode: string,
+ wardName: string,
+ bloodGroup: string,
+ dateOfBirth: string
+ ) {
+ cy.get("#phone_number-div").type(phoneNumber);
+ cy.get("#emergency_phone_number-div").type(emergencyPhoneNumber);
+ cy.get("#date_of_birth").should("be.visible").click();
+ cy.get("#date-input").click().type(dateOfBirth);
+ cy.get("[data-testid=name] input").type(patientName);
+ cy.get("[data-testid=Gender] button")
+ .click()
+ .then(() => {
+ cy.get("[role='option']").contains(gender).click();
+ });
+ cy.get("[data-testid=current-address] textarea").type(address);
+ cy.get("[data-testid=permanent-address] input").check();
+ cy.get("#pincode").type(pincode);
+ cy.get("[data-testid=localbody] button")
+ .click()
+ .then(() => {
+ cy.get("[role='option']").first().click();
+ });
+ cy.get("[data-testid=ward-respective-lsgi] button")
+ .click()
+ .then(() => {
+ cy.get("[role='option']").contains(wardName).click();
+ });
+ cy.get("[name=medical_history_check_1]").check();
+ cy.get("[data-testid=blood-group] button")
+ .click()
+ .then(() => {
+ cy.get("[role='option']").contains(bloodGroup).click();
+ });
+ }
+
+ clickCreatePatient() {
+ cy.intercept("POST", "**/api/v1/patient/").as("createPatient");
+ cy.get("button[data-testid='submit-button']").click();
+ cy.wait("@createPatient").its("response.statusCode").should("eq", 201);
+ }
+
+ verifyPatientIsCreated() {
+ cy.get("h2").should("contain", "Create Consultation");
+ cy.url().should("include", "/patient");
+ }
+
+ saveCreatedPatientUrl() {
+ cy.url().then((url) => {
+ cy.log(url);
+ patient_url = url.split("/").slice(0, -1).join("/");
+ cy.log(patient_url);
+ });
+ }
+
+ visitCreatedPatient() {
+ cy.awaitUrl(patient_url);
+ }
+
+ verifyPatientDetails(
+ age: number,
+ patientName: string,
+ phoneNumber: string,
+ emergencyPhoneNumber: string,
+ yearOfBirth: string,
+ bloodGroup: string
+ ) {
+ cy.url().should("include", "/facility/");
+ cy.get("[data-testid=patient-dashboard]").should("contain", age);
+ cy.get("[data-testid=patient-dashboard]").should("contain", patientName);
+ cy.get("[data-testid=patient-dashboard]").should("contain", phoneNumber);
+ cy.get("[data-testid=patient-dashboard]").should(
+ "contain",
+ emergencyPhoneNumber
+ );
+ cy.get("[data-testid=patient-dashboard]").should("contain", yearOfBirth);
+ cy.get("[data-testid=patient-dashboard]").should("contain", bloodGroup);
+ }
+
+ visitUpdatePatientUrl() {
+ cy.awaitUrl(patient_url + "/update");
+ }
+
+ interceptFacilities() {
+ cy.intercept("GET", "**/facility/*/patient/**").as("getFacilities");
+ }
+
+ verifyStatusCode() {
+ cy.wait("@getFacilities").its("response.statusCode").should("eq", 200);
+ }
+}
diff --git a/cypress/pageobject/Patient/PatientUpdate.ts b/cypress/pageobject/Patient/PatientUpdate.ts
new file mode 100644
index 00000000000..b26ef678679
--- /dev/null
+++ b/cypress/pageobject/Patient/PatientUpdate.ts
@@ -0,0 +1,97 @@
+let patient_url = "";
+
+export class UpdatePatientPage {
+ enterPatientDetails(
+ patientName: string,
+ bloodGroup: string,
+ phoneNumber: string,
+ emergencyPhoneNumber: string,
+ address: string,
+ currentHealthCondition: string,
+ ongoingMedication: string,
+ allergies: string,
+ medicalHistory: string[],
+ subscriberId: string,
+ policyId: string,
+ insuranceId: string,
+ insuranceName: string
+ ) {
+ cy.wait(10000);
+ cy.get("#address").scrollIntoView();
+ cy.get("#address").should("be.visible");
+ cy.get("#address").type(address);
+ cy.get("[data-testid=name] input").clear();
+ cy.get("[data-testid=name] input").type(patientName);
+ cy.get("#phone_number-div").clear();
+ cy.get("#phone_number-div").type("+91").type(phoneNumber);
+ cy.get("#emergency_phone_number-div").clear();
+ cy.get("#emergency_phone_number-div")
+ .type("+91")
+ .type(emergencyPhoneNumber);
+ cy.get("#present_health").type(currentHealthCondition);
+ cy.get("#ongoing_medication").type(ongoingMedication);
+ cy.get("#allergies").type(allergies);
+ cy.get("[name=medical_history_check_1]").uncheck();
+ cy.get("[name=medical_history_check_2]").check();
+ cy.get("#medical_history_2").type(medicalHistory[0]);
+ cy.get("[name=medical_history_check_3]").check();
+ cy.get("#medical_history_3").type(medicalHistory[1]);
+ cy.get("button").get("[data-testid=add-insurance-button]").click();
+ cy.get("#subscriber_id").type(subscriberId);
+ cy.get("#policy_id").type(policyId);
+ cy.get("#insurer_id").type(insuranceId);
+ cy.get("#insurer_name").type(insuranceName);
+ cy.get("[data-testid=blood-group] button")
+ .click()
+ .then(() => {
+ cy.get("[role='option']").contains(bloodGroup).click();
+ });
+ }
+
+ clickUpdatePatient() {
+ cy.intercept("PUT", "**/api/v1/patient/**").as("updatePatient");
+ cy.get("button").get("[data-testid=submit-button]").click();
+ cy.wait("@updatePatient").its("response.statusCode").should("eq", 200);
+ }
+
+ verifyPatientUpdated() {
+ cy.url().should("include", "/patient");
+ }
+
+ saveUpdatedPatientUrl() {
+ cy.url().then((url) => {
+ cy.log(url);
+ patient_url = url.split("/").slice(0, -1).join("/");
+ cy.log(patient_url);
+ });
+ }
+
+ visitUpdatedPatient() {
+ cy.awaitUrl(patient_url);
+ }
+
+ verifyPatientDetails(
+ patientName: string,
+ phoneNumber: string,
+ presentHealth: string,
+ ongoingMedication: string,
+ allergies: string
+ ) {
+ cy.url().should("include", "/facility/");
+ cy.get("[data-testid=patient-dashboard]").should("contain", patientName);
+ cy.get("[data-testid=patient-dashboard]").should("contain", phoneNumber);
+ cy.get("[data-testid=patient-present-health]").should(
+ "contain",
+ presentHealth
+ );
+ cy.get("[data-testid=patient-ongoing-medication]").should(
+ "contain",
+ ongoingMedication
+ );
+ cy.get("[data-testid=patient-allergies]").should("contain", allergies);
+ }
+
+ visitConsultationPage() {
+ cy.visit(patient_url + "/consultation");
+ }
+}
diff --git a/cypress/pageobject/constants.ts b/cypress/pageobject/constants.ts
new file mode 100644
index 00000000000..72e0d31c662
--- /dev/null
+++ b/cypress/pageobject/constants.ts
@@ -0,0 +1,4 @@
+export const phone_number =
+ "9" + Math.floor(100000000 + Math.random() * 900000000);
+export const emergency_phone_number =
+ "9" + Math.floor(100000000 + Math.random() * 900000000);
diff --git a/src/Components/Assets/AssetImportModal.tsx b/src/Components/Assets/AssetImportModal.tsx
index b5b0110096a..548df2901ec 100644
--- a/src/Components/Assets/AssetImportModal.tsx
+++ b/src/Components/Assets/AssetImportModal.tsx
@@ -220,7 +220,7 @@ const AssetImportModal = ({ open, onClose, facility }: Props) => {
Select location for import *
-
+
{
Upload a file
{
)
}
id="configure-asset"
+ data-testid="asset-configure-button"
authorizeFor={NonReadOnlyUsers}
>
diff --git a/src/Components/Assets/AssetsList.tsx b/src/Components/Assets/AssetsList.tsx
index 5b820f93e29..6183a47783c 100644
--- a/src/Components/Assets/AssetsList.tsx
+++ b/src/Components/Assets/AssetsList.tsx
@@ -310,14 +310,16 @@ const AssetsList = () => {
options={
<>
{authorizedForImportExport && (
-
+
,
+ icon: (
+
+ ),
onClick: () => setImportAssetModalOpen(true),
},
},
diff --git a/src/Components/Patient/PatientHome.tsx b/src/Components/Patient/PatientHome.tsx
index 2565bce64ba..34e5ed1cb01 100644
--- a/src/Components/Patient/PatientHome.tsx
+++ b/src/Components/Patient/PatientHome.tsx
@@ -1050,7 +1050,10 @@ export const PatientHome = (props: any) => {
Present Health
-
+
{patientData.present_health}
@@ -1060,7 +1063,10 @@ export const PatientHome = (props: any) => {
Ongoing Medications
-
+
{patientData.ongoing_medication}
@@ -1070,7 +1076,10 @@ export const PatientHome = (props: any) => {
Allergies
-
+
{patientData.allergies}
From e1f00fa423e3ac74ce63ecd4eed2a12b2cc5e886 Mon Sep 17 00:00:00 2001
From: Shivam Jha <86483059+ShivamJhaa@users.noreply.github.com>
Date: Thu, 7 Sep 2023 17:45:25 +0530
Subject: [PATCH 15/20] Added test for resource, facility and migrated them to
POM approach (#6106)
* lints
* Added test for resource and migrated it to POM
* trying a fix
* nits
* backend change
* Reverted useless changes
* fix test
* Fixed failing test
* Added api verification
* Diagnosis: Adds field Principal Diagnosis (#6218)
* adds field principle diagnosis
* show in consultation details
* fix typo
* fix cypress
* try adding wait
* fix tests
* open pdf file preview in new tab (#6226)
* Changed weekly to average weekly for working hours (#6228)
* Added padding to count block on patients page
* fixed date format in asset manage page
* Merged configure facility and configure health facility in one page
* removed commented code
* changed weekly to average weekly for working hours
* Resolved comments
---------
Co-authored-by: Mohammed Nihal <57055998+nihal467@users.noreply.github.com>
Co-authored-by: Rithvik Nishad
Co-authored-by: Ashesh <3626859+Ashesh3@users.noreply.github.com>
Co-authored-by: Kshitij Verma <101321276+kshitijv256@users.noreply.github.com>
---
cypress/e2e/facility_spec/facility.cy.ts | 41 ++++++-
cypress/e2e/facility_spec/inventory.cy.ts | 28 +++--
cypress/e2e/resource_spec/resources.cy.ts | 70 +++++++-----
.../pageobject/Facility/FacilityCreation.ts | 106 ++++++++++++++++++
cypress/pageobject/Login/LoginPage.ts | 2 +
cypress/pageobject/Resource/ResourcePage.ts | 83 ++++++++++++++
src/Components/Common/DateInputV2.tsx | 4 +-
src/Components/Facility/FacilityHome.tsx | 2 +
src/Components/Resource/ListView.tsx | 1 +
src/Components/Resource/ResourceBoard.tsx | 1 +
src/Components/Resource/ResourceDetails.tsx | 1 +
src/index.tsx | 2 +-
12 files changed, 291 insertions(+), 50 deletions(-)
create mode 100644 cypress/pageobject/Resource/ResourcePage.ts
diff --git a/cypress/e2e/facility_spec/facility.cy.ts b/cypress/e2e/facility_spec/facility.cy.ts
index f2e555bb58a..f8fe04b4f30 100644
--- a/cypress/e2e/facility_spec/facility.cy.ts
+++ b/cypress/e2e/facility_spec/facility.cy.ts
@@ -1,12 +1,16 @@
// FacilityCreation
+import { cy, describe, before, beforeEach, it, afterEach } from "local-cypress";
import FacilityPage from "../../pageobject/Facility/FacilityCreation";
+import LoginPage from "../../pageobject/Login/LoginPage";
describe("Facility Creation", () => {
let facilityUrl: string;
const facilityPage = new FacilityPage();
+ const loginPage = new LoginPage();
+ const phone_number = "9999999999";
before(() => {
- cy.loginByApi("devdistrictadmin", "Coronasafe@123");
+ loginPage.loginAsDisctrictAdmin();
cy.saveLocalStorage();
});
@@ -51,6 +55,7 @@ describe("Facility Creation", () => {
facilityPage.visitUpdateFacilityPage(facilityUrl);
facilityPage.clickManageFacilityDropdown();
facilityPage.clickUpdateFacilityOption();
+ facilityPage.clickUpdateFacilityType();
facilityPage.fillFacilityName("cypress facility updated");
facilityPage.fillAddress("Cypress Facility Updated Address");
facilityPage.fillOxygenCapacity("100");
@@ -61,6 +66,40 @@ describe("Facility Creation", () => {
cy.url().should("not.include", "/update");
});
+ it("Configure the existing facility", () => {
+ facilityPage.visitUpdateFacilityPage(facilityUrl);
+ facilityPage.clickManageFacilityDropdown();
+ facilityPage.clickConfigureFacilityOption();
+ facilityPage.fillMiddleWareAddress("dev_middleware.coronasafe.live");
+ facilityPage.clickupdateMiddleWare();
+ facilityPage.verifySuccessNotification("Facility updated successfully");
+ });
+
+ it("Create a resource request", () => {
+ facilityPage.visitUpdateFacilityPage(facilityUrl);
+ facilityPage.clickManageFacilityDropdown();
+ facilityPage.clickResourceRequestOption();
+ facilityPage.fillResourceRequestDetails(
+ "Test User",
+ phone_number,
+ "cypress",
+ "Test title",
+ "10",
+ "Test description"
+ );
+ facilityPage.clickSubmitRequestButton();
+ facilityPage.verifySuccessNotification(
+ "Resource request created successfully"
+ );
+ });
+
+ it("Delete a facility", () => {
+ facilityPage.visitUpdateFacilityPage(facilityUrl);
+ facilityPage.clickManageFacilityDropdown();
+ facilityPage.clickDeleteFacilityOption();
+ facilityPage.confirmDeleteFacility();
+ });
+
afterEach(() => {
cy.saveLocalStorage();
});
diff --git a/cypress/e2e/facility_spec/inventory.cy.ts b/cypress/e2e/facility_spec/inventory.cy.ts
index 91c6d36466f..c28035dd885 100644
--- a/cypress/e2e/facility_spec/inventory.cy.ts
+++ b/cypress/e2e/facility_spec/inventory.cy.ts
@@ -1,8 +1,13 @@
import { cy, describe, before, beforeEach, it, afterEach } from "local-cypress";
+import FacilityPage from "../../pageobject/Facility/FacilityCreation";
+import LoginPage from "../../pageobject/Login/LoginPage";
describe("Inventory Management Section", () => {
+ const facilityPage = new FacilityPage();
+ const loginPage = new LoginPage();
+
before(() => {
- cy.loginByApi("devdistrictadmin", "Coronasafe@123");
+ loginPage.loginAsDisctrictAdmin();
cy.saveLocalStorage();
});
@@ -10,23 +15,16 @@ describe("Inventory Management Section", () => {
cy.restoreLocalStorage();
cy.awaitUrl("/");
cy.viewport(1280, 720);
- cy.intercept("GET", "**/api/v1/facility/**").as("getFacilities");
- cy.get("[id='facility-details']").first().click();
- cy.wait("@getFacilities").its("response.statusCode").should("eq", 200);
- cy.get("#manage-facility-dropdown button").should("be.visible");
- cy.get("[id='manage-facility-dropdown']").scrollIntoView().click();
- cy.get("[id=inventory-management]").click();
});
it("Adds Inventory", () => {
- cy.contains("Manage Inventory").click();
- cy.get("div#id").click();
- cy.get("div#id ul li").contains("Liquid Oxygen").click();
- cy.get("div#isIncoming").click();
- cy.get("div#isIncoming ul li").contains("Add Stock").click();
- cy.get("[name='quantity']").type("120");
- cy.get("button").contains("Add/Update Inventory").click();
- cy.verifyNotification("Inventory created successfully");
+ facilityPage.visitAlreadyCreatedFacility();
+ facilityPage.clickManageFacilityDropdown();
+ facilityPage.clickInventoryManagementOption();
+ facilityPage.clickManageInventory();
+ facilityPage.fillInventoryDetails("Liquid Oxygen", "Add Stock", "120");
+ facilityPage.clickAddInventory();
+ facilityPage.verifySuccessNotification("Inventory created successfully");
});
afterEach(() => {
diff --git a/cypress/e2e/resource_spec/resources.cy.ts b/cypress/e2e/resource_spec/resources.cy.ts
index 099e782277a..b3393d0942b 100644
--- a/cypress/e2e/resource_spec/resources.cy.ts
+++ b/cypress/e2e/resource_spec/resources.cy.ts
@@ -1,8 +1,13 @@
import { afterEach, before, beforeEach, cy, describe, it } from "local-cypress";
+import LoginPage from "../../pageobject/Login/LoginPage";
+import ResourcePage from "../../pageobject/Resource/ResourcePage";
describe("Resource Page", () => {
+ const loginPage = new LoginPage();
+ const resourcePage = new ResourcePage();
+
before(() => {
- cy.loginByApi("devdistrictadmin", "Coronasafe@123");
+ loginPage.loginAsDisctrictAdmin();
cy.saveLocalStorage();
});
@@ -11,36 +16,39 @@ describe("Resource Page", () => {
cy.awaitUrl("/resource");
});
- it("checks if all download button works", () => {
- cy.get("svg.care-svg-icon__baseline.care-l-export").each(($button) => {
- cy.intercept(/\/api\/v1\/resource/).as("resource_download");
- cy.wrap($button).click({ force: true });
- cy.wait("@resource_download").then((interception) => {
- expect(interception.response.statusCode).to.equal(200);
- });
- });
- });
-
- it("switch between active/completed", () => {
- cy.intercept(/\/api\/v1\/resource/).as("resource");
- cy.contains("Completed").click();
- cy.wait("@resource").then((interception) => {
- expect(interception.response.statusCode).to.equal(200);
- });
- cy.contains("Active").should("have.class", "text-primary-500");
- cy.contains("Completed").should("have.class", "text-white");
- cy.intercept(/\/api\/v1\/resource/).as("resource");
- cy.contains("Active").click();
- cy.wait("@resource").then((interception) => {
- expect(interception.response.statusCode).to.equal(200);
- });
- cy.contains("Active").should("have.class", "text-white");
- cy.contains("Completed").should("have.class", "text-primary-500");
- });
-
- it("switch between list view and board view", () => {
- cy.contains("List View").click();
- cy.contains("Board View").click();
+ it("Checks if all download button works", () => {
+ resourcePage.verifyDownloadButtonWorks();
+ });
+
+ it("Switch between active/completed", () => {
+ resourcePage.spyResourceApi();
+ resourcePage.clickCompletedResources();
+ resourcePage.verifyCompletedResources();
+ resourcePage.spyResourceApi();
+ resourcePage.clickActiveResources();
+ resourcePage.verifyActiveResources();
+ });
+
+ it("Switch between list view and board view", () => {
+ resourcePage.clickListViewButton();
+ resourcePage.clickBoardViewButton();
+ });
+
+ it("Update the status of resource", () => {
+ resourcePage.openAlreadyCreatedResource();
+ resourcePage.clickUpdateStatus();
+ resourcePage.updateStatus("APPROVED");
+ resourcePage.clickSubmitButton();
+ resourcePage.verifySuccessNotification(
+ "Resource request updated successfully"
+ );
+ });
+
+ it("Post comment for a resource", () => {
+ resourcePage.openAlreadyCreatedResource();
+ resourcePage.addCommentForResource("Test comment");
+ resourcePage.clickPostCommentButton();
+ resourcePage.verifySuccessNotification("Comment added successfully");
});
afterEach(() => {
diff --git a/cypress/pageobject/Facility/FacilityCreation.ts b/cypress/pageobject/Facility/FacilityCreation.ts
index ab958a49810..84b793b3949 100644
--- a/cypress/pageobject/Facility/FacilityCreation.ts
+++ b/cypress/pageobject/Facility/FacilityCreation.ts
@@ -1,7 +1,13 @@
// FacilityPage.ts
+import { cy } from "local-cypress";
+
class FacilityPage {
visitCreateFacilityPage() {
+ cy.intercept("GET", "**/facility/create").as("getCreateFacilities");
cy.visit("/facility/create");
+ cy.wait("@getCreateFacilities")
+ .its("response.statusCode")
+ .should("eq", 200);
}
visitUpdateFacilityPage(url: string) {
@@ -11,6 +17,14 @@ class FacilityPage {
cy.get("#manage-facility-dropdown button").should("be.visible");
}
+ clickUpdateFacilityType() {
+ cy.get("#facility_type")
+ .click()
+ .then(() => {
+ cy.get("[role='option']").contains("Request Approving Center").click();
+ });
+ }
+
fillFacilityName(name: string) {
cy.get("#name").clear().type(name);
}
@@ -99,6 +113,28 @@ class FacilityPage {
cy.get("#update-facility").contains("Update Facility").click();
}
+ clickConfigureFacilityOption() {
+ cy.get("#configure-facility").contains("Configure Facility").click();
+ }
+
+ clickInventoryManagementOption() {
+ cy.get("[id=inventory-management]").click();
+ }
+
+ clickResourceRequestOption() {
+ cy.get("#resource-request").contains("Resource Request").click();
+ }
+
+ clickDeleteFacilityOption() {
+ cy.get("#delete-facility").contains("Delete Facility").click();
+ }
+
+ confirmDeleteFacility() {
+ cy.intercept("DELETE", "**/api/v1/facility/**").as("deleteFacility");
+ cy.get("#submit").contains("Delete").click();
+ cy.wait("@deleteFacility").its("response.statusCode").should("eq", 403);
+ }
+
selectLocation(location: string) {
cy.get("span > svg.care-svg-icon__baseline.care-l-map-marker").click();
cy.intercept("https://maps.googleapis.com/maps/api/mapsjs/*").as("mapApi");
@@ -106,6 +142,76 @@ class FacilityPage {
cy.get("input#pac-input").type(location).type("{enter}");
cy.get("div#map-close").click();
}
+
+ fillMiddleWareAddress(url: string) {
+ cy.get("#middleware_address").type(url);
+ }
+
+ clickupdateMiddleWare() {
+ cy.intercept("PATCH", "**/api/v1/facility/**").as("updateMiddleWare");
+ cy.get("button#submit").first().click();
+ cy.wait("@updateMiddleWare").its("response.statusCode").should("eq", 200);
+ }
+
+ verifySuccessNotification(message: string) {
+ cy.verifyNotification(message);
+ }
+
+ visitAlreadyCreatedFacility() {
+ cy.intercept("GET", "**/api/v1/facility/**").as("getFacilities");
+ cy.get("[id='facility-details']").first().click();
+ cy.wait("@getFacilities").its("response.statusCode").should("eq", 200);
+ cy.get("#manage-facility-dropdown button").should("be.visible");
+ cy.get("[id=manage-facility-dropdown]").scrollIntoView().click();
+ }
+
+ clickManageInventory() {
+ cy.contains("Manage Inventory").click();
+ }
+
+ fillInventoryDetails(name: string, status: string, quantity: string) {
+ cy.get("div#id").click();
+ cy.get("div#id ul li").contains(name).click();
+ cy.get("div#isIncoming").click();
+ cy.get("div#isIncoming ul li").contains(status).click();
+ cy.get("[name='quantity']").type(quantity);
+ }
+
+ clickAddInventory() {
+ cy.intercept("POST", "**/api/v1/facility/*/inventory/").as(
+ "createInventory"
+ );
+ cy.get("button").contains("Add/Update Inventory").click();
+ cy.wait("@createInventory").its("response.statusCode").should("eq", 201);
+ }
+
+ fillResourceRequestDetails(
+ name: string,
+ phone_number: string,
+ facility: string,
+ title: string,
+ quantity: string,
+ description: string
+ ) {
+ cy.get("#refering_facility_contact_name").type(name);
+ cy.get("#refering_facility_contact_number").type(phone_number);
+ cy.get("[name='approving_facility']")
+ .type(facility)
+ .then(() => {
+ cy.get("[role='option']").first().click();
+ });
+ cy.get("#title").type(title);
+ cy.get("#requested_quantity").type(quantity);
+ cy.get("#reason").type(description);
+ }
+
+ clickSubmitRequestButton() {
+ cy.intercept("POST", "**/api/v1/resource/").as("createResourceRequest");
+ cy.get("button").contains("Submit").click();
+ cy.wait("@createResourceRequest")
+ .its("response.statusCode")
+ .should("eq", 201);
+ }
}
export default FacilityPage;
diff --git a/cypress/pageobject/Login/LoginPage.ts b/cypress/pageobject/Login/LoginPage.ts
index e75524ad3f4..f691d5f9e15 100644
--- a/cypress/pageobject/Login/LoginPage.ts
+++ b/cypress/pageobject/Login/LoginPage.ts
@@ -1,4 +1,6 @@
// LoginPage.ts
+import { cy } from "local-cypress";
+
class LoginPage {
loginAsDisctrictAdmin(): void {
cy.loginByApi("devdistrictadmin", "Coronasafe@123");
diff --git a/cypress/pageobject/Resource/ResourcePage.ts b/cypress/pageobject/Resource/ResourcePage.ts
new file mode 100644
index 00000000000..1fecf86b9e1
--- /dev/null
+++ b/cypress/pageobject/Resource/ResourcePage.ts
@@ -0,0 +1,83 @@
+// ResoucrePage.ts
+class ResourcePage {
+ verifyDownloadButtonWorks() {
+ cy.get("svg.care-svg-icon__baseline.care-l-export").each(($button) => {
+ cy.intercept(/\/api\/v1\/resource/).as("resource_download");
+ cy.wrap($button).click({ force: true });
+ cy.wait("@resource_download").then((interception) => {
+ expect(interception.response.statusCode).to.equal(200);
+ });
+ });
+ }
+
+ spyResourceApi() {
+ cy.intercept(/\/api\/v1\/resource/).as("resource");
+ }
+
+ clickCompletedResources() {
+ cy.contains("Completed").click();
+ }
+
+ verifyCompletedResources() {
+ cy.wait("@resource").then((interception) => {
+ expect(interception.response.statusCode).to.equal(200);
+ });
+ cy.contains("Active").should("have.class", "text-primary-500");
+ cy.contains("Completed").should("have.class", "text-white");
+ }
+
+ clickActiveResources() {
+ cy.contains("Active").click();
+ }
+
+ verifyActiveResources() {
+ cy.wait("@resource").then((interception) => {
+ expect(interception.response.statusCode).to.equal(200);
+ });
+ cy.contains("Active").should("have.class", "text-white");
+ cy.contains("Completed").should("have.class", "text-primary-500");
+ }
+
+ clickListViewButton() {
+ cy.contains("List View").click();
+ }
+
+ clickBoardViewButton() {
+ cy.contains("Board View").click();
+ }
+
+ openAlreadyCreatedResource() {
+ cy.get("[data-testid='resource-details']").first().click();
+ }
+
+ clickUpdateStatus() {
+ cy.get("[data-testid='update-status']").click();
+ }
+
+ updateStatus(status: string) {
+ cy.get("#status").click();
+ cy.get("[role='option']").contains(status).click();
+ }
+
+ clickSubmitButton() {
+ cy.intercept("PUT", "**/api/v1/resource/**/").as("updateResource");
+ cy.get("#submit").contains("Submit").click();
+ cy.wait("@updateResource").its("response.statusCode").should("eq", 200);
+ }
+
+ verifySuccessNotification(message: string) {
+ cy.verifyNotification(message);
+ }
+
+ addCommentForResource(comment: string) {
+ cy.get("#comment").type(comment);
+ }
+
+ clickPostCommentButton() {
+ cy.intercept("POST", "**/api/v1/resource/*/comment/").as("postComment");
+ cy.contains("Post Your Comment").click();
+ cy.wait("@postComment").its("response.statusCode").should("eq", 201);
+ }
+}
+
+export default ResourcePage;
diff --git a/src/Components/Common/DateInputV2.tsx b/src/Components/Common/DateInputV2.tsx
index ecee0b8a969..bcebd4e0055 100644
--- a/src/Components/Common/DateInputV2.tsx
+++ b/src/Components/Common/DateInputV2.tsx
@@ -284,7 +284,7 @@ const DateInputV2: React.FC = ({
datePickerHeaderDate.getMonth() - 1
)
}
- className="aspect-square inline-flex cursor-pointer items-center justify-center rounded p-2 transition duration-100 ease-in-out hover:bg-gray-300"
+ className="inline-flex aspect-square cursor-pointer items-center justify-center rounded p-2 transition duration-100 ease-in-out hover:bg-gray-300"
onClick={decrement}
>
@@ -317,7 +317,7 @@ const DateInputV2: React.FC = ({
new Date().getFullYear() === year.getFullYear()) ||
!isDateWithinConstraints(getLastDay())
}
- className="aspect-square inline-flex cursor-pointer items-center justify-center rounded p-2 transition duration-100 ease-in-out hover:bg-gray-300"
+ className="inline-flex aspect-square cursor-pointer items-center justify-center rounded p-2 transition duration-100 ease-in-out hover:bg-gray-300"
onClick={increment}
>
diff --git a/src/Components/Facility/FacilityHome.tsx b/src/Components/Facility/FacilityHome.tsx
index ec157d61884..81e7fa4906f 100644
--- a/src/Components/Facility/FacilityHome.tsx
+++ b/src/Components/Facility/FacilityHome.tsx
@@ -565,6 +565,7 @@ export const FacilityHome = (props: any) => {
Location Management
navigate(`/facility/${facilityId}/resource/new`)
}
@@ -593,6 +594,7 @@ export const FacilityHome = (props: any) => {
View Users
setOpenDeleteDialog(true)}
className="flex items-center gap-3"
diff --git a/src/Components/Resource/ListView.tsx b/src/Components/Resource/ListView.tsx
index ab02d31bedd..b368c9bf3ea 100644
--- a/src/Components/Resource/ListView.tsx
+++ b/src/Components/Resource/ListView.tsx
@@ -174,6 +174,7 @@ export default function ListView() {
navigate(`/resource/${resource.external_id}`)}
className="btn btn-default mr-2 w-full bg-white"
>
diff --git a/src/Components/Resource/ResourceBoard.tsx b/src/Components/Resource/ResourceBoard.tsx
index 64a8ef9da35..66bf559be0d 100644
--- a/src/Components/Resource/ResourceBoard.tsx
+++ b/src/Components/Resource/ResourceBoard.tsx
@@ -139,6 +139,7 @@ const ResourceCard = ({ resource }: any) => {
navigate(`/resource/${resource.external_id}`)}
className="btn btn-default mr-2 w-full bg-white"
>
diff --git a/src/Components/Resource/ResourceDetails.tsx b/src/Components/Resource/ResourceDetails.tsx
index 5a98256a605..591f6b48bdb 100644
--- a/src/Components/Resource/ResourceDetails.tsx
+++ b/src/Components/Resource/ResourceDetails.tsx
@@ -271,6 +271,7 @@ export default function ResourceDetails(props: { id: string }) {
{data.title || "--"}
diff --git a/src/index.tsx b/src/index.tsx
index 1cea1c326d9..0c60d9ba2db 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -9,7 +9,7 @@ import * as Sentry from "@sentry/browser";
import "./style/index.css";
import { registerSW } from "virtual:pwa-register";
-if("serviceWorker" in navigator){
+if ("serviceWorker" in navigator) {
registerSW({ immediate: false });
}
From 0c2be8b8c62fb32437d3abf72ceb29d290463a76 Mon Sep 17 00:00:00 2001
From: Rithvik Nishad
Date: Thu, 7 Sep 2023 17:18:27 +0000
Subject: [PATCH 16/20] User (Doctor) Autocomplete for Consultation Verified By
(#6194)
* Consultation: Verified By Doctor as Dropdown
* filter by home_facility instead
* fixes #6213
* fix cypress
* fix cypress
* fix more cypressss
* fix moreeeee
* fix inventory
* fix inventory
---
cypress/e2e/patient_spec/patient_crud.cy.ts | 3 +-
.../pageobject/Facility/FacilityCreation.ts | 3 +-
.../pageobject/Patient/PatientConsultation.ts | 9 ++++-
.../Common/UserAutocompleteFormField.tsx | 13 ++++--
.../Facility/ConsultationDetails.tsx | 7 +++-
src/Components/Facility/ConsultationForm.tsx | 40 ++++++++++++-------
src/Components/Facility/models.tsx | 3 ++
src/Components/Users/models.tsx | 17 ++++----
8 files changed, 61 insertions(+), 34 deletions(-)
diff --git a/cypress/e2e/patient_spec/patient_crud.cy.ts b/cypress/e2e/patient_spec/patient_crud.cy.ts
index af639783a80..b55732fa440 100644
--- a/cypress/e2e/patient_spec/patient_crud.cy.ts
+++ b/cypress/e2e/patient_spec/patient_crud.cy.ts
@@ -118,9 +118,10 @@ describe("Patient Creation with consultation", () => {
"170",
"IP007",
"generalnote",
- "generalnote"
+ "Dev Doctor"
);
patientConsultationPage.submitConsultation();
+
// Below code for the prescription module only present while creating a new consultation
patientConsultationPage.clickAddPrescription();
patientConsultationPage.interceptMediaBase();
diff --git a/cypress/pageobject/Facility/FacilityCreation.ts b/cypress/pageobject/Facility/FacilityCreation.ts
index 84b793b3949..3eac29f14c5 100644
--- a/cypress/pageobject/Facility/FacilityCreation.ts
+++ b/cypress/pageobject/Facility/FacilityCreation.ts
@@ -104,6 +104,7 @@ class FacilityPage {
}
clickManageFacilityDropdown() {
+ cy.get("#manage-facility-dropdown button").scrollIntoView();
cy.get("#manage-facility-dropdown button")
.contains("Manage Facility")
.click();
@@ -118,7 +119,7 @@ class FacilityPage {
}
clickInventoryManagementOption() {
- cy.get("[id=inventory-management]").click();
+ cy.get("#inventory-management").click();
}
clickResourceRequestOption() {
diff --git a/cypress/pageobject/Patient/PatientConsultation.ts b/cypress/pageobject/Patient/PatientConsultation.ts
index 315ef455aaa..c0ba0c260d8 100644
--- a/cypress/pageobject/Patient/PatientConsultation.ts
+++ b/cypress/pageobject/Patient/PatientConsultation.ts
@@ -16,7 +16,7 @@ export class PatientConsultationPage {
}
fillIllnessHistory(history: string) {
- cy.get("#history_of_present_illness").scrollIntoView;
+ cy.get("#history_of_present_illness").scrollIntoView();
cy.get("#history_of_present_illness").should("be.visible");
cy.get("#history_of_present_illness").click().type(history);
}
@@ -52,7 +52,12 @@ export class PatientConsultationPage {
.click();
cy.get("#consultation_notes").click().type(consulationNotes);
- cy.get("#verified_by").click().type(verificationBy);
+ cy.get("#verified_by")
+ .click()
+ .type(verificationBy)
+ .then(() => {
+ cy.get("[role='option']").contains("Dev Doctor").click();
+ });
}
submitConsultation() {
diff --git a/src/Components/Common/UserAutocompleteFormField.tsx b/src/Components/Common/UserAutocompleteFormField.tsx
index 6262db47bc3..ebe6d96bbc5 100644
--- a/src/Components/Common/UserAutocompleteFormField.tsx
+++ b/src/Components/Common/UserAutocompleteFormField.tsx
@@ -8,11 +8,13 @@ import {
} from "../Form/FormFields/Utils";
import { UserModel } from "../Users/models";
import { isUserOnline } from "../../Utils/utils";
+import { UserRole } from "../../Common/constants";
type Props = FormFieldBaseProps & {
placeholder?: string;
facilityId?: string;
- userType?: string;
+ homeFacility?: string;
+ userType?: UserRole;
showActiveStatus?: boolean;
};
@@ -26,6 +28,7 @@ export default function UserAutocompleteFormField(props: Props) {
let search_filter: {
limit: number;
offset: number;
+ home_facility?: string;
user_type?: string;
search_text?: string;
} = { limit: 5, offset: 0 };
@@ -34,6 +37,10 @@ export default function UserAutocompleteFormField(props: Props) {
search_filter = { ...search_filter, user_type: props.userType };
}
+ if (props.homeFacility) {
+ search_filter = { ...search_filter, home_facility: props.homeFacility };
+ }
+
const getStatusIcon = (option: UserModel) => {
if (!props.showActiveStatus) return null;
@@ -69,11 +76,11 @@ export default function UserAutocompleteFormField(props: Props) {
onQuery={(query) =>
fetchOptions(
props.facilityId
- ? getFacilityUsers(props.facilityId)
- : getUserList({
+ ? getFacilityUsers(props.facilityId, {
...search_filter,
search_text: query,
})
+ : getUserList({ ...search_filter, search_text: query })
)
}
isLoading={isLoading}
diff --git a/src/Components/Facility/ConsultationDetails.tsx b/src/Components/Facility/ConsultationDetails.tsx
index 194d6629fc8..401f113a812 100644
--- a/src/Components/Facility/ConsultationDetails.tsx
+++ b/src/Components/Facility/ConsultationDetails.tsx
@@ -469,12 +469,15 @@ export const ConsultationDetails = (props: any) => {
label="Diagnosis (as per ICD-11 recommended by WHO)"
/>
- {consultationData.verified_by && (
+ {(consultationData.verified_by_object ||
+ consultationData.deprecated_verified_by) && (
Verified By:{" "}
- {consultationData.verified_by}
+ {consultationData.verified_by_object
+ ? `${consultationData.verified_by_object.first_name} ${consultationData.verified_by_object.last_name}`
+ : consultationData.deprecated_verified_by}
)}
diff --git a/src/Components/Facility/ConsultationForm.tsx b/src/Components/Facility/ConsultationForm.tsx
index 435529d48a9..fbea6dd8a5a 100644
--- a/src/Components/Facility/ConsultationForm.tsx
+++ b/src/Components/Facility/ConsultationForm.tsx
@@ -40,7 +40,10 @@ import CheckBoxFormField from "../Form/FormFields/CheckBoxFormField";
import DateFormField from "../Form/FormFields/DateFormField";
import { DiagnosisSelectFormField } from "../Common/DiagnosisSelectFormField";
import { FacilitySelect } from "../Common/FacilitySelect";
-import { FieldChangeEventHandler } from "../Form/FormFields/Utils";
+import {
+ FieldChangeEvent,
+ FieldChangeEventHandler,
+} from "../Form/FormFields/Utils";
import { FormAction } from "../Form/Utils";
import PatientCategorySelect from "../Patient/PatientCategorySelect";
import { SelectFormField } from "../Form/FormFields/SelectFormField";
@@ -83,6 +86,7 @@ type FormDetails = {
icd11_provisional_diagnoses_object: ICD11DiagnosisModel[];
icd11_principal_diagnosis?: ICD11DiagnosisModel["id"];
verified_by: string;
+ verified_by_object: UserModel | null;
is_kasp: BooleanStrings;
kasp_enabled_date: null;
examination_details: string;
@@ -128,6 +132,7 @@ const initForm: FormDetails = {
icd11_provisional_diagnoses_object: [],
icd11_principal_diagnosis: undefined,
verified_by: "",
+ verified_by_object: null,
is_kasp: "false",
kasp_enabled_date: null,
examination_details: "",
@@ -329,12 +334,13 @@ export const ConsultationForm = (props: any) => {
?.id ?? "Comfort"
: "Comfort",
patient_no: res.data.patient_no ?? "",
- verified_by: res.data.verified_by ? res.data.verified_by : "",
OPconsultation: res.data.consultation_notes,
is_telemedicine: `${res.data.is_telemedicine}`,
is_kasp: `${res.data.is_kasp}`,
assigned_to: res.data.assigned_to || "",
assigned_to_object: res.data.assigned_to_object,
+ verified_by: res.data.verified_by || "",
+ verified_by_object: res.data.verified_by_object,
ett_tt: res.data.ett_tt ? Number(res.data.ett_tt) : 3,
special_instruction: res.data.special_instruction || "",
weight: res.data.weight ? res.data.weight : "",
@@ -745,7 +751,6 @@ export const ConsultationForm = (props: any) => {
symptoms_onset_date: new Date(),
category: "Critical",
suggestion: "DD",
- verified_by: "Brought Dead",
},
});
} else if (event.name === "suggestion" && event.value === "DD") {
@@ -778,14 +783,14 @@ export const ConsultationForm = (props: any) => {
}
};
- const handleDoctorSelect = (doctor: UserModel | null) => {
- if (doctor?.id) {
+ const handleDoctorSelect = (event: FieldChangeEvent) => {
+ if (event.value?.id) {
dispatch({
type: "set_form",
form: {
...state.form,
- assigned_to: doctor.id.toString(),
- assigned_to_object: doctor,
+ [event.name]: event.value.id.toString(),
+ [`${event.name}_object`]: event.value,
},
});
} else {
@@ -793,8 +798,8 @@ export const ConsultationForm = (props: any) => {
type: "set_form",
form: {
...state.form,
- assigned_to: "",
- assigned_to_object: null,
+ [event.name]: "",
+ [`${event.name}_object`]: null,
},
});
}
@@ -1309,11 +1314,17 @@ export const ConsultationForm = (props: any) => {
className="col-span-6"
ref={fieldRef["verified_by"]}
>
-
@@ -1358,11 +1369,10 @@ export const ConsultationForm = (props: any) => {
value={
state.form.assigned_to_object ?? undefined
}
- onChange={(option) =>
- handleDoctorSelect(option.value)
- }
+ onChange={handleDoctorSelect}
userType={"Doctor"}
name={"assigned_to"}
+ label="Assigned to"
/>
)}
diff --git a/src/Components/Facility/models.tsx b/src/Components/Facility/models.tsx
index 9666f20cfb8..012ca1d68b2 100644
--- a/src/Components/Facility/models.tsx
+++ b/src/Components/Facility/models.tsx
@@ -2,6 +2,7 @@ import { AssignedToObjectModel } from "../Patient/models";
import { ProcedureType } from "../Common/prescription-builder/ProcedureBuilder";
import { NormalPrescription, PRNPrescription } from "../Medicine/models";
import { AssetData } from "../Assets/AssetTypes";
+import { UserBareMinimum } from "../Users/models";
export interface LocalBodyModel {
name: string;
@@ -113,7 +114,9 @@ export interface ConsultationModel {
icd11_diagnoses_object?: ICD11DiagnosisModel[];
icd11_provisional_diagnoses_object?: ICD11DiagnosisModel[];
icd11_principal_diagnosis?: ICD11DiagnosisModel["id"];
+ deprecated_verified_by?: string;
verified_by?: string;
+ verified_by_object?: UserBareMinimum;
suggestion_text?: string;
symptoms?: Array;
symptoms_text?: string;
diff --git a/src/Components/Users/models.tsx b/src/Components/Users/models.tsx
index a59802ab440..ae3229933c5 100644
--- a/src/Components/Users/models.tsx
+++ b/src/Components/Users/models.tsx
@@ -5,13 +5,18 @@ interface HomeFacilityObjectModel {
id?: string;
name?: string;
}
-export type UserModel = {
+
+export type UserBareMinimum = {
id: number;
username: string;
first_name: string;
last_name: string;
email: string;
user_type: UserRole;
+ last_login: string | undefined;
+};
+
+export type UserModel = UserBareMinimum & {
local_body?: number;
district?: number;
state?: number;
@@ -21,7 +26,6 @@ export type UserModel = {
age?: number;
is_superuser?: boolean;
verified?: boolean;
- last_login: string | undefined;
home_facility_object?: HomeFacilityObjectModel;
local_body_object?: LocalBodyModel;
district_object?: DistrictModel;
@@ -42,13 +46,7 @@ export interface SkillModel {
skill_object: SkillObjectModel;
}
-export interface UserAssignedModel {
- id?: number;
- username?: string;
- first_name?: string;
- last_name?: string;
- email?: string;
- user_type?: number | string;
+export interface UserAssignedModel extends UserBareMinimum {
local_body?: number;
district?: number;
state?: number;
@@ -58,7 +56,6 @@ export interface UserAssignedModel {
age?: number;
is_superuser?: boolean;
verified?: boolean;
- last_login?: Date;
home_facility_object?: HomeFacilityObjectModel;
doctor_qualification?: string;
doctor_experience_commenced_on?: Date;
From 4519b08aca6d4e2e6df774789b13d8a3d9d258f4 Mon Sep 17 00:00:00 2001
From: Khavin Shankar
Date: Fri, 8 Sep 2023 07:28:49 +0530
Subject: [PATCH 17/20] Temporarily expose abdm health facility config directly
(#6197)
---
.../ABDM/ConfigureHealthFacility.tsx | 81 ++++++++++++++++++-
.../Facility/UpdateFacilityMiddleware.tsx | 9 +--
src/Redux/actions.tsx | 9 +++
src/Redux/api.tsx | 5 ++
4 files changed, 95 insertions(+), 9 deletions(-)
diff --git a/src/Components/ABDM/ConfigureHealthFacility.tsx b/src/Components/ABDM/ConfigureHealthFacility.tsx
index c0a74ccf106..025a3f0e862 100644
--- a/src/Components/ABDM/ConfigureHealthFacility.tsx
+++ b/src/Components/ABDM/ConfigureHealthFacility.tsx
@@ -6,6 +6,7 @@ import * as Notification from "../../Utils/Notifications.js";
import { navigate } from "raviger";
import { Cancel, Submit } from "../Common/components/ButtonV2";
import TextFormField from "../Form/FormFields/TextFormField";
+import { classNames } from "../../Utils/utils";
const Loading = lazy(() => import("../Common/Loading"));
const initForm = {
@@ -47,7 +48,7 @@ export const ConfigureHealthFacility = (props: any) => {
setIsLoading(true);
const res = await dispatchAction(healthFacilityActions.read(facilityId));
- if (res.status === 200 && res?.data) {
+ if (res?.status === 200 && res?.data) {
const formData = {
...state.form,
hf_id: res.data.hf_id,
@@ -84,6 +85,32 @@ export const ConfigureHealthFacility = (props: any) => {
hf_id: state.form.hf_id,
})
);
+ } else if (state.form.hf_id === state.form.health_facility?.hf_id) {
+ res = await dispatchAction(
+ healthFacilityActions.registerService(facilityId)
+ );
+
+ if (res?.status === 200 && res?.data) {
+ if (res.data?.registered) {
+ dispatch({
+ type: "set_form",
+ form: {
+ ...state.form,
+ health_facility: {
+ ...state.form?.health_facility,
+ registered: res.data.registered,
+ },
+ },
+ });
+
+ return;
+ }
+ }
+
+ Notification.Error({
+ msg: "Service registration failed, please try again later",
+ });
+ return;
} else {
res = await dispatchAction(
healthFacilityActions.create({
@@ -127,6 +154,49 @@ export const ConfigureHealthFacility = (props: any) => {
+ {state.form.health_facility?.registered ? (
+ <>
+
+
+ The ABDM health facility is successfully linked with
+ care{" "}
+ and registered as a service in bridge
+
+
+ No Action Required.
+
+
+ Registered
+ >
+ ) : (
+ <>
+
+
+ The ABDM health facility is successfully linked with
+ care{" "}
+
+ but not registered as a service in bridge
+
+
+
+ Click on Link Health Facility to
+ register the service
+
+
+ Not Registered
+ >
+ )}
+
+ }
required
value={state.form.hf_id}
onChange={(e) => handleChange(e)}
@@ -136,7 +206,14 @@ export const ConfigureHealthFacility = (props: any) => {
navigate(`/facility/${facilityId}`)} />
-
+
diff --git a/src/Components/Facility/UpdateFacilityMiddleware.tsx b/src/Components/Facility/UpdateFacilityMiddleware.tsx
index 4fd5a4f24b0..211d8cf458a 100644
--- a/src/Components/Facility/UpdateFacilityMiddleware.tsx
+++ b/src/Components/Facility/UpdateFacilityMiddleware.tsx
@@ -11,7 +11,6 @@ import { navigate } from "raviger";
import { Cancel, Submit } from "../Common/components/ButtonV2";
import TextFormField from "../Form/FormFields/TextFormField";
import Page from "../Common/components/Page";
-import useConfig from "../../Common/hooks/useConfig";
import { ConfigureHealthFacility } from "../ABDM/ConfigureHealthFacility";
const Loading = lazy(() => import("../Common/Loading"));
@@ -52,7 +51,6 @@ export const UpdateFacilityMiddleware = (props: any) => {
const { facilityId } = props;
const dispatchAction: any = useDispatch();
const [isLoading, setIsLoading] = useState(false);
- const config = useConfig();
const fetchData = useCallback(
async (status: statusType) => {
@@ -169,11 +167,8 @@ export const UpdateFacilityMiddleware = (props: any) => {
- {config.enable_abdm ? (
-
- ) : (
- <>>
- )}
+
+
);
};
diff --git a/src/Redux/actions.tsx b/src/Redux/actions.tsx
index e3212685d2f..6e0d91fc59d 100644
--- a/src/Redux/actions.tsx
+++ b/src/Redux/actions.tsx
@@ -979,6 +979,15 @@ export const healthFacilityActions = {
facility_id: id,
});
},
+
+ registerService: (id: string) => {
+ return fireRequest(
+ "registerHealthFacilityAsService",
+ [],
+ {},
+ { facility_id: id }
+ );
+ },
};
export const listAssetAvailability = (params: object) =>
diff --git a/src/Redux/api.tsx b/src/Redux/api.tsx
index 3efff35689e..393b9372ca5 100644
--- a/src/Redux/api.tsx
+++ b/src/Redux/api.tsx
@@ -931,6 +931,11 @@ const routes: Routes = {
method: "PATCH",
},
+ registerHealthFacilityAsService: {
+ path: "/api/v1/abdm/health_facility/{facility_id}/register_service/",
+ method: "POST",
+ },
+
// Asset Availability endpoints
listAssetAvailability: {
From 8bcf91dce41cb8c20d7b2b674550dcb73a0ca746 Mon Sep 17 00:00:00 2001
From: Rithvik Nishad
Date: Fri, 8 Sep 2023 06:22:14 +0000
Subject: [PATCH 18/20] cypress: fix inventory management (#6245)
* fix cypress :/
* Update cypress/pageobject/Facility/FacilityCreation.ts
* fix double click
---------
Co-authored-by: Mohammed Nihal <57055998+nihal467@users.noreply.github.com>
---
cypress/pageobject/Facility/FacilityCreation.ts | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/cypress/pageobject/Facility/FacilityCreation.ts b/cypress/pageobject/Facility/FacilityCreation.ts
index 3eac29f14c5..aa46d4f1105 100644
--- a/cypress/pageobject/Facility/FacilityCreation.ts
+++ b/cypress/pageobject/Facility/FacilityCreation.ts
@@ -119,6 +119,7 @@ class FacilityPage {
}
clickInventoryManagementOption() {
+ cy.get("#inventory-management", { timeout: 10000 }).should("be.visible");
cy.get("#inventory-management").click();
}
@@ -162,8 +163,6 @@ class FacilityPage {
cy.intercept("GET", "**/api/v1/facility/**").as("getFacilities");
cy.get("[id='facility-details']").first().click();
cy.wait("@getFacilities").its("response.statusCode").should("eq", 200);
- cy.get("#manage-facility-dropdown button").should("be.visible");
- cy.get("[id=manage-facility-dropdown]").scrollIntoView().click();
}
clickManageInventory() {
From 9b45c5e9a496c54111e07232f1015c68ebb6205b Mon Sep 17 00:00:00 2001
From: Ashesh <3626859+Ashesh3@users.noreply.github.com>
Date: Fri, 8 Sep 2023 19:24:23 +0530
Subject: [PATCH 19/20] Fix verified_by and Principal Diagnosis validation
(#6247)
* Fix verified_by and Principal Diagnosis validation
* Apply suggestions from code review
Co-authored-by: Rithvik Nishad
---
src/Components/Facility/ConsultationForm.tsx | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/Components/Facility/ConsultationForm.tsx b/src/Components/Facility/ConsultationForm.tsx
index fbea6dd8a5a..97f35f292f8 100644
--- a/src/Components/Facility/ConsultationForm.tsx
+++ b/src/Components/Facility/ConsultationForm.tsx
@@ -538,7 +538,7 @@ export const ConsultationForm = (props: any) => {
}
case "verified_by": {
- if (!state.form[field].replace(/\s/g, "").length) {
+ if (!state.form[field]) {
errors[field] = "Please fill verified by";
invalidForm = true;
break;
@@ -570,6 +570,7 @@ export const ConsultationForm = (props: any) => {
if (
state.form[field] &&
state.form["icd11_diagnoses_object"].length &&
+ !state.form["icd11_provisional_diagnoses_object"] &&
!state.form["icd11_diagnoses_object"]
.map((d) => d.id)
.includes(state.form[field]!)
@@ -583,6 +584,7 @@ export const ConsultationForm = (props: any) => {
if (
state.form[field] &&
state.form["icd11_provisional_diagnoses_object"].length &&
+ !state.form["icd11_diagnoses_object"] &&
!state.form["icd11_provisional_diagnoses_object"]
.map((d) => d.id)
.includes(state.form[field]!)
From fb4e7bed464b858e5a127b9701c5caa1660a8447 Mon Sep 17 00:00:00 2001
From: Rithvik Nishad
Date: Fri, 8 Sep 2023 15:28:47 +0000
Subject: [PATCH 20/20] Consultation Form: skip validation for `verified_by` if
`suggestion` is Declare Death and fix discharge not working on create
consultation (#6248)
* fix verified by validation
* fix decalre dead
---
src/Components/Facility/ConsultationForm.tsx | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/Components/Facility/ConsultationForm.tsx b/src/Components/Facility/ConsultationForm.tsx
index 97f35f292f8..49028a62953 100644
--- a/src/Components/Facility/ConsultationForm.tsx
+++ b/src/Components/Facility/ConsultationForm.tsx
@@ -538,7 +538,7 @@ export const ConsultationForm = (props: any) => {
}
case "verified_by": {
- if (!state.form[field]) {
+ if (state.form.suggestion !== "DD" && !state.form[field]) {
errors[field] = "Please fill verified by";
invalidForm = true;
break;
@@ -618,6 +618,7 @@ export const ConsultationForm = (props: any) => {
};
const declareThePatientDead = async (
+ id: string,
cause_of_death: string,
death_datetime: string,
death_confirmed_doctor: string
@@ -629,6 +630,7 @@ export const ConsultationForm = (props: any) => {
discharge_notes: cause_of_death,
death_datetime: death_datetime,
death_confirmed_doctor: death_confirmed_doctor,
+ discharge_date: dayjs().toISOString(),
},
{ id }
)
@@ -714,6 +716,7 @@ export const ConsultationForm = (props: any) => {
if (data.suggestion === "DD") {
await declareThePatientDead(
+ res.data.id,
state.form.cause_of_death,
state.form.death_datetime,
state.form.death_confirmed_doctor