PageSourceSearch

https://repredict.com/assets/AdminTrainingSupport-DTK2P4I7.js

js repredict.com collected 2026-10-09 22:55:59 UTC 11,433 bytes, 1 lines download raw bytes

1import{F as O,b as U,r as k,u as A,h as d,d as K,j as e,L as q,B as m,S as D,t as j}from"./index-DBG4OZ3F.js";import{C as x,b as Q,c as H,d as z,a as h}from"./card-EWKKjIKj.js";import{B as n}from"./badge-DBE79tw3.js";import{D as Y,a as _,b as J,c as V,d as W,e as S}from"./dialog-CPMlJbPZ.js";import{A as F}from"./arrow-left-Bo5kbfGj.js";import{C as f}from"./concierge-bell-CeKGJAny.js";import{L as N}from"./loader-circle-Cb5RqKNo.js";import{C as X}from"./clock-CH3nTmIC.js";import{U as T}from"./user-CG37sG7b.js";import{S as L}from"./shield-off-Bk6aAXb-.js";import{C as R}from"./circle-check-hU5EluYM.js";import{F as $}from"./file-text-Dj-PuPUU.js";import{D as P}from"./download-BhCu6a4I.js";import"./index-D4bXy2Lp.js";import"./index-BKfQqV27.js";function pe(){const{user:G}=O(),M=U(),[o,c]=k.useState(null),{data:i,isLoading:b}=A({queryKey:["/api/admin/concierge/requests"],queryFn:async()=>(await d("GET","/api/admin/concierge/requests")).json()}),{data:t,isLoading:v}=A({queryKey:["/api/admin/concierge/requests",o],queryFn:async()=>(await d("GET",`/api/admin/concierge/requests/${o}`)).json(),enabled:!!o});k.useEffect(()=>{i&&i.length>0&&d("POST","/api/admin/concierge/auto-revoke").catch(()=>{})},[i]);const p=K({mutationFn:async s=>(await d("POST",`/api/admin/concierge/requests/${s}/complete`)).json(),onSuccess:()=>{j.success("Request marked complete. Support access revoked."),M.invalidateQueries({queryKey:["/api/admin/concierge/requests"]}),c(null)},onError:()=>{j.error("Failed to complete request")}});if(!G?.isAdmin)return e.jsx("div",{className:"light min-h-screen bg-gradient-to-br from-slate-50 to-blue-50 flex items-center justify-center p-4",children:e.jsxs(x,{className:"max-w-md",children:[e.jsxs(Q,{children:[e.jsx(H,{className:"text-red-600",children:"Access Denied"}),e.jsx(z,{children:"You need admin privileges to access this page."})]}),e.jsx(h,{children:e.jsx(q,{href:"/app",children:e.jsxs(m,{variant:"outline",children:[e.jsx(F,{className:"w-4 h-4 mr-2"}),"Back to App"]})})})]})});const u=i?.filter(s=>s.status==="pending")||[],g=i?.filter(s=>s.status==="complete")||[],B=s=>s?new Date(s).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):"—",w=s=>s?new Date(s).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"}):"—",E=s=>Math.floor((Date.now()-new Date(s).getTime())/(1e3*60*60*24)),y=async s=>{try{const a=await(await d("GET",`/api/admin/concierge/files/${s}/download`)).json();a.url&&window.open(a.url,"_blank")}catch{j.error("Failed to download file")}},I=s=>{const r=new Map;for(const a of s){const l=`${a.pairGender||"unknown"}-${a.pairAge||0}`;r.has(l)||r.set(l,{gender:a.pairGender||"unknown",age:a.pairAge||0,before:null,after:null});const C=r.get(l);a.fileType==="before"?C.before=a:C.after=a}return Array.from(r.values()).sort((a,l)=>a.gender!==l.gender?a.gender<l.gender?-1:1:a.age-l.age)};return e.jsx("div",{className:"light min-h-screen bg-slate-50",children:e.jsxs("div",{className:"max-w-5xl mx-auto px-4 py-6",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[e.jsx(q,{href:"/admin/users",children:e.jsxs(m,{variant:"ghost",size:"sm","data-testid":"button-back-admin",children:[e.jsx(F,{className:"h-4 w-4 mr-1"})," Admin"]})}),e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold text-slate-900 flex items-center gap-2","data-testid":"heading-training-support",children:[e.jsx(f,{className:"h-6 w-6 text-violet-600"}),"Training Support"]}),e.jsx("p",{className:"text-sm text-slate-500",children:"Manage concierge service requests"})]})]}),b&&e.jsx("div",{className:"flex items-center justify-center py-16",children:e.jsx(N,{className:"h-8 w-8 animate-spin text-violet-500"})}),!b&&(!i||i.length===0)&&e.jsx(x,{children:e.jsxs(h,{className:"py-16 text-center text-slate-500",children:[e.jsx(f,{className:"h-12 w-12 mx-auto mb-3 text-slate-300"}),e.jsx("p",{className:"font-medium",children:"No concierge requests yet"}),e.jsx("p",{className:"text-sm mt-1",children:"Requests will appear here when users submit them."})]})}),u.length>0&&e.jsxs("div",{className:"mb-8",children:[e.jsxs("h2",{className:"text-sm font-semibold text-slate-700 mb-3 flex items-center gap-2",children:[e.jsx(X,{className:"h-4 w-4 text-amber-500"}),"Pending (",u.length,")"]}),e.jsx("div",{className:"space-y-3",children:u.map(s=>e.jsx(x,{className:"cursor-pointer hover:shadow-md transition-shadow border-amber-200",onClick:()=>c(s.id),"data-testid":`card-request-${s.id}`,children:e.jsx(h,{className:"py-4 px-5",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(T,{className:"h-4 w-4 text-slate-400"}),e.jsxs("div",{children:[e.jsxs("p",{className:"text-sm font-medium text-slate-900",children:[s.firstName||""," ",s.lastName||""," ",e.jsxs("span",{className:"text-slate-400 font-normal",children:["(",s.email,")"]})]}),e.jsx("p",{className:"text-xs text-slate-500 mt-0.5 line-clamp-1",children:s.description})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[s.supportAccessGranted?e.jsxs(n,{className:"bg-green-100 text-green-700 border-green-200 gap-1",children:[e.jsx(D,{className:"h-3 w-3"})," Access Active"]}):e.jsxs(n,{variant:"secondary",className:"gap-1",children:[e.jsx(L,{className:"h-3 w-3"})," No Access"]}),e.jsxs(n,{variant:"outline",className:"text-xs",children:[E(s.createdAt),"d ago"]})]})]})})},s.id))})]}),g.length>0&&e.jsxs("div",{children:[e.jsxs("h2",{className:"text-sm font-semibold text-slate-700 mb-3 flex items-center gap-2",children:[e.jsx(R,{className:"h-4 w-4 text-green-500"}),"Complete (",g.length,")"]}),e.jsx("div",{className:"space-y-3",children:g.map(s=>e.jsx(x,{className:"cursor-pointer hover:shadow-md transition-shadow opacity-75",onClick:()=>c(s.id),"data-testid":`card-request-${s.id}`,children:e.jsx(h,{className:"py-4 px-5",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(T,{className:"h-4 w-4 text-slate-400"}),e.jsxs("div",{children:[e.jsxs("p",{className:"text-sm font-medium text-slate-900",children:[s.firstName||""," ",s.lastName||""," ",e.jsxs("span",{className:"text-slate-400 font-normal",children:["(",s.email,")"]})]}),e.jsx("p",{className:"text-xs text-slate-500 mt-0.5 line-clamp-1",children:s.description})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(n,{className:"bg-green-100 text-green-700 border-green-200",children:"Complete"}),e.jsx(n,{variant:"outline",className:"text-xs",children:B(s.completedAt)})]})]})})},s.id))})]}),e.jsx(Y,{open:!!o&&!!t,onOpenChange:s=>{s||c(null)},children:e.jsxs(_,{className:"max-w-2xl",children:[v&&e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(N,{className:"h-8 w-8 animate-spin text-violet-500"})}),t&&!v&&e.jsxs(e.Fragment,{children:[e.jsxs(J,{children:[e.jsxs(V,{className:"flex items-center gap-2",children:[e.jsx(f,{className:"h-5 w-5 text-violet-600"}),"Concierge Request"]}),e.jsxs(W,{children:[t.firstName||""," ",t.lastName||""," (",t.email,")"]})]}),e.jsxs("div",{className:"space-y-4 max-h-[60vh] overflow-y-auto",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"bg-slate-50 rounded-lg p-3",children:[e.jsx("p",{className:"text-xs font-medium text-slate-500",children:"Received"}),e.jsx("p",{className:"text-sm font-medium text-slate-900","data-testid":"text-received-date",children:w(t.createdAt)})]}),e.jsxs("div",{className:"bg-slate-50 rounded-lg p-3",children:[e.jsx("p",{className:"text-xs font-medium text-slate-500",children:"Completed"}),e.jsx("p",{className:"text-sm font-medium text-slate-900","data-testid":"text-completed-date",children:t.completedAt?w(t.completedAt):"In progress"})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium text-slate-500 mb-1",children:"Description"}),e.jsx("div",{className:"bg-slate-50 rounded-lg p-4",children:e.jsx("p",{className:"text-sm text-slate-700 whitespace-pre-wrap",children:t.description})})]}),e.jsxs("div",{children:[e.jsxs("p",{className:"text-xs font-medium text-slate-500 mb-2",children:["Illustration Pairs (",t.files.length/2," pairs)"]}),e.jsxs("div",{className:"space-y-2",children:[I(t.files).map((s,r)=>e.jsxs("div",{className:"bg-slate-50 rounded-lg p-3",children:[e.jsx("div",{className:"flex items-center gap-2 mb-2",children:e.jsxs(n,{variant:"secondary",className:"text-xs",children:[s.gender==="male"?"M":s.gender==="female"?"F":"?",s.age]})}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[s.before&&e.jsxs("button",{onClick:()=>y(s.before.id),className:"flex items-center gap-2 text-xs bg-blue-50 rounded px-3 py-2 hover:bg-blue-100 transition-colors text-left","data-testid":`button-download-before-${r}`,children:[e.jsx($,{className:"h-3.5 w-3.5 text-blue-500 shrink-0"}),e.jsx("span",{className:"truncate text-blue-900",children:s.before.fileName}),e.jsx(P,{className:"h-3 w-3 text-blue-400 shrink-0 ml-auto"})]}),s.after&&e.jsxs("button",{onClick:()=>y(s.after.id),className:"flex items-center gap-2 text-xs bg-green-50 rounded px-3 py-2 hover:bg-green-100 transition-colors text-left","data-testid":`button-download-after-${r}`,children:[e.jsx($,{className:"h-3.5 w-3.5 text-green-500 shrink-0"}),e.jsx("span",{className:"truncate text-green-900",children:s.after.fileName}),e.jsx(P,{className:"h-3 w-3 text-green-400 shrink-0 ml-auto"})]})]})]},r)),t.files.length===0&&e.jsx("p",{className:"text-sm text-slate-400 text-center py-2",children:"No files uploaded"})]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsxs("div",{className:"bg-slate-50 rounded-lg p-3",children:[e.jsx("p",{className:"text-xs font-medium text-slate-500",children:"Payment"}),e.jsxs("p",{className:"text-sm font-medium text-slate-900",children:["$",(t.amountCents/100).toFixed(2)]}),e.jsx(n,{className:t.paymentStatus==="paid"?"bg-green-100 text-green-700 mt-1":"bg-amber-100 text-amber-700 mt-1",children:t.paymentStatus})]}),e.jsxs("div",{className:"bg-slate-50 rounded-lg p-3",children:[e.jsx("p",{className:"text-xs font-medium text-slate-500",children:"Support Acce
1ss"}),t.supportAccessGranted?e.jsxs(n,{className:"bg-green-100 text-green-700 mt-1 gap-1",children:[e.jsx(D,{className:"h-3 w-3"})," Active"]}):t.supportAccessRevokedAt?e.jsxs(n,{variant:"secondary",className:"mt-1 gap-1",children:[e.jsx(L,{className:"h-3 w-3"})," Revoked"]}):e.jsx(n,{variant:"secondary",className:"mt-1",children:"Not Granted"})]}),e.jsxs("div",{className:"bg-slate-50 rounded-lg p-3",children:[e.jsx("p",{className:"text-xs font-medium text-slate-500",children:"Status"}),e.jsx(n,{className:t.status==="complete"?"bg-green-100 text-green-700 mt-1":"bg-amber-100 text-amber-700 mt-1",children:t.status==="complete"?"Complete":"Pending"})]})]})]}),t.status==="pending"&&e.jsxs(S,{children:[e.jsx(m,{variant:"outline",onClick:()=>c(null),children:"Close"}),e.jsxs(m,{onClick:()=>p.mutate(t.id),disabled:p.isPending,className:"bg-green-600 hover:bg-green-700","data-testid":"button-mark-complete",children:[p.isPending?e.jsx(N,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx(R,{className:"h-4 w-4 mr-2"}),"Mark Complete"]})]}),t.status==="complete"&&e.jsx(S,{children:e.jsx(m,{variant:"outline",onClick:()=>c(null),children:"Close"})})]})]})})]})})}export{pe 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.