PageSourceSearch

https://smb1001.ai/assets/executive-report-viewer-Jd9ihf5U.js

js smb1001.ai collected 2026-10-05 15:08:00 UTC 5,044 bytes, 1 lines download raw bytes

1import{z as T,u as A,n as L,l as F,j as e,L as x,B as P,A as S}from"./index-CYWzIoL_.js";import{B as s}from"./button-CKTFDFlx.js";import{c as h,C as U,a as B,d as E,b}from"./card-4V0TQtKc.js";import{S as f}from"./primitives-UZSBD4ri.js";import{b as $}from"./vendor-recharts-CNbq9ujH.js";import{ExecutiveReportContent as z}from"./ExecutiveReport-DmF4oWQW.js";import{C as w}from"./circle-alert-CxoedvwX.js";import{A as j}from"./arrow-left-CC_Obl3R.js";import{F as O}from"./file-text-5H6scefd.js";import{D as J}from"./download-DZBUAaJp.js";import"./animations-8dOrGFrp.js";import"./score-colors-ByP4NK_E.js";import"./badge-hGuU_1lf.js";import"./skeleton-CLq8jbwF.js";import"./table-C991XdSQ.js";import"./select-3DlU0bPm.js";import"./index-BdQq_4o_.js";import"./index-CPFQCbBx.js";import"./Combination-4h0MUD61.js";import"./index-ZLblNrkv.js";import"./chevron-down-DSXWubwf.js";import"./check-Duy9todO.js";import"./chevron-up-DfIIpUd0.js";import"./chart-tooltip-h6LdJT0u.js";import"./horizontal-bar-gradient-Cp5dthJz.js";import"./triangle-alert-CNTU6BGr.js";import"./chart-column-Bfbu4mvn.js";import"./trending-up-xJhWHW9T.js";import"./target-XO1f44hG.js";import"./shield-4y0JuBi_.js";import"./calendar-D2P_CWPx.js";const M=["January","February","March","April","May","June","July","August","September","October","November","December"];function je(){const[,v]=T("/cssm/executive-reports/:id"),[,y]=A(),{toast:k}=L(),[a,i]=$.useState(null),n=v?.id,{data:t,isLoading:g,error:N}=F({queryKey:["/api/analytics/executive-reports",n],queryFn:S({on401:"throw"}),enabled:!!n}),d=async o=>{if(t){i(o);try{const D=`/api/analytics/executive-report/export-${o}`,m=await P(),p=await fetch(D,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json",...m?{"X-CSRF-Token":m}:{}},body:JSON.stringify({month:t.reportMonth,year:t.reportYear,...t.reportData?{reportData:t.reportData}:{},...t.aiAnalysis?{aiAnalysis:t.aiAnalysis}:{}})});if(!p.ok)throw new Error("Download failed");const R=await p.blob(),u=URL.createObjectURL(R),r=document.createElement("a");r.href=u,r.download=`executive_report_${M[t.reportMonth-1].toLowerCase()}_${t.reportYear}_${Date.now()}.${o}`,document.body.appendChild(r),r.click(),URL.revokeObjectURL(u),document.body.removeChild(r)}catch{k({title:"Download failed",description:`Could not download ${o.toUpperCase()}`,variant:"destructive"})}i(null)}},l=()=>{window.history.length>1?window.history.back():y("/")};if(g)return e.jsx("div",{className:"p-8","data-testid":"executive-report-loading",children:e.jsxs("div",{className:"max-w-6xl mx-auto space-y-4",children:[e.jsx(f,{hasHeader:!0,lines:4}),e.jsx(f,{hasHeader:!0,lines:6})]})});if(N||!t)return e.jsx("div",{className:"h-full overflow-y-auto bg-gradient-to-br from-slate-50 to-slate-100 dark:from-background dark:to-background/80 p-8","data-testid":"executive-report-error",children:e.jsx("div",{className:"max-w-6xl mx-auto",children:e.jsxs(h,{className:"border-destructive",children:[e.jsxs(U,{children:[e.jsxs(B,{className:"flex items-center gap-2 text-destructive",children:[e.jsx(w,{className:"h-5 w-5"}),"Report Not Found"]}),e.jsx(E,{children:"The executive report you're looking for could not be loaded."})]}),e.jsx(b,{children:e.jsxs(s,{variant:"outline",onClick:l,"data-testid":"button-back-to-reports",children:[e.jsx(j,{className:"h-4 w-4 mr-2"}),"Back to Reports"]})})]})})});const c=t.reportData,C=t.aiAnalysis;return e.jsxs("div",{className:"h-full overflow-y-auto bg-gradient-to-br from-slate-50 to-slate-100 dark:from-background dark:to-background/80 print:bg-card","data-testid":"executive-report-viewer",children:[e.jsx("div",{className:"print:hidden sticky top-0 z-10 bg-card/80 backdrop-blur-sm border-b border-border p-4 shadow-sm",children:e.jsxs("div",{className:"max-w-6xl mx-auto flex items-center justify-between",children:[e.jsxs(s,{variant:"outline",size:"sm",onClick:l,"data-testid":"button-back-to-reports",children:[e.jsx(j,{className:"h-4 w-4 mr-2"}),"Back to Reports"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(s,{variant:"outline",size:"sm",onClick:()=>d("pdf"),disabled:a!==null,"data-testid":"button-download-pdf",children:[a==="pdf"?e.jsx(x,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx(O,{className:"h-4 w-4 mr-2"}),"PDF"]}),e.jsxs(s,{variant:"outline",size:"sm",onClick:()=>d("pptx"),disabled:a!==null,"data-testid":"button-download-pptx",children:[a==="pptx"?e.jsx(x,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx(J,{className:"h-4 w-4 mr-2"}
1),"PPTX"]})]})]})}),e.jsx("div",{className:"max-w-6xl mx-auto p-6 md:p-8",children:c?e.jsx(z,{reportData:c,aiAnalysis:C}):e.jsx(h,{children:e.jsxs(b,{className:"flex flex-col items-center justify-center py-16 text-center",children:[e.jsx(w,{className:"h-16 w-16 text-muted-foreground mb-4"}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Report Data Unavailable"}),e.jsx("p",{className:"text-muted-foreground max-w-md",children:"The saved report data could not be loaded. Try downloading the PDF or PPTX instead."})]})})})]})}export{je 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.