import{r as h,f as C,i as S,j as e,T as r,g as i,a as m,u as f,b as I,B as b,s as g,P as N,F as $,C as w,c as L,d as M}from"./index-BMKwTcAk.js";import{R as O}from"./root-set-state-modal.component-bfs94Ogh.js";import{m as k}from"./metric-colors.data-D0Z_RuPK.js";import{T,a as H,b as x}from"./TableRow-BK4qT9bC.js";import{T as P}from"./TableContainer-CS9sJRj-.js";import{T as j}from"./TableHead-BZJ_hEvl.js";import"./change-ladle.modal-Uvj0fTFl.js";import"./root-type.enum-Cp1EXS66.js";import"./RootStateSelector-DBEoSXWg.js";import"./location-selector-BKyteqw9.js";import"./index-CDMHG9_A.js";const y=[{componentTypeId:211,name:"Barrel",metrics:[{metricTypeId:203,name:"Heats"},{metricTypeId:204,name:"Min"}]},{componentTypeId:227,name:"SlagLine",metrics:[{metricTypeId:210,name:"Heats"},{metricTypeId:204,name:"Min"}]},{componentTypeId:216,name:"Coll Nozzle",metrics:[{metricTypeId:210,name:"Heats"}]},{componentTypeId:220,name:"Plate",metrics:[{metricTypeId:210,name:"Heats"}]},{componentTypeId:229,name:"Upper Nozzle",metrics:[{metricTypeId:210,name:"Heats"}]},{componentTypeId:202,name:"Plug1",metrics:[{metricTypeId:203,name:"Heats"},{metricTypeId:205,name:"Min"}]},{componentTypeId:203,name:"Plug1 Block",metrics:[{metricTypeId:205,name:"Min"}]},{componentTypeId:205,name:"Plug2",metrics:[{metricTypeId:203,name:"Heats"},{metricTypeId:205,name:"Min"}]},{componentTypeId:206,name:"Plug2 Block",metrics:[{metricTypeId:205,name:"Min"}]}],z=({metricType:t,componentType:a,root:o})=>{const n=h.useMemo(()=>{const c=C(o.components,d=>d.componentTypeId===a.componentTypeId)?.metrics;return C(c,d=>d.metricTypeId===t.metricTypeId)},[o]);if(S(n))return e(r,{},`root-${o.rootId}-${a.name}-${t.name}`);const s=S(n?.value)?"":Math.round(n.value),l=n?.metricState!=1?i(k,n?.metricState,"rgba(0,0,0,0)"):"";return e(r,{style:{backgroundColor:l,border:"1px solid #C0C0C0",color:Number.isNaN(s)||s==0?"darkgray":"black"},className:"text-center",children:s!==""?new Intl.NumberFormat().format(s):""},`root-${o.rootId}-${a.name}-${t.name}`)},B=({root:t})=>{const a=t.supervisorInstructions?`Supervisor comments: ${t.supervisorInstructions}`:"",o=t.workerComments?`Operator comments: ${t.workerComments}`:"";return m("div",{className:"truncate",title:`${a}

${o}`,children:[t.supervisorInstructions??"",t.supervisorInstructions&&e("br",{}),t.workerComments??""]})},F=({root:t})=>{const a=f(),o=I(p=>p.common.lookupTables),n=i(o,`roots[${t.rootId}].rootName`,""),s=i(o,`locations[${t.locationId}].locationName`,""),l=i(t,"currentHeat.heatName",""),c=i(o,`rootStates[${t.rootStateId}].rootStateName`,"");return m(T,{hover:!0,children:[e(r,{children:n}),e(r,{children:s}),e(r,{children:l}),e(r,{children:c}),e(r,{children:e(b,{size:"small",variant:"outlined",color:"primary",onClick:()=>{a(g(t))},style:{whiteSpace:"nowrap"},children:"Set State"})}),e(r,{children:e(B,{root:t},`root-${t.rootId}-comments`)}),y.reduce((p,u)=>[...p,u.metrics.map(v=>e(z,{root:t,metricType:v,componentType:u},`root-${t.rootId}_metricType-${v.metricTypeId}_componentType-${u.componentTypeId}`))],[])]})},R=({isLoading:t})=>{const a=I(n=>n.ladleOverview.roots),o=I(n=>n.ladleOverview.ladleForModify?.renderModal);return m(N,{style:{paddingLeft:"1rem",paddingTop:"0.3rem"},children:[e("h1",{className:"ladle-overview-table__title",children:"All Ladles"}),e($,{children:t?e("div",{style:{display:"flex",justifyContent:"center",alignContent:"center",padding:"18rem"},children:e(w,{})}):e(P,{children:m(H,{size:"small",children:[m(j,{children:[m(T,{children:[e(r,{colSpan:6}),y.map(n=>e(r,{className:"text-center",colSpan:n.metrics.length,children:n.name},`header-${n.name}`))]}),m(T,{children:[e(r,{children:"Ladle"}),e(r,{children:"Location"}),e(r,{children:"Heat"}),e(r,{children:"State/Comment"}),e(r,{}),e(r,{children:"Supervisor/Operator Comments"}),y.reduce((n,s)=>[...n,...Object.entries(s.metrics).map(([l,c])=>e(r,{style:{width:"4rem"},className:"text-center",children:c.name},`header-${s.name}-${c.name}`))],[])]})]}),e(x,{children:Object.values(a).map(n=>e(F,{root:n},`root-${n.rootId.toString()}`))})]})})}),o&&e(O,{loadWithComponents:!0})]})},V=()=>{const[t,a]=h.useState(!1),o=f();function n(){a(!0),o(L()),o(M(!0)).then(()=>a(!1))}return h.useEffect(()=>n(),[]),e("div",{className:"container-fluid",children:e(R,{isLoading:t})})};export{V as LadleOverviewComponent};
//# sourceMappingURL=index-D46WBWoK.js.map
