1import{r as d,j as e,Q as m,c as y,C as v,v as w,L as R,H as p,O as C,t as b}from"./index-BJRQ5ypg.js";import{x as A,C as D,w as L,j as S,n as T,o as F}from"./offers.queries-ACEF8t8A.js";import{F as U}from"./file-spreadsheet-CUypz-Fn.js";import{D as O}from"./dollar-sign-UW3M76m2.js";import"./properties.queries-CYnq1GpO.js";const P=[{value:"ALL",label:"All"},{value:"PENDING",label:"Active"},{value:"COUNTER_OFFERED",label:"Countered"},{value:"ACCEPTED",label:"Accepted"},{value:"REJECTED",label:"Rejected"},{value:"WITHDRAWN",label:"Withdrawn"},{value:"EXPIRED",label:"Expired"}],I=["PENDING","UNDER_REVIEW","COUNTER_OFFERED","BUYER_COUNTER_OFFERED"],h={PENDING:{bg:"bg-yellow-100",text:"text-yellow-800",label:"Submitted"},UNDER_REVIEW:{bg:"bg-blue-100",text:"text-blue-800",label:"Under Review"},COUNTER_OFFERED:{bg:"bg-blue-100",text:"text-blue-800",label:"Countered"},BUYER_COUNTER_OFFERED:{bg:"bg-purple-100",text:"text-purple-800",label:"Buyer Countered"},ACCEPTED:{bg:"bg-green-100",text:"text-green-800",label:"Accepted"},REJECTED:{bg:"bg-red-100",text:"text-red-800",label:"Rejected"},WITHDRAWN:{bg:"bg-gray-100",text:"text-gray-700",label:"Withdrawn"},EXPIRED:{bg:"bg-gray-50",text:"text-gray-500",label:"Expired"},SCHEDULED:{bg:"bg-amber-100",text:"text-amber-800",label:"Scheduled"}};function X(){const[l,c]=d.useState("ALL"),i=d.useMemo(()=>{if(l!=="ALL")return l==="PENDING"?I:[l]},[l]),{data:a,isLoading:f,isError:N,error:g}=A(i?{statuses:i}:void 0),[x,u]=d.useState(!1),E=async()=>{u(!0);try{const t=await F.exportPipelineToXlsx(i?{statuses:i}:void 0),r=URL.createObjectURL(t),s=document.createElement("a");s.href=r,s.download=`my-pipeline-${new Date().toISOString().slice(0,10)}.xlsx`,document.body.appendChild(s),s.click(),s.remove(),URL.revokeObjectURL(r),b.success("Exported pipeline to Excel")}catch(t){const r=t instanceof Error?t.message:"Export failed";b.error(r)}finally{u(!1)}};return e.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-6",children:[e.jsxs("div",{className:"flex items-start justify-between mb-6",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(m,{className:"w-6 h-6 text-[#009FE4]"}),e.jsx("h1",{className:"text-2xl font-semibold text-gray-900",children:"My Pipeline"})]}),e.jsx("p",{className:"text-sm text-gray-500",children:"Every offer across every listing you have. Filter by status, export to Excel."})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("button",{onClick:E,disabled:x||!a||a.totals.offers===0,className:"inline-flex items-center px-3.5 py-2 border border-gray-200 text-gray-700 rounded-md text-sm font-medium hover:bg-gray-50 hover:border-gray-300 transition-colors disabled:opacity-50",title:"Download every offer in the current filter as XLSX",children:[x?e.jsx(y,{className:"w-3.5 h-3.5 mr-1.5 animate-spin"}):e.jsx(U,{className:"w-3.5 h-3.5 mr-1.5 text-gray-500"}),x?"Exportingâ¦":"Export XLSX"]})})]}),e.jsx("div",{className:"flex flex-wrap items-center gap-1.5 mb-6 border-b border-gray-200 pb-3",children:P.map(t=>e.jsx("button",{onClick:()=>c(t.value),className:`px-3 py-1.5 rounded-md text-sm font-medium transition-colors ${l===t.value?"bg-[#009FE4] text-white":"text-gray-700 hover:bg-gray-100"}`,children:t.label},t.value))}),a&&e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3 mb-6",children:[e.jsx(n,{label:"Listings",value:String(a.totals.properties),icon:e.jsx(m,{className:"w-5 h-5 text-gray-400"})}),e.jsx(n,{label:"Total Offers",value:String(a.totals.offers),icon:e.jsx(O,{className:"w-5 h-5 text-gray-400"})}),e.jsx(n,{label:"Accepted",value:String(a.groups.reduce((t,r)=>t+r.stats.accepted,0)),icon:e.jsx(v,{className:"w-5 h-5 text-green-500"})}),e.jsx(n,{label:"Active",value:String(a.groups.reduce((t,r)=>t+r.stats.active,0)),icon:e.jsx(D,{className:"w-5 h-5 text-yellow-500"})})]}),f&&e.jsxs("div",{className:"py-16 text-center",children:[e.jsx(y,{className:"mx-auto w-8 h-8 text-[#009FE4] animate-spin"}),e.jsx("p",{className:"mt-3 text-sm text-gray-500",children:"Loading your pipelineâ¦"})]}),N&&e.jsxs("div",{className:"py-12 text-center",children:[e.jsx(w,{className:"mx-auto w-8 h-8 text-red-500"}),e.jsx("p",{className:"mt-3 text-sm text-gray-900",children:"Failed to load pipeline"}),e.jsx("p",{className:"mt-1 text-xs text-gray-500",children:g instanceof Error?g.message:"Please try again later."})]}),a&&a.groups.length===0&&e.jsxs("div",{className:"py-16 text-center bg-gray-50 rounded-lg",children:[e.jsx(m,{className:"mx-auto w-12 h-12 text-gray-300"}),e.jsxs("p",{className:"mt-3 text-sm text-gray-700",children:["No offers ",l!=="ALL"?`with status "${l}"`:"yet","."]}),e.jsx("p",{className:"mt-1 text-xs text-gray-500",children:"Offers will appear here as they come in across your listings."})]}),a&&a.groups.length>0&&e.jsx("div",{className:"space-y-5",children:a.groups.map(t=>{const r=`${t.property.address.street}${t.property.address.unit?` ${t.property.address.unit}`:""}, ${t.property.address.city}, ${t.property.address.state} ${t.property.address.zipCode}`;return e.jsxs("div",{className:"bg-white border border-gray-200 rounded-lg overflow-hidden",children:[e.jsxs("div",{className:"px-4 py-3 bg-gray-50 border-b border-gray-200 flex items-center justify-between",children:[e.jsxs(R,{to:`/properties/${t.property._id}`,className:"flex items-center gap-2 text-sm font-medium text-gray-900 hover:text-[#009FE4]",children:[r,e.jsx(L,{className:"w-4 h-4 text-gray-400"})]}),e.jsxs("div",{className:"flex items-center gap-3 text-xs text-gray-500",children:[typeof t.property.price=="number"&&e.jsxs("span",{children:["List ",p(t.property.price)]}),e.jsxs("span",{children:[t.stats.total," offer",t.stats.total===1?"":"s",t.stats.active>0&&e.jsxs("span",{className:"ml-1 text-yellow-700",children:["(",t.stats.active," active)"]})]}),t.stats.highestActiveAmount!==null&&e.jsxs("span",{className:"font-medium text-gray-700",children:["High: ",p(t.stats.highestActiveAmount)]})]})]}),e.jsx("div",{className:"divide-y divide-gray-100",children:t.offers.map(s=>{const j=S(s),o=h[j]||h.PENDING;return e.jsxs("div",{className:"px-4 py-3 flex flex-wrap items-center gap-3 text-sm",children:[e.jsx("span",{className:"font-semibold text-gray-900 w-32",children:p(s.offerAmount)}),e.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded text-xs font-medium ${o.bg} ${o.text}`,children:o.label}),e.jsx("span",{className:"text-gray-700",children:s.agentName}),s.agentBrokerage&&e.jsxs("span",{className:"text-gray-400 text-xs",children:["(",s.agentBrokerage,")"]}),s.commission&&e.jsxs("span",{className:"text-xs text-gray-500",title:"Buyer broker compensation",children:[T(s.commission)," comm."]}),s.financingType&&e.jsx("span",{className:"text-xs text-gray-500",children:s.financingType}),e.jsx("span",{className:"ml-auto text-xs text-gray-400",children:C(s.submittedAt)})]},s._id)})})]},t.property._id)})})]})}function n({label:l,value:c,icon:i}){return e.jsxs("div",{className:"bg-white border border-gray-200 rounded-lg p-4 flex items-center gap-3",children:[e.jsx("div",{className:"flex-shrink-0",children:i}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-gray-500",children:l}),e.jsx("p",{className:"text-lg font-semibold text-gray-900",children:c})]})]})}export{X as default}; 2//# sourceMappingURL=PipelinePage-BqsZoRFw.js.map
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.