import{TableBody_default as e,TableRow_default as t,Table_default as n}from"./TableRow-BvvF3P07.js";import{TableContainer_default as r}from"./TableContainer-Dsle3fJG.js";import{TableHead_default as i}from"./TableHead-Dk_Y1NW0.js";import{Box_default as a,TableCell_default as o,__toESM as s,createSlice as c,fetchLookupTables as l,get_default as u,init_redux_toolkit_esm as d,jsx as f,jsxs as p,ladlesRepository as m,makeStyles_default as h,require_build as g,require_react as _,useAppDispatch as v,useAppSelector as y,useNavigate as b}from"./index-w-YpLVZ3.js";import{ShortDateTimeFormat as x}from"./date-time.format-BfyGY2du.js";const S=({campaign:e})=>{let n=b(),r=y(e=>{var t;return(t=e.common.lookupTables)?.workers}),i=u(r,`[${e.installWorkerId}].workerName`,``),a=()=>{n({pathname:`/ladle-track/ladle-details/${e.rootId}/tasks/${e.taskGroupInstanceId}/edit`,search:`backTo=${encodeURI(`/ladle-track/campaigns`)}`})};return p(t,{onClick:a,style:{cursor:`pointer`},children:[f(o,{children:e.rootName}),f(o,{children:e.componentTypeName}),f(o,{children:e.partName}),f(o,{children:e.vendorName??``}),f(o,{children:x(e.installTime)}),f(o,{children:i})]})};d();const C={campaigns:null},w=c({name:`__`,initialState:C,reducers:{setCampaigns(e,{payload:t}){e.campaigns=t}}});var T=s(_()),E=s(g());const D=(0,T.createContext)({state:C,actions:w.actions}),O=()=>(0,T.useContext)(D),k=({children:e})=>{let[t,n]=(0,E.useComplexState)({initialState:C,reducers:w.caseReducers});return f(D.Provider,{value:{state:t,actions:n},children:e})},A=h({greyBackground:{"& th":{backgroundColor:`rgba(242, 241, 239)`}}}),j=s=>{let c=A(),u=v(),{state:d,actions:h}=O(),[g,_]=(0,T.useState)(!0);return(0,T.useEffect)(()=>{_(!0),(async()=>{await u(l());let e=await m.getCampaignList();h.setCampaigns(e.data),_(!1)})()},[]),f(a,{p:3,children:f(r,{style:{maxHeight:`89vh`},children:p(n,{"aria-label":`simple table`,stickyHeader:!0,className:c.greyBackground,children:[f(i,{children:p(t,{children:[f(o,{children:`Ladle`}),f(o,{children:`Component`}),f(o,{children:`Part`}),f(o,{children:`Vendor`}),f(o,{children:`Installed Date`}),f(o,{children:`Installed By`})]})}),p(e,{children:[g&&f(t,{children:f(o,{colSpan:6,children:`Loading...`})}),!g&&d.campaigns.map(e=>f(S,{campaign:e},`campaign-${e.taskId}`))]})]})})})},M=()=>f(k,{children:f(j,{})});export{M as CampaignListPage};
//# sourceMappingURL=campaign-list-lA_frZQA.js.map