import{M as d,N as v,r as b,f as h,H as S,c as g,o as w,I as C,a as l,J as N,t as s,e as B,b as D,w as c,v as V}from"./index-CipWZKo_.js";import{u as I}from"./contracts-CILh9uSu.js";import{s as x}from"./multiselect-DWCHRlfT.js";import{_ as y}from"./_plugin-vue_export-helper-DlAUqK2U.js";const T={class:"form-field form-field--basic"},L={class:"form-field-input__wrapper"},P={class:"tw-mr-2"},E={class:"tw-text-right"},M={__name:"BlockSelectContract",props:d({title:{type:String,default:""},hasBalance:{type:Boolean,default:!1},allowPartner:{type:Boolean,default:!1}},{modelValue:{type:Number},modelModifiers:{}}),emits:d(["buttonClicked","update"],["update:modelValue"]),setup(u,{emit:m}){const o=u,f=v(u,"modelValue"),p=m,n=I(),i=b(null),r=h(()=>{const a=["Natural","Juridical","Default","Public","Individual","NaturalPartner"];return Object.values(n.contractsList).filter(e=>!(!a.includes(e.TypeID)||e.IsHidden||!o.allowPartner&&e.TypeID==="NaturalPartner"||o.hasBalance&&Number(e.Balance)<=0)).map(e=>({value:Number(e.ID),name:e.Customer,balance:e.Balance}))});function _(a){f.value=a,p("update")}return S(()=>{if(r.value?.length&&n.contractsList){const a=r.value[0].value;n.contractsList[a]?i.value=a:console.error("Договор не найден:",a)}}),(a,e)=>(w(),g("div",null,[C(l("h2",{class:"tw-mb-2"},s(o.title),513),[[N,o.title]]),l("div",T,[e[1]||(e[1]=l("div",{class:"form-field__label"},[B(" Выбрать договор "),l("span",null,"*")],-1)),l("div",L,[D(V(x),{class:"multiselect--white tw-h-[44px]",placeholder:"Выбрать договор",label:"name",modelValue:i.value,"onUpdate:modelValue":e[0]||(e[0]=t=>i.value=t),options:r.value,disabled:r.value?.length<=1,onChange:_},{singlelabel:c(({value:t})=>[l("div",P," # "+s(t.value?t.value.toString().padStart(5,"0"):String(t).padStart(5,"0"))+" / "+s(t.name)+" / "+s(t.balance+" руб"),1)]),option:c(({option:t})=>[l("div",E," # "+s(t.value.toString().padStart(5,"0"))+" / "+s(t.name)+" / "+s(t.balance+" руб"),1)]),_:1},8,["modelValue","options","disabled"])])])]))}},J=y(M,[["__scopeId","data-v-393082f9"]]);export{J as _};
