PageSourceSearch

https://reamintell.com/assets/Reports-BZv3WkaP.js

js reamintell.com collected 2026-10-02 16:14:20 UTC 11,287 bytes, 30 lines download raw bytes

1import{j as e}from"./vendor-grid-ClmSNH6q.js";import{F as v,k as _,T as y,B as R,U as $,O as k,a9 as S,bk as E,o as T}from"./index-DBBMBrQC.js";import{l as C}from"./lease-text-to-html-1CosH3j_.js";import{r as n}from"./vendor-charts-B2bLUVVL.js";import{b as l}from"./Card-BUL_z2x0.js";import{P as D}from"./PageHeader-ClJL8uuT.js";const L=" https://reamintell.com";function G(){const[c,u]=n.useState("portfolio_performance"),[o,j]=n.useState(`${new Date().getFullYear()}-01-01`),[x,f]=n.useState(`${new Date().getFullYear()}-12-31`),[i,p]=n.useState(!1),[s,m]=n.useState(null),[h,g]=n.useState(null),w=async()=>{p(!0),g(null),m(null);try{const t=T(),a=await fetch(`${L}/api/reports/generate`,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":t},body:JSON.stringify({report_type:c,date_range:{start:o,end:x}})}),r=await a.json();if(!a.ok)throw new Error(r.error||"Failed to generate report");if(r.success&&r.report)m(r.report);else throw new Error("Invalid response from server")}catch(t){g(t.message||"Failed to generate report")}finally{p(!1)}},b=()=>{if(!s)return;const t=`
2${s.report_type.toUpperCase().replace(/_/g," ")} REPORT
3Generated: ${new Date(s.generated_at).toLocaleString()}
4Date Range: ${s.date_range.start} to ${s.date_range.end}
5
6${"=".repeat(80)}
7
8EXECUTIVE SUMMARY
9${"=".repeat(80)}
10
11${s.narrative}
12
13${"=".repeat(80)}
14
15KEY METRICS
16${"=".repeat(80)}
17
18${JSON.stringify(s.summary,null,2)}
19
20${"=".repeat(80)}
21
22DETAILED DATA
23${"=".repeat(80)}
24
25${JSON.stringify(s.data,null,2)}
26
27${"=".repeat(80)}
28
29Report generated by REAM AI
30`,a=new Blob([t],{type:"text/plain"}),r=window.URL.createObjectURL(a),d=document.createElement("a");d.href=r,d.download=`${s.report_type}_${s.date_range.start}_to_${s.date_range.end}.txt`,document.body.appendChild(d),d.click(),document.body.removeChild(d),window.URL.revokeObjectURL(r)},N={portfolio_performance:k,tenant_analysis:$,property_comparison:R}[c];return e.jsxs("div",{className:"space-y-6",children:[e.jsx(D,{title:"Reports",subtitle:"Generate comprehensive AI-powered reports for your portfolio",onShowGuide:()=>window.dispatchEvent(new CustomEvent("ream-open-guide",{detail:"reports"}))}),e.jsx(l,{children:e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{children:e.jsxs("h2",{className:"text-lg font-semibold text-gray-900 mb-4 flex items-center gap-2",children:[e.jsx(v,{className:"w-5 h-5 text-brand-navy"}),"Report Configuration"]})}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Report Type"}),e.jsxs("select",{value:c,onChange:t=>u(t.target.value),className:"w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-brand-navy focus:border-transparent",disabled:i,children:[e.jsx("option",{value:"portfolio_performance",children:"Portfolio Performance"}),e.jsx("option",{value:"tenant_analysis",children:"Tenant Analysis"}),e.jsx("option",{value:"property_comparison",children:"Property Comparison"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Start Date"}),e.jsx("input",{type:"date",value:o,onChange:t=>j(t.target.value),className:"w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-brand-navy focus:border-transparent",disabled:i})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"End Date"}),e.jsx("input",{type:"date",value:x,onChange:t=>f(t.target.value),className:"w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-brand-navy focus:border-transparent",disabled:i})]})]}),e.jsx("div",{children:e.jsx("button",{onClick:w,disabled:i,className:"w-full md:w-auto px-6 py-3 bg-brand-navy text-white rounded-lg hover:bg-blue-700 disabled:bg-gray-300 disabled:cursor-not-allowed transition-colors flex items-center justify-center gap-2",children:i?e.jsxs(e.Fragment,{children:[e.jsx(_,{className:"w-5 h-5 animate-spin"}),"Generating Report..."]}):e.jsxs(e.Fragment,{children:[e.jsx(y,{className:"w-5 h-5"}),"Generate Report"]})})})]})}),h&&e.jsx(l,{className:"border-red-200 bg-red-50",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"flex-shrink-0 w-8 h-8 bg-red-100 rounded-full flex items-center justify-center",children:e.jsx("span",{className:"text-red-600 font-bold",children:"!"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"text-sm font-semibold text-red-900",children:"Error Generating Report"}),e.jsx("p",{className:"text-sm text-red-700 mt-1",children:h})]})]})}),s&&e.jsxs("div",{className:"space-y-6",children:[e.jsx(l,{className:"bg-gradient-to-r from-brand-navy to-blue-600 text-white",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"w-12 h-12 bg-white/20 rounded-lg flex items-center justify-center",children:e.jsx(N,{className:"w-6 h-6"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-bold",children:s.report_type.replace(/_/g," ").toUpperCase()}),e.jsxs("p",{className:"text-white/80 text-sm",children:[new Date(s.generated_at).toLocaleStr
30ing()," • ",s.date_range.start," to ",s.date_range.end]})]})]}),e.jsxs("button",{onClick:b,className:"px-4 py-2 bg-white/20 hover:bg-white/30 rounded-lg transition-colors flex items-center gap-2",children:[e.jsx(S,{className:"w-4 h-4"}),"Download"]})]})}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:Object.entries(s.summary).map(([t,a])=>e.jsx(l,{className:"bg-gray-50",children:e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium text-gray-600 uppercase tracking-wide",children:t.replace(/_/g," ")}),e.jsx("p",{className:"text-2xl font-bold text-gray-900 mt-2",children:typeof a=="number"&&t.includes("revenue")?`$${a.toLocaleString()}`:typeof a=="number"&&t.includes("rate")?`${a}%`:String(a)})]})},t))}),e.jsx(l,{children:e.jsxs("div",{children:[e.jsxs("h3",{className:"text-lg font-semibold text-gray-900 mb-4 flex items-center gap-2",children:[e.jsx(y,{className:"w-5 h-5 text-brand-navy"}),"Executive Summary"]}),e.jsx("div",{className:"prose prose-sm max-w-none",children:e.jsx("div",{className:"prose prose-sm max-w-none text-gray-700",dangerouslySetInnerHTML:{__html:E(C(s.narrative))}})})]})}),e.jsx(l,{children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-4",children:"Detailed Data"}),s.data.property_performance&&e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"min-w-full divide-y divide-gray-200",children:[e.jsx("thead",{className:"bg-gray-50",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Property"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Occupied"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Total Units"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Occupancy"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Monthly Revenue"})]})}),e.jsx("tbody",{className:"bg-white divide-y divide-gray-200",children:s.data.property_performance.map((t,a)=>e.jsxs("tr",{children:[e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900",children:t.name}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500",children:t.occupied_units}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500",children:t.total_units}),e.jsxs("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500",children:[t.occupancy_rate,"%"]}),e.jsxs("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500",children:["$",t.monthly_revenue]})]},a))})]})}),s.data.tenants&&e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"min-w-full divide-y divide-gray-200",children:[e.jsx("thead",{className:"bg-gray-50",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Tenant"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Property"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Status"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Monthly Rent"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Lease Start"})]})}),e.jsx("tbody",{className:"bg-white divide-y divide-gray-200",children:s.data.tenants.map((t,a)=>e.jsxs("tr",{children:[e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900",children:t.name}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500",children:t.property}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500",children:e.jsx("span",{className:`px-2 py-1 rounded-full text-xs font-semibold ${t.lease_status==="active"?"bg-green-100 text-green-800":"bg-gray-100 text-gray-800"}`,children:t.lease_status})}),e.jsxs("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500",children:["$",t.monthly_rent]}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500",children:t.lease_start})]},a))})]})}),s.data.properties&&e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"min-w-full divide-y divide-gray-200",children:[e.jsx("thead",{className:"bg-gray-50",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Property"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Address"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Type"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Active Leases"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Monthly Revenue"})]})}),e.jsx("tbody",{className:"bg-white divide-y divide-gray-200",children:s.data.properties.map((t,a)=>e.jsxs("tr",{children:[e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900",children:t.name}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500",children:t.address}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500",children:t.type}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500",children:t.active_leases}),e.jsxs("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500",children:["$",t.monthly_revenue]})]},a))})]})})]})})]})]})}export{G 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.