(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6534],{5240:function(e,s,l){Promise.resolve().then(l.bind(l,5265))},5265:function(e,s,l){"use strict";l.r(s),l.d(s,{default:function(){return r}});var a=l(57437),t=l(2265);function r(){let[e,s]=(0,t.useState)(null),[l,r]=(0,t.useState)(null),[n,i]=(0,t.useState)(!1),c=async()=>{if(e){i(!0);try{let s=new FormData;s.append("file",e);let l=await fetch("/api/test-upload",{method:"POST",body:s}),a=await l.json();r(a),a.success?alert("File uploaded successfully! Check the result below."):alert("Upload failed: "+a.error)}catch(e){console.error("Upload error:",e),alert("Upload failed")}finally{i(!1)}}};return(0,a.jsx)("div",{className:"min-h-screen bg-gradient-bg-light p-8",children:(0,a.jsxs)("div",{className:"max-w-2xl mx-auto",children:[(0,a.jsx)("h1",{className:"text-3xl font-bold mb-8 text-center",children:"File Upload Test"}),(0,a.jsxs)("div",{className:"card-primary mb-8",children:[(0,a.jsx)("h2",{className:"text-xl font-semibold mb-4",children:"Upload Agreement Document"}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-sm font-medium mb-2",children:"Select File"}),(0,a.jsx)("input",{type:"file",onChange:e=>{var l;let a=null===(l=e.target.files)||void 0===l?void 0:l[0];a&&s(a)},accept:".pdf,.doc,.docx,.txt",className:"w-full p-2 border border-gray-300 rounded-lg"})]}),e&&(0,a.jsxs)("div",{className:"text-sm text-gray-600",children:["Selected: ",e.name," (",(e.size/1024).toFixed(1)," KB)"]}),(0,a.jsx)("button",{onClick:c,disabled:!e||n,className:"btn-primary disabled:opacity-50 disabled:cursor-not-allowed",children:n?"Uploading...":"Upload File"})]})]}),l&&(0,a.jsxs)("div",{className:"card-primary",children:[(0,a.jsx)("h2",{className:"text-xl font-semibold mb-4",children:"Upload Result"}),(0,a.jsx)("pre",{className:"bg-gray-100 p-4 rounded-lg text-sm overflow-auto",children:JSON.stringify(l,null,2)}),l.success&&l.file&&(0,a.jsxs)("div",{className:"mt-4",children:[(0,a.jsx)("p",{className:"text-green-600 font-medium mb-2",children:"✅ File uploaded successfully!"}),(0,a.jsxs)("p",{className:"text-sm text-gray-600 mb-2",children:["File URL: ",l.file.url]}),(0,a.jsx)("a",{href:l.file.url,target:"_blank",rel:"noopener noreferrer",className:"btn-secondary text-sm",children:"View Uploaded File"})]})]}),(0,a.jsxs)("div",{className:"card-primary mt-8",children:[(0,a.jsx)("h2",{className:"text-xl font-semibold mb-4",children:"Test Existing Agreement Documents"}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("a",{href:"/uploads/agreements/sample-john-smith-agreement.txt",target:"_blank",rel:"noopener noreferrer",className:"block btn-secondary text-sm",children:"View John Smith's Agreement"}),(0,a.jsx)("a",{href:"/uploads/agreements/sample-sarah-johnson-agreement.txt",target:"_blank",rel:"noopener noreferrer",className:"block btn-secondary text-sm",children:"View Sarah Johnson's Agreement"})]})]})]})})}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=5240)}),_N_E=e.O()}]);