diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000000..2125666142e --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text=auto \ No newline at end of file diff --git a/cypress.config.ts b/cypress.config.ts index b6e8fadd462..4da5d989a88 100644 --- a/cypress.config.ts +++ b/cypress.config.ts @@ -1,7 +1,10 @@ import { defineConfig } from "cypress"; import cypressSplit from "cypress-split"; +import * as dotenv from "dotenv"; import fs from "fs"; +dotenv.config(); + export default defineConfig({ projectId: "wf7d2m", defaultCommandTimeout: 10000, @@ -32,7 +35,7 @@ export default defineConfig({ requestTimeout: 15000, }, env: { - API_URL: process.env.REACT_CARE_API_URL ?? "http://localhost:9000", + API_URL: process.env.REACT_CARE_API_URL, ENABLE_HCX: process.env.REACT_ENABLE_HCX ?? false, }, }); diff --git a/cypress/e2e/assets_spec/AssetHomepage.cy.ts b/cypress/e2e/assets_spec/AssetHomepage.cy.ts index 67ad50e832f..dfb3249c243 100644 --- a/cypress/e2e/assets_spec/AssetHomepage.cy.ts +++ b/cypress/e2e/assets_spec/AssetHomepage.cy.ts @@ -1,9 +1,9 @@ import { advanceFilters } from "pageobject/utils/advanceFilterHelpers"; +import { pageNavigation } from "pageobject/utils/paginationHelpers"; import { v4 as uuidv4 } from "uuid"; import { AssetPage } from "../../pageobject/Asset/AssetCreation"; import { AssetFilters } from "../../pageobject/Asset/AssetFilters"; -import { AssetPagination } from "../../pageobject/Asset/AssetPagination"; import { AssetQRScanPage } from "../../pageobject/Asset/AssetQRScan"; import { AssetSearchPage } from "../../pageobject/Asset/AssetSearch"; import LoginPage from "../../pageobject/Login/LoginPage"; @@ -11,7 +11,6 @@ import LoginPage from "../../pageobject/Login/LoginPage"; describe("Asset Tab", () => { const assetSearchPage = new AssetSearchPage(); const assetQRScanPage = new AssetQRScanPage(); - const assetPagination = new AssetPagination(); const assetFilters = new AssetFilters(); const assetPage = new AssetPage(); const loginPage = new LoginPage(); @@ -79,10 +78,10 @@ describe("Asset Tab", () => { // Verify the pagination in the page it("Next/Previous Page", () => { - assetPagination.navigateToNextPage(); - assetPagination.verifyNextUrl(); - assetPagination.navigateToPreviousPage(); - assetPagination.verifyPreviousUrl(); + pageNavigation.navigateToNextPage(); + pageNavigation.verifyCurrentPageNumber(2); + pageNavigation.navigateToPreviousPage(); + pageNavigation.verifyCurrentPageNumber(1); }); it("Import new asset", () => { diff --git a/cypress/e2e/facility_spec/FacilityHomepage.cy.ts b/cypress/e2e/facility_spec/FacilityHomepage.cy.ts index 2c5699ec76c..f4c7aaa90a0 100644 --- a/cypress/e2e/facility_spec/FacilityHomepage.cy.ts +++ b/cypress/e2e/facility_spec/FacilityHomepage.cy.ts @@ -1,5 +1,6 @@ // FacilityCreation -import { AssetPagination } from "../../pageobject/Asset/AssetPagination"; +import { pageNavigation } from "pageobject/utils/paginationHelpers"; + import FacilityPage from "../../pageobject/Facility/FacilityCreation"; import FacilityHome from "../../pageobject/Facility/FacilityHome"; import FacilityNotify from "../../pageobject/Facility/FacilityNotify"; @@ -15,7 +16,6 @@ describe("Facility Homepage Function", () => { const facilityPage = new FacilityPage(); const manageUserPage = new ManageUserPage(); const userPage = new UserPage(); - const assetPagination = new AssetPagination(); const facilitiesAlias = "downloadFacilitiesCSV"; const doctorsAlias = "downloadDoctorsCSV"; const triagesAlias = "downloadTriagesCSV"; @@ -83,10 +83,10 @@ 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(); + pageNavigation.navigateToNextPage(); + pageNavigation.verifyCurrentPageNumber(2); + pageNavigation.navigateToPreviousPage(); + pageNavigation.verifyCurrentPageNumber(1); // search for a facility manageUserPage.typeFacilitySearch(facilityName); facilityPage.verifyFacilityBadgeContent(facilityName); diff --git a/cypress/e2e/facility_spec/FacilityLocation.cy.ts b/cypress/e2e/facility_spec/FacilityLocation.cy.ts index 7d0c626a93b..9ac85e9ba4c 100644 --- a/cypress/e2e/facility_spec/FacilityLocation.cy.ts +++ b/cypress/e2e/facility_spec/FacilityLocation.cy.ts @@ -1,7 +1,7 @@ +import { pageNavigation } from "pageobject/utils/paginationHelpers"; import { v4 as uuidv4 } from "uuid"; import { AssetPage } from "../../pageobject/Asset/AssetCreation"; -import { AssetPagination } from "../../pageobject/Asset/AssetPagination"; import FacilityPage from "../../pageobject/Facility/FacilityCreation"; import FacilityHome from "../../pageobject/Facility/FacilityHome"; import FacilityLocation from "../../pageobject/Facility/FacilityLocation"; @@ -12,7 +12,6 @@ describe("Location Management Section", () => { const userCreationPage = new UserCreationPage(); const facilityPage = new FacilityPage(); const facilityLocation = new FacilityLocation(); - const assetPagination = new AssetPagination(); const facilityHome = new FacilityHome(); const EXPECTED_LOCATION_ERROR_MESSAGES = [ @@ -172,8 +171,8 @@ describe("Location Management Section", () => { facilityLocation.setMultipleBeds(numberOfModifiedBeds); assetPage.clickassetupdatebutton(); // pagination - assetPagination.navigateToNextPage(); - assetPagination.navigateToPreviousPage(); + pageNavigation.navigateToNextPage(); + pageNavigation.navigateToPreviousPage(); facilityLocation.closeNotification(); }); diff --git a/cypress/e2e/hcx_spec/HcxClaims.cy.ts b/cypress/e2e/hcx_spec/HcxClaims.cy.ts index 869afd6fcbb..b698bb7ffd8 100644 --- a/cypress/e2e/hcx_spec/HcxClaims.cy.ts +++ b/cypress/e2e/hcx_spec/HcxClaims.cy.ts @@ -11,7 +11,7 @@ describe("HCX Claims configuration and approval workflow", () => { const patientConsultationPage = new PatientConsultationPage(); const patientInsurance = new PatientInsurance(); const hcxClaims = new HcxClaims(); - const hcxPatientName = "Dummy Patient 14"; + const hcxPatientName = "Dummy Patient Thirteen"; const firstInsuranceIdentifier = "insurance-details-0"; const patientMemberId = "001"; const patientPolicyId = "100"; diff --git a/cypress/e2e/patient_spec/PatientBedManagement.cy.ts b/cypress/e2e/patient_spec/PatientBedManagement.cy.ts index 65adf131c87..94f0869db9b 100644 --- a/cypress/e2e/patient_spec/PatientBedManagement.cy.ts +++ b/cypress/e2e/patient_spec/PatientBedManagement.cy.ts @@ -11,8 +11,8 @@ describe("Patient swtich bed functionality", () => { const switchBedOne = "Dummy Bed 4"; const switchBedTwo = "Dummy Bed 1"; const switchBedThree = "Dummy Bed 7"; - const switchPatientOne = "Dummy Patient 6"; - const switchPatientTwo = "Dummy Patient 7"; + const switchPatientOne = "Dummy Patient Six"; + const switchPatientTwo = "Dummy Patient Seven"; before(() => { loginPage.loginAsDistrictAdmin(); diff --git a/cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts b/cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts index bd6e7c0d967..3eacd9b718f 100644 --- a/cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts +++ b/cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts @@ -375,7 +375,7 @@ describe("Patient Consultation in multiple combination", () => { }); it("Edit created consultation to existing patient", () => { - patientPage.visitPatient("Dummy Patient 13"); + patientPage.visitPatient("Dummy Patient Thirteen"); patientConsultationPage.clickEditConsultationButton(); patientConsultationPage.typePatientIllnessHistory("editted"); patientConsultationPage.selectPatientDiagnosis( diff --git a/cypress/e2e/patient_spec/PatientConsultationDischarge.cy.ts b/cypress/e2e/patient_spec/PatientConsultationDischarge.cy.ts index 6a3d2863818..9e234c860da 100644 --- a/cypress/e2e/patient_spec/PatientConsultationDischarge.cy.ts +++ b/cypress/e2e/patient_spec/PatientConsultationDischarge.cy.ts @@ -31,7 +31,7 @@ describe("Patient Discharge based on multiple reason", () => { }); it("Discharge a LAMA patient in the consultation", () => { - patientPage.visitPatient("Dummy Patient 12"); + patientPage.visitPatient("Discharge Patient One"); patientDischarge.clickDischarge(); patientDischarge.selectDischargeReason(patientDischargeReason4); cy.clickSubmitButton("Confirm Discharge"); @@ -47,7 +47,7 @@ describe("Patient Discharge based on multiple reason", () => { }); it("Discharge a expired patient in the consultation", () => { - patientPage.visitPatient("Dummy Patient 13"); + patientPage.visitPatient("Discharge Patient Two"); patientDischarge.clickDischarge(); patientDischarge.selectDischargeReason(patientDischargeReason3); patientDischarge.typeDischargeNote(patientDeathCause); @@ -67,7 +67,7 @@ describe("Patient Discharge based on multiple reason", () => { }); it("Discharge patient with referred reason to a facility", () => { - patientPage.visitPatient("Dummy Patient 16"); + patientPage.visitPatient("Discharge Patient Three"); patientDischarge.clickDischarge(); patientDischarge.selectDischargeReason(patientDischargeReason2); patientDischarge.typeDischargeNote(patientDischargeAdvice); @@ -93,7 +93,7 @@ describe("Patient Discharge based on multiple reason", () => { }); it("Discharge a recovered patient with all relevant fields", () => { - patientPage.visitPatient("Dummy Patient 15"); + patientPage.visitPatient("Discharge Patient Four"); patientDischarge.clickDischarge(); patientDischarge.selectDischargeReason(patientDischargeReason1); patientDischarge.typeDischargeNote(patientDischargeAdvice); diff --git a/cypress/e2e/patient_spec/PatientDoctorConnect.cy.ts b/cypress/e2e/patient_spec/PatientDoctorConnect.cy.ts index dd626f619ce..474af286b21 100644 --- a/cypress/e2e/patient_spec/PatientDoctorConnect.cy.ts +++ b/cypress/e2e/patient_spec/PatientDoctorConnect.cy.ts @@ -7,10 +7,10 @@ describe("Patient Doctor Connect in consultation page", () => { const loginPage = new LoginPage(); const patientPage = new PatientPage(); const doctorconnect = new DoctorConnect(); - const patientName = "Dummy Patient 11"; + const patientName = "Dummy Patient Eleven"; const doctorUser = "Dev Doctor"; const nurseUser = "Dev Staff"; - const teleIcuUser = "Dev Doctor Two"; + const teleIcuUser = "Tester Doctor"; before(() => { loginPage.loginAsDistrictAdmin(); diff --git a/cypress/e2e/patient_spec/PatientDoctorNotes.cy.ts b/cypress/e2e/patient_spec/PatientDoctorNotes.cy.ts index e35d3eb8961..d227d68ddcb 100644 --- a/cypress/e2e/patient_spec/PatientDoctorNotes.cy.ts +++ b/cypress/e2e/patient_spec/PatientDoctorNotes.cy.ts @@ -6,7 +6,7 @@ describe("Patient Discussion notes in the consultation page", () => { const loginPage = new LoginPage(); const patientPage = new PatientPage(); const patientDoctorNotes = new PatientDoctorNotes(); - const patientName = "Dummy Patient 4"; + const patientName = "Dummy Patient Four"; const patientNurseNote = "Test nurse Notes"; const patientNurseReplyNote = "Test nurse reply Notes"; const discussionNotesSubscribeWarning = diff --git a/cypress/e2e/patient_spec/PatientFileUpload.ts b/cypress/e2e/patient_spec/PatientFileUpload.cy.ts similarity index 96% rename from cypress/e2e/patient_spec/PatientFileUpload.ts rename to cypress/e2e/patient_spec/PatientFileUpload.cy.ts index 110631551a1..dd3098163ec 100644 --- a/cypress/e2e/patient_spec/PatientFileUpload.ts +++ b/cypress/e2e/patient_spec/PatientFileUpload.cy.ts @@ -14,9 +14,9 @@ function runTests( const cypressAudioName = "cypress audio"; const cypressFileName = "cypress name"; const newFileName = "cypress modified name"; - const patientNameOne = "Dummy Patient 3"; - const patientNameTwo = "Dummy Patient 4"; - const patientNameThree = "Dummy Patient 5"; + const patientNameOne = "Dummy Patient Three"; + const patientNameTwo = "Dummy Patient Four"; + const patientNameThree = "Dummy Patient Five"; before(() => { loginPage.loginAsDistrictAdmin(); cy.saveLocalStorage(); diff --git a/cypress/e2e/patient_spec/PatientHomepage.cy.ts b/cypress/e2e/patient_spec/PatientHomepage.cy.ts index e4e0f927952..e2c32098f1c 100644 --- a/cypress/e2e/patient_spec/PatientHomepage.cy.ts +++ b/cypress/e2e/patient_spec/PatientHomepage.cy.ts @@ -1,4 +1,5 @@ import { advanceFilters } from "pageobject/utils/advanceFilterHelpers"; +import { pageNavigation } from "pageobject/utils/paginationHelpers"; import LoginPage from "../../pageobject/Login/LoginPage"; import PatientHome from "../../pageobject/Patient/PatientHome"; @@ -163,15 +164,15 @@ describe("Patient Homepage present functionalities", () => { .invoke("text") .then((patientOne: string) => { firstPatientPageOne = patientOne.trim(); - patientHome.clickNextPage(); - patientHome.verifySecondPageUrl(); + pageNavigation.navigateToNextPage(); + pageNavigation.verifyCurrentPageNumber(2); cy.get('[data-cy="patient"]') .first() .invoke("text") .then((patientTwo: string) => { const firstPatientPageTwo = patientTwo.trim(); expect(firstPatientPageOne).not.to.eq(firstPatientPageTwo); - patientHome.clickPreviousPage(); + pageNavigation.navigateToPreviousPage(); }); }); }); diff --git a/cypress/e2e/patient_spec/PatientInvestigation.cy.ts b/cypress/e2e/patient_spec/PatientInvestigation.cy.ts index 262759bd360..350614d0c9a 100644 --- a/cypress/e2e/patient_spec/PatientInvestigation.cy.ts +++ b/cypress/e2e/patient_spec/PatientInvestigation.cy.ts @@ -7,7 +7,7 @@ describe("Patient Investigation Creation from Patient consultation page", () => const loginPage = new LoginPage(); const patientPage = new PatientPage(); const patientInvestigation = new PatientInvestigation(); - const patientName = "Dummy Patient 14"; + const patientName = "Dummy Patient Thirteen"; before(() => { loginPage.loginAsDistrictAdmin(); diff --git a/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts b/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts index 05958bdf3f0..cfb739c8343 100644 --- a/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts +++ b/cypress/e2e/patient_spec/PatientLogUpdate.cy.ts @@ -32,13 +32,13 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { const patientInsulinDosage = "56"; const patientFluidBalance = "500"; const patientNetBalance = "1000"; - const patientOne = "Dummy Patient 9"; + const patientOne = "Dummy Patient Nine"; const bedOne = "Dummy Bed 5"; - const patientTwo = "Dummy Patient 10"; + const patientTwo = "Dummy Patient Ten"; const bedTwo = "Dummy Bed 2"; - const patientThree = "Dummy Patient 8"; + const patientThree = "Dummy Patient Eight"; const bedThree = "Dummy Bed 3"; - const domicilaryPatient = "Dummy Patient 11"; + const domicilaryPatient = "Dummy Patient Eleven"; before(() => { loginPage.loginAsDistrictAdmin(); diff --git a/cypress/e2e/patient_spec/PatientPrescription.cy.ts b/cypress/e2e/patient_spec/PatientPrescription.cy.ts index 1011c2f4f4d..96e6e23b1aa 100644 --- a/cypress/e2e/patient_spec/PatientPrescription.cy.ts +++ b/cypress/e2e/patient_spec/PatientPrescription.cy.ts @@ -26,7 +26,7 @@ describe("Patient Medicine Administration", () => { }); it("Add a new medicine | Verify the Edit and Discontinue Medicine workflow |", () => { - patientPage.visitPatient("Dummy Patient 9"); + patientPage.visitPatient("Dummy Patient Nine"); patientPrescription.visitMedicineTab(); patientPrescription.visitEditPrescription(); // Add a normal Medicine to the patient @@ -63,7 +63,7 @@ describe("Patient Medicine Administration", () => { }); it("Add a PRN Prescription medicine | Group Administrate it |", () => { - patientPage.visitPatient("Dummy Patient 6"); + patientPage.visitPatient("Dummy Patient Six"); patientPrescription.visitMedicineTab(); patientPrescription.visitEditPrescription(); // Add First Medicine @@ -97,7 +97,7 @@ describe("Patient Medicine Administration", () => { }); it("Add a new titrated medicine for a patient | Individual Administeration |", () => { - patientPage.visitPatient("Dummy Patient 5"); + patientPage.visitPatient("Dummy Patient Five"); patientPrescription.visitMedicineTab(); patientPrescription.visitEditPrescription(); patientPrescription.clickAddPrescription(); @@ -136,7 +136,7 @@ describe("Patient Medicine Administration", () => { }); it("Add a new medicine for a patient and verify the duplicate medicine validation", () => { - patientPage.visitPatient("Dummy Patient 4"); + patientPage.visitPatient("Dummy Patient Four"); patientPrescription.visitMedicineTab(); patientPrescription.visitEditPrescription(); patientPrescription.clickAddPrescription(); diff --git a/cypress/e2e/patient_spec/PatientRegistration.cy.ts b/cypress/e2e/patient_spec/PatientRegistration.cy.ts index 91810ffd273..2da35c840e0 100644 --- a/cypress/e2e/patient_spec/PatientRegistration.cy.ts +++ b/cypress/e2e/patient_spec/PatientRegistration.cy.ts @@ -40,10 +40,12 @@ describe("Patient Creation with consultation", () => { const patientDateOfBirth = "01012001"; const patientMenstruationStartDate = getRelativeDateString(-10); const patientDateOfDelivery = getRelativeDateString(-20); - const patientOneName = "Patient With No Consultation"; + const patientOneName = "Great Napolean 14"; const patientOneGender = "Male"; const patientOneUpdatedGender = "Female"; - const patientOneAddress = "Test Patient Address"; + const patientOneAddress = `149/J, 3rd Block, + Aluva + Ernakulam, Kerala - 682001`; const patientOnePincode = "682001"; const patientOneState = "Kerala"; const patientOneDistrict = "Ernakulam"; @@ -64,7 +66,7 @@ describe("Patient Creation with consultation", () => { const patientOneSecondInsurerName = "Care Payor"; const patientTransferPhoneNumber = "9849511866"; const patientTransferFacility = "Dummy Shifting Center"; - const patientTransferName = "Dummy Patient 10"; + const patientTransferName = "Dummy Patient Twelve"; const patientOccupation = "Student"; before(() => { @@ -130,6 +132,7 @@ describe("Patient Creation with consultation", () => { "Middle Class", "Family member", ); + patientMedicalHistory.verifyPatientMedicalDetails( patientOnePresentHealth, patientOneOngoingMedication, @@ -214,11 +217,9 @@ describe("Patient Creation with consultation", () => { patientMedicalHistory.verifyNoSymptosPresent("Diabetes"); // verify insurance details and dedicatd page cy.get("[data-testid=patient-details]") - .contains("member id") + .contains("Member ID") .scrollIntoView(); cy.wait(2000); - patientInsurance.clickPatientInsuranceViewDetail(); - cy.wait(3000); patientInsurance.verifyPatientPolicyDetails( patientOneFirstSubscriberId, patientOneFirstPolicyId, @@ -243,7 +244,7 @@ describe("Patient Creation with consultation", () => { patientTransfer.clickTransferPatientYOB(yearOfBirth); patientTransfer.clickTransferSubmitButton(); cy.verifyNotification( - "Patient Dummy Patient 10 (Male) transferred successfully", + `Patient ${patientTransferName} (Male) transferred successfully`, ); patientTransfer.clickConsultationCancelButton(); // allow the transfer button of a patient diff --git a/cypress/e2e/sample_test_spec/SampleTestRequest.cy.ts b/cypress/e2e/sample_test_spec/SampleTestRequest.cy.ts index a0f30ebd6db..da4d8aabd20 100644 --- a/cypress/e2e/sample_test_spec/SampleTestRequest.cy.ts +++ b/cypress/e2e/sample_test_spec/SampleTestRequest.cy.ts @@ -8,7 +8,7 @@ describe("Sample Test", () => { const patientPage = new PatientPage(); const loginPage = new LoginPage(); const patientConsultationPage = new PatientConsultationPage(); - const patientName = "Dummy Patient 11"; + const patientName = "Dummy Patient Eleven"; const sampleTestType = "BA/ETA"; const icmrCategory = "Cat 0"; const icmrLabel = "Test Icmr Label"; diff --git a/cypress/e2e/users_spec/UsersHomepage.cy.ts b/cypress/e2e/users_spec/UsersHomepage.cy.ts index d5825f58f20..b32bb859e4e 100644 --- a/cypress/e2e/users_spec/UsersHomepage.cy.ts +++ b/cypress/e2e/users_spec/UsersHomepage.cy.ts @@ -1,4 +1,5 @@ import { advanceFilters } from "pageobject/utils/advanceFilterHelpers"; +import { pageNavigation } from "pageobject/utils/paginationHelpers"; import LoginPage from "../../pageobject/Login/LoginPage"; import { UserPage } from "../../pageobject/Users/UserSearch"; @@ -16,7 +17,7 @@ describe("User Homepage", () => { const altPhoneNumber = "8878825662"; const homeFacility = "Dummy Facility 40"; const nurseUserName = "dummynurse1"; - const doctorUserName = "devdoctor1"; + const doctorUserName = "dev-doctor2"; before(() => { loginPage.loginAsDistrictAdmin(); @@ -84,10 +85,10 @@ describe("User Homepage", () => { }); it("Next/Previous Page Navigation", () => { - userPage.navigateToNextPage(); - userPage.verifyCurrentPageNumber(2); - userPage.navigateToPreviousPage(); - userPage.verifyCurrentPageNumber(1); + pageNavigation.navigateToNextPage(); + pageNavigation.verifyCurrentPageNumber(2); + pageNavigation.navigateToPreviousPage(); + pageNavigation.verifyCurrentPageNumber(1); }); afterEach(() => { diff --git a/cypress/pageobject/Asset/AssetPagination.ts b/cypress/pageobject/Asset/AssetPagination.ts index f2a4103b065..e69de29bb2d 100644 --- a/cypress/pageobject/Asset/AssetPagination.ts +++ b/cypress/pageobject/Asset/AssetPagination.ts @@ -1,19 +0,0 @@ -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/cypress/pageobject/Patient/PatientConsultation.ts b/cypress/pageobject/Patient/PatientConsultation.ts index c8046a39a9e..edd8ae135a4 100644 --- a/cypress/pageobject/Patient/PatientConsultation.ts +++ b/cypress/pageobject/Patient/PatientConsultation.ts @@ -122,9 +122,10 @@ export class PatientConsultationPage { } clickViewConsultationButton() { + cy.get("a").contains("Encounters").click(); cy.verifyAndClickElement( "#view_consultation_and_log_updates", - "View Consultation / Log Updates", + "View Updates", ); } diff --git a/cypress/pageobject/Patient/PatientCreation.ts b/cypress/pageobject/Patient/PatientCreation.ts index a38b8ab6a5c..1f915f5474e 100644 --- a/cypress/pageobject/Patient/PatientCreation.ts +++ b/cypress/pageobject/Patient/PatientCreation.ts @@ -181,7 +181,7 @@ export class PatientPage { expect($dashboard).to.contain(patientName); expect($dashboard).to.contain(phoneNumber); expect($dashboard).to.contain(emergencyPhoneNumber); - expect($dashboard).to.contain(yearOfBirth); + //expect($dashboard).to.contain(yearOfBirth); //Commented out because new proposed UI does not have DOB. Can change later. expect($dashboard).to.contain(bloodGroup); expect($dashboard).to.contain(occupation); socioeconomicStatus && expect($dashboard).to.contain(socioeconomicStatus); @@ -221,7 +221,7 @@ export class PatientPage { } clickPatientUpdateDetails() { - cy.verifyAndClickElement("#update-patient-details", "Update Details"); + cy.verifyAndClickElement("#update-patient-details", "Edit Profile"); } interceptFacilities() { diff --git a/cypress/pageobject/Patient/PatientFileupload.ts b/cypress/pageobject/Patient/PatientFileupload.ts index 6cde7d78568..c70170a744d 100644 --- a/cypress/pageobject/Patient/PatientFileupload.ts +++ b/cypress/pageobject/Patient/PatientFileupload.ts @@ -20,7 +20,9 @@ export class PatientFileUpload { recordAudio() { cy.get("#record-audio").click(); - cy.wait(5000); + cy.wait(2000); + cy.get("#start-recording").click(); + cy.wait(2000); cy.get("#stop-recording").click(); cy.wait(1000); cy.get("#save-recording").click(); diff --git a/cypress/pageobject/Patient/PatientHome.ts b/cypress/pageobject/Patient/PatientHome.ts index bc27977d561..36cad15f0e5 100644 --- a/cypress/pageobject/Patient/PatientHome.ts +++ b/cypress/pageobject/Patient/PatientHome.ts @@ -1,16 +1,4 @@ class PatientHome { - clickNextPage() { - cy.get("#next-pages").click(); - } - - verifySecondPageUrl() { - cy.url().should("include", "/patients?page=2"); - } - - clickPreviousPage() { - cy.get("#prev-pages").click(); - } - clickPatientExport() { cy.get("#patient-export").click(); } diff --git a/cypress/pageobject/Patient/PatientMedicalHistory.ts b/cypress/pageobject/Patient/PatientMedicalHistory.ts index 93fdd1b38b3..bf2296b4471 100644 --- a/cypress/pageobject/Patient/PatientMedicalHistory.ts +++ b/cypress/pageobject/Patient/PatientMedicalHistory.ts @@ -33,7 +33,9 @@ class PatientMedicalHistory { patientSymptoms6: string, patientSymptoms7: string, ) { - cy.get("[data-testid=patient-details]").then(($dashboard) => { + cy.get("a").contains("Health Profile").click(); + cy.wait(2000); + cy.get("[data-test-id=patient-health-profile]").then(($dashboard) => { cy.url().should("include", "/facility/"); expect($dashboard).to.contain(patientPresentHealth); expect($dashboard).to.contain(patientOngoingMedication); diff --git a/cypress/pageobject/Patient/PatientPredefined.ts b/cypress/pageobject/Patient/PatientPredefined.ts index a3eb41cb86c..445fbaf9b31 100644 --- a/cypress/pageobject/Patient/PatientPredefined.ts +++ b/cypress/pageobject/Patient/PatientPredefined.ts @@ -19,7 +19,9 @@ class PatientPredefined { patientPage.typePatientDateOfBirth("01012001"); patientPage.typePatientName("Patient With Predefined Data"); patientPage.selectPatientGender("Male"); - patientPage.typePatientAddress("Test Patient Address"); + patientPage.typePatientAddress( + "149/J, 3rd Block, Aluva, Ernakulam - 682001", + ); facilityPage.fillPincode("682001"); facilityPage.selectStateOnPincode("Kerala"); facilityPage.selectDistrictOnPincode("Ernakulam"); diff --git a/cypress/pageobject/Sample/SampleTestCreate.ts b/cypress/pageobject/Sample/SampleTestCreate.ts index cd2e93e5072..445d08732c3 100644 --- a/cypress/pageobject/Sample/SampleTestCreate.ts +++ b/cypress/pageobject/Sample/SampleTestCreate.ts @@ -1,5 +1,6 @@ export class SampleTestPage { visitSampleRequestPage(): void { + cy.get("a").contains("Service Request").click(); cy.verifyAndClickElement("#sample-request-btn", "Request Sample Test"); cy.url().should("include", "/sample-test"); } @@ -60,6 +61,7 @@ export class SampleTestPage { fastTrack: string, sampleTestResult: string, ): void { + cy.get("a").contains("Service Request").click(); cy.verifyContentPresence("#sample-test-status", [sampleTestStatus]); cy.verifyContentPresence("#sample-test-type", [sampleTestType]); cy.verifyContentPresence("#sample-test-fast-track", [fastTrack]); diff --git a/cypress/pageobject/Users/UserSearch.ts b/cypress/pageobject/Users/UserSearch.ts index 85575398d0d..6b727aa2040 100644 --- a/cypress/pageobject/Users/UserSearch.ts +++ b/cypress/pageobject/Users/UserSearch.ts @@ -76,18 +76,6 @@ export class UserPage { cy.get(`[data-testid="${testId}"]`).should("not.be.visible"); } - navigateToNextPage() { - cy.get("button#next-pages").click(); - } - - navigateToPreviousPage() { - cy.get("button#prev-pages").click(); - } - - verifyCurrentPageNumber(pageNumber: number) { - cy.url().should("include", `page=${pageNumber}`); - } - verifyMultipleBadgesWithSameId(alreadylinkedusersviews: string[]) { cy.get("#user-view-name").then(($elements) => { const userViews = $elements diff --git a/cypress/pageobject/utils/paginationHelpers.ts b/cypress/pageobject/utils/paginationHelpers.ts new file mode 100644 index 00000000000..edbabec5523 --- /dev/null +++ b/cypress/pageobject/utils/paginationHelpers.ts @@ -0,0 +1,13 @@ +export const pageNavigation = { + navigateToNextPage() { + cy.get("button#next-pages").click(); + }, + + verifyCurrentPageNumber(pageNumber: number) { + cy.url().should("include", `page=${pageNumber}`); + }, + + navigateToPreviousPage() { + cy.get("button#prev-pages").click(); + }, +}; diff --git a/public/locale/en.json b/public/locale/en.json index 2eb4822c27e..56f84a1883a 100644 --- a/public/locale/en.json +++ b/public/locale/en.json @@ -205,6 +205,10 @@ "SORT_OPTIONS__name": "Patient name A-Z", "SORT_OPTIONS__review_time": "Oldest review date first", "SORT_OPTIONS__taken_at": "Oldest taken date first", + "SPO2_LEVEL_MILD_HYPOXEMIA": "Mild Hypoxemia", + "SPO2_LEVEL_MODERATE_HYPOXEMIA": "Moderate Hypoxemia", + "SPO2_LEVEL_NORMAL": "Normal", + "SPO2_LEVEL_SEVERE_HYPOXEMIA": "Severe Hypoxemia", "Submit": "Submit", "TELEMEDICINE": "Telemedicine", "TRANSPORTATION TO BE ARRANGED": "Transportation", @@ -270,6 +274,7 @@ "accept_all": "Accept All", "access_level": "Access Level", "action_irreversible": "This action is irreversible", + "actions": "Actions", "active": "Active", "active_prescriptions": "Active Prescriptions", "add": "Add", @@ -277,7 +282,10 @@ "add_attachments": "Add Attachments", "add_beds": "Add Bed(s)", "add_beds_to_configure_presets": "Add beds to this location to configure presets for them.", + "add_consultation": "Add consultation", + "add_consultation_update": "Add Consultation Update", "add_details_of_patient": "Add Details of Patient", + "add_insurance_details": "Add Insurance Details", "add_location": "Add Location", "add_new_beds": "Add New Bed(s)", "add_new_user": "Add New User", @@ -297,11 +305,14 @@ "administered_on": "Administered on", "administration_dosage_range_error": "Dosage should be between start and target dosage", "administration_notes": "Administration Notes", + "admitted": "Admitted", + "admitted_on": "Admitted On", "advanced_filters": "Advanced Filters", "age": "Age", "all_changes_have_been_saved": "All changes have been saved", "all_details": "All Details", "allergies": "Allergies", + "allow_transfer": "Allow Transfer", "allowed_formats_are": "Allowed formats are", "already_a_member": "Already a member?", "ambulance_driver_name": "Name of ambulance driver", @@ -312,6 +323,7 @@ "any_id_description": "Currently we support: Aadhaar Number / Mobile Number", "any_other_comments": "Any other comments", "apply": "Apply", + "approve": "Approve", "approved_by_district_covid_control_room": "Approved by District COVID Control Room", "approving_facility": "Name of Approving Facility", "archive": "Archive", @@ -328,8 +340,14 @@ "asset_qr_id": "Asset QR ID", "asset_type": "Asset Type", "assets": "Assets", + "assign": "Assign", + "assign_a_volunteer_to": "Assign a volunteer to {{name}}", + "assign_bed": "Assign Bed", + "assign_to_volunteer": "Assign to a Volunteer", + "assigned_doctor": "Assigned Doctor", "assigned_facility": "Facility assigned", "assigned_to": "Assigned to", + "assigned_volunteer": "Assigned Volunteer", "async_operation_warning": "This operation may take some time. Please check back later.", "atypical_presentation_details": "Atypical presentation details", "audio__allow_permission": "Please allow microphone permission in site settings", @@ -361,6 +379,7 @@ "bed_capacity": "Bed Capacity", "bed_created_notification_one": "{{count}} Bed created successfully", "bed_created_notification_other": "{{count}} Beds created successfully", + "bed_history": "Bed History", "bed_not_linked_to_camera": "This bed has not been linked to this camera.", "bed_search_placeholder": "Search by beds name", "bed_type": "Bed Type", @@ -393,6 +412,7 @@ "central_nursing_station": "Central Nursing Station", "change_file": "Change File", "change_password": "Change Password", + "chat_on_whatsapp": "Chat on Whatsapp", "check_eligibility": "Check Eligibility", "check_for_available_update": "Check for available update", "check_for_update": "Check for Update", @@ -489,6 +509,7 @@ "consent_request_rejected": "Patient has rejected the consent request", "consent_request_waiting_approval": "Waiting for the Patient to approve the consent request", "consent_requested_successfully": "Consent requested successfully!", + "consultation_history": "Consultation History", "consultation_missing_warning": "You have not created a consultation for the patient in", "consultation_not_filed": "You have not filed a consultation for this patient yet.", "consultation_not_filed_description": "Please file a consultation for this patient to continue.", @@ -512,6 +533,7 @@ "countries_travelled": "Countries travelled", "covid_19_cat_gov": "Covid_19 Clinical Category as per Govt. of Kerala guideline (A/B/C)", "covid_19_death_reporting_form_1": "Covid-19 Death Reporting : Form 1", + "covid_details": "Covid Details", "create": "Create", "create_abha_address": "Create ABHA Address", "create_add_more": "Create & Add More", @@ -529,6 +551,7 @@ "created_date": "Created Date", "created_on": "Created On", "csv_file_in_the_specified_format": "Select a CSV file in the specified format", + "current_address": "Current Address", "current_password": "Current Password", "customer_support_email": "Customer Support Email", "customer_support_name": "Customer Support Name", @@ -542,13 +565,16 @@ "date_of_birth": "Date of birth", "date_of_positive_covid_19_swab": "Date of Positive Covid 19 Swab", "date_of_result": "Covid confirmation date", + "date_of_return": "Date of Return", "date_of_test": "Date of sample collection for Covid testing", "days": "Days", + "death_report": "Death Report", "delete": "Delete", "delete_facility": "Delete Facility", "delete_item": "Delete {{name}}", "delete_record": "Delete Record", "deleted_successfully": "{{name}} deleted successfully", + "demography": "Demography", "denied_on": "Denied On", "describe_why_the_asset_is_not_working": "Describe why the asset is not working", "description": "Description", @@ -569,6 +595,7 @@ "diastolic": "Diastolic", "differential": "Differential", "differential_diagnosis": "Differential diagnosis", + "disable_transfer": "Disable Transfer", "discard": "Discard", "discharge": "Discharge", "discharge_from_care": "Discharge from CARE", @@ -576,6 +603,7 @@ "discharge_summary": "Discharge Summary", "discharge_summary_not_ready": "Discharge summary is not ready yet.", "discharged": "Discharged", + "discharged_on": "Discharged On", "discharged_patients": "Discharged Patients", "discharged_patients_empty": "No discharged patients present in this facility", "disclaimer": "Disclaimer", @@ -610,6 +638,7 @@ "edit_policy": "Edit Insurance Policy", "edit_policy_description": "Add or edit patient's insurance details", "edit_prescriptions": "Edit Prescriptions", + "edit_profile": "Edit Profile", "edit_user_profile": "Edit Profile", "edited_by": "Edited by", "edited_on": "Edited on", @@ -623,7 +652,11 @@ "email_discharge_summary_description": "Enter your valid email address to receive the discharge summary", "email_success": "We will be sending an email shortly. Please check your inbox.", "emergency": "Emergency", + "emergency_contact": "Emergency Contact", "emergency_contact_number": "Emergency Contact Number", + "emergency_contact_person_name": "Emergency Contact Person Name", + "emergency_contact_person_name_volunteer": "Emergency Contact Person Name (Volunteer)", + "emergency_contact_volunteer": "Emergency Contact (Volunteer)", "empty_date_time": "--:-- --; --/--/----", "encounter_date_field_label__A": "Date & Time of Admission to the Facility", "encounter_date_field_label__DC": "Date & Time of Domiciliary Care commencement", @@ -639,6 +672,7 @@ "encounter_suggestion__OP": "Out-patient visit", "encounter_suggestion__R": "Consultation", "encounter_suggestion_edit_disallowed": "Not allowed to switch to this option in edit consultation", + "encounters": "Encounters", "end_datetime": "End Date/Time", "enter_aadhaar_number": "Enter a 12-digit Aadhaar ID", "enter_aadhaar_otp": "Enter OTP sent to the registered mobile with Aadhaar", @@ -660,6 +694,7 @@ "events": "Events", "expand_sidebar": "Expand Sidebar", "expected_burn_rate": "Expected Burn Rate", + "expired": "Expired", "expired_on": "Expired On", "expires_on": "Expires On", "facilities": "Facilities", @@ -717,6 +752,7 @@ "granted_on": "Granted On", "has_domestic_healthcare_support": "Has domestic healthcare support?", "has_sari": "Has SARI (Severe Acute Respiratory illness)?", + "health-profile": "Health Profile", "health_facility__config_registration_error": "Health ID registration failed", "health_facility__config_update_error": "Health Facility config update failed", "health_facility__config_update_success": "Health Facility config updated successfully", @@ -753,12 +789,17 @@ "i_declare": "I hereby declare that:", "icd11_as_recommended": "As per ICD-11 recommended by WHO", "icmr_specimen_referral_form": "ICMR Specimen Referral Form", + "immunisation-records": "Immunisation", "incomplete_patient_details_warning": "Patient details are incomplete. Please update the details before proceeding.", "inconsistent_dosage_units_error": "Dosage units must be same", "indian_mobile": "Indian Mobile", "indicator": "Indicator", "inidcator_event": "Indicator Event", "instruction_on_titration": "Instruction on titration", + "insurance__insurer_id": "Insurer ID", + "insurance__insurer_name": "Insurer Name", + "insurance__member_id": "Member ID", + "insurance__policy_name": "Policy ID / Policy Name", "insurer_name_required": "Insurer Name is required", "international_mobile": "International Mobile", "invalid_asset_id_msg": "Oops! The asset ID you entered does not appear to be valid.", @@ -767,6 +808,7 @@ "invalid_link_msg": "It appears that the password reset link you have used is either invalid or expired. Please request a new password reset link.", "invalid_password": "Password doesn't meet the requirements", "invalid_password_reset_link": "Invalid password reset link", + "invalid_patient_data": "Invalid Patient Data", "invalid_phone": "Please enter valid phone number", "invalid_phone_number": "Invalid Phone Number", "invalid_pincode": "Invalid Pincode", @@ -785,6 +827,8 @@ "investigations__result": "Result", "investigations__unit": "Unit", "investigations_suggested": "Investigations Suggested", + "investigations_summary": "Investigations Summary", + "ip_encounter": "IP Encounter", "is": "Is", "is_antenatal": "Is Antenatal", "is_atypical_presentation": "Is Atypical presentation", @@ -792,21 +836,26 @@ "is_emergency": "Is emergency", "is_emergency_case": "Is emergency case", "is_it_upshift": "is it upshift", + "is_pregnant": "Is pregnant", "is_this_an_emergency": "Is this an emergency?", "is_this_an_upshift": "Is this an upshift?", "is_unusual_course": "Is unusual course", "is_up_shift": "Is up shift", "is_upshift_case": "Is upshift case", "is_vaccinated": "Whether vaccinated", + "kasp_enabled_date": "{{kasp_string}} enabled date", "label": "Label", "landline": "Indian landline", "language_selection": "Language Selection", "last_administered": "Last administered", + "last_discharge_reason": "Last Discharge Reason", "last_edited": "Last Edited", "last_modified": "Last Modified", "last_name": "Last Name", "last_online": "Last Online", "last_serviced_on": "Last Serviced On", + "last_updated_by": "Last updated by", + "last_vaccinated_on": "Last Vaccinated on", "latitude_invalid": "Latitude must be between -90 and 90", "left": "Left", "length": "Length ({{unit}})", @@ -855,6 +904,7 @@ "max_size_for_image_uploaded_should_be": "Max size for image uploaded should be", "measured_after": "Measured after", "measured_before": "Measured before", + "medical": "Medical", "medical_council_registration": "Medical Council Registration", "medical_worker": "Medical Worker", "medicine": "Medicine", @@ -865,6 +915,7 @@ "middleware_hostname": "Middleware Hostname", "middleware_hostname_example": "e.g. example.ohc.network", "middleware_hostname_sourced_from": "Middleware hostname sourced from {{ source }}", + "min_char_length_error": "Must be at least {{ min_length }} characters", "min_password_len_8": "Minimum password length 8", "min_time_bw_doses": "Min. time b/w doses", "minimize": "Minimize", @@ -898,6 +949,8 @@ "no_beds_available": "No beds available", "no_changes": "No changes", "no_changes_made": "No changes made", + "no_consultation_filed": "No consultation filed", + "no_consultation_history": "No consultation history available", "no_consultation_updates": "No consultation updates", "no_data_found": "No data found", "no_duplicate_facility": "You should not create duplicate facilities", @@ -910,6 +963,7 @@ "no_linked_facilities": "No Linked Facilities", "no_log_update_delta": "No changes since previous log update", "no_log_updates": "No log updates found", + "no_medical_history_available": "No Medical History Available", "no_notices_for_you": "No notices for you.", "no_patients_found": "No Patients Found", "no_patients_to_show": "No patients to show.", @@ -919,6 +973,7 @@ "no_records_found": "No Records Found", "no_remarks": "No remarks", "no_results_found": "No Results Found", + "no_social_profile_details_available": "No Social Profile Details Available", "no_staff": "No staff found", "no_tests_taken": "No tests taken", "no_treating_physicians_available": "This facility does not have any home facility doctors. Please contact your admin.", @@ -938,6 +993,7 @@ "number_of_beds": "Number of beds", "number_of_beds_out_of_range_error": "Number of beds cannot be greater than 100", "number_of_chronic_diseased_dependents": "Number Of Chronic Diseased Dependents", + "number_of_covid_vaccine_doses": "Number of Covid vaccine doses", "nursing_care": "Nursing Care", "nursing_information": "Nursing Information", "nutrition": "Nutrition", @@ -947,6 +1003,8 @@ "on": "On", "ongoing_medications": "Ongoing Medications", "only_indian_mobile_numbers_supported": "Currently only Indian numbers are supported", + "op_encounter": "OP Encounter", + "op_file_closed": "OP file closed", "open": "Open", "open_camera": "Open Camera", "open_live_monitoring": "Open Live Monitoring", @@ -969,6 +1027,11 @@ "password_reset_success": "Password Reset successfully", "password_sent": "Password Reset Email Sent", "patient": "Patient", + "patient-notes": "Notes", + "patient__general-info": "General Info", + "patient__insurance-details": "Insurance Details", + "patient__social-profile": "Social Profile", + "patient__volunteer-contact": "Volunteer Contact", "patient_address": "Patient Address", "patient_body": "Patient Body", "patient_category": "Patient Category", @@ -992,6 +1055,8 @@ "patient_notes_thread__Doctors": "Doctor's Discussions", "patient_notes_thread__Nurses": "Nurse's Discussions", "patient_phone_number": "Patient Phone Number", + "patient_profile": "Patient Profile", + "patient_profile_created_by": "Patient profile created by", "patient_registration__address": "Address", "patient_registration__age": "Age", "patient_registration__comorbidities": "Comorbidities", @@ -1004,12 +1069,15 @@ "patient_status": "Patient Status", "patient_transfer_birth_match_note": "Note: Year of birth must match the patient to process the transfer request.", "patients": "Patients", + "permanent_address": "Permanent Address", + "permission_denied": "You do not have permission to perform this action", "personal_information": "Personal Information", "phone": "Phone", "phone_no": "Phone no.", "phone_number": "Phone Number", "phone_number_at_current_facility": "Phone Number of Contact person at current Facility", "pincode": "Pincode", + "please_assign_bed_to_patient": "Please assign a bed to this patient", "please_enter_a_reason_for_the_shift": "Please enter a reason for the shift.", "please_select_a_facility": "Please select a facility", "please_select_breathlessness_level": "Please select Breathlessness Level", @@ -1031,6 +1099,7 @@ "policy__subscriber_id__example": "SUB001", "policy_id_required": "Policy Id or Policy Name is required", "position": "Position", + "post_partum": "Post-partum", "post_your_comment": "Post Your Comment", "powered_by": "Powered By", "preferred_facility_type": "Preferred Facility Type", @@ -1045,6 +1114,7 @@ "prescriptions__medicine": "Medicine", "prescriptions__route": "Route", "prescriptions__start_date": "Prescribed On", + "present_health": "Present Health", "preset_deleted": "Preset deleted", "preset_name_placeholder": "Specify an identifiable name for the new preset", "preset_updated": "Preset updated", @@ -1095,9 +1165,11 @@ "req_atleast_one_lowercase": "Require at least one lower case letter", "req_atleast_one_symbol": "Require at least one symbol", "req_atleast_one_uppercase": "Require at least one upper case", + "request-sample-test": "Service Request", "request_consent": "Request Consent", "request_description": "Description of Request", "request_description_placeholder": "Type your description here", + "request_sample_test": "Request Sample Test", "request_title": "Request Title", "request_title_placeholder": "Type your title here", "required": "Required", @@ -1121,6 +1193,8 @@ "return_to_login": "Return to Login", "return_to_password_reset": "Return to Password Reset", "return_to_patient_dashboard": "Return to Patient Dashboard", + "review_before": "Review Before", + "review_missed": "Review Missed", "revoked_on": "Revoked On", "right": "Right", "route": "Route", @@ -1168,6 +1242,8 @@ "send_otp_error": "Failed to send OTP. Please try again later.", "send_otp_success": "OTP has been sent to the respective mobile number", "send_reset_link": "Send Reset Link", + "send_sample_to_collection_centre_description": "Are you sure you want to send the sample to Collection Centre?", + "send_sample_to_collection_centre_title": "Send sample to collection centre", "serial_number": "Serial Number", "serviced_on": "Serviced on", "session_expired": "Session Expired", @@ -1176,6 +1252,8 @@ "set_your_local_language": "Set your local language", "settings_and_filters": "Settings and Filters", "severity_of_breathlessness": "Severity of Breathlessness", + "sex": "Sex", + "shift": "Shift Patient", "shift_request_updated_successfully": "Shift request updated successfully", "shifting": "Shifting", "shifting_approval_facility": "Shifting approval facility", @@ -1183,6 +1261,7 @@ "shifting_approving_facility_can_not_be_empty": "Shifting approving facility can not be empty.", "shifting_deleted": "Shifting record has been deleted successfully.", "shifting_details": "Shifting details", + "shifting_history": "Shifting History", "shifting_status": "Shifting status", "show_abha_profile": "Show ABHA Profile", "show_all": "Show all", @@ -1192,6 +1271,7 @@ "show_unread_notifications": "Show Unread", "sign_out": "Sign Out", "skills": "Skills", + "social_profile": "Social Profile", "socioeconomic_status": "Socioeconomic status", "software_update": "Software Update", "something_went_wrong": "Something went wrong..!", @@ -1220,9 +1300,11 @@ "subscription_error": "Subscription Error", "subscription_failed": "Subscription Failed", "suggested_investigations": "Suggested Investigations", + "suggestion": "Suggestion", "summary": "Summary", "support": "Support", "switch": "Switch", + "switch_bed": "Switch Bed", "switch_camera_is_not_available": "Switch camera is not available.", "symptoms": "Symptoms", "systolic": "Systolic", @@ -1239,7 +1321,10 @@ "total_users": "Total Users", "transcript_edit_info": "You can update this if we made an error", "transcript_information": "This is what we heard", + "transfer_allowed": "Transfer Allowed", + "transfer_blocked": "Transfer Blocked", "transfer_in_progress": "TRANSFER IN PROGRESS", + "transfer_status_updated": "Transfer Status Updated", "transfer_to_receiving_facility": "Transfer to receiving facility", "travel_within_last_28_days": "Domestic/international Travel (within last 28 days)", "treating_doctor": "Treating Doctor", @@ -1300,6 +1385,8 @@ "username": "Username", "users": "Users", "vacant": "Vacant", + "vaccinated": "Vaccinated", + "vaccine_name": "Vaccine name", "vehicle_preference": "Vehicle preference", "vendor_name": "Vendor Name", "ventilator_interface": "Respiratory Support Type", @@ -1315,21 +1402,30 @@ "verify_otp_success": "OTP has been verified successfully.", "verify_patient_identifier": "Please verify the patient identifier", "verify_using": "Verify Using", + "video_call": "Video Call", "video_conference_link": "Video Conference Link", "view": "View", "view_abdm_records": "View ABDM Records", + "view_all_details": "View All Details", "view_asset": "View Assets", "view_cns": "View CNS", "view_consultation_and_log_updates": "View Consultation / Log Updates", "view_details": "View Details", "view_faciliy": "View Facility", + "view_files": "View Files", "view_patients": "View Patients", + "view_update_patient_files": "View/Update patient files", + "view_updates": "View Updates", "view_users": "View Users", + "village": "Village", "virtual_nursing_assistant": "Virtual Nursing Assistant", "vitals": "Vitals", "vitals_monitor": "Vitals Monitor", "vitals_present": "Vitals Monitor present", "voice_autofill": "Voice Autofill", + "volunteer_assigned": "Volunteer assigned successfuly", + "volunteer_contact": "Volunteer Contact", + "volunteer_unassigned": "Volunteer unassigned successfuly", "ward": "Ward", "warranty_amc_expiry": "Warranty / AMC Expiry", "what_facility_assign_the_patient_to": "What facility would you like to assign the patient to", diff --git a/public/locale/hi.json b/public/locale/hi.json index 0eb0cc28cfd..b3c172021dd 100644 --- a/public/locale/hi.json +++ b/public/locale/hi.json @@ -567,6 +567,7 @@ "patient_name": "मरीज का नाम", "patient_no": "ओपी/आईपी संख्या", "patient_phone_number": "मरीज़ का फ़ोन नंबर", + "patient_profile": "रोगी प्रोफ़ाइल", "patient_registration__address": "पता", "patient_registration__age": "आयु", "patient_registration__comorbidities": "comorbidities", diff --git a/public/locale/kn.json b/public/locale/kn.json index be18432e0ce..faf50da3a23 100644 --- a/public/locale/kn.json +++ b/public/locale/kn.json @@ -568,6 +568,7 @@ "patient_name": "ರೋಗಿಯ ಹೆಸರು", "patient_no": "OP/IP ಸಂ", "patient_phone_number": "ರೋಗಿಯ ಫೋನ್ ಸಂಖ್ಯೆ", + "patient_profile": "ರೋಗಿ ಪ್ರೊಫೈಲ್", "patient_registration__address": "ವಿಳಾಸ", "patient_registration__age": "ವಯಸ್ಸು", "patient_registration__comorbidities": "ಸಹವರ್ತಿ ರೋಗಗಳು", diff --git a/public/locale/ml.json b/public/locale/ml.json index cf381c32c0e..33dadcf9fb7 100644 --- a/public/locale/ml.json +++ b/public/locale/ml.json @@ -567,6 +567,7 @@ "patient_name": "രോഗിയുടെ പേര്", "patient_no": "OP/IP നമ്പർ", "patient_phone_number": "രോഗിയുടെ ഫോൺ നമ്പർ", + "patient_profile": "രോഗിയുടെ പ്രൊഫൈൽ", "patient_registration__address": "വിലാസം", "patient_registration__age": "പ്രായം", "patient_registration__comorbidities": "കോമോർബിഡിറ്റികൾ", diff --git a/public/locale/mr.json b/public/locale/mr.json index 06e9c5bbbde..543278bf867 100644 --- a/public/locale/mr.json +++ b/public/locale/mr.json @@ -49,6 +49,7 @@ "new_password": "नवीन पासवर्ड", "no_duplicate_facility": "बनावट हॉस्पिटल सुविधा मुळीच तयार करू नका", "no_facilities": "कोणतेही हॉस्पिटल नाही", + "patient_profile": "रुग्ण प्रोफाइल", "password": "पासवर्ड", "password_mismatch": "\"पासवर्ड\" आणि \"पासवर्डची खात्री करा\" दोन्ही सारखे हवेत.", "password_reset_failure": "पासवर्ड रिसेट झाला नाही", @@ -62,5 +63,36 @@ "send_reset_link": "रीसेट लिंक पाठवा", "sign_out": "साइन आउट", "something_wrong": "काहीतरी चूक झाली! पुन्हा प्रयत्न करा", - "username": "युजरनेम" + "username": "युजरनेम", + "general_info": "सामान्य माहिती", + "phone": "फोन", + "date_of_birth": "जन्म तारीख", + "sex": "लिंग", + "emergency_contact": "आपत्कालीन संपर्क", + "emergency_contact_person_name": "आपत्कालीन संपर्क व्यक्तीचे नाव", + "covid_details": "कोविड तपशील", + "number_of_covid_vaccine_doses": "कोविड लसीचे डोस", + "vaccine_name": "लस नाव", + "last_vaccinated_on": "शेवटचा लसीकरणाचा दिवस", + "countries_travelled": "प्रवास केलेले देश", + "date_of_return": "परतण्याची तारीख", + "social_profile": "सामाजिक प्रोफाइल", + "no_social_profile_details_available": "कोणतीही सामाजिक प्रोफाइल माहिती उपलब्ध नाही", + "location": "स्थान", + "current_address": "सध्याचा पत्ता", + "permanent_address": "स्थायी पत्ता", + "nationality": "राष्ट्रीयत्व", + "state": "राज्य", + "local_body": "स्थानिक संस्था", + "ward": "वॉर्ड", + "village": "गाव", + "volunteer_contact": "स्वयंसेवक संपर्क", + "emergency_contact_volunteer": "आपत्कालीन संपर्क (स्वयंसेवक)", + "emergency_contact_person_name_volunteer": "आपत्कालीन संपर्क व्यक्तीचे नाव (स्वयंसेवक)", + "medical": "वैद्यकीय", + "no_medical_history_available": "कोणताही वैद्यकीय इतिहास उपलब्ध नाही", + "present_health": "सध्याचे आरोग्य", + "ongoing_medications": "चालू औषधे", + "allergies": "अॅलर्जी", + "is_pregnant": "गर्भवती आहे" } diff --git a/src/CAREUI/display/Chip.tsx b/src/CAREUI/display/Chip.tsx index a2bacf8bd61..e501bf26f90 100644 --- a/src/CAREUI/display/Chip.tsx +++ b/src/CAREUI/display/Chip.tsx @@ -26,7 +26,7 @@ export default function Chip({ -
+
<>
{" "} @@ -121,7 +121,7 @@ export default function AppRouter() {
-
+
@@ -91,32 +91,26 @@ export default function Breadcrumbs({ +
{
+
+ + - - - {showPatientNotesPopup && ( - - )} -
+ )} ); }; diff --git a/src/components/Facility/Consultations/LogUpdateAnalyseTable.tsx b/src/components/Facility/Consultations/LogUpdateAnalyseTable.tsx new file mode 100644 index 00000000000..43e59bebe7d --- /dev/null +++ b/src/components/Facility/Consultations/LogUpdateAnalyseTable.tsx @@ -0,0 +1,93 @@ +import React from "react"; +import { useTranslation } from "react-i18next"; + +import { classNames, formatDate, formatTime } from "@/Utils/utils"; + +interface SharedSectionTableProps { + data: Record>; + rows: Array<{ title?: string; field?: string; subField?: boolean }>; + choices?: Record>; +} + +const LogUpdateAnalyseTable: React.FC = ({ + data, + rows, + choices = {}, +}) => { + const { t } = useTranslation(); + + const dataValues = React.useMemo(() => Object.values(data), [data]); + + const getDisplayValue = ( + value: string | boolean | null | undefined, + field?: string, + ): string => { + if (typeof value === "boolean") { + return t(value ? "yes" : "no"); + } + + if (field && choices[field]) { + const choiceMap = choices[field]; + const choice = + typeof value === "string" || typeof value === "number" + ? choiceMap[value] + : undefined; + return choice ? t(`${field.toUpperCase()}__${choice}`) : "-"; + } + + return typeof value === "string" ? value : "-"; + }; + + return ( +
+ + + + + {Object.keys(data).map((date) => ( + + ))} + + + + {rows.map((row) => ( + + + {dataValues.map((obj, idx) => { + const value = row.field ? obj[row.field] : undefined; + return ( + + ); + })} + + ))} + +
+

{formatDate(date)}

+

{formatTime(date)}

+
+ {row.title ?? t(`LOG_UPDATE_FIELD_LABEL__${row.field!}`)} + + {row.field ? getDisplayValue(value, row.field) : "-"} +
+
+ ); +}; + +export default LogUpdateAnalyseTable; diff --git a/src/components/Facility/Consultations/NursingPlot.tsx b/src/components/Facility/Consultations/NursingPlot.tsx deleted file mode 100644 index 13f5bb64201..00000000000 --- a/src/components/Facility/Consultations/NursingPlot.tsx +++ /dev/null @@ -1,132 +0,0 @@ -import { useEffect, useState } from "react"; -import { useTranslation } from "react-i18next"; - -import Pagination from "@/components/Common/Pagination"; -import { NursingPlotFields } from "@/components/Facility/models"; - -import { NURSING_CARE_PROCEDURES, PAGINATION_LIMIT } from "@/common/constants"; - -import routes from "@/Utils/request/api"; -import request from "@/Utils/request/request"; -import { formatDateTime } from "@/Utils/utils"; - -export const NursingPlot = ({ consultationId }: any) => { - const { t } = useTranslation(); - const [results, setResults] = useState({}); - const [currentPage, setCurrentPage] = useState(1); - const [totalCount, setTotalCount] = useState(0); - - useEffect(() => { - const fetchDailyRounds = async ( - currentPage: number, - consultationId: string, - ) => { - const { res, data } = await request(routes.dailyRoundsAnalyse, { - body: { page: currentPage, fields: NursingPlotFields }, - pathParams: { - consultationId, - }, - }); - if (res && res.ok && data) { - setResults(data.results); - setTotalCount(data.count); - } - }; - - fetchDailyRounds(currentPage, consultationId); - }, [consultationId, currentPage]); - - const handlePagination = (page: number) => { - setCurrentPage(page); - }; - - const data = Object.entries(results).map((key: any) => { - return { - date: formatDateTime(key[0]), - nursing: key[1]["nursing"], - }; - }); - - const dataToDisplay = data - .map((x) => - x.nursing.map((f: any) => { - f["date"] = x.date; - return f; - }), - ) - .reduce((accumulator, value) => accumulator.concat(value), []); - - const filterEmpty = (field: (typeof NURSING_CARE_PROCEDURES)[number]) => { - const filtered = dataToDisplay.filter((i: any) => i.procedure === field); - return filtered.length > 0; - }; - - const areFieldsEmpty = () => { - let emptyFieldCount = 0; - for (const field of NURSING_CARE_PROCEDURES) { - if (!filterEmpty(field)) emptyFieldCount++; - } - if (emptyFieldCount === NURSING_CARE_PROCEDURES.length) return true; - else return false; - }; - - return ( -
-
-
-
- {areFieldsEmpty() && ( -
-
- {t("no_data_found")} -
-
- )} - {NURSING_CARE_PROCEDURES.map( - (f) => - filterEmpty(f) && ( -
-
-
-

- {t(`NURSING_CARE_PROCEDURE__${f}`)} -

-
-
-
- {dataToDisplay - .filter((i: any) => i.procedure === f) - .map((care: any, index: number) => ( -
-
- {care.date} -
-
- {care.description} -
-
- ))} -
-
- ), - )} -
-
-
- - {!areFieldsEmpty() && totalCount > PAGINATION_LIMIT && ( -
- -
- )} -
- ); -}; diff --git a/src/components/Facility/FacilityHome.tsx b/src/components/Facility/FacilityHome.tsx index 02c3f5386cb..e38c187590e 100644 --- a/src/components/Facility/FacilityHome.tsx +++ b/src/components/Facility/FacilityHome.tsx @@ -48,6 +48,8 @@ import uploadFile from "@/Utils/request/uploadFile"; import useQuery from "@/Utils/request/useQuery"; import { sleep } from "@/Utils/utils"; +import { patientRegisterAuth } from "../Patient/PatientRegister"; + type Props = { facilityId: string; }; @@ -458,17 +460,19 @@ export const FacilityHome = ({ facilityId }: Props) => { {CameraFeedPermittedUserTypes.includes(authUser.user_type) && ( )} - navigate(`/facility/${facilityId}/patient`)} - authorizeFor={NonReadOnlyUsers} - > - - {t("add_details_of_patient")} - + {patientRegisterAuth(authUser, facilityData, facilityId) && ( + navigate(`/facility/${facilityId}/patient`)} + authorizeFor={NonReadOnlyUsers} + > + + {t("add_details_of_patient")} + + )} { const maxYear = new Date().getFullYear(); const handleChange = (e: FieldChangeEvent) => { - if ( - e.name === "year_of_birth" && - parseInt((e.value as string) || "0") > maxYear - ) { + const value = String(e.value); + + if (e.name === "year_of_birth") { + if (value.length <= 4) { + dispatch({ + type: "set_form", + form: { ...state.form, [e.name]: e.value }, + }); + } + } else { dispatch({ - type: "set_error", - errors: { - ...state.errors, - [e.name]: `Cannot be greater than ${maxYear}`, - }, + type: "set_form", + form: { ...state.form, [e.name]: e.value }, }); - return; + } + }; + + const handleOnBlur = (e: React.FocusEvent) => { + const yearValue = Number(state.form.year_of_birth); + if (!state.form.year_of_birth) return; + let errorMessage = ""; + if (yearValue > maxYear) { + errorMessage = `Cannot be greater than ${maxYear}`; + } else if (yearValue < 1900) { + errorMessage = `Cannot be smaller than 1900`; } dispatch({ - type: "set_form", - form: { ...state.form, [e.name]: e.value }, + type: "set_error", + errors: { + ...state.errors, + [e.target.name]: errorMessage, + }, }); }; @@ -115,6 +131,11 @@ const TransferPatientDialog = (props: Props) => { errors[field] = `Cannot be greater than ${maxYear}`; invalidForm = true; } + + if (parseInt(state.form[field] || "0") < 1900) { + errors[field] = `Cannot be smaller than 1900`; + invalidForm = true; + } return; default: return; @@ -193,9 +214,8 @@ const TransferPatientDialog = (props: Props) => { label="Year of birth" labelClassName="text-sm" value={state.form.year_of_birth} - min="1900" - max={maxYear} onChange={handleChange} + onBlur={handleOnBlur} placeholder="Enter year of birth" error={state.errors.year_of_birth} /> diff --git a/src/components/Facility/models.tsx b/src/components/Facility/models.tsx index 79272ac3de7..a984efe6283 100644 --- a/src/components/Facility/models.tsx +++ b/src/components/Facility/models.tsx @@ -391,7 +391,10 @@ export const NursingPlotFields = [ ] as const satisfies (keyof DailyRoundsModel)[]; export type NursingPlotRes = { - nursing: any[]; + nursing: Array<{ + procedure: string; + description: string; + }>; }; export const RoutineFields = [ diff --git a/src/components/Files/AudioCaptureDialog.tsx b/src/components/Files/AudioCaptureDialog.tsx index 4d60f64a135..d198ac7db16 100644 --- a/src/components/Files/AudioCaptureDialog.tsx +++ b/src/components/Files/AudioCaptureDialog.tsx @@ -1,5 +1,5 @@ import { Link } from "raviger"; -import { useEffect, useState } from "react"; +import { useEffect, useRef, useState } from "react"; import { useTranslation } from "react-i18next"; import CareIcon from "@/CAREUI/icons/CareIcon"; @@ -26,6 +26,7 @@ export default function AudioCaptureDialog(props: AudioCaptureDialogProps) { const { show, onHide, onCapture, autoRecord = false } = props; const [status, setStatus] = useState(null); + const mediaStreamRef = useRef(null); const { t } = useTranslation(); const { audioURL, resetRecording, startRecording, stopRecording } = @@ -42,7 +43,8 @@ export default function AudioCaptureDialog(props: AudioCaptureDialogProps) { const handleStartRecording = () => { navigator.mediaDevices .getUserMedia({ audio: true }) - .then(() => { + .then((stream) => { + mediaStreamRef.current = stream; setStatus("RECORDING"); startRecording(); timer.start(); @@ -105,6 +107,13 @@ export default function AudioCaptureDialog(props: AudioCaptureDialogProps) { if (autoRecord && show && status === "RECORDING") { handleStartRecording(); } + + return () => { + if (mediaStreamRef.current) { + mediaStreamRef.current.getTracks().forEach((track) => track.stop()); + mediaStreamRef.current = null; + } + }; }, [autoRecord, status, show]); return ( @@ -133,7 +142,7 @@ export default function AudioCaptureDialog(props: AudioCaptureDialogProps) {

{t("audio__record")}

{t("audio__record_helper")}
-
+
+ ))} +
+ +
+
+
+
+ {t("patient_status")} +
+
+ +
+
+
+ + navigate( + `/facility/${patientData?.facility}/patient/${id}/update`, + ), + )} + > + + {t("edit_profile")} + +
+
+ {/*
+ {[ + { label: t("abha_number"), value: "-" }, + { label: t("abha_address"), value: "-" }, + ].map((info, i) => ( +
+

+ {info.label}: +

+

+ {info.value} +

+
+ ))} +
*/} +
+ {data + .filter((s) => !s.hidden) + .map((subtab, i) => ( +
+
+
+

{t(`patient__${subtab.id}`)}

+ {subtab.allowEdit && ( + + )} +
+
+ {subtab.details.map((detail, j) => + detail && + typeof detail === "object" && + "label" in detail ? ( +
+
+ {detail.label} +
+
+ {detail.value || "-"} +
+
+ ) : ( + {detail} + ), + )} +
+
+ ))} +
+
+ +
+ ); +}; diff --git a/src/components/Patient/PatientDetailsTab/EncounterHistory.tsx b/src/components/Patient/PatientDetailsTab/EncounterHistory.tsx new file mode 100644 index 00000000000..71865483800 --- /dev/null +++ b/src/components/Patient/PatientDetailsTab/EncounterHistory.tsx @@ -0,0 +1,90 @@ +import React, { useEffect, useState } from "react"; +import { useTranslation } from "react-i18next"; + +import PaginatedList from "@/CAREUI/misc/PaginatedList"; + +import CircularProgress from "@/components/Common/CircularProgress"; +import Loading from "@/components/Common/Loading"; +import { ConsultationCard } from "@/components/Facility/ConsultationCard"; +import { ConsultationModel } from "@/components/Facility/models"; + +import useAuthUser from "@/hooks/useAuthUser"; + +import { triggerGoal } from "@/Integrations/Plausible"; +import routes from "@/Utils/request/api"; +import useQuery from "@/Utils/request/useQuery"; + +import { PatientProps } from "."; +import { PatientModel } from "../models"; + +const EncounterHistory = (props: PatientProps) => { + const { patientData: initialPatientData, facilityId, id } = props; + const [patientData, setPatientData] = + useState(initialPatientData); + const authUser = useAuthUser(); + + useEffect(() => { + setPatientData(initialPatientData); + }, [initialPatientData]); + + const { t } = useTranslation(); + + const { loading: isLoading, refetch } = useQuery(routes.getPatient, { + pathParams: { + id, + }, + onResponse: ({ res, data }) => { + if (res?.ok && data) { + setPatientData(data); + } + triggerGoal("Patient Profile Viewed", { + facilityId: facilityId, + userId: authUser.id, + }); + }, + }); + + if (isLoading) { + return ; + } + + return ( + + {(_) => ( +
+ + + + +
+
+ {t("no_consultation_history")} +
+
+
+ > + {(item) => ( + + )} + +
+ +
+
+ )} +
+ ); +}; + +export default EncounterHistory; diff --git a/src/components/Patient/PatientDetailsTab/HealthProfileSummary.tsx b/src/components/Patient/PatientDetailsTab/HealthProfileSummary.tsx new file mode 100644 index 00000000000..3fb6b60d330 --- /dev/null +++ b/src/components/Patient/PatientDetailsTab/HealthProfileSummary.tsx @@ -0,0 +1,135 @@ +import { navigate } from "raviger"; +import { useTranslation } from "react-i18next"; + +import CareIcon from "@/CAREUI/icons/CareIcon"; + +import { UserModel } from "@/components/Users/models"; + +import useAuthUser from "@/hooks/useAuthUser"; + +import { ADMIN_USER_TYPES } from "@/common/constants"; + +import { PatientProps } from "."; +import * as Notification from "../../../Utils/Notifications"; +import { PatientModel } from "../models"; + +export const HealthProfileSummary = (props: PatientProps) => { + const { patientData, facilityId, id } = props; + + const authUser = useAuthUser(); + const { t } = useTranslation(); + + const handleEditClick = (sectionId: string) => { + navigate( + `/facility/${facilityId}/patient/${id}/update?section=${sectionId}`, + ); + }; + + let patientMedHis: JSX.Element[] = []; + + if (patientData?.medical_history?.length) { + const medHis = patientData.medical_history; + patientMedHis = medHis + .filter((item) => item.disease !== "NO") + .map((item, idx) => ( +
+
+ {item.disease} +
+
+ {item.details} +
+
+ )); + } + + const canEditPatient = (authUser: UserModel, patientData: PatientModel) => { + return ( + ADMIN_USER_TYPES.includes( + authUser.user_type as (typeof ADMIN_USER_TYPES)[number], + ) || authUser.home_facility_object?.id === patientData.facility + ); + }; + + return ( +
+
+
+
+
+
+ {t("medical")} +
+ +
+ +
+
+
+ {t("present_health")} +
+
+ {patientData.present_health || "-"} +
+
+ +
+
+ {t("ongoing_medications")} +
+
+ {patientData.ongoing_medication || "-"} +
+
+ +
+
+ {t("allergies")} +
+
+ {patientData.allergies || "-"} +
+
+ + {patientData.gender === 2 && patientData.is_antenatal && ( +
+
+ {t("is_pregnant")} +
+
+ {t("yes")} +
+
+ )} + {patientMedHis} +
+
+
+
+ ); +}; diff --git a/src/components/Patient/PatientDetailsTab/ImmunisationRecords.tsx b/src/components/Patient/PatientDetailsTab/ImmunisationRecords.tsx new file mode 100644 index 00000000000..eb298737f3c --- /dev/null +++ b/src/components/Patient/PatientDetailsTab/ImmunisationRecords.tsx @@ -0,0 +1,124 @@ +import { navigate } from "raviger"; +import { useTranslation } from "react-i18next"; + +import CareIcon from "@/CAREUI/icons/CareIcon"; + +import { UserModel } from "@/components/Users/models"; + +import useAuthUser from "@/hooks/useAuthUser"; + +import { ADMIN_USER_TYPES } from "@/common/constants"; + +import { formatDateTime } from "@/Utils/utils"; + +import { PatientProps } from "."; +import * as Notification from "../../../Utils/Notifications"; +import { PatientModel } from "../models"; + +export const ImmunisationRecords = (props: PatientProps) => { + const { patientData, facilityId, id } = props; + + const authUser = useAuthUser(); + const { t } = useTranslation(); + + const handleEditClick = (sectionId: string) => { + navigate( + `/facility/${facilityId}/patient/${id}/update?section=${sectionId}`, + ); + }; + + const canEditPatient = (authUser: UserModel, patientData: PatientModel) => { + return ( + ADMIN_USER_TYPES.includes( + authUser.user_type as (typeof ADMIN_USER_TYPES)[number], + ) || authUser.home_facility_object?.id === patientData.facility + ); + }; + + return ( +
+
+
+
+
+

{t("covid_details")}

+ +
+ +
+
+
+ {t("number_of_covid_vaccine_doses")} +
+
+ {patientData.is_vaccinated && patientData.number_of_doses + ? patientData.number_of_doses + : "-"} +
+
+ +
+
+ {t("vaccine_name")} +
+
+ {patientData.is_vaccinated && patientData.vaccine_name + ? patientData.vaccine_name + : "-"} +
+
+ +
+
+ {t("last_vaccinated_on")} +
+
+ {patientData.is_vaccinated && patientData.last_vaccinated_date + ? formatDateTime(patientData.last_vaccinated_date) + : "-"} +
+
+ +
+
+ {t("countries_travelled")} +
+
+ {patientData.countries_travelled && + patientData.countries_travelled.length > 0 + ? patientData.countries_travelled.join(", ") + : "-"} +
+
+ +
+
+ {t("date_of_return")} +
+
+ {patientData.date_of_return + ? formatDateTime(patientData.date_of_return) + : "-"} +
+
+
+
+
+
+ ); +}; diff --git a/src/components/Patient/PatientDetailsTab/Notes.tsx b/src/components/Patient/PatientDetailsTab/Notes.tsx new file mode 100644 index 00000000000..646e97d3bd5 --- /dev/null +++ b/src/components/Patient/PatientDetailsTab/Notes.tsx @@ -0,0 +1,184 @@ +import { t } from "i18next"; +import { useEffect, useState } from "react"; + +import CareIcon from "@/CAREUI/icons/CareIcon"; + +import ButtonV2 from "@/components/Common/ButtonV2"; +import DoctorNoteReplyPreviewCard from "@/components/Facility/DoctorNoteReplyPreviewCard"; +import PatientNotesList from "@/components/Facility/PatientNotesList"; +import { + PatientNoteStateType, + PatientNotesModel, +} from "@/components/Facility/models"; +import AutoExpandingTextInputFormField from "@/components/Form/FormFields/AutoExpandingTextInputFormField"; + +import useAuthUser from "@/hooks/useAuthUser"; +import { useMessageListener } from "@/hooks/useMessageListener"; + +import { PATIENT_NOTES_THREADS } from "@/common/constants"; + +import { NonReadOnlyUsers } from "@/Utils/AuthorizeFor"; +import routes from "@/Utils/request/api"; +import request from "@/Utils/request/request"; +import { classNames, keysOf } from "@/Utils/utils"; + +import * as Notification from "../../../Utils/Notifications"; + +interface PatientNotesProps { + id: string; + facilityId: string; +} + +const PatientNotes = (props: PatientNotesProps) => { + const { id: patientId, facilityId } = props; + + const authUser = useAuthUser(); + const [thread, setThread] = useState( + authUser.user_type === "Nurse" + ? PATIENT_NOTES_THREADS.Nurses + : PATIENT_NOTES_THREADS.Doctors, + ); + + const [patientActive, setPatientActive] = useState(true); + const [noteField, setNoteField] = useState(""); + const [reload, setReload] = useState(false); + const [reply_to, setReplyTo] = useState( + undefined, + ); + + const initialData: PatientNoteStateType = { + notes: [], + cPage: 1, + totalPages: 1, + }; + const [state, setState] = useState(initialData); + + const onAddNote = async () => { + if (!/\S+/.test(noteField)) { + Notification.Error({ + msg: "Note Should Contain At Least 1 Character", + }); + return; + } + + try { + const { res } = await request(routes.addPatientNote, { + pathParams: { patientId: patientId }, + body: { + note: noteField, + thread, + reply_to: reply_to?.id, + }, + }); + if (res?.status === 201) { + setNoteField(""); + setReload(!reload); + setState({ ...state, cPage: 1 }); + setReplyTo(undefined); + Notification.Success({ msg: "Note added successfully" }); + } + } catch (error) { + Notification.Error({ + msg: "Failed to add note. Please try again.", + }); + } + }; + + useEffect(() => { + async function fetchPatientName() { + if (patientId) { + try { + const { data } = await request(routes.getPatient, { + pathParams: { id: patientId }, + }); + if (data) { + setPatientActive(data.is_active ?? true); + } + } catch (error) { + Notification.Error({ + msg: "Failed to fetch patient status", + }); + } + } + } + fetchPatientName(); + }, [patientId]); + + useMessageListener((data) => { + const message = data?.message; + if ( + (message?.from == "patient/doctor_notes/create" || + message?.from == "patient/doctor_notes/edit") && + message?.facility_id == facilityId && + message?.patient_id == patientId + ) { + setReload(true); + } + }); + + return ( +
+
+
+ {keysOf(PATIENT_NOTES_THREADS).map((current) => ( + + ))} +
+ + setReplyTo(undefined)} + > +
+ setNoteField(e.value)} + className="w-full grow" + errorClassName="hidden" + innerClassName="pr-10" + placeholder={t("notes_placeholder")} + disabled={!patientActive} + /> + + + +
+
+
+
+ ); +}; + +export default PatientNotes; diff --git a/src/components/Patient/PatientDetailsTab/SampleTestHistory.tsx b/src/components/Patient/PatientDetailsTab/SampleTestHistory.tsx new file mode 100644 index 00000000000..b7a907fe662 --- /dev/null +++ b/src/components/Patient/PatientDetailsTab/SampleTestHistory.tsx @@ -0,0 +1,107 @@ +import { navigate } from "raviger"; +import React, { useState } from "react"; +import { useTranslation } from "react-i18next"; + +import CareIcon from "@/CAREUI/icons/CareIcon"; +import PaginatedList from "@/CAREUI/misc/PaginatedList"; + +import ButtonV2 from "@/components/Common/ButtonV2"; +import CircularProgress from "@/components/Common/CircularProgress"; + +import { NonReadOnlyUsers } from "@/Utils/AuthorizeFor"; +import routes from "@/Utils/request/api"; + +import { PatientProps } from "."; +import { SampleTestCard } from "../SampleTestCard"; +import { PatientModel, SampleTestModel } from "../models"; + +export const SampleTestHistory = (props: PatientProps) => { + const { patientData, facilityId, id } = props; + const [_selectedStatus, setSelectedStatus] = useState<{ + status: number; + sample: SampleTestModel | null; + }>({ status: 0, sample: null }); + const [_showAlertMessage, setShowAlertMessage] = useState(false); + + const isPatientInactive = (patientData: PatientModel, facilityId: string) => { + if (!patientData) return true; + return ( + !patientData.is_active || + !( + patientData?.last_consultation && + patientData.last_consultation.facility === facilityId + ) + ); + }; + + const confirmApproval = (status: number, sample: SampleTestModel) => { + setSelectedStatus({ status, sample }); + setShowAlertMessage(true); + }; + + const { t } = useTranslation(); + + return ( +
+
+
+

+ {t("sample_test_history")} +

+ + navigate( + `/facility/${patientData?.facility}/patient/${id}/sample-test`, + ) + } + authorizeFor={NonReadOnlyUsers} + id="sample-request-btn" + > + + + {t("request_sample_test")} + + +
+
+ + + {(_, query) => ( +
+ + + + +
+
+ {t("no_records_found")} +
+
+
+ > + {(item) => ( + + )} + +
+ +
+
+ )} +
+
+ ); +}; diff --git a/src/components/Patient/PatientDetailsTab/ShiftingHistory.tsx b/src/components/Patient/PatientDetailsTab/ShiftingHistory.tsx new file mode 100644 index 00000000000..b7ef154bf4d --- /dev/null +++ b/src/components/Patient/PatientDetailsTab/ShiftingHistory.tsx @@ -0,0 +1,73 @@ +import { navigate } from "raviger"; +import { useTranslation } from "react-i18next"; + +import CareIcon from "@/CAREUI/icons/CareIcon"; + +import ButtonV2 from "@/components/Common/ButtonV2"; +import { formatFilter } from "@/components/Resource/ResourceCommons"; +import ShiftingTable from "@/components/Shifting/ShiftingTable"; + +import useFilters from "@/hooks/useFilters"; + +import { NonReadOnlyUsers } from "@/Utils/AuthorizeFor"; +import routes from "@/Utils/request/api"; +import useQuery from "@/Utils/request/useQuery"; + +import { PatientProps } from "."; +import { PatientModel } from "../models"; + +const ShiftingHistory = (props: PatientProps) => { + const { patientData, facilityId, id } = props; + const { t } = useTranslation(); + const { qParams, Pagination, resultsPerPage } = useFilters({ + cacheBlacklist: ["patient_name"], + }); + + const isPatientInactive = (patientData: PatientModel, facilityId: string) => { + return ( + !patientData.is_active || + !(patientData?.last_consultation?.facility === facilityId) + ); + }; + + const { data: shiftData, loading } = useQuery(routes.listShiftRequests, { + query: { + ...formatFilter({ + ...qParams, + offset: (qParams.page ? qParams.page - 1 : 0) * resultsPerPage, + }), + patient: id, + }, + prefetch: !!id, + }); + + return ( +
+
+

+ {t("shifting_history")} +

+ + navigate(`/facility/${facilityId}/patient/${id}/shift/new`) + } + authorizeFor={NonReadOnlyUsers} + > + + + {t("shift")} + + +
+ +
+ +
{" "} +
+ ); +}; + +export default ShiftingHistory; diff --git a/src/components/Patient/PatientDetailsTab/index.tsx b/src/components/Patient/PatientDetailsTab/index.tsx new file mode 100644 index 00000000000..effc9b667f8 --- /dev/null +++ b/src/components/Patient/PatientDetailsTab/index.tsx @@ -0,0 +1,45 @@ +import { PatientModel } from "../models"; +import { Demography } from "./Demography"; +import EncounterHistory from "./EncounterHistory"; +import { HealthProfileSummary } from "./HealthProfileSummary"; +import { ImmunisationRecords } from "./ImmunisationRecords"; +import PatientNotes from "./Notes"; +import { SampleTestHistory } from "./SampleTestHistory"; +import ShiftingHistory from "./ShiftingHistory"; + +export interface PatientProps { + facilityId: string; + id: string; + patientData: PatientModel; +} + +export const patientTabs = [ + { + route: "demography", + component: Demography, + }, + { + route: "encounters", + component: EncounterHistory, + }, + { + route: "health-profile", + component: HealthProfileSummary, + }, + { + route: "immunisation-records", + component: ImmunisationRecords, + }, + { + route: "shift", + component: ShiftingHistory, + }, + { + route: "request-sample-test", + component: SampleTestHistory, + }, + { + route: "patient-notes", + component: PatientNotes, + }, +]; diff --git a/src/components/Patient/PatientHome.tsx b/src/components/Patient/PatientHome.tsx index a7b08bdea58..d6b9844b699 100644 --- a/src/components/Patient/PatientHome.tsx +++ b/src/components/Patient/PatientHome.tsx @@ -1,26 +1,9 @@ -import { navigate } from "raviger"; +import { Link, navigate } from "raviger"; import { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; -import Chip from "@/CAREUI/display/Chip"; -import CareIcon from "@/CAREUI/icons/CareIcon"; -import PaginatedList from "@/CAREUI/misc/PaginatedList"; - -import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"; -import { Button } from "@/components/ui/button"; - -import ButtonV2 from "@/components/Common/ButtonV2"; -import CircularProgress from "@/components/Common/CircularProgress"; import ConfirmDialog from "@/components/Common/ConfirmDialog"; -import Loading from "@/components/Common/Loading"; -import Page from "@/components/Common/Page"; -import RelativeDateUserMention from "@/components/Common/RelativeDateUserMention"; import UserAutocomplete from "@/components/Common/UserAutocompleteFormField"; -import { ConsultationCard } from "@/components/Facility/ConsultationCard"; -import { ConsultationModel, ShiftingModel } from "@/components/Facility/models"; -import { InsuranceDetialsCard } from "@/components/Patient/InsuranceDetailsCard"; -import { SampleTestCard } from "@/components/Patient/SampleTestCard"; -import { PatientModel, SampleTestModel } from "@/components/Patient/models"; import useAuthUser from "@/hooks/useAuthUser"; @@ -31,98 +14,67 @@ import { SAMPLE_TEST_STATUS, } from "@/common/constants"; -import { triggerGoal } from "@/Integrations/Plausible"; -import { NonReadOnlyUsers } from "@/Utils/AuthorizeFor"; -import * as Notification from "@/Utils/Notifications"; import dayjs from "@/Utils/dayjs"; import routes from "@/Utils/request/api"; -import request from "@/Utils/request/request"; -import useQuery from "@/Utils/request/useQuery"; + +import Chip from "../../CAREUI/display/Chip"; +import CareIcon from "../../CAREUI/icons/CareIcon"; +import { triggerGoal } from "../../Integrations/Plausible"; +import { NonReadOnlyUsers } from "../../Utils/AuthorizeFor"; +import * as Notification from "../../Utils/Notifications"; +import request from "../../Utils/request/request"; +import useQuery from "../../Utils/request/useQuery"; import { - classNames, - formatDate, formatDateTime, formatName, formatPatientAge, + humanizeStrings, isAntenatal, isPostPartum, -} from "@/Utils/utils"; + relativeDate, +} from "../../Utils/utils"; +import { Avatar } from "../Common/Avatar"; +import ButtonV2 from "../Common/ButtonV2"; +import Loading from "../Common/Loading"; +import Page from "../Common/Page"; +import { SkillModel, UserBareMinimum } from "../Users/models"; +import { patientTabs } from "./PatientDetailsTab"; +import { isPatientMandatoryDataFilled } from "./Utils"; +import { AssignedToObjectModel, PatientModel, SampleTestModel } from "./models"; export const parseOccupation = (occupation: string | undefined) => { return OCCUPATION_TYPES.find((i) => i.value === occupation)?.text; }; -export const PatientHome = (props: any) => { - const { facilityId, id } = props; - const [showShifts, setShowShifts] = useState(false); - const [isShiftClicked, setIsShiftClicked] = useState(false); +export const PatientHome = (props: { + facilityId?: string; + id: string; + page: (typeof patientTabs)[0]["route"]; +}) => { + const { facilityId, id, page } = props; const [patientData, setPatientData] = useState({}); - const [assignedVolunteerObject, setAssignedVolunteerObject] = - useState(null); + const authUser = useAuthUser(); const { t } = useTranslation(); - const [selectedStatus, setSelectedStatus] = useState<{ + const [selectedStatus, _setSelectedStatus] = useState<{ status: number; - sample: any; + sample: SampleTestModel | null; }>({ status: 0, sample: null }); - const [showAlertMessage, setShowAlertMessage] = useState(false); - const [modalFor, setModalFor] = useState(); - const [openAssignVolunteerDialog, setOpenAssignVolunteerDialog] = - useState(false); - const initErr: any = {}; - const errors = initErr; + const [assignedVolunteer, setAssignedVolunteer] = useState< + AssignedToObjectModel | undefined + >(patientData.assigned_to_object); useEffect(() => { - setAssignedVolunteerObject(patientData.assigned_to_object); + setAssignedVolunteer(patientData.assigned_to_object); }, [patientData.assigned_to_object]); - const handleTransferComplete = async (shift: ShiftingModel) => { - if (!shift) return; - await request(routes.completeTransfer, { - pathParams: { externalId: shift.external_id }, - }); - navigate( - `/facility/${shift.assigned_facility}/patient/${shift.patient}/consultation`, - ); - }; - - const { data: insuranceDetials } = useQuery(routes.hcx.policies.list, { - query: { - patient: id, - limit: 1, - }, - }); - - const handlePatientTransfer = async (value: boolean) => { - const dummyPatientData = Object.assign({}, patientData); - dummyPatientData["allow_transfer"] = value; - - await request(routes.patchPatient, { - pathParams: { - id: patientData.id as string, - }, - - body: { allow_transfer: value }, - - onResponse: ({ res }) => { - if ((res || {}).status === 200) { - const dummyPatientData = Object.assign({}, patientData); - dummyPatientData["allow_transfer"] = value; - setPatientData(dummyPatientData); - - Notification.Success({ - msg: "Transfer status updated.", - }); - } - }, - }); - }; - - const handleVolunteerSelect = (volunteer: any) => { - setAssignedVolunteerObject(volunteer.value); - }; + const [showAlertMessage, setShowAlertMessage] = useState(false); + const [openAssignVolunteerDialog, setOpenAssignVolunteerDialog] = + useState(false); + const initErr: any = {}; + const errors = initErr; const { loading: isLoading, refetch } = useQuery(routes.getPatient, { pathParams: { id, @@ -144,20 +96,18 @@ export const PatientHome = (props: any) => { id: patientData.id as string, }, body: { - assigned_to: assignedVolunteerObject - ? assignedVolunteerObject.id - : null, + assigned_to: (assignedVolunteer as UserBareMinimum)?.id || null, }, }); if (res?.ok && data) { setPatientData(data); - if (assignedVolunteerObject) { + if (!assignedVolunteer) { Notification.Success({ - msg: "Volunteer assigned successfully.", + msg: t("volunteer_assigned"), }); } else { Notification.Success({ - msg: "Volunteer unassigned successfully.", + msg: t("volunteer_unassigned"), }); } refetch(); @@ -166,34 +116,41 @@ export const PatientHome = (props: any) => { if (errors["assignedVolunteer"]) delete errors["assignedVolunteer"]; }; - const { loading: isShiftDataLoading, data: activeShiftingData } = useQuery( - routes.listShiftRequests, - { - query: { - patient: id, - }, - prefetch: isShiftClicked, + const consultation = patientData?.last_consultation; + const skillsQuery = useQuery(routes.userListSkill, { + pathParams: { + username: consultation?.treating_physician_object?.username ?? "", }, - ); + prefetch: !!consultation?.treating_physician_object?.username, + }); + const formatSkills = (arr: SkillModel[]) => { + const skills = arr.map((skill) => skill.skill_object.name); + + if (skills.length === 0) { + return ""; + } - const confirmApproval = (status: number, sample: any) => { - setSelectedStatus({ status, sample }); - setShowAlertMessage(true); + if (skills.length <= 3) { + return humanizeStrings(skills); + } + + const [first, second, ...rest] = skills; + return `${first}, ${second} and ${rest.length} other skills...`; }; const handleApproval = async () => { const { status, sample } = selectedStatus; const sampleData = { - id: sample.id, + id: sample?.id, status: status.toString(), - consultation: sample.consultation, + consultation: sample?.consultation, }; const statusName = SAMPLE_TEST_STATUS.find((i) => i.id === status)?.desc; await request(routes.patchSample, { body: sampleData, pathParams: { - id: sample.id, + id: sample?.id || "", }, onResponse: ({ res }) => { if (res?.ok) { @@ -214,351 +171,390 @@ export const PatientHome = (props: any) => { (i) => i.id === patientData.gender, )?.text; - let patientMedHis: any[] = []; - if ( - patientData && - patientData.medical_history && - patientData.medical_history.length - ) { - const medHis = patientData.medical_history; - patientMedHis = medHis - .filter((item) => item.disease !== "NO") - .map((item, idx) => ( -
-
- {item.disease} -
-
- {item.details} -
-
- )); - } - - const isPatientInactive = (patientData: PatientModel, facilityId: string) => { - return ( - !patientData.is_active || - !(patientData?.last_consultation?.facility === facilityId) - ); + const handlePatientTransfer = async (value: boolean) => { + await request(routes.patchPatient, { + pathParams: { + id: patientData.id as string, + }, + body: { allow_transfer: value }, + onResponse: ({ res }) => { + if (res?.status === 200) { + setPatientData((prev) => ({ + ...prev, + allow_transfer: value, + })); + Notification.Success({ + msg: t("transfer_status_updated"), + }); + } + }, + }); }; + const Tab = patientTabs.find((t) => t.route === page)?.component; + return ( handleApproval()} onClose={() => setShowAlertMessage(false)} /> -
-
-
-
- {patientData?.last_consultation?.assigned_to_object && ( -

- - Assigned Doctor: - {formatName( - patientData.last_consultation.assigned_to_object, - )} - - {patientData?.last_consultation?.assigned_to_object - .alt_phone_number && ( - - Video Call - - )} -

- )} - {patientData.assigned_to_object && ( -

- - Assigned Volunteer: - {formatName(patientData.assigned_to_object)} - -

- )} -
-
-
- {(patientData?.facility != patientData?.last_consultation?.facility || - (patientData.is_active && - patientData?.last_consultation?.discharge_date)) && ( - -
- -
- - {t("consultation_not_filed")} - - - - {t("consultation_not_filed_description")} - - +
+
+
+
+
+
+
+
+ +
+
+

+ {patientData.name} +

+

+ {formatPatientAge(patientData, true)},{" "} + {patientGender},{" "} {patientData.blood_group || "-"} +

+
+
+
+
+
+
+ {patientData?.is_active && + (!patientData?.last_consultation || + patientData?.last_consultation?.discharge_date) && ( +
+ + navigate( + `/facility/${patientData?.facility}/patient/${id}/consultation`, + ) + } + > + + + {t("add_consultation")} + + +
+ )} +
+
+
-
- - - )} -
-
-
-
-

- {patientData.name} - {formatPatientAge(patientData, true)} -

-
- {patientData.is_vaccinated && ( - - )} - {patientData.allow_transfer ? ( - - ) : ( - +
+ {isPatientMandatoryDataFilled(patientData) && + (!patientData.last_consultation || + patientData.last_consultation?.facility !== + patientData.facility || + (patientData.last_consultation?.discharge_date && + patientData.is_active)) && ( + + + + + + + )} - {patientData.gender === 2 && ( - <> - {patientData.is_antenatal && - isAntenatal( - patientData.last_menstruation_start_date, - ) && ( - - )} - {isPostPartum(patientData.date_of_delivery) && ( + {patientData.is_vaccinated && ( + + )} + {patientData.allow_transfer ? ( + + ) : ( + + )} + + {patientData.gender === 2 && ( + <> + {patientData.is_antenatal && + isAntenatal( + patientData.last_menstruation_start_date, + ) && ( )} - - )} - {patientData.last_consultation?.is_telemedicine && ( - - )} -
+ {isPostPartum(patientData.date_of_delivery) && ( + + )} + + )} + {patientData.last_consultation?.is_telemedicine && ( + + )} + {patientData.allergies && ( + + )}
-

- - {patientData.facility_object?.name || "-"} -

-

- {patientGender} | {patientData.blood_group || "-"} | Born on{" "} - {patientData.date_of_birth - ? formatDate(patientData.date_of_birth) - : patientData.year_of_birth} -

-
- -
-
- {t("patient_registration__contact")} -
- + +
+
+

+ {t("facility")}: +

+

+ {patientData.facility_object?.name || "-"} +

- {patientData.date_of_return && ( -
-
- Date of Return -
-
- {formatDateTime(patientData.date_of_return)} -
-
- )} - {patientData.is_vaccinated && !!patientData.number_of_doses && ( -
-
- Number of vaccine doses -
-
- {patientData.number_of_doses} -
-
- )} - {patientData.is_vaccinated && patientData.vaccine_name && ( -
-
- Vaccine name -
-
- {patientData.vaccine_name} + + {patientData?.last_consultation?.treating_physician_object && ( +
+

+ {t("treating_doctor")}: +

+
+

+ {formatName( + patientData.last_consultation + .treating_physician_object, + )} +

+

+ {!!skillsQuery.data?.results?.length && + formatSkills(skillsQuery.data?.results)} +

)} - {patientData.is_vaccinated && - patientData.last_vaccinated_date && ( -
-
- Last Vaccinated on -
-
- {formatDateTime(patientData.last_vaccinated_date)} -
-
- )} - {patientData.countries_travelled && - !!patientData.countries_travelled.length && ( -
-
- Countries travelled -
-
- {patientData.countries_travelled.join(", ")} -
-
- )} - {patientData.meta_info?.occupation && ( -
-
- {t("occupation")} -
-
- {parseOccupation(patientData.meta_info.occupation)} + {patientData?.last_consultation?.assigned_to_object && ( +
+

+ {t("assigned_doctor")}: +

+
+

+ {formatName( + patientData.last_consultation.assigned_to_object, + )} +

+ {patientData?.last_consultation?.assigned_to_object + .alt_phone_number && ( + + {" "} + {t("video_call")} + + )}
)} - {patientData.ration_card_category && ( -
-
- {t("ration_card_category")} -
-
- {t(`ration_card__${patientData.ration_card_category}`)} -
+ + {patientData.assigned_to_object && ( +
+

+ {t("assigned_volunteer")}: +

+

+ {formatName(patientData.assigned_to_object)} +

)} - {patientData.meta_info?.socioeconomic_status && ( -
-
- {t("socioeconomic_status")} -
-
- {t( - `SOCIOECONOMIC_STATUS__${patientData.meta_info.socioeconomic_status}`, - )} +
+
+
+
+ +
+
+ {patientTabs.map((tab) => ( + + {t(tab.route)} + + ))} +
+
+ +
+
+ {Tab && ( + + )} +
+
+
+
+
+ {t("actions")} +
+
+
+
+ + navigate(`/patient/${id}/investigation_reports`) + } + > + + + {t("investigations_summary")} + +
-
- )} - {patientData.meta_info?.domestic_healthcare_support && ( -
-
- {t("domestic_healthcare_support")} +
+ + navigate( + `/facility/${patientData?.facility}/patient/${id}/files`, + ) + } + > + + + {t("view_update_patient_files")} + +
-
- {t( - `DOMESTIC_HEALTHCARE_SUPPORT__${patientData.meta_info.domestic_healthcare_support}`, - )} + + {NonReadOnlyUsers && ( +
+ setOpenAssignVolunteerDialog(true)} + disabled={false} + authorizeFor={NonReadOnlyUsers} + className="w-full bg-white font-semibold text-green-800 hover:bg-secondary-200" + size="large" + > + + {" "} + {t("assign_to_volunteer")} + + +
+ )} + +
+ + handlePatientTransfer(!patientData.allow_transfer) + } + authorizeFor={NonReadOnlyUsers} + > + + + {patientData.allow_transfer + ? t("disable_transfer") + : t("allow_transfer")} + +
- )} +
-
-
-
+
+
{patientData.review_time && @@ -567,7 +563,7 @@ export const PatientHome = (props: any) => { 0 && (
{

{(dayjs().isBefore(patientData.review_time) - ? "Review before: " - : "Review Missed: ") + + ? t("review_before") + : t("review_missed")) + + ": " + formatDateTime(patientData.review_time)}

)} -
-
-
-
- Status -
-
- {patientData.is_active ? "LIVE" : "DISCHARGED"} -
-
-
-
- Last Discharged Reason + +
+
+
+
+ {t("last_discharge_reason")}
-
+
{patientData.is_active ? ( "-" ) : !patientData.last_consultation ?.new_discharge_reason ? ( {patientData?.last_consultation?.suggestion === "OP" - ? "OP file closed" - : "UNKNOWN"} + ? t("op_file_closed") + : t("unknown")} ) : patientData.last_consultation ?.new_discharge_reason === DISCHARGE_REASONS.find((i) => i.text == "Expired") ?.id ? ( - EXPIRED + + {t("expired")} + ) : ( DISCHARGE_REASONS.find( (reason) => @@ -623,31 +615,46 @@ export const PatientHome = (props: any) => {
-
-
-
- Created -
-
-
- +
+
+
+ {t("last_updated_by")}{" "} + + {patientData.last_edited?.first_name}{" "} + {patientData.last_edited?.last_name} + +
+
+
+ + {patientData.modified_date + ? formatDateTime(patientData.modified_date) + : "--:--"} + + {patientData.modified_date + ? relativeDate(patientData.modified_date) + : "--:--"}
-
-
- Last Edited -
-
-
- +
+
+ {t("patient_profile_created_by")}{" "} + + {patientData.created_by?.first_name}{" "} + {patientData.created_by?.last_name} + +
+
+
+ + {patientData.created_date + ? formatDateTime(patientData.created_date) + : "--:--"} + + {patientData.modified_date + ? relativeDate(patientData.modified_date) + : "--:--"}
@@ -659,784 +666,40 @@ export const PatientHome = (props: any) => {
navigate(`/death_report/${id}`)} > - Death Report + {t("death_report")}
)} -
- { - const showAllFacilityUsers = [ - "DistrictAdmin", - "StateAdmin", - ]; - if ( - !showAllFacilityUsers.includes(authUser.user_type) && - authUser.home_facility_object?.id !== - patientData.facility - ) { - Notification.Error({ - msg: "Oops! Non-Home facility users don't have permission to perform this action.", - }); - } else { - navigate( - `/facility/${patientData?.facility}/patient/${id}/update`, - ); - } - }} - > - - Update Details - -
-
- - handlePatientTransfer(!patientData.allow_transfer) - } - authorizeFor={NonReadOnlyUsers} - > - - {patientData.allow_transfer - ? "Disable Transfer" - : "Allow Transfer"} - -
-
-
-
-
-
-
{ - setShowShifts(!showShifts); - setIsShiftClicked(true); - }} - > -
{t("shifting")}
- {showShifts ? ( - - ) : ( - - )} -
-
- {activeShiftingData?.count ? ( - activeShiftingData.results.map((shift: ShiftingModel) => ( -
-
-
-
-
-
- {shift.emergency && ( - - Emergency - - )} -
-
-
-
-
- -
- {shift.status} -
- -
-
-
- -
- {(shift.origin_facility_object || {})?.name} -
- -
-
-
- -
- { - ( - shift.shifting_approving_facility_object || - {} - )?.name - } -
- -
-
-
- -
- {(shift.assigned_facility_object || {})?.name || - "Yet to be decided"} -
- -
- -
-
- -
- {formatDateTime(shift.modified_date) || "--"} -
- -
-
-
- -
- - navigate(`/shifting/${shift.external_id}`) - } - > - - All Details - -
- {shift.status === "COMPLETED" && - shift.assigned_facility && ( -
- setModalFor(shift)} - > - {t("transfer_to_receiving_facility")} - - setModalFor(undefined)} - onConfirm={() => handleTransferComplete(shift)} - /> -
- )} -
-
-
- )) - ) : ( -
- {isShiftDataLoading ? "Loading..." : "No Shifting Records!"} -
- )} -
-
- -
-
-
-
- {t("location")} -
-
-
-
- {t("address")} -
-
- {patientData.address || "-"} -
-
-
-
- {t("district")} -
-
- {patientData.district_object?.name || "-"} -
-
-
-
- Village -
-
- {patientData.village || "-"} -
-
-
-
- {t("ward")} -
-
- {(patientData.ward_object && - patientData.ward_object.number + - ", " + - patientData.ward_object.name) || - "-"} -
-
-
-
- State, Country - Pincode -
-
- {patientData?.state_object?.name}, - {patientData.nationality || "-"} - {patientData.pincode} -
-
-
-
- {t("local_body")} -
-
- {patientData.local_body_object?.name || "-"} -
-
-
-
-
- Medical -
- {!patientData.present_health && - !patientData.allergies && - !patientData.ongoing_medication && - !(patientData.gender === 2 && patientData.is_antenatal) && - !patientData.medical_history?.some( - (history) => history.disease !== "NO", - ) && ( -
- No Medical History Available -
- )} -
- {patientData.present_health && ( -
-
- Present Health -
-
- {patientData.present_health} -
-
- )} - {patientData.ongoing_medication && ( -
-
- Ongoing Medications -
-
- {patientData.ongoing_medication} -
-
- )} - {patientData.allergies && ( -
-
- Allergies -
-
- {patientData.allergies} -
-
- )} - {patientData.gender === 2 && patientData.is_antenatal && ( -
-
- Is pregnant -
-
- Yes -
-
- )} - {patientMedHis} -
-
-
- - 1 - } - /> -
-
-
-
-
navigate(`/patient/${id}/investigation_reports`)} - > -
-
- - - -
-
-

- Investigations Summary -

-
-
-
-
- navigate( - `/facility/${patientData?.facility}/patient/${id}/files/`, - ) - } - > -
-
- - - -
-
-

- View/Upload Patient Files -

-
-
-
-
{ - if (!isPatientInactive(patientData, facilityId)) { - navigate(`/facility/${facilityId}/patient/${id}/shift/new`); - } - }} - > -
-
- - - -
- -
-

- Shift Patient -

-
-
-
-
{ - if (!isPatientInactive(patientData, facilityId)) { - navigate( - `/facility/${patientData?.facility}/patient/${id}/sample-test`, - ); - } - }} - > -
-
- - - -
-
-

