(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[177],{6648:function(e,s,a){Promise.resolve().then(a.bind(a,2383))},2383:function(e,s,a){"use strict";a.r(s),a.d(s,{default:function(){return o}});var t=a(7437),r=a(2265),n=a(1549);function l(e){let{leads:s}=e,[a,n]=(0,r.useState)(""),l=s.filter(e=>{let s=a.toLowerCase();return e.name.toLowerCase().includes(s)||e.email.toLowerCase().includes(s)});return(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"mb-4",children:(0,t.jsx)("input",{type:"text",placeholder:"Search by name or email…",value:a,onChange:e=>n(e.target.value),className:"w-full max-w-sm border border-gray-300 rounded-lg px-4 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500"})}),(0,t.jsx)("div",{className:"bg-white rounded-xl border border-gray-100 shadow-sm overflow-hidden",children:(0,t.jsx)("div",{className:"overflow-x-auto",children:0===l.length?(0,t.jsx)("p",{className:"p-6 text-sm text-gray-500",children:"No leads found."}):(0,t.jsxs)("table",{className:"w-full text-sm",children:[(0,t.jsx)("thead",{className:"bg-gray-50",children:(0,t.jsx)("tr",{children:["Name","Email","Phone","Listing Address","Listing Price","Message","Date"].map(e=>(0,t.jsx)("th",{className:"px-4 py-3 text-left text-xs font-semibold text-gray-500 uppercase tracking-wide whitespace-nowrap",children:e},e))})}),(0,t.jsx)("tbody",{className:"divide-y divide-gray-100",children:l.map(e=>(0,t.jsxs)("tr",{className:"hover:bg-gray-50",children:[(0,t.jsx)("td",{className:"px-4 py-3 font-medium text-gray-900 whitespace-nowrap",children:e.name}),(0,t.jsx)("td",{className:"px-4 py-3 text-gray-600 whitespace-nowrap",children:e.email}),(0,t.jsx)("td",{className:"px-4 py-3 text-gray-600 whitespace-nowrap",children:e.phone||"—"}),(0,t.jsx)("td",{className:"px-4 py-3 text-gray-600 max-w-[200px] truncate",children:e.listing_address||"—"}),(0,t.jsx)("td",{className:"px-4 py-3 text-gray-600 whitespace-nowrap",children:e.listing_price||"—"}),(0,t.jsx)("td",{className:"px-4 py-3 text-gray-600 max-w-[200px] truncate",children:e.message||"—"}),(0,t.jsx)("td",{className:"px-4 py-3 text-gray-500 whitespace-nowrap",children:new Date(e.created_at).toLocaleDateString()})]},e.id))})]})})})]})}var i=a(6650),d=a(2617),c=a(9064);function o(){let[e,s]=(0,r.useState)([]),[a,o]=(0,r.useState)(!0),[x,m]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{(0,d.ni)().then(s).catch(e=>c.ZP.error(e.message)).finally(()=>o(!1))},[]),(0,t.jsx)(n.Z,{children:(0,t.jsxs)("div",{className:"max-w-7xl mx-auto",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h1",{className:"text-2xl font-bold text-gray-900",children:"Listing Leads"}),!a&&(0,t.jsxs)("p",{className:"text-sm text-gray-500 mt-1",children:[e.length," total leads"]})]}),(0,t.jsxs)("button",{onClick:()=>m(!0),className:"flex items-center gap-2 bg-blue-600 text-white px-5 py-2.5 rounded-lg text-sm font-semibold hover:bg-blue-700 transition-colors shadow-sm",children:[(0,t.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})}),"Send Email"]})]}),a?(0,t.jsx)("div",{className:"bg-white rounded-xl border border-gray-100 shadow-sm p-6 animate-pulse space-y-4",children:[1,2,3,4,5].map(e=>(0,t.jsx)("div",{className:"h-8 bg-gray-100 rounded"},e))}):(0,t.jsx)(l,{leads:e}),x&&(0,t.jsx)(i.Z,{leads:e,onClose:()=>m(!1)})]})})}}},function(e){e.O(0,[458,64,678,226,971,117,744],function(){return e(e.s=6648)}),_N_E=e.O()}]);