import{_ as R}from"./EmptyStateBlock-Dt7jmbAi.js";import{_ as V}from"./InfoMiniCard-BQLw48d_.js";import{_ as z}from"./BlueButton.vue_vue_type_script_setup_true_lang-CY8chwQm.js";import{_ as A}from"./IconDownload-CH0De47-.js";import{_ as F}from"./BlockBalanceAgreement-396E9Da8.js";import{am as j,g as i,x as P,o as e,c as m,b as r,a as o,F as _,w as l,B as q,h as k,m as d,j as G,d as H,f as J,t as u}from"./index-Bb2UEb_P.js";import{u as K}from"./index-Dax_IkAt.js";import{u as O}from"./documents-5nfQq6vW.js";import{f as Q}from"./time-CsiTV-I2.js";import"./_plugin-vue_export-helper-DlAUqK2U.js";import"./ButtonDefault-CzWpVlv6.js";import"./common-U_VzDrmL.js";const U={class:"tw-px-4 md:tw-px-8 tw-pb-8"},W={class:"tw-text-sm tw-text-gray-500 tw-mt-2"},X={class:"tw-grid tw-grid-cols-1 sm:tw-grid-cols-2 lg:tw-grid-cols-3 tw-gap-4 tw-mt-4"},Y={class:"tw-text-sm tw-text-gray-500 tw-mt-4"},Z={class:"tw-text-sm tw-text-gray-500 tw-mt-4"},dt={__name:"ContractDocuments",async setup(tt){let p,f;const D=K(),s=O(),I=j(),w=G(),c=i(()=>D.contractsList?.[w.params.id]),B=i(()=>s.motionDocumentsList.filter(t=>t.ContractID===c.value?.ID)),S=i(()=>s.contractDocumentsList.filter(t=>t.ContractID===c.value?.ID)),v=i(()=>I.data);function h(t){return v.value?.MotionDocuments?.Types?.[t]?.Name}function N(t){return v.value?.Contracts?.Enclosures?.Types?.[t]?.Name}function C(t){return t?"от "+Q(t):""}function $(t){s.motionDocumentDownload({MotionDocumentID:t})}function L(t){s.contractEnclosureDownload({ContractEnclosureID:t})}return[p,f]=P(()=>Promise.all([D.fetchContracts(),s.fetchMotionDocuments(),s.fetchContractDocuments()])),await p,f(),(t,a)=>{const M=F,E=H("RouterLink"),g=A,x=z,y=V,T=R;return e(),m(_,null,[r(M,{"contract-id":c.value?.ID},null,8,["contract-id"]),o("div",U,[c.value?(e(),m(_,{key:0},[a[2]||(a[2]=o("h1",{class:"tw-text-xl sm:tw-text-4xl"},"Документы",-1)),o("div",W,[r(E,{to:`/ContractScheme/${q(w).params.id}`},{default:l(()=>[J(u(c.value.Customer),1)]),_:1},8,["to"])]),o("div",X,[(e(!0),m(_,null,k(B.value,n=>(e(),d(y,{key:`motion-${n.ID}`},{default:l(()=>[o("div",null,[o("div",null,u(h(n.TypeID)),1),o("div",Y,u(C(n.CreateDate)),1)]),o("div",null,[r(x,{type:"small",onClick:b=>$(n.ID)},{default:l(()=>[a[0]||(a[0]=o("div",null,"Скачать",-1)),r(g,{class:"tw-size-5"})]),_:2,__:[0]},1032,["onClick"])])]),_:2},1024))),128)),(e(!0),m(_,null,k(S.value,n=>(e(),d(y,{key:`contract-${n.ID}`},{default:l(()=>[o("div",null,[o("div",null,u(N(n.TypeID)),1),o("div",Z,u(C(n.CreateDate)),1)]),o("div",null,[r(x,{type:"small",onClick:b=>L(n.ID)},{default:l(()=>[a[1]||(a[1]=o("div",null,"Скачать",-1)),r(g,{class:"tw-size-5"})]),_:2,__:[1]},1032,["onClick"])])]),_:2},1024))),128))])],64)):(e(),d(T,{key:1,label:"У вас пока нету документов"}))])],64)}}};export{dt as default};
