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