PageSourceSearch

https://idtyc.ai/assets/js/AdminLeads-DxfUBLnj.js

js idtyc.ai collected 2026-10-05 14:39:38 UTC 16,211 bytes, 2 lines download raw bytes

1var le=Object.defineProperty,ne=Object.defineProperties;var re=Object.getOwnPropertyDescriptors;var z=Object.getOwnPropertySymbols;var oe=Object.prototype.hasOwnProperty,ie=Object.prototype.propertyIsEnumerable;var q=(c,r,o)=>r in c?le(c,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):c[r]=o,h=(c,r)=>{for(var o in r||(r={}))oe.call(r,o)&&q(c,o,r[o]);if(z)for(var o of z(r))ie.call(r,o)&&q(c,o,r[o]);return c},x=(c,r)=>ne(c,re(r));var K=(c,r,o)=>new Promise((s,i)=>{var N=m=>{try{b(o.next(m))}catch(v){i(v)}},w=m=>{try{b(o.throw(m))}catch(v){i(v)}},b=m=>m.done?s(m.value):Promise.resolve(m.value).then(N,w);b((o=o.apply(c,r)).next())});import{r as C,j as e,L as k}from"./react-vendor-BPwh9txD.js";import{aM as ce,dL as me,I as j,E,a3 as O,dM as de,dN as ue,a2 as he,ci as F,ap as G,a_ as n,bs as pe,aC as xe,df as je}from"./index-BOYF6AfX.js";import{u as fe}from"./useAdminListUrl-BXd_5P9J.js";import{u as we}from"./query-vendor-Bl4VUy38.js";import{u as ge,a as be}from"./useAdminLeads-CXcx3JxP.js";import{u as ve,C as Ce}from"./ColumnSelector-BJDAaqM2.js";import{S as Y}from"./StatusBadge-DuID-7fr.js";import{A as Ne}from"./AddressAutocomplete-BF98_uyU.js";import{B as ye,m as Se}from"./mergeBusinessCardScan-Bq9uXm7z.js";import{A as Ae}from"./AdminListPageActions-QhAfrbFx.js";import{A as ke}from"./AdminPageHeader-DHIX1pl-.js";import{E as Le}from"./EmptyState-C8y2ySrz.js";import{F as _e}from"./FilterCard-DSy2G_yH.js";import{F as J}from"./FormField-RDUQKhJ_.js";import{P as Pe}from"./PageContainer-BFiWm0ue.js";import{T as Fe}from"./TableLoading-Bfz6kODz.js";import{P as Me}from"./Pagination-M5NRf_Iu.js";import{A as Re,a as Ee,b as He,c as De,d as Be}from"./AdminMobileList-CUdVlTfg.js";import{A as g}from"./AdminMobileField-DPsTErw8.js";import"./badgeStyles-Ct0EeuOY.js";import"./useGoogleMaps-DhyPfGuY.js";import"./ReceiptScanProgress-CMDmMwCF.js";import"./receiptImages-y-WaeoAV.js";import"./PageHeader-BvIzAgjV.js";import"./Breadcrumb-kWknRl0H.js";import"./TablePagination-CGkY3zFn.js";const Z={name:"",email:"",phone:"",companyName:"",businessAddress:"",website:"",annualRevenue:"",referralSource:"",note:""};function Ie({show:c,onClose:r,onSubmit:o}){const[s,i]=C.useState(Z),[N,w]=C.useState(null),[b,m]=C.useState(null),v=t=>{if(!t)return"";const d=t.toString().replace(/\D/g,"");return d?parseInt(d,10).toLocaleString("en-US"):""},S=t=>t?t.toString().replace(/,/g,""):"",_=()=>{i(Z),w(null),m(null)},M=()=>K(null,null,function*(){var f;const t={name:s.name||void 0,email:s.email||void 0,phone:s.phone||void 0,companyName:s.companyName||void 0,businessAddress:s.businessAddress||void 0,website:s.website||void 0,annualRevenue:s.annualRevenue?parseFloat(S(s.annualRevenue)):void 0,referralSource:s.referralSource||void 0,followUpStatus:"new"},p=(f=(yield de(t,{front:N,back:b})).data)==null?void 0:f.id;if(s.note&&s.note.trim()&&p)try{yield ue(p,s.note.trim())}catch(y){console.error("Failed to add note to lead:",y)}yield o(x(h({},t),{_alreadyCreated:!0,_leadId:p})),_()}),P=()=>{_(),r()},u=t=>({file:d,scan:p})=>{t==="front"?w(d||null):m(d||null),p&&i(f=>Se(f,p))};return e.jsx(ce,{show:c,onClose:P,title:"Add New Lead",subtitle:"Quickly collect lead information (all fields optional)",size:"md",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(ye,{scanFn:me,onFrontScanned:u("front"),onBackScanned:u("back"),onFrontClear:()=>w(null),onBackClear:()=>m(null)}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-2 text-white/90",children:"Name"}),e.jsx(j,{type:"text",value:s.name,onChange:t=>i(x(h({},s),{name:t.target.value})),className:"w-full",placeholder:"John Doe"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-2 text-white/90",children:"Email"}),e.jsx(j,{type:"email",value:s.email,onChange:t=>i(x(h({},s),{email:t.target.value})),className:"w-full",placeholder:"[email protected]",autoComplete:"off"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-2 text-white/90",children:"Phone"}),e.jsx(j,{type:"tel",value:s.phone,onChange:t=>i(x(h({},s),{phone:E(t.target.value)})),className:"w-full",placeholder:"(555) 123-4567"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-2 text-white/90",children:"Company Name"}),e.jsx(j,{type:"text",value:s.companyName,onChange:t=>i(x(h({}
1,s),{companyName:t.target.value})),className:"w-full",placeholder:"Acme Corp"})]}),e.jsxs("div",{className:"md:col-span-2",children:[e.jsx("label",{className:"block text-sm font-medium mb-2 text-white/90",children:"Business Address"}),e.jsx(Ne,{value:s.businessAddress||"",onChange:t=>{var p,f;const d=((p=t==null?void 0:t.target)==null?void 0:p.value)||((f=t==null?void 0:t.currentTarget)==null?void 0:f.value)||"";i(y=>x(h({},y),{businessAddress:d}))},placeholder:"Start typing business address..."})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-2 text-white/90",children:"Website"}),e.jsx(j,{type:"text",value:s.website,onChange:t=>i(x(h({},s),{website:t.target.value})),className:"w-full",placeholder:"example.com"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-2 text-white/90",children:"Annual Revenue"}),e.jsxs("div",{className:"relative",children:[e.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-white/40 font-mono",children:"$"}),e.jsx(j,{type:"text",value:v(s.annualRevenue),onChange:t=>{const d=S(t.target.value);i(x(h({},s),{annualRevenue:d}))},className:"w-full pl-8 font-mono",placeholder:"1,000,000",inputMode:"numeric"})]})]}),e.jsxs("div",{className:"md:col-span-2",children:[e.jsx("label",{className:"block text-sm font-medium mb-2 text-white/90",children:"Where did you find the lead?"}),e.jsx(j,{type:"text",value:s.referralSource,onChange:t=>i(x(h({},s),{referralSource:t.target.value})),className:"w-full",placeholder:"LinkedIn, Referral, Trade Show, etc."})]}),e.jsxs("div",{className:"md:col-span-2",children:[e.jsx("label",{className:"block text-sm font-medium mb-2 text-white/90",children:"Note"}),e.jsx(j,{as:"textarea",value:s.note,onChange:t=>i(x(h({},s),{note:t.target.value})),className:"w-full min-h-[180px] resize-y",placeholder:"Add a quick note about this lead...",rows:6})]})]}),e.jsxs("div",{className:"flex gap-3 pt-4 border-t border-white/10",children:[e.jsx(O,{variant:"secondary",fullWidth:!0,onClick:P,children:"Cancel"}),e.jsxs(O,{variant:"primary",fullWidth:!0,onClick:M,children:[e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),"Add Lead"]})]})]})})}const X=20,Ue=["followUpStatus","referralSource","search"];function L(c){return c.assigned_rep_name?c.assigned_rep_name:je(c.assigned_rep_id)}function pa(){var H,D,B,I,U;const c=we(),{filters:r,page:o,returnTo:s,updateListParams:i,searchParams:N,clearModalQueryKeys:w}=fe(Ue),[b,m]=C.useState(!1),[v,S]=C.useState(!1),[_,M]=C.useState(!1),P=h({page:o,limit:X},r),{data:u,isLoading:t}=ge(P),d=(H=u==null?void 0:u.leads)!=null?H:[],p={page:o,limit:X,total:(B=(D=u==null?void 0:u.pagination)==null?void 0:D.total)!=null?B:0,totalPages:(U=(I=u==null?void 0:u.pagination)==null?void 0:I.totalPages)!=null?U:0},f=be(),y=[{key:"name",label:"Name"},{key:"email",label:"Email"},{key:"phone",label:"Phone"},{key:"company",label:"Company"},{key:"revenue",label:"Revenue"},{key:"referralSource",label:"Source"},{key:"assignedRep",label:"Assigned Ambassador"},{key:"status",label:"Status"},{key:"notes",label:"Notes"},{key:"created",label:"Created"},{key:"actions",label:"Actions"}],{visibleColumns:ee,toggleColumn:ae,resetColumns:se,isColumnVisible:l}=ve("leads",y.map(a=>a.key));C.useEffect(()=>{N.get("create")==="true"&&(m(!0),w(["create"]))},[N,w]);const te=a=>{if(a._alreadyCreated){m(!1),c.invalidateQueries({queryKey:pe.leads.all()});return}f.mutate(a,{onSuccess:()=>m(!1),onError:A=>{var V,T,W,Q;let R="Failed to create lead";(T=(V=A.response)==null?void 0:V.data)!=null&&T.errors&&Array.isArray(A.response.data.errors)?R=A.response.data.errors.map($=>$.message||$.msg).join(`
2`)||"Validation failed. Please check your input.":(Q=(W=A.response)==null?void 0:W.data)!=null&&Q.message&&(R=A.response.data.message),xe.error(R)}})};return e.jsxs(Pe,{children:[e.jsx(ke,{breadcrumbItems:[{label:"Lead Management"}],title:"Leads",description:"Quickly collect and manage lead information",actions:e.jsx(Ae,{onOpenColumns:()=>S(!0),createLabel:"+ Add Lead",onCreate:()=>m(!0)})}),e.jsx(_e,{searchValue:r.search,onSearchChange:a=>i({search:a},{resetPage:!0}),searchPlaceholder:"Search leads...",searchAriaLabel:"Search leads",activeFilterCount:(r.followUpStatus?1:0)+(r.referralSource?1:0),onClear:()=>i({followUpStatus:"",referralSource:"",search:r.search},{resetPage:!0}),open:_,onOpenChange:M,children:e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsx(J,{label:"Status",children:e.jsxs(j,{as:"select",value:r.followUpStatus,onChange:a=>i({followUpStatus:a.target.value},{resetPage:!0}),className:"w-full h-11 px-4",children:[e.jsx("option",{value:"",children:"All Statuses"}),e.jsx("option",{value:"new",children:"New"}),e.jsx("option",{value:"contacted",children:"Contacted"}
2),e.jsx("option",{value:"qualified",children:"Qualified"}),e.jsx("option",{value:"converted",children:"Converted"}),e.jsx("option",{value:"lost",children:"Lost"}),e.jsx("option",{value:"nurturing",children:"Nurturing"})]})}),e.jsx(J,{label:"Source",children:e.jsxs(j,{as:"select",value:r.referralSource,onChange:a=>i({referralSource:a.target.value},{resetPage:!0}),className:"w-full h-11 px-4",children:[e.jsx("option",{value:"",children:"All Pages"}),e.jsx("option",{value:"photography",children:"Photography"}),e.jsx("option",{value:"video-production",children:"Video Production"}),e.jsx("option",{value:"construction-documentation",children:"Construction Documentation"}),e.jsx("option",{value:"real-estate-photography",children:"Real Estate Photography"})]})})]})}),e.jsx(he,{padding:"none",overflow:"hidden",children:t?e.jsx(Fe,{}):d.length===0?e.jsx(Le,{icon:e.jsx("svg",{className:"w-10 h-10 text-white/60",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z"})}),title:"No leads found",description:"No leads match your search criteria"}):e.jsxs(e.Fragment,{children:[e.jsx(Re,{children:d.map(a=>e.jsxs(Ee,{children:[e.jsx(He,{title:l("name")?e.jsx(k,{to:`/admin/leads/${a.id}`,state:{returnTo:s},className:"hover:text-gold-400 hover:underline underline-offset-2",children:a.name||"Unnamed lead"}):a.email||a.phone||"Lead",subtitle:l("email")?a.email||a.phone:a.company_name,badge:l("status")?e.jsx(Y,{status:a.follow_up_status,type:"lead"}):null}),e.jsxs(De,{children:[l("email")&&a.email&&e.jsx(g,{label:"Email",children:e.jsx(F,{value:a.email,label:"email",stopPropagation:!0,textClassName:"text-sm text-white/80"})}),l("phone")&&a.phone&&e.jsx(g,{label:"Phone",children:e.jsx(F,{value:E(a.phone),label:"phone",stopPropagation:!0,textClassName:"text-sm"})}),l("company")&&a.company_name&&e.jsx(g,{label:"Company",children:a.company_name}),l("referralSource")&&a.referral_source&&e.jsx(g,{label:"Source",children:a.referral_source}),l("assignedRep")&&L(a)&&e.jsx(g,{label:"Assigned Ambassador",children:L(a)}),l("revenue")&&a.annual_revenue&&e.jsx(g,{label:"Revenue",children:G(a.annual_revenue,{allowNull:!0,minimumFractionDigits:0,maximumFractionDigits:0})}),l("notes")&&e.jsx(g,{label:"Notes",children:a.note_count||0}),l("created")&&e.jsx(g,{label:"Created",children:new Date(a.created_at).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})})]}),l("actions")&&e.jsx(Be,{children:e.jsx(k,{to:`/admin/leads/${a.id}`,state:{returnTo:s},className:"glass-button inline-flex w-full items-center justify-center px-3 py-1.5 text-xs min-h-[44px] font-semibold rounded-lg",children:"View Lead"})})]},a.id))}),e.jsxs(n,{minWidth:"min-w-[1120px]",wrapperClassName:"hidden lg:block",children:[e.jsx(n.Head,{children:e.jsxs(n.HeadRow,{children:[l("name")&&e.jsx(n.HeadCell,{className:"min-w-[150px]",children:"Name"}),l("email")&&e.jsx(n.HeadCell,{className:"min-w-[200px]",children:"Email"}),l("phone")&&e.jsx(n.HeadCell,{className:"min-w-[120px]",children:"Phone"}),l("company")&&e.jsx(n.HeadCell,{className:"min-w-[150px]",children:"Company"}),l("revenue")&&e.jsx(n.HeadCell,{className:"min-w-[120px]",children:"Revenue"}),l("referralSource")&&e.jsx(n.HeadCell,{className:"min-w-[150px]",children:"Source"}),l("assignedRep")&&e.jsx(n.HeadCell,{className:"min-w-[130px]",children:"Assigned Ambassador"}),l("status")&&e.jsx(n.HeadCell,{className:"min-w-[120px]",children:"Status"}),l("notes")&&e.jsx(n.HeadCell,{className:"min-w-[80px]",children:"Notes"}),l("created")&&e.jsx(n.HeadCell,{className:"min-w-[110px]",children:"Created"}),l("actions")&&e.jsx(n.HeadCell,{className:"min-w-[100px]",children:"Actions"})]})}),e.jsx(n.Body,{children:d.map(a=>e.jsxs(n.Row,{children:[l("name")&&e.jsx(n.Cell,{className:"whitespace-nowrap",children:e.jsx(k,{to:`/admin/leads/${a.id}`,state:{returnTo:s},className:"text-sm text-white/90 font-semibold hover:text-gold-400 hover:underline underline-offset-2",children:a.name||e.jsx("span",{className:"text-white/40 italic",children:"-"})})}),l("email")&&e.jsx(n.Cell,{className:"text-sm text-white/70 whitespace-nowrap",children:e.jsx(F,{value:a.email,label:"email",stopPropagation:!0,textClassName:"text-sm text-white/70",empty:e.jsx("span",{className:"text-white/40 italic",children:"-"})})}),l("phone")&&e.jsx(n.Cell,{className:"text-sm text-white/70 whitespace-nowrap",children:e.jsx(F,{value:a.p
2hone?E(a.phone):"",label:"phone",stopPropagation:!0,textClassName:"text-sm text-white/70",empty:e.jsx("span",{className:"text-white/40 italic",children:"-"})})}),l("company")&&e.jsx(n.Cell,{className:"text-sm whitespace-nowrap",children:a.company_name||e.jsx("span",{className:"text-white/40 italic",children:"-"})}),l("revenue")&&e.jsx(n.Cell,{className:"whitespace-nowrap",children:a.annual_revenue?e.jsx("span",{className:"text-sm",children:G(a.annual_revenue,{allowNull:!0,minimumFractionDigits:0,maximumFractionDigits:0})}):e.jsx("span",{className:"text-white/40 italic",children:"-"})}),l("referralSource")&&e.jsx(n.Cell,{className:"text-sm text-white/70 whitespace-nowrap",children:a.referral_source||e.jsx("span",{className:"text-white/40 italic",children:"-"})}),l("assignedRep")&&e.jsx(n.Cell,{className:"text-sm whitespace-nowrap",children:L(a)?a.assigned_rep_id?e.jsx(k,{to:`/admin/users/${a.assigned_rep_id}`,className:"text-purple-300 hover:text-purple-200 hover:underline underline-offset-2",children:L(a)}):e.jsx("span",{className:"text-white/90",children:L(a)}):e.jsx("span",{className:"text-white/40 italic",children:"-"})}),l("status")&&e.jsx(n.Cell,{className:"whitespace-nowrap",children:e.jsx(Y,{status:a.follow_up_status,type:"lead"})}),l("notes")&&e.jsx(n.Cell,{className:"whitespace-nowrap",children:e.jsx("span",{className:"text-sm text-white/70",children:a.note_count||0})}),l("created")&&e.jsx(n.Cell,{className:"text-white/60 text-xs whitespace-nowrap",children:new Date(a.created_at).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}),l("actions")&&e.jsx(n.Cell,{className:"whitespace-nowrap",children:e.jsx(k,{to:`/admin/leads/${a.id}`,state:{returnTo:s},className:"glass-button inline-flex items-center justify-center px-3 py-1.5 text-xs min-h-[36px] font-semibold rounded-lg",children:"View"})})]},a.id))})]}),e.jsx("div",{className:"px-4 py-3",children:e.jsx(Me,{pagination:p,onPageChange:a=>i({page:a})})})]})}),e.jsx(Ie,{show:b,onClose:()=>m(!1),onSubmit:te}),e.jsx(Ce,{show:v,onClose:()=>S(!1),allColumns:y,visibleColumns:ee,toggleColumn:ae,resetColumns:se})]})}export{pa 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.