1import{c as A,t as p,r,j as s,b as S,T as _}from"./index-DEKcvlOi.js";import{S as h}from"./sparkles-C2zFjXZD.js";import{C as k}from"./circle-dollar-sign-COzbigev.js";import{F as C}from"./filter-BPRsf2yk.js";import{M as q}from"./mail-DwfihRku.js";import{P as T}from"./phone-BGILB7to.js";import{E}from"./external-link-BbDIQTZh.js";import{C as P}from"./calendar-clock-DVxaw8K6.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 b=A("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** 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 $=A("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]),L={new:"bg-sky-500/15 text-sky-300 border-sky-500/25",contacted:"bg-blue-500/15 text-blue-300 border-blue-500/25",qualified:"bg-violet-500/15 text-violet-300 border-violet-500/25",consultation_scheduled:"bg-amber-500/15 text-amber-300 border-amber-500/25",needs_analysis:"bg-orange-500/15 text-orange-300 border-orange-500/25",proposal_needed:"bg-pink-500/15 text-pink-300 border-pink-500/25",proposal_sent:"bg-fuchsia-500/15 text-fuchsia-300 border-fuchsia-500/25",negotiating:"bg-indigo-500/15 text-indigo-300 border-indigo-500/25",won:"bg-emerald-500/15 text-emerald-300 border-emerald-500/25",lost:"bg-rose-500/15 text-rose-300 border-rose-500/25",follow_up_later:"bg-slate-500/15 text-slate-300 border-slate-500/25",spam:"bg-gray-500/15 text-gray-400 border-gray-500/25"},F={consultation_scheduled:"Consultation scheduled",needs_analysis:"Needs analysis",proposal_needed:"Proposal needed",proposal_sent:"Proposal sent",follow_up_later:"Follow up later"},D=["new","contacted","qualified","consultation_scheduled","needs_analysis","proposal_needed","proposal_sent","negotiating","won","lost","follow_up_later","spam"];function n(t){return t?F[t]??t.replace(/_/g," ").replace(/\b\w/g,o=>o.toUpperCase()):"â"}function W(){const{data:t=[],isLoading:o,error:B}=p.businessLeads.list.useQuery({limit:250}),j=p.useUtils(),m=p.businessLeads.updateStatus.useMutation({onSuccess:()=>j.businessLeads.list.invalidate()}),[x,w]=r.useState(""),[l,y]=r.useState("all"),[i,f]=r.useState("all"),u=r.useMemo(()=>t.filter(e=>{const a=x.toLowerCase().trim();return(!a||[e.name,e.company,e.email,e.phone,e.industry,e.serviceRequested,e.message].filter(Boolean).some(d=>
11String(d).toLowerCase().includes(a)))&&(l==="all"||e.status===l)&&(i==="all"||e.source===i)}),[t,x,l,i]),c={total:t.length,new:t.filter(e=>e.status==="new").length,qualified:t.filter(e=>["qualified","consultation_scheduled","needs_analysis","proposal_needed","proposal_sent","negotiating"].includes(e.status)).length,won:t.filter(e=>e.status==="won").length},N=Array.from(new Set(t.map(e=>e.source))).sort(),v=Array.from(new Set(t.map(e=>e.status))).sort();return s.jsxs("div",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:62",className:"mx-auto max-w-[1480px] space-y-6 p-6",children:[s.jsxs("div",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:63",className:"flex flex-col gap-4 lg:flex-row lg:items-end lg:justify-between",children:[s.jsxs("div",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:64",children:[s.jsx("p",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:64",className:"text-sm font-semibold uppercase tracking-[.15em] text-sky-300",children:"Central lead management"}),s.jsx("h1",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:64",className:"mt-2 text-3xl font-black text-white",children:"Bitware Lead Pipeline"}),s.jsx("p",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:64",className:"mt-2 text-sm text-slate-400",children:"Every new public Bitware request is mirrored here with source, attribution, intake details, and initial scoring."})]}),s.jsxs("div",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:65",className:"rounded-xl border border-sky-400/20 bg-sky-400/[.07] px-4 py-3 text-sm text-sky-200",children:[s.jsx(h,{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:65",className:"mr-2 inline h-4 w-4"}),"Lead scoring uses form-completion signals; staff review remains the source of truth."]})]}),s.jsx("div",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:68",className:"grid gap-4 sm:grid-cols-2 xl:grid-cols-4",children:[{label:"All leads",value:c.total,icon:S,tone:"text-white"},{label:"New",value:c.new,icon:h,tone:"text-sky-300"},{label:"Active opportunities",value:c.qualified,icon:_,tone:"text-violet-300"},{label:"Won",value:c.won,icon:k,tone:"text-emerald-300"}].map(({label:e,value:a,icon:g,tone:d})=>s.jsxs("div",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:74",className:"rounded-2xl border border-white/10 bg-white/[.035] p-5",children:[s.jsx(g,{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:74",className:`h-5 w-5 ${d}`}),s.jsx("p",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:74",className:`mt-4 text-3xl font-black ${d}`,children:a}),s.jsx("p",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:74",className:"mt-1 text-sm text-slate-400",children:e})]},e))}),s.jsxs("div",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:77",className:"flex flex-col gap-3 rounded-2xl border border-white/10 bg-white/[.025] p-4 xl:flex-row xl:items-center",children:[s.jsxs("div",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:78",className:"relative flex-1",children:[s.jsx($,{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:78",className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-slate-500"}),s.jsx("input",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:78",value:x,onChange:e=>w(e.target.value),placeholder:"Search name, company, email, industry, service, or message",className:"w-full rounded-xl border border-white/10 bg-[#080c15] py-3 pl-10 pr-4 text-sm text-white placeholder:text-slate-600 outline-none focus:border-sky-300/50"})]}),s.jsxs("div",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:79",className:"flex flex-col gap-3 sm:flex-row",children:[s.jsxs("label",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:79",className:"relative",children:[s.jsx(C,{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:79",className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-slate-500"}),s.jsxs("select",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:79",value:l,onChange:e=>y(e.target.value),className:"appearance-none rounded-xl border border-white/10 bg-[#080c15] py-3 pl-10 pr-10 text-sm text-slate-200 outline-none",children:[s.jsx("option",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:79",value:"all",children:"All statuses"}),v.map(e=>s.jsx("option",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:79",value:e,children:n(e)},e))]}),s.jsx(b,{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:79",className:"pointer-events-none absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2 text-slate-500"})]}),s.jsxs("label",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:79",className:"relative",children:[s.jsxs("select",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:79",value:i,onChange:e=>f(e.target.value),className:"appearance-none rounded-xl border border-white/10 bg-[#080c15] px-4 py-3 pr-10 text-sm text-slate-200 outline-none",children:[s.jsx("option",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:79",value:"all",children:"All sources"}),N.map(e=>s.jsx("option",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:79",value:e,children:n(e)},e))]}),s.jsx(b,{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:79",className:"pointer-events-none absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2 text-slate-500"})]})]})]}),s.jsx("div",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:82",className:"overflow-hidden rounded-2xl border border-white/10 bg-[#080c15]",children:s.jsx("div",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:83",className:"overflow-x-auto",children:s.jsxs("table",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:84",className:"w-full min-w-[1080px] text-left text-sm",children:[s.jsx("thead",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:85",className:"border-b border-white/10 bg-white/[.025] text-xs uppercase tracking-[.12em] text-slate-500",children:s.jsxs("tr",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:85",children:[s.jsx("th",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:85",className:"px-5 py-4",children:"Lead"}),s.jsx("th",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:85",className:"px-5 py-4",children:"Service & industry"}),s.jsx("th",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:85",className:"px-5 py-4",children:"Source"}),s.jsx("th",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:85",className:"px-5 py-4",children:"Status"}),s.jsx("th",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:85",className:"px-5 py-4",children:"Score"}),s.jsx("th",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:85",className:"px-5 py-4",children:"Submitted"}),s.jsx("th",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:85",className:"px-5 py-4 text-right",children:"Contact"})]})}),s.jsx("tbody",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:86",className:"divide-y divide-white/[.06]",children:o?s.jsx("tr",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:86",children:s.jsx("td",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:86",colSpan:7,className:"px-5 py-14 text-center text-slate-400",children:"Loading centralized lead pipelineâ¦"})}):B?s.jsx("tr",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:86",children:s.jsx("td",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:86",colSpan:7,className:"px-5 py-14 text-center text-rose-300",children:"Unable to load leads. Confirm you are signed in as an admin."})}):u.length===0?s.jsx("tr",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:86",children:s.jsx("td",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:86",colSpan:7,className:"px-5 py-14 text-center text-slate-400",children:"No leads match the current filters."})}):u.map(e=>s.jsxs("tr",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:86",className:"transition-colors hover:bg-white/[.025]",children:[s.jsxs("td",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:86",className:"px-5 py-4",children:[s.jsx("p",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:86",className:"font-semibold text-white",children:e.name}),s.jsx("p",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:86",className:"mt-1 text-xs text-slate-500",children:e.company||e.email})]}),s.jsxs("td",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:86",className:"px-5 py-4",children:[s.jsx("p",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:86",className:"text-slate-200",children:e.serviceRequested?n(e.serviceRequested):"General inquiry"}),s.jsx("p",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:86",className:"mt-1 text-xs text-slate-500",children:e.industry||"Industry not specified"})]}),s.jsx("td",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:86",className:"px-5 py-4",children:s.jsx("span",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:86",className:"rounded-full border border-white/10 bg-white/[.04] px-2.5 py-1 text-xs text-slate-300",children:n(e.source)})}),s.jsx("td",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:86",className:"px-5 py-4",children:s.jsx("select",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:86","aria-label":`Change ${e.name} lead status`,disabled:m.isPending,value:e.status,onChange:a=>m.mutate({leadId:e.id,status:a.target.value}),className:`rounded-full border px-2.5 py-1 text-xs font-semibold outline-none ${L[e.status]||L.new}`,children:D.map(a=>s.jsx("option",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:86",value:a,className:"bg-slate-950 text-white",children:n(a)},a))})}),s.jsxs("td",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:86",className:"px-5 py-4",children:[s.jsx("p",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:86",className:"font-bold text-white",children:e.score}),s.jsx("p",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:86",className:"mt-1 text-xs text-slate-500",children:n(e.scoreCategory)})]}),s.jsxs("td",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:86",className:"px-5 py-4",children:[s.jsx("p",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:86",className:"text-slate-300",children:new Date(e.createdAt).toLocaleDateString()}),s.jsx("p",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:86",className:"mt-1 text-xs text-slate-500",children:new Date(e.createdAt).toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})})]}),s.jsx("td",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:86",className:"px-5 py-4",children:s.jsxs("div",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:86",className:"flex justify-end gap-2",children:[e.email?s.jsx("a",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:86",href:`mailto:${e.email}`,className:"rounded-lg border border-white/10 p-2 text-sky-300 hover:bg-sky-300/[.1]","aria-label":`Email ${e.name}`,children:s.jsx(q,{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:86",className:"h-4 w-4"})}):null,e.phone?s.jsx("a",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:86",href:`tel:${e.phone}`,className:"rounded-lg border border-white/10 p-2 text-emerald-300 hover:bg-emerald-300/[.1]","aria-label":`Call ${e.name}`,children:s.jsx(T,{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:86",className:"h-4 w-4"})}):null,e.website?s.jsx("a",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:86",href:e.website,target:"_blank",rel:"noreferrer",className:"rounded-lg border border-white/10 p-2 text-slate-300 hover:bg-white/[.08]","aria-label":`Open ${e.name} website`,children:s.jsx(E,{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:86",className:"h-4 w-4"})}):null]})})]},e.id))})]})})}),s.jsxs("div",{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:91",className:"flex items-center gap-2 text-xs text-slate-500",children:[s.jsx(P,{"data-loc":"client/src/pages/AdminBusinessLeads.tsx:91",className:"h-3.5 w-3.5"}),"Future phases will add assignment, follow-up scheduling, stage updates, proposals, and activity entry to this central record."]})]})}export{W 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.