{{ this.ScheduleDateFormatted }}
-{{ this.ScheduleTimeFormatted }}
+{{ ScheduleDateFormatted }}
+{{ ScheduleTimeFormatted }}
diff --git a/src/digital-components/modal/modal.vue b/src/digital-components/modal/modal.vue
index 0fed54f45..67eca497a 100644
--- a/src/digital-components/modal/modal.vue
+++ b/src/digital-components/modal/modal.vue
@@ -198,10 +198,6 @@ export default {
button {
margin: 0;
}
- @include media-breakpoint-up(md) {
- position: relative;
- background-color: transparent;
- }
}
}
&.show .modal-dialog {
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 645e3b12f..14b6d978b 100644
--- a/src/layouts/add-to-calendar/add-to-calendar.spec.js
+++ b/src/layouts/add-to-calendar/add-to-calendar.spec.js
@@ -69,7 +69,23 @@ afterEach(() => {
describe("Add-to-calendar methods...", () => {
test("Add-to-calendar should trigger openModal method", () => {
//Arrange
- const { wrapper } = setupMocks({});
+
+ const { wrapper } = setupMocks({
+ customMountOptions: {
+ propsData: {
+ appointment: {
+ RefrrlSeqNum: "123456",
+ StartDate: new Date(2023, 9, 11, 12, 0, 0),
+ EndDate: new Date(2023, 9, 11, 13, 0, 0),
+ Subject: "Meeting with John",
+ Location: "Conference Room",
+ Body: "Discuss the project progress",
+ IsHTML: true,
+ Duration: "1220",
+ },
+ },
+ },
+ });
//Act
wrapper.vm.openCalendarModal();
@@ -77,45 +93,26 @@ describe("Add-to-calendar methods...", () => {
//Assert
expect(wrapper.vm.$refs.calendarModalQuestion.openModal).toBeCalled();
});
- test("serviceType should return 'replacement and recalibration' when isRepair is false and funnelHasRecalibrationPart true.", () => {
- //Arrange
- store.getters.order.damage.isRepair = false;
- store.getters.funnelHasRecalibrationPart = true;
- const { wrapper } = setupMocks({});
- //Act
- const testValue = wrapper.vm.serviceType();
-
- //Assert
- expect(testValue).toEqual("replacement and recalibration");
- });
- test("serviceType should return 'replacement' when isRepair is false and funnelHasRecalibrationPart is false.", () => {
- //Arrange
- store.getters.order.damage.isRepair = false;
- store.getters.funnelHasRecalibrationPart = false;
- const { wrapper } = setupMocks({});
-
- //Act
- const testValue = wrapper.vm.serviceType();
-
- //Assert
- expect(testValue).toEqual("replacement");
- });
- test("serviceType should return 'repair' when isRepair is true.", () => {
- //Arrange
- store.getters.order.damage.isRepair = true;
- const { wrapper } = setupMocks({});
-
- //Act
- const testValue = wrapper.vm.serviceType();
-
- //Assert
- expect(testValue).toEqual("repair");
- });
test("getCalendarData should return expected model value.", () => {
//Arrange
const type = calendarOptions.OUTLOOKCOM;
- const { wrapper } = setupMocks({});
+ const { wrapper } = setupMocks({
+ customMountOptions: {
+ propsData: {
+ appointment: {
+ RefrrlSeqNum: "123456",
+ StartDate: new Date(2023, 9, 11, 12, 0, 0),
+ EndDate: new Date(2023, 9, 11, 13, 0, 0),
+ Subject: "Meeting with John",
+ Location: "Conference Room",
+ Body: "Discuss the project progress",
+ IsHTML: true,
+ Duration: "1220",
+ },
+ },
+ },
+ });
//Act
const testValue = wrapper.vm.getCalendarData(type);
@@ -123,95 +120,26 @@ describe("Add-to-calendar methods...", () => {
//Assert
expect(testValue.name).toEqual(calendarOptions.OUTLOOKCOM);
});
- test("getappointmentData should return expected model value for appointmentType mobile.", () => {
- //Arrange
- store.getters.order.serviceLocation.appointmentType = AppointmentTypeStrings.MOBILE;
- store.getters.order.damage.isRepair = false;
- store.getters.funnelHasRecalibrationPart = true;
- const { wrapper } = setupMocks({});
- //Act
- const testValue = wrapper.vm.getappointmentData();
-
- //Assert
- expect(testValue.Subject).toEqual("Safelite replacement and recalibration appointment");
- });
- test("getappointmentData should return expected model value for appointmentType DROP_OFF and OVERNIGHT_DROP_OFF.", () => {
- //Arrange
- store.getters.order.serviceLocation.appointmentType = AppointmentTypeStrings.DROP_OFF;
- store.getters.order.schedule.routeCode = RouteCodeFlags.OVERNIGHT_DROP_OFF;
- const { wrapper } = setupMocks({});
-
- //Act
- const testValue = wrapper.vm.getappointmentData();
-
- //Assert
- expect(testValue.Subject).toEqual("Drop off your vehicle by 5:30 PM");
- });
- test("getappointmentData should return expected model value for appointmentType DROP_OFF and ALL_DAY_DROP_OFF and isSameDayDropOff.", () => {
- //Arrange
- store.getters.order.serviceLocation.appointmentType = AppointmentTypeStrings.DROP_OFF;
- store.getters.order.schedule.routeCode = RouteCodeFlags.ALL_DAY_DROP_OFF;
- store.getters.order.schedule.date = new Date().toISOString().split("T")[0];
- const { wrapper } = setupMocks({});
-
- //Act
- const testValue = wrapper.vm.getappointmentData();
-
- //Assert
- expect(testValue.Subject).toEqual("Drop off your vehicle in the next 30 - 60 minutes");
- });
- test("getappointmentData should return expected model value for appointmentType DROP_OFF and ALL_DAY_DROP_OFF.", () => {
- //Arrange
- store.getters.order.serviceLocation.appointmentType = AppointmentTypeStrings.DROP_OFF;
- store.getters.order.schedule.routeCode = RouteCodeFlags.ALL_DAY_DROP_OFF;
- const { wrapper } = setupMocks({});
-
- //Act
- const testValue = wrapper.vm.getappointmentData();
-
- //Assert
- expect(testValue.Subject).toEqual("Drop off your vehicle between 9:00 AM - 11:00 AM");
- });
- 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 = true;
- const { wrapper } = setupMocks({});
-
- //Act
- const testValue = wrapper.vm.getappointmentData();
-
- //Assert
- expect(testValue.Subject).toEqual("Safelite repair appointment");
- });
- 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 = true;
- const { wrapper } = setupMocks({});
-
- //Act
- const testValue = wrapper.vm.getappointmentData();
-
- //Assert
- expect(testValue.Subject).toEqual("Safelite repair appointment");
- });
- test("isSameDayDropOff should return true for current schedule date.", () => {
- //Arrange
- store.getters.order.schedule.date = new Date().toISOString().split("T")[0];
- const { wrapper } = setupMocks({});
-
- //Act
- const testValue = wrapper.vm.isSameDayDropOff();
-
- //Assert
- expect(testValue).toEqual(true);
- });
test("setCalendarAppointment should call getAppointment method for iCAL and Outlook.", () => {
//Arrange
const newValue = { name: calendarOptions.OUTLOOK };
- const { wrapper } = setupMocks({});
+ const { wrapper } = setupMocks({
+ customMountOptions: {
+ propsData: {
+ appointment: {
+ RefrrlSeqNum: "123456",
+ StartDate: new Date(2023, 9, 11, 12, 0, 0),
+ EndDate: new Date(2023, 9, 11, 13, 0, 0),
+ Subject: "Meeting with John",
+ Location: "Conference Room",
+ Body: "Discuss the project progress",
+ IsHTML: true,
+ Duration: "1220",
+ },
+ },
+ },
+ });
wrapper.vm.getAppointment = jest.fn();
//Act
wrapper.vm.setCalendarAppointment(newValue);
@@ -222,7 +150,22 @@ describe("Add-to-calendar methods...", () => {
test("setCalendarAppointment should call window.open for Google, yahoo and Outlook.com.", () => {
//Arrange
const newValue = { name: calendarOptions.GOOGLE };
- const { wrapper } = setupMocks({});
+ const { wrapper } = setupMocks({
+ customMountOptions: {
+ propsData: {
+ appointment: {
+ RefrrlSeqNum: "123456",
+ StartDate: new Date(2023, 9, 11, 12, 0, 0),
+ EndDate: new Date(2023, 9, 11, 13, 0, 0),
+ Subject: "Meeting with John",
+ Location: "Conference Room",
+ Body: "Discuss the project progress",
+ IsHTML: true,
+ Duration: "1220",
+ },
+ },
+ },
+ });
window.open = jest.fn();
//Act
diff --git a/src/layouts/add-to-calendar/add-to-calendar.vue b/src/layouts/add-to-calendar/add-to-calendar.vue
index 3f32a525b..afd9942ea 100644
--- a/src/layouts/add-to-calendar/add-to-calendar.vue
+++ b/src/layouts/add-to-calendar/add-to-calendar.vue
@@ -22,26 +22,19 @@
import { calendarOptions } from "@/constants/calendar-options";
import { calendarStatus } from "@/constants/calendar-status";
import calendarModalQuestion from "@/layouts/add-to-calendar/calendar-modal-question/calendar-modal-question";
-import {
- getDateFormat,
- calculateDuration,
- combineDateAndTime,
- shortTimeString,
- addMinutes,
-} from "@/helpers/date-helper";
+import { getDateFormat } from "@/helpers/date-helper";
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",
components: {
calendarModalQuestion,
},
+ props: {
+ appointment: Object,
+ },
data() {
return {
- appointment: this.getappointmentData(),
selectedCalendarOption: null,
};
},
@@ -83,67 +76,6 @@ export default {
openCalendarModal() {
this.$refs["calendarModalQuestion"].openModal();
},
- scheduleDate() {
- return store.getters.order.schedule.date;
- },
- scheduleStartTime() {
- return store.getters.order.schedule.startTime;
- },
- scheduleEndTime() {
- return store.getters.order.schedule.endTime;
- },
- serviceLocationAddress() {
- return store.getters.order.serviceLocation.address;
- },
- ServiceLocationAddress2() {
- return store.getters.order.serviceLocation.address2;
- },
- serviceLocationCity() {
- return store.getters.order.serviceLocation.city;
- },
- serviceLocationState() {
- return store.getters.order.serviceLocation.state;
- },
- serviceLocationZipCode() {
- return store.getters.order.serviceLocation.zipCode;
- },
- providerAddress() {
- return store.getters.order.serviceLocation.provider.address.streetAddress;
- },
- providerCity() {
- return store.getters.order.serviceLocation.provider.address.city;
- },
- providerState() {
- return store.getters.order.serviceLocation.provider.address.state;
- },
- providerZipCode() {
- return store.getters.order.serviceLocation.provider.address.zipCode;
- },
- appointmentType() {
- return store.getters.order.serviceLocation.appointmentType;
- },
- uniqueId() {
- return store.getters.order.referralNumber?.toString();
- },
- serviceType() {
- const isRepair = store.getters.order.damage.isRepair;
- const funnelHasRecalibrationPart = store.getters.funnelHasRecalibrationPart;
- if (!isRepair) {
- if (funnelHasRecalibrationPart) {
- return serviceType.REPLACEMENT_AND_RECALIBRATION;
- } else {
- return serviceType.REPLACEMENT;
- }
- }
- return serviceType.REPAIR;
- },
- routeCode() {
- return store.getters.order.schedule.routeCode;
- },
- isSameDayDropOff() {
- const todaysDate = new Date().toISOString().split("T")[0];
- return this.scheduleDate() === todaysDate;
- },
getCalendarData(type) {
var URL = "";
const dateFormat = "yyyyMMddTHHmmss";
@@ -185,72 +117,6 @@ export default {
icon: require(`@/assets/img/icons/${type}.svg`),
};
},
- getappointmentData() {
- var subject = "";
- var location = "";
- var startDateTime = combineDateAndTime(this.scheduleDate(), this.scheduleStartTime());
- var endDateTime = combineDateAndTime(this.scheduleDate(), this.scheduleEndTime());
- var body = "";
- var isHTML = false;
- var duration = "";
-
- if (this.appointmentType() === AppointmentTypeStrings.MOBILE) {
- location = `${
- this.ServiceLocationAddress2() ? this.ServiceLocationAddress2() + ", " : ""
- }${this.serviceLocationAddress()}, ${this.serviceLocationCity()}, ${this.serviceLocationState()} ${this.serviceLocationZipCode()}`;
- subject = `Safelite ${this.serviceType()} appointment`;
-
- body =
- "Your safety is our top priority, so we'll let you know who's coming to you and your tech will reach out to let you know when they're on the way.";
- } else {
- location = `${this.providerAddress()}, ${this.providerCity()}, ${this.providerState()} ${this.providerZipCode()}`;
- if (this.appointmentType() === AppointmentTypeStrings.DROP_OFF) {
- if (this.routeCode().includes(RouteCodeFlags.OVERNIGHT_DROP_OFF)) {
- subject = "Drop off your vehicle by 5:30 PM";
-
- body =
- "Drop off your vehicle by 5:30 PM the night of your scheduled appointment. The shop will work with you on a convenient pick-up time.";
- } else if (this.routeCode().includes(RouteCodeFlags.ALL_DAY_DROP_OFF)) {
- if (this.isSameDayDropOff()) {
- subject = "Drop off your vehicle in the next 30 - 60 minutes";
- endDateTime = addMinutes(startDateTime, 120);
- body =
- "Drop your vehicle off in the next 30 - 60 minutes. We'll work your vehicle into our day's schedule. The shop will work with you on a convenient pick-up time.";
- } else {
- endDateTime = addMinutes(startDateTime, 120);
- subject =
- "Drop off your vehicle between " +
- shortTimeString(startDateTime) +
- " - " +
- shortTimeString(endDateTime);
-
- body = `Drop off your vehicle by ${shortTimeString(
- endDateTime
- )} and pick it up later in the day. When you arrive, park in an open space and follow the key drop instructions. We'll text you when your vehicle is ready.`;
- }
- } //normal time slot
- else {
- subject = `Safelite ${this.serviceType()} appointment`;
- body = "Just a reminder that you're coming to us at " + location + ".";
- }
- } else {
- subject = `Safelite ${this.serviceType()} appointment`;
- body = "Just a reminder that you're coming to us at " + location + ".";
- }
- duration = calculateDuration(startDateTime, endDateTime);
- }
- return {
- Subject: subject,
- Location: location,
- StartDate: startDateTime,
- EndDate: endDateTime,
- RefrrlSeqNum: this.uniqueId(),
- Body: body,
- IsHTML: isHTML,
- Duration: duration,
- };
- },
-
getAppointment() {
let body = this.appointment.Body;
body = body.replace("|", "<").replace("~", ">");
diff --git a/src/layouts/confirmation/confirmation.spec.js b/src/layouts/confirmation/confirmation.spec.js
index eb77afcb1..4bef5f8a3 100644
--- a/src/layouts/confirmation/confirmation.spec.js
+++ b/src/layouts/confirmation/confirmation.spec.js
@@ -115,16 +115,16 @@ describe("confirmation.vue", () => {
});
});
describe("computed properties...", () => {
- // test("ScheduleDateFormatted should return date in expected format.", () => {
- // //Arrange
- // const { wrapper } = setupMocks({});
+ test("ScheduleDateFormatted should return date in expected format.", () => {
+ //Arrange
+ const { wrapper } = setupMocks({});
- // // Act
- // const testValue = wrapper.vm.ScheduleDateFormatted;
+ // Act
+ const testValue = wrapper.vm.ScheduleDateFormatted;
- // // Assert
- // expect(testValue).toEqual("Sunday, January 1");
- // });
+ // Assert
+ expect(testValue).toEqual("Sunday, January 1");
+ });
test("ScheduleTimeFormatted should return mobile time in expected format.", () => {
//Arrange
store.getters.order.serviceLocation.appointmentType = AppointmentTypeStrings.MOBILE;
diff --git a/src/layouts/confirmation/confirmation.vue b/src/layouts/confirmation/confirmation.vue
index f0af10529..1ced1c495 100644
--- a/src/layouts/confirmation/confirmation.vue
+++ b/src/layouts/confirmation/confirmation.vue
@@ -10,10 +10,6 @@
-
{{ this.ScheduleDateFormatted }}
-{{ this.ScheduleTimeFormatted }}
+{{ ScheduleDateFormatted }}
+{{ ScheduleTimeFormatted }}