Skip to content

Commit

Permalink
advance filtering of the data only
Browse files Browse the repository at this point in the history
  • Loading branch information
nihal467 committed Oct 8, 2024
1 parent 238b1ac commit 6be5d78
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
23 changes: 23 additions & 0 deletions cypress/e2e/patient_spec/PatientHomepage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,29 @@ describe("Patient Homepage present functionalities", () => {
cy.awaitUrl("/patients");
});

it("Patient Details based advance filters applied in the patient tab", () => {
// Patient Filtering based on data
patientHome.clickPatientAdvanceFilters();
cy.clickAndSelectOption("#gender-advancefilter", "Male");
cy.clickAndSelectOption("#category-advancefilter", "Moderate");
cy.get("#age_min").type("18");
cy.get("#age_max").type("24");
cy.clickAndMultiSelectOption(
"#last_consultation_admitted_bed_type_list",
"No bed assigned",
);
cy.clickAndMultiSelectOption(
"#last_consultation__consent_types",
"No consents",
);
cy.clickAndSelectOption("#telemedicine-advancefilter", "No");
cy.clickAndSelectOption("#review-advancefilter", "No");
cy.clickAndSelectOption("#medico-advancefilter", "Non-Medico-Legal");
patientHome.clickPatientFilterApply();
cy.get("a[data-cy='patient']").should("contain.text", "Dummy Patient");
// Verify the presence of badges
});

it("Export the live patient list based on a date range", () => {
patientHome.clickPatientExport();
cy.verifyNotification("Please select a seven day period");
Expand Down
4 changes: 4 additions & 0 deletions cypress/pageobject/Patient/PatientHome.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,9 @@ class PatientHome {
typePatientModifiedAfterDate(endDate: string) {
cy.clickAndTypeDate("input[name='modified_date_end']", endDate);
}

clickPatientAdvanceFilters() {
cy.get("#advanced-filter").click();
}
}
export default PatientHome;
7 changes: 7 additions & 0 deletions src/Components/Patient/PatientFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ export default function PatientFilter(props: any) {
<div className="w-full flex-none">
<FieldLabel className="text-sm">Gender</FieldLabel>
<SelectMenuV2
id="gender-advancefilter"
placeholder="Show all"
options={GENDER_TYPES}
optionLabel={(o) => o.text}
Expand All @@ -304,6 +305,7 @@ export default function PatientFilter(props: any) {
<div className="w-full flex-none">
<FieldLabel className="text-sm">Category</FieldLabel>
<SelectMenuV2
id="category-advancefilter"
placeholder="Show all"
options={PATIENT_FILTER_CATEGORIES}
optionLabel={(o) => o.text}
Expand Down Expand Up @@ -407,6 +409,7 @@ export default function PatientFilter(props: any) {
<div className="w-full flex-none">
<FieldLabel className="text-sm">Telemedicine</FieldLabel>
<SelectMenuV2
id="telemedicine-advancefilter"
placeholder="Show all"
options={TELEMEDICINE_FILTER}
optionLabel={(o) => o.text}
Expand All @@ -423,6 +426,7 @@ export default function PatientFilter(props: any) {
<div className="w-full flex-none">
<FieldLabel className="text-sm">Respiratory Support</FieldLabel>
<SelectMenuV2
id="respiratory-advancefilter"
placeholder="Show all"
options={RESPIRATORY_SUPPORT_FILTER}
optionLabel={(o) => o.text}
Expand Down Expand Up @@ -455,6 +459,7 @@ export default function PatientFilter(props: any) {
<>
<FieldLabel className="text-sm">Review Missed</FieldLabel>
<SelectMenuV2
id="review-advancefilter"
placeholder="Show all"
options={["true", "false"]}
optionLabel={(o) => (o === "true" ? "Yes" : "No")}
Expand All @@ -469,6 +474,7 @@ export default function PatientFilter(props: any) {
<div className="w-full flex-none">
<FieldLabel className="text-sm">Is Medico-Legal Case</FieldLabel>
<SelectMenuV2
id="medico-advancefilter"
placeholder="Show all"
options={["true", "false"]}
optionLabel={(o) =>
Expand All @@ -484,6 +490,7 @@ export default function PatientFilter(props: any) {
/>
</div>
<SelectFormField
id="ration-advancefilter"
name="ration_card_category"
label="Ration Card Category"
placeholder="Select"
Expand Down

0 comments on commit 6be5d78

Please sign in to comment.