- Request Sample Test -

-
-
-
-
- navigate( - `/facility/${patientData?.facility}/patient/${id}/notes`, - ) - } - > -
-
- - - -
-
-

- View Patient Notes -

-
-
-
-
{ - if (!isPatientInactive(patientData, facilityId)) { - setOpenAssignVolunteerDialog(true); - } - }} - > -
-
- - - -
-
-

- Assign to a volunteer -

-
-
-
-
-
-
-
-
-
- - navigate(`/patient/${id}/investigation_reports`) - } - > - - - Investigations Summary - - -
-
- - navigate( - `/facility/${patientData?.facility}/patient/${id}/files`, - ) - } - > - - - View/Upload Patient Files - - -
-
- - navigate( - `/facility/${facilityId}/patient/${id}/shift/new`, - ) - } - authorizeFor={NonReadOnlyUsers} - > - - - Shift Patient - - -
-
- - navigate( - `/facility/${patientData?.facility}/patient/${id}/sample-test`, - ) - } - authorizeFor={NonReadOnlyUsers} - id="sample-request-btn" - > - - - Request Sample Test - - -
-
- - navigate( - `/facility/${patientData?.facility}/patient/${id}/notes`, - ) - } - > - - - View Patient Notes - - -
-
- setOpenAssignVolunteerDialog(true)} - disabled={false} - authorizeFor={NonReadOnlyUsers} - > - - - Assign to a volunteer - - -
-
-
-
-
+
setOpenAssignVolunteerDialog(false)} description={
setAssignedVolunteer(user.value)} userType={"Volunteer"} name={"assign_volunteer"} error={errors.assignedVolunteer} />
} - action="Assign" + action={t("assign")} onConfirm={handleAssignedVolunteer} /> - -
-

