import{v as S,s as C,d as M,r as n,e as V,o as l,c,a as e,g as d,h as v,w as o,i as k,f as b,F as w,k as x,t as p,p as $,_ as y,P as B,u as E,n as N,j as D,m as L}from"./index-Cdt4oMy6.js";import{_ as O}from"./AppBanner-DMbYC2-2.js";import{_ as P}from"./AppBreadcrumbs-D4S6z5V4.js";import{E as I,a as q}from"./el-tab-pane-Byz9AmJe.js";import{S as H,a as A}from"./swiper-lfl8oNG_.js";const F={class:"section section--last section--bg"},U={class:"container"},j={class:"section__header"},z=e("div",{class:"section__title h2 font-500"},"Специальные предложения",-1),G=e("span",null,[$("Смотреть все "),e("img",{src:y})],-1),R={class:"slider-item__wrap"},J=e("div",{class:"slider-item__label"},"Специальное предложения",-1),K=["src"],Q={class:"slider-item__text"},W={class:"slider-item__title h3"},X=e("span",null,[$("Смотреть все "),e("img",{src:y})],-1),Y={__name:"SpecialsBlock",setup(T){const h=S.useMq();C(()=>{M.get("main?populate[0]=specials.banner&populate[1]=specials.cover").then(function(i){r.value=i.data.attributes.specials.data,m.value=r.value.filter(a=>a.attributes.vehicleCategory===s.value)}).catch(function(i){console.log(i)})});const f=n([{label:"Легковой транспорт",value:"passenger"},{label:"Грузовой транспорт",value:"commercialVehicles"},{label:"Спецтехника",value:"specialMachinery"}]),s=n("passenger"),g=i=>{s.value=i.paneName,m.value=r.value.filter(a=>a.attributes.vehicleCategory===s.value)},r=n([]),m=n([]),u=i=>"https://admin.resoleasing.com"+i;return(i,a)=>{const _=V("router-link");return l(),c("div",F,[e("div",U,[e("div",j,[z,d(h).mdPlus?(l(),v(_,{key:0,to:{path:"/special"},class:"btn-all"},{default:o(()=>[G]),_:1})):k("",!0)]),b(d(q),{modelValue:s.value,"onUpdate:modelValue":a[0]||(a[0]=t=>s.value=t),type:"card",onTabClick:a[1]||(a[1]=t=>g(t)),class:"border"},{default:o(()=>[(l(!0),c(w,null,x(f.value,t=>(l(),v(d(I),{key:t.value,label:t.label,name:t.value},null,8,["label","name"]))),128))]),_:1},8,["modelValue"]),b(d(A),{slidesPerView:"auto","space-between":10,breakpoints:{1536:{spaceBetween:30}},class:"swiper-visible swiper-width-auto"},{default:o(()=>[(l(!0),c(w,null,x(m.value,t=>(l(),v(d(H),{key:t.id},{default:o(()=>[b(_,{to:{name:"specialItem",params:{id:t.id}},class:"slider-item slider-item--1"},{default:o(()=>[e("div",R,[J,e("img",{class:"slider-item__img",src:u(t.attributes.cover.data.attributes.url)},null,8,K),e("div",Q,[e("div",W,p(t.attributes.title),1),e("p",null,p(t.attributes.shortDescription),1)])])]),_:2},1032,["to"])]),_:2},1024))),128))]),_:1}),d(h).smMinus?(l(),v(_,{key:0,to:{path:"special"},class:"btn btn--big"},{default:o(()=>[X]),_:1})):k("",!0)])])}}},Z={key:1,class:"section section--shadow"},ee={class:"container"},te={class:"finance-options"},se={class:"subtitle"},ae={class:"text-big font-300"},le={class:"spec-wrap"},ie={class:"spec-wrap__text"},ne=["innerHTML"],oe={class:"disclaimer text-normal"},ce={class:"spec-wrap__btn"},re=e("span",null,[$("Получить расчет "),e("img",{src:y})],-1),ue=[re],be={__name:"SpecialItemView",setup(T){const h=B(),f=E(),s=n({}),g=n({}),r=n(null);n(!1),C(async()=>{M.get(`/specials/${h.params.id}?populate[0]=banner&populate[1]=financeOptions`).then(function(a){s.value=a.data,g.value={attributes:{title:s.value.attributes.title,description:s.value.attributes.shortDescription,banner:s.value.attributes.banner}},f.commit("SET_BC",s.value.attributes.title),setTimeout(()=>{r.value},0)}).catch(function(a){console.log(a)})});const m=a=>a?L.parse(a):"",u=n(!1),i=()=>{f.commit("OPEN_LEASING_MODAL",{isOpen:!0,name:""})};return(a,_)=>(l(),c(w,null,[s.value.id?(l(),v(O,{key:0,data:g.value},{bc:o(()=>[b(P)]),_:1},8,["data"])):k("",!0),s.value.id?(l(),c("div",Z,[e("div",ee,[e("div",te,[(l(!0),c(w,null,x(s.value.attributes.financeOptions,t=>(l(),c("div",{class:"finance-options__item text-normal",key:t.id},[e("span",se,p(t.subtitle),1),e("span",ae,p(t.title),1)]))),128))]),e("div",le,[e("div",ie,[e("div",{ref_key:"textContent",ref:r,class:N(["text-overflow",{hide:!u.value}])},[e("div",{class:"text-section",innerHTML:m(s.value.attributes.description)},null,8,ne)],2),e("div",{class:"more-btn text-normal color-green",onClick:_[0]||(_[0]=t=>u.value=!u.value)},p(u.value?"Скрыть":"Показать")+" весь текст ",1),e("p",oe,p(s.value.attributes.disclaimer),1)]),e("div",ce,[e("a",{href:"#",onClick:D(i,["prevent"]),class:"btn"},ue)])])])])):k("",!0),b(Y)],64))}};export{be as default};