1import{r as m,j as e,L as w}from"./vendor-react-BOaImszz.js";import{u as _,b as S,a as k}from"./vendor-query-Dkmn6_NE.js";import{a as b,I as C,s as y}from"./index-BwoIzMQ7.js";import{aM as q,a6 as L,ar as A,az as R,aJ as E,aK as I,j as v,b1 as $,O as B,ax as D}from"./vendor-icons-BOzMA5KD.js";import{A as M,m as O}from"./vendor-framer-DvbsvzBN.js";import"./vendor-radix-DLV9a04e.js";import"./vendor-supabase-FNdQBYSB.js";const h=[{value:"pending",label:"Pending",tone:"bg-amber-100 text-amber-800 border-amber-200"},{value:"reviewed",label:"Reviewed",tone:"bg-brand-inclusiveBlue/20 text-brand-collaborationBlue border-brand-inclusiveBlue/30"},{value:"invited",label:"Invited",tone:"bg-purple-100 text-purple-800 border-purple-200"},{value:"placed",label:"Placed",tone:"bg-green-100 text-green-800 border-green-200"},{value:"rejected",label:"Rejected",tone:"bg-gray-100 text-gray-700 border-gray-200"}],P={high_school:"High school",college_undergrad:"College (undergrad)",college_grad:"College (graduate)",other:"Other"},F={academic_credit:"Academic credit",work_based_learning:"Work-based learning",none:"No formal requirement",other:"Other"};function N(s){return s?new Date(s).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):""}function Q({value:s}){var o,r;const n=((o=h.find(l=>l.value===s))==null?void 0:o.tone)||"bg-gray-100 text-gray-700 border-gray-200",i=((r=h.find(l=>l.value===s))==null?void 0:r.label)||s;return e.jsx("span",{className:`inline-flex items-center px-2.5 py-1 rounded-full text-xs font-semibold border ${n}`,children:i})}function K({app:s}){const[n,i]=m.useState(!1),[o,r]=m.useState(s.notes||""),[l,u]=m.useState(!1),d=S(),x=k({mutationFn:async t=>{const{error:a}=await y.from("internship_applications").update({status:t,reviewed_at:t!=="pending"?new Date().toISOString():null}).eq("id",s.id);if(a)throw a},onSuccess:()=>d.invalidateQueries({queryKey:["internship_applications"]})});async function g(){u(!0);const{error:t}=await y.from("internship_applications").update({notes:o.trim()||null}).eq("id",s.id);u(!1),t||d.invalidateQueries({queryKey:["internship_applications"]})}return e.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl overflow-hidden",children:[e.jsxs("button",{type:"button",onClick:()=>i(t=>!t),className:"w-full flex items-center justify-between gap-4 p-4 md:p-5 hover:bg-gray-50 transition-colors text-left",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[n?e.jsx(E,{className:"w-5 h-5 text-gray-400 shrink-0"}):e.jsx(I,{className:"w-5 h-5 text-gray-400 shrink-0"}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("p",{className:"font-bold text-gray-900 text-base truncate",children:[s.first_name," ",s.last_name]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-gray-500 mt-0.5",children:[e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(v,{className:"w-3 h-3"})," ",s.email]}),s.school_name&&e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx($,{className:"w-3 h-3"})," ",s.school_name]}),s.education_level&&e.jsx("span",{children:P[s.education_level]||s.education_level})]})]})]}),e.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[e.jsx("span",{className:"text-xs text-gray-500 hidden sm:inline",children:N(s.created_at)}),e.jsx(Q,{value:s.status})]})]}),e.jsx(M,{children:n&&e.jsx(O.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"border-t border-gray-100 overflow-hidden",children:e.jsxs("div",{className:"p-4 md:p-6 bg-gray-50",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-x-8 gap-y-3 text-sm mb-5",children:[s.phone&&e.jsxs("div",{children:[e.jsx("span",{className:"font-semibold text-gray-600",children:"Phone:"})," ",e.jsx("span",{className:"text-gray-900",children:s.phone})]}),s.graduation_year&&e.jsxs("div",{children:[e.jsx("span",{className:"font-semibold text-gray-600",children:"Graduation year:"})," ",e.jsx("span",{className:"text-gray-900",children:s.graduation_year})]}),s.start_date_preference&&e.jsxs("div",{children:[e.jsx("span",{className:"font-semibold text-gray-600",children:"Preferred start:"})," ",e.jsx("span",{className:"text-gray-900",children:s.start_date_preference})]}),s.hours_per_week&&e.jsxs("div",{children:[e.jsx("span",{className:"font-semibold text-gray-600",children:"Hours/week:"})," ",e.jsx("span",{className:"text-gray-900",children:s.hours_per_week})]}),s.school_requirement&&e.jsxs("div",{children:[e.jsx("span",{className:"font-semibold text-gray-600",children:"School requirement:"})," ",e.jsx("span",{className:"text-gray-900",children:F[s.school_requirement]||s.school_requirement})]}),s.career_counselor_name&&e.jsxs("div",{children:[e.jsx("span",{className:"font-semibold text-gray-600",children:"Career counselor:"})," ",e.jsxs("span",{className:"text-gray-900",children:[s.career_counselor_name,s.career_counselor_email?` (${s.career_counselor_email})`:""]})]}),s.reviewed_at&&e.jsxs("div",{children:[e.jsx("span",{className:"font-semibold text-gray-600",children:"Reviewed at:"})," ",e.jsx("span",{className:"text-gray-900",children:N(s.reviewed_at)})]})]}),s.why_interested&&e.jsxs("div",{className:"mb-4",children:[e.jsx("p",{className:"text-xs font-bold text-gray-500 uppercase tracking-widest mb-1.5",children:"Why interested"}),e.jsx("p",{className:"text-sm text-gray-800 whitespace-pre-wrap leading-relaxed",children:s.why_interested})]}),s.what_youd_like_to_learn&&e.jsxs("div",{className:"mb-5",children:[e.jsx("p",{className:"text-xs font-bold text-gray-500 uppercase tracking-widest mb-1.5",children:"What they want to learn"}),e.jsx("p",{className:"text-sm text-gray-800 whitespace-pre-wrap leading-relaxed",children:s.what_youd_like_to_learn})]}),e.jsxs("div",{className:"mb-5",children:[e.jsxs("p",{className:"text-xs font-bold text-gray-500 uppercase tracking-widest mb-1.5 flex items-center gap-1.5",children:[e.jsx(B,{className:"w-3 h-3"})," Internal notes"]}),e.jsx("textarea",{value:o,onChange:t=>r(t.target.value),rows:3,className:"w-full px-3 py-2 rounded-lg border border-gray-200 bg-white text-sm focus:outline-none focus:ring-2 focus:ring-red-200",placeholder:"Decisions, follow-ups, school requirements details..."}),e.jsxs(b,{onClick:g,disabled:l,className:"mt-2 rounded-full text-xs font-medium px-4 py-2 bg-gray-900 text-white hover:bg-gray-800",children:[e.jsx(D,{className:"w-3.5 h-3.5 mr-1.5"})," ",l?"Saving...":"Save notes"]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 pt-4 border-t border-gray-200",children:[e.jsx("span",{className:"text-xs font-bold text-gray-500 uppercase tracking-widest mr-2",children:"Set status:"}),h.map(t=>e.jsx(b,{onClick:()=>x.mutate(t.value),disabled:x.isPending||s.status===t.value,className:`rounded-full text-xs font-medium px-3 py-1.5 border ${t.tone} ${s.status===t.value?"opacity-50 cursor-default":"hover:opacity-80"}`,children:t.label},t.value)),e.jsxs("a",{href:`mailto:${s.email}`,className:"ml-auto text-xs font-medium text-red-500 hover:underline inline-flex items-center gap-1",children:[e.jsx(v,{className:"w-3.5 h-3.5"})," Reply"]})]})]})})})]})}function V(){const[s,n]=m.useState("all"),[i,o]=m.useState(""),{data:r=[],isLoading:l,refetch:u,isFetching:d}=_({queryKey:["internship_applications",s],queryFn:async()=>{let t=y.from("internship_applications").select("*").order("created_at",{ascending:!1});s!=="all"&&(t=t.eq("status",s));const{data:a,error:c}=await t;if(c)throw c;return a||[]}}),x=r.filter(t=>{var c,f,p,j;if(!i.trim())return!0;const a=i.toLowerCase();return((c=t.first_name)==null?void 0:c.toLowerCase().includes(a))||((f=t.last_name)==null?void 0:f.toLowerCase().includes(a))||((p=t.email)==null?void 0:p.toLowerCase().includes(a))||((j=t.school_name)==null?void 0:j.toLowerCase().includes(a))}),g=h.reduce((t,a)=>(t[a.value]=r.filter(c=>c.status===a.value).length,t),{});return e.jsx("div",{className:"min-h-screen bg-gray-50 py-24",children:e.jsxs("div",{className:"max-w-5xl mx-auto px-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs(w,{to:"/admin/dashboard",className:"inline-flex items-center text-sm font-medium text-gray-500 hover:text-gray-700",children:[e.jsx(q,{className:"w-4 h-4 mr-1.5"})," Admin dashboard"]}),e.jsxs(b,{onClick:()=>u(),disabled:d,className:"rounded-full text-xs font-medium px-4 py-2 bg-white border border-gray-200 text-gray-700 hover:bg-gray-50",children:[e.jsx(L,{className:`w-3.5 h-3.5 mr-1.5 ${d?"animate-spin":""}`})," Refresh"]})]}),e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("div",{className:"w-12 h-12 rounded-2xl bg-red-50 flex items-center justify-center",children:e.jsx(A,{className:"w-6 h-6 text-red-500"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl md:text-4xl font-black uppercase tracking-tight text-gray-900",children:"Internship applications"}),e.jsx("p",{className:"text-sm text-gray-500 mt-0.5",children:"Monthly review cadence. Respond by the 10th of the month after the application date."})]})]}
1),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-2 my-6",children:[e.jsxs("button",{onClick:()=>n("all"),className:`p-3 rounded-xl border text-left transition-colors ${s==="all"?"bg-gray-900 text-white border-gray-900":"bg-white border-gray-200 hover:border-gray-300"}`,children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-widest opacity-80",children:"All"}),e.jsx("p",{className:"text-2xl font-black mt-0.5",children:r.length})]}),h.map(t=>e.jsxs("button",{onClick:()=>n(t.value),className:`p-3 rounded-xl border text-left transition-colors ${s===t.value?"bg-gray-900 text-white border-gray-900":"bg-white border-gray-200 hover:border-gray-300"}`,children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-widest opacity-80",children:t.label}),e.jsx("p",{className:"text-2xl font-black mt-0.5",children:g[t.value]||0})]},t.value))]}),e.jsxs("div",{className:"relative mb-5",children:[e.jsx(R,{className:"absolute left-3.5 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),e.jsx(C,{value:i,onChange:t=>o(t.target.value),placeholder:"Search by name, email, or school...",className:"pl-10 bg-white border-gray-200"})]}),l?e.jsx("div",{className:"text-center py-16 text-gray-500",children:"Loading applications..."}):x.length===0?e.jsx("div",{className:"text-center py-16 text-gray-500 bg-white rounded-xl border border-gray-200",children:r.length===0?"No applications yet.":"No applications match your filter."}):e.jsx("div",{className:"space-y-3",children:x.map(t=>e.jsx(K,{app:t},t.id))})]})})}export{V 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.