Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for time in dateinput component #8504

Merged
merged 28 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
909d821
Added support for time in dateinput
shivankacker Sep 8, 2024
d8d89f1
made responsive
shivankacker Sep 8, 2024
e62e655
fixed responsiveness and updated tests
shivankacker Sep 12, 2024
e9ee7c3
Merge branch 'develop' of https://github.com/ohcnetwork/care_fe into …
shivankacker Sep 12, 2024
248afe9
Fixed scroll behaviour
shivankacker Sep 12, 2024
435484d
minor test fix
shivankacker Sep 12, 2024
060b271
Updated placeholder, changed layout of time picker on mobile, and mad…
shivankacker Sep 13, 2024
3f52db1
Made fool proof
shivankacker Sep 13, 2024
e54004e
Merge branch 'develop' of https://github.com/ohcnetwork/care_fe into …
shivankacker Sep 17, 2024
e88adba
fix merge conflicts
shivankacker Sep 19, 2024
b46694d
stashing
shivankacker Sep 20, 2024
1f0d1f7
fix merge conflicts
shivankacker Oct 4, 2024
86663d8
fix merge conflicts
shivankacker Oct 9, 2024
16aa346
updated UI to not have the user add slashes
shivankacker Oct 10, 2024
c3162fb
updated tests
shivankacker Oct 11, 2024
e5480f3
Merge branch 'develop' of https://github.com/ohcnetwork/care_fe into …
shivankacker Oct 11, 2024
79cdb31
fixed tests
shivankacker Oct 12, 2024
1bd3e32
Merge branch 'develop' of https://github.com/ohcnetwork/care_fe into …
shivankacker Oct 14, 2024
149e6b6
fix responsiveness
shivankacker Oct 14, 2024
4b7adcc
fix merge conflicts
shivankacker Oct 17, 2024
5e69cf0
fixed bugs
shivankacker Oct 17, 2024
fe68ada
fixed merge conflicts and updated tests
shivankacker Oct 22, 2024
e5950f5
little mistake
shivankacker Oct 22, 2024
ceaf273
autoclose on first date input
shivankacker Oct 23, 2024
f47f372
fix merge conflicts
shivankacker Oct 24, 2024
2f9bd97
fix merge conflicts
shivankacker Oct 24, 2024
d5f0683
cleanup
shivankacker Oct 25, 2024
c3c1727
fixed merge conflicts
shivankacker Oct 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ describe("Patient Consultation in multiple combination", () => {
patientConsultationPage.selectPatientPrincipalDiagnosis(diagnosis4);
patientTreatmentPlan.clickAddProcedure();
patientTreatmentPlan.typeProcedureName(procedureName);
patientTreatmentPlan.typeProcedureTime("2024-02-22T12:30");
patientTreatmentPlan.typeProcedureTime("220220241230");
patientTreatmentPlan.typeTreatmentPlan(patientTreatment);
patientTreatmentPlan.typePatientGeneralInstruction(generalInstruction);
patientTreatmentPlan.typeSpecialInstruction(specialInstruction);
Expand Down Expand Up @@ -182,12 +182,12 @@ describe("Patient Consultation in multiple combination", () => {
patientConsultationPage.typeCauseOfDeath("Cause of Death");
patientConsultationPage.typePatientConsultationDate(
"#death_datetime",
"2024-02-22T12:45",
"220220241230",
);
patientConsultationPage.typeDeathConfirmedBy(doctorName);
patientConsultationPage.typePatientConsultationDate(
"#encounter_date",
"2024-02-22T12:30",
"220220241230",
);
cy.submitButton("Create Consultation");
cy.verifyNotification(
Expand Down Expand Up @@ -245,7 +245,7 @@ describe("Patient Consultation in multiple combination", () => {
);
patientConsultationPage.typePatientConsultationDate(
"#icu_admission_date",
"2024-02-23T12:30",
"230220241230",
);
// add investigation
patientInvestigation.clickAddInvestigation();
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/patient_spec/PatientRegistration.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const getRelativeDateString = (deltaDays = 0) => {
month: "2-digit",
year: "numeric",
})
.replace("/", "");
.replace(/\//g, "");
};

describe("Patient Creation with consultation", () => {
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/users_spec/UsersCreation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ describe("User Creation", () => {
userCreationPage.typeIntoElementById("password", "Test@123");
userCreationPage.selectHomeFacility("Dummy Shifting Center");
userCreationPage.typeIntoElementById("phone_number", phone_number);
userCreationPage.setInputDate("date_of_birth", "date-input", "25081999");
userCreationPage.setInputDate("date_of_birth", "25081999");
userCreationPage.selectDropdownOption("user_type", "Doctor");
userCreationPage.typeIntoElementById("c_password", "Test@123");
userCreationPage.typeIntoElementById("qualification", "MBBS");
Expand Down
19 changes: 9 additions & 10 deletions cypress/pageobject/Asset/AssetCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ export class AssetPage {
cy.get("[data-testid=asset-support-email-input] input").type(supportEmail);
cy.get("[data-testid=asset-vendor-name-input] input").type(vendorName);
cy.get("[data-testid=asset-serial-number-input] input").type(serialNumber);
cy.get(
"[data-testid=asset-last-serviced-on-input] input[type='text']",
).click();
cy.get("#date-input").click().type(lastServicedOn);
cy.clickAndTypeDate(
"[data-testid=asset-last-serviced-on-input]",
lastServicedOn,
);
cy.get("[data-testid=asset-notes-input] textarea").type(notes);
}

Expand Down Expand Up @@ -117,10 +117,10 @@ export class AssetPage {
cy.get("[data-testid=asset-vendor-name-input] input")
.clear()
.type(vendorName);
cy.get(
"[data-testid=asset-last-serviced-on-input] input[type='text']",
).click();
cy.get("#date-input").click().clear().type(lastServicedOn);
cy.clickAndTypeDate(
"[data-testid=asset-last-serviced-on-input]",
lastServicedOn,
);
cy.get("[data-testid=asset-notes-input] textarea").clear().type(notes);
}

Expand Down Expand Up @@ -267,8 +267,7 @@ export class AssetPage {
}

enterAssetservicedate(text: string) {
cy.get("input[name='last_serviced_on']").click();
cy.get("#date-input").click().type(text);
cy.clickAndTypeDate("input[name='last_serviced_on']", text);
}

scrollintoWarrantyDetails() {
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 @@ -245,8 +245,7 @@ class FacilityPage {
}

fillEntryDate(date: string) {
cy.get("#entry_date").click();
cy.get("#date-input").click().type(date);
cy.clickAndTypeDate("#entry_date", date);
}

clickEditButton() {
Expand Down
2 changes: 1 addition & 1 deletion cypress/pageobject/Patient/PatientConsultation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export class PatientConsultationPage {
}

typePatientConsultationDate(selector: string, date: string) {
cy.get(selector).clear().click().type(date);
cy.clickAndTypeDate(selector, date);
}

clickPatientDetails() {
Expand Down
10 changes: 3 additions & 7 deletions cypress/pageobject/Patient/PatientCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ export class PatientPage {

typePatientDateOfBirth(dateOfBirth: string) {
cy.clickAndSelectOption("#patientAge", "DOB");
cy.get("#date_of_birth").scrollIntoView();
cy.get("#date_of_birth").should("be.visible").click();
cy.get("#date-input").click().type(dateOfBirth);
cy.clickAndTypeDate("#date_of_birth", dateOfBirth);
}

typePatientAge(age: string) {
Expand All @@ -80,13 +78,11 @@ export class PatientPage {
}

typeLastMenstruationStartDate(date: string) {
cy.get("#last_menstruation_start_date").click();
cy.get("#date-input").click().type(date);
cy.clickAndTypeDate("#last_menstruation_start_date", date);
}

typeDateOfDelivery(date: string) {
cy.get("#date_of_delivery").click();
cy.get("#date-input").click().type(date);
cy.clickAndTypeDate("#date_of_delivery", date);
}

clickPermanentAddress() {
Expand Down
2 changes: 1 addition & 1 deletion cypress/pageobject/Patient/PatientTreatmentPlan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class PatientTreatmentPlan {
}

typeProcedureTime(time: string) {
cy.get("#procedure-time").type(time);
cy.clickAndTypeDate("#procedure-time", time);
}

typeTreatmentPlan(treatment: string) {
Expand Down
10 changes: 2 additions & 8 deletions cypress/pageobject/Shift/ShiftFilters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,18 +139,12 @@ class ShiftingPage {
modified_date_end: string,
) {
this.createdDateStartInput().click();
cy.get("[id^='headlessui-popover-panel-'] .care-l-angle-left-b")
.eq(0)
.closest("button")
.click();
cy.get("[data-test-id='increment-date-range']").click();
cy.get(created_date_start).click();
cy.get(created_date_end).click();

this.modifiedDateStartInput().click();
cy.get("[id^='headlessui-popover-panel-'] .care-l-angle-left-b")
.eq(0)
.closest("button")
.click();
cy.get("[data-test-id='increment-date-range']").click();
cy.get(modified_date_start).click();
cy.get(modified_date_end).click();

Expand Down
12 changes: 3 additions & 9 deletions cypress/pageobject/Users/UserCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ export class UserCreationPage {
.type(value);
}
typeIntoElementByIdPostClearDob(elementId: string, value: string) {
cy.get("#" + elementId).click();
cy.get("#date-input").clear().type(value);
cy.clickAndTypeDate("#" + elementId, value);
}
clearIntoElementById(elementId: string) {
cy.get("#" + elementId)
Expand Down Expand Up @@ -54,13 +53,8 @@ export class UserCreationPage {
this.selectOptionContainingText(name);
}

setInputDate(
dateElementId: string,
inputElementId: string,
dateValue: string,
) {
this.clickElementById(dateElementId);
this.typeIntoElementById(inputElementId, dateValue);
setInputDate(dateElementId: string, dateValue: string) {
cy.clickAndTypeDate("#" + dateElementId, dateValue);
}

selectDropdownOption(dropdownId: string, optionText: string) {
Expand Down
4 changes: 1 addition & 3 deletions cypress/pageobject/Users/UserProfilePage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ export default class UserProfilePage {
}

typedate_of_birth(date_of_birth: string) {
//check
cy.get("#date_of_birth").click();
cy.get("#date-input").clear().type(date_of_birth);
cy.clickAndTypeDate("#date_of_birth", date_of_birth);
}

selectGender(gender: string) {
Expand Down
10 changes: 8 additions & 2 deletions cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,16 @@ Cypress.Commands.add("selectRadioOption", (name: string, value: string) => {
cy.get(`input[type='radio'][name='${name}'][value=${value}]`).click();
});

Cypress.Commands.add("clickAndTypeDate", (selector: string, date: string) => {
Cypress.Commands.add("clickAndTypeDate", (selector, date) => {
cy.get(selector).scrollIntoView();
cy.get(selector).click();
cy.get("#date-input").click().type(date);
cy.get('[data-test-id="date-input"]:visible [data-time-input]').each((el) =>
cy.wrap(el).clear(),
);
cy.get(`[data-test-id="date-input"]:visible [data-time-input="0"]`)
.click()
.type(date);
cy.get("body").click(0, 0);
});

Cypress.Commands.add(
Expand Down
7 changes: 6 additions & 1 deletion src/CAREUI/interactive/SlideOver.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,12 @@ export default function SlideOver({
<h1 className="w-full text-xl font-black">{title}</h1>
</div>
</div>
<div className="flex-1 overflow-auto p-4">{children}</div>
<div
className="flex-1 overflow-auto p-4"
data-test-id="slide-over-container"
>
{children}
</div>
</div>
)}
</DialogPanel>
Expand Down
1 change: 0 additions & 1 deletion src/components/ABDM/FetchRecordsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ export default function FetchRecordsModal({ abha, show, onClose }: IProps) {
label={t("consent_request__expiry")}
required
disablePast
position="TOP-RIGHT"
/>

<div className="mt-6 flex items-center justify-end">
Expand Down
1 change: 0 additions & 1 deletion src/components/Assets/AssetServiceEditModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ export const AssetServiceEditModal = (props: {
label={t("serviced_on")}
name="serviced_on"
className="mt-2"
position="LEFT"
value={new Date(form.serviced_on)}
max={new Date(props.service_record.created_date)}
onChange={(date) => {
Expand Down
Loading
Loading