import{Q as p}from"./QSelect-7Ay93ffU.js";import{b as f,Q as S}from"./QItem-9vG9WSh3.js";import{d as F,aM as B,j as u,E as n,C as s,a as A,r as N,w as U,b as D,al as E,as as L,af as c,ae as o,aq as e,aA as w,aB as g,aw as x,ap as q,at as M,aD as O}from"./index-BT5eY4j5.js";import{Q as z}from"./QForm-_ScWQlBk.js";import{C as I,c as k,a as T,b as G}from"./index-3EQhSKDt.js";import{u as K}from"./vue-i18n-CUkMLu72.js";const Z=F({__name:"QuickSearch",props:{autosubmit:{type:Boolean}},emits:["submit"],setup(v,{emit:V}){const{t:l}=K(),m=B(),d={rating:u.All,price:n.All,currency:s.RSD,city:"",country:I.Serbia};function R(i){return{rating:String(i.rating),price:String(i.price),currency:i.currency,city:i.city,country:i.country}}function P(i){return{rating:Object.values(u).includes(Number(i.rating))?Number(i.rating):d.rating,price:Object.values(n).includes(Number(i.price))?Number(i.price):d.price,currency:Object.values(s).includes(String(i.currency))?i.currency:d.currency,city:i.city?String(i.city):d.city,country:i.country?String(i.country):d.country}}const r=A(P(m.currentRoute.value.query)),h=N([]);function Q(i,a){a(()=>{const t=i.toLowerCase();h.value=k[r.country].map(y=>y.city).filter(y=>y.toLowerCase().indexOf(t)>-1)})}U(r,()=>{k[r.country].some(i=>i.city===r.city)||(r.city=""),r.currency=T[r.country]});const _=V;function b(){_("submit",r),m.push({name:O.Search,query:R(r)})}const C=v;return D(()=>{C.autosubmit&&b()}),(i,a)=>(E(),L(z,{class:"flex q-gutter-xs",style:{"max-width":"800px",width:"100%"},onSubmit:a[5]||(a[5]=t=>b())},{default:c(()=>[o(p,{borderless:"","hide-dropdown-icon":"",label:e(l)("quickSearch.country"),"display-value":e(l)("countries."+r.country)||e(l)("quickSearch.countryPlaceholder"),placeholder:e(l)("quickSearch.countryPlaceholder"),modelValue:r.country,"onUpdate:modelValue":a[0]||(a[0]=t=>r.country=t),"option-label":t=>e(l)("countries."+t),options:e(G),style:{"max-width":"100px",width:"100%"},rules:[t=>!!t],"hide-bottom-space":"","no-error-icon":""},null,8,["label","display-value","placeholder","modelValue","option-label","options","rules"]),o(p,{borderless:"","hide-dropdown-icon":"",label:e(l)("quickSearch.city"),"display-value":r.city||e(l)("quickSearch.cityPlaceholder"),placeholder:e(l)("quickSearch.cityPlaceholder"),modelValue:r.city,"onUpdate:modelValue":a[1]||(a[1]=t=>r.city=t),"use-input":"","hide-selected":"","fill-input":"","input-debounce":200,options:h.value,onFilter:Q,style:{"max-width":"150px",width:"100%"},rules:[t=>!!t],"hide-bottom-space":"","no-error-icon":""},null,8,["label","display-value","placeholder","modelValue","options","rules"]),o(p,{borderless:"","hide-dropdown-icon":"",label:e(l)("quickSearch.currency"),modelValue:r.currency,"onUpdate:modelValue":a[2]||(a[2]=t=>r.currency=t),options:[e(s).RSD,e(s).EUR,e(s).BAM,e(s).MKD],style:{"max-width":"80px",width:"100%"},readonly:""},null,8,["label","modelValue","options"]),o(p,{borderless:"","hide-dropdown-icon":"",modelValue:r.price,"onUpdate:modelValue":a[3]||(a[3]=t=>r.price=t),label:e(l)("quickSearch.price"),options:[e(n).All,e(n).LT_2000,e(n).B_2000_5000,e(n).B_5000_10000,e(n).GT_10000],style:{"max-width":"130px",width:"100%"},"display-value":e(l)("quickSearch.filterPrice",{filter:r.price,currency:r.currency})},{option:c(t=>[o(f,w(g(t.itemProps)),{default:c(()=>[o(S,null,{default:c(()=>[x(q(e(l)("quickSearch.filterPrice",{filter:t.opt,currency:r.currency})),1)]),_:2},1024)]),_:2},1040)]),_:1},8,["modelValue","label","options","display-value"]),o(p,{borderless:"","hide-dropdown-icon":"",modelValue:r.rating,"onUpdate:modelValue":a[4]||(a[4]=t=>r.rating=t),label:e(l)("quickSearch.rating"),options:[e(u).All,e(u).R5,e(u).R4_5,e(u).R3_5],style:{"max-width":"100px",width:"100%"},"display-value":e(l)("quickSearch.filterRating",[r.rating])},{option:c(t=>[o(f,w(g(t.itemProps)),{default:c(()=>[o(S,null,{default:c(()=>[x(q(e(l)("quickSearch.filterRating",[t.opt])),1)]),_:2},1024)]),_:2},1040)]),_:1},8,["modelValue","label","options","display-value"]),o(M,{type:"submit",label:e(l)("quickSearch.search"),color:"primary",flat:"",icon:"search"},null,8,["label"])]),_:1}))}});export{Z as _};
