import{u as ae,P as te,v as oe,r as v,s as se,d as P,o as n,c as r,g as t,h as p,w as o,i as _,a as s,f as u,L as ue,F as c,k as L,Q as V,R as y,U as $,V as M,W as m,n as f,X as h,p as B,Y as j,Z as ie,$ as ne,_ as re}from"./index-Cdt4oMy6.js";import{_ as de}from"./AppBanner-DMbYC2-2.js";import{E as F,a as G}from"./el-tab-pane-Byz9AmJe.js";import{_ as J}from"./AppBreadcrumbs-D4S6z5V4.js";import{_ as ve}from"./AppPagination-BbKWO8Aw.js";import{_ as pe}from"./SaleItemForList-BtxYbJcU.js";const me={class:"section section--last section--shadow",style:{"z-index":"10"}},fe={class:"container"},_e={key:1,class:"filters"},ce={class:"filters__wrap"},ge=s("span",{class:"placeholder"},"до",-1),Ve=s("span",{class:"placeholder"},"Цена от, ₽",-1),Le=s("span",{class:"placeholder"},"до",-1),he=s("span",{class:"placeholder"},"Год выпуÑка от",-1),be=s("span",{class:"placeholder"},"до",-1),we=s("span",{class:"placeholder"},"Пробег от, Ñ‚Ñ‹Ñ. км",-1),ye={class:"w-full"},Me={key:0,width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",class:"icon-right"},Ce=s("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M3.46987 19.4687L9.7021 13.2365L10.7628 14.2972L4.53053 20.5294L3.46987 19.4687ZM9.70202 10.7616L3.46987 4.52941L4.53053 3.46875L10.7627 9.7009L9.70202 10.7616Z",fill:"#314157"},null,-1),xe=s("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M10.9393 12.0009L19.4697 3.47059L20.5303 4.53125L13.0607 12.0009L20.5303 19.4706L19.4697 20.5312L10.9393 12.0009Z",fill:"#017338"},null,-1),ke=[Ce,xe],Ee=s("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",class:"icon-right"},[s("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M3.46987 19.4687L9.7021 13.2365L10.7628 14.2972L4.53053 20.5294L3.46987 19.4687ZM9.70202 10.7616L3.46987 4.52941L4.53053 3.46875L10.7627 9.7009L9.70202 10.7616Z",fill:"#314157"}),s("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M10.9393 12.0009L19.4697 3.47059L20.5303 4.53125L13.0607 12.0009L20.5303 19.4706L19.4697 20.5312L10.9393 12.0009Z",fill:"#017338"})],-1),Ue=s("img",{src:re},null,-1),Oe={key:3,class:"flex mb-3"},Ze=s("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[s("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M11.6667 2.71094C13.3926 2.71094 14.7917 4.11005 14.7917 5.83594C14.7917 7.56183 13.3926 8.96094 11.6667 8.96094C10.1548 8.96094 8.89372 7.88734 8.60418 6.46094L0 6.46094V5.21094L8.60418 5.21094C8.89372 3.78454 10.1548 2.71094 11.6667 2.71094ZM13.5417 5.83594C13.5417 4.8004 12.7022 3.96094 11.6667 3.96094C10.6311 3.96094 9.79167 4.8004 9.79167 5.83594C9.79167 6.87147 10.6311 7.71094 11.6667 7.71094C12.7022 7.71094 13.5417 6.87147 13.5417 5.83594Z",fill:"#314157"}),s("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M8.33333 17.2943C6.60744 17.2943 5.20833 15.8952 5.20833 14.1693C5.20833 12.4434 6.60744 11.0443 8.33333 11.0443C9.84518 11.0443 11.1063 12.1179 11.3958 13.5443H20V14.7943H11.3958C11.1063 16.2207 9.84518 17.2943 8.33333 17.2943ZM6.45833 14.1693C6.45833 15.2048 7.2978 16.0443 8.33333 16.0443C9.36887 16.0443 10.2083 15.2048 10.2083 14.1693C10.2083 13.1337 9.36887 12.2943 8.33333 12.2943C7.2978 12.2943 6.45833 13.1337 6.45833 14.1693Z",fill:"#314157"}),s("path",{d:"M16.6667 6.46094L20 6.46094V5.21094H16.6667V6.46094Z",fill:"#017338"}),s("path",{d:"M3.33333 13.5443H0V14.7943H3.33333L3.33333 13.5443Z",fill:"#017338"})],-1),$e=s("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[s("g",{"clip-path":"url(#clip0_6135_18959)"},[s("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M11.308 7.09008L5.83342 0.703125L0.358887 7.09008L1.30796 7.90357L5.20842 3.35303V14.1635H6.45842V3.35303L10.3589 7.90357L11.308 7.09008ZM18.6922 12.0901L14.7918 16.6406V5.83018H13.5418V16.6406L9.64129 12.0901L8.69222 12.9036L14.1668 19.2906L19.6413 12.9036L18.6922 12.0901Z",fill:"#314157"}),s("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M14.7916 4.16146V0.828125H13.5416V4.16146H14.7916ZM6.45831 19.1615V15.8281H5.20831V19.1615H6.45831Z",fill:"#017338"})]),s("defs",null,[s("clipPath",{id:"clip0_6135_18959"},[s("rect",{width:"20",height:"20",fill:"white"})])])],-1),Be={class:"sale-list"},Fe={key:1,class:"mobile-wrapper"},Re={class:"mobile-wrapper__container"},Se={class:"mobile-wrapper__header"},De=s("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M3.46987 19.4687L9.7021 13.2365L10.7628 14.2972L4.53053 20.5294L3.46987 19.4687ZM9.70202 10.7616L3.46987 4.52941L4.53053 3.46875L10.7627 9.7009L9.70202 10.7616Z",fill:"#314157"},null,-1),Ne=s("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M10.9393 12.0009L19.4697 3.47059L20.5303 4.53125L13.0607 12.0009L20.5303 19.4706L19.4697 20.5312L10.9393 12.0009Z",fill:"#017338"},null,-1),Ae=[De,Ne],He={class:"mobile-wrapper__body"},Pe=s("div",{class:"mobile-wrapper__title"},"Ð’Ñе фильтры",-1),Te=s("span",{class:"placeholder"},"до",-1),Ie=s("span",{class:"placeholder"},"Цена от, ₽",-1),qe=s("span",{class:"placeholder"},"до",-1),ze=s("span",{class:"placeholder"},"Год выпуÑка от",-1),We=s("span",{class:"placeholder"},"до",-1),Ye=s("span",{class:"placeholder"},"Пробег от, Ñ‚Ñ‹Ñ. км",-1),Qe={class:"w-full"},Xe=s("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[s("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M3.46987 19.4687L9.7021 13.2365L10.7628 14.2972L4.53053 20.5294L3.46987 19.4687ZM9.70202 10.7616L3.46987 4.52941L4.53053 3.46875L10.7627 9.7009L9.70202 10.7616Z",fill:"#314157"}),s("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M10.9393 12.0009L19.4697 3.47059L20.5303 4.53125L13.0607 12.0009L20.5303 19.4706L19.4697 20.5312L10.9393 12.0009Z",fill:"#017338"})],-1),je=s("div",{class:"mobile-wrapper__title"},"Сортировать по",-1),ol={__name:"SaleView",setup(Ge){const R=ae(),T=te(),C=oe.useMq(),b=v(!1),S=v({}),I=v(),a=v({vehicle_type:"",brand:"",model:"",price_from:"",price_to:"",year_from:"",year_to:"",mileage_from:"",mileage_to:"",sort:"price_asc",page:1}),g=v({page:1,pageCount:1,pageSize:1,total:1}),k=v(!1);v({});const x=v([]),q=()=>{a.value.model="",x.value=[],a.value.brand?Object.entries(D.value).filter(([e,l])=>l===a.value.brand).forEach(e=>{x.value.push({id:e[0],label:N.value[e[0]]})}):(a.value.brand="",x.value=[])},z=()=>{a.value.brand="",a.value.model="",a.value.price_from="",a.value.price_to="",a.value.year_from="",a.value.year_to="",a.value.mileage_from="",a.value.mileage_to=""},W=v({passenger:"Легковой транÑпорт",cargo:"Грузовой",special:"Спецтехника",bus:"ÐвтобуÑÑ‹",trailer:"Прицепы"}),Y=v({price_asc:"Цена по возраÑтанию",price_desc:"Цена по убыванию",year_asc:"Год выпуÑка по возраÑтанию",year_desc:"Год выпуÑка по убыванию",mileage_asc:"Пробег по возраÑтанию",mileage_desc:"Пробег по убыванию"}),E=v([]),D=v([]),N=v([]),U=v([]);se(()=>{T.query.type&&(a.value.vehicle_type=T.query.type),P.get("/banners?populate=*&filters[type][$eq]=sale").then(function(i){S.value=i.data[0]}).catch(function(i){console.log(i)}),b.value=!0,P.get(`/sales-catalog?${X(a.value)}`).then(function(i){E.value=i.filter.BRAND_NAME,D.value=i.filter.MODEL_OF_BRAND,N.value=i.filter.MODEL_NAME,U.value=i.vehicles,g.value.page=i.page,g.value.pageCount=i.total_pages,g.value.pageSize=i.limit,g.value.total=i.total_items,b.value=!1}).catch(function(i){console.log(i)})});const Q=()=>{const i=new URL(window.location.href);i.searchParams.set("type",a.value.vehicle_type),window.history.pushState(null,"",i.toString()),w()},w=()=>{b.value=!0,U.value=[];const i=Object.assign({},a.value);i.price_from=i.price_from.replace(/\s/g,""),i.price_to=i.price_to.replace(/\s/g,""),P.get(`/sales-catalog?${X(i)}`).then(function(e){E.value=e.filter.BRAND_NAME,D.value=e.filter.MODEL_OF_BRAND,N.value=e.filter.MODEL_NAME,U.value=e.vehicles,g.value.page=e.page,g.value.pageCount=e.total_pages,g.value.pageSize=e.limit,g.value.total=e.total_items,b.value=!1}).catch(function(e){console.log(e)})},X=i=>{var e=[];for(var l in i)i.hasOwnProperty(l)&&i[l]!==""&&e.push(encodeURIComponent(l)+"="+encodeURIComponent(i[l]));return e.join("&")},K=i=>{g.value.page=i,a.value.page=i,w()},O=v(!1),A=v(!1),H=v(!1),ee=()=>{O.value=!0,H.value=!1,A.value=!0,R.commit("SET_BODY_OVERFLOW",!0)},le=()=>{O.value=!0,A.value=!1,H.value=!0,R.commit("SET_BODY_OVERFLOW",!0)},Z=(i,e)=>{if(typeof i=="string")return!1;const l=i.replace(/\s/g,"");a.value[e]=Number(l).toLocaleString("ru-RU")};return(i,e)=>(n(),r("div",null,[S.value.id&&t(C).smPlus?(n(),p(de,{key:0,data:S.value},{bc:o(()=>[u(J)]),_:1},8,["data"])):_("",!0),s("div",me,[s("div",fe,[t(C).xs?(n(),p(J,{key:0})):_("",!0),t(C).smPlus?(n(),r("div",_e,[u(t(G),{modelValue:a.value.vehicle_type,"onUpdate:modelValue":e[0]||(e[0]=l=>a.value.vehicle_type=l),type:"card",onTabChange:e[1]||(e[1]=l=>Q())},{default:o(()=>[u(t(F),{label:"Ð’Ñе",name:""}),(n(!0),r(c,null,L(W.value,(l,d)=>(n(),p(t(F),{key:d,label:l,name:d},null,8,["label","name"]))),128))]),_:1},8,["modelValue"]),s("div",ce,[u(t(j),{ref_key:"filterFormRef",ref:I,modelValue:a.value,"onUpdate:modelValue":e[16]||(e[16]=l=>a.value=l),class:"filters-form"},{default:o(()=>[u(t(V),null,{default:o(()=>[u(t(y),{modelValue:a.value.brand,"onUpdate:modelValue":e[2]||(e[2]=l=>a.value.brand=l),filterable:"",clearable:"",placeholder:"Марка",onChange:e[3]||(e[3]=l=>q()),"no-match-text":"Ðичего не найдено","suffix-icon":$},{default:o(()=>[(n(!0),r(c,null,L(E.value,(l,d)=>(n(),p(t(M),{key:d,label:l,value:d},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),u(t(V),null,{default:o(()=>[u(t(y),{modelValue:a.value.model,"onUpdate:modelValue":e[4]||(e[4]=l=>a.value.model=l),filterable:"",clearable:"",placeholder:"Модель",disabled:!a.value.brand,"suffix-icon":$},{default:o(()=>[(n(!0),r(c,null,L(x.value,l=>(n(),p(t(M),{key:l.id,label:l.label,value:l.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","disabled"])]),_:1}),u(t(V),{prop:"price_from"},{default:o(()=>[u(t(m),{modelValue:a.value.price_to,"onUpdate:modelValue":e[7]||(e[7]=l=>a.value.price_to=l),modelModifiers:{number:!0},class:f(["input-with-select",{"is-filled":a.value.price_to.length>0}]),onInput:e[8]||(e[8]=l=>Z(l,"price_to"))},{prefix:o(()=>[ge]),prepend:o(()=>[u(t(m),{modelValue:a.value.price_from,"onUpdate:modelValue":e[5]||(e[5]=l=>a.value.price_from=l),onInput:e[6]||(e[6]=l=>Z(l,"price_from")),class:f({"is-filled":a.value.price_from.length>0})},{prefix:o(()=>[Ve]),_:1},8,["modelValue","class"])]),_:1},8,["modelValue","class"])]),_:1}),k.value?(n(),r(c,{key:0},[u(t(V),null,{default:o(()=>[u(t(m),{modelValue:a.value.year_to,"onUpdate:modelValue":e[10]||(e[10]=l=>a.value.year_to=l),class:f(["input-with-select",{"is-filled":a.value.year_to.length>0}])},{prefix:o(()=>[Le]),prepend:o(()=>[u(t(m),{modelValue:a.value.year_from,"onUpdate:modelValue":e[9]||(e[9]=l=>a.value.year_from=l),class:f({"is-filled":a.value.year_from.length>0})},{prefix:o(()=>[he]),_:1},8,["modelValue","class"])]),_:1},8,["modelValue","class"])]),_:1}),u(t(V),null,{default:o(()=>[u(t(m),{modelValue:a.value.mileage_to,"onUpdate:modelValue":e[12]||(e[12]=l=>a.value.mileage_to=l),class:f(["input-with-select",{"is-filled":a.value.mileage_to.length>0}])},{prefix:o(()=>[be]),prepend:o(()=>[u(t(m),{modelValue:a.value.mileage_from,"onUpdate:modelValue":e[11]||(e[11]=l=>a.value.mileage_from=l),class:f({"is-filled":a.value.mileage_from.length>0})},{prefix:o(()=>[we]),_:1},8,["modelValue","class"])]),_:1},8,["modelValue","class"])]),_:1})],64)):_("",!0),s("div",ye,[u(t(h),{round:"",onClick:e[13]||(e[13]=l=>k.value=!k.value)},{default:o(()=>[B(" Ð’Ñе фильтры "),k.value?(n(),r("svg",Me,ke)):_("",!0)]),_:1}),u(t(h),{round:"",onClick:e[14]||(e[14]=l=>z())},{default:o(()=>[B(" СброÑить "),Ee]),_:1}),u(t(h),{type:"success",round:"",onClick:e[15]||(e[15]=l=>w())},{default:o(()=>[B(" Показать результаты "),Ue]),_:1})])]),_:1},8,["modelValue"])])])):_("",!0),t(C).smPlus?(n(),p(t(y),{key:2,modelValue:a.value.sort,"onUpdate:modelValue":e[17]||(e[17]=l=>a.value.sort=l),onChange:e[18]||(e[18]=l=>w()),class:"rounded sort mt-3 mb-3"},{default:o(()=>[(n(!0),r(c,null,L(Y.value,(l,d)=>(n(),p(t(M),{key:d,label:l,value:d},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])):_("",!0),t(C).xs?(n(),r("div",Oe,[u(t(h),{round:"",class:"border",onClick:e[19]||(e[19]=l=>ee())},{default:o(()=>[Ze]),_:1}),u(t(h),{round:"",class:"border ml-auto",onClick:e[20]||(e[20]=l=>le())},{default:o(()=>[$e]),_:1})])):_("",!0),ue((n(),r("div",Be,[(n(!0),r(c,null,L(U.value,l=>(n(),p(pe,{key:l.id,data:l},null,8,["data"]))),128))])),[[t(ie),b.value]]),b.value?_("",!0):(n(),p(ve,{key:4,pagination:g.value,center:!0,onOnChangePage:e[21]||(e[21]=l=>K(l))},null,8,["pagination"]))])]),O.value?(n(),r("div",Fe,[s("div",Re,[s("div",Se,[(n(),r("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",onClick:e[22]||(e[22]=l=>{O.value=!1,t(R).commit("SET_BODY_OVERFLOW",!1)})},Ae))]),s("div",He,[A.value?(n(),p(t(ne),{key:0,always:""},{default:o(()=>[Pe,u(t(G),{modelValue:a.value.vehicle_type,"onUpdate:modelValue":e[23]||(e[23]=l=>a.value.vehicle_type=l),type:"card",onTabChange:e[24]||(e[24]=l=>Q())},{default:o(()=>[u(t(F),{label:"Ð’Ñе",name:""}),(n(!0),r(c,null,L(W.value,(l,d)=>(n(),p(t(F),{key:d,label:l,name:d},null,8,["label","name"]))),128))]),_:1},8,["modelValue"]),u(t(j),{ref_key:"filterFormRef",ref:I,modelValue:a.value,"onUpdate:modelValue":e[38]||(e[38]=l=>a.value=l),class:"filters-form"},{default:o(()=>[u(t(V),null,{default:o(()=>[u(t(y),{modelValue:a.value.brand,"onUpdate:modelValue":e[25]||(e[25]=l=>a.value.brand=l),filterable:"",clearable:"",placeholder:"Марка",onChange:e[26]||(e[26]=l=>q()),"no-match-text":"Ðичего не найдено","suffix-icon":$},{default:o(()=>[(n(!0),r(c,null,L(E.value,(l,d)=>(n(),p(t(M),{key:d,label:l,value:d},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),u(t(V),null,{default:o(()=>[u(t(y),{modelValue:a.value.model,"onUpdate:modelValue":e[27]||(e[27]=l=>a.value.model=l),filterable:"",clearable:"",placeholder:"Модель",disabled:!a.value.brand,"suffix-icon":$},{default:o(()=>[(n(!0),r(c,null,L(x.value,l=>(n(),p(t(M),{key:l.id,label:l.label,value:l.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","disabled"])]),_:1}),u(t(V),{prop:"price_from"},{default:o(()=>[u(t(m),{modelValue:a.value.price_to,"onUpdate:modelValue":e[30]||(e[30]=l=>a.value.price_to=l),modelModifiers:{number:!0},class:f(["input-with-select",{"is-filled":a.value.price_to.length>0}]),onInput:e[31]||(e[31]=l=>Z(l,"price_to"))},{prefix:o(()=>[Te]),prepend:o(()=>[u(t(m),{modelValue:a.value.price_from,"onUpdate:modelValue":e[28]||(e[28]=l=>a.value.price_from=l),onInput:e[29]||(e[29]=l=>Z(l,"price_from")),class:f({"is-filled":a.value.price_from.length>0})},{prefix:o(()=>[Ie]),_:1},8,["modelValue","class"])]),_:1},8,["modelValue","class"])]),_:1}),u(t(V),null,{default:o(()=>[u(t(m),{modelValue:a.value.year_to,"onUpdate:modelValue":e[33]||(e[33]=l=>a.value.year_to=l),modelModifiers:{number:!0},class:f(["input-with-select",{"is-filled":a.value.year_to.length>0}])},{prefix:o(()=>[qe]),prepend:o(()=>[u(t(m),{modelValue:a.value.year_from,"onUpdate:modelValue":e[32]||(e[32]=l=>a.value.year_from=l),modelModifiers:{number:!0},class:f({"is-filled":a.value.year_from.length>0})},{prefix:o(()=>[ze]),_:1},8,["modelValue","class"])]),_:1},8,["modelValue","class"])]),_:1}),u(t(V),null,{default:o(()=>[u(t(m),{modelValue:a.value.mileage_to,"onUpdate:modelValue":e[35]||(e[35]=l=>a.value.mileage_to=l),class:f(["input-with-select",{"is-filled":a.value.mileage_to.length>0}])},{prefix:o(()=>[We]),prepend:o(()=>[u(t(m),{modelValue:a.value.mileage_from,"onUpdate:modelValue":e[34]||(e[34]=l=>a.value.mileage_from=l),class:f({"is-filled":a.value.mileage_from.length>0})},{prefix:o(()=>[Ye]),_:1},8,["modelValue","class"])]),_:1},8,["modelValue","class"])]),_:1}),s("div",Qe,[u(t(h),{round:"",class:"border",onClick:e[36]||(e[36]=l=>z())},{default:o(()=>[Xe]),_:1}),u(t(h),{type:"success",round:"",onClick:e[37]||(e[37]=l=>w())},{default:o(()=>[B(" Показать результаты ")]),_:1})])]),_:1},8,["modelValue"])]),_:1})):_("",!0),H.value?(n(),r(c,{key:1},[je,u(t(y),{modelValue:a.value.sort,"onUpdate:modelValue":e[39]||(e[39]=l=>a.value.sort=l),onChange:e[40]||(e[40]=l=>w()),class:"rounded sort"},{default:o(()=>[(n(!0),r(c,null,L(Y.value,(l,d)=>(n(),p(t(M),{key:d,label:l,value:d},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])],64)):_("",!0)])])])):_("",!0)]))}};export{ol as default};