1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["ssrassets/PPAutoCompleteHotels.DWkUXerP.js","ssrassets/app.91KPl16X.js","ssrassets/app.mqXFwSoB.css","ssrassets/PPAutoCompleteHotels.BJ8Wbrxx.css"])))=>i.map(i=>d[i]); 2import{_ as w,y as x,o as a,c as d,t as c,f,a as t,d as p,w as b,e as k,F as g,h as _,p as S,z as N,r as y}from"./app.91KPl16X.js";import{C as q}from"./component.BiV0dDn6.js";import{_ as E}from"./ClientOnly.BfHm-z2a.js";const D={name:"HomePage",props:{quickSearch:{type:[Object,null],required:!1},mainClass:{type:String,required:!1,default:""}},components:{flatPickr:q,PPAutoCompleteHotels:x(()=>N(()=>import("./PPAutoCompleteHotels.DWkUXerP.js"),__vite__mapDeps([0,1,2,3]))),ClientOnly:E},data(){return{searchError:"",flatConfig:{wrap:!0,altFormat:"M j, Y",altInput:!0,dateFormat:"Y-m-d"},searchCityItems:[],ismounted:!1,hotels:{location:"",checkin:"",checkout:"",rooms:[{roomNumber:1,adults:2,children:0,childrenAges:[]}],accommodationTypes:[]}}},computed:{totalAdults(){return this.hotels.rooms.reduce((e,s)=>e+s.adults,0)},totalChildren(){return this.hotels.rooms.reduce((e,s)=>e+s.children,0)},totalGuests(){return this.totalAdults+this.totalChildren}},mounted(){const e=this.$route.query,s=decodeURIComponent(this.$route.query.city||""),i=s.split("-")[0]||"";s.split("-")[1],i.split(" ").map(o=>o.charAt(0).toUpperCase()+o.slice(1)).join(" ");let r=[];if(e.roomsData)try{r=JSON.parse(e.roomsData)}catch(o){console.error("Error parsing roomsData:",o),r=[{roomNumber:1,adults:parseInt(e.adults)||2,children:parseInt(e.children)||0,childrenAges:e.childrenAges?e.childrenAges.split(",").map(Number):[]}]}else r=[{roomNumber:1,adults:parseInt(e.adults)||2,children:parseInt(e.children)||0,childrenAges:e.childrenAges?e.childrenAges.split(",").map(Number):[]}];this.hotels={location:e.location?JSON.parse(e.location):{name:""},checkin:e.checkin||"",checkout:e.checkout||"",rooms:r,accommodationTypes:e.accommodationTypes?e.accommodationTypes.split(","):[]},this.ismounted=!0},watch:{quickSearch:{handler(e){e&&(this.hotels.location=location)},immediate:!0,deep:!0}},methods:{addRoom(){const e=this.hotels.rooms.length+1;this.hotels.rooms.push({roomNumber:e,adults:2,children:0,childrenAges:[]})},removeRoom(e){this.hotels.rooms.length>1&&(this.hotels.rooms.splice(e,1),this.hotels.rooms.forEach((s,i)=>{s.roomNumber=i+1}))},incrementAdults(e){this.hotels.rooms[e].adults<4&&this.hotels.rooms[e].adults++},decrementAdults(e){this.hotels.rooms[e].adults>1&&this.hotels.rooms[e].adults--},incrementChildren(e){this.hotels.rooms[e].children<3&&(this.hotels.rooms[e].children++,this.hotels.rooms[e].childrenAges.push(2))},decrementChildren(e){this.hotels.rooms[e].children>0&&(this.hotels.rooms[e].children--,this.hotels.rooms[e].childrenAges.pop())},updateChildAge(e,s,i){const r=parseInt(i.target.value);this.hotels.rooms[e].childrenAges[s]=r},searchCity(e){this.axios.get("/airports-autocomplete?city="+e).then(s=>{this.searchCityItems=s.data})},format_date(e){const s=e.getDate().toString().padStart(2,"0"),i=(e.getMonth()+1).toString().padStart(2,"0");return`${e.getFullYear()}-${i}-${s}`},searchHotels(){if(this.searchError="",this.hotels.checkin==""){this.searchError="Please enter checkin date.";return}else{let o=new Date(this.hotels.checkin),n=new Date;if(o.setHours(0,0,0,0),n.setHours(0,0,0,0),console.log(o,n),o<n){this.searchError="Checkin date should be greater than or equal to today.";return}}if(this.hotels.checkout==""){this.searchError="Please enter checkout date.";return}else{var e=new Date(this.hotels.checkin),s=new Date(this.hotels.checkout);if(s<e){this.searchError="Checkout date should be greater than checkin date.";return}}if(this.totalAdults==0){this.searchError="Please enter number of adults.";return}if(this.hotels.rooms.length==0){this.searchError="Please enter at least one room.";return}const i={location:JSON.stringify(this.hotels.location),checkin:this.format_date(new Date(this.hotels.checkin)),checkout:this.format_date(new Date(this.hotels.checkout)),adults:this.totalAdults,children:this.totalChildren,rooms:this.hotels.rooms.length,roomsData:JSON.stringify(this.hotels.rooms
2),accommodationTypes:this.hotels.accommodationTypes.join(",")},r=this.hotels.rooms.flatMap(o=>o.childrenAges);r.length>0&&(i.childrenAges=r.join(",")),this.$route.name==="hotel-search"?this.$router.replace({name:"hotel-search",query:i}):this.$router.push({name:"hotel-search",query:i})}}},V={key:0,class:"alert alert-danger radius-0 border-0"},P={class:"d-lg-flex"},R={class:"d-flex form-info bg-white"},j={class:"form-item dropdown"},T={"data-bs-toggle":"dropdown","data-bs-auto-close":"outside","aria-expanded":"false",role:"menu"},H={key:0},O={href:"javascript:void(0);"},F={class:"fs-16 fw-medium"},B={class:"form-item"},J={class:"input-group"},U={class:"form-item"},Y={class:"input-group"},G={class:"form-item dropdown"},I={"data-bs-toggle":"dropdown","data-bs-auto-close":"outside","aria-expanded":"false",role:"menu"},L={class:"fs-12 mb-0 text-muted"},M={class:"dropdown-menu dropdown-menu-end dropdown-xl"},z={class:"d-flex justify-content-between align-items-center mb-3"},Q={class:"d-flex justify-content-between align-items-center mb-3"},W={class:"fs-16 fw-medium mb-0"},K=["onClick"],X={class:"row"},Z={class:"col-md-12 mb-3"},$={class:"d-flex align-items-center justify-content-between"},tt={class:"custom-increment"},et={class:"input-group"},st={class:"input-group-btn float-start"},ot=["onClick","disabled"],lt=["value"],nt={class:"input-group-btn float-end"},it=["onClick","disabled"],rt={class:"col-md-12 mb-3"},at={class:"d-flex align-items-center justify-content-between"},dt={class:"custom-increment"},ct={class:"input-group"},ut={class:"input-group-btn float-start"},ht=["onClick","disabled"],mt=["value"],pt={class:"input-group-btn float-end"},ft=["onClick","disabled"],bt={key:0,class:"col-md-12"},gt={class:"row"},_t={class:"form-label text-gray-9 mb-1"},yt=["value","onChange"],Ct=["value"];function vt(e,s,i,r,o,n){const A=y("PPAutoCompleteHotels"),C=y("flat-pickr"),v=y("ClientOnly");return a(),d("div",{class:S(i.mainClass)},[o.searchError!=""?(a(),d("div",V,c(o.searchError),1)):f("",!0),s[16]||(s[16]=t("div",{class:"d-flex align-items-center justify-content-between flex-wrap p-0"},null,-1)),t("div",P,[t("div",R,[t("div",j,[t("div",T,[o.ismounted?(a(),d("div",H,[p(A,{defaultValue:o.hotels.location.name,suggestions:o.searchCityItems,onSelect:s[0]||(s[0]=l=>o.hotels.location=l),onComplete:s[1]||(s[1]=l=>n.searchCity(l)),inputClass:"form-control",optionLabel:"city",placeholder:"Where would you like to stay?"},{option:b(l=>[(a(),d("div",{key:l.option.id||l.option.city,class:"d-flex align-items-center mr-2 bg-white p-3 pb-2 w-100 border-bottom radius-5 pt-2"},[t("span",O,[t("h6",F,c(l.option.city),1)])]))]),_:1},8,["defaultValue","suggestions"])])):f("",!0)])]),t("div",B,[t("div",J,[p(v,null,{default:b(()=>[p(C,{modelValue:o.hotels.checkin,"onUpdate:modelValue":s[2]||(s[2]=l=>o.hotels.checkin=l),config:o.flatConfig,class:"form-control",placeholder:"Select date",name:"date"},null,8,["modelValue","config"])]),_:1}),s[6]||(s[6]=t("div",{class:"input-group-append"},[t("button",{class:"btn btn-default",type:"button",title:"Toggle","data-toggle":""},[t("i",{class:"fa fa-calendar text-muted"})])],-1))])]),t("div",U,[t("div",Y,[p(v,null,{default:b(()=>[p(C,{modelValue:o.hotels.checkout,"onUpdate:modelValue":s[3]||(s[3]=l=>o.hotels.checkout=l),config:o.flatConfig,class:"form-control",placeholder:"Select date",name:"date"},null,8,["modelValue","config"])]),_:1}),s[7]||(s[7]=t("div",{class:"input-group-append"},[t("button",{class:"btn btn-default",type:"button",title:"Toggle","data-toggle":""},[t("i",{class:"fa fa-calendar text-muted"})])],-1))])]),t("div",G,[t("div",I,[t("h5",null,[k(c(n.totalGuests)+" ",1),s[8]||(s[8]=t("span",{class:"fw-normal fs-14"},"Guests",-1))]),t("p",L,c(o.hotels.rooms.length)+" Room"+c(o.hotels.rooms.length>1?"s":"")+", "+c(n.totalAdults)+" Adult"+c(n.totalAdults>1?"s":"")+c(n.totalChildren>0?`, ${n.totalChildren} Child${n.totalChildren>1?"ren":""}`:""),1)]),t("div",M,[t("div",z,[s[9]||(s[9]=t("h5",{class:"mb-0"},"Select Travelers & Class",-1)),t("button",{type:"button",class:"btn btn-sm btn-outline-primary",onClick:s[4]||(s[4]=(...l)=>n.addRoom&&n.addRoom(...l))}," + Add Room ")]),(a(!0),d(g,null,_(o.hotels.rooms,(l,h)=>(a(),d("div",{key:h,class:"mb-3 border br-10 info-item px-3"},[t("div",Q,[t("h6",W,"Room "+c(l.roomNumber),1),o.hotels.rooms.length>
21?(a(),d("button",{key:0,type:"button",class:"btn btn-sm btn-outline-danger",onClick:u=>n.removeRoom(h)}," Remove ",8,K)):f("",!0)]),t("div",X,[t("div",Z,[t("div",$,[s[12]||(s[12]=t("label",{class:"form-label text-gray-9 mb-2"},"Adults",-1)),t("div",tt,[t("div",et,[t("span",st,[t("button",{type:"button",class:"quantity-left-minus btn btn-light btn-number",onClick:u=>n.decrementAdults(h),disabled:l.adults<=1},s[10]||(s[10]=[t("span",null,[t("i",{class:"isax isax-minus"})],-1)]),8,ot)]),t("input",{type:"text",class:"input-number",value:l.adults,readonly:""},null,8,lt),t("span",nt,[t("button",{type:"button",class:"quantity-right-plus btn btn-light btn-number",onClick:u=>n.incrementAdults(h),disabled:l.adults>=4},s[11]||(s[11]=[t("span",null,[t("i",{class:"isax isax-add"})],-1)]),8,it)])])])])]),t("div",rt,[t("div",at,[s[15]||(s[15]=t("label",{class:"form-label text-gray-9 mb-2"},[k(" Children "),t("span",{class:"text-default fw-normal"},"( 2-12 Yrs )")],-1)),t("div",dt,[t("div",ct,[t("span",ut,[t("button",{type:"button",class:"quantity-left-minus btn btn-light btn-number",onClick:u=>n.decrementChildren(h),disabled:l.children<=0},s[13]||(s[13]=[t("span",null,[t("i",{class:"isax isax-minus"})],-1)]),8,ht)]),t("input",{type:"text",class:"input-number",value:l.children,readonly:""},null,8,mt),t("span",pt,[t("button",{type:"button",class:"quantity-right-plus btn btn-light btn-number",onClick:u=>n.incrementChildren(h),disabled:l.children>=3},s[14]||(s[14]=[t("span",null,[t("i",{class:"isax isax-add"})],-1)]),8,ft)])])])])]),l.children>0?(a(),d("div",bt,[t("div",gt,[(a(!0),d(g,null,_(l.children,u=>(a(),d("div",{key:u,class:"col-md-6 mb-2"},[t("label",_t," Child "+c(u)+" Age ",1),t("select",{class:"form-select form-select-sm",value:l.childrenAges[u-1]||2,onChange:m=>n.updateChildAge(h,u-1,m)},[(a(),d(g,null,_(17,m=>t("option",{key:m,value:m},c(m)+" years ",9,Ct)),64))],40,yt)]))),128))])])):f("",!0)])]))),128))])])]),t("button",{type:"button",class:"btn btn-info search-btn rounded",onClick:s[5]||(s[5]=l=>n.searchHotels())}," Search ")])],2)}const xt=w(D,[["render",vt],["__scopeId","data-v-2fc73654"]]);export{xt 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.