- Consultation History -

- - - {(_) => ( -
- - - - -
-
- No Consultation History Available -
-
-
- > - {(item) => ( - - )} - -
- -
-
- )} -
-
- -
-

- Sample Test History -

- - {(_, query) => ( -
- - - - -
-
- No Sample Test History Available -
-
-
- > - {(item) => ( - - )} - -
- -
-
- )} -
-
); }; diff --git a/src/components/Patient/PatientInfoCard.tsx b/src/components/Patient/PatientInfoCard.tsx index e415d928a0d..486e8b103fd 100644 --- a/src/components/Patient/PatientInfoCard.tsx +++ b/src/components/Patient/PatientInfoCard.tsx @@ -538,7 +538,7 @@ export default function PatientInfoCard(props: PatientInfoCardProps) { )} {!!consultation?.discharge_date && (
-
+
Discharge Reason
diff --git a/src/components/Patient/PatientRegister.tsx b/src/components/Patient/PatientRegister.tsx index 5cc958d44de..5828517adf9 100644 --- a/src/components/Patient/PatientRegister.tsx +++ b/src/components/Patient/PatientRegister.tsx @@ -2,7 +2,7 @@ import careConfig from "@careConfig"; import { startCase, toLower } from "lodash-es"; import { debounce } from "lodash-es"; import { navigate } from "raviger"; -import { useCallback, useReducer, useRef, useState } from "react"; +import { useCallback, useEffect, useReducer, useRef, useState } from "react"; import { useTranslation } from "react-i18next"; import CareIcon from "@/CAREUI/icons/CareIcon"; @@ -22,6 +22,7 @@ import TransferPatientDialog from "@/components/Facility/TransferPatientDialog"; import { DistrictModel, DupPatientModel, + FacilityModel, WardModel, } from "@/components/Facility/models"; import { @@ -51,6 +52,7 @@ import { PatientMeta, PatientModel, } from "@/components/Patient/models"; +import { UserModel } from "@/components/Users/models"; import useAppHistory from "@/hooks/useAppHistory"; import useAuthUser from "@/hooks/useAuthUser"; @@ -67,7 +69,7 @@ import { } from "@/common/constants"; import countryList from "@/common/static/countries.json"; import { statusType, useAbortableEffect } from "@/common/utils"; -import { validatePincode } from "@/common/validation"; +import { validateName, validatePincode } from "@/common/validation"; import { PLUGIN_Component } from "@/PluginEngine"; import { RestoreDraftButton } from "@/Utils/AutoSave"; @@ -230,6 +232,25 @@ export const PatientRegister = (props: PatientRegisterProps) => { const headerText = !id ? "Add Details of Patient" : "Update Patient Details"; const buttonText = !id ? "Add Patient" : "Save Details"; + useEffect(() => { + const getQueryParams = () => { + const params = new URLSearchParams(window.location.search); + return { + section: params.get("section"), + }; + }; + + const { section } = getQueryParams(); + if (section) { + setTimeout(() => { + const element = document.getElementById(section); + if (element) { + element.scrollIntoView({ behavior: "smooth" }); + } + }, 2000); + } + }, []); + const fetchDistricts = useCallback(async (id: number) => { if (id > 0) { setIsDistrictLoading(true); @@ -419,8 +440,16 @@ export const PatientRegister = (props: PatientRegisterProps) => { Object.keys(form).forEach((field) => { let phoneNumber, emergency_phone_number; switch (field) { + case "name": { + const requiredError = RequiredFieldValidator()(form[field]); + if (requiredError) { + errors[field] = requiredError; + } else if (!validateName(form[field])) { + errors[field] = t("min_char_length_error", { min_length: 3 }); + } + return; + } case "address": - case "name": case "gender": errors[field] = RequiredFieldValidator()(form[field]); return; @@ -814,31 +843,12 @@ export const PatientRegister = (props: PatientRegisterProps) => { return ; } - const PatientRegisterAuth = () => { - const showAllFacilityUsers = ["DistrictAdmin", "StateAdmin"]; - if ( - !showAllFacilityUsers.includes(authUser.user_type) && - authUser.home_facility_object?.id === facilityId - ) { - return true; - } - if ( - authUser.user_type === "DistrictAdmin" && - authUser.district === facilityObject?.district - ) { - return true; - } - if ( - authUser.user_type === "StateAdmin" && - authUser.state === facilityObject?.state - ) { - return true; - } - - return false; - }; - - if (!isLoading && facilityId && facilityObject && !PatientRegisterAuth()) { + if ( + !isLoading && + facilityId && + facilityObject && + !patientRegisterAuth(authUser, facilityObject, facilityId) + ) { return ; } @@ -1411,7 +1421,7 @@ export const PatientRegister = (props: PatientRegisterProps) => {
{field("nationality").value === "India" && ( -
+
{
)} -
+
{
-
+

Medical History

@@ -1670,7 +1683,10 @@ export const PatientRegister = (props: PatientRegisterProps) => {
-
+

Insurance Details @@ -1713,3 +1729,31 @@ export const PatientRegister = (props: PatientRegisterProps) => { ); }; + +export function patientRegisterAuth( + authUser: UserModel, + facilityObject: FacilityModel | undefined, + facilityId: string, +) { + const showAllFacilityUsers = ["DistrictAdmin", "StateAdmin"]; + if ( + !showAllFacilityUsers.includes(authUser.user_type) && + authUser.home_facility_object?.id === facilityId + ) { + return true; + } + if ( + authUser.user_type === "DistrictAdmin" && + authUser.district === facilityObject?.district + ) { + return true; + } + if ( + authUser.user_type === "StateAdmin" && + authUser.state === facilityObject?.state + ) { + return true; + } + + return false; +} diff --git a/src/components/Patient/SampleDetails.tsx b/src/components/Patient/SampleDetails.tsx index c5282a65c1f..edc0b4d53a6 100644 --- a/src/components/Patient/SampleDetails.tsx +++ b/src/components/Patient/SampleDetails.tsx @@ -477,7 +477,11 @@ export const SampleDetails = ({ id }: DetailRoute) => {

{t("sample_test_history")}

{sampleDetails?.flow && - sampleDetails.flow.map((flow: FlowModel) => renderFlow(flow))} + sampleDetails.flow.map((flow: FlowModel) => ( +
+ {renderFlow(flow)} +
+ ))}
void; handleApproval: (status: number, sample: SampleTestModel) => void; diff --git a/src/components/Patient/models.tsx b/src/components/Patient/models.tsx index 15063be4e9c..85614e707d5 100644 --- a/src/components/Patient/models.tsx +++ b/src/components/Patient/models.tsx @@ -136,7 +136,7 @@ export interface PatientModel { is_declared_positive?: boolean; last_edited?: UserBareMinimum; created_by?: UserBareMinimum; - assigned_to?: { first_name?: string; username?: string; last_name?: string }; + assigned_to?: number | null; assigned_to_object?: AssignedToObjectModel; occupation?: Occupation; meta_info?: PatientMeta; diff --git a/src/components/Resource/ResourceList.tsx b/src/components/Resource/ResourceList.tsx index 6eecf7fcef2..891c2f3378b 100644 --- a/src/components/Resource/ResourceList.tsx +++ b/src/components/Resource/ResourceList.tsx @@ -189,7 +189,7 @@ export default function ListView() { return (
- advancedFilter.setShow(true)} - /> {t("board_view")} + advancedFilter.setShow(true)} + />
} diff --git a/src/components/Shifting/ShiftingBlock.tsx b/src/components/Shifting/ShiftingBlock.tsx index 09bbcfb3b9f..db173b2c6d8 100644 --- a/src/components/Shifting/ShiftingBlock.tsx +++ b/src/components/Shifting/ShiftingBlock.tsx @@ -13,7 +13,7 @@ import { classNames, formatDateTime, formatName } from "@/Utils/utils"; export default function ShiftingBlock(props: { shift: ShiftingModel; - onTransfer: () => unknown; + onTransfer?: () => unknown; }) { const { shift, onTransfer } = props; const { t } = useTranslation(); @@ -123,25 +123,28 @@ export default function ShiftingBlock(props: { {t("all_details")} - {shift.status === "COMPLETED" && shift.assigned_facility && ( - <> - - - )} + {shift.status === "COMPLETED" && + shift.assigned_facility && + onTransfer && ( + <> + + + )}

); diff --git a/src/components/Shifting/ShiftingList.tsx b/src/components/Shifting/ShiftingList.tsx index d4746ad434b..7161ea29441 100644 --- a/src/components/Shifting/ShiftingList.tsx +++ b/src/components/Shifting/ShiftingList.tsx @@ -1,29 +1,25 @@ -import careConfig from "@careConfig"; import { navigate } from "raviger"; -import { useState } from "react"; import { useTranslation } from "react-i18next"; import CareIcon from "@/CAREUI/icons/CareIcon"; import { AdvancedFilterButton } from "@/CAREUI/interactive/FiltersSlideover"; import ButtonV2 from "@/components/Common/ButtonV2"; -import ConfirmDialog from "@/components/Common/ConfirmDialog"; import { ExportButton } from "@/components/Common/Export"; import Loading from "@/components/Common/Loading"; import Page from "@/components/Common/Page"; -import { ShiftingModel } from "@/components/Facility/models"; import SearchInput from "@/components/Form/SearchInput"; import BadgesList from "@/components/Shifting/ShiftingBadges"; import { formatFilter } from "@/components/Shifting/ShiftingCommons"; import ListFilter from "@/components/Shifting/ShiftingFilters"; -import useAuthUser from "@/hooks/useAuthUser"; import useFilters from "@/hooks/useFilters"; import routes from "@/Utils/request/api"; import request from "@/Utils/request/request"; import useQuery from "@/Utils/request/useQuery"; -import { formatDateTime } from "@/Utils/utils"; + +import ShiftingTable from "./ShiftingTable"; export default function ListView() { const { @@ -35,31 +31,7 @@ export default function ListView() { resultsPerPage, } = useFilters({ cacheBlacklist: ["patient_name"] }); - const [modalFor, setModalFor] = useState<{ - externalId: string | undefined; - loading: boolean; - }>({ - externalId: undefined, - loading: false, - }); - - const authUser = useAuthUser(); const { t } = useTranslation(); - - const handleTransferComplete = async (shift: ShiftingModel) => { - setModalFor({ ...modalFor, loading: true }); - try { - await request(routes.completeTransfer, { - pathParams: { externalId: shift.external_id }, - }); - navigate( - `/facility/${shift.assigned_facility}/patient/${shift.patient}/consultation`, - ); - } catch (error) { - setModalFor({ externalId: undefined, loading: false }); - } - }; - const { data: shiftData, loading, @@ -71,179 +43,6 @@ export default function ListView() { }), }); - const showShiftingCardList = (data: ShiftingModel[]) => { - if (loading) { - return ; - } - if (data && !data.length) { - return ( -
- {t("no_patients_to_show")} -
- ); - } - - return data.map((shift: ShiftingModel) => ( -
-
-
-
- {shift.patient_object.name} -
-
- {shift.patient_object.age} -
-
- -
-
-
- -
- {shift.patient_object.phone_number || ""} -
- -
-
-
- -
- {shift.patient_object.address || "--"} -
- -
-
- -
-
-
- -
{shift.status}
- - -
- {shift.emergency && ( - - {t("emergency")} - - )} -
-
- -
-
- -
- {formatDateTime(shift.modified_date) || "--"} -
- -
-
- -
-
- -
- {shift.origin_facility_object?.name} -
- - - {careConfig.wartimeShifting && ( -
- -
- {shift.shifting_approving_facility_object?.name} -
- - )} - -
- -
- {shift.assigned_facility_external || - shift.assigned_facility_object?.name || - t("yet_to_be_decided")} -
- -
-
- navigate(`/shifting/${shift.external_id}`)} - variant="secondary" - border - className="w-full" - > - {t("all_details")} - - {shift.status === "COMPLETED" && shift.assigned_facility && ( -
- - setModalFor({ - externalId: shift.external_id, - loading: false, - }) - } - > - {t("transfer_to_receiving_facility")} - - - setModalFor({ externalId: undefined, loading: false }) - } - onConfirm={() => handleTransferComplete(shift)} - /> -
- )} -
-
-
- )); - }; - return (
- advancedFilter.setShow(true)} - /> navigate("/shifting/board", { query: qParams })} @@ -284,11 +80,15 @@ export default function ListView() { {t("board_view")} + advancedFilter.setShow(true)} + />
} > +
{loading ? ( @@ -307,27 +107,7 @@ export default function ListView() { {t("refresh_list")}
-
-
-
- {t("patients")} -
-
- {t("contact_info")} -
-
- {t("consent__status")} -
-
- {t("facilities")} -
-
- {t("LOG_UPDATE_FIELD_LABEL__action")} -
-
-
{showShiftingCardList(shiftData?.results || [])}
-
- +
diff --git a/src/components/Shifting/ShiftingTable.tsx b/src/components/Shifting/ShiftingTable.tsx new file mode 100644 index 00000000000..de186a13d56 --- /dev/null +++ b/src/components/Shifting/ShiftingTable.tsx @@ -0,0 +1,261 @@ +import careConfig from "@careConfig"; +import { navigate } from "raviger"; +import { useState } from "react"; +import { useTranslation } from "react-i18next"; + +import { cn } from "@/lib/utils"; + +import CareIcon from "@/CAREUI/icons/CareIcon"; + +import useAuthUser from "@/hooks/useAuthUser"; + +import routes from "@/Utils/request/api"; +import request from "@/Utils/request/request"; +import { formatDateTime } from "@/Utils/utils"; + +import ButtonV2 from "../Common/ButtonV2"; +import ConfirmDialog from "../Common/ConfirmDialog"; +import Loading from "../Common/Loading"; +import { ShiftingModel } from "../Facility/models"; + +export default function ShiftingTable(props: { + data?: ShiftingModel[]; + loading?: boolean; + hidePatient?: boolean; +}) { + const { data, loading, hidePatient } = props; + + const { t } = useTranslation(); + const authUser = useAuthUser(); + const [modalFor, setModalFor] = useState<{ + externalId: string | undefined; + loading: boolean; + }>({ + externalId: undefined, + loading: false, + }); + + const handleTransferComplete = async (shift: ShiftingModel) => { + setModalFor({ ...modalFor, loading: true }); + try { + await request(routes.completeTransfer, { + pathParams: { externalId: shift.external_id }, + }); + navigate( + `/facility/${shift.assigned_facility}/patient/${shift.patient}/consultation`, + ); + } catch (error) { + setModalFor({ externalId: undefined, loading: false }); + } + }; + + if (loading) { + return ; + } + if (data && !data.length) { + return ( +
+ {t("no_results_found")} +
+ ); + } + + return ( +
+
+ {!hidePatient && ( +
+ {t("patients")} +
+ )} +
+ {t("contact_info")} +
+
+ {t("consent__status")} +
+
+ {t("facilities")} +
+
+ {t("LOG_UPDATE_FIELD_LABEL__action")} +
+
+
+ {data?.map((shift: ShiftingModel) => ( +
+
+ {!hidePatient && ( +
+
+ {shift.patient_object.name} +
+
+ {shift.patient_object.age} +
+
+ )} + +
+
+
+ +
+ {shift.patient_object.phone_number || ""} +
+ +
+
+
+ +
+ {shift.patient_object.address || "--"} +
+ +
+
+ +
+
+
+ +
{shift.status}
+ + +
+ {shift.emergency && ( + + {t("emergency")} + + )} +
+
+ +
+
+ +
+ {formatDateTime(shift.modified_date) || "--"} +
+ +
+
+ +
+
+ +
+ {shift.origin_facility_object?.name} +
+ + + {careConfig.wartimeShifting && ( +
+ +
+ {shift.shifting_approving_facility_object?.name} +
+ + )} + +
+ +
+ {shift.assigned_facility_external || + shift.assigned_facility_object?.name || + t("yet_to_be_decided")} +
+ +
+
+ navigate(`/shifting/${shift.external_id}`)} + variant="secondary" + border + className="w-full" + > + {t("all_details")} + + {shift.status === "COMPLETED" && shift.assigned_facility && ( +
+ + setModalFor({ + externalId: shift.external_id, + loading: false, + }) + } + > + {t("transfer_to_receiving_facility")} + + + setModalFor({ externalId: undefined, loading: false }) + } + onConfirm={() => handleTransferComplete(shift)} + /> +
+ )} +
+
+
+ ))} +
+
+ ); +} diff --git a/src/components/Users/ManageUsers.tsx b/src/components/Users/ManageUsers.tsx index 0b6a9149dbb..a1c00e5eaef 100644 --- a/src/components/Users/ManageUsers.tsx +++ b/src/components/Users/ManageUsers.tsx @@ -250,7 +250,7 @@ export default function ManageUsers() {
{formatName(user)} diff --git a/src/components/Users/UserAdd.tsx b/src/components/Users/UserAdd.tsx index 4c6c5edde2a..bfd38d2cae2 100644 --- a/src/components/Users/UserAdd.tsx +++ b/src/components/Users/UserAdd.tsx @@ -415,7 +415,7 @@ export const UserAdd = (props: UserProps) => { .join(" ")} is required`; invalidForm = true; } else if (!validateName(state.form[field])) { - errors[field] = "Please enter a valid name"; + errors[field] = t("min_char_length_error", { min_length: 3 }); invalidForm = true; } return; diff --git a/src/components/Users/UserProfile.tsx b/src/components/Users/UserProfile.tsx index 15cedafab2e..7b0df12cac0 100644 --- a/src/components/Users/UserProfile.tsx +++ b/src/components/Users/UserProfile.tsx @@ -36,7 +36,6 @@ import request from "@/Utils/request/request"; import uploadFile from "@/Utils/request/uploadFile"; import useQuery from "@/Utils/request/useQuery"; import { - classNames, dateQueryString, formatDate, formatDisplayName, @@ -1006,31 +1005,34 @@ export default function UserProfile() {

- {updateStatus.isUpdateAvailable && ( - - +
+ {updateStatus.isChecking ? ( + // While checking for updates +
- - {t("update_available")} + + {t("checking_for_update")}
- - )} -
- {!updateStatus.isUpdateAvailable && ( - - {" "} + ) : updateStatus.isUpdateAvailable ? ( + // When an update is available + + +
+ + {t("update_available")} +
+
+
+ ) : ( + // Default state to check for updates +
- - {updateStatus.isChecking - ? t("checking_for_update") - : t("check_for_update")} + + {t("check_for_update")}
)} diff --git a/src/hooks/useFileUpload.tsx b/src/hooks/useFileUpload.tsx index 56f0d337a5e..d580ad7d557 100644 --- a/src/hooks/useFileUpload.tsx +++ b/src/hooks/useFileUpload.tsx @@ -249,6 +249,11 @@ export default function useFileUpload( setUploadFileNames([]); }; + const clearFiles = () => { + setFiles([]); + setUploadFileNames([]); + }; + const Dialogues = ( <> { setFiles((prev) => [...prev, file]); }} + onResetCapture={clearFiles} /> prev.filter((_, i) => i !== index)); setUploadFileNames((prev) => prev.filter((_, i) => i !== index)); }, - clearFiles: () => { - setFiles([]); - setUploadFileNames([]); - }, + clearFiles, uploading, }; } diff --git a/vite.config.mts b/vite.config.mts index ca92aa50954..3fc64d66829 100644 --- a/vite.config.mts +++ b/vite.config.mts @@ -111,7 +111,12 @@ export default defineConfig(({ mode }) => { REACT_SENTRY_DSN: z.string().url().optional(), REACT_SENTRY_ENVIRONMENT: z.string().optional(), - REACT_PLAUSIBLE_SITE_DOMAIN: z.string().url().optional(), + REACT_PLAUSIBLE_SITE_DOMAIN: z + .string() + .regex(/^[a-zA-Z0-9][a-zA-Z0-9-_.]*\.[a-zA-Z]{2,}$/) + .optional() + .describe("Domain name without protocol (e.g., sub.domain.com)"), + REACT_PLAUSIBLE_SERVER_URL: z.string().url().optional(), REACT_CDN_URLS: z .string()