Skip to content

Commit

Permalink
Merge branch 'develop' into log-update-vitals
Browse files Browse the repository at this point in the history
  • Loading branch information
saloni0419 authored Mar 5, 2024
2 parents 90c5e7d + 85e6c88 commit 4242dad
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 51 deletions.
6 changes: 3 additions & 3 deletions cypress/e2e/patient_spec/patient_consultation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ describe("Patient Consultation in multiple combination", () => {
patientConsultationPage.selectConsultationStatus(
"Outpatient/Emergency Room"
);
patientConsultationPage.selectSymptoms("ASYMPTOMATIC");
cy.clickAndSelectOption("#symptoms", "ASYMPTOMATIC");
patientConsultationPage.typePatientIllnessHistory(patientIllnessHistory);
patientConsultationPage.typePatientExaminationHistory(
patientExaminationHistory
Expand Down Expand Up @@ -175,7 +175,7 @@ describe("Patient Consultation in multiple combination", () => {
"Outpatient/Emergency Room"
);
// Asymptomatic
patientConsultationPage.selectSymptoms("ASYMPTOMATIC");
cy.clickAndSelectOption("#symptoms", "ASYMPTOMATIC");
// CRITICAL category
patientConsultationPage.selectPatientCategory("Critical");
patientConsultationPage.selectPatientSuggestion("Declare Death");
Expand Down Expand Up @@ -233,7 +233,7 @@ describe("Patient Consultation in multiple combination", () => {
);
patientConsultationPage.selectPatientWard("Dummy Location 1");
// Asymptomatic
patientConsultationPage.selectSymptoms("ASYMPTOMATIC");
cy.clickAndSelectOption("#symptoms", "ASYMPTOMATIC");
// Abnormal category
patientConsultationPage.selectPatientCategory("Abnormal");
patientConsultationPage.selectPatientSuggestion("Domiciliary Care");
Expand Down
12 changes: 3 additions & 9 deletions cypress/e2e/users_spec/user_manage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ describe("Manage User", () => {
userPage.typeInSearchInput(usernameforworkinghour);
userPage.checkUsernameText(usernameforworkinghour);
manageUserPage.clicklinkedskillbutton();
manageUserPage.typeSkill(linkedskill);
manageUserPage.selectFacilityFromDropdown(linkedskill);
manageUserPage.selectSkillFromDropdown(linkedskill);
manageUserPage.clickAddSkillButton();
manageUserPage.clickCloseSlideOver();
cy.wait(5000);
Expand All @@ -60,17 +59,15 @@ describe("Manage User", () => {
userPage.typeInSearchInput(usernametolinkskill);
userPage.checkUsernameText(usernametolinkskill);
manageUserPage.clicklinkedskillbutton();
manageUserPage.typeSkill(linkedskill);
manageUserPage.selectFacilityFromDropdown(linkedskill);
manageUserPage.selectSkillFromDropdown(linkedskill);
manageUserPage.clickAddSkillButton();
manageUserPage.clickCloseSlideOver();
cy.wait(5000); // temporary hack to fix the failure
manageUserPage.clicklinkedskillbutton();
manageUserPage.assertSkillInAddedUserSkills(linkedskill);
manageUserPage.clickUnlinkSkill();
manageUserPage.clickSubmit();
manageUserPage.typeSkill(linkedskill);
manageUserPage.selectFacilityFromDropdown(linkedskill);
manageUserPage.selectSkillFromDropdown(linkedskill);
manageUserPage.clickAddSkillButton();
manageUserPage.clickCloseSlideOver();
// verifying the doctor connect
Expand Down Expand Up @@ -105,7 +102,6 @@ describe("Manage User", () => {
manageUserPage.assertHomeFacility("No Home Facility");
// Link a new facility and ensure it is under linked facility - doctor username (1)
manageUserPage.clickFacilitiesTab();
manageUserPage.typeFacilityName(facilitytolinkusername);
manageUserPage.selectFacilityFromDropdown(facilitytolinkusername);
manageUserPage.clickLinkFacility();
manageUserPage.assertLinkedFacility(facilitytolinkusername);
Expand All @@ -117,7 +113,6 @@ describe("Manage User", () => {
userPage.typeInSearchInput(usernametolinkfacilitydoc2);
userPage.checkUsernameText(usernametolinkfacilitydoc2);
manageUserPage.clickFacilitiesTab();
manageUserPage.typeFacilityName(facilitytolinkusername);
manageUserPage.selectFacilityFromDropdown(facilitytolinkusername);
manageUserPage.clickLinkFacility();
manageUserPage.clickHomeFacilityIcon();
Expand All @@ -134,7 +129,6 @@ describe("Manage User", () => {
userPage.typeInSearchInput(usernametolinkfacilitydoc3);
userPage.checkUsernameText(usernametolinkfacilitydoc3);
manageUserPage.clickFacilitiesTab();
manageUserPage.typeFacilityName(facilitytolinkusername);
manageUserPage.selectFacilityFromDropdown(facilitytolinkusername);
manageUserPage.clickLinkFacility();
manageUserPage.clickUnlinkFacilityButton();
Expand Down
3 changes: 1 addition & 2 deletions cypress/pageobject/Facility/FacilityCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ class FacilityPage {
}

selectBedType(bedType: string) {
cy.get("div#bed-type button").click();
cy.get("[role='option']").contains(bedType).click();
cy.clickAndSelectOption("div#bed-type button", bedType);
}

isVisibleselectBedType() {
Expand Down
14 changes: 5 additions & 9 deletions cypress/pageobject/Users/ManageUserPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ export class ManageUserPage {
cy.get("#facilities").click();
}

typeFacilityName(facilityName) {
cy.get("input[name='facility']").click().type(facilityName);
selectFacilityFromDropdown(facilityName) {
cy.searchAndSelectOption("input[name='facility']", facilityName);
}

selectFacilityFromDropdown(facilityName) {
cy.get("[role='option']").contains(facilityName).click();
selectSkillFromDropdown(skill) {
cy.searchAndSelectOption("input[name='skill']", skill);
}

clickLinkFacility() {
Expand All @@ -36,7 +36,7 @@ export class ManageUserPage {
}

assertFacilityNotInDropdown(facilityName) {
this.typeFacilityName(facilityName);
cy.get("input[name='facility']").click().type(facilityName);
cy.get("[role='option']").should("not.exist");
}

Expand Down Expand Up @@ -129,10 +129,6 @@ export class ManageUserPage {
.should("have.length", 1);
}

typeSkill(skillName) {
cy.get("#select-skill").click().type(skillName);
}

clickDoctorConnectButton() {
cy.get("#doctor-connect-patient-button").click();
}
Expand Down
30 changes: 15 additions & 15 deletions src/Common/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ export const REVIEW_AT_CHOICES: Array<OptionsType> = [
];

export const SYMPTOM_CHOICES = [
{ id: 1, text: "ASYMPTOMATIC" },
{ id: 1, text: "ASYMPTOMATIC", isSingleSelect: true },
{ id: 2, text: "FEVER" },
{ id: 3, text: "SORE THROAT" },
{ id: 4, text: "COUGH" },
Expand Down Expand Up @@ -689,20 +689,20 @@ export const MOTOR_RESPONSE_SCALE = [
{ value: 2, text: "Abnormal Extension(decerebrate)" },
{ value: 1, text: "No Response" },
];
export const CONSULTATION_TABS: Array<OptionsType> = [
{ id: 1, text: "UPDATES", desc: "Updates" },
{ id: 13, text: "FEED", desc: "Feed" },
{ id: 2, text: "SUMMARY", desc: "Summary" },
{ id: 3, text: "MEDICINES", desc: "Medicines" },
{ id: 4, text: "FILES", desc: "Files" },
{ id: 5, text: "INVESTIGATIONS", desc: "Investigations" },
{ id: 6, text: "ABG", desc: "ABG" },
{ id: 7, text: "NURSING", desc: "Nursing" },
{ id: 8, text: "NEUROLOGICAL_MONITORING", desc: "Neurological Monitoring" },
{ id: 9, text: "VENTILATOR", desc: "Respiratory Support" },
{ id: 10, text: "NUTRITION", desc: "Nutrition" },
{ id: 11, text: "PRESSURE_SORE", desc: "Pressure Sore" },
{ id: 12, text: "DIALYSIS", desc: "Dialysis" },
export const CONSULTATION_TABS = [
{ text: "UPDATES", desc: "Overview" },
{ text: "FEED", desc: "Feed" },
{ text: "SUMMARY", desc: "Vitals" },
{ text: "ABG", desc: "ABG" },
{ text: "MEDICINES", desc: "Medicines" },
{ text: "FILES", desc: "Files" },
{ text: "INVESTIGATIONS", desc: "Investigations" },
{ text: "NEUROLOGICAL_MONITORING", desc: "Neuro" },
{ text: "VENTILATOR", desc: "Ventilation" },
{ text: "NUTRITION", desc: "Nutrition" },
{ text: "PRESSURE_SORE", desc: "Pressure Sore" },
{ text: "NURSING", desc: "Nursing" },
{ text: "DIALYSIS", desc: "Dialysis" },
];

export const RHYTHM_CHOICES: Array<OptionsType> = [
Expand Down
52 changes: 39 additions & 13 deletions src/Components/Form/MultiSelectMenuV2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import CareIcon from "../../CAREUI/icons/CareIcon";
import { DropdownTransition } from "../Common/components/HelperComponents";
import { Listbox } from "@headlessui/react";
import { classNames } from "../../Utils/utils";
import { ReactNode } from "react";
import { ReactNode, useRef } from "react";

type OptionCallback<T, R = void> = (option: T) => R;

Expand Down Expand Up @@ -61,9 +61,18 @@ const MultiSelectMenuV2 = <T, V>(props: Props<T, V>) => {
if (selectedOptions.length === 0) return placeholder;
if (props.renderSelectedOptions)
return props.renderSelectedOptions(selectedOptions.map((o) => o.option));
return (
<span className="text-gray-800">{`${selectedOptions.length} item(s) selected`}</span>
);
};

const buttonRef = useRef(null);

const handleSingleSelect = (o: any) => {
if (
o.option?.isSingleSelect === true &&
!selectedOptions.includes(o) &&
buttonRef.current
) {
buttonRef.current.click();
}
};

return (
Expand All @@ -83,23 +92,39 @@ const MultiSelectMenuV2 = <T, V>(props: Props<T, V>) => {
</Listbox.Label>
<div className="relative">
<div>
<Listbox.Button className="cui-input-base flex w-full rounded">
<Listbox.Button
className="cui-input-base flex w-full rounded"
ref={buttonRef}
>
<div className="relative z-0 flex w-full items-center">
<div className="relative flex flex-1 items-center pr-4 focus:z-10">
<p className="ml-2.5 text-sm font-normal text-gray-600">
<Placeholder />
</p>

{selectedOptions.length !== 0 && (
<div className="flex flex-wrap gap-2">
{selectedOptions.map((option) => (
<MultiSelectOptionChip
key={option.value}
label={option.selectedLabel}
onRemove={() => {
const updatedOptions = selectedOptions.filter(
(selectedOption) =>
selectedOption.value !== option.value
);
props.onChange(
updatedOptions.map((o) => o.value) as any
);
}}
/>
))}
</div>
)}
</div>
<CareIcon className="care-l-angle-down -mb-0.5 text-lg text-gray-900" />
</div>
</Listbox.Button>
{selectedOptions.length !== 0 && (
<div className="flex flex-wrap gap-2 p-2">
{selectedOptions.map((option) => (
<MultiSelectOptionChip label={option.selectedLabel} />
))}
</div>
)}
</div>
<DropdownTransition show={open}>
<Listbox.Options className="cui-dropdown-base absolute top-12">
Expand All @@ -109,6 +134,7 @@ const MultiSelectMenuV2 = <T, V>(props: Props<T, V>) => {
key={index}
className={dropdownOptionClassNames}
value={option}
onClick={() => handleSingleSelect(option)}
>
{({ active }) => (
<div className="flex flex-col gap-2">
Expand Down Expand Up @@ -154,7 +180,7 @@ interface MultiSelectOptionChipProps {
export const MultiSelectOptionChip = (props: MultiSelectOptionChipProps) => {
return (
<span className="flex items-center gap-2 rounded-full border-gray-300 bg-gray-200 px-3 text-xs text-gray-700">
<p className="py-1.5">{props.label}</p>
<p className="py-1">{props.label}</p>
{props.onRemove && (
<p
className="cursor-pointer rounded-full hover:bg-white"
Expand Down

0 comments on commit 4242dad

Please sign in to comment.