1import{a as l,j as e}from"./vendor-react-Cum0FC2W.js";import{g as f}from"./index-Bf2Wepnp.js";import{A as E,a as R}from"./AdminLayout-Cx6ZmnCy.js";import"./vendor-router-CEKOzTBV.js";import"./vendor-query-Dy13JxaA.js";import"./vendor-radix-BB5WCbyI.js";import"./vendor-recharts-CJe0gtjG.js";import"./vendor-icons-HGMSwUWj.js";const U={delivered:"bg-emerald-100 text-emerald-700",failed:"bg-red-100 text-red-700",pending:"bg-amber-100 text-amber-700",processing:"bg-blue-100 text-blue-700",not_configured:"bg-slate-100 text-slate-500"};function b({status:s}){const r=s==="not_configured"?"Not configured":s[0].toUpperCase()+s.slice(1);return e.jsx("span",{className:`inline-flex px-2 py-0.5 rounded-full text-[11px] font-semibold ${U[s]}`,children:r})}function n({label:s,children:r}){return e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold text-slate-500 uppercase tracking-wider mb-1",children:s}),e.jsx("div",{className:"text-sm text-slate-700 break-words",children:r||e.jsx("span",{className:"text-slate-400",children:"Not provided"})})]})}function C({application:s,onClose:r}){const[i,h]=l.useState(!1),[o,d]=l.useState("");async function u(){const c=window.open("","_blank","noopener,noreferrer");h(!0),d("");try{const m=await f.adminGetApplicationResumeUrl(s.id);c?c.location.href=m.url:window.location.href=m.url}catch(m){c?.close(),d(m instanceof Error?m.message:"Unable to open résumé")}finally{h(!1)}}const x=new Date(s.submittedAt);return e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 px-4 py-8",children:e.jsxs("div",{className:"bg-white rounded-2xl shadow-xl w-full max-w-3xl max-h-full overflow-y-auto",children:[e.jsxs("div",{className:"flex items-start justify-between p-6 border-b border-slate-100",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"font-bold text-slate-900 text-lg",children:s.fullName}),e.jsx("p",{className:"text-slate-500 text-sm mt-0.5",children:s.position})]}),e.jsx("button",{onClick:r,className:"text-slate-400 hover:text-slate-600 text-xl leading-none ml-4",children:"Ã"})]}),e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-5",children:[e.jsx(n,{label:"Email",children:e.jsx("a",{href:`mailto:${s.email}`,className:"text-blue-600 hover:underline",children:s.email})}),e.jsx(n,{label:"Phone",children:s.phone}),e.jsx(n,{label:"Location",children:s.location}),e.jsxs(n,{label:"Submitted",children:[x.toLocaleDateString("en-US",{month:"long",day:"numeric",year:"numeric"})," at ",x.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit"})]}),e.jsx(n,{label:"LinkedIn",children:s.linkedinUrl&&e.jsx("a",{href:s.linkedinUrl,target:"_blank",rel:"noreferrer",className:"text-blue-600 hover:underline",children:s.linkedinUrl})}),e.jsx(n,{label:"Portfolio",children:s.portfolioUrl&&e.jsx("a",{href:s.portfolioUrl,target:"_blank",rel:"noreferrer",className:"text-blue-600 hover:underline",children:s.portfolioUrl})}),e.jsx(n,{label:"Referral source",children:s.referralSource}),e.jsx(n,{label:"Role slug",children:s.positionSlug})]}),e.jsx(n,{label:"Cover note",children:e.jsx("div",{className:"bg-slate-50 rounded-xl p-4 whitespace-pre-wrap border border-slate-100 leading-relaxed",children:s.coverNote})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold text-slate-500 uppercase tracking-wider mb-2",children:"Résumé"}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3 bg-slate-50 rounded-xl border border-slate-100 p-4",children:[e.jsxs("div",{className:"flex-1 min-w-[220px]",children:[e.jsx("p",{className:"text-sm font-medium text-slate-800",children:s.resumeOriginalName}),e.jsxs("p",{className:"text-xs text-slate-500 mt-0.5",children:[Math.ceil(s.resumeSizeBytes/1024)," KB"]})]}),e.jsx("button",{type:"button",onClick:u,disabled:i,className:"bg-blue-600 hover:bg-blue-700 disabled:opacity-60 text-white text-sm font-semibold px-4 py-2 rounded-lg transition-colors",children:i?"Openingâ¦":"Open résumé"})]}),o&&e.jsx("p",{className:"text-xs text-red-600 mt-2",children:o})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold text-slate-500 uppercase tracking-wider mb-2",children:"Delivery status"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[e.jsxs("div",{className:"border border-slate-200 rounded-xl p-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("span",{className:"text-sm font-semibold text-slate-800",children:"Zapier webhook"}),e.jsx(b,{status:s.webhookStatus})]}),s.webhookLastError&&e.jsx("p",{className:"text-xs text-red-600 mt-2",children:s.webhookLastError}),s.webhookAttempts>0&&e.jsxs("p",{className:"text-xs text-slate-400 mt-2",children:[s.webhookAttempts," delivery attempt",s.webhookAttempts===1?"":"s"]})]}),e.jsxs("div",{className:"border border-slate-200 rounded-xl p-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("span",{className:"text-sm font-semibold text-slate-800",children:"Email"}),e.jsx(b,{status:s.emailStatus})]}),s.emailLastError&&e.jsx("p",{className:"text-xs text-red-600 mt-2",children:s.emailLastError}),s.emailAttempts>0&&e.jsxs("p",{className:"text-xs text-slate-400 mt-2",children:[s.emailAttempts," delivery attempt",s.emailAttempts===1?"":"s"]})]})]})]})]}),e.jsxs("div",{className:"p-6 border-t border-slate-100 flex justify-between items-center",children:[e.jsx("a",{href:`mailto:${s.email}?subject=Re: Your application for ${encodeURIComponent(s.position)}`,className:"bg-blue-600 hover:bg-blue-700 text-white text-sm font-semibold px-4 py-2 rounded-lg transition-colors",children:"Reply via email"}),e.jsx("button",{onClick:r,className:"text-sm text-slate-500 hover:text-slate-700",children:"Close"})]})]})})}function M(){const[s,r]=l.useState([]),[i,h]=l.useState(!0),[o,d]=l.useState(""),[u,x]=l.useState(null),[c,m]=l.useState("all"),[p,g]=l.useState(null);async function N(){h(!0),d("");try{const t=await f.adminGetApplications();r(t.applications)}catch(t){d(t instanceof Error?t.message:"Unable to load applications")}finally{h(!1)}}l.useEffect(()=>{N()},[]);async function w(t){g(t.id),d("");try{const a=await f.adminRetryApplication(t.id);r(A=>A.map(v=>v.id===a.application.id?a.application:v)),u?.id===a.application.id&&x(a.application)}catch(a){d(a instanceof Error?a.message:"Unable to retry delivery")}finally{g(null)}}const S=t=>t.webhookStatus!=="delivered"||!["delivered","not_configured"].includes(t.emailStatus),y=l.useMemo(()=>Array.from(new Set(s.map(t=>t.position))).sort(),[s]),j=c==="all"?s:s.filter(t=>t.position===c),k=t=>new Date(t).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return e.jsxs(E,{children:[e.jsx(R,{title:`Career Applications${i?"":` (${s.length})`}`}),e.jsxs("div",{className:"p-8",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4 mb-6",children:[e.jsx("p",{className:"text-sm text-slate-500",children:"All career form submissions are stored here before delivery to Zapier or email."}),y.length>1&&e.jsxs("select",{value:c,onChange:t=>m(t.target.value),className:"border border-slate-200 rounded-lg px-3 py-2 text-sm text-slate-700 bg-white",children:[e.jsx("option",{value:"all",children:"All roles"}),y.map(t=>e.jsx("option",{value:t,children:t},t))]})]}),i&&e.jsx("p",{className:"text-slate-500 text-sm",children:"Loading applicationsâ¦"}),!i&&o&&e.jsxs("div",{className:"rounded-xl border border-red-200 bg-red-50 p-5",children:[e.jsx("p",{className:"text-sm text-red-700",children:o}),e.jsx("button",{onClick:()=>{N()},className:"text-sm font-semibold text-red-700 underline mt-2",children:"Try again"})]}),!i&&!o&&j.length===0&&e.jsxs("div",{className:"text-center py-16 text-slate-400",children:[e.jsx("p",{className:"text-4xl mb-3",children:"ð¼"}),e.jsx("p",{className:"font-medium",children:"No career applications yet"}),e.jsx("p",{className:"text-sm mt-1",children:"Future career form submissions will appear here."})]}),!i&&!o&&j.length>0&&e.jsx("div",{className:"bg-white rounded-xl border border-slate-200 overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm min-w-[860px]",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-slate-100 bg-slate-50",children:[e.jsx("th",{className:"text-left px-6 py-3 font-semibold text-slate-600",children:"Applicant"}),e.jsx("th",{className:"text-left px-4 py-3 font-semibold text-slate-600",children:"Role"}),e.jsx("th",{className:"text-left px-4 py-3 font-semibold text-slate-600",children:"Submitted"}),e.jsx("th",{className:"text-left px-4 py-3 font-semibold text-slate-600",children:"Zapier"}),e.jsx("th",{className:"text-left px-4 py-3 font-semibold text-slate-600",children:"Email"}),e.jsx("th",{className:"px-4 py-3"})]})}),e.jsx("tbody",{className:"divide-y divide-slate-100",children:j.map(t=>e.jsxs("tr",{className:"hover:bg-slate-50 transition-colors cursor-pointer",onClick:()=>x(t),children:[e.jsxs("td",{className:"px-6 py-4",children:[e.jsx("p",{className:"font-medium text-slate-900",children:t.fullName}),e.jsx("p",{className:"text-xs text-slate-400 mt-0.5",children:t.email})]}),e.jsx("td",{className:"px-4 py-4 text-slate-600 max-w-[260px]",children:t.position}),e.jsx("td",{className:"px-4 py-4 text-slate-500 text-xs whitespace-nowrap",children:k(t.submittedAt)}),e.jsx("td",{className:"px-4 py-4",children:e.jsx(b,{status:t.webhookStatus})}),e.jsx("td",{className:"px-4 py-4",children:e.jsx(b,{status:t.emailStatus})}),e.jsx("td",{className:"px-4 py-4 text-right",onClick:a=>a.stopPropagation(),children:e.jsxs("div",{className:"flex justify-end gap-3",children:[e.jsx("button",{onClick:()=>x(t),className:"text-blue-600 text-xs hover:text-blue-800 font-medium",children:"View"}),S(t)&&e.jsx("button",{onClick:()=>{w(t)},disabled:p===t.id,className:"text-amber-600 text-xs hover:text-amber-800 font-medium disabled:opacity-50",children:p===t.id?"Retryingâ¦":"Retry"})]})})]},t.id))})]})})]}),u&&e.jsx(C,{application:u,onClose:()=>x(null)})]})}export{M as ApplicationsList};
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.