1import{j as e}from"./trpc-vendor-Bv0iaNDN.js";import{A as y}from"./AdminLayout-BvvhRFUw.js";import{t as c,h as i,K as N,g as v,M as x,G as w,e as z}from"./index-Bp5xQ-En.js";import{r as b}from"./react-vendor-CGOjsTCb.js";import{R as S}from"./refresh-cw-DS2mrj9R.js";import{T as P}from"./trash-2-DEzeex90.js";import{G as M}from"./graduation-cap-DtyfmjZD.js";import{M as T}from"./message-square-D7ASK-H8.js";import"./bell-DDfP3iQl.js";import"./image-NXvCck6X.js";import"./phone-call-DR-uxlHF.js";import"./radix-vendor-BsQgJgbQ.js";import"./charts-DUKIMxkY.js";const g={new:{label:"New",color:"bg-blue-100 text-blue-700"},called:{label:"Called",color:"bg-yellow-100 text-yellow-700"},closed:{label:"Closed",color:"bg-gray-100 text-gray-500"}};function J(){const[t,p]=b.useState(1),[q,B]=b.useState(null),u=20,n=c.useUtils(),{data:h,isLoading:R}=c.callBack.list.useQuery({page:t,pageSize:u}),k=c.callBack.updateStatus.useMutation({onSuccess:()=>n.callBack.list.invalidate()}),C=c.callBack.delete.useMutation({onSuccess:()=>n.callBack.list.invalidate()}),d=h?.items??[],r=h?.total??0,l=Math.max(1,Math.ceil(r/u)),A=(a,s)=>{k.mutate({id:a,status:s})},j=a=>{confirm("Delete this request? This action cannot be undone.")&&C.mutate({id:a})};return e.jsx(y,{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:43",title:"Call Back Requests",children:e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:44",className:"max-w-5xl mx-auto",children:[e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:46",className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:47",children:[e.jsx("h1",{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:48",className:"text-xl font-serif font-bold text-gray-900",children:"Call Back Requests"}),e.jsxs("p",{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:49",className:"text-sm text-gray-500 mt-0.5",children:[r," total request",r!==1?"s":""]})]}),e.jsxs("button",{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:51",onClick:()=>n.callBack.list.invalidate(),className:"flex items-center gap-2 px-3 py-2 text-sm text-gray-600 border border-gray-300 rounded-lg hover:bg-gray-50 transition-colors",children:[e.jsx(S,{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:55",size:14})," Refresh"]})]}),e.jsx("div",{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:60",className:"grid grid-cols-3 gap-3 mb-6",children:Object.entries(g).map(([a,{label:s,color:o}])=>{const m=d.filter(f=>f.status===a).length;return e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:64",className:"bg-white rounded-xl border border-gray-200 p-4",children:[e.jsx("div",{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:65",className:`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-semibold ${o} mb-2`,children:s}),e.jsx("div",{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:66",className:"text-2xl font-bold text-gray-900",children:m}),e.jsx("div",{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:67",className:"text-xs text-gray-400",children:"on this page"})]},a)})}),e.jsx("div",{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:74",className:"bg-white rounded-xl border border-gray-200 overflow-hidden",children:R?e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:76",className:"p-12 text-center text-gray-400",children:[e.jsx("div",{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:77",className:"w-6 h-6 border-2 border-bci border-t-transparent rounded-full animate-spin mx-auto mb-3"}),"Loading requests..."]}):d.length===0?e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:81",className:"p-12 text-center",children:[e.jsx(i,{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:82",size:40,className:"text-gray-300 mx-auto mb-3"}),e.jsx("p",{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:83",className:"text-gray-500 font-medium",children:"No call back requests yet"}),e.jsx("p",{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:84",className:"text-gray-400 text-sm mt-1",children:"Requests submitted via the website will appear here."})]}):e.jsx("div",{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:87",className:"divide-y divide-gray-100",children:d.map(a=>{const s=q===a.id,o=g[a.status]??g.new;return e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:92",className:"hover:bg-gray-50 transition-colors",children:[e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:94",className:"px-5 py-4 flex items-center gap-4",children:[e.jsx("button",{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:96",onClick:()=>B(s?null:a.id),className:"text-gray-400 hover:text-gray-600 shrink-0",children:s?e.jsx(N,{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:100",size:16}):e.jsx(v,{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:100",size:16})}),e.jsx("div",{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:104",className:"w-9 h-9 rounded-full bg-green-50 text-green-700 flex items-center justify-center font-bold text-sm shrink-0",children:a.name?.[0]?.toUpperCase()??"?"}),e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:109",className:"flex-1 min-w-0",children:[e.jsx("div",{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:110",className:"font-semibold text-gray-900 text-sm truncate",children:a.name}),e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:111",className:"text-xs text-gray-500 truncate",children:[a.interestedProgramme??"No programme specified",a.preferredTime?` · ${a.preferredTime}`:""]})]}),e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:118",className:"hidden md:flex items-center gap-3 text-xs text-gray-500 shrink-0",children:[e.jsxs("a",{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:119",href:`tel:${a.phone}`,className:"flex items-center gap-1 hover:text-bci transition-colors font-medium",children:[e.jsx(i,{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:120",size:12})," ",a.phone]}),a.email&&e.jsxs("a",{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:123",href:`mailto:${a.email}`,className:"flex items-center gap-1 hover:text-bci transition-colors",children:[e.jsx(x,{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:124",size:12})," ",a.email]})]}),e.jsx("div",{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:130",className:"hidden lg:block text-xs text-gray-400 shrink-0 w-24 text-right",children:new Date(a.createdAt).toLocaleDateString()}),e.jsxs("select",{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:135",value:a.status,onChange:m=>A(a.id,m.target.value),className:`text-xs font-semibold px-2 py-1 rounded-full border-0 cursor-pointer ${o.color}`,disabled:k.isPending,children:[e.jsx("option",{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:141",value:"new",children:"New"}),e.jsx("option",{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:142",value:"called",children:"Called"}),e.jsx("option",{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:143",value:"closed",children:"Closed"})]}),e.jsx("button",{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:147",onClick:()=>j(a.id),className:"text-gray-300 hover:text-red-500 transition-colors shrink-0",disabled:C.isPending,title:"Delete",children:e.jsx(P,{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:153",size:15})})]}),s&&e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:159",className:"px-5 pb-4 ml-14 border-t border-gray-100 pt-3 space-y-2",children:[e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:160",className:"flex flex-wrap gap-4 text-xs text-gray-600",children:[e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:161",className:"flex items-center gap-1.5",children:[e.jsx(i,{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:162",size:12,className:"text-gray-400"}),e.jsx("a",{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:163",href:`tel:${a.phone}`,className:"hover:text-bci transition-colors font-medium",children:a.phone})]}),a.email&&e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:166",className:"flex items-center gap-1.5",children:[e.jsx(x,{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:167",size:12,className:"text-gray-400"}),e.jsx("a",{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:168",href:`mailto:${a.email}`,className:"hover:text-bci transition-colors",children:a.email})]}),a.nationality&&e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:172",className:"flex items-center gap-1.5",children:[e.jsx(w,{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:173",size:12,className:"text-gray-400"}),a.nationality]}),a.preferredTime&&e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:178",className:"flex items-center gap-1.5",children:[e.jsx(z,{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:179",size:12,className:"text-gray-400"}),"Preferred time: ",a.preferredTime]}),a.interestedProgramme&&e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:184",className:"flex items-center gap-1.5",children:[e.jsx(M,{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:185",size:12,className:"text-gray-400"}),"Interested in: ",a.interestedProgramme]}),e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:189",className:"flex items-center gap-1.5 text-gray-400",children:["Submitted: ",new Date(a.createdAt).toLocaleStr
1ing()]})]}),a.message&&e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:194",className:"flex items-start gap-2 text-xs text-gray-700 bg-gray-50 rounded-lg p-3",children:[e.jsx(T,{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:195",size:12,className:"text-gray-400 mt-0.5 shrink-0"}),e.jsx("p",{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:196",className:"whitespace-pre-wrap",children:a.message})]}),e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:199",className:"flex gap-2 pt-1",children:[e.jsxs("a",{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:200",href:`tel:${a.phone}`,className:"inline-flex items-center gap-1.5 px-3 py-1.5 bg-bci text-white text-xs font-semibold rounded-lg hover:bg-bci/90 transition-colors",children:[e.jsx(i,{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:204",size:12})," Call Now"]}),a.email&&e.jsxs("a",{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:207",href:`mailto:${a.email}?subject=BCI Admissions Enquiry`,className:"inline-flex items-center gap-1.5 px-3 py-1.5 border border-gray-300 text-gray-700 text-xs font-semibold rounded-lg hover:bg-gray-50 transition-colors",children:[e.jsx(x,{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:211",size:12})," Email"]})]})]})]},a.id)})})}),l>1&&e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:226",className:"flex items-center justify-between mt-4 text-sm text-gray-500",children:[e.jsxs("span",{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:227",children:["Page ",t," of ",l]}),e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:228",className:"flex gap-2",children:[e.jsx("button",{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:229",onClick:()=>p(a=>Math.max(1,a-1)),disabled:t===1,className:"px-3 py-1.5 border border-gray-300 rounded-lg hover:bg-gray-50 disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:"Previous"}),e.jsx("button",{"data-loc":"client/src/pages/admin/AdminCallBackRequests.tsx:236",onClick:()=>p(a=>Math.min(l,a+1)),disabled:t===l,className:"px-3 py-1.5 border border-gray-300 rounded-lg hover:bg-gray-50 disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:"Next"})]})]})]})})}export{J 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.