diff --git a/.eslintrc.json b/.eslintrc.json index a2f7b667856..0fc2f64ddaf 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -12,7 +12,6 @@ "extends": [ "eslint:recommended", "plugin:react-hooks/recommended", - "plugin:prettier/recommended", "plugin:@typescript-eslint/eslint-recommended", "plugin:@typescript-eslint/recommended", "plugin:i18next/recommended", diff --git a/cypress/e2e/patient_spec/patient_registration.cy.ts b/cypress/e2e/patient_spec/patient_registration.cy.ts index 17c9b0b3679..f94dbbe46cd 100644 --- a/cypress/e2e/patient_spec/patient_registration.cy.ts +++ b/cypress/e2e/patient_spec/patient_registration.cy.ts @@ -254,7 +254,7 @@ describe("Patient Creation with consultation", () => { }); it("Patient Registration using the transfer with no consultation", () => { - // transfer the patient and no consulation + // transfer the patient with no consulation and verify the transfer to a new facility patientPage.createPatient(); patientPage.selectFacility(patientTransferFacility); patientPage.patientformvisibility(); @@ -264,9 +264,10 @@ describe("Patient Creation with consultation", () => { patientTransfer.clickTransferPatientNameList(patientTransferName); patientTransfer.clickTransferPatientYOB(yearOfBirth); patientTransfer.clickTransferSubmitButton(); - patientTransfer.verifyFacilitySuccessfullMessage(); + cy.verifyNotification( + "Patient Dummy Patient 10 (Male) transferred successfully", + ); patientTransfer.clickConsultationCancelButton(); - cy.wait(3000); // allow the transfer button of a patient patientTransfer.clickAllowPatientTransferButton(); // Verify the patient error message for the same facility @@ -280,7 +281,9 @@ describe("Patient Creation with consultation", () => { patientTransfer.clickTransferPatientNameList(patientTransferName); patientTransfer.clickTransferPatientYOB(yearOfBirth); patientTransfer.clickTransferSubmitButton(); - patientTransfer.verifyFacilityErrorMessage(); + cy.verifyNotification( + "Patient - Patient transfer cannot be completed because the patient has an active consultation in the same facility", + ); }); it("Patient Registration using External Result Import", () => { diff --git a/cypress/pageobject/Patient/PatientTransfer.ts b/cypress/pageobject/Patient/PatientTransfer.ts index 4c884ee2427..0bdd55e9880 100644 --- a/cypress/pageobject/Patient/PatientTransfer.ts +++ b/cypress/pageobject/Patient/PatientTransfer.ts @@ -19,44 +19,18 @@ class PatientTransfer { clickTransferSubmitButton() { cy.get("#submit-transferpatient").click(); + cy.wait(2000); } clickConsultationCancelButton() { cy.get("#cancel").scrollIntoView(); cy.get("#cancel").click(); + cy.wait(2000); } clickAllowPatientTransferButton() { cy.get("#patient-allow-transfer").click(); } - - verifyFacilitySuccessfullMessage() { - cy.get(".pnotify") - .should("exist") - .within(() => { - cy.get(".pnotify-text") - .invoke("text") - .then((text) => { - expect(text.trim()).to.match( - /^Patient Dummy Patient 10 \(Male\) transferred successfully$/i, - ); - }); - }); - } - - verifyFacilityErrorMessage() { - cy.get(".pnotify") - .should("exist") - .within(() => { - cy.get(".pnotify-text") - .invoke("text") - .then((text) => { - expect(text).to.match( - /Patient - Patient transfer cannot be completed because the patient has an active consultation in the same facility/, - ); - }); - }); - } } export default PatientTransfer; diff --git a/cypress/support/index.ts b/cypress/support/index.ts index 9ddfd0c819a..c9af6a02c96 100644 --- a/cypress/support/index.ts +++ b/cypress/support/index.ts @@ -1,3 +1,4 @@ +/// import "./commands"; declare global { diff --git a/package-lock.json b/package-lock.json index 93346b978e6..2458c891d41 100644 --- a/package-lock.json +++ b/package-lock.json @@ -72,6 +72,7 @@ "@tailwindcss/container-queries": "^0.1.1", "@tailwindcss/forms": "^0.5.7", "@tailwindcss/typography": "^0.5.13", + "@types/cypress": "^1.1.3", "@types/echarts": "^4.9.22", "@types/google.maps": "^3.55.8", "@types/lodash-es": "^4.17.12", @@ -87,7 +88,7 @@ "@typescript-eslint/parser": "^5.61.0", "@vitejs/plugin-react-swc": "^3.6.0", "autoprefixer": "^10.4.19", - "cypress": "^13.9.0", + "cypress": "^13.13.1", "cypress-localstorage-commands": "^2.2.5", "cypress-split": "^1.23.2", "eslint": "^8.44.0", @@ -6222,6 +6223,16 @@ "@types/node": "*" } }, + "node_modules/@types/cypress": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/@types/cypress/-/cypress-1.1.3.tgz", + "integrity": "sha512-OXe0Gw8LeCflkG1oPgFpyrYWJmEKqYncBsD/J0r17r0ETx/TnIGDNLwXt/pFYSYuYTpzcq1q3g62M9DrfsBL4g==", + "deprecated": "This is a stub types definition for cypress (https://cypress.io). cypress provides its own type definitions, so you don't need @types/cypress installed!", + "dev": true, + "dependencies": { + "cypress": "*" + } + }, "node_modules/@types/debug": { "version": "4.1.12", "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.12.tgz", @@ -9129,9 +9140,9 @@ "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==" }, "node_modules/cypress": { - "version": "13.9.0", - "resolved": "https://registry.npmjs.org/cypress/-/cypress-13.9.0.tgz", - "integrity": "sha512-atNjmYfHsvTuCaxTxLZr9xGoHz53LLui3266WWxXJHY7+N6OdwJdg/feEa3T+buez9dmUXHT1izCOklqG82uCQ==", + "version": "13.13.1", + "resolved": "https://registry.npmjs.org/cypress/-/cypress-13.13.1.tgz", + "integrity": "sha512-8F9UjL5MDUdgC/S5hr8CGLHbS5gGht5UOV184qc2pFny43fnkoaKxlzH/U6//zmGu/xRTaKimNfjknLT8+UDFg==", "dev": true, "hasInstallScript": true, "dependencies": { @@ -9174,7 +9185,7 @@ "request-progress": "^3.0.0", "semver": "^7.5.3", "supports-color": "^8.1.1", - "tmp": "~0.2.1", + "tmp": "~0.2.3", "untildify": "^4.0.0", "yauzl": "^2.10.0" }, diff --git a/package.json b/package.json index 59fd5cd89e8..aa8d3f5df01 100644 --- a/package.json +++ b/package.json @@ -112,6 +112,7 @@ "@tailwindcss/container-queries": "^0.1.1", "@tailwindcss/forms": "^0.5.7", "@tailwindcss/typography": "^0.5.13", + "@types/cypress": "^1.1.3", "@types/echarts": "^4.9.22", "@types/google.maps": "^3.55.8", "@types/lodash-es": "^4.17.12", @@ -127,7 +128,7 @@ "@typescript-eslint/parser": "^5.61.0", "@vitejs/plugin-react-swc": "^3.6.0", "autoprefixer": "^10.4.19", - "cypress": "^13.9.0", + "cypress": "^13.13.1", "cypress-localstorage-commands": "^2.2.5", "cypress-split": "^1.23.2", "eslint": "^8.44.0", diff --git a/src/Components/Facility/ConsultationDetails/index.tsx b/src/Components/Facility/ConsultationDetails/index.tsx index 0b0d2c01a50..62d3232729a 100644 --- a/src/Components/Facility/ConsultationDetails/index.tsx +++ b/src/Components/Facility/ConsultationDetails/index.tsx @@ -205,8 +205,10 @@ export const ConsultationDetails = (props: any) => { } const tabButtonClasses = (selected: boolean) => - `capitalize min-w-max-content cursor-pointer border-transparent text-secondary-700 hover:text-secondary-700 hover:border-secondary-300 font-bold whitespace-nowrap ${ - selected === true ? "border-primary-500 text-primary-600 border-b-2" : "" + `capitalize min-w-max-content cursor-pointer font-bold whitespace-nowrap ${ + selected === true + ? "border-primary-500 hover:border-secondary-300 text-primary-600 border-b-2" + : "text-secondary-700 hover:text-secondary-700" }`; return ( diff --git a/src/Components/Facility/Consultations/Mews.tsx b/src/Components/Facility/Consultations/Mews.tsx index 9773e9ce7a8..b3960e171c2 100644 --- a/src/Components/Facility/Consultations/Mews.tsx +++ b/src/Components/Facility/Consultations/Mews.tsx @@ -73,7 +73,7 @@ export const Mews = ({ dailyRound }: { dailyRound: DailyRoundsModel }) => { return ( <>
-
+
-
diff --git a/src/Components/Facility/CoverImageEditModal.tsx b/src/Components/Facility/CoverImageEditModal.tsx index cbf976aafe4..319ae60fd1b 100644 --- a/src/Components/Facility/CoverImageEditModal.tsx +++ b/src/Components/Facility/CoverImageEditModal.tsx @@ -390,7 +390,7 @@ const CoverImageEditModal = ({ setIsCameraOpen(false); webRef.current.stopCamera(); }} - className="border-grey-200 my-2 w-full border-2" + className="my-2 w-full" > {t("close")} diff --git a/src/Components/Facility/DischargeModal.tsx b/src/Components/Facility/DischargeModal.tsx index a85439bfa55..2311ffd7bc4 100644 --- a/src/Components/Facility/DischargeModal.tsx +++ b/src/Components/Facility/DischargeModal.tsx @@ -222,9 +222,13 @@ const DischargeModal = ({ title={

Discharge patient from CARE

- + -

Caution: this action is irreversible.

+

+ {new_discharge_reason === 3 // Expired + ? "Caution: Once a patient is marked as expired, the patient file cannot be transferred or edited. Please proceed with caution." + : "Caution: This action is irrevesible. Please proceed with caution."} +

} diff --git a/src/Components/Facility/FacilityHome.tsx b/src/Components/Facility/FacilityHome.tsx index f53fa43efa8..0a885c0b6e3 100644 --- a/src/Components/Facility/FacilityHome.tsx +++ b/src/Components/Facility/FacilityHome.tsx @@ -445,19 +445,6 @@ export const FacilityHome = (props: any) => { View Patients - - navigate(`/facility/${facilityId}/discharged-patients`) - } - > - - View Discharged Patients -
diff --git a/src/Components/Facility/HospitalList.tsx b/src/Components/Facility/HospitalList.tsx index 63a76e5998a..b59a1a2c5db 100644 --- a/src/Components/Facility/HospitalList.tsx +++ b/src/Components/Facility/HospitalList.tsx @@ -137,7 +137,7 @@ export const HospitalList = () => { ) : (
navigate("/facility/create")} > diff --git a/src/Components/Facility/TransferPatientDialog.tsx b/src/Components/Facility/TransferPatientDialog.tsx index 05d08635b01..3ead082c610 100644 --- a/src/Components/Facility/TransferPatientDialog.tsx +++ b/src/Components/Facility/TransferPatientDialog.tsx @@ -58,7 +58,12 @@ const TransferPatientDialog = (props: Props) => { const patientOptions: Array = patientList.map((patient) => { return { id: patient.patient_id as unknown as number, - text: `${patient.name} (${patient.gender})`, + text: [ + patient.name, + `(${patient.gender})`, + patient.is_expired ? "(Expired)" : "", + ].join(" "), + disabled: patient.is_expired, }; }); @@ -171,6 +176,7 @@ const TransferPatientDialog = (props: Props) => { options={patientOptions} optionLabel={(patient) => patient.text} optionValue={(patient) => patient.id} + optionDisabled={(patient) => patient.disabled ?? false} value={state.form.patient} onChange={handleChange} error={state.errors.patient} diff --git a/src/Components/Facility/models.tsx b/src/Components/Facility/models.tsx index 4114c61dee0..f93d95448a5 100644 --- a/src/Components/Facility/models.tsx +++ b/src/Components/Facility/models.tsx @@ -208,6 +208,7 @@ export interface DupPatientModel { date_of_birth: string; year_of_birth: number; state_id: number; + is_expired: boolean; } export interface InventoryItemsModel { diff --git a/src/Components/Form/MultiSelectMenuV2.tsx b/src/Components/Form/MultiSelectMenuV2.tsx index ac180a88fca..9ab2f4d55c7 100644 --- a/src/Components/Form/MultiSelectMenuV2.tsx +++ b/src/Components/Form/MultiSelectMenuV2.tsx @@ -158,10 +158,10 @@ const MultiSelectMenuV2 = (props: Props) => { className={classNames( "text-sm font-normal", option.disabled - ? "text-secondary-700" + ? "text-secondary-500" : active ? "text-primary-200" - : "text-secondary-700", + : "text-secondary-500", )} > {option.description} @@ -226,7 +226,7 @@ export const dropdownOptionClassNames = ({ !disabled && active && "bg-primary-500 text-white", !disabled && !active && selected && "text-primary-500", !disabled && !active && !selected && "text-secondary-900", - disabled && "cursor-not-allowed text-secondary-800", + disabled && "cursor-not-allowed text-secondary-600", selected ? "font-semibold" : "font-normal", ); }; diff --git a/src/Components/Patient/FileUpload.tsx b/src/Components/Patient/FileUpload.tsx index d8f865d3fef..cfef384afe9 100644 --- a/src/Components/Patient/FileUpload.tsx +++ b/src/Components/Patient/FileUpload.tsx @@ -1397,10 +1397,12 @@ export const FileUpload = (props: FileUploadProps) => { className="text-lg text-danger-500" />
-
+

Archive File

- This action is irreversible. Once a file is archived it cannot be - unarchived. + + This action is irreversible. Once a file is archived it cannot + be unarchived. +
} @@ -1447,10 +1449,12 @@ export const FileUpload = (props: FileUploadProps) => { className="text-lg text-primary-500" />
-
+

File Details

- This file is archived. Once a file is archived it cannot be - unarchived. + + This file is archived. Once a file is archived it cannot be + unarchived. +
} diff --git a/src/Components/Patient/ManagePatients.tsx b/src/Components/Patient/ManagePatients.tsx index b6fc98935e2..26a6148e0bf 100644 --- a/src/Components/Patient/ManagePatients.tsx +++ b/src/Components/Patient/ManagePatients.tsx @@ -398,7 +398,7 @@ export const PatientManager = () => { prefetch: !!qParams.last_consultation_current_bed__location, }, ); - + /* const { data: patientsWithNoConsentsData } = useQuery(routes.patientList, { query: { ...qParams, @@ -409,7 +409,7 @@ export const PatientManager = () => { }); const patientsWithNoConsents = patientsWithNoConsentsData?.count; - + */ const { data: permittedFacilities } = useQuery( routes.getPermittedFacilities, { @@ -519,7 +519,7 @@ export const PatientManager = () => {
-
+
{patient?.last_consultation?.current_bed && patient?.last_consultation?.discharge_date === null ? (
@@ -707,7 +707,7 @@ export const PatientManager = () => { )} - {!!patient.last_consultation?.has_consents.length || ( + {/* {!!patient.last_consultation?.has_consents.length || ( { - )} + )} */}
@@ -788,7 +788,6 @@ export const PatientManager = () => { name, value: qParams[name] || defaultValue, onChange: (e: FieldChangeEvent) => updateQuery({ [e.name]: e.value }), - className: "grow w-full mb-2", }; }; @@ -975,21 +974,23 @@ export const PatientManager = () => {
-
-
+
+
-
+
{ onChange={(e) => setPhoneNum(e.value)} error={phoneNumberError} types={["mobile", "landline"]} + className="w-full grow" /> { onChange={(e) => setEmergencyPhoneNum(e.value)} error={emergencyPhoneNumberError} types={["mobile", "landline"]} + className="w-full" />
- {!qParams.last_consultation__consent_types && + {/*!qParams.last_consultation__consent_types && (patientsWithNoConsents || 0) > 0 && (
@@ -1027,7 +1030,7 @@ export const PatientManager = () => {

- )} + )*/}
-
+
{manageUsers}
{userData.show && ( diff --git a/src/Utils/useFileManager.tsx b/src/Utils/useFileManager.tsx index 145c63800a8..6d73710d2b4 100644 --- a/src/Utils/useFileManager.tsx +++ b/src/Utils/useFileManager.tsx @@ -224,10 +224,12 @@ export default function useFileManager( className="text-lg text-danger-500" />
-
+

Archive File

- This action is irreversible. Once a file is archived it cannot be - unarchived. + + This action is irreversible. Once a file is archived it cannot + be unarchived. +
} diff --git a/tailwind.config.js b/tailwind.config.js index 43e2412b93c..a40c805621f 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -3,6 +3,7 @@ const colors = require("tailwindcss/colors"); const defaultTheme = require("tailwindcss/defaultTheme"); const gray = { + 50: "#F9FAFB", 100: "#FBFAFC", 200: "#F7F5FA", 300: "#F1EDF7",