Skip to content

Commit

Permalink
Merge branch 'develop' into last-online-filter
Browse files Browse the repository at this point in the history
  • Loading branch information
gigincg authored Jul 24, 2024
2 parents 4f44185 + abd95d8 commit 2c5ac35
Show file tree
Hide file tree
Showing 20 changed files with 83 additions and 84 deletions.
1 change: 0 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
11 changes: 7 additions & 4 deletions cypress/e2e/patient_spec/patient_registration.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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
Expand All @@ -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", () => {
Expand Down
30 changes: 2 additions & 28 deletions cypress/pageobject/Patient/PatientTransfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
1 change: 1 addition & 0 deletions cypress/support/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/// <reference types="cypress" />
import "./commands";

declare global {
Expand Down
21 changes: 16 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
6 changes: 4 additions & 2 deletions src/Components/Facility/ConsultationDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Facility/Consultations/Mews.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export const Mews = ({ dailyRound }: { dailyRound: DailyRoundsModel }) => {
return (
<>
<div className="tooltip flex flex-col items-center">
<div className="border-grey-400 flex h-7 w-7 items-center justify-center rounded-full border-2">
<div className="flex h-7 w-7 items-center justify-center rounded-full border-2">
<span className="text-sm font-semibold">-</span>
</div>
<span className="mt-1 text-xs font-medium text-secondary-700">
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Facility/CoverImageEditModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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")}
</ButtonV2>
Expand Down
8 changes: 6 additions & 2 deletions src/Components/Facility/DischargeModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,13 @@ const DischargeModal = ({
title={
<div>
<p>Discharge patient from CARE</p>
<span className="mt-1 flex gap-1 text-sm font-medium text-warning-500">
<span className="mt-1 flex gap-1 text-sm font-medium text-danger-500">
<CareIcon icon="l-exclamation-triangle" className="text-base" />
<p>Caution: this action is irreversible.</p>
<p>
{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."}
</p>
</span>
</div>
}
Expand Down
13 changes: 0 additions & 13 deletions src/Components/Facility/FacilityHome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -445,19 +445,6 @@ export const FacilityHome = (props: any) => {
<CareIcon icon="l-user-injured" className="text-lg" />
<span>View Patients</span>
</ButtonV2>
<ButtonV2
id="view-patient-facility-list"
variant="primary"
ghost
border
className="mt-2 flex w-full flex-row justify-center md:w-auto"
onClick={() =>
navigate(`/facility/${facilityId}/discharged-patients`)
}
>
<CareIcon icon="l-user-injured" className="text-lg" />
<span>View Discharged Patients</span>
</ButtonV2>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Facility/HospitalList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export const HospitalList = () => {
) : (
<div>
<div
className="border-grey-500 mt-4 cursor-pointer whitespace-nowrap rounded-md border bg-white p-16 text-center text-sm font-semibold shadow hover:bg-secondary-300"
className="mt-4 cursor-pointer whitespace-nowrap rounded-md border bg-white p-16 text-center text-sm font-semibold shadow hover:bg-secondary-300"
onClick={() => navigate("/facility/create")}
>
<CareIcon icon="l-plus" className="text-3xl" />
Expand Down
8 changes: 7 additions & 1 deletion src/Components/Facility/TransferPatientDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,12 @@ const TransferPatientDialog = (props: Props) => {
const patientOptions: Array<OptionsType> = 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,
};
});

Expand Down Expand Up @@ -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}
Expand Down
1 change: 1 addition & 0 deletions src/Components/Facility/models.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ export interface DupPatientModel {
date_of_birth: string;
year_of_birth: number;
state_id: number;
is_expired: boolean;
}

export interface InventoryItemsModel {
Expand Down
6 changes: 3 additions & 3 deletions src/Components/Form/MultiSelectMenuV2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,10 @@ const MultiSelectMenuV2 = <T, V>(props: Props<T, V>) => {
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}
Expand Down Expand Up @@ -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",
);
};
16 changes: 10 additions & 6 deletions src/Components/Patient/FileUpload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1397,10 +1397,12 @@ export const FileUpload = (props: FileUploadProps) => {
className="text-lg text-danger-500"
/>
</div>
<div className="text-grey-200 text-sm">
<div className="text-sm">
<h1 className="text-xl text-black">Archive File</h1>
This action is irreversible. Once a file is archived it cannot be
unarchived.
<span className="text-sm text-secondary-600">
This action is irreversible. Once a file is archived it cannot
be unarchived.
</span>
</div>
</div>
}
Expand Down Expand Up @@ -1447,10 +1449,12 @@ export const FileUpload = (props: FileUploadProps) => {
className="text-lg text-primary-500"
/>
</div>
<div className="text-grey-200 text-sm">
<div className="text-sm">
<h1 className="text-xl text-black">File Details</h1>
This file is archived. Once a file is archived it cannot be
unarchived.
<span className="text-sm font-normal text-secondary-600">
This file is archived. Once a file is archived it cannot be
unarchived.
</span>
</div>
</div>
}
Expand Down
Loading

0 comments on commit 2c5ac35

Please sign in to comment.