import{ao as C,b as T,g as k,a as i,j as e,T as t,ah as b,q as L,r as c,D as x,u as y,c as I,aL as S,a8 as f}from"./index-BMKwTcAk.js";import{S as v}from"./date-time.format-GN0YbgxC.js";import{T as d,a as w,b as N}from"./TableRow-BK4qT9bC.js";import{T as R}from"./TableContainer-CS9sJRj-.js";import{T as B}from"./TableHead-BZJ_hEvl.js";const $=({campaign:a})=>{const s=C(),r=T(n=>n.common.lookupTables?.workers),l=k(r,`[${a.installWorkerId}].workerName`,"");return i(d,{onClick:()=>{s({pathname:`/ladle-track/ladle-details/${a.rootId}/tasks/${a.taskGroupInstanceId}/edit`,search:`backTo=${encodeURI("/ladle-track/campaigns")}`})},style:{cursor:"pointer"},children:[e(t,{children:a.rootName}),e(t,{children:a.componentTypeName}),e(t,{children:a.partName}),e(t,{children:a.vendorName??""}),e(t,{children:v(a.installTime)}),e(t,{children:l})]})},p={campaigns:null},u=b({name:"__",initialState:p,reducers:{setCampaigns(a,{payload:s}){a.campaigns=s}}}),g=c.createContext({state:p,actions:u.actions}),D=()=>c.useContext(g),P=({children:a})=>{const[s,r]=L.useComplexState({initialState:p,reducers:u.caseReducers});return e(g.Provider,{value:{state:s,actions:r},children:a})},j=x({greyBackground:{"& th":{backgroundColor:"rgba(242, 241, 239)"}}}),E=a=>{const s=j(),r=y(),{state:l,actions:m}=D(),[n,h]=c.useState(!0);return c.useEffect(()=>{h(!0),(async()=>{await r(I());const o=await S.getCampaignList();m.setCampaigns(o.data),h(!1)})()},[]),e(f,{p:3,children:e(R,{style:{maxHeight:"89vh"},children:i(w,{"aria-label":"simple table",stickyHeader:!0,className:s.greyBackground,children:[e(B,{children:i(d,{children:[e(t,{children:"Ladle"}),e(t,{children:"Component"}),e(t,{children:"Part"}),e(t,{children:"Vendor"}),e(t,{children:"Installed Date"}),e(t,{children:"Installed By"})]})}),i(N,{children:[n&&e(d,{children:e(t,{colSpan:6,children:"Loading..."})}),!n&&l.campaigns.map(o=>e($,{campaign:o},`campaign-${o.taskId}`))]})]})})})},F=()=>e(P,{children:e(E,{})});export{F as CampaignListPage};
//# sourceMappingURL=index-CZqO0Y4y.js.map
