1import{k as M,C as a,E as o,F as t,G as i,H as u,I as p,O as y,K as c,M as m,N as g,L as D}from"./@vue-5319c5cc.js";import{_ as Y,D as x,h as v}from"./main-d4383649.js";import{M as $}from"./Footer-6d9291be.js";import{S}from"./SimpleHeader-648751f6.js";import{C}from"./CustomerHelp-7e067f55.js";import{h as f}from"./moment-fbc5633a.js";import{b as T}from"./vue-router-42226a4c.js";import{u as E}from"./@unhead-9e3f7909.js";import"./vuex-acdfc790.js";import"./axios-a342f982.js";import"./sweetalert2-83f7d833.js";import"./click-outside-vue3-c4fa2243.js";import"./yup-phone-lite-113193ff.js";import"./yup-4b41f893.js";import"./nanoclone-8dc95fbc.js";import"./lodash-c9533085.js";import"./property-expr-38205fa5.js";import"./toposort-47e1d23b.js";import"./libphonenumber-js-0deec75d.js";import"./lodash.clonedeep-e678ee7f.js";import"./@vueuse-9afea8b7.js";/* empty css */import"./@sentry-757d3dd0.js";import"./unhead-61a90b96.js";import"./hookable-e7fd869b.js";import"./LoadingJourney-2c02abf2.js";import"./vee-validate-7754014b.js";import"./open-live-chat-27c5f870.js";const I=M({props:{orderType:{type:String,default:""},fittingDate:{type:String,default:null},selectedDates:{type:Array,default:()=>[]},disabled:{type:Boolean,default:!1}},emits:["toggle"],data(){return{calendarDate:f().startOf("month"),weekdays:["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]}},computed:{today(){return f().startOf("day")},earliestSelectableDate(){return this.today.clone().add(2,"days")},previousMonth(){return this.calendarDate.clone().subtract(1,"month")},thisMonth(){return this.calendarDate.clone()},nextMonth(){return this.calendarDate.clone().add(1,"month")},calendarDays(){const e=this.calendarDate.clone().startOf("month"),s=e.isoWeekday()-1,d=[];for(let l=0;l<s;l++)d.push({date:e.clone().subtract(s-l,"days"),available:!1,blank:!0});for(let l=1;l<=this.calendarDate.daysInMonth();l++){const h=e.clone().date(l);d.push({date:h,available:this.isSelectable(h),blank:!1})}for(;d.length%7!==0;)d.push({date:e.clone().add(d.length-s,"days"),available:!1,blank:!0});return d}},watch:{fittingDate(e){this.setInitialMonth(e)}},mounted(){this.setInitialMonth(this.fittingDate)},methods:{setInitialMonth(e){const s=e?f(e).startOf("month"):this.today.clone().startOf("month");this.calendarDate=s.isValid()&&!s.isBefore(this.today,"month")?s:this.today.clone().startOf("month")},changeCalendarDate(e){e.isBefore(this.today,"month")||(this.calendarDate=e.clone().startOf("month"))},isSelectable(e){return e.isBefore(this.earliestSelectableDate,"day")||e.day()===0||this.orderType.includes("conversion")&&[5,6].includes(e.day())?!1:this.fittingDate!==e.format("YYYY-MM-DD")},isPreferredDay(e){return!e.blank&&!!this.fittingDate&&e.date.format("YYYY-MM-DD")===this.fittingDate},unavailableLabel(e){return`${e.date.format("dddd D MMMM YYYY")}, ${this.isPreferredDay(e)?"preferred date":"unavailable"}`},toggleDate(e){e.available&&!this.disabled&&this.$emit("toggle",e.date.format("YYYY-MM-DD"))}}}),j={"aria-labelledby":"suggest-dates-calendar-title"},L={class:"flex items-center justify-between gap-2"},W={class:"text-lg font-medium text-gray-900",id:"suggest-dates-calendar-title"},H={class:"flex items-center gap-2"},O=["disabled","aria-label"],B=t("i",{class:"fa-solid fa-chevron-left","aria-hidden":"true"},null,-1),R=[B],N=["aria-label"],P=t("i",{class:"fa-solid fa-chevron-right","aria-hidden":"true"},null,-1),F=[P],V=t("p",{class:"mt-2 text-sm leading-6 text-gray-600"},"Choose all the dates that work for you. The earliest date you can choose is two days from today.",-1),q={class:"mt-5 grid grid-cols-7 gap-1 sm:gap-2"},A={key:0,class:"aspect-square","aria-hidden":"true"},z=["disabled","aria-label","checked","onChange"],G={key:0,class:"fa-solid fa-check text-xs","aria-hidden":"true"},K=["aria-label"];function U(e,s,d,l,h,k){return a(),o("section",j,[t("div",L,[t("h2",W,i(e.thisMonth.format("MMMM YYYY")),1),t("div",H,[t("button",{class:"flex h-11 w-11 items-center justify-center rounded-full bg-gray-200 text-gray-900 hover:bg-gray-300 disabled:cursor-not-allowed disabled:opacity-40",type:"button",disabled:e.previousMonth.isBefore(e.today,"month"),"aria-label":`Previous month, ${e.previousMonth.format("MMMM YYYY")}`,onClick:s[0]||(s[0]=r=>e.changeCalendarDate(e.previousMonth))},R,8,O),t("button",{class:"flex h-11 w-11 items-center justify-center rounded-full bg-gray-200 text-gray-900 hover:bg-gray-300",type:"button","aria-label":`Next month, ${e.nextMonth.format("MMMM YYYY")}`,onClick:s[1]||(s[1]=r=>e.changeCalendarDate(e.nextMonth))},F,8,N)])]),V,t("div",q,[(a(!0),o(u,null,p(e.weekdays,r=>(a(),o("span",{class:"py-1 text-center text-xs font-medium text-gray-600",key:r},i(r),1))),128)),(a(!0),o(u,null,p(e.calendarDays,r=>(a(),o(u,{key:r.date.format("YYYY-MM-DD")},[r.blank?(a(),o("span",A)):r.available?(a(),o("label",{key:1,class:y(["flex aspect-square cursor-pointer flex-col items-center justify-center rounded-lg border text-xs font-medium leading-tight focus-within:outline focus-within:outline-2 focus-within:outline-offset-2 focus-within:outline-gray-900",e.selectedDates.includes(r.date.format("YYYY-MM-DD"))?"border-primary bg-primary text-white":"border-gray-300 bg-white text-gray-900 hover:border-gray-900"])},[t("input",{class:"sr-only",type:"checkbox",disabled:e.disabled,"aria-label":r.date.format("dddd D MMMM YYYY"),checked:e.selectedDates.includes(r.date.format("YYYY-MM-DD")),onChange:b=>e.toggleDate(r)},null,40,z),t("span",null,i(r.date.date()),1),e.selectedDates.includes(r.date.format("YYYY-MM-DD"))?(a(),o("i",G)):c("",!0)],2)):(a(),o("span",{key:2,class:"flex aspect-square flex-col items-center justify-center rounded-lg bg-gray-100 text-xs text-gray-500","aria-label":e.unavailableLabel(r)},[t("span",null,i(r.date.date()),1)],8,K))],64))),128))])])}const J=Y(I,[["render",U]]),Q=M({components:{SimpleHeader:S,MainFooter:$,CustomerHelp:C,SuggestDatesCalendar:J},setup(){const e=T();return E({title:"Suggest alternative dates - iHeat",meta:[{name:"description",content:""},{property:"og:title",content:"Suggest alternative dates - iHeat"},{property:"og:description",content:""},...x.facebook,{name:"twitter:title",content:"Suggest alternative dates - iHeat"},{name:"twitter:description",content:""},...x.twitter]}),{route:e}},data(){return{loading:!0,loadError:!1,orderId:"",orderType:"",fittingDate:null,fittingDateReadable:"",selectedDates:[],hasSubmittedDates:!1,canSubmit:!1,saved:!1,submitting:!1,submissionError:""}},computed:{sortedSelectedDates(){return[...this.selectedDates].sort((e,s)=>e.localeCompare(s))}},mounted(){this.load(String(this.route.params.order??""))},methods:{async load(e){if(!e){this.loadError=!0,this.loading=!1;return}this.loading=!0,this.loadError=!1;try{const s=await v.api.get(`/order/${e}/suggest-dates`);this.orderId=s.data.orderId,this.orderType=s.data.orderType??"",this.fittingDate=s.data.fittingDate??null,this.fittingDateReadable=s.data.fittingDateReadable??"",this.selectedDates=[...s.data.submittedDates??[]],this.hasSubmittedDates=this.selectedDates.length>0,this.canSubmit=s.data.canSubmit??!1}catch{this.loadError=!0}finally{this.loading=!1}},formatDateLabel(e){return f(e).format("dddd D MMMM YYYY")},toggleDate(e){this.submitting||(this.submissionError="",this.selectedDates.includes(e)?this.removeDate(e):this.selectedDates=[...this.selectedDates,e])},removeDate(e){this.submitting||(this.selectedDates=this.selectedDates.filter(s=>s!==e))},async submit(){var e;if(!(!this.orderId||this.submitting||this.selectedDates.length===0)){this.submitting=!0,this.submissionError="";try{await v.api.post(`/order/${this.orderId}/suggest-dates`,{dates:this.selectedDates}),this.hasSubmittedDates=!0,this.saved=!0,await this.$nextTick(),(e=this.$refs.pageHeading)==null||e.focus()}catch{this.submissionError="We could not send your dates. Please try again or c
1ontact us."}finally{this.submitting=!1}}}}}),X={class:"min-h-screen bg-gray-100"},Z={class:"mx-6"},ee={class:"mx-auto flex w-full max-w-xl flex-col gap-6 pb-14 pt-10 text-primary md:pt-14"},te={class:"flex flex-col items-center gap-3 text-center"},se={key:0,class:"text-sm leading-6 text-gray-600"},ae={key:0,class:"rounded-2xl border border-gray-200 bg-white p-5"},oe=t("p",{class:"text-sm leading-6 text-gray-700"},"We could not load this page. Please try again.",-1),re={key:1,class:"rounded-2xl border border-gray-200 bg-white p-5"},ie=t("p",{class:"text-sm leading-6 text-gray-700"},"An engineer has been assigned to your order. Contact us if you need to change your installation date.",-1),ne=[ie],le={key:2,class:"rounded-2xl border border-gray-200 bg-white p-5"},de=t("h2",{class:"text-lg font-medium text-gray-900"},"What happens next",-1),ue=t("p",{class:"mt-2 text-sm leading-6 text-gray-700"},"We have shared your suggested dates with our team. These dates are not booked yet. We will contact you when we have an update.",-1),ce=t("h3",{class:"mt-5 text-sm font-medium text-gray-900"},"Dates you sent",-1),he={class:"mt-2 flex flex-col gap-2"},me={key:3,class:"rounded-2xl border border-gray-200 bg-white p-5"},ge={key:0,class:"text-sm leading-6 text-gray-700"},fe={key:1,class:"text-sm leading-6 text-gray-700"},pe={key:2,class:"mt-3 text-sm leading-6 text-gray-600"},ye={key:3,class:"mt-3 text-sm leading-6 text-gray-600"},be=t("h2",{class:"mt-6 text-lg font-medium text-gray-900"},"Your suggested dates",-1),De={class:"mt-3 flex flex-col gap-2"},xe={class:"text-sm font-medium text-gray-900"},ve=["aria-label","onClick","disabled"],Me={key:5,class:"mt-4 text-sm leading-6 text-red-700",role:"alert"},Ye=["disabled"],ke=t("p",{class:"mt-3 text-sm leading-6 text-gray-600"},"Choosing a date does not book it. We will contact you after checking availability.",-1);function we(e,s,d,l,h,k){const r=m("simple-header"),b=m("suggest-dates-calendar"),w=m("customer-help"),_=m("main-footer");return a(),o("div",null,[g(r,{withProgress:!1}),t("div",X,[t("div",Z,[t("main",ee,[e.loading?c("",!0):(a(),o(u,{key:0},[t("header",te,[t("div",{class:y(["flex h-16 w-16 items-center justify-center rounded-full",e.saved?"bg-green-100":"bg-gray-200"]),"aria-hidden":"true"},[t("i",{class:y(["text-2xl",e.saved?"fa-solid fa-check text-green-700":"fa-regular fa-calendar text-gray-700"])},null,2)],2),t("h1",{class:"text-3xl font-semibold text-gray-900 md:text-4xl",tabindex:"-1",ref:"pageHeading"},i(e.loadError?"Installation dates unavailable":e.saved?"Dates sent to our team":e.canSubmit?"Suggest alternative dates":"Your installation is booked"),513),e.orderId?(a(),o("p",se,"Order reference: "+i(e.orderId),1)):c("",!0)]),e.loadError?(a(),o("section",ae,[oe,t("button",{class:"mt-4 inline-flex min-h-12 items-center justify-center rounded-full bg-primary px-5 py-3 text-sm font-medium text-white hover:bg-gray-800",type:"button",onClick:s[0]||(s[0]=n=>e.load(String(e.route.params.order||"")))},"Try again")])):e.canSubmit?e.saved?(a(),o("section",le,[de,ue,ce,t("ul",he,[(a(!0),o(u,null,p(e.sortedSelectedDates,n=>(a(),o("li",{class:"text-sm leading-6 text-gray-700",key:n},i(e.formatDateLabel(n)),1))),128))])])):(a(),o("section",me,[e.fittingDateReadable?(a(),o("p",ge,[D("We have not yet confirmed an engineer for your preferred date of "),t("strong",null,i(e.fittingDateReadable),1),D(". Let us know any other dates that would work for you.")])):(a(),o("p",fe,"We have not yet confirmed an engineer for your installation. Let us know which dates would work for you.")),g(b,{class:"mt-6","order-type":e.orderType,"fitting-date":e.fittingDate,"selected-dates":e.selectedDates,disabled:e.submitting,onToggle:e.toggleDate},null,8,["order-type","fitting-date","selected-dates","disabled","onToggle"]),e.orderType.includes("conversion")?(a(),o("p",pe,"Your preferred date is shaded. Sundays, Fridays and Saturdays cannot be selected for this installation.")):(a(),o("p",ye,"Your preferred date is shaded. Sundays cannot be selected.")),e.selectedDates.length?(a(),o(u,{key:4},[be,t("ul",De,[(a(!0),o(u,null,p(e.sortedSelectedDates,n=>(a(),o("li",{class:"flex items-center justify-between gap-3 rounded-xl border border-gray-200 px-4 py-3",key:n},[t("span",xe,i(e.formatDateLabel(n)),1),t("button",{class:"inline-flex h-11 shrink-0 items-center justify-center rounded-md px-2 text-sm font-medium text-primary underline underline-offset-2 hover:text-gray-800 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",type:"button","aria-label":`Remove ${e.formatDateLabel(n)}`,onClick:_e=>e.removeDate(n),disabled:e.submitting},"Remove",8,ve)]))),128))])],64)):c("",!0),e.submissionError?(a(),o("p",Me,i(e.submissionError),1)):c("",!0),t("button",{class:"mt-6 inline-flex min-h-12 items-center justify-center rounded-full bg-primary px-6 py-3 text-sm font-medium text-white hover:bg-gray-800 disabled:cursor-not-allowed disabled:opacity-50",type:"button",disabled:e.submitting||e.selectedDates.length===0,onClick:s[1]||(s[1]=(...n)=>e.submit&&e.submit(...n))},i(e.submitting?"Sending dates...":e.hasSubmittedDates?"Update suggested dates":"Send suggested dates"),9,Ye),ke])):(a(),o("section",re,ne)),g(w,{reference:e.orderId,title:"Need help with your installation dates?",description:"Contact us if you cannot find dates that work or need to discu
1ss your installation."},null,8,["reference"])],64))])])]),g(_)])}const tt=Y(Q,[["render",we]]);export{tt as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.