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,u as x,c as y,aL as I,a8 as S,D as f}from"./index-09tpYl64.js";import{S as v}from"./date-time.format-C46bYdC8.js";import{T as d,a as w,b as N}from"./TableRow-CDjskHei.js";import{T as R}from"./TableContainer-B8l2b0Os.js";import{T as B}from"./TableHead-D5uQqOJ3.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=f({greyBackground:{"& th":{backgroundColor:"rgba(242, 241, 239)"}}}),E=a=>{const s=j(),r=x(),{state:l,actions:m}=D(),[n,h]=c.useState(!0);return c.useEffect(()=>{h(!0),(async()=>{await r(y());const o=await I.getCampaignList();m.setCampaigns(o.data),h(!1)})()},[]),e(S,{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-DMdbM9LB.js.map
