1import{h as F,r,e as D,p as _,j as s,b6 as k,cg as M,q as N,bQ as E,O as y,M as z,c3 as L,z as R,c4 as q}from"./index-BPR3l8qa.js";function T({contractId:n,label:i,value:c,onChange:d}){const[j,u]=F(),[e,p]=r.useState(null),[S,f]=r.useState(!1),[b,m]=r.useState(!1),[g,x]=r.useState(""),[a,v]=r.useState(),[t,h]=r.useState({});r.useEffect(()=>{h(c||{})},[c]),r.useEffect(()=>{f(!0),D("/signup_contract/"+n).then(o=>{p(o.contract),f(!1)})},[n]);const w=r.useCallback(o=>{o&&(o.preventDefault(),o.stopPropagation()),m(!0),x(""),_("/signup_contract/"+n,{customData:t,signature:a,fileName:i||(e==null?void 0:e.title)}).then(l=>{m(!1),l.error?x(l.error):(u(),d({target:{value:{...t,...l}}}))})},[a,t,d]),C=r.useMemo(()=>{if(e&&t&&e.custom_fields){for(let{isRequired:o,id:l}of e.custom_fields)if(o&&!t[l])return!1;return!0}else return!!a},[a,e,t]);return S?s.jsx(k,{height:48.5}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"list-group mt-1",children:s.jsxs("button",{onClick:u,type:"button",className:"d-flex align-items-center justify-content-between list-group-item list-group-item-action",children:[i||(e==null?void 0:e.title)||"Contract not found",t.url?s.jsx("span",{className:"text-success",children:s.jsx(M,{})}):null]})}),e&&e.url?s.jsxs(N,{confirmLoading:b,title:i||(e==null?void 0:e.title),okText:"Submit",disabled:!C,onSubmit:t.url?null:w,visible:j,size:"lg",onClose:u,children:[s.jsx("div",{style:{height:400,overflowY:"scroll",overflowX:"hidden"},className:"p-3 mb-4 border rounded shadow-sm",children:s.jsx(E,{source:e.url,customObject:t,formFields:e.custom_fields})}),s.jsx("hr",{}),t.url?s.jsxs("a",{href:t.url,download:"Download.pdf",children:[s.jsx(y,{})," ",s.jsx(z,{id:"Download"})]}):e.custom_fields?s.jsx(L,{onChange:h,value:t,formFields:e.custom_fields}):s.jsx(R,{label:"Signature",children:s.jsx(q,{value:a,onChange:({target:o})=>v(o.value)})}),g?s.jsx("div",{className:"alert alert-danger mt-3",children:g}):null]}):null]})}export{T as default}; 2//# sourceMappingURL=ContractInput-BucAOzvy.js.map
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.