From 863edfdeb9c1f46fab33868306ad62ac65ca292c Mon Sep 17 00:00:00 2001 From: hiteshkumar87 Date: Fri, 15 Sep 2023 19:43:18 +0530 Subject: [PATCH 01/13] Update index.js --- src/store/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/store/index.js b/src/store/index.js index 5ab4f971a..f685e15ba 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -614,7 +614,7 @@ function getTimeSlotsAdditionalEventData( ) { var numberOfDays = null; if (firstAvailableAppointmentDateString) - numberOfDays = getDateDifferenceInDays(new Date(), firstAvailableAppointmentDateString); + numberOfDays = getDateDifferenceInDays(new Date().toISOString().split("T")[0], firstAvailableAppointmentDateString); if (shopAppointmentType) return `FirstAvailableAppointment:${numberOfDays},Zip:${zipCode},ShopAppointmentType:${shopAppointmentType},ProvisionalTriggers:${provisionalTriggers.join( From deebd15e1ab41a79b50c8e64193428e41dea8ccd Mon Sep 17 00:00:00 2001 From: hiteshkumar87 Date: Fri, 15 Sep 2023 19:50:55 +0530 Subject: [PATCH 02/13] Update index.js --- src/store/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/store/index.js b/src/store/index.js index f685e15ba..40b58b856 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -614,7 +614,10 @@ function getTimeSlotsAdditionalEventData( ) { var numberOfDays = null; if (firstAvailableAppointmentDateString) - numberOfDays = getDateDifferenceInDays(new Date().toISOString().split("T")[0], firstAvailableAppointmentDateString); + numberOfDays = getDateDifferenceInDays( + new Date().toISOString().split("T")[0], + firstAvailableAppointmentDateString + ); if (shopAppointmentType) return `FirstAvailableAppointment:${numberOfDays},Zip:${zipCode},ShopAppointmentType:${shopAppointmentType},ProvisionalTriggers:${provisionalTriggers.join( From bd7be85511a465028694557dba95e1710959db3c Mon Sep 17 00:00:00 2001 From: hiteshkumar87 Date: Mon, 16 Oct 2023 17:03:57 +0530 Subject: [PATCH 03/13] CSR-1417 remove getFullDayName and getFullMonthName from date-helper and use from schedule helper --- src/helpers/date-helper.js | 16 --------------- src/helpers/date-helper.spec.js | 19 +----------------- .../add-to-calendar/add-to-calendar.vue | 2 +- src/layouts/confirmation/confirmation.vue | 20 +++++++++---------- 4 files changed, 12 insertions(+), 45 deletions(-) diff --git a/src/helpers/date-helper.js b/src/helpers/date-helper.js index d42ad326f..7a8c3e71d 100644 --- a/src/helpers/date-helper.js +++ b/src/helpers/date-helper.js @@ -7,22 +7,6 @@ export function getDateDifferenceInDays(startDate, endDate) { // Convert milliseconds to days and return the result return difference / (1000 * 3600 * 24); } -export function getFullDayName(date) { - // Use a ternary operator to check if the input is a valid date object - return date instanceof Date - ? // Use the built-in method toLocaleDateString() to get the full day name in the current locale - date.toLocaleDateString(undefined, { weekday: "long" }) - : // Return undefined if the input is not a valid date object - undefined; -} -export function getFullMonthName(date) { - // Use a ternary operator to check if the input is a valid date object - return date instanceof Date - ? // Use the built-in method toLocaleDateString() to get the full month name in the current locale - date.toLocaleDateString(undefined, { month: "long" }) - : // Return undefined if the input is not a valid date object - undefined; -} export function get12HourTimeFormat(time) { // Check correct time format and split into components time = time.toString().match(/^([01]\d|2[0-3])(:)([0-5]\d)?$/) || [time]; diff --git a/src/helpers/date-helper.spec.js b/src/helpers/date-helper.spec.js index 4ea2157f5..b78397e0f 100644 --- a/src/helpers/date-helper.spec.js +++ b/src/helpers/date-helper.spec.js @@ -1,6 +1,4 @@ import { - getFullDayName, - getFullMonthName, get12HourTimeFormat, get12HourTimeMobileFormat, getDateFormat, @@ -49,22 +47,6 @@ describe("date-helper.js", () => { expect(result).toEqual(testCase.expected); } }); - it("getFullMonthName should return full month format.", () => { - // Arrange / Act - const date = new Date("2023-10-01"); - const monthName = getFullMonthName(date); - - // Assert - expect(monthName).toEqual("October"); - }); - it("getFullDayName should return full Day Name format.", () => { - // Arrange / Act - const date = new Date("2023-10-01"); - const dayName = getFullDayName(date); - - // Assert - expect(dayName).toEqual("Sunday"); - }); it("getDateFormat should return date in the given format.", () => { // Arrange / Act const date = new Date("2023-10-01"); @@ -74,6 +56,7 @@ describe("date-helper.js", () => { // Assert expect(formattedDate).toEqual("2023-10-01"); }); + it("should return the correct difference in days", function () { // Define some sample dates and their expected differences const testCases = [ diff --git a/src/layouts/add-to-calendar/add-to-calendar.vue b/src/layouts/add-to-calendar/add-to-calendar.vue index b0306b5d0..0b856e72d 100644 --- a/src/layouts/add-to-calendar/add-to-calendar.vue +++ b/src/layouts/add-to-calendar/add-to-calendar.vue @@ -127,7 +127,7 @@ export default { serviceType() { const isRepair = store.getters.order.damage.isRepair; const funnelHasRecalibrationPart = store.getters.funnelHasRecalibrationPart; - if (isRepair) { + if (!isRepair) { if (funnelHasRecalibrationPart) { return "replacement and recalibration"; } else { diff --git a/src/layouts/confirmation/confirmation.vue b/src/layouts/confirmation/confirmation.vue index cb7ca43c1..5fa24856d 100644 --- a/src/layouts/confirmation/confirmation.vue +++ b/src/layouts/confirmation/confirmation.vue @@ -55,15 +55,11 @@ import { fetchCmsContentForPage } from "@/helpers/cms-content-helper"; import { AppointmentTypeStrings } from "@/constants/schedule-constants"; import { settleAllPromises } from "@/helpers/layout-helper"; import { applicationConfig } from "@/constants/application-config.js"; +import { convertDateStringToDate } from "@/layouts/schedule/helpers/schedule-helper"; import { Form } from "vee-validate"; import store from "@/store"; -import { - getFullDayName, - getFullMonthName, - get12HourTimeFormat, - get12HourTimeMobileFormat, -} from "@/helpers/date-helper"; +import { get12HourTimeFormat, get12HourTimeMobileFormat } from "@/helpers/date-helper"; export default { name: "confirmation", async beforeRouteEnter(to, from, next) { @@ -174,10 +170,14 @@ export default { return `${this.ProviderAddress},
${this.ProviderCity}, ${this.ProviderState} ${this.ProviderZipCode}`; }, ScheduleDateFormatted() { - const scheduleDate = new Date(this.ScheduleDate); - return `${getFullDayName(scheduleDate)}, ${getFullMonthName( - scheduleDate - )} ${scheduleDate.getDate()}`; + // This conversion ensures we don't get get GMT induced date changes + const dateObject = convertDateStringToDate(this.ScheduleDate); + // Ex: Tuesday, April 22 + return dateObject.toLocaleDateString("en-us", { + weekday: "long", + month: "long", + day: "numeric", + }); }, ScheduleTimeFormatted() { if (this.AppointmentType == AppointmentTypeStrings.MOBILE) { From 1c48dc856a678108b17ca8b9c6fe0a92066131e4 Mon Sep 17 00:00:00 2001 From: hiteshkumar87 Date: Mon, 16 Oct 2023 17:54:54 +0530 Subject: [PATCH 04/13] service-type constant file service-type constant file added --- src/constants/service-type.js | 6 +++++ .../add-to-calendar/add-to-calendar.spec.js | 24 +++++++------------ .../add-to-calendar/add-to-calendar.vue | 7 +++--- 3 files changed, 19 insertions(+), 18 deletions(-) create mode 100644 src/constants/service-type.js diff --git a/src/constants/service-type.js b/src/constants/service-type.js new file mode 100644 index 000000000..5cb6a277a --- /dev/null +++ b/src/constants/service-type.js @@ -0,0 +1,6 @@ +const serviceType = { + REPLACEMENT: "replacement", + REPAIR: "repair", + REPLACEMENT_AND_RECALIBRATION: "replacement and recalibration", +}; +export { serviceType }; diff --git a/src/layouts/add-to-calendar/add-to-calendar.spec.js b/src/layouts/add-to-calendar/add-to-calendar.spec.js index 1e3e5ae4e..645e3b12f 100644 --- a/src/layouts/add-to-calendar/add-to-calendar.spec.js +++ b/src/layouts/add-to-calendar/add-to-calendar.spec.js @@ -77,9 +77,9 @@ describe("Add-to-calendar methods...", () => { //Assert expect(wrapper.vm.$refs.calendarModalQuestion.openModal).toBeCalled(); }); - test("serviceType should return 'replacement and recalibration' when isRepair and funnelHasRecalibrationPart true.", () => { + test("serviceType should return 'replacement and recalibration' when isRepair is false and funnelHasRecalibrationPart true.", () => { //Arrange - store.getters.order.damage.isRepair = true; + store.getters.order.damage.isRepair = false; store.getters.funnelHasRecalibrationPart = true; const { wrapper } = setupMocks({}); @@ -89,9 +89,9 @@ describe("Add-to-calendar methods...", () => { //Assert expect(testValue).toEqual("replacement and recalibration"); }); - test("serviceType should return 'replacement' when isRepair is true and funnelHasRecalibrationPart is false.", () => { + test("serviceType should return 'replacement' when isRepair is false and funnelHasRecalibrationPart is false.", () => { //Arrange - store.getters.order.damage.isRepair = true; + store.getters.order.damage.isRepair = false; store.getters.funnelHasRecalibrationPart = false; const { wrapper } = setupMocks({}); @@ -101,9 +101,9 @@ describe("Add-to-calendar methods...", () => { //Assert expect(testValue).toEqual("replacement"); }); - test("serviceType should return 'repair' when isRepair is false.", () => { + test("serviceType should return 'repair' when isRepair is true.", () => { //Arrange - store.getters.order.damage.isRepair = false; + store.getters.order.damage.isRepair = true; const { wrapper } = setupMocks({}); //Act @@ -126,7 +126,7 @@ describe("Add-to-calendar methods...", () => { test("getappointmentData should return expected model value for appointmentType mobile.", () => { //Arrange store.getters.order.serviceLocation.appointmentType = AppointmentTypeStrings.MOBILE; - store.getters.order.damage.isRepair = true; + store.getters.order.damage.isRepair = false; store.getters.funnelHasRecalibrationPart = true; const { wrapper } = setupMocks({}); @@ -176,7 +176,7 @@ describe("Add-to-calendar methods...", () => { test("getappointmentData should return expected model value for appointmentType DROP_OFF.", () => { //Arrange store.getters.order.serviceLocation.appointmentType = AppointmentTypeStrings.DROP_OFF; - store.getters.order.damage.isRepair = false; + store.getters.order.damage.isRepair = true; const { wrapper } = setupMocks({}); //Act @@ -188,7 +188,7 @@ describe("Add-to-calendar methods...", () => { test("getappointmentData should return expected model value for appointmentType IN_SHOP.", () => { //Arrange store.getters.order.serviceLocation.appointmentType = AppointmentTypeStrings.IN_SHOP; - store.getters.order.damage.isRepair = false; + store.getters.order.damage.isRepair = true; const { wrapper } = setupMocks({}); //Act @@ -239,12 +239,6 @@ function setupMocks({ customMountOptions }) { }); const wrapper = shallowMount(addToCalendar, mountOptions); - - //wrapper.vm.setCmsContent = jest.fn(); - //wrapper.vm.$refs.datePicker.initializeComponent = jest.fn(); - //wrapper.vm.$refs.locationAlerts.initializeComponent = jest.fn(); - //wrapper.vm.$refs.funnelFooter.updateButtonText = jest.fn(); wrapper.vm.$refs.calendarModalQuestion.openModal = jest.fn(); - return { wrapper }; } diff --git a/src/layouts/add-to-calendar/add-to-calendar.vue b/src/layouts/add-to-calendar/add-to-calendar.vue index 0b856e72d..3f32a525b 100644 --- a/src/layouts/add-to-calendar/add-to-calendar.vue +++ b/src/layouts/add-to-calendar/add-to-calendar.vue @@ -32,6 +32,7 @@ import { import { getCalendarFile, download } from "@/helpers/add-to-calendar-helper"; import { AppointmentTypeStrings, RouteCodeFlags } from "@/constants/schedule-constants"; import store from "@/store"; +import { serviceType } from "@/constants/service-type"; export default { name: "add-to-calendar", @@ -129,12 +130,12 @@ export default { const funnelHasRecalibrationPart = store.getters.funnelHasRecalibrationPart; if (!isRepair) { if (funnelHasRecalibrationPart) { - return "replacement and recalibration"; + return serviceType.REPLACEMENT_AND_RECALIBRATION; } else { - return "replacement"; + return serviceType.REPLACEMENT; } } - return "repair"; + return serviceType.REPAIR; }, routeCode() { return store.getters.order.schedule.routeCode; From 3d23bdbabcb1ed2e71b6ec8be3a24c6aaf2a2fb6 Mon Sep 17 00:00:00 2001 From: Bryan Mauger Date: Mon, 16 Oct 2023 08:38:23 -0400 Subject: [PATCH 05/13] CSR-1593 set column width to control overly-wide components on larger screens. Change scroll to auto for modals to avoid ghost scrollbars when not needed. Center content on all screen sizes. --- src/digital-components/modal/modal.vue | 2 +- .../questions-page-layout.vue | 6 +++--- src/layouts/address-lookup/address-lookup.vue | 2 +- .../address-vehicles/address-vehicles.vue | 2 +- src/layouts/confirmation/confirmation.vue | 2 +- .../customer-details/customer-details.vue | 2 +- src/layouts/estimate/estimate.vue | 2 +- .../license-plate-lookup.vue | 2 +- src/layouts/payment-method/payment-method.vue | 2 +- src/layouts/quote/quote.vue | 2 +- src/layouts/schedule/schedule.vue | 2 +- .../service-location/service-location.vue | 8 ++++---- src/layouts/vehicle-damage/vehicle-damage.vue | 8 ++++---- src/layouts/vehicle-parts/vehicle-parts.vue | 4 ++-- src/layouts/vin-lookup/vin-lookup.vue | 2 +- src/styles/common-styles.scss | 18 ++++++++++++++++++ 16 files changed, 42 insertions(+), 24 deletions(-) diff --git a/src/digital-components/modal/modal.vue b/src/digital-components/modal/modal.vue index e0353829c..413ca0369 100644 --- a/src/digital-components/modal/modal.vue +++ b/src/digital-components/modal/modal.vue @@ -179,7 +179,7 @@ export default { } } @include media-breakpoint-up(md) { - overflow: scroll; + overflow: auto; flex: none; } } diff --git a/src/fmg-components/layouts/questions-page-layout/questions-page-layout.vue b/src/fmg-components/layouts/questions-page-layout/questions-page-layout.vue index 73d810cc7..8fc382bf0 100644 --- a/src/fmg-components/layouts/questions-page-layout/questions-page-layout.vue +++ b/src/fmg-components/layouts/questions-page-layout/questions-page-layout.vue @@ -7,7 +7,7 @@ -
+
-
+
-
+
-
+
-
+
-
+
diff --git a/src/layouts/customer-details/customer-details.vue b/src/layouts/customer-details/customer-details.vue index 9568b2a13..6e5fc0f09 100644 --- a/src/layouts/customer-details/customer-details.vue +++ b/src/layouts/customer-details/customer-details.vue @@ -6,7 +6,7 @@
-
+
-
+
diff --git a/src/layouts/license-plate-lookup/license-plate-lookup.vue b/src/layouts/license-plate-lookup/license-plate-lookup.vue index ac167cae9..fc3756b6d 100644 --- a/src/layouts/license-plate-lookup/license-plate-lookup.vue +++ b/src/layouts/license-plate-lookup/license-plate-lookup.vue @@ -6,7 +6,7 @@
-
+
-
+
-
+
-
+