Skip to content

Commit

Permalink
Merge branch 'develop' into test1#6690
Browse files Browse the repository at this point in the history
  • Loading branch information
nihal467 authored Nov 29, 2023
2 parents a69e53f + a18016b commit 6664888
Show file tree
Hide file tree
Showing 24 changed files with 766 additions and 707 deletions.
4 changes: 2 additions & 2 deletions cypress/e2e/facility_spec/facility.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ describe("Facility Creation", () => {
facilityPage.fillPhoneNumber("9898469865");
facilityPage.submitForm();

facilityPage.selectBedType("Non-Covid Oxygen beds");
facilityPage.selectBedType("Oxygen beds");
facilityPage.fillTotalCapacity("10");
facilityPage.fillCurrentlyOccupied("5");
facilityPage.saveAndExitBedCapacityForm();
Expand All @@ -49,7 +49,7 @@ describe("Facility Creation", () => {
facilityPage.visitUpdateFacilityPage(facilityUrl);
facilityPage.clickManageFacilityDropdown();
facilityPage.clickUpdateFacilityOption();
facilityPage.clickUpdateFacilityType();
facilityPage.clickUpdateFacilityType("Request Approving Center");
facilityPage.fillFacilityName("cypress facility updated");
facilityPage.fillAddress("Cypress Facility Updated Address");
facilityPage.fillOxygenCapacity("100");
Expand Down
24 changes: 23 additions & 1 deletion cypress/e2e/facility_spec/facility_homepage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,22 @@ import LoginPage from "../../pageobject/Login/LoginPage";
import FacilityHome from "../../pageobject/Facility/FacilityHome";
import ManageUserPage from "../../pageobject/Users/ManageUserPage";
import FacilityPage from "../../pageobject/Facility/FacilityCreation";
import { UserPage } from "../../pageobject/Users/UserSearch";

describe("Facility Creation", () => {
describe("Facility Homepage Function", () => {
const loginPage = new LoginPage();
const facilityHome = new FacilityHome();
const facilityPage = new FacilityPage();
const manageUserPage = new ManageUserPage();
const userPage = new UserPage();
const facilitiesAlias = "downloadFacilitiesCSV";
const capacitiesAlias = "downloadCapacitiesCSV";
const doctorsAlias = "downloadDoctorsCSV";
const triagesAlias = "downloadTriagesCSV";
const facilityname = "Dummy Facility 1";
const statename = "Kerala";
const district = "Ernakulam";
const facilitytype = "Private Hospital";

before(() => {
loginPage.loginAsDisctrictAdmin();
Expand All @@ -26,6 +31,23 @@ describe("Facility Creation", () => {
cy.awaitUrl("/facility");
});

it("Verify the functionality of advance filter", () => {
userPage.clickAdvancedFilters();
facilityPage.selectState(statename);
facilityPage.selectDistrict(district);
// facilityPage.selectLocalBody("Anthikad Grama"); current dummy data have issue in local body
facilityPage.clickUpdateFacilityType(facilitytype);
userPage.applyFilter();
facilityPage.verifyStateBadgeContent(statename);
facilityPage.verifyDistrictBadgeContent(district);
facilityPage.verifyFacilityTypeBadgeContent(facilitytype);
manageUserPage.assertFacilityInCard(facilityname);
userPage.clearFilters();
userPage.verifyDataTestIdNotVisible("State");
userPage.verifyDataTestIdNotVisible("District");
userPage.verifyDataTestIdNotVisible("Facility type");
});

it("Search a facility in homepage", () => {
manageUserPage.typeFacilitySearch(facilityname);
facilityPage.verifyFacilityBadgeContent(facilityname);
Expand Down
16 changes: 14 additions & 2 deletions cypress/pageobject/Facility/FacilityCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ class FacilityPage {
cy.get("#manage-facility-dropdown button").should("be.visible");
}

clickUpdateFacilityType() {
clickUpdateFacilityType(facilityType) {
cy.get("#facility_type")
.click()
.then(() => {
cy.get("[role='option']").contains("Request Approving Center").click();
cy.get("[role='option']").contains(facilityType).click();
});
}

Expand Down Expand Up @@ -195,6 +195,18 @@ class FacilityPage {
);
}

verifyStateBadgeContent(expectedText: string) {
cy.get("[data-testid='State']").should("contain", expectedText);
}

verifyDistrictBadgeContent(expectedText: string) {
cy.get("[data-testid='District']").should("contain", expectedText);
}

verifyFacilityTypeBadgeContent(expectedText: string) {
cy.get("[data-testid='Facility type']").should("contain", expectedText);
}

verifyfacilitycreateassetredirection() {
cy.url().should("include", "/assets/new");
}
Expand Down
3 changes: 2 additions & 1 deletion cypress/pageobject/Patient/PatientConsultation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,8 @@ export class PatientConsultationPage {
}

clickDischargePatient() {
cy.get("#discharge_patient_from_care").click();
cy.get("#show-more").click();
cy.contains("p", "Discharge from CARE").click();
}

selectDischargeReason(reason: string) {
Expand Down
8 changes: 4 additions & 4 deletions src/Common/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,10 @@ export const getBedTypes = ({
: [];

return [
{ id: 1, text: "Non-Covid Ordinary Beds" },
{ id: 150, text: "Non-Covid Oxygen beds" },
{ id: 10, text: "Non-Covid ICU (ICU without ventilator)" },
{ id: 20, text: "Non-Covid Ventilator (ICU with ventilator)" },
{ id: 1, text: "Ordinary Beds" },
{ id: 150, text: "Oxygen beds" },
{ id: 10, text: "ICU (ICU without ventilator)" },
{ id: 20, text: "Ventilator (ICU with ventilator)" },
{ id: 30, text: "Covid Ordinary Beds" },
{ id: 120, text: "Covid Oxygen beds" },
{ id: 110, text: "Covid ICU (ICU without ventilator)" },
Expand Down
10 changes: 0 additions & 10 deletions src/Common/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,6 @@ export const parseOptionId: (
return textArray.join(", ");
};

export const getDimensionOrDash = (
value: number | string | null | undefined,
unit: string
) => {
if (value === undefined || value === null || value === 0 || value === "0") {
return "-";
}
return value + unit;
};

export const deepEqual = (x: any, y: any): boolean => {
if (x === y) return true;

Expand Down
2 changes: 1 addition & 1 deletion src/Components/Common/LocationSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ interface LocationSelectProps {
name: string;
disabled?: boolean;
margin?: string;
errors: string;
errors?: string;
className?: string;
searchAll?: boolean;
multiple?: boolean;
Expand Down
86 changes: 8 additions & 78 deletions src/Components/Facility/ConsultationDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ import {
} from "../../../Redux/actions";
import { statusType, useAbortableEffect } from "../../../Common/utils";
import { lazy, useCallback, useState } from "react";
import ButtonV2 from "../../Common/components/ButtonV2";
import CareIcon from "../../../CAREUI/icons/CareIcon";
import DischargeModal from "../DischargeModal";
import DischargeSummaryModal from "../DischargeSummaryModal";
import DoctorVideoSlideover from "../DoctorVideoSlideover";
import { make as Link } from "../../Common/components/Link.bs";
import PatientInfoCard from "../../Patient/PatientInfoCard";
Expand All @@ -25,7 +21,6 @@ import { formatDateTime, relativeTime } from "../../../Utils/utils";

import { navigate, useQueryParams } from "raviger";
import { useDispatch } from "react-redux";
import { useTranslation } from "react-i18next";
import { triggerGoal } from "../../../Integrations/Plausible";
import useAuthUser from "../../../Common/hooks/useAuthUser";
import { ConsultationUpdatesTab } from "./ConsultationUpdatesTab";
Expand Down Expand Up @@ -73,7 +68,6 @@ const TABS = {
};

export const ConsultationDetails = (props: any) => {
const { t } = useTranslation();
const { facilityId, patientId, consultationId } = props;
const tab = props.tab.toUpperCase() as keyof typeof TABS;
const dispatch: any = useDispatch();
Expand All @@ -86,9 +80,6 @@ export const ConsultationDetails = (props: any) => {
);
const [patientData, setPatientData] = useState<PatientModel>({});
const [activeShiftingData, setActiveShiftingData] = useState<Array<any>>([]);
const [openDischargeSummaryDialog, setOpenDischargeSummaryDialog] =
useState(false);
const [openDischargeDialog, setOpenDischargeDialog] = useState(false);
const [isCameraAttached, setIsCameraAttached] = useState(false);

const getPatientGender = (patientData: any) =>
Expand Down Expand Up @@ -197,19 +188,6 @@ export const ConsultationDetails = (props: any) => {

const SelectedTab = TABS[tab];

const hasActiveShiftingRequest = () => {
if (activeShiftingData.length > 0) {
return [
"PENDING",
"APPROVED",
"DESTINATION APPROVED",
"PATIENT TO BE PICKED UP",
].includes(activeShiftingData[activeShiftingData.length - 1].status);
}

return false;
};

if (isLoading) {
return <Loading />;
}
Expand Down Expand Up @@ -272,18 +250,6 @@ export const ConsultationDetails = (props: any) => {

return (
<div>
<DischargeSummaryModal
consultation={consultationData}
show={openDischargeSummaryDialog}
onClose={() => setOpenDischargeSummaryDialog(false)}
/>

<DischargeModal
show={openDischargeDialog}
onClose={() => setOpenDischargeDialog(false)}
consultationData={consultationData}
/>

<div className="px-2 pb-2">
<nav className="relative flex flex-wrap items-start justify-between">
<PageTitle
Expand All @@ -307,34 +273,6 @@ export const ConsultationDetails = (props: any) => {
<div className="flex w-full flex-col min-[1150px]:w-min min-[1150px]:flex-row min-[1150px]:items-center">
{!consultationData.discharge_date && (
<>
{hasActiveShiftingRequest() ? (
<ButtonV2
onClick={() =>
navigate(
`/shifting/${
activeShiftingData[activeShiftingData.length - 1].id
}`
)
}
className="btn btn-primary mx-1 w-full p-1.5 px-4 hover:text-white"
>
<CareIcon className="care-l-ambulance h-5 w-5" />
Track Shifting
</ButtonV2>
) : (
<ButtonV2
id="create_shift_request"
onClick={() =>
navigate(
`/facility/${patientData.facility}/patient/${patientData.id}/shift/new`
)
}
className="btn btn-primary mx-1 w-full p-1.5 px-4 hover:text-white"
>
<CareIcon className="care-l-ambulance h-5 w-5" />
Shift Patient
</ButtonV2>
)}
<button
onClick={() => {
triggerGoal("Doctor Connect Clicked", {
Expand Down Expand Up @@ -371,7 +309,13 @@ export const ConsultationDetails = (props: any) => {
</Link>
<Link
id="patient_doctor_notes"
onClick={() => setShowPatientNotesPopup(true)}
onClick={() =>
showPatientNotesPopup
? navigate(
`/facility/${facilityId}/patient/${patientId}/notes`
)
: setShowPatientNotesPopup(true)
}
className="btn btn-primary m-1 w-full hover:text-white"
>
Doctor&apos;s Notes
Expand All @@ -385,6 +329,7 @@ export const ConsultationDetails = (props: any) => {
consultation={consultationData}
fetchPatientData={fetchData}
consultationId={consultationId}
activeShiftingData={activeShiftingData}
showAbhaProfile={qParams["show-abha-profile"] === "true"}
/>

Expand Down Expand Up @@ -448,21 +393,6 @@ export const ConsultationDetails = (props: any) => {
</div>
)}
</div>
<div className="flex h-full w-full flex-col justify-end gap-2 text-right lg:flex-row">
<ButtonV2 onClick={() => setOpenDischargeSummaryDialog(true)}>
<i className="fas fa-clipboard-list"></i>
<span>{t("discharge_summary")}</span>
</ButtonV2>

<ButtonV2
id="discharge_patient_from_care"
onClick={() => setOpenDischargeDialog(true)}
disabled={!!consultationData.discharge_date}
>
<i className="fas fa-hospital-user"></i>
<span>{t("discharge_from_care")}</span>
</ButtonV2>
</div>
</div>
<div className="flex flex-col justify-between gap-2 p-4 md:flex-row">
<div className="font-base flex flex-col text-xs leading-relaxed text-gray-700">
Expand Down
6 changes: 5 additions & 1 deletion src/Components/Facility/ConsultationForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,10 @@ export const ConsultationForm = (props: any) => {
errors[field] = "Field is required";
invalidForm = true;
}
if (dayjs(state.form.admission_date).isBefore(dayjs("2000-01-01"))) {
errors[field] = "Admission date cannot be before 01/01/2000";
invalidForm = true;
}
return;
case "cause_of_death":
if (state.form.suggestion === "DD" && !state.form[field]) {
Expand Down Expand Up @@ -946,7 +950,7 @@ export const ConsultationForm = (props: any) => {
required
label="Route to Facility"
{...field("route_to_facility")}
disabled={isUpdate}
disabled={isUpdate && !!state.form.route_to_facility} // For backwards compatibility; Allow in edit form only if route_to_facility is not set previously
/>
</div>

Expand Down
6 changes: 3 additions & 3 deletions src/Components/Facility/Consultations/Feed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ export const Feed: React.FC<IFeedProps> = ({ consultationId, facilityId }) => {
const [isFullscreen, setFullscreen] = useFullscreen();
const [videoStartTime, setVideoStartTime] = useState<Date | null>(null);
const [statusReported, setStatusReported] = useState(false);
const [facilityMiddlewareHostname, setFacilityMiddlewareHostname] =
useState("");
const authUser = useAuthUser();

let facilityMiddlewareHostname = "";

useQuery(routes.getPermittedFacility, {
pathParams: { id: facilityId || "" },
onResponse: ({ res, data }) => {
if (res && res.status === 200 && data && data.middleware_address) {
facilityMiddlewareHostname = data.middleware_address;
setFacilityMiddlewareHostname(data.middleware_address);
}
},
});
Expand Down
Loading

0 comments on commit 6664888

Please sign in to comment.