import{H as k}from"./HeaderBreadcrumbs.da67f38c.js";import{P as z}from"./Page.4c1db0aa.js";import{al as v,bi as B,aQ as R,ar as p,r as u,j as r,S as _,f as e,i as y,aq as f,P as A,as as G,g as H,ay as O,B as W,T as q,az as F}from"./index.8f299a7d.js";import{C as Q}from"./CorporateTabNavigations.42a351a3.js";import{d as J,a as K}from"./KeyboardArrowRight.3ee3e2fb.js";import{d as M}from"./Add.06de942b.js";import{C as b}from"./Card.1ec83a31.js";import{T as U}from"./TableContainer.b8d5000e.js";import{T as V,a as m,b as d,c as a}from"./TableRow.d2ef76cd.js";import{G as g}from"./Grid.358b274d.js";import"./jsx-runtime_commonjs-proxy.e03e6edd.js";function X(){v();const{corporate_id:l}=B(),[i,D]=R();function P(t){const n=u.exports.useRef(null),[o,h]=u.exports.useState(""),N=s=>{var C;const j=(C=s.target.value)!=null?C:"";h(j)},$=s=>{s.preventDefault(),t.onSearch(o)};return u.exports.useEffect(()=>{var s;h((s=i.get("search"))!=null?s:"")},[i]),e("form",{onSubmit:$,style:{width:"100%"},children:e(G,{id:"search-input",ref:n,label:"Search",variant:"outlined",fullWidth:!0,onChange:N,value:o})})}function w(t){const{row:n}=t,[o,h]=p.useState(!1);return r(p.Fragment,{children:[r(d,{sx:{"& > *":{borderBottom:"unset"}},children:[e(a,{children:e(H,{"aria-label":"expand row",size:"small",onClick:()=>h(!o),children:o?e(J,{}):e(K,{})})}),e(a,{align:"left",children:n.code}),e(a,{align:"left",children:n.name}),e(a,{align:"right",children:e(f,{variant:"outlined",color:"success",size:"small",children:"Active"})}),e(a,{align:"right",children:e(y,{to:`/corporates/${n.corporate_id}/corporate-benefits/${n.id}/edit`,children:e(f,{variant:"outlined",color:"success",size:"small",children:"Edit"})})})]}),e(d,{children:e(a,{style:{paddingBottom:0,paddingTop:0},colSpan:10,children:r(O,{in:o,timeout:"auto",unmountOnExit:!0,children:[e(W,{sx:{borderBottom:1},children:e(q,{variant:"body2",gutterBottom:!0,component:"div",children:"No Extra Data"})}),!1]})})})]})}const[E,x]=p.useState(!0),[S,I]=p.useState({current_page:1,data:[],path:"",first_page_url:"",last_page:1,last_page_url:"",next_page_url:"",prev_page_url:"",per_page:10,from:0,to:0,total:0}),T=async(t=null)=>{x(!0);const n=t||Object.fromEntries([...i.entries()]),o=await F.get("/corporates/"+l+"/corporate-benefits",{params:n});x(!1),I(o.data)},c={fontWeight:"bold"},L=async t=>{await T({search:t}),D({search:t})};return u.exports.useEffect(()=>{T()},[]),r(_,{children:[r(_,{direction:"row",spacing:2,sx:{p:2},children:[e(P,{onSearch:L}),e(y,{to:`/corporates/${l}/corporate-benefits/create`,children:e(f,{id:"upload-button",variant:"outlined",startIcon:e(M,{}),sx:{p:1.8},children:"Create"})})]}),e(b,{children:e(U,{component:A,children:r(V,{"aria-label":"collapsible table",children:[e(m,{children:r(d,{children:[e(a,{style:c,align:"left"}),e(a,{style:c,align:"left",children:"Code"}),e(a,{style:c,align:"left",children:"Name"}),e(a,{style:c,align:"right",children:"Status"}),e(a,{style:c,align:"right",children:"Action"})]})}),E?e(m,{children:e(d,{children:e(a,{colSpan:8,align:"center",children:"Loading"})})}):S.data.length==0?e(m,{children:e(d,{children:e(a,{colSpan:8,align:"center",children:"No Data"})})}):e(m,{children:S.data.map(t=>e(w,{row:t},t.code))})]})})})]})}function ce(){v();const{corporate_id:l}=B(),i="Corporate Benefit";return r(z,{title:i,children:[e(k,{heading:i,links:[{name:"Corporates",href:"/corporates"},{name:"Corporate Name",href:"/corporates/"+l},{name:"Corporate Benefit",href:"/corporates/"+l+"/benefits"}]}),r(g,{container:!0,spacing:2,children:[e(g,{item:!0,xs:8,children:r(b,{children:[e(Q,{position:"corporate-benefits"}),e(X,{})]})}),e(g,{item:!0,xs:4,children:e(b,{sx:{p:2},children:"Corporate Detail Goes Here \xA0"})})]})]})}export{ce as default};
