UNPKG

vue-hotel-booking-calendar

Version:

A Vue 3 calendar component suite for hotel bookings with price calculation, hotel dashboard, custom text labels, and flexible navigation. Features guest booking calendar and owner dashboard with elegant white design and full internationalization support.

2 lines (1 loc) 22.1 kB
(function(x,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(x=typeof globalThis<"u"?globalThis:x||self,e(x.VueHotelBookingCalendar={},x.Vue))})(this,function(x,e){"use strict";const le={class:"calendar-header"},se=["disabled","aria-label"],re={class:"month-year"},ce=["disabled","aria-label"],ie={key:0,class:"selection-error"},de={class:"error-content"},ue={class:"error-message"},me={key:0,class:"blocked-dates"},ge=["aria-label"],he={class:"calendar-body"},ke={class:"weekdays"},be={class:"days-grid"},De=["onClick","onMouseenter","tabindex","aria-label","onKeydown"],pe={class:"day-content"},fe={class:"day-number"},ye={key:0,class:"day-price"},we={key:1,class:"price-summary"},Se={class:"price-summary-header"},Ee=["aria-label"],_e={class:"price-content"},Ve={class:"stay-info"},Be={class:"nights"},Ne={class:"dates"},Ce={key:0,class:"breakdown"},Me={class:"breakdown-toggle"},$e={class:"daily-list"},xe={class:"totals"},Ie={class:"subtotal"},Pe={class:"total"},Oe=["disabled"],Le={key:2,class:"calendar-legend"},Fe={class:"legend-item"},Te={class:"legend-item"},ve={class:"legend-item"},He=e.defineComponent({__name:"HotelBookingCalendar",props:{modelValue:{default:()=>({checkIn:null,checkOut:null})},availabilityData:{default:()=>[]},minDate:{},maxDate:{},locale:{default:"en-GB"},disablePastDates:{type:Boolean,default:!0},allowPreviousMonthNavigation:{type:Boolean,default:!0},showPrices:{type:Boolean,default:!1},allowSingleDay:{type:Boolean,default:!1},theme:{default:"light"},basePrice:{default:85},currency:{default:"GBP"},showPriceCalculation:{type:Boolean,default:!0},showSelectionErrors:{type:Boolean,default:!0},textLabels:{default:()=>({})}},emits:["update:modelValue","date-click","date-select","selection-change","selection-error","price-calculation","book-now"],setup(I,{emit:v}){const o=I,D=v,g=e.ref(new Date),q=e.ref(null),C=e.ref(!1),p=e.ref(null),_=e.computed(()=>{if(!o.minDate){if(o.disablePastDates){const t=new Date;return t.setHours(0,0,0,0),t}return null}return typeof o.minDate=="string"?new Date(o.minDate):o.minDate}),T=e.computed(()=>o.maxDate?typeof o.maxDate=="string"?new Date(o.maxDate):o.maxDate:null),H=e.computed(()=>{const t=new Map;return o.availabilityData.forEach(l=>{t.set(l.date,l)}),t}),K=e.computed(()=>{const t=new Intl.DateTimeFormat(o.locale,{weekday:"short"}),l=[];for(let i=0;i<7;i++){const d=new Date(2023,0,i+1);l.push(t.format(d))}return l}),U=e.computed(()=>{const t=g.value.getFullYear(),l=g.value.getMonth(),i=new Date(t,l,1),d=new Date(t,l+1,0),u=new Date(i),c=new Date(d);u.setDate(u.getDate()-u.getDay()),c.setDate(c.getDate()+(6-c.getDay()));const f=[],h=new Date(u);for(;h<=c;){const E=F(h),N={date:new Date(h),dateString:E,isToday:E===F(new Date),isCurrentMonth:h.getMonth()===l,isPreviousMonth:h.getMonth()<l,isNextMonth:h.getMonth()>l,availability:H.value.get(E)};f.push(N),h.setDate(h.getDate()+1)}return f}),R=e.computed(()=>{if(o.allowPreviousMonthNavigation||!_.value)return!0;const t=new Date(g.value);t.setMonth(t.getMonth()-1),t.setDate(1);const l=new Date(_.value);return l.setDate(1),t>=l}),L=e.computed(()=>{if(!T.value)return!0;const t=new Date(g.value);t.setMonth(t.getMonth()+1),t.setDate(1);const l=new Date(T.value);return l.setDate(1),t<=l}),S=e.computed(()=>{var t,l,i,d,u,c,f,h,E,N,A,oe,ae;return{previousMonth:((t=o.textLabels)==null?void 0:t.previousMonth)||"Previous month",nextMonth:((l=o.textLabels)==null?void 0:l.nextMonth)||"Next month",bookingSummary:((i=o.textLabels)==null?void 0:i.bookingSummary)||"Booking Summary",nights:((d=o.textLabels)==null?void 0:d.nights)||"nights",night:((u=o.textLabels)==null?void 0:u.night)||"night",priceBreakdown:((c=o.textLabels)==null?void 0:c.priceBreakdown)||"Price breakdown",total:((f=o.textLabels)==null?void 0:f.total)||"Total",bookNow:((h=o.textLabels)==null?void 0:h.bookNow)||"Book Now",available:((E=o.textLabels)==null?void 0:E.available)||"Available",checkoutOnly:((N=o.textLabels)==null?void 0:N.checkoutOnly)||"Checkout Only",blocked:((A=o.textLabels)==null?void 0:A.blocked)||"Blocked",clearSelection:((oe=o.textLabels)==null?void 0:oe.clearSelection)||"Clear selection",dismissError:((ae=o.textLabels)==null?void 0:ae.dismissError)||"Dismiss error"}}),y=e.computed(()=>{const{checkIn:t,checkOut:l}=o.modelValue;if(!t||!l)return null;const i=new Date(t),d=new Date(l),u=Math.ceil((d.getTime()-i.getTime())/(1e3*60*60*24));if(u<=0)return null;const c=[];let f=0;const h=new Date(i);for(;h<d;){const E=F(h),N=H.value.get(E),A=(N==null?void 0:N.price)||o.basePrice||85;c.push({date:E,price:A}),f+=A,h.setDate(h.getDate()+1)}return{basePrice:o.basePrice||85,nights:u,dailyPrices:c,totalPrice:f,currency:o.currency||"GBP",averagePerNight:f/u}}),F=t=>{const l=t.getFullYear(),i=String(t.getMonth()+1).padStart(2,"0"),d=String(t.getDate()).padStart(2,"0");return`${l}-${i}-${d}`},J=t=>new Intl.DateTimeFormat(o.locale,{month:"long",year:"numeric"}).format(t),P=t=>new Intl.NumberFormat(o.locale,{style:"currency",currency:o.currency||"GBP"}).format(t),z=(t,l)=>{const i=new Date(t),d=new Date(l),u=new Intl.DateTimeFormat(o.locale,{month:"short",day:"numeric"});return`${u.format(i)} - ${u.format(d)}`},W=t=>new Intl.DateTimeFormat(o.locale,{month:"short",day:"numeric"}).format(new Date(t)),Q=t=>t.map(l=>W(l)).join(", "),G=t=>{var l;return((l=t.availability)==null?void 0:l.price)||o.basePrice||0},Y=t=>{if(!t.isCurrentMonth)return!0;if(o.disablePastDates){const l=new Date;l.setHours(0,0,0,0);const i=new Date(t.date);if(i.setHours(0,0,0,0),i<l)return!0}return!!(_.value&&t.date<_.value||T.value&&t.date>T.value)},j=t=>!!(Y(t)||O(t)==="blocked"),O=t=>{var l;return((l=t.availability)==null?void 0:l.status)||"available"},X=t=>{var l,i;return((i=(l=p.value)==null?void 0:l.blockedDates)==null?void 0:i.includes(t))||!1},a=(t,l)=>{const i=new Date(t),d=new Date(l),u=new Date(i),c=[];for(u.setDate(u.getDate()+1);u<d;){const f=F(u),h=H.value.get(f);(h==null?void 0:h.status)==="blocked"&&c.push(f),u.setDate(u.getDate()+1)}return c},s=t=>t===o.modelValue.checkIn||t===o.modelValue.checkOut,n=t=>{const{checkIn:l,checkOut:i}=o.modelValue;return!l||!i?!1:t>l&&t<i},r=t=>t===o.modelValue.checkIn,m=t=>t===o.modelValue.checkOut,b=t=>{const l=t.date.toLocaleDateString(o.locale,{weekday:"long",year:"numeric",month:"long",day:"numeric"}),i=O(t),d=G(t);return`${l}, ${i}${d?`, ${P(d)}`:""}`},k=()=>{p.value=null},w=(t,l)=>({type:t,message:{"blocked-dates-in-range":"Selected dates include unavailable periods. Please choose different dates.","min-stay-not-met":"Minimum stay requirement not met for selected dates.","max-stay-exceeded":"Selected stay exceeds maximum allowed duration.","invalid-range":"Invalid date range selected."}[t],blockedDates:l}),V=()=>{const t={checkIn:null,checkOut:null};D("update:modelValue",t),D("selection-change",t),k(),C.value=!1},M=()=>{if(y.value&&o.modelValue.checkIn&&o.modelValue.checkOut){const t={selection:{checkIn:o.modelValue.checkIn,checkOut:o.modelValue.checkOut},calculation:y.value};D("book-now",t)}},B=t=>{if(j(t))return;k();const{checkIn:l,checkOut:i}=o.modelValue,d=t.dateString;if(D("date-click",d,O(t)),!l||l&&i){const u={checkIn:d,checkOut:null};D("update:modelValue",u),D("selection-change",u),C.value=!0}else if(l&&!i){if(d===l&&!o.allowSingleDay)return;const u=d<l?d:l,c=d<l?l:d,f=a(u,c);if(f.length>0){const E=w("blocked-dates-in-range",f);p.value=E,D("selection-error",E);const N={checkIn:d,checkOut:null};D("update:modelValue",N),D("selection-change",N),C.value=!0;return}const h={checkIn:u,checkOut:c};D("update:modelValue",h),D("selection-change",h),C.value=!1}},$=t=>{Y(t)||(q.value=t.dateString)},Z=()=>{if(!R.value)return;const t=new Date(g.value);t.setMonth(t.getMonth()-1),g.value=t},lt=()=>{if(!L.value)return;const t=new Date(g.value);t.setMonth(t.getMonth()+1),g.value=t};return e.onMounted(()=>{if(o.modelValue.checkIn){const t=new Date(o.modelValue.checkIn);g.value=new Date(t.getFullYear(),t.getMonth(),1)}}),e.watch(()=>o.modelValue,t=>{t.checkIn&&!t.checkOut?C.value=!0:C.value=!1},{deep:!0}),e.watch(y,t=>{D("price-calculation",t)},{immediate:!0}),(t,l)=>{var i,d,u;return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["hotel-booking-calendar",[`theme-${t.theme}`,{"show-prices":t.showPrices},{"has-selection-error":p.value}]])},[e.createElementVNode("div",le,[e.createElementVNode("button",{type:"button",class:"nav-button prev",onClick:Z,disabled:!R.value,"aria-label":S.value.previousMonth}," ‹ ",8,se),e.createElementVNode("div",re,[e.createElementVNode("h2",null,e.toDisplayString(J(g.value)),1)]),e.createElementVNode("button",{type:"button",class:"nav-button next",onClick:lt,disabled:!L.value,"aria-label":S.value.nextMonth}," › ",8,ce)]),p.value&&t.showSelectionErrors?(e.openBlock(),e.createElementBlock("div",ie,[l[0]||(l[0]=e.createElementVNode("div",{class:"error-icon"},"⚠️",-1)),e.createElementVNode("div",de,[e.createElementVNode("div",ue,e.toDisplayString(p.value.message),1),(i=p.value.blockedDates)!=null&&i.length?(e.openBlock(),e.createElementBlock("div",me," Blocked dates: "+e.toDisplayString(Q(p.value.blockedDates)),1)):e.createCommentVNode("",!0)]),e.createElementVNode("button",{onClick:k,class:"error-dismiss","aria-label":S.value.dismissError},"✕",8,ge)])):e.createCommentVNode("",!0),e.createElementVNode("div",he,[e.createElementVNode("div",ke,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(K.value,c=>(e.openBlock(),e.createElementBlock("div",{key:c,class:"weekday"},e.toDisplayString(c),1))),128))]),e.createElementVNode("div",be,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(U.value,c=>(e.openBlock(),e.createElementBlock("div",{key:c.dateString,class:e.normalizeClass(["day-cell",{"other-month":!c.isCurrentMonth,today:c.isToday,selected:s(c.dateString),"in-range":n(c.dateString),"range-start":r(c.dateString),"range-end":m(c.dateString),available:O(c)==="available",blocked:O(c)==="blocked","checkout-only":O(c)==="checkout-only",disabled:Y(c),"click-disabled":j(c),"error-blocked":X(c.dateString)}]),onClick:f=>B(c),onMouseenter:f=>$(c),role:"button",tabindex:j(c)?-1:0,"aria-label":b(c),onKeydown:[e.withKeys(f=>B(c),["enter"]),e.withKeys(e.withModifiers(f=>B(c),["prevent"]),["space"])]},[e.createElementVNode("div",pe,[e.createElementVNode("span",fe,e.toDisplayString(c.date.getDate()),1),t.showPrices&&G(c)?(e.openBlock(),e.createElementBlock("div",ye,e.toDisplayString(P(G(c))),1)):e.createCommentVNode("",!0)])],42,De))),128))])]),t.showPriceCalculation&&y.value?(e.openBlock(),e.createElementBlock("div",we,[e.createElementVNode("div",Se,[e.createElementVNode("h4",null,e.toDisplayString(S.value.bookingSummary),1),e.createElementVNode("button",{onClick:V,class:"clear-btn","aria-label":S.value.clearSelection},"✕",8,Ee)]),e.createElementVNode("div",_e,[e.createElementVNode("div",Ve,[e.createElementVNode("span",Be,e.toDisplayString(y.value.nights)+" "+e.toDisplayString(y.value.nights===1?S.value.night:S.value.nights),1),e.createElementVNode("span",Ne,e.toDisplayString((d=t.modelValue)!=null&&d.checkIn&&((u=t.modelValue)!=null&&u.checkOut)?z(t.modelValue.checkIn,t.modelValue.checkOut):""),1)]),y.value.dailyPrices.length>1?(e.openBlock(),e.createElementBlock("div",Ce,[e.createElementVNode("details",Me,[e.createElementVNode("summary",null,[e.createTextVNode(e.toDisplayString(S.value.priceBreakdown)+" ",1),l[1]||(l[1]=e.createElementVNode("span",{class:"arrow"},"▼",-1))]),e.createElementVNode("div",$e,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(y.value.dailyPrices,c=>(e.openBlock(),e.createElementBlock("div",{key:c.date,class:"daily-row"},[e.createElementVNode("span",null,e.toDisplayString(W(c.date)),1),e.createElementVNode("span",null,e.toDisplayString(P(c.price)),1)]))),128))])])])):e.createCommentVNode("",!0),e.createElementVNode("div",xe,[e.createElementVNode("div",Ie,[e.createElementVNode("span",null,e.toDisplayString(y.value.nights)+" × "+e.toDisplayString(P(y.value.averagePerNight)),1),e.createElementVNode("span",null,e.toDisplayString(P(y.value.totalPrice)),1)]),e.createElementVNode("div",Pe,[e.createElementVNode("span",null,e.toDisplayString(S.value.total),1),e.createElementVNode("strong",null,e.toDisplayString(P(y.value.totalPrice)),1)])]),e.createElementVNode("button",{onClick:M,class:"book-btn",disabled:!y.value},e.toDisplayString(S.value.bookNow),9,Oe)])])):e.createCommentVNode("",!0),(t.$slots.legend,e.openBlock(),e.createElementBlock("div",Le,[e.renderSlot(t.$slots,"legend",{},()=>[e.createElementVNode("div",Fe,[l[2]||(l[2]=e.createElementVNode("div",{class:"legend-indicator available"},null,-1)),e.createElementVNode("span",null,e.toDisplayString(S.value.available),1)]),e.createElementVNode("div",Te,[l[3]||(l[3]=e.createElementVNode("div",{class:"legend-indicator checkout-only"},null,-1)),e.createElementVNode("span",null,e.toDisplayString(S.value.checkoutOnly),1)]),e.createElementVNode("div",ve,[l[4]||(l[4]=e.createElementVNode("div",{class:"legend-indicator blocked"},null,-1)),e.createElementVNode("span",null,e.toDisplayString(S.value.blocked),1)])],!0)]))],2)}}}),ee=(I,v)=>{const o=I.__vccOpts||I;for(const[D,g]of v)o[D]=g;return o},te=ee(He,[["__scopeId","data-v-fd5ea05e"]]),Re={class:"dashboard-header"},ze=["aria-label"],Ge={class:"current-month"},Ye=["aria-label"],je={class:"calendar-container"},Ae={class:"calendar-grid"},Ke={class:"grid-header"},Ue={class:"room-header"},We={class:"date-number"},qe={class:"date-weekday"},Je={class:"room-name"},Qe=["onClick","title"],Xe={class:"span-content"},Ze={class:"span-text"},et=["onClick","title"],tt={key:0,class:"booking-indicator"},nt={class:"guest-initials"},ot={class:"legend"},ne=ee(e.defineComponent({__name:"HotelDashboardCalendar",props:{rooms:{},bookings:{},selectedMonth:{default:()=>new Date},theme:{default:"light"},statusConfig:{},allowPreviousMonthNavigation:{type:Boolean,default:!1},textLabels:{default:()=>({})}},emits:["update:selectedMonth","booking-click","booking-create"],setup(I,{emit:v}){const o=I,D=v,g=e.ref(new Date(o.selectedMonth)),q=[{key:"available",label:"Available",color:"#666",backgroundColor:"#f9f9f9",darkBackgroundColor:"#2a2a2a"},{key:"confirmed",label:"Confirmed",color:"#166534",backgroundColor:"#dcf8c6",darkBackgroundColor:"#1a4d14"},{key:"pending",label:"Pending",color:"#92400e",backgroundColor:"#fef3c7",darkBackgroundColor:"#4a3c00"},{key:"checked-in",label:"Checked In",color:"#1e40af",backgroundColor:"#dbeafe",darkBackgroundColor:"#1e3a8a"},{key:"checked-out",label:"Checked Out",color:"#7c3aed",backgroundColor:"#f3e8ff",darkBackgroundColor:"#5b21b6"},{key:"cancelled",label:"Cancelled",color:"#dc2626",backgroundColor:"#fee2e2",darkBackgroundColor:"#7f1d1d"}],C=e.computed(()=>o.statusConfig||q),p=e.computed(()=>{var a,s,n,r,m,b;return{previousMonth:((a=o.textLabels)==null?void 0:a.previousMonth)||"← Previous",nextMonth:((s=o.textLabels)==null?void 0:s.nextMonth)||"Next →",room:((n=o.textLabels)==null?void 0:n.room)||"Room",available:((r=o.textLabels)==null?void 0:r.available)||"Available",createBooking:((m=o.textLabels)==null?void 0:m.createBooking)||"Click to create booking",clickForDetails:((b=o.textLabels)==null?void 0:b.clickForDetails)||"Click for details"}}),_=e.computed(()=>{const a=g.value.getFullYear(),s=g.value.getMonth(),n=new Date(a,s+1,0).getDate(),r=new Date;r.setHours(0,0,0,0);const m=[];for(let b=1;b<=n;b++){const k=new Date(a,s,b),w=`${a}-${String(s+1).padStart(2,"0")}-${String(b).padStart(2,"0")}`;m.push({day:b,dateString:w,date:k,isToday:k.getTime()===r.getTime(),isWeekend:k.getDay()===0||k.getDay()===6,weekday:new Intl.DateTimeFormat("en-US",{weekday:"short"}).format(k)})}return m}),T=e.computed(()=>{const a={};return o.rooms.forEach(s=>{a[s.id]=[],o.bookings.filter(r=>r.roomNumber===s.number).forEach(r=>{const m=new Date(r.checkIn),b=new Date(r.checkOut),k=g.value.getFullYear(),w=g.value.getMonth(),V=new Date(k,w,1),M=new Date(k,w+1,0);if(m<=M&&b>V){let B,$;if(m>=V?B=m.getDate():B=1,b<=M?$=b.getDate()-1:$=M.getDate(),$=Math.max(B,$),B>=1&&$<=M.getDate()&&B<=$){const Z=y(r.status);a[s.id].push({booking:r,startDay:B,endDay:$,length:$-B+1,statusConfig:Z})}}}),a[s.id].sort((r,m)=>r.startDay-m.startDay)}),a}),H=a=>new Intl.DateTimeFormat("en-US",{year:"numeric",month:"long"}).format(a),K=a=>{if(a<0&&!o.allowPreviousMonthNavigation){const n=new Date,r=new Date(g.value.getFullYear(),g.value.getMonth(),1),m=new Date(n.getFullYear(),n.getMonth(),1);if(r<=m)return}const s=new Date(g.value);s.setMonth(s.getMonth()+a),g.value=s,D("update:selectedMonth",s)},U=(a,s)=>o.bookings.some(n=>n.roomNumber===a.number&&R(s,n)),R=(a,s)=>{const n=new Date(a),r=new Date(s.checkIn),m=new Date(s.checkOut);return n>=r&&n<m},L=(a,s)=>o.bookings.find(n=>n.roomNumber===a.number&&R(s,n))||null,S=(a,s)=>{const n=L(a,s);return n?n.status:"available"},y=a=>C.value.find(s=>s.key===a)||C.value[0],F=(a,s)=>{const n=[],r=_.value.find(m=>m.dateString===s);return r!=null&&r.isToday&&n.push("is-today"),r!=null&&r.isWeekend&&n.push("is-weekend"),U(a,s)&&n.push("has-booking"),n},J=(a,s)=>{const n=S(a,s),r=y(n);return{backgroundColor:o.theme==="dark"&&r.darkBackgroundColor?r.darkBackgroundColor:r.backgroundColor,color:r.color}},P=(a,s)=>{const n=L(a,s);return n?n.guestName.split(" ").map(r=>r.charAt(0).toUpperCase()).join("").substring(0,2):""},z=(a,s)=>{const n=new Date(a),m=new Date(s).getTime()-n.getTime();return Math.ceil(m/(1e3*60*60*24))},W=(a,s)=>{const n=L(a,s);if(!n)return`${p.value.room} ${a.number} - ${p.value.available} (${p.value.createBooking})`;const r=y(n.status),m=z(n.checkIn,n.checkOut);return`${n.guestName} - ${p.value.room} ${a.number} - ${r.label} - ${m} nights (${p.value.clickForDetails})`},Q=(a,s)=>{const n=L(a,s);n?D("booking-click",n):D("booking-create",{roomId:a.id,date:s})},G=a=>{var b;const s=[],n=T.value[a.id]||[],r=new Set,m=[...n].sort((k,w)=>k.startDay-w.startDay);for(let k=1;k<=_.value.length;k++){if(r.has(k))continue;const w=m.find(V=>V.startDay===k);if(w){const V=((b=_.value[k-1])==null?void 0:b.dateString)||"";s.push({type:"booking-span",booking:w.booking,startDay:w.startDay,endDay:w.endDay,length:w.length,statusConfig:w.statusConfig,startDate:V});for(let M=w.startDay;M<=w.endDay;M++)r.add(M)}else{const V=_.value[k-1];V&&s.push({type:"date-cell",dateString:V.dateString,day:k})}}return s},Y=a=>({backgroundColor:o.theme==="dark"&&a.statusConfig.darkBackgroundColor?a.statusConfig.darkBackgroundColor:a.statusConfig.backgroundColor,color:a.statusConfig.color,border:`1px solid ${a.statusConfig.color}`,borderRadius:"4px",gridColumnStart:(a.startDay+1).toString(),gridColumnEnd:(a.endDay+2).toString()}),j=a=>{const s=z(a.booking.checkIn,a.booking.checkOut),n=a.booking.guestName;return a.length===1?n.split(" ").map(r=>r.charAt(0)).join("").substring(0,2):a.length<=3?n.split(" ")[0]:a.length<=6?`${n.split(" ")[0]} (${s}n)`:`${n} - ${s} nights`},O=a=>{const s=z(a.booking.checkIn,a.booking.checkOut),n=o.rooms.find(r=>r.number===a.booking.roomNumber);return`${a.booking.guestName} - Room ${n==null?void 0:n.number} - ${a.statusConfig.label} - ${s} nights`},X=a=>{D("booking-click",a)};return e.watch(()=>o.selectedMonth,a=>{a&&(g.value=new Date(a))}),(a,s)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["hotel-dashboard-calendar",`theme-${a.theme}`]),style:e.normalizeStyle({"--days-in-month":_.value.length})},[e.createElementVNode("div",Re,[e.createElementVNode("button",{onClick:s[0]||(s[0]=n=>K(-1)),class:"nav-btn","aria-label":p.value.previousMonth},e.toDisplayString(p.value.previousMonth),9,ze),e.createElementVNode("h2",Ge,e.toDisplayString(H(g.value)),1),e.createElementVNode("button",{onClick:s[1]||(s[1]=n=>K(1)),class:"nav-btn","aria-label":p.value.nextMonth},e.toDisplayString(p.value.nextMonth),9,Ye)]),e.createElementVNode("div",je,[e.createElementVNode("div",Ae,[e.createElementVNode("div",Ke,[e.createElementVNode("div",Ue,e.toDisplayString(p.value.room),1),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(_.value,n=>(e.openBlock(),e.createElementBlock("div",{key:n.dateString,class:e.normalizeClass(["date-header",{"is-today":n.isToday,"is-weekend":n.isWeekend}])},[e.createElementVNode("div",We,e.toDisplayString(n.day),1),e.createElementVNode("div",qe,e.toDisplayString(n.weekday),1)],2))),128))]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.rooms,n=>(e.openBlock(),e.createElementBlock("div",{key:n.id,class:"room-row"},[e.createElementVNode("div",Je,e.toDisplayString(n.number),1),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(G(n),(r,m)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:`${n.id}-${m}`},[r.type==="booking-span"?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["booking-span-cell",F(n,r.startDate)]),style:e.normalizeStyle(Y(r)),onClick:b=>X(r.booking),title:O(r)},[e.createElementVNode("div",Xe,[e.createElementVNode("span",Ze,e.toDisplayString(j(r)),1)])],14,Qe)):(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["date-cell",F(n,r.dateString)]),style:e.normalizeStyle(J(n,r.dateString)),onClick:b=>Q(n,r.dateString),title:W(n,r.dateString)},[U(n,r.dateString)?(e.openBlock(),e.createElementBlock("div",tt,[e.createElementVNode("span",nt,e.toDisplayString(P(n,r.dateString)),1)])):e.createCommentVNode("",!0)],14,et))],64))),128))]))),128))])]),e.createElementVNode("div",ot,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(C.value,n=>(e.openBlock(),e.createElementBlock("div",{key:n.key,class:"legend-item"},[e.createElementVNode("div",{class:"legend-color",style:e.normalizeStyle({backgroundColor:n.backgroundColor,borderColor:n.color})},null,4),e.createElementVNode("span",null,e.toDisplayString(n.label),1)]))),128))])],6))}}),[["__scopeId","data-v-f67bbf1d"]]),at={install(I){I.component("HotelBookingCalendar",te),I.component("HotelDashboardCalendar",ne)}};x.HotelBookingCalendar=te,x.HotelDashboardCalendar=ne,x.default=at,Object.defineProperties(x,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});