%PDF- %PDF-
Direktori : /home/forge/takeaseat.eco-n-tech.co.uk/.nuxt/dist/client/ |
Current File : //home/forge/takeaseat.eco-n-tech.co.uk/.nuxt/dist/client/d7c2412.js |
(window.webpackJsonp=window.webpackJsonp||[]).push([[51],{504:function(t,e,r){"use strict";r.r(e);var l=r(0),n=(r(60),r(53),r(61),r(30),r(3),{head:function(){return{titleTemplate:"Reschedule Booking | %s"}},data:function(){return{step:1,loading:!1,working:!1,timer:null,minDate:null,maxDate:null,availability:{},available_dates:[],selected_date:[],selected_slots:[],selected_session:null,selected_product_id:null}},computed:{therapist:function(){return this.$store.state.booking.therapist},booking:function(){return this.$store.state.booking.reschedule.booking}},mounted:function(){var t=this;return Object(l.a)(regeneratorRuntime.mark((function e(){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=new Date,t.minDate=t.$moment(r).add(1,"days").format("Y-MM-DD"),e.next=4,t.$axios.post("/availability/"+t.therapist.id,{dates:t.selected_date}).then((function(e){t.loading=!1,t.availability=e.data.availability,t.available_dates=e.data.available_dates,t.selected_slots=e.data.selected_slots,t.minDate=t.available_dates[0],t.maxDate=t.available_dates[t.available_dates.length-1],t.selected_date=t.available_dates[0]})).catch((function(e){t.loading=!1,t.$toast.error(e).goAway(3e3)}));case 4:case"end":return e.stop()}}),e)})))()},asyncData:function(t){return Object(l.a)(regeneratorRuntime.mark((function e(){var r,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.store,l=t.params,e.next=3,r.dispatch("booking/get",l.therapist_slug);case 3:return e.next=5,r.dispatch("booking/reschedule/get",l.id);case 5:case"end":return e.stop()}}),e)})))()},methods:{changeDates:function(){var t=this;this.timer&&(clearTimeout(this.timer),this.timer=null),this.timer=setTimeout((function(){t.getTimes()}),250)},getTimes:function(){var t=this;return Object(l.a)(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.loading=!0,e.next=3,t.$axios.post("/availability/"+t.therapist.id,{dates:t.selected_date}).then((function(e){t.loading=!1,t.availability=e.data.availability,t.available_dates=e.data.available_dates,t.selected_slots=e.data.selected_slots,t.minDate=t.available_dates[0],t.maxDate=t.available_dates[t.available_dates.length-1]})).catch((function(e){t.loading=!1,t.$toast.error(e).goAway(3e3)}));case 3:case"end":return e.stop()}}),e)})))()},getDisabledDates:function(t){var e=this.$moment(t).format("Y-MM-DD");return!this.available_dates.includes(e)},submit:function(){var t=this;return Object(l.a)(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t.$refs.form.validate().then((function(e){e&&(t.working=!0,t.$store.dispatch("booking/reschedule/update",{therapist_id:t.therapist.id,booking_id:t.$route.params.id,slot:t.selected_slots[Object.keys(t.selected_slots)[0]]}))}));case 1:case"end":return e.stop()}}),e)})))()}}}),o=r(10),component=Object(o.a)(n,(function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticClass:"page-wrapper"},[r("div",{staticClass:"py-10 sm:py-20 bg-white"},[r("div",{staticClass:"relative z-20 text-center"},[r("figure",{staticClass:"relative inline-block w-32 mb-4 sm:mb-8"},[r("div",{staticClass:"absolute top-0 left-0 w-full h-full border-15",class:"tas-border-"+t.therapist.colour}),t._v(" "),r("img",{staticClass:"block w-full",attrs:{src:t.therapist.user.photo_url,alt:t.therapist.user.first_name}})]),t._v(" "),r("h1",[r("span",{staticClass:"block w-full text-5xl md:text-7xl leading-none "},[t._v(t._s(t.therapist.user.first_name))]),t._v(" "),r("span",{staticClass:"block w-full uppercase text-2xl"},[t._v(t._s(t.therapist.user.last_name))])])])]),t._v(" "),r("div",{staticClass:"bg-gray px-4 py-6 sm:py-10 sm:px-8 md:py-20"},[r("div",{staticClass:"max-w-lg w-full mx-auto"},[r("div",{staticClass:"py-8 px-6 sm:py-12 sm:px-16 rounded-xl bg-white"},[r("ValidationObserver",{ref:"form"},[r("form",{attrs:{role:"form",method:"POST"},on:{submit:function(e){return e.preventDefault(),t.submit(e)}}},[r("span",{staticClass:"block text-center text-3xl font-bold mb-6"},[t._v("Your Session")]),t._v(" "),r("t-calendar",{attrs:{minDate:t.minDate,maxDate:t.maxDate,yearsPerView:1,disabledDates:t.getDisabledDates,inline:""},on:{change:t.changeDates},model:{value:t.selected_date,callback:function(e){t.selected_date=e},expression:"selected_date"}}),t._v(" "),r("div",{staticClass:"mb-6"},[r("span",{staticClass:"block font-bold mb-3"},[t._v("Select time")]),t._v(" "),1==t.loading?r("div",{staticClass:"flex items-center justify-center"},[r("svg",{staticClass:"animate-spin -ml-1 mr-3 h-5 w-5 text-current",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"}},[r("circle",{staticClass:"opacity-25",attrs:{cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"}}),t._v(" "),r("path",{staticClass:"opacity-75",attrs:{fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"}})]),t._v("\n Loading Times...\n ")]):t.availability?r("div",t._l(t.availability,(function(e,l){return r("div",{key:l,staticClass:"mb-3"},[r("ValidationProvider",{attrs:{rules:"required"},scopedSlots:t._u([{key:"default",fn:function(n){var o=n.errors;return[r("span",{staticClass:"block mb-2 text-sm font-bold"},[t._v(t._s(t.$moment(l).format("DD/MM/Y")))]),t._v(" "),e.length>0?r("div",{staticClass:"grid grid-cols-2 sm:grid-cols-3 gap-3"},t._l(e,(function(slot,e){return r("label",{key:e,staticClass:"border border-black px-3 py-2 rounded-md cursor-pointer text-center text-sm",class:t.selected_slots[l]==slot.start?"bg-yellow":""},[r("input",{directives:[{name:"model",rawName:"v-model",value:t.selected_slots[l],expression:"selected_slots[key]"}],staticClass:"hidden",attrs:{type:"radio",id:"times-"+e,name:"times-"+e},domProps:{value:slot.start,checked:t._q(t.selected_slots[l],slot.start)},on:{change:function(e){return t.$set(t.selected_slots,l,slot.start)}}}),t._v("\n "+t._s(t.$moment.utc(slot.start).format("H:mm"))+"\n ")])})),0):r("div",[r("p",[t._v("No availability for this day")])]),t._v(" "),o[0]?r("span",{staticClass:"field-invalid"},[t._v(t._s(o[0]))]):t._e()]}}],null,!0)})],1)})),0):r("div",[r("p",[t._v("No availability found")])])]),t._v(" "),r("div",{staticClass:"mt-6 flex items-center justify-center"},[r("button",{staticClass:"btn btn-primary btn-small rounded-full w-full sm:w-auto",attrs:{type:"submit"}},[0==t.working?r("span",[t._v("Reschedule")]):r("span",{staticClass:"flex items-center justify-center"},[r("svg",{staticClass:"animate-spin -ml-1 mr-3 h-5 w-5 text-current",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"}},[r("circle",{staticClass:"opacity-25",attrs:{cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"}}),t._v(" "),r("path",{staticClass:"opacity-75",attrs:{fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"}})]),t._v(" "),r("span",[t._v("Processing")])])])])],1)])],1)])])])}),[],!1,null,null,null);e.default=component.exports}}]);