import{r as I,f as u,H as S,m as b,c as D,o as V,I as h,a as o,J as w,t as n,e as E,b as N,w as m,v as T}from"./index-CmCGXBst.js";import{u as g}from"./contracts-P7YPBhEI.js";import{s as k}from"./multiselect-DhoC9bwZ.js";import{_ as O}from"./_plugin-vue_export-helper-DlAUqK2U.js";const x={class:"form-field form-field--basic"},B={class:"form-field-input__wrapper"},C={class:"multiselect-option"},L={__name:"BlockSelectProfile",props:["modelValue","title","items","domainOwner"],emits:["update:modelValue","buttonClicked"],setup(r,{emit:p}){const s=r,v=p,_=g(),i=I(null),a=u(()=>_?.profileList),c=u(()=>Object.keys(a.value).map(t=>{const e=a.value[t].TemplateID;if(e==="Natural"||e==="Juridical"||e==="Individual"||e==="NaturalPartner")return{value:a.value[t].ID,name:a.value[t].Name,contractID:a.value[t].ContractID}}).filter(Boolean)),d=u(()=>s.domainOwner?c.value.filter(t=>{const e=a.value[t.value].TemplateID;return e==="Natural"||e==="Juridical"}):c.value);function f(t){v("update:modelValue",t)}return S(()=>{a.value&&(i.value=Object.keys(a.value)?.[0])}),b(s,()=>{i.value=s.modelValue}),(t,e)=>(V(),D("section",null,[h(o("h2",{class:"section-block_title"},n(s.title),513),[[w,s.title]]),o("div",x,[e[1]||(e[1]=o("div",{class:"form-field__label"},[E(" Выбрать профиль "),o("span",null,"*")],-1)),o("div",B,[N(T(k),{class:"multiselect--white",placeholder:"Выбрать профиль",label:"name",modelValue:i.value,"onUpdate:modelValue":e[0]||(e[0]=l=>i.value=l),options:r.items||d.value,disabled:r.items?.length<=1&&d.value?.length<=1,onChange:f},{singlelabel:m(({value:l})=>[o("span",null,"# "+n(String(l.value).padStart(5,"0"))+" / "+n(l.name),1)]),option:m(({option:l})=>[o("div",C,"# "+n(String(l.value).padStart(5,"0"))+" / "+n(l.name),1)]),_:1},8,["modelValue","options","disabled"])])])]))}},J=O(L,[["__scopeId","data-v-dda44bca"]]);export{J as _};
