PageSourceSearch

https://smartmanageai.ai/assets/ai-takeoff-dashboard-B1ae10rK.js

js smartmanageai.ai collected 2026-10-05 15:06:23 UTC 6,856 bytes, 1 lines download raw bytes

1import{r as o,j as e}from"./vendor-react-DKbe1Umz.js";import{r as f,B as j,S as w,g as v,h as k,i as S,j as T,C as r,s as n,t as m,v as c,l as p}from"./index-DZ74KeH3.js";import{u as C}from"./vendor-data-CjSe2wkl.js";import{T as L,a as D,b,c as t,d as $,e as l}from"./table-CAeITjOT.js";import{c1 as A,b6 as I,c0 as M,J as P,a$ as B,E}from"./vendor-ui-DMaW9-Ov.js";import{a as O}from"./vendor-dates-5UNeOyFW.js";import"./vendor-charts-DWX9qznF.js";import"./vendor-forms-C2vWC2ab.js";const N=[{value:"1",label:"Last 24 hours"},{value:"7",label:"Last 7 days"},{value:"30",label:"Last 30 days"},{value:"90",label:"Last 90 days"}];function J(){const[d,g]=o.useState("7"),{data:s,isLoading:h,error:u}=C({queryKey:["/api/ai-features/takeoff/scale-mismatches",{sinceDays:d}],queryFn:async()=>{const a=await fetch(`/api/ai-features/takeoff/scale-mismatches?sinceDays=${encodeURIComponent(d)}`,{credentials:"include"});if(!a.ok)throw new Error(`Failed to load summary: ${a.status}`);return a.json()}}),y=o.useMemo(()=>s?Math.round(s.mismatchRate*100):0,[s]),x=o.useMemo(()=>{var a;return((a=N.find(i=>i.value===d))==null?void 0:a.label.toLowerCase())??"this window"},[d]);return e.jsx("div",{className:"min-h-screen bg-background","data-testid":"page-ai-takeoff-dashboard",children:e.jsxs("main",{className:"mx-auto max-w-full px-4 py-6 sm:px-6 sm:py-8",children:[e.jsx("div",{className:"mb-4",children:e.jsx(f,{href:"/takeoff",children:e.jsxs(j,{variant:"ghost",size:"sm","data-testid":"button-back-to-takeoff",children:[e.jsx(A,{className:"w-4 h-4 mr-1"})," Back to Takeoff"]})})}),e.jsxs("div",{className:"mb-6 flex items-start justify-between gap-4 flex-wrap",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-semibold flex items-center gap-2","data-testid":"text-ai-takeoff-dashboard-title",children:[e.jsx(I,{className:"w-6 h-6 text-primary"}),"AI Takeoff Dashboard"]}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1 max-w-2xl",children:"Tracks AI-detected drawing scales that disagree with the user's calibrated scale by more than 5%. Use the list below to triage which sheets to recalibrate before quantities ship."})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"Window"}),e.jsxs(w,{value:d,onValueChange:g,children:[e.jsx(v,{className:"w-[160px]","data-testid":"select-scale-mismatch-window",children:e.jsx(k,{})}),e.jsx(S,{children:N.map(a=>e.jsx(T,{value:a.value,children:a.label},a.value))})]})]})]}),h&&e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground py-12 justify-center","data-testid":"text-ai-takeoff-dashboard-loading",children:[e.jsx(M,{className:"w-4 h-4 animate-spin"})," Loading scale-mismatch summary…"]}),u&&e.jsxs("div",{className:"flex items-center gap-2 text-destructive py-12 justify-center","data-testid":"text-ai-takeoff-dashboard-error",children:[e.jsx(P,{className:"w-4 h-4"})," Failed to load summary."]}),!h&&!u&&s&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-4 sm:grid-cols-3 mb-6",children:[e.jsxs(r,{"data-testid":"tile-scale-mismatch-count",children:[e.jsx(n,{className:"pb-2",children:e.jsx(m,{className:"text-sm font-medium text-muted-foreground",children:"Scale mismatches"})}),e.jsx(c,{children:e.jsxs("div",{className:"flex items-end gap-2",children:[e.jsx("span",{className:"text-3xl font-semibold tabular-nums","data-testid":"text-mismatch-count",children:s.mismatchCount}),e.jsxs("span",{className:"text-xs text-muted-foreground pb-1",children:["sheets ",x]})]})})]}),e.jsxs(r,{"data-testid":"tile-scale-mismatch-rate",children:[e.jsx(n,{className:"pb-2",children:e.jsx(m,{className:"text-sm font-medium text-muted-foreground",children:"Mismatch rate"})}),e.jsx(c,{children:e.jsxs("div",{className:"flex items-end gap-2",children:[e.jsxs("span",{className:"text-3xl font-semibold tabular-nums","data-testid":"text-mismatch-rate",children:[y,"%"]}),e.jsxs("span",{className:"text-xs text-muted-foreground pb-1",children:["of ",s.totalAnalyses," analyses"]})]})})]}),e.jsxs(r,{"data-testid":"tile-total-analyses",children:[e.jsx(n,{className:"pb-2",children:e.jsx(m,{className:"text-sm font-medium text-muted-foreground",children:"Analyses run"})}),e.jsx(c,{children:e.jsxs("div",{className:"flex items-end gap-2",children:[e.jsx("span",{className:"text-3xl font-semibold tabular-nums","data-testid":"text-total-analyses",children:s.totalAnalyses}),e.jsx("span",{className:"text-xs text-muted-foreground pb-1",children:x})]})})]})]}),s.sheets.length===0?e.jsx(r,{"data-testid":"card-scale-mismatch-empty",children:e.jsxs(c,{className:"py-12 text-center text-muted-foreground",children:[e.jsx(B,{className:"w-10 h-10 mx-auto mb-2 opacity-50"}),"No scale mismatches recorded ",x,"."]})}):e.jsxs(r,{children:[e.jsx(n,{className:"pb-2",children:e.jsx(m,{className:"text-base",children:"Affected sheets"})}),e.jsx(c,{className:"p-0 overflow-x-auto",children:e.jsxs(L,{"data-testid":"table-scale-mismatch-sheets",children:[e.jsx(D,{children:e.jsxs(b,{children:[e.jsx(t,{children:"Sheet"}),e.jsx(t,{children:"Trade"}),e.jsx(t,{children:"Detected scale"}),e.jsx(t,{children:"Calibrated scale"}),e.jsx(t,{className:"text-right",children:"Delta"}),e.jsx(t,{children:"When"}),e.jsx(t,{className:"text-right",children:"Open"})]})}),e.jsx($,{children:s.sheets.map(a=>{const i=a.scaleDeltaPercent!==null?Math.round(a.scaleDeltaPercent*100):null;return e.jsxs(b,{"data-testid":`row-scale-mismatch-${a.id}`,children:[e.jsxs(l,{className:"max-w-[260px]",children:[e.jsx("div",{className:"font-medium truncate","data-testid":`text-mismatch-sheet-name-${a.id}`,children:a.fileName||"Untitled sheet"}),e.jsx("div",{className:"text-xs text-muted-foreground truncate",children:a.takeoffSheetId?`Sheet ${a.takeoffSheetId.slice(0,8)}`:"No linked sheet"})]}),e.jsx(l,{children:e.jsx(p,{variant:"secondary",className:"text-xs",children:a.tradeType})}),e.jsx(l,{className:"text-xs font-mono","data-testid":`text-mismatch-detected-${a.id}`,children:a.detectedScaleLabel||"—"}),e.jsx(l,{className:"text-xs font-mono","data-testid":`text-mismatch-calibrated-${a.id}`,children:a.calibratedScaleLabel||"—"}),e.jsx(l,{className:"text-right tabular-nums","data-testid":`text-mismatch-delta-${a.id}`,children:i!==null?e.jsxs(p,{variant:i>=25?"destructive":"outline",className:"text-xs",children:[i,"%"]}):"—"}),e.jsx(l,{className:"text-xs text-muted-foreground whitespace-nowrap",children:O(new Date(a.createdAt),"MMM d, h:mm a")}),e.jsx(l,{className:"text-right",children:a.bidId?e.jsx(f,{href:`/takeoff/${a.bidId}`,children:e.jsxs(j,{size:"sm",variant:"outline","data-testid":`button-open-takeoff-${a.id}`,children:[e.jsx(E,{className:"w-3 h-3 mr-1"}),"Open"]})}):e.jsx("span",{className:"text-xs text-muted-foreground",children:"—"})})]},a.id)})})]})})]})]})]})})}export{J 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.