PageSourceSearch

https://aicureacademy.com/assets/AdminTicketsPage-CpZeTkxI.js

js aicureacademy.com collected 2026-09-29 10:55:10 UTC 11,808 bytes, 1 lines download raw bytes

1import{r as i,B as F,y as e}from"./vendor-CAn19U_C.js";import{A as O,d as f,n as p,a as u}from"./index-CJ3hxe8K.js";import{q as $,h as z,f as T,u as B,d as H,n as I,w as X,k as G,m as J}from"./vendor-firebase-CMgAD1F0.js";import{b as K,aB as U,a as Q,j as L,c as V,s as W,O as Y}from"./vendor-lucide-B99EgzbQ.js";function ae(){const[P,_]=i.useState([]),[D,j]=i.useState(!0),[d,E]=i.useState(""),[h,R]=i.useState("All"),[t,m]=i.useState(null),[y,n]=i.useState(!1),w=F();i.useEffect(()=>{const s=$(z(f,"support_tickets")),a=T(s,l=>{const g=l.docs.map(r=>({id:r.id,...r.data()}));g.sort((r,c)=>{var k,o,S,C,x,A;const b=((k=r.createdAt)==null?void 0:k.seconds)||((S=(o=r.createdAt)==null?void 0:o.getTime)==null?void 0:S.call(o))||0;return(((C=c.createdAt)==null?void 0:C.seconds)||((A=(x=c.createdAt)==null?void 0:x.getTime)==null?void 0:A.call(x))||0)-b}),_(g),j(!1)},l=>{j(!1)});return()=>a()},[]);const M=async(s,a)=>{n(!0);try{await B(H(f,"support_tickets",s),{status:a,updatedAt:I()}),p.success("Status Updated",`Ticket marked as ${a}`),(t==null?void 0:t.id)===s&&m({...t,status:a})}catch{p.error("Error","Failed to update status")}finally{n(!1)}},q=async s=>{if(u.currentUser){n(!0);try{const a=z(f,"chats"),l=$(a,X("participants","array-contains",u.currentUser.uid)),r=(await G(l)).docs.find(v=>v.data().participants.includes(s.studentId));if(r){w(`/admin/dashboard?tab=Messages&chatId=${r.id}`);return}const c={participants:[u.currentUser.uid,s.studentId],chatType:"student-support",lastMessage:"",lastUpdatedAt:I(),participantDetails:{[u.currentUser.uid]:{fullName:"Admin",role:"admin"},[s.studentId]:{fullName:s.studentName,role:"student"}}},b=await J(a,c);p.success("Chat Created",`Support session for ${s.studentName} started.`),w(`/admin/dashboard?tab=Messages&chatId=${b.id}`)}catch{p.error("Error","Failed to initiate chat")}finally{n(!1)}}},N=P.filter(s=>{const a=s.subject.toLowerCase().includes(d.toLowerCase())||s.studentName.toLowerCase().includes(d.toLowerCase())||s.studentEmail.toLowerCase().includes(d.toLowerCase()),l=h==="All"||s.status===h;return a&&l});return e.jsxs(O,{activePage:"Support Tickets",children:[e.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-6 mb-12",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-4xl font-black text-gray-900 mb-2",children:"Support Tickets"}),e.jsx("p",{className:"text-gray-500 font-extrabold uppercase text-[10px] tracking-[0.2em]",children:"Manage and Resolve Student Inquiries"})]}),e.jsx("div",{className:"flex items-center gap-4 bg-white p-2 rounded-[22px] border border-gray-100 shadow-sm",children:["All","Open","In Progress","Resolved"].map(s=>e.jsx("button",{onClick:()=>R(s),className:`px-6 py-3 rounded-xl text-[10px] font-black uppercase tracking-widest transition-all ${h===s?"bg-blue-600 text-white shadow-lg":"text-gray-400 hover:text-gray-600 hover:bg-gray-50"}`,children:s},s))})]}),e.jsxs("div",{className:"grid lg:grid-cols-12 gap-8 items-start",children:[e.jsxs("div",{className:`lg:col-span-5 space-y-4 ${t?"hidden lg:block":"block"}`,children:[e.jsxs("div",{className:"relative group mb-6",children:[e.jsx(K,{className:"absolute left-6 top-1/2 -translate-y-1/2 text-gray-300 group-focus-within:text-blue-600 transition-colors",size:20}),e.jsx("input",{type:"text",placeholder:"Search by subject, student, email...",value:d,onChange:s=>E(s.target.value),className:"w-full pl-16 pr-8 py-5 bg-white border border-gray-100 rounded-[28px] text-sm outline-none shadow-sm focus:ring-2 focus:ring-blue-100 font-bold"})]}),e.jsx("div",{className:"space-y-4 max-h-[calc(100vh-350px)] overflow-y-auto no-scrollbar pr-2",children:D?e.jsxs("div",{className:"flex flex-col items-center justify-center p-20 bg-white rounded-[40px] border border-gray-50",children:[e.jsx("div",{className:"w-10 h-10 border-4 border-blue-600/10 border-t-blue-600 rounded-full animate-spin mb-4"}),e.jsx("p",{className:"text-gray-400 font-black text-[10px] uppercase tracking-widest",children:"Fetching Tickets..."})]}):N.length===0?e.jsxs("div",{className:"bg-white rounded-[40px] p-20 border border-gray-100 text-center flex flex-col items-center",children:[e.jsx(U,{size:48,className:"text-gray-200 mb-4"}),e.jsx("h3",{className:"text-xl font-black text-gray-900 mb-1",children:"No tickets found"}),e.jsx("p",{className:"text-gray-400 font-bold text-xs",children:"Try adjusting your search or filters"})]}):N.map(s=>{var a;return e.jsxs("div",{onClick:()=>m(s),className:`group p-6 rounded-[32px] border transition-all duration-300 cursor-pointer ${(t==null?void 0:t.id)===s.id?"bg-blue-600 border-transparent shadow-xl shadow-blue-500/20 text-white translate-x-2":"bg-white border-gray-100 hover:border-blue-200 hover:shadow-lg"}`,children:[e.jsxs("div",{className:"flex justify-between items-start mb-3",children:[e.jsxs("span",{className:`px-2 py-0.5 rounded-lg text-[8px] font-black uppercase tracking-widest ${(t==null?void 0:t.id)===s.id?"bg-white/20 text-white":s.priority==="High"?"bg-red-50 text-red-500":"bg-blue-50 text-blue-600"}`,children:[s.priority," Priority"]}),e.jsx("span",{className:`text-[9px] font-bold ${(t==null?void 0:t.id)===s.id?"text-white/60":"text-gray-300"}`,children:(a=s.createdAt)!=null&&a.toDate?s.createdAt.toDate().toLocaleDateString():"Today"})]}),e.jsx("h3",{className:"text-[15px] font-black mb-1 line-clamp-1 uppercase tracking-tight",children:s.subject}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:`text-[11px] font-bold truncate max-w-[150px] ${(t==null?void 0:t.id)===s.id?"text-blue-100":"text-gray-400"}`,children:s.studentName}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:`w-1.5 h-1.5 rounded-full ${s.status==="Resolved"?"bg-emerald-500":s.status==="In Progress"?"bg-amber-500":"bg-blue-400"}`}),e.jsx("span",{className:`text-[9px] font-black uppercase tracking-widest ${(t==null?void 0:t.id)===s.id?"text-white/80":"text-gray-500"}`,children:s.status})]})]})]},s.id)})})]}),e.jsx("div",{className:`lg:col-span-7 bg-white rounded-[40px] border border-gray-100 shadow-sm overflow-hidden min-h-[600px] flex flex-col ${t?"flex animate-enter":"hidden lg:flex"}`,children:t?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"p-10 border-b border-gray-50 flex items-center justify-between bg-white sticky top-0 z-10",children:[e.jsxs("div",{className:"flex items-center gap-6",children:[e.jsx("button",{onClick:()=>m(null),className:"lg:hidden p-3 bg-gray-50 text-gray-400 rounded-2xl",children:e.jsx(Q,{size:20})}),e.jsx("div",{className:"w-16 h-16 rounded-[24px] bg-blue-50 flex items-center justify-center text-blue-600 text-2xl font-black shadow-inner",children:t.studentName.charAt(0)}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-black text-gray-900 leading-tight tracking-tight",children:t.subject}),e.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[e.jsxs("span",{className:`px-2 py-0.5 rounded-lg text-[8px] font-black uppercase tracking-widest ${t.priority==="High"?"bg-red-50 text-red-500":"bg-blue-50 text-blue-600"}`,children:[t.priority," Priority"]}),e.jsxs("span",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-widest",children:["ID: ",t.id.slice(-6).toUpperCase()]})]})]})]}),e.jsxs("div",{className:"flex flex-col items-end gap-3 font-black",children:[e.jsx("span",{className:`inline-block px-5 py-2 rounded-xl text-[10px] uppercase tracking-widest ${t.status==="Resolved"?"bg-emerald-500 text-white shadow-lg shadow-emerald-200":t.status==="In Progress"?"bg-amber-500 text-white shadow-lg shadow-amber-200":"bg-blue-600 text-white shadow-lg shadow-blue-200"}`,children:t.status}),e.jsxs("button",{onClick:()=>q(t),disabled:y,className:"px-6 py-3 bg-gray-900 shadow-xl shadow-gray-200 hover:bg-black text-white rounded-2xl text-[10px] uppercase tracking-widest flex items-center gap-2 transition-all active:scale-95 disabled:opacity-50",children:[e.jsx(L,{size:14}),"Open Support Chat"]})]})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-10 space-y-10 custom-scrollbar",children:[e.jsxs("div",{className:"grid md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"p-6 bg-gray-50/50 rounded-3xl border border-gray-50 flex items-center gap-4",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-white flex items-center justify-center text-blue-600 shadow-sm",children:e.jsx(V,{size:18})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-black text-gray-400 uppercase tracking-widest",children:"Student"}),e.jsx("h4",{className:"text-sm font-black text-gray-900",children:t.studentName})]})]}),e.jsxs("div",{className:"p-6 bg-gray-50/50 rounded-3xl border border-gray-50 flex items-center gap-4",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-white flex items-center justify-center text-blue-600 shadow-sm",children:e.jsx(W,{size:18})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-black text-gray-400 uppercase tracking-widest",children:"Email Address"}),e.jsx("h4",{className:"text-sm font-black text-gray-900 truncate max-w-[200px]",children:t.studentEmail})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 ml-1",children:[e.jsx(L,{size:16,className:"text-blue-600"}),e.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest",children:"Message from Student"})]}),e.jsxs("div",{className:"p-8 bg-gray-50/80 rounded-[32px] border border-gray-100 italic relative overflow-hidden group",children:[e.jsx("div",{className:"absolute top-0 right-0 w-32 h-32 bg-blue-100/20 blur-3xl rounded-full -mr-16 -mt-16 group-hover:scale-110 transition-transform"}),e.jsxs("p",{className:"text-gray-700 font-bold leading-relaxed whitespace-pre-wrap relative z-10 text-lg",children:['"',t.message,'"']})]})]}),e.jsxs("div",{className:"bg-blue-600 rounded-[32px] p-8 text-white relative overflow-hidden shadow-2xl shadow-blue-500/20 group",children:[e.jsx("div",{className:"absolute inset-0 opacity-10 pointer-events-none bg-[radial-gradient(#fff_1px,transparent_1px)] [background-size:24px_24px]"}),e.jsxs("div",{className:"relative z-10",children:[e.jsxs("h4",{className:"text-xl font-black mb-4 flex items-center gap-3",children:[e.jsx(Y,{size:22})," System Actions"]}),e.jsx("p",{className:"text-blue-100 font-bold text-sm mb-8 leading-relaxed",children:"Please review the student's message and update the ticket status as you proceed with the resolution."}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:["Open","In Progress","Resolved","Closed"].map(s=>e.jsx("button",{disabled:y,onClick:()=>
1M(t.id,s),className:`py-3 px-4 rounded-xl font-black uppercase text-[10px] tracking-widest transition-all ${t.status===s?"bg-white text-blue-600 shadow-xl scale-105":"bg-white/10 text-white hover:bg-white/20"}`,children:s===t.status?"Current":s},s))})]})]})]})]}):e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center p-20 text-center relative",children:[e.jsx("div",{className:"absolute inset-0 opacity-[0.02] pointer-events-none bg-[radial-gradient(#3b82f6_1px,transparent_1px)] [background-size:40px_40px]"}),e.jsx("div",{className:"w-28 h-28 bg-gray-50 rounded-[44px] flex items-center justify-center text-gray-200 mb-8 border border-gray-100 shadow-inner group transition-all duration-500 hover:scale-110",children:e.jsx(U,{size:56,className:"group-hover:text-blue-600/20 transition-colors"})}),e.jsx("h3",{className:"text-3xl font-black text-gray-900 mb-4 tracking-tight",children:"Support Operations"}),e.jsx("p",{className:"text-gray-400 font-bold max-w-sm leading-relaxed uppercase text-[10px] tracking-[0.2em]",children:"Select a ticket from the left to view details and update status"})]})})]})]})}export{ae 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.