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