1import{j as e}from"./app-C1iegf7Q.js";import{h as v,b as h,H as S,L as C,f as x}from"./inertia-BpyZy4w-.js";import{C as _}from"./contact-email-dialog-ByGdXKGI.js";import{I as L}from"./input-DJt0nBB3.js";import{S as A,e as E,f as I,a as $,c as b}from"./select-Bn8hgKYl.js";import{a as D}from"./admin-layout-BhXWbUlP.js";import{U as P}from"./upload-C1CGckSw.js";import{D as T}from"./download-CXbkSkxk.js";import{M as u}from"./mail-Dwbp3545.js";import{S as U}from"./search-BY9GDMxP.js";/* empty css */import"./button-BE4q1_FS.js";import"./index-CGXdj8xB.js";import"./utils-BiuKVCuu.js";import"./dialog-DrkalYDs.js";import"./index-BewtL6Hn.js";import"./index-Dc_FVRD7.js";import"./index-C_n-C52S.js";import"./index-CL12STDK.js";import"./index-XydtsrKA.js";import"./index-BDqbV96p.js";import"./index-Cja0wFUH.js";import"./Combination-Cr5kvm8y.js";import"./index-B1PKR-s8.js";import"./x-DQSeRCcH.js";import"./createLucideIcon-wqc1LSWg.js";import"./label-Czc25Mye.js";import"./index-DdRFMukF.js";import"./textarea-CXLxrYIG.js";import"./index-BdQq_4o_.js";import"./index-B0NHTN87.js";import"./index-C48dRAib.js";import"./index-D4vO54bj.js";import"./index-BRU_LjHB.js";import"./index-Cs5D2gCo.js";import"./index-DyGg2PJd.js";import"./chevron-down-B1YaU0K5.js";import"./check-0O-UND6N.js";import"./chevron-up-CLp5HMgA.js";import"./app-logo-Dz0wogSq.js";import"./logo-light-DU4bWymm.js";import"./flash-toast-C6O0iVL1.js";import"./info-D2ZN_yLm.js";import"./triangle-alert-C7AVwNi-.js";import"./circle-x-Bp6Mbpgt.js";import"./circle-check-BMWvzPMx.js";import"./arrow-left-DCX0fhKH.js";import"./menu-BR3Nc3Gr.js";import"./users-BCcupCXV.js";import"./folder-open-I72SPUVk.js";import"./pound-sterling-D16GLaAZ.js";import"./book-open-DVFlG_9t.js";function c(r){return r?r.charAt(0).toUpperCase()+r.slice(1).replace(/_/g," "):"â"}function f(r){const s=Object.entries(r).filter(([,i])=>i!==null&&i!=="");return s.length===0?"â":s.slice(0,4).map(([i,a])=>`${i.replace(/_/g," ")}: ${Array.isArray(a)?a.join(", "):String(a)}`).join(" · ")}function Te(){const{props:r}=v(),{contacts:s,sources:i,stats:a,filters:l,filteredTotal:n}=r,[o,g]=h.useState(l.search||""),[j,d]=h.useState(null),p=t=>{x.get("/admin/contacts",{...l,...t,search:o},{preserveState:!0})},N=t=>{t.preventDefault(),p({search:o})},y=()=>d({filters:{...l,registered:"guest"},count:n,label:`${n.toLocaleString()} filtered lead${n===1?"":"s"}`}),w=t=>d({contactId:t.id,label:t.name??t.email}),k=`/admin/contacts/export?${new URLSearchParams(Object.entries({search:l.search??"",source:l.source??""}).filter(([,t])=>t)).toString()}`;return e.jsxs(D,{children:[e.jsx(S,{title:"Leads · Admin"}),e.jsxs("div",{className:"px-4 py-5 sm:px-6 sm:py-7",children:[e.jsxs("div",{className:"mb-5 flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-semibold text-ink",children:"Leads"}),e.jsx("p",{className:"mt-0.5 text-sm text-ink-3",children:"People captured who have not signed up yet. Once they register they appear under Users."})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(C,{href:"/admin/contacts/import",className:"inline-flex items-center gap-1.5 rounded-lg border border-line bg-white px-3 py-1.5 text-sm font-medium text-ink-2 hover:bg-bg-2",children:[e.jsx(P,{className:"h-3.5 w-3.5"}),"Import"]}),e.jsxs("a",{href:n===0?void 0:k,className:"inline-flex items-center gap-1.5 rounded-lg border border-line bg-white px-3 py-1.5 text-sm font-medium text-ink-2 hover:bg-bg-2 disabled:opacity-50",children:[e.jsx(T,{className:"h-3.5 w-3.5"}),"Export"]}),e.jsxs("button",{type:"button",disabled:n===0,onClick:y,className:"inline-flex items-center gap-1.5 rounded-lg bg-ink px-4 py-2 text-sm font-medium text-white hover:bg-ink/90 disabled:opacity-50",children:[e.jsx(u,{className:"h-3.5 w-3.5"}),"Email ",n.toLocaleString()," filtered"]})]})]}),e.jsxs("div",{className:"mb-5 grid grid-cols-3 gap-3",children:[e.jsxs("div",{className:"rounded-card border border-line bg-white p-4",children:[e.jsx("p",{className:"text-2xs font-bold uppercase tracking-eyebrow text-ink-3",children:"Leads"}),e.jsx("p",{className:"mt-1.5 font-serif text-3xl leading-none text-ink",children:a.total})]}),e.jsxs("div",{className:"rounded-card border border-line bg-white p-4",children:[e.jsx("p",{className:"text-2xs font-bold uppercase tracking-eyebrow text-ink-3",children:"Converted to users"}),e.jsx("p",{className:"mt-1.5 font-serif text-3xl leading-none text-green-ink",children:a.converted})]}),e.jsxs("div",{className:"rounded-card border border-line bg-white p-4",children:[e.jsx("p",{className:"text-2xs font-bold uppercase tracking-eyebrow text-ink-3",children:"Seen this week"}),e.jsx("p",{className:"mt-1.5 font-serif text-3xl leading-none text-teal",children:a.this_week})]})]}),e.jsxs("div",{className:"mb-4 flex flex-wrap items-center gap-3",children:[e.jsxs("form",{onSubmit:N,className:"relative flex-1 max-w-xs",children:[e.jsx(U,{className:"absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-ink-3"}),e.jsx(L,{type:"search",placeholder:"Search by name or email...",value:o,onChange:t=>g(t.target.value),className:"h-8 pl-8 text-sm"})]}),e.jsxs(A,{value:l.source??"all",onValueChange:t=>p({source:t==="all"?null:t}),children:[e.jsx(E,{className:"h-8 w-48 text-sm",children:e.jsx(I,{placeholder:"All sources"})}),e.jsxs($,{children:[e.jsx(b,{value:"all",children:"All sources"}),i.map(t=>e.jsx(b,{value:t,children:c(t)},t))]})]})]}),e.jsxs("div",{className:"overflow-hidden rounded-card border border-line bg-white",children:[e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full border-collapse",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-line-2 bg-bg-2",children:[e.jsx("th",{className:"px-4 py-2.5 text-left text-2xs font-bold uppercase tracking-eyebrow text-ink-3",children:"Lead"}),e.jsx("th",{className:"px-4 py-2.5 text-left text-2xs font-bold uppercase tracking-eyebrow text-ink-3",children:"Source"}),e.jsx("th",{className:"px-4 py-2.5 text-left text-2xs font-bold uppercase tracking-eyebrow text-ink-3",children:"Details"}),e.jsx("th",{className:"px-4 py-2.5 text-left text-2xs font-bold uppercase tracking-eyebrow text-ink-3",children:"Last seen"}),e.jsx("th",{className:"px-4 py-2.5 text-right text-2xs font-bold uppercase tracking-eyebrow text-ink-3",children:"Actions"})]})}),e.jsx("tbody",{children:s.data.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:5,className:"py-10 text-center text-sm text-ink-3",children:"No leads found."})}):s.data.map(t=>e.jsxs("tr",{className:"cursor-pointer border-b border-line-2 last:border-0 hover:bg-bg-2",onClick:()=>x.visit(`/admin/contacts/${t.id}`),children:[e.jsxs("td",{className:"px-4 py-3",children:[e.jsx("p",{className:"text-sm font-semibold text-ink",children:t.name??t.email}),t.name&&e.jsx("p",{className:"mt-0.5 text-xs text-ink-3",children:t.email})]}),e.jsxs("td",{className:"px-4 py-3",children:[e.jsx("p",{className:"text-sm text-ink-2",children:c(t.source)}),t.last_source&&t.last_source!==t.source&&e.jsxs("p",{className:"mt-0.5 text-xs text-ink-3",children:["last: ",c(t.last_source)]})]}),e.jsx("td",{className:"px-4 py-3 max-w-xs",children:e.jsx("p",{className:"truncate text-xs text-ink-3",title:f(t.metadata),children:f(t.metadata)})}),e.jsx("td",{className:"px-4 py-3 text-sm text-ink-3",children:t.last_seen_at??"â"}),e.jsx("td",{className:"px-4 py-3 text-right",children:e.jsxs("button",{type:"button",onClick:m=>{m.stopPropagation(),w(t)},className:"inline-flex items-center gap-1 rounded-md border border-line bg-white px-2.5 py-1 text-xs font-medium text-ink-2 hover:bg-bg-2",children:[e.jsx(u,{className:"h-3 w-3"}),"Email"]})})]},t.id))})]})}),s.last_page>1&&e.jsxs("div",{className:"flex items-center justify-between border-t border-line-2 px-4 py-3",children:[e.jsxs("span",{className:"text-xs text-ink-3",children:["Showing ",s.from,"â",s.to," of ",s.total]}),e.jsx("div",{className:"flex gap-1",children:s.links.map((t,m)=>e.jsx("button",{type:"button",disabled:!t.url,onClick:()=>t.url&&x.get(t.url,{},{preserveState:!0}),className:t.active?"min-w-[28px] rounded-md bg-ink px-2 py-1 text-xs font-medium text-white":"min-w-[28px] rounded-md border border-line bg-white px-2 py-1 text-xs font-medium text-ink-2 hover:bg-bg-2 disabled:opacity-40",dangerouslySetInnerHTML:{__html:t.label}},m))})]})]})]}),e.jsx(_,{target:j,onClose:()=>d(null)})]})}export{Te 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.