PageSourceSearch

https://intel-base.ai/assets/ReadingsScreen-DyX1bJ6k.js

js intel-base.ai collected 2026-10-05 15:37:26 UTC 12,185 bytes, 1 lines download raw bytes

1import{j as e,r as i,i as H,u as K}from"./react-vendor-BDFCGFgF.js";import{P as Y}from"./PlankFloorIcon-D_IKscXl.js";import{M as Q}from"./MoistureTopBar-D-OCNXiN.js";import{P as X}from"./plus-3ewMnmS_.js";import{I as T,br as Z,b as ee,B as G}from"./index-CnoOAt8u.js";import{R as te,A as se}from"./moisture-C0K8RFYq.js";import{c as O,a as ae,b as z,d as ne,g as re}from"./moisture-calculations-DTy4C26_.js";import{F as oe,a as L}from"./FieldGroupCard-BkNOEzdE.js";import{T as le,a as ie,b as E}from"./tabs-voX3A16L.js";import{u as de}from"./SyncStatusIndicator-DcM2ABEB.js";import{G as ce}from"./grid-3x3-0WHiUacC.js";import{T as ue}from"./thermometer-oL4PINvZ.js";import"./supabase-Cw9ajmI9.js";import"./radix-C1DJG546.js";import"./cloud-off-DMd5tTLO.js";import"./cloud-BBU-cp5o.js";const me=["text-primary","text-primary","text-primary"];function V({stats:a}){return e.jsx("div",{className:"grid grid-cols-3 gap-2",children:a.map((o,s)=>{const v=o.value!=="—"?me[s]||"text-foreground":"text-muted-foreground";return e.jsxs("div",{className:"border border-border bg-card rounded-xl p-3 text-center",children:[e.jsx("div",{className:`text-lg font-semibold ${v}`,children:o.value}),e.jsx("div",{className:"text-[10px] text-muted-foreground mt-0.5",children:o.label})]},s)})})}function B({sequenceNumber:a,value:o,onClick:s}){const l=o===void 0;return e.jsx("button",{onClick:s,className:`aspect-square rounded-xl border-2 flex flex-col items-center justify-center transition-all min-h-[64px] ${l?"border-primary/40 bg-gradient-to-br from-primary/15 to-primary/5 hover:from-primary/25 hover:to-primary/10 hover:border-primary/60 shadow-sm":"border-primary/20 bg-primary/5"}`,children:l?e.jsxs(e.Fragment,{children:[e.jsx(X,{className:"h-5 w-5 text-primary"}),e.jsxs("span",{className:"text-[10px] text-primary/80 font-medium mt-0.5",children:["Add #",a]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"text-sm font-medium text-primary",children:[o.toFixed(1),"%"]}),e.jsxs("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:["#",a]})]})})}function W({readings:a,onTileClick:o}){const s=a.length+1;return e.jsxs("div",{className:"grid grid-cols-4 gap-2",children:[a.map((l,v)=>e.jsx(B,{sequenceNumber:l.sequence_number,value:l.value_pct,onClick:()=>o(l.sequence_number,l)},l.id||v)),e.jsx(B,{sequenceNumber:s,onClick:()=>o(s)})]})}function J({open:a,sequenceNumber:o,existing:s,hideLocation:l,onSave:v,onDelete:g,onClose:h}){const[b,n]=i.useState(""),[k,c]=i.useState(""),[j,m]=i.useState(""),[N,x]=i.useState(null),y=i.useRef(null),R=t=>t?t.length===1?`0.${t}`:`${t.slice(0,-1)}.${t.slice(-1)}`:"",d=b?parseFloat(R(b)):NaN,S=R(b);if(i.useEffect(()=>{var t;a&&(n(s?Math.round(s.value_pct*10).toString():""),c((s==null?void 0:s.notes)||""),m((s==null?void 0:s.location)||""),x((s==null?void 0:s.condition)||null),(t=y.current)==null||t.scrollTo(0,0))},[a,s]),!a)return null;const C=()=>{isNaN(d)||d<0||v(d,k,j,N)},f=t=>{n(p=>p.length>=5||p===""&&t==="0"?p:p+t)},A=t=>{t.key>="0"&&t.key<="9"?(t.preventDefault(),f(t.key)):t.key==="Backspace"||t.key==="Delete"?(t.preventDefault(),n(p=>p.slice(0,-1))):t.key==="."||t.key===","?t.preventDefault():t.key==="Enter"&&(t.preventDefault(),C())};return e.jsx("div",{className:"fixed inset-0 z-50 flex items-end sm:items-center justify-center bg-black/50",onClick:h,children:e.jsxs("div",{ref:y,className:"bg-card border border-border rounded-t-2xl sm:rounded-2xl w-full sm:w-[420px] max-h-[85vh] overflow-y-auto shadow-2xl",onClick:t=>t.stopPropagation(),children:[e.jsx("div",{className:"sticky top-0 bg-card border-b border-border px-5 py-4 rounded-t-2xl z-10",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"text-xs text-muted-foreground",children:["Reading #",o]}),e.jsx("div",{className:"text-sm font-semibold text-foreground",children:"Moisture Content (%)"})]}),e.jsx("button",{onClick:h,className:"text-muted-foreground hover:text-foreground text-sm px-2 py-1",children:"✕"})]})}),e.jsxs("div",{className:"p-5 space-y-5",children:[e.jsx(T,{type:"text",inputMode:"numeric",pattern:"[0-9]*",value:S,onKeyDown:A,onChange:()=>{},onBeforeInput:t=>{const p=t.data??"";if(p&&(t.preventDefault(),/^\d+$/.test(p)))for(const $ of p)f($)},className:"text-center text-3xl font-semibold h-16",placeholder:"0.0",autoF
1ocus:!0}),!l&&e.jsxs("div",{children:[e.jsxs("label",{className:"flex items-center gap-1.5 text-xs font-medium text-muted-foreground uppercase tracking-wider mb-2",children:[e.jsx(Z,{size:14,className:"text-blue-500"}),"Location / Room"]}),e.jsx("div",{className:"grid grid-cols-3 gap-1.5 mb-2",children:te.map(t=>e.jsx("button",{type:"button",onClick:()=>m(t),className:`px-2 py-2 text-xs rounded-lg border transition-colors ${j===t?"bg-primary text-primary-foreground border-primary":"bg-secondary/50 text-foreground border-border hover:bg-secondary"}`,children:t},t))})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"flex items-center gap-1.5 text-xs font-medium text-muted-foreground uppercase tracking-wider mb-2",children:[e.jsx(ee,{size:14,className:"text-orange-500"}),"Note / Custom Location"]}),e.jsx(T,{type:"text",value:k,onChange:t=>c(t.target.value),className:"text-sm",placeholder:"Note or custom location…"})]})]}),e.jsxs("div",{className:"sticky bottom-0 bg-card border-t border-border p-5 space-y-2",children:[e.jsx(G,{onClick:C,disabled:!b||isNaN(d),className:"w-full h-12 text-base",children:"Save Reading"}),s&&g&&e.jsx("button",{onClick:g,className:"w-full text-center text-xs text-destructive hover:text-destructive/80 py-1",children:"Delete reading"})]})]})})}function xe({readings:a,mode:o,onAddReading:s,onDeleteReading:l}){const[v,g]=i.useState(!1),[h,b]=i.useState(),[n,k]=i.useState(1),c=a.map(d=>d.value_pct),j=c.length?O(c):null,m=c.length?ae(c):null,N=c.length?z(c):null,x=(d,S)=>{k(d),b(S),g(!0)},y=(d,S,C,f)=>{s(d,S,C,f,h),g(!1)},R=()=>{h&&(l(h.id),g(!1))};return e.jsxs("div",{className:"space-y-4",children:[e.jsx(V,{stats:[{value:j!=null?`${j.toFixed(1)}%`:"—",label:"Average MC"},{value:m!=null?`${m.toFixed(1)}%`:"—",label:"High"},{value:N!=null?`${N.toFixed(1)}%`:"—",label:"Low"}]}),e.jsx(W,{readings:a,onTileClick:x}),e.jsx("p",{className:"text-xs text-muted-foreground",children:o==="full_nwfa"?`${a.length} of 40 readings entered`:"Standard mode: 5 readings minimum recommended. NWFA full mode requires 40 per 1,000 sq ft."}),e.jsx(J,{open:v,sequenceNumber:n,existing:h,hideLocation:o==="shipment",onSave:y,onDelete:h?R:void 0,onClose:()=>g(!1)})]})}function fe({readings:a,flooringReadings:o,widthCategory:s,subfloorType:l,onAddReading:v,onDeleteReading:g}){const[h,b]=i.useState(!1),[n,k]=i.useState(),[c,j]=i.useState(1),m=a.map(f=>f.value_pct),N=o.map(f=>f.value_pct),x=m.length?O(m):null,y=m.length?z(m):null,d=N.length>0&&m.length>0?ne(O(N),x):null,S=re(s),C=(f,A)=>{j(f),k(A),b(!0)};return e.jsxs("div",{className:"space-y-4",children:[e.jsx(V,{stats:[{value:x!=null?`${x.toFixed(1)}%`:"—",label:"Average MC"},{value:d!=null?`${d.toFixed(1)}%`:"—",label:"Differential"},{value:y!=null?`${y.toFixed(1)}%`:"—",label:"Low"}]}),e.jsx(W,{readings:a,onTileClick:C}),d!=null&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Differential is ",d.toFixed(1),"%. NWFA reference limit is ",S,"% (",s==="wide_plank"?"wide plank":"narrow strip","). See the NWFA Guide for context."]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Standard mode: 5 readings minimum recommended. NWFA full mode requires 20 per 1,000 sq ft."}),l==="concrete"&&e.jsxs("div",{className:"text-xs text-muted-foreground bg-accent/50 rounded-xl p-3",children:[e.jsx("strong",{children:"Note:"})," Full concrete testing workflow (ASTM F2170/F1869) is coming in Phase 2. You can enter standard subfloor readings for now."]}),e.jsx(J,{open:h,sequenceNumber:c,existing:n,onSave:(f,A,t,p)=>{v(f,A,t,p,n),b(!1)},onDelete:n?()=>{g(n.id),b(!1)}:void 0,onClose:()=>b(!1)})]})}function pe({job:a,onChange:o}){return e.jsx("div",{className:"space-y-4",children:e.jsxs(oe,{title:"Ambient Conditions",children:[e.jsx(L,{label:"Indoor temperature (°F)",children:e.jsx(T,{type:"number",inputMode:"decimal",value:a.indoor_temp_f??"",onChange:s=>o("indoor_temp_f",s.target.value?parseFloat(s.target.value):null),placeholder:"e.g. 72",className:"border-0 p-0 h-auto text-sm focus-visible:ring-0"})}),e.jsx(L,{label:"Indoor relative humidity (%)",children:e.jsx(T,{type:"number",inputMode:"decimal",value:a.indoor_rh_pct??"",onChange:s=>o("indoor_rh_pct",s.target.value?parseFloat(s.target.value):null),placeholder:"e.g. 40",className:"border-0 p-0 h-auto text-sm focus-visible:ring-0"})}),e.jsx(L,{label:"Acclimation period met?",children:e.jsxs("select",{value:a.acclimation_met||"",onChange:s=>o("acclimation_met",s.target.value||null),className:"w-full text-sm bg-transparent text-foreground focus:outline-none",children:[e.jsx("option",{value:"",children:"Select..."}),Object.entries(se).map(([s,l])=>e.jsx("option",{value:s,children:l},s))]})})]})})}function Te(){const{jobId:a}=H(),o=K(),{loadJob:s,saveJob:l,loadReadings:v,saveReading:g,removeReading:h,syncStatus:b}=de(),[n,k]=i.useState(null),[c,j]=i.useState([]),[m,N]=i.useState([]),[x,y]=i.useState("flooring");i.useEffect(()=>{a&&(s(a).then(r=>r&&k(r)),v(a).then(r=>{j(r.filter(u=>u.reading_type==="flooring")),N(r.filter(u=>u.reading_type==="subfloor"))}))},[a]);const R=(n==null?void 0:n.mode)==="shipment",d=!R,S=!R,C=i.useCallback(async(r,u,w,_,F,M)=>
1{if(!a||!n)return;const U=r==="flooring"?c:m,I=r==="flooring"?j:N;if(M){const D={...M,value_pct:u,notes:w||null,location:_||null,condition:F||null};await g(D),I(q=>q.map(P=>P.id===M.id?D:P))}else{const D={id:crypto.randomUUID(),job_id:a,reading_type:r,value_pct:u,sequence_number:U.length+1,notes:w||null,location:_||null,condition:F||null,created_at:new Date().toISOString()};await g(D),I(q=>[...q,D])}},[a,n,c,m,g]),f=i.useCallback(async(r,u)=>{const w=r==="flooring"?j:N;await h(u),w(_=>_.filter(F=>F.id!==u))},[h]),A=i.useCallback(async(r,u)=>{if(!n)return;const w={...n,[r]:u,updated_at:new Date().toISOString()};k(w),await l(w)},[n,l]),t=async()=>{if(!n)return;const r=c.length>0||m.length>0,u={...n,status:r?"passed":n.status,updated_at:new Date().toISOString()};await l(u),o(`/moisture-logger/job/${n.id}/report`)};if(!n)return e.jsx("div",{className:"p-4 text-muted-foreground",children:"Loading..."});const p=c.length>0,$=R?"Wood / product readings only":"Record flooring, subfloor, and ambient readings";return e.jsxs("div",{className:"max-w-2xl mx-auto",children:[e.jsx(Q,{title:n.customer_name||"Moisture Readings",subtitle:$,syncStatus:b,backTo:"/moisture-logger"}),e.jsx(le,{value:x,className:"mb-6",children:e.jsxs(ie,{className:"w-full grid",style:{gridTemplateColumns:`repeat(${1+(d?1:0)+(S?1:0)}, minmax(0, 1fr))`},children:[e.jsxs(E,{value:"flooring",onClick:()=>y("flooring"),className:"gap-2",children:[e.jsx(Y,{className:`h-4 w-4 ${x==="flooring"?"text-purple":"text-muted-foreground"}`}),R?"Product":"Flooring"]}),d&&e.jsxs(E,{value:"subfloor",onClick:()=>y("subfloor"),className:"gap-2",children:[e.jsx(ce,{className:`h-4 w-4 ${x==="subfloor"?"text-primary":"text-muted-foreground"}`}),"Subfloor"]}),S&&e.jsxs(E,{value:"ambient",onClick:()=>y("ambient"),className:"gap-2",children:[e.jsx(ue,{className:`h-4 w-4 ${x==="ambient"?"text-orange":"text-muted-foreground"}`}),"Ambient"]})]})}),e.jsxs("div",{className:"pb-24",children:[x==="flooring"&&e.jsx(xe,{readings:c,mode:n.mode,onAddReading:(r,u,w,_,F)=>C("flooring",r,u,w,_,F),onDeleteReading:r=>f("flooring",r)}),x==="subfloor"&&d&&e.jsx(fe,{readings:m,flooringReadings:c,widthCategory:n.width_category,subfloorType:n.subfloor_type,onAddReading:(r,u,w,_,F)=>C("subfloor",r,u,w,_,F),onDeleteReading:r=>f("subfloor",r)}),x==="ambient"&&S&&e.jsx(pe,{job:n,onChange:A})]}),e.jsx("div",{className:"fixed bottom-0 left-0 right-0 p-4 bg-background/95 backdrop-blur border-t border-border z-40",children:e.jsx("div",{className:"container mx-auto max-w-2xl",children:e.jsx(G,{onClick:t,disabled:!p,className:"w-full",children:"Generate report →"})})})]})}export{Te as ReadingsScreen};

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.