PageSourceSearch

https://crgdirect.co.uk/_app/immutable/nodes/73.DCgEtyo4.js

js crgdirect.co.uk collected 2026-10-06 12:25:33 UTC 12,264 bytes, 2 lines download raw bytes

1import{At as r,B as Ve,Ct as Ke,D as pe,G as Qe,I as y,K as We,N as J,O as Ye,R as p,St as He,T as me,V as g,X as o,_ as ie,_t as qe,dt as m,ft as e,g as Xe,ht as B,it as f,kt as fe,lt as s,q as G,rt as Je,st as Ze,ut as $e,y as et,yt as ne,z as v}from"../chunks/ud6d9L-9.js";import{p as de}from"../chunks/CXsZ0DkC.js";import"../chunks/DwdwGuwu.js";import{t as tt}from"../chunks/BHtqvhHp.js";import{t as xe}from"../chunks/CNuYd6Kr.js";var rt=g('<div class="p-4 bg-green-50 border border-green-200 rounded-lg text-green-700 text-sm"> </div>'),at=g('<div class="p-4 bg-red-50 border border-red-200 rounded-lg text-red-700 text-sm"> </div>'),ot=g('<li class="flex items-center gap-2 text-sm text-amber-700"><span class="w-1.5 h-1.5 rounded-full bg-amber-500 shrink-0"></span> <span class="text-amber-600"> </span></li>'),st=g('<div class="bg-amber-50 border border-amber-200 rounded-lg p-4"><h3 class="text-sm font-semibold text-amber-800 mb-2"> </h3> <ul class="space-y-1"></ul></div>'),it=g("<option> </option>"),nt=g('<optgroup label="Required Documents"></optgroup>'),dt=g('<div class="p-8 text-center"><p class="text-gray-500">No documents uploaded yet.</p></div>'),lt=g('<p class="text-xs text-blue-600 mt-1"> </p>'),vt=g('<span class="px-1.5 py-0.5 text-[10px] bg-blue-50 text-blue-700 rounded"> </span>'),ct=g('<div class="flex flex-wrap gap-1 mt-1.5"></div>'),ut=g('<a class="px-3 py-1.5 text-sm font-medium text-green-700 bg-green-50 rounded-lg hover:bg-green-100 transition-colors shrink-0">View</a>'),gt=g('<div class="px-6 py-4"><div class="flex items-start justify-between gap-4"><div class="min-w-0 flex-1"><div class="flex items-center gap-2 flex-wrap"><p class="text-sm font-medium text-gray-900"> </p> <span> </span> <span class="px-2 py-0.5 text-xs font-medium rounded-full bg-gray-100 text-gray-700"> </span></div> <p class="text-xs text-gray-500 mt-1"> </p> <!> <!></div> <!></div></div>'),Te=g('<div class="divide-y divide-gray-100"></div>'),pt=g('<div class="space-y-6"><!> <!> <!> <div class="bg-white rounded-lg border border-gray-200 p-6"><h2 class="text-lg font-semibold text-gray-900 mb-4">Upload Document</h2> <form method="POST" action="?/upload" enctype="multipart/form-data"><div class="mb-4"><label for="category" class="block text-sm font-medium text-gray-700 mb-1">Document Type</label> <select id="category" name="category" class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:ring-2 focus:ring-green-500 focus:border-green-500"><!><optgroup label="Other Documents"><option>Insurance</option> <option>Certification</option> <option>License</option> <option>Tax Document</option> <option>Safety Certificate</option> <option>Qualification</option> <option>Other (AI will categorize)</option></optgroup></select></div> <div role="group" aria-label="File drop area"><p class="text-gray-600 mb-2 text-sm">Drag and drop or</p> <label for="file-input" class="inline-flex items-center px-4 py-2 bg-green-700 text-white text-sm font-medium rounded-lg hover:bg-green-800 transition-colors cursor-pointer">Choose File</label> <input id="file-input" type="file" name="file" class="sr-only" accept=".pdf,.jpg,.jpeg,.png,.webp,.doc,.docx,.xls,.xlsx,.txt"/> <p class="text-xs text-gray-400 mt-2">PDF, images, Word, Excel. Max 25MB.</p></div> <button type="submit" class="mt-3 w-full px-4 py-2.5 bg-green-700 text-white text-sm font-semibold rounded-lg hover:bg-green-800 disabled:opacity-50 transition-colors"> </button></form></div> <div class="bg-white rounded-lg border border-gray-200"><div class="px-6 py-4 border-b border-gray-200"><h2 class="text-lg font-semibold text-gray-900"> </h2></div> <!></div></div>'),mt=g('<div class="p-4 bg-green-50 border border-green-200 rounded-lg text-green-700"> </div>'),ft=g('<div class="p-4 bg-red-50 border border-red-200 rounded-lg text-red-700"> </div>'),xt=g('<div class="p-8 text-center"><p class="text-gray-500">No documents yet. Upload your first file above.</p></div>'),_t=g('<div class="px-6 py-4 flex items-center justify-between gap-4"><div class="min-w-0 flex-1"><p class="text-sm font-medium text-gray-900 truncate"> </p> <p class="text-xs text-gray-500 mt-0.5"> </p></div> <div class="flex items-center gap-2 shrink-0"><a class="px-3 py-1.5 text-sm font-medium text-green-700 bg-green-50 rounded-lg hover:bg-green-100 transition-colors">Download</a> <form method="POST" action="?/delete"><input type="hidden" name="fullPath"/> <button type="submit" class="px-3 py-1.5 text-sm font-medium text-red-600 bg-red-50 rounded-lg hover:bg-red-100 transition-colors">Delete</button></form></div></div>'),bt=g('<div class="p-6 sm:p-8 bg-gray-50 min-h-screen">
1<div class="max-w-5xl mx-auto space-y-6"><div><a class="text-sm text-gray-500 hover:text-gray-700 transition-colors inline-flex items-center gap-1 mb-3"><svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7"></path></svg> Back to Dashboard</a> <h1 class="text-2xl sm:text-3xl font-bold text-gray-900">My Documents</h1> <p class="text-gray-600 mt-1">Upload and manage your files.</p></div> <!> <!> <div class="bg-white rounded-lg border border-gray-200 p-6"><div class="flex items-center justify-between"><div><h2 class="text-lg font-semibold text-gray-900">Compliance Documents</h2> <p class="text-sm text-gray-600 mt-1">Review and acknowledge required company documents</p></div> <a class="px-4 py-2 bg-green-700 text-white text-sm font-medium rounded-lg hover:bg-green-800 transition-colors">View Documents</a></div></div> <div class="bg-white rounded-lg border border-gray-200 p-6"><h2 class="text-lg font-semibold text-gray-900 mb-4">Upload a File</h2> <form method="POST" action="?/upload" enctype="multipart/form-data"><div role="group" aria-label="File drop area"><p class="text-gray-600 mb-2">Drag and drop your file here, or</p> <label for="file-input-customer" class="inline-flex items-center px-4 py-2 bg-green-700 text-white text-sm font-medium rounded-lg hover:bg-green-800 transition-colors cursor-pointer">Choose File</label> <input id="file-input-customer" type="file" name="file" class="sr-only" accept=".pdf,.jpg,.jpeg,.png,.webp,.doc,.docx,.xls,.xlsx,.txt"/> <p class="text-xs text-gray-400 mt-3">PDF, images, Word, Excel, or text files. Max 25MB.</p></div></form></div> <div class="bg-white rounded-lg border border-gray-200"><div class="px-6 py-4 border-b border-gray-200"><h2 class="text-lg font-semibold text-gray-900">Your Files</h2></div> <!></div></div></div>');function Tt(Me,d){Ke(d,!0);let P=qe(!1),S=qe(!1);const Be=ne(()=>new Set(d.data.subcontractorDocs.map(n=>n.category))),le=ne(()=>(d.data.requiredDocTypes??[]).filter(n=>!o(Be).has(n.type)));function _e(n){if(n===0)return"0 B";const x=["B","KB","MB","GB"],_=Math.min(Math.floor(Math.log(n)/Math.log(1024)),x.length-1),j=x[_]??"B";return`${(n/Math.pow(1024,_)).toFixed(_===0?0:1)} ${j}`}function Ce(n){switch(n){case"approved":return"bg-green-100 text-green-800";case"rejected":return"bg-red-100 text-red-800";case"expired":return"bg-orange-100 text-orange-800";default:return"bg-yellow-100 text-yellow-800"}}function ke(n){return{insurance:"Insurance",certification:"Certification",license:"License",tax_document:"Tax Document",safety_certificate:"Safety Certificate",qualification:"Qualification",other:"Other"}[n]??n}function be(n){B(S,!1);const x=tt(document,"file-input",HTMLInputElement),_=n.dataTransfer?.files;x!=null&&_!=null&&_.length>0&&(x.files=_)}var he=Ve();Ye("jayyye",n=>{Je(()=>{Ze.title="Documents | CRG Direct"})});var Se=$e(he),je=n=>{var x=pt(),_=s(x),j=t=>{var i=rt(),c=m(i,!0);f(()=>p(c,d.form.message)),v(t,i)};y(_,t=>{d.form?.success===!0&&d.form.message&&t(j)});var Z=e(_,2),$=t=>{var i=at(),c=m(i,!0);f(()=>p(c,d.form.error)),v(t,i)};y(Z,t=>{d.form?.error&&t($)});var ee=e(Z,2),te=t=>{var i=st(),c=s(i),u=m(c),D=e(c,2);J(D,21,()=>o(le),k=>k.type,(k,q)=>{var z=ot(),L=e(s(z)),H=e(L),se=m(H,!0);r(z),f(()=>{p(L,` ${o(q).name??""}: `),p(se,o(q).description)}),v(k,z)}),r(D),r(i),f(()=>p(u,`Missing Required Documents (${o(le).length??""})`)),v(t,i)};y(ee,t=>{o(le).length>0&&t(te)});var A=e(ee,2),F=e(s(A),2),I=s(F),re=e(s(I),2),O=s(re),E=t=>{var i=nt();J(i,21,()=>d.data.requiredDocTypes??[],c=>c.type,(c,u)=>{var D=it(),k=m(D,!0),q={};f(()=>{p(k,o(u).name),q!==(q=o(u).type)&&(D.value=(D.__value=q)??"")}),v(c,D)}),r(i),v(t,i)};y(O,t=>{(d.data.requiredDocTypes??[]).length>0&&t(E)});var T=e(O),V=s(T);V.value=V.__value="insurance";var U=e(V,2);U.value=U.__value="certification";var K=e(U,2);K.value=K.__value="license";var Q=e(K,2);Q.value=Q.__value="tax_document";var W=e(Q,2);W.value=W.__value="safety_certificate";var a=e(W,2);a.value=a.__value="qualification";var l=e(a,2);l.value=l.__value="other",r(T),r(re),r(I);var b=e(I,2),C=e(b,2),Y=m(C,!0);r(F),pe(F,(t,i)=>xe?.(t,i),()=>()=>(B(P,!0),async({update:t})=>{B(P,!1),await t()})),r(A);var N=e(A,2),R=s(N),ve=s(R),ce=m(ve);r(R);var ue=e(R,2),ae=t=>{var i=dt();v(t,i)},oe=t=>
1{var i=Te();J(i,21,()=>d.data.subcontractorDocs,c=>c.id,(c,u)=>{const D=ne(()=>o(u).aiNotes??""),k=ne(()=>o(u).aiClassification?.tags??[]);var q=gt(),z=s(q),L=s(z),H=s(L),se=s(H),Pe=m(se,!0),ge=e(se,2),Ie=m(ge,!0),Oe=e(ge,2),Ue=m(Oe,!0);r(H);var ye=e(H,2),Ne=m(ye),we=e(ye,2),Re=h=>{var w=lt(),M=m(w,!0);f(X=>p(M,X),[()=>o(D).split(`
2`)[0]]),v(h,w)};y(we,h=>{o(D)!==""&&h(Re)});var ze=e(we,2),Le=h=>{var w=ct();J(w,20,()=>o(k).slice(0,5),M=>M,(M,X)=>{var De=vt(),Ee=m(De,!0);f(()=>p(Ee,X)),v(M,De)}),r(w),v(h,w)};y(ze,h=>{o(k).length>0&&h(Le)}),r(L);var Ge=e(L,2),Ae=h=>{var w=ut();f(M=>ie(w,"href",M),[()=>de(`/dashboard/documents/${o(u).id}/view`)]),v(h,w)};y(Ge,h=>{o(u).fileUrl!==""&&h(Ae)}),r(z),r(q),f((h,w,M,X)=>{p(Pe,o(u).fileName),me(ge,1,`px-2 py-0.5 text-xs font-medium rounded-full ${h??""}`),p(Ie,o(u).status),p(Ue,w),p(Ne,`${M??""} · ${X??""}`)},[()=>Ce(o(u).status),()=>ke(o(u).category),()=>_e(o(u).fileSize),()=>new Date(o(u).uploadedAt).toLocaleDateString("en-GB")]),v(c,q)}),r(i),v(t,i)};y(ue,t=>{d.data.subcontractorDocs.length===0?t(ae):t(oe,-1)}),r(N),r(x),f(()=>{me(b,1,`focus-within:ring-2 focus-within:ring-green-600 border-2 border-dashed rounded-lg p-6 text-center transition-colors ${o(S)?"border-green-400 bg-green-50":"border-gray-300 hover:border-gray-400"}`),C.disabled=o(P),p(Y,o(P)?"Uploading...":"Upload Document"),p(ce,`Your Documents (${d.data.subcontractorDocs.length??""})`)}),G("dragover",b,t=>{t.preventDefault(),B(S,!0)}),G("dragleave",b,()=>{B(S,!1)}),G("drop",b,t=>{t.preventDefault(),be(t)}),v(n,x)},Fe=n=>{var x=bt(),_=s(x),j=s(_),Z=s(j);fe(4),r(j);var $=e(j,2),ee=a=>{var l=mt(),b=m(l,!0);f(()=>p(b,d.form.message)),v(a,l)};y($,a=>{d.form?.success===!0&&d.form.message&&a(ee)});var te=e($,2),A=a=>{var l=ft(),b=m(l,!0);f(()=>p(b,d.form.error)),v(a,l)};y(te,a=>{d.form?.error&&a(A)});var F=e(te,2),I=s(F),re=e(s(I),2);r(I),r(F);var O=e(F,2),E=e(s(O),2),T=s(E),V=e(s(T),4);fe(2),r(T),r(E),pe(E,(a,l)=>xe?.(a,l),()=>()=>(B(P,!0),async({update:a})=>{B(P,!1),await a()})),r(O);var U=e(O,2),K=e(s(U),2),Q=a=>{var l=xt();v(a,l)},W=a=>{var l=Te();J(l,21,()=>d.data.files,b=>b.fullPath,(b,C)=>{var Y=_t(),N=s(Y),R=s(N),ve=m(R,!0),ce=e(R,2),ue=m(ce);r(N);var ae=e(N,2),oe=s(ae),t=e(oe,2),i=s(t);Xe(i),fe(2),r(t),pe(t,(c,u)=>xe?.(c,u),()=>()=>async({update:c})=>{await c()}),r(ae),r(Y),f((c,u)=>{p(ve,o(C).name),p(ue,`${c??""} · ${o(C).uploaded??""}`),ie(oe,"href",u),et(i,o(C).fullPath)},[()=>_e(o(C).size),()=>de(`/dashboard/documents/download?path=${encodeURIComponent(o(C).fullPath)}`)]),v(b,Y)}),r(l),v(a,l)};y(K,a=>{d.data.files.length===0?a(Q):a(W,-1)}),r(U),r(_),r(x),f((a,l)=>{ie(Z,"href",a),ie(re,"href",l),me(T,1,`focus-within:ring-2 focus-within:ring-green-600 border-2 border-dashed rounded-lg p-8 text-center transition-colors ${o(S)?"border-green-400 bg-green-50":"border-gray-300 hover:border-gray-400"}`)},[()=>de("/dashboard"),()=>de("/dashboard/documents/compliance")]),G("dragover",T,a=>{a.preventDefault(),B(S,!0)}),G("dragleave",T,()=>{B(S,!1)}),G("drop",T,a=>{a.preventDefault(),be(a)}),We("change",V,a=>{const l=a.currentTarget;(l.files?.length??0)>0&&l.form?.requestSubmit()}),v(n,x)};y(Se,n=>{d.data.isSubcontractor?n(je):n(Fe,-1)}),v(Me,he),He()}Qe(["change"]);export{Tt as component};

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.