1import{q as w,$ as U,ah as M,ad as z,j as e,G as b,S as G,r as A,k as E,s as m,b5 as K}from"./theme-3dfVej7W.js";import{dL as R,dM as Q,bG as O,bJ as B,fn as H,b$ as Y,fo as q,fp as J,fq as V,dU as W,R as X,fr as Z,s as P,g as ee}from"./PrivateApp-BFO3_Tbx.js";import{b as te,a as se}from"./format-iAAoiKz_.js";import{a as ae}from"./downloadFileByUrl-w19mXwt2.js";import{F as I}from"./FileDownloadLink-CDJK4Sj_.js";import"./purify.es-LQkvcK5U.js";import{F as x}from"./contractExecutionTypes-BKIbIApT.js";import{T as ie}from"./index-I1ZxXO3B.js";import{R as ce}from"./LeftOutlined-zZTRbrqI.js";import{C as D}from"./index-BKUOnk1C.js";import{F as y,T as ne}from"./index-C86gn5Ct.js";import{S as re}from"./index-C63dYVM1.js";import{P as oe}from"./index-BZy7ibvr.js";import{U as le}from"./index-YFykW8M_.js";import"./vite-preload-helper-BXl3LOEh.js";import"./index-LRpAibSh.js";import"../remoteEntry.js";import"./index-BEDcFE4N.js";import"./SignatureContext-BIIScoJU.js";import"./registerCabinetApi-CKnIRFA1.js";import"./index-C016Db5J.js";import"./AntdIcon-B8e_FEAo.js";import"./formatAmount-BO0bCaMt.js";import"./index-wH3ULS13.js";import"./PurePanel-CIovuaru.js";import"./useContractFileDownload-zoXsSrlc.js";import"./index-CPNG8-3L.js";import"./EllipsisOutlined-fLaExTxN.js";import"./PlusOutlined-DJbYRZlH.js";import"./isMobile-B_S5qVvp.js";import"./index-CwLtvCkV.js";import"./Sider-CaqjhNAo.js";import"./useBreakpoint-DBaSuQQQ.js";import"./index-D10blwUV.js";import"./useForm-Cmblz3t1.js";import"./index-DqejBB-o.js";import"./EyeOutlined-DGpwx6h2.js";import"./progress-DriKEix0.js";const de=3e3,pe=60,me=i=>new Promise(n=>setTimeout(n,i)),N=i=>{const n=i?.code;return n?ee(n):K(i)},{Title:k}=ie,ue=({crootId:i,unitId:n})=>{const{t:s}=w("contract"),{data:o,isLoading:u}=H({crootId:i,unitId:n}),[c]=Y(),[r]=q(),[l,g]=J(),[_]=V(),[d]=W(),[j,h]=A.useState(!1),p=async a=>{h(!0);try{const t=await P(a),S=await c({file:a,signature:t}).unwrap();let f=x.PENDING;for(let T=0;T<pe&&(f=(await d({file_ids:[S.file_id]}).unwrap()).items[0]?.final??x.PENDING,f===x.PENDING);T+=1)await me(de);if(f!==x.PASSED){m.error(s(f===x.FAILED?"techSpec.fileCheckFailed":"techSpec.fileCheckPending"));return}const L=await r({crootId:i,unitId:n,file_id:S.file_id}).unwrap();m.success(L.message)}catch(t){m.error(N(t)??s("techSpec.actionError"))}finally{h(!1)}},C=async a=>{h(!0);try{if(!a.file_url)throw new Error("no download url");const t=await ae(a.file_url,a.original_filename??`techspec_${a.file_id}.pdf`),S=await P(t),f=await _({crootId:i,unitId:n,signature:S}).unwrap();m.success(f.message)}catch(t){m.error(N(t)??s("techSpec.actionError"))}finally{h(!1)}},F=async()=>{try{const a=await l({crootId:i,unitId:n}).unwrap();m.success(a.message)}catch(a){m.error(N(a)??s("techSpec.actionError"))}},$=[{title:s("card.subjects.techspecName"),dataIndex:"plan_point_name",width:260,render:a=>a??"â"},{title:s("card.subjects.techspecFile"),dataIndex:"original_filename",render:(a,t)=>e.jsx(I,{url:t.file_url,fileName:a,children:a??String(t.file_id)})},{title:s("card.subjects.techspecAuthor"),dataIndex:"author",width:200},{title:s("card.subjects.techspecSubject"),dataIndex:"subject_name",width:220},{title:s("card.subjects.techspecDate"),dataIndex:"create_date",width:140,render:a=>te(a)},{title:s("card.subjects.techspecSigned"),key:"signed",width:220,render:(a,t)=>e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(ne,{color:t.is_signed?"green":t.need_sign?"orange":"default",children:t.is_signed?s("card.subjects.techspecSignedYes"):s("card.subjects.techspecSignedNo")}),t.notice?e.jsx("span",{className:"text-[12px] text-neutral-500",children:t.notice}):null]})},{key:"actions",width:200,render:(a,t)=>t.need_sign||t.can_delete?e.jsxs(re,{direction:"vertical",size:4,children:[t.need_sign&&e.jsx(b,{size:"small",type:"primary",loading:j,onClick:()=>C(t),children:s("techSpec.sign")}),t.can_delete&&e.jsx(oe,{title:s("techSpec.deleteConfirm"),onConfirm:F,children:e.jsx(b,{size:"small",danger:!0,loading:g.isLoading,children:s("techSpec.deleteFile")})})]}):null}],v=[{title:s("card.subjects.signerOwner"),dataIndex:"signer"},{title:s("card.subjects.signerSubject"),dataIndex:"subject_name"},{title:s("card.subjects.signerDate"),dataIndex:"crdate",width:170,render:a=>se(a)},{title:s("card.subjects.signerCms"),width:130,render:(a,t)=>t.cms_link?e.jsx("a",{href:`${E.apiUrl}${t.cms_link}`,target:"_blank",rel:"noreferrer",children:s("card.subjects.signerCms")}):"â"},{title:s("card.subjects.signerCertColumn"),width:150,render:(a,t)=>t.cert_link?e.jsx("a",{href:`${E.apiUrl}${t.cert_link}`,target:"_blank",rel:"noreferrer",children:s("card.subjects.signerCert")}):"â"}];return e.jsxs(e.Fragment,{children:[o?.can_upload&&e.jsx("div",{className:"mb-3",children:e.jsx(le,{accept:".pdf,.doc,.docx,.xls,.xlsx,.zip,.rar,.jpg,.jpeg,.png",showU
1ploadList:!1,beforeUpload:a=>(p(a),!1),children:e.jsx(b,{type:"primary",icon:e.jsx(X,{}),loading:j,children:s("techSpec.attachFile")})})}),e.jsx(y,{rowKey:"file_id",size:"small",loading:u,columns:$,dataSource:o?.items??[],pagination:!1,locale:{emptyText:s("techSpec.noDocuments")},expandable:{rowExpandable:a=>a.signers.length>0,expandedRowRender:a=>e.jsx(y,{rowKey:t=>`${t.user_id}-${t.subject_id}-${t.crdate}`,size:"small",columns:v,dataSource:a.signers,pagination:!1})}})]})},he={1:"teoPsd",5:"smeta",6:"tz"},fe=({crootId:i,unitId:n})=>{const{t:s}=w("contract"),{data:o,isLoading:u}=Z({crootId:i,unitId:n}),c=[{title:s("techSpec.planDocType"),dataIndex:"file_type_id",width:260,render:r=>s(`techSpec.planDocTypes.${he[r]??"other"}`)},{title:s("card.subjects.techspecFile"),dataIndex:"file_name",render:(r,l)=>l.file_id==null?"â":e.jsx(I,{url:l.file_url,fileName:r,children:r??String(l.file_id)})}];return!u&&!o?.items.length?null:e.jsxs("div",{className:"mt-4",children:[e.jsx(k,{level:5,className:"!mb-2",children:s("techSpec.planDocumentsTitle")}),e.jsx(y,{rowKey:"file_id",size:"small",loading:u,columns:c,dataSource:o?.items??[],pagination:!1})]})},tt=()=>{const{t:i}=w("contract"),n=U(),{crootId:s,unitId:o}=M(),[u]=z(),c=Number(s),r=R(u),l=r?`?version=${r}`:"",{data:g}=Q({crootId:c,contractId:r},{skip:!c}),{data:_}=O({crootId:c,contractId:r},{skip:!c}),d=Number(o)||(_?.items[0]?.unit_id??0),{isLoading:j}=B({crootId:c,unitId:d,contractId:r},{skip:!c||!d}),h=[{title:i("techSpec.unitId"),dataIndex:"unit_id",width:90},{title:i("techSpec.planPoint"),dataIndex:"pln_point_rootrecord_id",width:110},{title:i("techSpec.unitName"),dataIndex:"point_name_ru",render:(p,C)=>p??C.name??"â"}];return e.jsxs("div",{className:"p-4",children:[e.jsxs("div",{className:"mb-4 flex flex-wrap items-center justify-between gap-2",children:[e.jsxs(k,{level:4,className:"!mb-0",children:[i("techSpec.contractNumber")," ",g?.contract_number_sys??c,g?.tech_spec_title?` â ${g.tech_spec_title}`:""]}),e.jsx(b,{icon:e.jsx(ce,{}),onClick:()=>n(`/cabinet/contracts/${c}`),children:i("techSpec.backToContract")})]}),e.jsxs("div",{className:"grid gap-4 lg:grid-cols-[320px_minmax(0,1fr)]",children:[e.jsx(D,{size:"small",title:i("techSpec.unitsTitle"),children:e.jsx(y,{rowKey:"unit_id",size:"small",columns:h,dataSource:_?.items??[],pagination:!1,rowClassName:p=>p.unit_id===d?"bg-sky-50":"cursor-pointer",onRow:p=>({onClick:()=>n(`/cabinet/contracts/${c}/units/${p.unit_id}/tech-spec${l}`)}),locale:{emptyText:i("card.tabNoData")}})}),e.jsx(D,{size:"small",title:i("techSpec.documentsTitle"),children:j?e.jsx("div",{className:"flex h-64 items-center justify-center",children:e.jsx(G,{})}):e.jsxs(e.Fragment,{children:[e.jsx(ue,{crootId:c,unitId:d}),e.jsx(fe,{crootId:c,unitId:d})]})})]})]})};export{tt as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.