import{u as h,v as I,_ as k}from"./index-Dax_IkAt.js";import{_ as C}from"./ButtonDefault-CzWpVlv6.js";import{e as D,r as B,g as m,K as S,B as _,o as w,c as r,a as t,t as a,b as d,k as N,n as $,F as j,h as O,i as f}from"./index-Bb2UEb_P.js";import{f as V}from"./common-U_VzDrmL.js";import{_ as z}from"./_plugin-vue_export-helper-DlAUqK2U.js";const A={key:0,class:"tw-relative tw-border-b tw-border-gray-100 tw-mb-4 tw-py-1 tw-px-2 md:tw-px-6"},F={class:"tw-flex tw-flex-wrap tw-gap-1 md:tw-gap-4 tw-w-full tw-items-center tw-justify-between tw-px-2"},L={class:"tw-flex tw-gap-4 md:tw-items-center tw-justify-between tw-flex-1"},R={class:"tw-flex-1 tw-flex tw-flex-col md:tw-flex-row md:tw-items-center tw-gap-1 md:tw-gap-4"},E={class:"tw-text-gray-400 tw-text-left"},H={class:"tw-flex-1 tw-text-sky-400 tw-line-clamp-1 tw-text-left"},K={class:"tw-flex tw-gap-4"},M={class:"tw-flex-1 tw-flex tw-flex-col md:tw-flex-row md:tw-items-center tw-gap-1 md:tw-gap-4"},P={class:"tw-text-gray-800 tw-text-left"},T={class:"balance__pay-btn"},q={key:0,class:"tw-absolute tw-top-[50px] md:tw-top-[58px] tw-left-1 tw-right-1 tw-z-20 tw-pl-1 md:tw-pl-6 tw-pr-8 md:tw-pr-[60px] tw-bg-white tw-border tw-border-gray-100 tw-rounded tw-shadow-md"},G={class:"tw-flex-1 tw-flex tw-flex-col md:tw-flex-row md:tw-items-center tw-gap-1 md:tw-gap-4"},J={class:"tw-text-gray-400 tw-text-left"},Q={class:"tw-flex-1 tw-text-sky-400 tw-line-clamp-1 tw-text-left"},U={class:"tw-flex tw-gap-4"},W={class:"tw-flex-1 tw-flex tw-flex-col md:tw-flex-row md:tw-items-center tw-gap-1 md:tw-gap-4"},X={class:"tw-text-gray-800 tw-text-left"},Y={class:"balance__pay-btn"},Z={__name:"BlockBalanceAgreement",props:{contractId:{type:Number,default:null}},setup(x){const i=x,v=h(),g=D(),l=B(!1),c=m(()=>Object.values(v.contractsList).filter(e=>e.ID===i.contractId||(e.Orders>0||e.Balance>0)&&e.IsHidden===!1).map(e=>({ID:e.ID,name:e.Customer,balance:e.Balance}))),o=m(()=>i.contractId?c.value.find(n=>n.ID===i.contractId):c.value?.[0]||null);function p(n){g.push(`/Balance/${n}`)}function b(){l.value=!1}return(n,e)=>{const u=C,y=k;return o.value?S((w(),r("div",A,[t("div",F,[t("div",L,[t("div",R,[t("div",E,a(String(o.value.ID).padStart(5,"0")),1),t("div",H,a(o.value.name),1)]),t("div",K,[t("div",M,[e[2]||(e[2]=t("div",{class:"tw-text-gray-400 tw-text-left"},"Баланс",-1)),t("div",P,a(_(V)(o.value.balance)),1)]),t("div",T,[d(u,{class:"btn-pay tw-m-0",label:"Пополнить",onClick:e[0]||(e[0]=N(s=>p(o.value.ID),["stop"]))})])])]),d(y,{onClick:e[1]||(e[1]=s=>l.value=!l.value),class:$(["tw-cursor-pointer tw-duration-300",{"tw-rotate-180":l.value}])},null,8,["class"])]),l.value?(w(),r("div",q,[(w(!0),r(j,null,O(c.value,s=>(w(),r("div",{key:s.ID,class:"tw-flex md:tw-items-center tw-justify-between tw-gap-1 md:tw-gap-4 tw-w-full tw-p-2"},[t("div",G,[t("div",J,a(String(s.ID).padStart(5,"0")),1),t("div",Q,a(s.name),1)]),t("div",U,[t("div",W,[e[3]||(e[3]=t("div",{class:"tw-text-gray-400 tw-text-left"},"Баланс",-1)),t("div",X,a(s.balance)+" ₽",1)]),t("div",Y,[d(u,{class:"btn-pay tw-m-0",label:"Пополнить",onClick:tt=>p(s.ID)},null,8,["onClick"])])])]))),128))])):f("",!0)])),[[_(I),b]]):f("",!0)}}},nt=z(Z,[["__scopeId","data-v-f3256890"]]);export{nt as _};
