(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[311],{3392:function(e,a,s){Promise.resolve().then(s.bind(s,5105))},5105:function(e,a,s){"use strict";s.r(a),s.d(a,{default:function(){return o}});var t=s(7437),r=s(2265),l=s(1549),n=s(6650),d=s(2617),i=s(9064);function o(){let[e,a]=(0,r.useState)([]),[s,o]=(0,r.useState)(!0),[c,x]=(0,r.useState)(""),[m,h]=(0,r.useState)(!1);(0,r.useEffect)(()=>{(0,d.iu)().then(a).catch(e=>i.ZP.error(e.message||"Failed to fetch home value leads")).finally(()=>o(!1))},[]);let u=e.filter(e=>{let a=c.toLowerCase();return e.full_name.toLowerCase().includes(a)||e.email.toLowerCase().includes(a)}),p=e.map(e=>({id:e.id,name:e.full_name,email:e.email}));return(0,t.jsx)(l.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:"Home Value Leads"}),!s&&(0,t.jsxs)("p",{className:"text-sm text-gray-500 mt-1",children:[e.length," total leads"]})]}),(0,t.jsxs)("button",{onClick:()=>h(!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"]})]}),(0,t.jsx)("div",{className:"mb-4",children:(0,t.jsx)("input",{type:"text",placeholder:"Search by name or email…",value:c,onChange:e=>x(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"})}),s?(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)("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===u.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","Property Address","Size (sq ft)","Beds","Baths","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:u.map(e=>{var a,s;return(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.full_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 max-w-[220px] truncate",children:e.property_address||"—"}),(0,t.jsx)("td",{className:"px-4 py-3 text-gray-600 whitespace-nowrap",children:e.house_size?e.house_size.toLocaleString():"—"}),(0,t.jsx)("td",{className:"px-4 py-3 text-gray-600 whitespace-nowrap",children:null!==(a=e.bedrooms)&&void 0!==a?a:"—"}),(0,t.jsx)("td",{className:"px-4 py-3 text-gray-600 whitespace-nowrap",children:null!==(s=e.bathrooms)&&void 0!==s?s:"—"}),(0,t.jsx)("td",{className:"px-4 py-3 text-gray-500 whitespace-nowrap",children:new Date(e.created_at).toLocaleDateString()})]},e.id)})})]})})}),m&&(0,t.jsx)(n.Z,{leads:p,onClose:()=>h(!1)})]})})}}},function(e){e.O(0,[458,64,678,226,971,117,744],function(){return e(e.s=3392)}),_N_E=e.O()}]);