PageSourceSearch

https://simpleapply.ai/assets/CoachDashboard-BmDsm-sD.js

js simpleapply.ai collected 2026-10-05 12:37:58 UTC 67,874 bytes, 16 lines download raw bytes

1import{c as ts,cD as Ks,r as d,j as e,aa as Ye,ab as Xe,ac as Ze,ad as Ge,aZ as es,a_ as ht,B as o,M as ss,u as xt,d0 as ut,bL as pt,f as As,aG as jt,l as ft,d as gt,i as wt,d1 as bt,k as ge,m as se,cL as yt,a8 as te,L as I,bM as Ts,d2 as Nt,bX as vt,$ as q,w as $s,x as Fs,F as Ms,H,a6 as Le,ae as Re,y as _t,z as kt,aN as Ct,cv as Ue,cw as ze,I as we,cx as Ie,d3 as Os,d4 as ae,a1 as Et,Z as Ps,cy as W,d5 as Ls,a7 as V,O as qe,Q as Ve,R as Je,T as Ke,U as We,V as Be,W as He,X as be,d6 as Dt,G as St,n as S,c6 as v,D as re,C as At}from"./index-C0haL9EC.js";import{T as Tt,a as $t,b as Rs,c as U,d as Ft,e as z}from"./table-BginOdFR.js";import{S as ne}from"./switch-D9K7udns.js";import{S as Us,a as zs,b as Is,c as qs,d as ie}from"./select-7dT2Cwzq.js";import{i as Mt}from"./pendingInvite-iPwsi_Sq.js";import{T as c,a as m,b as h,c as x}from"./tooltip-Bf5ZFU8W.js";import{E as Ot}from"./ExportJobsDialog-BenOsSMX.js";import{b as Pt,U as Lt,a as Rt}from"./coachJobsExport-CHG5HAHq.js";import{f as Ut}from"./fetchJsonWithRetry-CJLS1ijq.js";import{s as zt}from"./subDays-Goe3N12o.js";import{E as le}from"./external-link-9nhts5KZ.js";import{C as J}from"./circle-help-BLGkt60-.js";import{C as It}from"./circle-x-D1IDPeOx.js";import{A as B}from"./arrow-up-down-CQsRLu5g.js";import{K as Vs}from"./key-round-ZhoD2rTv.js";import{E as qt,a as Vt}from"./eye-H_XnNPKX.js";import{B as Jt}from"./briefcase-Dd1dyBEE.js";import{C as Kt}from"./calendar-check-DioN9e39.js";import"./index-B8xp7amX.js";/**
2 * @license lucide-react v0.453.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const Js=ts("FileSpreadsheet",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]]);/**
7 * @license lucide-react v0.453.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const Wt=ts("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);/**
12 * @license lucide-react v0.453.0 - ISC
13 *
14 * This source code is licensed under the ISC license.
15 * See the LICENSE file in the root directory of this source tree.
16 */const Bt=ts("Video",[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]]);function Ht(l){return Ks(l).getDay()}function Qt(l){return Ks(l).getDay()===5}function Yt(l,p){let j=Ht(l)-p;return j<=0&&(j+=7),zt(l,j)}function Xt(l){return Yt(l,5)}function Zt({file:l,onClose:p}){const[j,A]=d.useState(null),[_,F]=d.useState(!1),M=d.useRef(null);d.useEffect(()=>{let w;try{w=URL.createObjectURL(l.blob),F(!1),A(w)}catch{A(null),F(!0);return}return()=>{window.setTimeout(()=>URL.revokeObjectURL(w),6e4)}},[l]),d.useEffect(()=>{var w;j&&((w=M.current)==null||w.click())},[j]);const Q=l.blob.size>=1024*1024?`${(l.blob.size/(1024*1024)).toFixed(2)} MB`:`${(l.blob.size/1024).toFixed(1)} KB`;return e.jsx(Ye,{open:!0,onOpenChange:w=>{w||p()},children:e.jsxs(Xe,{children:[e.jsxs(Ze,{children:[e.jsx(Ge,{children:"Excel workbook ready"}),e.jsx(es,{children:_?"The workbook was generated, but your browser could not prepare a download link. Close this dialog and try exporting again.":`Your workbook is ready (${Q}). An automatic download was attempted. If it did not start, use the Download Excel link below. Your browser may ask where to save the file.`})]}),j&&e.jsx("a",{ref:M,href:j,download:l.filename,className:"inline-flex min-h-10 items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90",children:"Download Excel"}),e.jsx(ht,{children:e.jsx(o,{variant:"outline",onClick:p,children:"Close"})})]})})}const ye="all_clients_jobs.xlsx",Gt="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";async function ea(l){var O,oe,T,de;if(!l.ok){let k="";try{const $=await l.text();try{const C=JSON.parse($);
16k=typeof(C==null?void 0:C.error)=="string"?C.error:typeof(C==null?void 0:C.message)=="string"?C.message:""}catch{$&&!/^\s*</.test($)&&(k=$.trim().slice(0,300))}}catch{}throw new Error(k?`Excel export failed (${l.status}): ${k}`:`Excel export failed (HTTP ${l.status}). Please try again.`)}const p=(O=l.headers.get("Content-Type"))==null?void 0:O.split(";")[0].trim().toLowerCase();if(p!==Gt&&p!=="application/octet-stream")throw new Error("The server did not return an Excel workbook. Please try again.");const j=await l.blob();if(j.size<4)throw new Error("The Excel export was empty or incomplete. Please try again.");const A=new Uint8Array(await j.slice(0,4).arrayBuffer());if(A[0]!==80||A[1]!==75||A[2]!==3||A[3]!==4)throw new Error("The server returned an invalid Excel workbook. Please try again.");const _=l.headers.get("Content-Disposition"),F=(oe=_==null?void 0:_.match(/filename\*\s*=\s*UTF-8''([^;\s]+)/i))==null?void 0:oe[1],M=(T=_==null?void 0:_.match(/filename\s*=\s*"([^"]+)"/i))==null?void 0:T[1],Q=(de=_==null?void 0:_.match(/filename\s*=\s*([^;\s]+)/i))==null?void 0:de[1];let w=ye;try{w=(F?decodeURIComponent(F):M||Q||ye).split(/[\\/]/).pop().replace(/[\x00-\x1f\x7f]/g,"").trim()}catch{w=ye}return(!w||!w.toLowerCase().endsWith(".xlsx"))&&(w=ye),{blob:j,filename:w}}function sa({total:l,last30Days:p,last90Days:j}){return e.jsxs("div",{className:"flex flex-col items-center justify-center text-center rounded-lg border border-slate-200 dark:border-slate-700 bg-white dark:bg-slate-800 px-6 py-2.5","data-testid":"stat-interviews",children:[e.jsxs("p",{className:"flex items-center gap-1.5 text-sm text-muted-foreground leading-tight",children:[e.jsx(ss,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"}),"Interviews"]}),e.jsx("p",{className:"text-2xl font-bold text-blue-600 leading-tight","aria-label":"Total interviews",children:l}),e.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-x-3 gap-y-0.5 text-xs text-muted-foreground leading-tight","aria-label":"Recent interviews",children:[e.jsxs("span",{children:["30 days: ",p]}),e.jsxs("span",{children:["90 days: ",j]})]})]})}const ta=l=>{const[p,j,A]=l.slice(0,10).split("-").map(Number),_=new Date(p,j-1,A),F=new Date,M=new Date(F.getFullYear(),F.getMonth(),F.getDate());return Math.round((_.getTime()-M.getTime())/864e5)},aa=l=>{const[p,j,A]=l.slice(0,10).split("-").map(Number);return!p||!j||!A?"Not scheduled":new Intl.DateTimeFormat(void 0,{year:"numeric",month:"short",day:"numeric",timeZone:"UTC"}).format(new Date(Date.UTC(p,j-1,A)))},Qe=l=>l===null?{badge:"bg-gray-100 text-gray-600 dark:bg-gray-800 dark:text-gray-400",text:""}:l<70?{badge:"bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-300",text:"text-red-700 dark:text-red-300"}:l<80?{badge:"bg-yellow-100 text-yellow-700 dark:bg-yellow-900/40 dark:text-yellow-300",text:"text-yellow-700 dark:text-yellow-300"}:{badge:"bg-green-100 text-green-700 dark:bg-green-900/40 dark:text-green-300",text:"text-green-700 dark:text-green-300"};function _a(){var _s,ks,Cs,Es;const[,l]=xt(),{isImpersonating:p}=ut(),{isAdminOrOps:j}=pt((ks=(_s=As)==null?void 0:_s.currentUser)==null?void 0:ks.uid),A=jt((Es=(Cs=As)==null?void 0:Cs.currentUser)==null?void 0:Es.uid),{startUserImpersonation:_}=ft(),[F,M]=d.useState(!1),[Q,w]=d.useState(!1),[O,oe]=d.useState(!1),[T,de]=d.useState(!0),[k,$]=d.useState({column:"name",direction:"asc"}),[C,Ne]=d.useState(null),[ve,as]=d.useState(""),[Ws,rs]=d.useState(!1),[ns,_e]=d.useState(!1),[is,Bs]=d.useState(null),[ce,ls]=d.useState(null),[Y,me]=d.useState(null),[Hs,os]=d.useState(!1),[Qs,ke]=d.useState(!1),[ds,Ce]=d.useState(null),[Ee,De]=d.useState(!1),[cs,he]=d.useState(null),[xe,Se]=d.useState(null),[L,Ae]=d.useState(null),[ue,ms]=d.useState(!1),[hs,xs]=d.useState(!1),[Ys,Te]=d.useState(!1),[$e,us]=d.useState(!1),[ps,js]=d.useState(null),{toast:f}=gt(),E=wt(),{canBuySeats:Fe,canManageBilling:Xs,openAddSeats:Zs,openBillingPortal:Gs,openUpdatePaymentMethod:et,buyingSeats:pe}=bt(),{data:i,isLoading:st,error:tt}=ge({queryKey:["/api/coach/me"],queryFn:async()=>{const s=await S();if(!s)throw new Error("Not authenticated");const t=await fetch("/api/coach/me",{headers:v(s)});
16if(!t.ok)throw t.status===403?l("/coach/pending"):t.status===404&&l("/coach/register"),new Error("Failed to fetch coach info");return t.json()},retry:!1}),je=!!(i!=null&&i.self_managed)&&(i==null?void 0:i.billing_model)==="prepaid",{data:R}=ge({queryKey:["/api/coach/clients/unread-counts"],queryFn:async()=>{const s=await S();if(!s)throw new Error("Not authenticated");const t=await fetch("/api/coach/clients/unread-counts",{headers:v(s)});if(!t.ok)throw new Error("Failed to fetch unread counts");return t.json()},enabled:!!i,refetchInterval:3e4}),{data:g,isLoading:ra}=ge({queryKey:["/api/coach/stats",T],queryFn:async()=>{const s=await S();if(!s)throw new Error("Not authenticated");const t=await fetch(`/api/coach/stats?hide_below_50=${T}`,{headers:v(s)});if(!t.ok)throw new Error("Failed to fetch stats");return t.json()},enabled:!!i,refetchInterval:18e4}),{data:Me,isLoading:at}=ge({queryKey:["/api/coach/clients",O,T],queryFn:async()=>{const s=await S();if(!s)throw new Error("Not authenticated");const t=new URLSearchParams;O&&t.set("include_inactive","true"),t.set("hide_below_50",String(T));const a=t.toString(),n=await fetch(`/api/coach/clients?${a}`,{headers:v(s)});if(!n.ok)throw new Error("Failed to fetch clients");return n.json()},enabled:!!i,refetchInterval:s=>{const t=s.state.data;return t&&t.some(a=>{var n;return(((n=a.stats)==null?void 0:n.job_matches)??0)===0})?3e4:18e4}}),Oe=se({mutationFn:async({userId:s,active:t})=>{const a=await S();if(!a)throw new Error("Not authenticated");const n=await fetch(`/api/coach/clients/${s}/status`,{method:"PATCH",headers:v(a,{"Content-Type":"application/json"}),body:JSON.stringify({active:t})});if(!n.ok){const r=await n.json();throw new Error(r.error||"Failed to update client status")}return n.json()},onSuccess:(s,t)=>{E.invalidateQueries({queryKey:["/api/coach/clients"]}),E.invalidateQueries({queryKey:["/api/coach/stats"]}),f({title:t.active?"Client Reactivated":"Client Deactivated",description:t.active?"The client has been reactivated. You can now manage their profile and enable auto-apply.":"The client has been deactivated. Auto-apply and job search have been turned off."})},onError:s=>{f({variant:"destructive",title:"Error",description:s.message})}}),fs=se({mutationFn:async s=>{const t=await S();if(!t)throw new Error("Not authenticated");const a=await fetch("/api/coach/me/notifications",{method:"PATCH",headers:v(t,{"Content-Type":"application/json"}),body:JSON.stringify({enabled:s})});if(!a.ok){const n=await a.json().catch(()=>({}));throw new Error(n.error||"Failed to update notification setting")}return a.json()},onSuccess:(s,t)=>{E.invalidateQueries({queryKey:["/api/coach/me"]}),f({title:t?"Email notifications on":"Email notifications off",description:t?"You'll receive emails when our team sends you unread messages about your clients.":"You won't receive unread message emails anymore."})},onError:s=>{f({variant:"destructive",title:"Error",description:s.message})}}),X=se({mutationFn:async s=>{const t=await S();if(!t)throw new Error("Not authenticated");const a=await fetch("/api/coach/me/notifications",{method:"PATCH",headers:v(t,{"Content-Type":"application/json"}),body:JSON.stringify({additional_emails:s})});if(!a.ok){const n=await a.json().catch(()=>({}));throw new Error(n.error||"Failed to update notification emails")}return a.json()},onSuccess:s=>{E.invalidateQueries({queryKey:["/api/coach/me"]}),as(""),f({title:"Notification emails updated",description:`${(s.additional_emails??[]).length} additional email${(s.additional_emails??[]).length===1?"":"s"} will receive notifications.`})},onError:s=>{f({variant:"destructive",title:"Error",description:s.message})}}),gs=()=>{const s=ve.trim().toLowerCase();if(!s)return;if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(s)){f({variant:"destructive",title:"Invalid email",description:`"${s}" doesn't look like a valid email address.`});return}const t=(i==null?void 0:i.additional_emails)??[];if(t.includes(s)){f({variant:"destructive",title:"Already added",description:"That email is already on the list."});return}X.mutate([...t,s])},rt=s=>{const t=(i==null?void 0:i.additional_emails)??[];X.mutate(t.filter(a=>a!==s))},Z=se({mutationFn:async({userId:s,auto_apply:t})=>{const a=await S();if(!a)throw new Error("Not authenticated");const n=await fetch(`/api/coach/clients/${s}`,{method:"PUT",headers:v(a,{"Content-Type":"application/json"}),body:JSON.stringify({auto_apply:t})});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(r.error||"Failed to update auto-apply")}return n.json()},onMutate:async({userId:s,auto_apply:t})=>{await E.cancelQueries({queryKey:["/api/coach/clients"]});const a=E.getQueriesData({queryKey:["/api/coach/clients"]});return E.setQueriesData({queryKey:["/api/coach/clients"]},n=>Array.isArray(n)?n.map(r=>r.user_id===s?{...r,auto_apply:t}:r):n),{previous:a}},onError:(s,t,a)=>{if(a!=null&&a.previous)for(const[n,r]of a.previous)E.setQueryData(n,r);f({variant:"destructive",title:"Error",description:s.message})},onSuccess:(s,t)=>
16{f({title:t.auto_apply?"Auto-Apply Enabled":"Auto-Apply Disabled",description:t.auto_apply?"The client's matched jobs will now be applied to automatically.":"Auto-apply has been turned off for this client."})},onSettled:()=>{E.invalidateQueries({queryKey:["/api/coach/clients"]}),E.invalidateQueries({queryKey:["/api/coach/stats"]})}}),G=se({mutationFn:async({userId:s,settings:t})=>{const a=await S();if(!a)throw new Error("Not authenticated");const n=await fetch(`/api/coach/clients/${s}/email-settings`,{method:"PATCH",headers:v(a,{"Content-Type":"application/json"}),body:JSON.stringify(t)});if(!n.ok){const r=await n.json();throw new Error(r.error||"Failed to update email settings")}return n.json()},onMutate:async({userId:s,settings:t})=>{await E.cancelQueries({queryKey:["/api/coach/clients"]});const a=E.getQueriesData({queryKey:["/api/coach/clients"]});return E.setQueriesData({queryKey:["/api/coach/clients"]},n=>Array.isArray(n)?n.map(r=>r.user_id===s?{...r,...t}:r):n),{previous:a}},onSuccess:()=>{f({title:"Email Settings Updated",description:"The client's email preferences have been saved."})},onError:(s,t,a)=>{var n;(n=a==null?void 0:a.previous)==null||n.forEach(([r,u])=>{E.setQueryData(r,u)}),f({variant:"destructive",title:"Error",description:s.message})},onSettled:()=>{E.invalidateQueries({queryKey:["/api/coach/clients"]})}}),Pe=()=>{if(!i)return;if(i.coach_id.startsWith("admin-")){w(!0);return}i.total_seats-((g==null?void 0:g.total_clients)||0)<=0?M(!0):w(!0)},nt=async()=>{try{const s=await S();if(!s)throw new Error("Not authenticated");const t=await fetch("/api/coach/checkout-seat",{method:"POST",headers:v(s)}),a=await t.json();if(!t.ok||!a.url)throw new Error(a.error||"Unable to start checkout");window.location.assign(a.url)}catch(s){f({variant:"destructive",title:"Unable to add a seat",description:s instanceof Error?s.message:"Please try again."})}},it=async()=>{if(i){xs(!0);try{const s=await S();if(!s)throw new Error("Not authenticated");const t=await fetch("/api/coach/diagnostic",{method:"POST",headers:v(s)});if(!t.ok)throw new Error("Failed to generate diagnostic");const a=await t.json(),n=new Date().toISOString().split("T")[0],u=`${(i.full_name||"coach").replace(/[^a-zA-Z0-9_-]/g,"_")}_diagnostic_${n}.json`,D=new Blob([JSON.stringify(a,null,2)],{type:"application/json"}),N=URL.createObjectURL(D),b=document.createElement("a");b.href=N,b.download=u,document.body.appendChild(b),b.click(),document.body.removeChild(b),URL.revokeObjectURL(N),f({title:"Diagnostic downloaded",description:`${u}`})}catch(s){console.error("Diagnostic download error:",s),f({title:"Download failed",description:"Failed to generate diagnostic file.",variant:"destructive"})}finally{xs(!1)}}},lt=async s=>{try{const t=await S();if(!t)throw new Error("Not authenticated");const a=await fetch(`/api/coach/clients/${s}/jobs/export-csv`,{headers:v(t)});if(!a.ok)throw new Error("Failed to download CSV");const n=await a.blob(),r=a.headers.get("Content-Disposition"),u=r==null?void 0:r.match(/filename="(.+)"/),D=u?u[1]:"job_matches.csv",N=window.URL.createObjectURL(n),b=document.createElement("a");b.href=N,b.download=D,document.body.appendChild(b),b.click(),window.URL.revokeObjectURL(N),document.body.removeChild(b),f({title:"Download Started",description:"Your CSV file is being downloaded."})}catch(t){console.error("Error downloading CSV:",t),f({variant:"destructive",title:"Error",description:"Failed to download CSV. Please try again."})}},ot=async s=>{us(!0);try{const t=await S();if(!t)throw new Error("Not authenticated");const a=Pt(s).toString(),n=await fetch(`/api/coach/all-clients-jobs/export-xlsx${a?`?${a}`:""}`,{headers:v(t)}),r=await ea(n);js(r),Te(!1)}catch(t){console.error("Error downloading all-clients Excel export:",t),f({variant:"destructive",title:"Error",description:t instanceof Error?t.message:"Failed to download Excel export. Please try again."})}finally{us(!1)}},dt=async(s,t)=>{ls({userId:s,name:t}),me(null),Ce(null),ke(!1),os(!0),De(!1),he(null);try{const a=await S();if(!a)throw new Error("Not authenticated");const{response:n,data:r}=await Ut(`/api/coach/clients/${s}/credentials`,{headers:v(a)},{noBodyStatuses:[404]});if(n.status===404){ke(!0);const u=await fetch(`/api/coach/clients/${s}/credentials`,{method:"POST",headers:v(a)});if(!u.ok){const N=await u.json().catch(()=>({}));throw new Error(N.error||"Failed to create credentials")}const D=await u.json();me({proxy_email:D.proxy_email,password:D.password});return}if(!n.ok)throw new Error((r==null?void 0:r.error)||"Failed to fetch credentials");me(r)}catch(a){Ce(a instanceof Error?a.message:"Failed to fetch credentials")}finally{os(!1),ke(!1)}},ct=async()=>
16{if(L){ms(!0);try{const s=await S();if(!s)throw new Error("Not authenticated");const t=await fetch(`/api/coach/clients/${L.userId}/resend-weekly-rollup`,{method:"POST",headers:v(s)}),a=await t.json().catch(()=>({}));if(!t.ok||a.ok===!1)throw new Error(a.message||a.error||"Failed to resend weekly rollup");f({title:"Weekly rollup resent",description:a.message||`Email sent to ${L.email}.`}),Ae(null)}catch(s){f({variant:"destructive",title:"Failed to resend",description:s instanceof Error?s.message:"Failed to resend weekly rollup"})}finally{ms(!1)}}},mt=(()=>{const s=new Date,t=Qt(s)?s:Xt(s),a=yt(t,{weekStartsOn:1});return te(a,"MMM d, yyyy")})(),ws=async(s,t)=>{try{await navigator.clipboard.writeText(s),he(t),setTimeout(()=>he(null),2e3)}catch{f({variant:"destructive",title:"Copy Failed",description:"Could not copy to clipboard."})}},bs=[...Me??[]].sort((s,t)=>{var n,r,u,D,N,b,ee,y;const a=k.direction==="asc"?1:-1;if(k.column==="name")return a*(s.full_name||"").localeCompare(t.full_name||"");if(k.column==="total_jobs")return a*((((n=s.stats)==null?void 0:n.job_matches)??0)-(((r=t.stats)==null?void 0:r.job_matches)??0));if(k.column==="applied")return a*((((u=s.stats)==null?void 0:u.applications)??0)-(((D=t.stats)==null?void 0:D.applications)??0));if(k.column==="interviews")return a*((((N=s.stats)==null?void 0:N.interviews)??0)-(((b=t.stats)==null?void 0:b.interviews)??0));if(k.column==="median_match")return a*((((ee=s.stats)==null?void 0:ee.median_match_percentage)??-1)-(((y=t.stats)==null?void 0:y.median_match_percentage)??-1));if(k.column==="added")return a*(new Date(s.created_at).getTime()-new Date(t.created_at).getTime());if(k.column==="auto_apply")return a*((s.auto_apply?1:0)-(t.auto_apply?1:0));if(k.column==="status"){const P=s.deleted_at?0:1,K=t.deleted_at?0:1;return a*(P-K)}return 0}),ys=(s,t)=>{var a;return e.jsxs("div",{className:"flex flex-col gap-0.5 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[t?e.jsx("span",{className:"text-muted-foreground",children:s.full_name}):e.jsx(re,{href:`/coach/clients/${s.user_id}/jobs`,className:"text-primary hover:text-primary/80 hover:underline cursor-pointer",children:s.full_name}),!t&&R&&R[s.user_id]>0&&e.jsx(c,{delayDuration:0,children:e.jsxs(m,{children:[e.jsx(h,{asChild:!0,children:e.jsxs("button",{type:"button",onClick:n=>{n.preventDefault(),n.stopPropagation(),Se({userId:s.user_id,name:s.full_name})},className:"inline-flex items-center gap-1 bg-red-500 hover:bg-red-600 text-white text-[10px] font-semibold rounded-full px-1.5 h-[18px] cursor-pointer transition-colors","aria-label":`Open chat — ${R[s.user_id]} new message${R[s.user_id]===1?"":"s"}`,children:[e.jsx(ss,{className:"w-2.5 h-2.5"}),e.jsx("span",{children:"New"})]})}),e.jsx(x,{side:"top",children:e.jsxs("p",{className:"text-xs",children:[R[s.user_id]," new message",R[s.user_id]===1?"":"s"," — click to open chat"]})})]})}),t&&e.jsx(q,{variant:"outline",className:"text-[10px] px-1.5 py-0 border-red-300 text-red-400",children:"Inactive"}),!t&&!s.resume_storage_path&&(Mt(s)?e.jsx(c,{delayDuration:0,children:e.jsxs(m,{children:[e.jsx(h,{asChild:!0,children:e.jsxs("span",{className:"inline-flex items-center gap-1 text-blue-600 bg-blue-50 border border-blue-200 rounded px-1.5 py-0.5 text-xs font-medium shrink-0 cursor-default",children:[e.jsx(H,{className:"h-3 w-3"}),"Invite pending"]})}),e.jsx(x,{className:"max-w-[260px]",children:e.jsx("p",{children:"This client hasn't completed their onboarding form yet. Their profile will fill in once they finish their intake."})})]})}):e.jsxs("span",{className:"inline-flex items-center gap-1 text-amber-600 bg-amber-50 border border-amber-200 rounded px-1.5 py-0.5 text-xs font-medium shrink-0",children:[e.jsx(V,{className:"h-3 w-3"}),"No resume"]})),!t&&s.enable_auto_job_search===!1&&e.jsx(c,{delayDuration:0,children:e.jsxs(m,{children:[e.jsx(h,{asChild:!0,children:e.jsxs("span",{className:"inline-flex items-center gap-1 text-amber-600 bg-amber-50 border border-amber-200 rounded px-1.5 py-0.5 text-xs font-medium shrink-0 cursor-help","data-testid":`badge-auto-search-off-${s.user_id}`,children:[e.jsx(V,{className:"h-3 w-3"}),"Auto search off"]})}),e.jsx(x,{side:"top",className:"max-w-[260px]",children:e.jsx("p",{className:"text-xs",children:"Auto Job Search is turned off for this client, so no new job matches are being found for them. Turn it back on from their profile settings."})})]})}),!t&&s.detected_bad_resume_at&&(((a=s.stats)==null?void 0:a.job_matches_all)||0)===0&&e.jsx(c,{delayDuration:0,
16children:e.jsxs(m,{children:[e.jsx(h,{asChild:!0,children:e.jsxs("span",{className:"inline-flex items-center gap-1 text-red-600 bg-red-50 border border-red-200 rounded px-1.5 py-0.5 text-xs font-medium shrink-0 cursor-help",children:[e.jsx(V,{className:"h-3 w-3"}),"Unreadable resume"]})}),e.jsx(x,{side:"top",className:"max-w-xs",children:e.jsx("p",{className:"text-xs",children:"Our system couldn't read this resume. If we can't read it, company ATSs likely can't either — it may be an image-based or corrupted file. Please re-export and upload it again (PDF preferred)."})})]})})]}),s.email&&e.jsx("span",{className:"text-xs text-muted-foreground truncate",title:s.email,children:s.email}),(i==null?void 0:i.billing_model)==="prepaid"&&s.client_expiration_date&&e.jsxs("span",{className:"text-xs text-muted-foreground truncate",title:"This client's access expires on this date. Managed by SimpleApply.",children:["Expires ",new Date(s.client_expiration_date+"T00:00:00").toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})]})]})},Ns=(s,t)=>e.jsx(e.Fragment,{children:t?e.jsx("span",{className:"text-xs text-muted-foreground",children:"—"}):(()=>{var r;const a=Z.isPending&&((r=Z.variables)==null?void 0:r.userId)===s.user_id,n=s.min_match_percentage;return e.jsx(c,{delayDuration:0,children:e.jsxs(m,{children:[e.jsx(h,{asChild:!0,children:e.jsxs("button",{type:"button","aria-pressed":s.auto_apply,"aria-label":`Turn Auto-Apply ${s.auto_apply?"off":"on"} for ${s.full_name}`,"aria-disabled":a,disabled:a,onClick:u=>{u.preventDefault(),u.stopPropagation(),!a&&Z.mutate({userId:s.user_id,auto_apply:!s.auto_apply})},className:`inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-xs font-medium shrink-0 border transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 ${s.auto_apply?"text-green-600 bg-green-50 border-green-200 hover:bg-green-100":"text-muted-foreground bg-muted border-border hover:bg-muted/70"} ${a?"opacity-60 cursor-not-allowed":"cursor-pointer"}`,"data-testid":`badge-auto-apply-${s.user_id}`,children:[e.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${s.auto_apply?"bg-green-500":"bg-muted-foreground/60"}`}),s.auto_apply?"On":"Off"]})}),e.jsxs(x,{side:"top",className:"max-w-[240px]",children:[e.jsx("p",{className:"text-xs",children:s.auto_apply?"Auto-Apply is on — click to turn it off.":"Auto-Apply is off — click to turn it on."}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Threshold: ",n!=null?`${n}%`:"—"]})]})]})})})()}),vs=(s,t)=>{var a,n;return e.jsx(e.Fragment,{children:t?e.jsxs("div",{className:"flex items-center justify-end gap-1 flex-wrap",children:[e.jsx(c,{children:e.jsxs(m,{children:[e.jsx(h,{asChild:!0,children:e.jsx(o,{variant:"outline",size:"sm",className:"h-8",asChild:!0,"data-testid":`button-inactive-emails-${s.user_id}`,children:e.jsxs(re,{href:`/coach/clients/${s.user_id}/emails`,children:[e.jsx(H,{className:"w-4 h-4 mr-1"}),"Email Inbox"]})})}),e.jsx(x,{children:e.jsx("p",{children:"View this client's email inbox (read-only)"})})]})}),e.jsx(c,{children:e.jsxs(m,{children:[e.jsx(h,{asChild:!0,children:e.jsxs(o,{variant:"outline",size:"sm",className:"h-8",disabled:Oe.isPending,onClick:()=>Oe.mutate({userId:s.user_id,active:!0}),children:[e.jsx(Lt,{className:"w-4 h-4 mr-1"}),"Reactivate"]})}),e.jsx(x,{children:e.jsx("p",{children:"Reactivate this client"})})]})})]}):e.jsxs("div",{className:"flex items-center justify-end gap-1 flex-wrap",children:[!p&&(()=>{const r=(R==null?void 0:R[s.user_id])??0;return e.jsx(c,{children:e.jsxs(m,{children:[e.jsx(h,{asChild:!0,children:e.jsxs(o,{size:"sm",onClick:()=>Se({userId:s.user_id,name:s.full_name}),className:`h-8 gap-1.5 relative bg-orange-500 hover:bg-orange-600 text-white ${r>0?"ring-1 ring-red-400/40":""}`,children:[e.jsx(ss,{className:"w-4 h-4"}),e.jsx("span",{className:"text-xs",children:"Chat with Support"}),r>0&&e.jsx("span",{className:"absolute -top-1.5 -right-1.5 inline-flex items-center justify-center bg-red-500 text-white text-[10px] font-bold rounded-full min-w-[18px] h-[18px] px-1 shadow-sm",children:r})]})}),e.jsx(x,{side:"top",className:"max-w-[220px] text-center",children:r>0?e.jsxs("p",{children:[r," new message",r===1?"":"s"," — click to open chat with our support team about this client."]}):e.jsx("p",{children:"Chat with our support team about this client — resume reviews, job market research, and full client reviews."})})]})})})(),e.jsx(o,{asChild:!0,variant:"outline",size:"sm",className:"h-8",children:e.jsxs(re,{href:`/coach/clients/${s.user_id}/jobs`,children:[e.jsx(Jt,{className:"w-4 h-4 mr-1"}),"Jobs"]})}),e.jsx(o,{asChild:!0,variant:"outline",size:"sm",className:"h-8",children:e.jsxs(re,{href:`/coach/clients/${s.user_id}`,children:[e.jsx(Wt,{className:"w-4 h-4 mr-1"}),"Edit"]})}),p&&((a=A.data)==null?void 0:a.hasAccess)&&e.jsx(o,{variant:"outline",size:"sm",onClick:()=>{sessionStorage.setItem("impersonationReturnPath","/admin/coaches/wonsulting"),_(s.user_id,s.full_name||s.email||"Client")},children:"View as client"}),j&&(p||((n=i==null?void 0:i.coach_id)==null?void 0:n.startsWith("admin-")))&&e.jsx(c,{children:e.jsxs(m,{children:[e.jsx(h,{asChild:!0,children:e.jsxs(o,{variant:"outline",size:"sm",className:"h-8",onClick:()=>l(`/admin/clients/${s.user_id}/interviews`),children:[e.jsx(Kt,{className:"w-4 h-4 mr-1"}),"Interviews"]})}),e.jsx(x,{side:"top",className:"max-w-[220px] text-center",children:e.jsx("p",{children:"Staff only — link interview emails to jobs for this client"})})]})}),e.jsxs(Ue,{children:[e.jsx(ze,{asChild:!0,children:e.jsxs(o,{variant:"outline",size:"sm",className:"h-8",children:["More",e.jsx(we,{className:"w-3.5 h-3.5 ml-1"})]})}),e.jsxs(Ie,{align:"end",collisionPadding:12,className:"w-64 max-h-[70vh] overflow-y-auto",children:[e.jsxs(W,{onClick:()=>
16lt(s.user_id),children:[e.jsx(Ps,{className:"w-4 h-4 mr-2"}),"Download CSV"]}),e.jsxs(W,{onClick:()=>dt(s.user_id,s.full_name),children:[e.jsx(Vs,{className:"w-4 h-4 mr-2"}),"View Credentials"]}),e.jsxs(W,{onClick:()=>Ae({userId:s.user_id,name:s.full_name,email:s.email}),children:[e.jsx(H,{className:"w-4 h-4 mr-2"}),"Resend Weekly Rollup"]}),e.jsx(ae,{}),e.jsxs("div",{className:"flex items-center justify-between px-2 py-2","data-testid":`row-auto-apply-${s.user_id}`,children:[e.jsxs("span",{className:"text-sm flex items-center gap-1",children:["Auto-Apply",e.jsx(c,{delayDuration:0,children:e.jsxs(m,{children:[e.jsx(h,{asChild:!0,children:e.jsx(J,{className:"w-3.5 h-3.5 text-muted-foreground cursor-help"})}),e.jsx(x,{side:"top",className:"max-w-[220px]",children:e.jsx("p",{className:"text-xs",children:"Automatically apply to matched jobs on this client's behalf"})})]})})]}),e.jsx(ne,{checked:s.auto_apply,disabled:Z.isPending,onCheckedChange:r=>Z.mutate({userId:s.user_id,auto_apply:r}),"data-testid":`switch-auto-apply-${s.user_id}`,className:s.auto_apply?"data-[state=checked]:bg-green-500":"data-[state=unchecked]:bg-red-400"})]}),e.jsx(ae,{}),e.jsxs("button",{type:"button",className:"w-full flex items-center justify-between px-2 py-2 text-sm font-semibold hover:bg-accent rounded-sm",onClick:()=>Bs(r=>r===s.user_id?null:s.user_id),"data-testid":`button-toggle-email-settings-${s.user_id}`,children:[e.jsx("span",{children:"Email Notifications"}),e.jsx(we,{className:`w-4 h-4 text-muted-foreground transition-transform ${is===s.user_id?"rotate-180":""}`})]}),is===s.user_id&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between px-2 py-2",children:[e.jsxs("span",{className:"text-sm flex items-center gap-1",children:["Application Emails",e.jsx(c,{delayDuration:0,children:e.jsxs(m,{children:[e.jsx(h,{asChild:!0,children:e.jsx(J,{className:"w-3.5 h-3.5 text-muted-foreground cursor-help"})}),e.jsx(x,{side:"top",className:"max-w-[220px]",children:e.jsx("p",{className:"text-xs",children:"Forward application confirmation emails to the client when jobs are successfully applied to"})})]})})]}),e.jsx(ne,{checked:s.enable_forward_confirmation_emails,onCheckedChange:r=>G.mutate({userId:s.user_id,settings:{enable_forward_confirmation_emails:r}}),className:s.enable_forward_confirmation_emails?"data-[state=checked]:bg-green-500":"data-[state=unchecked]:bg-red-400"})]}),e.jsxs("div",{className:"flex items-center justify-between px-2 py-2",children:[e.jsxs("span",{className:"text-sm flex items-center gap-1",children:["Rejection Emails",e.jsx(c,{delayDuration:0,children:e.jsxs(m,{children:[e.jsx(h,{asChild:!0,children:e.jsx(J,{className:"w-3.5 h-3.5 text-muted-foreground cursor-help"})}),e.jsx(x,{side:"top",className:"max-w-[220px]",children:e.jsx("p",{className:"text-xs",children:"Forward rejection/not-selected emails to the client when received from employers"})})]})})]}),e.jsx(ne,{checked:s.enable_forward_rejection_emails,onCheckedChange:r=>G.mutate({userId:s.user_id,settings:{enable_forward_rejection_emails:r}}),className:s.enable_forward_rejection_emails?"data-[state=checked]:bg-green-500":"data-[state=unchecked]:bg-red-400"})]}),e.jsxs("div",{className:"flex items-center justify-between px-2 py-2",children:[e.jsxs("span",{className:"text-sm flex items-center gap-1",children:["Weekly Rollup",e.jsx(c,{delayDuration:0,children:e.jsxs(m,{children:[e.jsx(h,{asChild:!0,children:e.jsx(J,{className:"w-3.5 h-3.5 text-muted-foreground cursor-help"})}),e.jsx(x,{side:"top",className:"max-w-[220px]",children:e.jsx("p",{className:"text-xs",children:"Send the client a rollup summary email with their job search activity and results. Cadence configurable below."})})]})})]}),e.jsx(ne,{checked:s.notice_coach_client_weekly_report_enabled,onCheckedChange:r=>G.mutate({userId:s.user_id,settings:{notice_coach_client_weekly_report_enabled:r}}),className:s.notice_coach_client_weekly_report_enabled?"data-[state=checked]:bg-green-500":"data-[state=unchecked]:bg-red-400"})]}),s.notice_coach_client_weekly_report_enabled&&e.jsxs("div",{className:"px-2 py-2 ml-4",children:[e.jsxs("div",{className:"flex items-center gap-1 mb-1.5",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Cadence"}
16),e.jsx(c,{delayDuration:0,children:e.jsxs(m,{children:[e.jsx(h,{asChild:!0,children:e.jsx(J,{className:"w-3 h-3 text-muted-foreground cursor-help"})}),e.jsx(x,{side:"top",className:"max-w-[220px]",children:e.jsx("p",{className:"text-xs",children:"How often the rollup report email is sent to this client"})})]})})]}),e.jsxs(Us,{value:s.notice_coach_client_weekly_report_frequency||"weekly",onValueChange:r=>G.mutate({userId:s.user_id,settings:{notice_coach_client_weekly_report_frequency:r}}),children:[e.jsx(zs,{className:"h-7 text-xs mb-2","data-testid":`select-rollup-cadence-${s.user_id}`,children:e.jsx(Is,{})}),e.jsxs(qs,{children:[e.jsx(ie,{value:"weekly",children:e.jsx("span",{className:"text-xs",children:"Weekly"})}),e.jsx(ie,{value:"daily",children:e.jsx("span",{className:"text-xs",children:"Daily"})})]})]}),e.jsxs("div",{className:"flex items-center gap-1 mb-1.5",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Report includes"}),e.jsx(c,{delayDuration:0,children:e.jsxs(m,{children:[e.jsx(h,{asChild:!0,children:e.jsx(J,{className:"w-3 h-3 text-muted-foreground cursor-help"})}),e.jsxs(x,{side:"top",className:"max-w-[250px]",children:[e.jsx("p",{className:"text-xs font-medium mb-1",children:"Controls which jobs appear in the weekly CSV report:"}),e.jsxs("ul",{className:"text-xs space-y-0.5 list-disc ml-3",children:[e.jsxs("li",{children:[e.jsx("span",{className:"font-medium",children:"Applied only"})," — Successfully applied jobs"]}),e.jsxs("li",{children:[e.jsx("span",{className:"font-medium",children:"Applied & failed"})," — Applied + failed attempts"]}),e.jsxs("li",{children:[e.jsx("span",{className:"font-medium",children:"All matched"})," — Every matched job whether applied or not"]})]})]})]})})]}),e.jsxs(Us,{value:s.notice_coach_client_weekly_report_csv_filter||"completed_only",onValueChange:r=>G.mutate({userId:s.user_id,settings:{notice_coach_client_weekly_report_csv_filter:r}}),children:[e.jsx(zs,{className:"h-7 text-xs",children:e.jsx(Is,{})}),e.jsxs(qs,{children:[e.jsx(ie,{value:"completed_only",children:e.jsx("span",{className:"text-xs",children:"Applied only"})}),e.jsx(ie,{value:"completed_and_failed",children:e.jsx("span",{className:"text-xs",children:"Applied & failed"})}),e.jsx(ie,{value:"all",children:e.jsx("span",{className:"text-xs",children:"All matched jobs"})})]})]})]})]}),e.jsx(ae,{}),e.jsx(W,{asChild:!0,"data-testid":`button-client-emails-${s.user_id}`,className:"font-medium focus:bg-accent cursor-pointer py-2",children:e.jsxs(re,{href:`/coach/clients/${s.user_id}/emails`,children:[e.jsx(H,{className:"w-4 h-4 mr-2 text-blue-500"}),e.jsx("span",{className:"flex-1",children:"Email Inbox"}),e.jsx(At,{className:"w-4 h-4 ml-2 text-muted-foreground"})]})}),e.jsx(ae,{}),e.jsxs(W,{onClick:()=>Ne(s),className:"text-red-600 focus:text-red-600",children:[e.jsx(Rt,{className:"w-4 h-4 mr-2"}),"Deactivate"]})]})]})]})})};return st?e.jsx("div",{className:"min-h-screen flex items-center justify-center",children:e.jsx(I,{className:"w-8 h-8 animate-spin text-muted-foreground"})}):tt||!i?null:e.jsx("div",{className:"min-h-screen bg-slate-50 dark:bg-slate-900",children:e.jsxs("main",{className:"w-full px-4 sm:px-6 lg:px-8 py-8",children:[e.jsxs("div",{className:"mb-8 flex flex-wrap items-center gap-6",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-2xl font-bold mb-2",children:["Welcome back, ",i.full_name.split(" ")[0],"!"]}),e.jsx("p",{className:"text-sm text-muted-foreground","data-testid":"text-coach-email",children:i.email}),e.jsx("p",{className:"text-muted-foreground",children:"Manage your clients and track their job applications."})]}),e.jsxs("div",{className:"flex flex-wrap items-stretch gap-3",children:[e.jsxs("div",{className:"flex flex-col items-center justify-center text-center rounded-lg border border-slate-200 dark:border-slate-700 bg-white dark:bg-slate-800 px-6 py-2.5","data-testid":"stat-clients",children:[e.jsxs("p",{className:"flex items-center gap-1.5 text-sm text-muted-foreground leading-tight",children:[e.jsx(Ts,{className:"w-4 h-4 text-blue-600 dar
16k:text-blue-400"}),"Clients"]}),e.jsxs("p",{className:"text-2xl font-bold leading-tight",children:[(g==null?void 0:g.total_clients)||0,!i.coach_id.startsWith("admin-")&&e.jsxs("span",{className:"text-base font-normal text-muted-foreground",children:[" / ",i.total_seats]})]}),i.coach_id.startsWith("admin-")?e.jsx("p",{className:"text-xs text-muted-foreground leading-tight",children:"Unlimited clients"}):((g==null?void 0:g.total_clients)||0)>i.total_seats?e.jsx("p",{className:"text-xs text-amber-600 dark:text-amber-400 leading-tight","data-testid":"text-over-cap-notice",children:"Over seat limit — archive a client to add a new one."}):e.jsxs("p",{className:"text-xs text-muted-foreground leading-tight",children:[Math.max(0,i.total_seats-((g==null?void 0:g.total_clients)||0))," slots available",!p&&i.self_managed&&(i.free_seats??0)>0&&e.jsxs(e.Fragment,{children:[" "," · ",i.free_seats," free + ",i.paid_seats??0," paid"]})]})]}),e.jsx(sa,{total:(g==null?void 0:g.total_interviews)??0,last30Days:(g==null?void 0:g.total_interviews_30d)??0,last90Days:(g==null?void 0:g.total_interviews_90d)??0})]}),!p&&e.jsx("div",{className:"ml-auto self-center rounded-lg border border-slate-200 bg-white px-4 py-3 dark:border-slate-700 dark:bg-slate-800",children:je?e.jsxs("div",{className:"flex max-w-xs items-start gap-2.5",children:[e.jsx("span",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-blue-100 dark:bg-blue-900/40",children:e.jsx(Nt,{className:"h-5 w-5 text-blue-600 dark:text-blue-400"})}),e.jsxs("span",{className:"flex flex-col items-start leading-snug",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"Billing"}),e.jsx("span",{className:"font-semibold","data-testid":"text-prepaid-seats",children:"Prepaid seats"}),e.jsx("span",{className:"mt-0.5 text-xs text-muted-foreground",children:"Check your clients for their individual expiration dates."})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("span",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-blue-100 dark:bg-blue-900/40",children:e.jsx(vt,{className:"h-5 w-5 text-blue-600 dark:text-blue-400"})}),e.jsxs("span",{className:"flex flex-col items-start leading-snug",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"Account renewal date"}),e.jsx("span",{className:"font-semibold","data-testid":"text-account-renewal-date",children:i.next_billing_date?aa(i.next_billing_date):"Not scheduled"}),i.payment_failed_at&&e.jsx(q,{variant:"destructive",className:"mt-1 text-[10px]","data-testid":"badge-payment-failed",children:"Payment failed"})]})]}),i.payment_failed_at&&e.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-400","data-testid":"text-payment-failed-notice",children:"We couldn't charge your card. Your renewal date won't change until it's fixed."}),Xs&&e.jsxs(o,{type:"button",size:"sm",variant:"link",className:"mt-1 h-7 w-full justify-start px-0 text-xs",onClick:i.payment_failed_at?et:Gs,disabled:pe,"data-testid":"button-manage-subscription",children:[pe?e.jsx(I,{className:"mr-1.5 h-3 w-3 animate-spin"}):e.jsx(le,{className:"mr-1.5 h-3 w-3"}),i.payment_failed_at?"Update payment method":"View subscription in Stripe"]})]})})]}),e.jsx($s,{className:"mb-8","data-testid":"card-coach-toolkit",children:e.jsx(Fs,{className:"py-4",children:e.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-center gap-4",children:[e.jsxs("div",{className:"lg:w-52 lg:shrink-0",children:[e.jsx("h3",{className:"font-semibold",children:"Coach Toolkit"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Walkthrough, marketing materials, and client onboarding."})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-4 gap-3 flex-1",children:[e.jsxs("a",{href:"https://www.loom.com/share/e50a057026e74bb580357ae07ed949d2",target:"_blank",rel:"noopener noreferrer",className:"group flex items-start gap-3 p-4 rounded-lg border border-slate-200 dark:border-slate-700 hover:border-blue-500 hover:bg-blue-50/50 dark:hover:bg-blue-950/20 transition-colors","data-testid":"link-toolkit-loom",children:[e.jsx("div",{className:"w-10 h-10 bg-blue-100 dar
16k:bg-blue-900 rounded-lg flex items-center justify-center shrink-0",children:e.jsx(Bt,{className:"w-5 h-5 text-blue-600 dark:text-blue-400"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("p",{className:"font-medium text-sm",children:"Loom Walkthrough"}),e.jsx(le,{className:"w-3 h-3 text-muted-foreground group-hover:text-blue-600"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Video tour of the platform."})]})]}),e.jsxs("a",{href:"https://docs.google.com/document/d/1--pgU6jQEND8wVOeglVCUd4LUb6X1enZJX4ymxisDsk/edit?usp=sharing",target:"_blank",rel:"noopener noreferrer",className:"group flex items-start gap-3 p-4 rounded-lg border border-slate-200 dark:border-slate-700 hover:border-blue-500 hover:bg-blue-50/50 dark:hover:bg-blue-950/20 transition-colors","data-testid":"link-toolkit-marketing-doc",children:[e.jsx("div",{className:"w-10 h-10 bg-indigo-100 dark:bg-indigo-900 rounded-lg flex items-center justify-center shrink-0",children:e.jsx(Ms,{className:"w-5 h-5 text-indigo-600 dark:text-indigo-400"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("p",{className:"font-medium text-sm",children:"Marketing & Sales Doc"}),e.jsx(le,{className:"w-3 h-3 text-muted-foreground group-hover:text-blue-600"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Talking points for client conversations."})]})]}),e.jsxs("button",{type:"button",onClick:()=>rs(!0),className:"group flex items-start gap-3 p-4 rounded-lg border border-slate-200 dark:border-slate-700 hover:border-blue-500 hover:bg-blue-50/50 dark:hover:bg-blue-950/20 transition-colors text-left","data-testid":"link-toolkit-client-emails",children:[e.jsx("div",{className:"w-10 h-10 bg-amber-100 dark:bg-amber-900 rounded-lg flex items-center justify-center shrink-0",children:e.jsx(H,{className:"w-5 h-5 text-amber-600 dark:text-amber-400"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"flex items-center gap-1.5",children:e.jsx("p",{className:"font-medium text-sm",children:"Client Emails and Explanations"})}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Videos on client emails: one for you, one to send clients."})]})]}),e.jsxs("button",{type:"button",onClick:Pe,className:"group flex items-start gap-3 p-4 rounded-lg border border-slate-200 dark:border-slate-700 hover:border-blue-500 hover:bg-blue-50/50 dark:hover:bg-blue-950/20 transition-colors text-left","data-testid":"link-toolkit-onboarding-sheet",children:[e.jsx("div",{className:"w-10 h-10 bg-emerald-100 dark:bg-emerald-900 rounded-lg flex items-center justify-center shrink-0",children:e.jsx(Js,{className:"w-5 h-5 text-emerald-600 dark:text-emerald-400"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"flex items-center gap-1.5",children:e.jsx("p",{className:"font-medium text-sm",children:"Client Onboarding"})}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Add a client: invite by email or share a link."})]})]})]})]})})}),e.jsx(Ye,{open:Ws,onOpenChange:s=>{rs(s),s||_e(!1)},children:e.jsxs(Xe,{className:"max-w-2xl max-h-[90vh] overflow-y-auto","data-testid":"dialog-client-emails",children:[e.jsxs(Ze,{children:[e.jsx(Ge,{children:"Client Emails and Explanations"}),e.jsx(es,{children:"Use the coach link for your own walkthrough. Send the client link directly to clients."})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-lg border border-slate-200 p-4 dark:border-slate-700",children:[e.jsx("p",{className:"font-medium text-sm",children:"Coach walkthrough — for you"}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Explains the client-email process so you know what your clients will receive."}),e.jsx(o,{asChild:!0,variant:"outline",size:"sm",className:"mt-3",children:e.jsxs("a",{href:"https://www.loom.com/share/0a5d4e45fc1549c3b7127e3cc9bbd0b9",target:"_blank",rel:"noopener noreferrer","data-testid":"link-coach-email-video",children:["Open coach video",e.jsx(le,{className:"ml-1.5 h-3.5 w-3.5"})]})})]}),e.jsxs("div",{className:"rounded-lg border border-slate-200 p-4 dark:border-slate-700",children:[e.jsx("div",{className:"flex flex-wrap items-center justify-between gap-3",children:e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"font-medium text-sm",children:"Client explanation — send to your clients"}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Explains the emails from the client's perspective. It has no SimpleApply branding and is safe to share directly."})]})}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[e.jsx(o,{asChild:!0,variant:"outline",size:"sm",children:e.jsxs("a",{href:"https://www.loom.com/share/b8c70ae507424b6186b164971deb1a88",target:"_blank",rel:"noopener noreferrer","data-testid":"link-cl
16ient-email-video",children:["Open client video",e.jsx(le,{className:"ml-1.5 h-3.5 w-3.5"})]})}),e.jsxs(o,{variant:"outline",size:"sm",onClick:async()=>{try{await navigator.clipboard.writeText("https://www.loom.com/share/b8c70ae507424b6186b164971deb1a88"),_e(!0),setTimeout(()=>_e(!1),2e3)}catch{f({title:"Couldn't copy link",description:"Copy it manually: loom.com/share/b8c70ae507424b6186b164971deb1a88",variant:"destructive"})}},"data-testid":"button-copy-client-video-link",children:[ns?e.jsx(Le,{className:"w-3.5 h-3.5 mr-1.5"}):e.jsx(Re,{className:"w-3.5 h-3.5 mr-1.5"}),ns?"Copied":"Copy client link"]})]})]})]})]})}),e.jsxs($s,{children:[e.jsxs(_t,{className:"flex flex-col gap-4 space-y-0 lg:flex-row lg:items-center lg:justify-between",children:[e.jsxs("div",{children:[e.jsx(kt,{children:"Your Clients"}),e.jsx(Ct,{children:"Manage profiles and track applications"})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-3",children:[!i.coach_id.startsWith("admin-")&&e.jsxs(Ue,{children:[e.jsx(ze,{asChild:!0,children:e.jsxs(o,{variant:"outline",size:"sm","data-testid":"button-email-notifications-menu",children:[e.jsx(H,{className:"w-4 h-4 mr-1.5"}),"Emails",e.jsx(we,{className:"w-3.5 h-3.5 ml-1"})]})}),e.jsxs(Ie,{align:"end",className:"w-80 max-h-[70vh] overflow-y-auto",children:[e.jsx(Os,{children:"Email Notifications"}),e.jsxs("div",{className:"flex items-center justify-between px-2 py-2",children:[e.jsxs("span",{className:"flex items-center gap-1 text-sm",children:["Unread message emails",e.jsx(c,{delayDuration:0,children:e.jsxs(m,{children:[e.jsx(h,{asChild:!0,children:e.jsx(J,{className:"w-3.5 h-3.5 text-muted-foreground cursor-help"})}),e.jsx(x,{side:"bottom",className:"max-w-xs",children:"When our team sends you messages about your clients — questions or feedback on their job search — we'll email you a summary of anything you haven't read yet. Turn this off to stop those emails."})]})})]}),e.jsx(ne,{checked:i.unread_messages_notifications_enabled!==!1,disabled:fs.isPending,onCheckedChange:s=>fs.mutate(s),"data-testid":"switch-email-notifications"})]}),e.jsx(ae,{}),e.jsxs(Os,{className:"flex items-center gap-1",children:["Additional Emails",e.jsx(c,{delayDuration:0,children:e.jsxs(m,{children:[e.jsx(h,{asChild:!0,children:e.jsx(J,{className:"w-3.5 h-3.5 text-muted-foreground cursor-help"})}),e.jsx(x,{side:"bottom",className:"max-w-xs",children:"Other email addresses that should also receive your coach notification emails."})]})})]}),(i.additional_emails??[]).length===0?e.jsx("p",{className:"px-2 pb-2 text-xs text-muted-foreground",children:"No additional emails yet."}):e.jsx("div",{className:"px-2 pb-1 space-y-1",children:(i.additional_emails??[]).map(s=>e.jsxs("div",{className:"flex items-center justify-between gap-2 text-sm",children:[e.jsx("span",{className:"truncate",title:s,children:s}),e.jsx(o,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 shrink-0 text-muted-foreground hover:text-red-600",disabled:X.isPending,onClick:()=>rt(s),"data-testid":`button-remove-email-${s}`,"aria-label":`Remove ${s}`,children:e.jsx(It,{className:"w-4 h-4"})})]},s))}),e.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-2",children:[e.jsx(Et,{type:"email",placeholder:"[email protected]",value:ve,onChange:s=>as(s.target.value),onKeyDown:s=>{s.key==="Enter"&&(s.preventDefault(),gs()),s.stopPropagation()},className:"h-8 text-sm","data-testid":"input-additional-email"}),e.jsx(o,{size:"sm",className:"h-8",disabled:X.isPending||!ve.trim(),onClick:gs,"data-testid":"button-add-additional-email",children:X.isPending?e.jsx(I,{className:"w-4 h-4 animate-spin"}):"Add"})]})]})]}),e.jsxs(Ue,{children:[e.jsx(ze,{asChild:!0,children:e.jsxs(o,{variant:"outline",size:"sm",disabled:hs||$e,"data-testid":"button-coach-download-menu",children:[hs||$e?e.jsx(I,{className:"w-4 h-4 mr-2 animate-spin"}):e.jsx(Ps,{className:"w-4 h-4 mr-2"}),"Download",e.jsx(we,{className:"w-4 h-4 ml-2"})]})}),e.jsxs(Ie,{align:"end",children:[e.jsxs(W,{onClick:it,"data-testid":"menuitem-download-diagnostic",children:[e.jsx(Ms,{className:"w-4 h-4 mr-2"}),"Diagnostic"]}),e.jsxs(W,{onClick:()=>Te(!0),"data-testid":"menuitem-download-jobs-excel",children:[e.jsx(Js,{className:"w-4 h-4 mr-2"}),"Client jobs (Excel)"]})]})]}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"Hide < 60%"}),e.jsx("button",{type:"button",role:"switch","aria-checked":T,onClick:()=>de(!T),className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors ${T?"bg-primary":"bg-muted-foreground
16/30"}`,children:e.jsx("span",{className:`inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform ${T?"translate-x-[18px]":"translate-x-[3px]"}`})})]}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"Show inactive"}),e.jsx("button",{type:"button",role:"switch","aria-checked":O,onClick:()=>oe(!O),className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors ${O?"bg-primary":"bg-muted-foreground/30"}`,children:e.jsx("span",{className:`inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform ${O?"translate-x-[18px]":"translate-x-[3px]"}`})})]}),e.jsxs(o,{onClick:Pe,children:[e.jsx(Ls,{className:"w-4 h-4 mr-2"}),"Add Client"]})]})]}),e.jsx(Fs,{children:at?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(I,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):Me&&Me.length>0?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-3 md:hidden",children:bs.map(s=>{var a,n,r,u,D,N;const t=!!s.deleted_at;return e.jsxs("div",{className:`rounded-lg border border-border bg-card p-4 ${t?"opacity-60":""}`,"data-testid":`card-client-${s.user_id}`,children:[ys(s,t),s.job_title&&e.jsx("p",{className:"text-sm text-muted-foreground truncate mt-1",children:s.job_title}),e.jsxs("div",{className:"grid grid-cols-3 gap-2 mt-3",children:[e.jsxs("div",{className:"rounded-md bg-muted/50 px-2 py-1.5 text-center",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:"Jobs"}),e.jsxs("p",{className:"text-sm",children:[e.jsx("span",{className:"font-medium",children:((a=s.stats)==null?void 0:a.job_matches)||0}),e.jsxs("span",{className:"text-muted-foreground text-xs",children:[" | ",((n=s.stats)==null?void 0:n.job_matches_last_30d)||0]})]}),((r=s.stats)==null?void 0:r.median_match_percentage)!=null&&e.jsxs(q,{className:`${Qe(s.stats.median_match_percentage).badge} text-[10px] px-1 py-0 mt-0.5`,children:[s.stats.median_match_percentage,"%"]})]}),e.jsxs("div",{className:"rounded-md bg-muted/50 px-2 py-1.5 text-center",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:"Applied"}),e.jsxs("p",{className:"text-sm",children:[e.jsx("span",{className:"font-medium",children:((u=s.stats)==null?void 0:u.applications)||0}),e.jsxs("span",{className:"text-muted-foreground text-xs",children:[" | ",((D=s.stats)==null?void 0:D.applied_last_30d)||0]})]})]}),e.jsxs("div",{className:"rounded-md bg-muted/50 px-2 py-1.5 text-center",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:"Interviews"}),e.jsx("p",{className:"text-sm font-medium",children:((N=s.stats)==null?void 0:N.interviews)||0})]})]}),e.jsxs("div",{className:"flex items-center justify-between gap-2 mt-3 text-xs text-muted-foreground",children:[e.jsxs("span",{className:"truncate",children:["Added ",te(new Date(s.created_at),"MMM d, yyyy"),s.client_expiration_date?` · Expires ${te(new Date(s.client_expiration_date+"T00:00:00"),"MMM d, yyyy")}`:""]}),e.jsxs("span",{className:"flex items-center gap-1.5 shrink-0",children:["Auto-Apply ",Ns(s,t)]})]}),e.jsx("div",{className:"mt-3 pt-3 border-t border-border",children:vs(s,t)})]},s.user_id)})}),e.jsx("div",{className:"hidden md:block",children:e.jsxs(Tt,{className:"table-auto",children:[e.jsx($t,{children:e.jsxs(Rs,{children:[e.jsx(U,{className:"px-2 sticky left-0 z-20 bg-card",children:e.jsxs(o,{variant:"ghost",size:"sm",className:"h-auto p-0 font-medium hover:bg-transparent",onClick:()=>$(s=>({column:"name",direction:s.column==="name"&&s.direction==="asc"?"desc":"asc"})),children:["Name",e.jsx(B,{className:"w-3 h-3 ml-1 opacity-50"})]})}),e.jsx(U,{className:"px-2",children:"Job Title"}),e.jsx(U,{className:"px-2 text-center",children:e.jsxs(o,{variant:"ghost",size:"sm",className:"h-auto p-0 font-medium hover:bg-transparent mx-auto",onClick:()=>$(s=>({column:"total_jobs",direction:s.column==="total_jobs"&&s.direction==="desc"?"asc":"desc"})),children:[e.jsxs("div",{className:"text-center",children:[e.jsx("div",{children:"Total Jobs"}),e.jsx("div",{className:"text-xs font-normal text-muted-foreground",children:"All | 30d · Match"})]}),e.jsx(B,{className:"w-3 h-3 ml-1 opacity-50 shrink-0"})]})}),e.jsx(U,{className:"px-2",children:e.jsxs(o,{variant:"ghost",size:"sm",className:"h-auto p-0 font-medium hover:bg-transparent",onClick:()=>$(s=>({column:"applied",direction:s.column==="applied"&&s.direction==="desc"?"asc":"desc"})),children:[e.jsxs("div",{className:"text-left",children:[e.jsx("div",{children:"Applied"}),e.jsx("div",{className:"text-xs font-normal text-muted-foreground",children:"All | 30d"})]}),e.jsx(B,{className:"w-3 h-3 ml-1 opacity-50 shrink-0"})]})}),e.jsx(U,{className:"px-2 text-center",children:e.jsxs(o,{variant:"ghost",size:"sm",className:"h-auto p-0 font-medium hover:bg-transparent",onClick:()=>$(s=>({column:"interviews",direction:s.column==="interviews"&&s.direction==="desc"?"asc":"desc"})),children:["Interviews",e.jsx(B,{className:"w-3 h-3 ml-1 opacity-50"})]})}),e.jsx(U,{className:"px-2",children:e.jsxs(o,{variant:"ghost",size:"sm",className:"h-auto p-0 font-medium hover:bg-transparent",onClick:()=>$(s=>({column:"added",direction:s.column==="added"&&s.direction==="desc"?"asc":"desc"})),children:["Added",e.jsx(B,{className:"w-3 h-3 ml-1 opacity-50"})]})}),e.jsx(U,{className:"px-2",children:e.jsxs(o,{variant:"ghost",size:"sm",className:"h-auto p-0 font-medium hover:bg-transparent",onClick:()=>$(s=>({column:"auto_apply",direction:s.column==="auto_apply"&&s.direction==="desc"?"asc":"desc"})),children:["Auto-Apply",e.jsx(B,{className:"w-3 h-3 ml-1 opacity-50"})]})}),O&&e.jsx(U,{className:"px-2",children:e.jsxs(o,{variant:"ghost",size:"sm",className:"h-auto p-0 font-medium hover:bg-transparent",onClick:()=>$(s=>({column:"status",direction:s.column==="status"&&s.direction==="asc"?"desc":"asc"})),children:["Status ",k.column==="status"&&e.jsx(B,{className:"ml-1 h-3 w-3 inline"})]})}),e.jsx(U,{className:"px-2 text-right sticky right-0 z-20 bg-card",children:"Actions"})]})}),e.jsx(Ft,{children:bs.map(s=>{var a,n,r,u,D,N,b,ee;const t=!!s.deleted_at;return e.jsxs(Rs,{className:`[&>td]:py-6 [&>td]:px-2 text-base ${t?"opacity-50":""}`,children:[e.jsx(z,{className:"font-medium align-top sticky left-0 z-10 bg-card",children:ys(s,t)}),e.jsx(z,{className:"align-top max-w-[200px]",children:s.job_title?(()=>{const y=s.job_title.split(",").map(fe=>
16fe.trim()).filter(Boolean);if(y.length===0)return"-";const P=y[0],K=y.length-1;return K<=0?e.jsx("span",{className:"block truncate",children:P}):e.jsx(c,{delayDuration:0,children:e.jsxs(m,{children:[e.jsx(h,{asChild:!0,children:e.jsxs("span",{className:"cursor-help flex items-center gap-1.5 min-w-0","data-testid":`tooltip-job-titles-${s.user_id}`,children:[e.jsx("span",{className:"truncate",children:P}),e.jsxs("span",{className:"inline-flex items-center rounded-full bg-muted text-muted-foreground border border-border px-1.5 py-0 text-[10px] font-medium leading-4 shrink-0",children:["+",K]})]})}),e.jsx(x,{side:"top",className:"max-w-xs",children:e.jsx("p",{className:"text-xs",children:y.join(", ")})})]})})})():"-"}),e.jsx(z,{className:"align-top text-center",children:e.jsxs("div",{className:"flex flex-col items-center gap-1",children:[e.jsxs("div",{children:[e.jsx("span",{className:"font-medium",children:((a=s.stats)==null?void 0:a.job_matches)||0}),e.jsxs("span",{className:"text-muted-foreground text-xs",children:[" | ",((n=s.stats)==null?void 0:n.job_matches_last_30d)||0]})]}),e.jsx("div",{className:"flex items-center justify-center gap-1",children:((r=s.stats)==null?void 0:r.median_match_percentage)!=null?e.jsxs(e.Fragment,{children:[(((u=s.stats)==null?void 0:u.below_50_count)??0)>0?e.jsx(c,{children:e.jsxs(m,{children:[e.jsx(h,{asChild:!0,children:e.jsxs(q,{className:`${Qe(s.stats.median_match_percentage).badge} cursor-help text-xs`,children:[s.stats.median_match_percentage,"%"]})}),e.jsx(x,{children:e.jsxs("p",{children:["Excludes ",s.stats.below_50_count," match",s.stats.below_50_count===1?"":"es"," below 60%"]})})]})}):e.jsxs(q,{className:`${Qe(s.stats.median_match_percentage).badge} text-xs`,children:[s.stats.median_match_percentage,"%"]}),s.stats.median_match_percentage<70&&e.jsx(c,{children:e.jsxs(m,{children:[e.jsx(h,{asChild:!0,children:e.jsx(V,{className:"w-3.5 h-3.5 text-red-500 cursor-help"})}),e.jsx(x,{className:"max-w-xs",children:e.jsx("p",{children:"There is likely a misalignment between this client's profile, resume and the jobs being returned. They are not likely to get interviews without better alignment between their resume/experience and jobs currently in the market. Consider reviewing their job preferences and resume."})})]})})]}):T&&(((D=s.stats)==null?void 0:D.below_50_count)??0)>0?e.jsx(c,{children:e.jsxs(m,{children:[e.jsx(h,{asChild:!0,children:e.jsx(q,{variant:"secondary",className:"cursor-help text-xs",children:"N/A"})}),e.jsx(x,{children:e.jsxs("p",{children:["All ",s.stats.below_50_count," match",s.stats.below_50_count===1?"":"es"," are below 60%"]})})]})}):e.jsx("span",{className:"text-xs text-muted-foreground",children:"–"})})]})}),e.jsx(z,{className:"align-top",children:e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs("span",{children:[e.jsx("span",{className:"font-medium",children:((N=s.stats)==null?void 0:N.applications)||0}),e.jsxs("span",{className:"text-muted-foreground text-xs",children:[" | ",((b=s.stats)==null?void 0:b.applied_last_30d)||0]})]}),(()=>{var Ds,Ss;const y=((Ds=s.stats)==null?void 0:Ds.applications)||0,P=((Ss=s.stats)==null?void 0:Ss.failed)||0,K=y+P,fe=K>0?P/K:0;return fe>=.4?e.jsx(c,{children:e.jsxs(m,{children:[e.jsx(h,{children:e.jsx(V,{className:"h-4 w-4 text-red-500"})}),e.jsx(x,{children:e.jsxs("p",{children:["High failure rate: ",Math.round(fe*100),"%"]})})]})}):null})()]})}),e.jsx(z,{className:"align-top text-center",children:((ee=s.stats)==null?void 0:ee.interviews)||0}),e.jsxs(z,{className:"align-top whitespace-nowrap",children:[e.jsx("div",{children:te(new Date(s.created_at),"MMM d, yyyy")}),s.client_expiration_date&&(()=>{const y=ta(s.client_expiration_date),P=te(new Date(s.client_expiration_date+"T00:00:00"),"MMM d, yyyy");return y<0?e.jsx(c,{children:e.jsxs(m,{children:[e.jsx(h,{asChild:!0,children:e.jsxs("div",{className:"mt-0.5 inline-flex items-center gap-1 text-xs font-medium text-red-600 dark:text-red-400 cursor-help",children:[e.jsx(V,{className:"w-3 h-3 shrink-0"}),"Expired ",P]})}),e.jsx(x,{className:"max-w-xs",children:e.jsxs("p",{children:["This client's engagement ended ",Math.abs(y)," day",Math.abs(y)!==1?"s":""," ago."]})})]})}):y<=14?e.jsx(c,{children:e.jsxs(m,{children:[e.jsx(h,{asChild:!0,children:e.jsxs("div",{className:"mt-0.5 inline-flex items-center gap-1 text-xs font-medium text-amber-600 dar
16k:text-amber-400 cursor-help",children:[e.jsx(V,{className:"w-3 h-3 shrink-0"}),"Expires ",P]})}),e.jsx(x,{className:"max-w-xs",children:e.jsxs("p",{children:["This client's engagement ends ",y===0?"today":`in ${y} day${y!==1?"s":""}`,"."]})})]})}):e.jsxs("div",{className:"mt-0.5 text-xs text-muted-foreground",children:["Expires ",P]})})()]}),e.jsx(z,{className:"align-top",children:Ns(s,t)}),O&&e.jsx(z,{className:"align-top",children:t?e.jsx(q,{variant:"outline",className:"border-red-300 text-red-500",children:"Inactive"}):e.jsx(q,{variant:"default",className:"bg-green-600",children:"Active"})}),e.jsx(z,{className:"text-right sticky right-0 z-10 bg-card",children:vs(s,t)})]},s.user_id)})})]})})]}):e.jsxs("div",{className:"text-center py-12",children:[e.jsx(Ts,{className:"w-12 h-12 mx-auto text-muted-foreground mb-4"}),e.jsx("h3",{className:"text-lg font-medium mb-2",children:"No clients yet"}),e.jsx("p",{className:"text-muted-foreground mb-4",children:"Start by adding your first client to manage their job applications."}),e.jsxs(o,{onClick:Pe,children:[e.jsx(Ls,{className:"w-4 h-4 mr-2"}),"Add Your First Client"]})]})})]}),e.jsx(qe,{open:F,onOpenChange:M,children:e.jsxs(Ve,{children:[e.jsxs(Je,{children:[e.jsx(Ke,{children:"No available seats"}),e.jsx(We,{children:Fe?"You're out of seats. By clicking Add seats you'll be taken to Stripe, where you can increase the number of seats you're paying for (prorated). It'll bring you right back here after so you can onboard your next client.":je?"You're out of seats. Purchase a client pass in Stripe to add another client; you'll come right back after checkout.":"You've reached the maximum number of clients for your current plan. Archive a client, or contact SimpleApply to add more seats."})]}),e.jsxs(Be,{children:[e.jsx(He,{onClick:()=>M(!1),children:Fe||je?"Not now":"OK"}),Fe&&e.jsxs(be,{onClick:s=>{s.preventDefault(),Zs(),M(!1)},disabled:pe,"data-testid":"button-buy-seats",children:[pe?e.jsx(I,{className:"w-4 h-4 mr-1.5 animate-spin"}):null,"Add seats"]}),je&&e.jsx(be,{onClick:s=>{s.preventDefault(),nt()},"data-testid":"button-buy-pass",children:"Add client pass"})]})]})}),e.jsx(Dt,{open:Q,onOpenChange:w,onOnboardNow:()=>l("/coach/clients/new")}),e.jsx(qe,{open:!!C,onOpenChange:s=>!s&&Ne(null),children:e.jsxs(Ve,{children:[e.jsxs(Je,{children:[e.jsx(Ke,{children:"Deactivate Client"}),e.jsxs(We,{children:["This will deactivate ",C==null?void 0:C.full_name,". Auto-apply and job search will be turned off. You can reactivate them later from the dashboard."]})]}),e.jsxs(Be,{children:[e.jsx(He,{children:"Cancel"}),e.jsx(be,{className:"bg-red-600 hover:bg-red-700",onClick:()=>{C&&(Oe.mutate({userId:C.user_id,active:!1}),Ne(null))},children:"Deactivate"})]})]})}),e.jsx(Ye,{open:!!ce,onOpenChange:s=>{s||(ls(null),me(null),Ce(null),De(!1),he(null))},children:e.jsxs(Xe,{className:"sm:max-w-md",children:[e.jsxs(Ze,{children:[e.jsxs(Ge,{className:"flex items-center gap-2",children:[e.jsx(Vs,{className:"w-5 h-5"}),"Client Credentials"]}),e.jsxs(es,{children:["ATS login credentials for ",ce==null?void 0:ce.name]})]}),e.jsxs("div",{className:"space-y-4 pt-2",children:[Hs&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 gap-2",children:[e.jsx(I,{className:"w-6 h-6 animate-spin text-muted-foreground"}),Qs&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"Creating login credentials for this client…"})]}),ds&&e.jsxs("div",{className:"text-center py-6",children:[e.jsx(V,{className:"w-8 h-8 mx-auto text-muted-foreground mb-2"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:ds})]}),Y&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"Proxy Email"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"flex-1 bg-muted px-3 py-2 rounded-md text-sm font-mono break-all",children:Y.proxy_email}),e.jsx(o,{variant:"outline",size:"sm",className:"shrink-0",onClick:()=>ws(Y.proxy_email,"email"),children:cs==="email"?e.jsx(Le,{className:"w-4 h-4 text-green-600"}):e.jsx(Re,{className:"w-4 h-4"})})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"Password"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"flex-1 bg-muted px-3 py-2 rounded-md text-sm font-mono break-all",children:Ee?Y.password:"••••••••••••"}),e.jsx(o,{variant:"outline",size:"sm",className:"shrink-0",onClick:()=>De(!Ee),children:Ee?e.jsx(qt,{className:"w-4 h-4"}):e.jsx(Vt,{className:"w-4 h-4"})}),e.jsx(o,{variant:"outline",size:"sm",className:"shrink-0",onClick:()=>ws(Y.password,"password"),children:cs==="password"?e.jsx(Le,{className:"w-4 h-4 text-green-600"}):e.jsx(Re,{className:"w-4 h-4"})})]})]})]})]})]})}),e.jsx(qe,{open:!!L,onOpenChange:s=>{!s&&!ue&&Ae(null)},children:e.jsxs(Ve,{children:[e.jsxs(Je,{children:[e.jsx(Ke,{children:"Resend Weekly Rollup?"}),e.jsxs(We,{children:["Are you sure you want to resend the weekly rollup to ",L==null?void 0:L.name," for the week of ",mt,"?"," ","This will send an email to ",L==null?void 0:L.email," and can't be und
16one."]})]}),e.jsxs(Be,{children:[e.jsx(He,{disabled:ue,children:"Cancel"}),e.jsx(be,{onClick:s=>{s.preventDefault(),ct()},disabled:ue,children:ue?e.jsxs(e.Fragment,{children:[e.jsx(I,{className:"w-4 h-4 mr-2 animate-spin"}),"Resending..."]}):"Resend"})]})]})}),xe&&i&&!p&&e.jsx(St,{open:!!xe,onOpenChange:s=>{s||Se(null)},coachId:i.coach_id,userId:xe.userId,clientName:xe.name,isAdmin:!1}),e.jsx(Ot,{open:Ys,onOpenChange:Te,onConfirm:ot,downloading:$e,title:"Export All Clients' Jobs Excel",description:"Download a workbook with filtered job details and a lifetime per-client interview summary.",showInactiveClientsToggle:!0,allowInterviewsOnly:!0,downloadLabel:"Download Excel"}),ps&&e.jsx(Zt,{file:ps,onClose:()=>js(null)})]})})}export{_a 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.