import{_ as y}from"./EmptyStateBlock-Dt7jmbAi.js";import{_ as E}from"./ProfileForm-BB6yjYT8.js";import{_ as P}from"./ClausesKeeper-CyJ_9bTp.js";import{_ as N}from"./BlockBalanceAgreement-396E9Da8.js";import{am as V,r as s,g as l,v as I,o as n,c as h,b as f,a,t as C,m as d,F as D,e as L,j}from"./index-Bb2UEb_P.js";import{u as A}from"./index-Dax_IkAt.js";import{_ as R}from"./_plugin-vue_export-helper-DlAUqK2U.js";import"./ButtonDefault-CzWpVlv6.js";import"./HtmlContent-DrkJBX3e.js";import"./bootstrap-vue-next-C0pyDr3k.js";import"./IconClip-BGYNmTdK.js";import"./IconCloseCircle-ctElXVvc.js";import"./IconFile-CrvZD0mK.js";import"./InputSelect.vue_vue_type_script_setup_true_lang-DDGr1dhD.js";import"./IconChevronDown-NfcUpI8U.js";import"./BasicInput-BG-lQkv5.js";import"./component-C-Q4t0gB.js";import"./common-U_VzDrmL.js";import"./files-Bk5mgFCm.js";import"./clauses-Bhz_DuFa.js";const T={class:"tw-px-4 md:tw-px-8 tw-mb-10"},$={class:"tw-mb-4"},M={class:"tw-text-gray-500 tw-text-sm tw-mt-2"},O={__name:"ProfileEdit",setup(U){const v=V(),m=A(),g=L(),i=j(),r=s({}),p=s({}),c=s(!1),u=s(null),e=l(()=>m.profileList?.[i.params.id]),_=l(()=>e.value?.TemplateID),x=l(()=>v.data?.Profiles?.Templates?.[_.value]?.Name);I(e,()=>{e.value&&(r.value={...e.value.Attribs},p.value=Object.keys(e.value.Files||{}).map(o=>({name:e.value?.Files[o].Name,value:e.value?.Files[o].ID})))},{immediate:!0});async function w(o){o.append("ProfileID",i.params.id),c.value=!0;const t=await m.profileEdit(o);c.value=!1,t.status==="success"?g.push("/Contracts?section=Profiles"):u.value=t.data?.Exception}return(o,t)=>{const k=N,b=P,B=E,F=y;return n(),h(D,null,[f(k),a("div",T,[a("div",$,[t[1]||(t[1]=a("h1",{class:"tw-text-xl sm:tw-text-4xl"},"Редактировать профиль",-1)),a("div",M,C(x.value),1)]),f(b),e.value?(n(),d(B,{key:0,modelValue:r.value,"onUpdate:modelValue":t[0]||(t[0]=S=>r.value=S),template:_.value,"old-file-list":p.value,"error-message":u.value,onSend:w},null,8,["modelValue","template","old-file-list","error-message"])):(n(),d(F,{key:1,label:"Профиль договора не найден"}))])],64)}}},ie=R(O,[["__scopeId","data-v-bfe5175f"]]);export{ie as default};
