import{_ as A}from"./EmptyStateBlock-BaR9js3E.js";import{_ as F}from"./ButtonDefault-BIBStZbJ.js";import{_ as j}from"./IconDownload-B1Yh9ot7.js";import{_ as O}from"./BlockBalanceAgreement-qtspRQ_B.js";import{ao as R,f as d,g as q,D as C,c as u,b as s,a as e,C as z,w as p,E as G,F as v,i as S,o as c,e as B,t as _}from"./index-CmCGXBst.js";import{u as H}from"./contracts-P7YPBhEI.js";import{u as J}from"./documents-ClZw_PDI.js";import{f as K,s as P}from"./time-DenPiOX5.js";import{_ as Q}from"./_plugin-vue_export-helper-DlAUqK2U.js";const U={class:"section"},W={class:"container"},X={class:"section-header"},Y={class:"breadcrumb"},Z={key:0,class:"grid-section"},tt={class:"list-item__row"},ot={class:"list-item__row secondary-text"},et={class:"list-item__row"},nt={class:"list-item__row secondary-text"},st={__name:"ContractDocuments",async setup(ct){let a,r;const g=H(),i=J(),N=R(),x=q(),w=d(()=>g?.contractsList?.[x.params.id]),D=d(()=>i?.motionDocumentsList),f=d(()=>i?.contractDocumentsList),h=d(()=>N.data);function E(t){return h.value?.MotionDocuments?.Types?.[t]?.Name}function M(t){return h.value?.Contracts?.Enclosures?.Types?.[t]?.Name}function k(t){return t?"от "+K(P(t)):""}function l(t){let n=[];return t&&Object.keys(t).forEach(m=>{t[m]?.ContractID===w.value?.ID&&n.push(t[m])}),n}function T(t){i.motionDocumentDownload({MotionDocumentID:t})}function $(t){i.contractEnclosureDownload({ContractEnclosureID:t})}return[a,r]=C(()=>g.fetchContracts()),await a,r(),[a,r]=C(()=>i.fetchMotionDocuments()),await a,r(),[a,r]=C(()=>i.fetchContractDocuments()),await a,r(),(t,n)=>{const m=O,y=G("router-link"),I=j,b=F,L=A;return c(),u(v,null,[s(m),e("section",U,[e("div",W,[e("div",X,[e("div",Y,[s(y,{to:"/Contracts",class:"section-label"},{default:p(()=>n[0]||(n[0]=[B("Договор /",-1)])),_:1,__:[0]}),s(y,{to:`/ContractScheme/${t.$route.params.id}`,class:"section-label"},{default:p(()=>[B(_(w.value?.Customer),1)]),_:1},8,["to"])]),n[1]||(n[1]=e("h1",{class:"section-title"},"Документы",-1))]),l(D.value)&&l(D.value).length>0||l(f.value)&&l(f.value).length>0?(c(),u("div",Z,[(c(!0),u(v,null,S(l(D.value),o=>(c(),u("div",{key:"motion-"+o?.ID,class:"list-item"},[e("div",tt,_(E(o?.TypeID)),1),e("div",ot,_(k(o?.CreateDate)),1),s(b,{class:"download-button",label:"Скачать",onClick:V=>T(o?.ID)},{icon:p(()=>[s(I,{class:"download-icon"})]),_:2},1032,["onClick"])]))),128)),(c(!0),u(v,null,S(l(f.value),o=>(c(),u("div",{key:"contract-"+o?.ID,class:"list-item"},[e("div",et,_(M(o?.TypeID)),1),e("div",nt,_(k(o?.CreateDate)),1),s(b,{class:"download-button",label:"Скачать",onClick:V=>$(o?.ID)},{icon:p(()=>[s(I,{class:"download-icon"})]),_:2},1032,["onClick"])]))),128))])):(c(),z(L,{key:1,label:"У вас пока что нету документов"}))])])],64)}}},Dt=Q(st,[["__scopeId","data-v-daf4aa08"]]);export{Dt as default};
