import{_ as V}from"./EmptyStateBlock-Dt7jmbAi.js";import{_ as $}from"./BlueButton.vue_vue_type_script_setup_true_lang-CY8chwQm.js";import{L as A}from"./bootstrap-vue-next-C0pyDr3k.js";import{_ as y}from"./_plugin-vue_export-helper-DlAUqK2U.js";import{o as i,c as r,a as e,x as P,b as u,B as n,F as k,h as j,m as E,A as M,t as l,w as m,f as K,i as O}from"./index-Bb2UEb_P.js";import{_ as R}from"./ClausesKeeper-CyJ_9bTp.js";import{_ as T}from"./BlockBalanceAgreement-396E9Da8.js";import{u as q}from"./basket-jtD0S_sn.js";import{u as z}from"./index-Dax_IkAt.js";import{u as G}from"./services-DEZoSah0.js";import{f as x}from"./common-U_VzDrmL.js";import"./HtmlContent-DrkJBX3e.js";import"./IconCloseCircle-ctElXVvc.js";import"./clauses-Bhz_DuFa.js";import"./ButtonDefault-CzWpVlv6.js";const H={},J={fill:"none",height:"32",viewBox:"0 0 32 32",width:"32",xmlns:"http://www.w3.org/2000/svg"};function Q(S,c){return i(),r("svg",J,c[0]||(c[0]=[e("rect",{fill:"#F7F9FF",height:"31",rx:"3.5",width:"31",x:".5",y:".5"},null,-1),e("path",{d:"M8.5 11h15m-1.665 0v11.667a1.667 1.667 0 0 1-1.667 1.666h-8.333a1.667 1.667 0 0 1-1.667-1.666V11m2.5 0V9.333a1.667 1.667 0 0 1 1.667-1.666h3.333a1.667 1.667 0 0 1 1.667 1.666V11m-5.003 4.167v5m3.336-5v5",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),e("rect",{height:"31",rx:"3.5",stroke:"#C7D1ED",width:"31",x:".5",y:".5"},null,-1)]))}const U=y(H,[["render",Q]]),W={class:"tw-px-4 md:tw-px-8"},X={key:0,class:"cart-list tw-mt-4"},Y={key:0,class:"cart-item tw-mb-6"},Z={class:"cart-item__subtitle"},tt={class:"cart-item__subtitle-name"},et={class:"d-block"},st={class:"d-block table-td-blue"},ot=["onClick"],nt={class:"tw-flex tw-items-center tw-justify-between tw-text-2xl tw-mt-4"},lt={__name:"Basket",async setup(S){let c,b;const h=[{key:"ServiceID",label:"Услуга",variant:"td-service"},{key:"OrderID",label:"Номер заказа",variant:"td-service"},{key:"Amount",label:"Период"},{key:"Summ",label:"Сумма"},{key:"controls",label:"Действия",variant:"td-controls"}],a=q(),d=z(),B=G(),v=M("emitter");v.on("form-cart-invoice",o=>{g(o)}),[c,b]=P(()=>a.fetchBasket()),await c,b();function w(o){let t=0;for(let _=0;_<o.length;_++)t=t+Number(o[_]?.Summ);return t}function D(o,t){v.emit("open-modal",{component:"InvoiceMakeBasket",data:{ItemID:t,ContractPaymentSystems:d.contractsList[t]?.PaymentSystems,ProfileID:d.contractsList[t]?.ProfileID,sum:w(o)}})}function g(o){delete a.basketList[o]}return(o,t)=>{const _=T,C=R,I=U,L=A,F=$,N=V;return i(),r(k,null,[u(_),e("div",W,[t[7]||(t[7]=e("h1",{class:"tw-text-xl sm:tw-text-4xl"},"Корзина",-1)),u(C),n(a).basketList&&Object.keys(n(a).basketList).length?(i(),r("div",X,[(i(!0),r(k,null,j(n(a).basketList,(p,f)=>(i(),r(k,{key:f},[p.length?(i(),r("div",Y,[t[6]||(t[6]=e("div",{class:"cart-item__title"},"Заказ",-1)),e("div",Z,[e("div",tt,l(n(d).contractsList[f].Customer),1)]),u(L,{items:p,fields:h,class:"basic-table table-cart"},{"cell(ServiceID)":m(s=>[t[0]||(t[0]=e("span",{class:"td-mobile"},"Услуга",-1)),e("span",et,l(n(B).ServicesList[s.item?.ServiceID]?.Name),1),e("span",st,l(s.item?.Comment),1)]),"cell(OrderID)":m(s=>[t[1]||(t[1]=e("span",{class:"td-mobile"},"Номер заказа",-1)),e("span",null,"№ "+l(s.item?.OrderID),1)]),"cell(Amount)":m(s=>[t[2]||(t[2]=e("span",{class:"td-mobile"},"Период",-1)),e("span",null,l(s.item?.Amount)+" "+l(s.item?.Measure),1)]),"cell(Summ)":m(s=>[t[3]||(t[3]=e("span",{class:"td-mobile"},"Сумма",-1)),e("span",null,l(n(x)(s.item?.Summ)),1)]),"cell(controls)":m(s=>[e("button",{class:"btn-delete btn",onClick:it=>n(a).deleteFromBasket(s.item.ID)},[u(I)],8,ot)]),_:2},1032,["items"]),e("div",nt,[t[4]||(t[4]=e("div",null,"Итого",-1)),e("div",null,l(n(x)(w(p))),1)]),u(F,{class:"tw-w-full tw-mt-4",onClick:s=>D(p,f)},{default:m(()=>t[5]||(t[5]=[K(" Оплатить заказ ",-1)])),_:2,__:[5]},1032,["onClick"])])):O("",!0)],64))),128))])):(i(),E(N,{key:1,label:"Корзина заказов пуста",class:"tw-mt-4"}))])],64)}}},St=y(lt,[["__scopeId","data-v-905eeea4"]]);export{St as default};
