From cd94b853ee06a8b456464964731cfe080d29fe99 Mon Sep 17 00:00:00 2001 From: scottkiener-at-safelite Date: Mon, 4 May 2026 15:12:22 -0400 Subject: [PATCH] Wire in in-shop timeslots call and map the dates --- src/layouts/scheduling/scheduling.vue | 34 ++++++++++++++++----------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/src/layouts/scheduling/scheduling.vue b/src/layouts/scheduling/scheduling.vue index 8f12b2554..ea3f715b0 100644 --- a/src/layouts/scheduling/scheduling.vue +++ b/src/layouts/scheduling/scheduling.vue @@ -50,10 +50,6 @@ import { } from "@/helpers/page-prerequisites-helper.js"; import { debugLog } from "@/helpers/debug-log-helper"; -// Mock scheduling helpers — replace with real API data when integrating -// Offsets of available days within any 15-day block (gaps on days 2, 6, 7, 10, 13) -const MOCK_AVAILABLE_OFFSETS = [0, 1, 3, 4, 5, 8, 9, 11, 12, 14]; - function toDateString(offsetDays, base = new Date()) { const d = new Date(base); d.setDate(d.getDate() + offsetDays); @@ -68,24 +64,40 @@ export default { resultKey: "cmsContent", promise: fetchCmsContentForPage(to.name), }, + { + resultKey: "InshopOrDropoffTimeSlots", + promise: store.dispatch("getShopTimeSlots", { + payload: { + startDate: toDateString(0), + endDate: toDateString(15), + shopAppointmentType: "InshopOrDropoff", + providerNumber: "003417", + }, + pageNameToLog: to.name, + }), + }, ]; const resultMap = await settleAllPromises(promiseResultMap); next((vm) => { vm.setCmsContent(resultMap.cmsContent); + vm.InshopOrDropoffTimeSlots = resultMap.InshopOrDropoffTimeSlots; }); }, computed: { serviceLocationText() { return this.getCmsContent("ServiceLocationText", "Text"); }, + availableDates() { + return (this.InshopOrDropoffTimeSlots?.days ?? []).map((d) => d.date); + }, }, data() { return { selectedDate: null, isLoadingDates: false, datePickerStartDate: toDateString(0), - datePickerEndDate: toDateString(14), - availableDates: MOCK_AVAILABLE_OFFSETS.map((n) => toDateString(n)), + datePickerEndDate: toDateString(15), + InshopOrDropoffTimeSlots: null, }; }, methods: { @@ -139,14 +151,8 @@ export default { this.isLoadingDates = true; this.$refs.loadingModal.showModal(); - await new Promise((resolve) => setTimeout(resolve, 1000)); - - const currentEnd = new Date( - ...this.datePickerEndDate.split("-").map((n, i) => (i === 1 ? Number(n) - 1 : Number(n))) - ); - const newAvailable = MOCK_AVAILABLE_OFFSETS.map((n) => toDateString(n + 1, currentEnd)); - this.availableDates = [...this.availableDates, ...newAvailable]; - this.datePickerEndDate = toDateString(15, currentEnd); + // TODO: call getShopTimeSlots with the next date range and append results + // to this.availableDates and advance this.datePickerEndDate this.isLoadingDates = false; this.$refs.loadingModal.hideModal();