import{u as D,a as L,s as R,r as S,j as e,_ as E,S as P,B as n,T as m,Q as k,fA as T,L as A,fB as B,E as O,b as _,ek as $,f as H,h as N,eD as W,P as w,I as q,fC as G,D as Q,W as U,eE as V}from"./index-d2b25495.js";import{A as J}from"./index-b3c5bebe.js";import{u as K}from"./useToggle-4d859601.js";import{g as X,u as Y}from"./useViewPort-1fe27edd.js";import{I as M,R as F}from"./index-19cd9110.js";import{C as Z}from"./CardContent-be810fe0.js";const z=({tabsData:h,onTabClick:p,currentTab:I,id:l})=>{const f=D(),u=L(s=>R(s)),[b,y]=S.useState(new Set);S.useMemo(()=>X(u.sidenav.theme),[u.sidenav.theme]);const g=s=>{y(t=>{const o=new Set(t);return o.has(s)?o.delete(s):o.add(s),o})};return e.jsx(E,{sx:{height:"100%",flex:1},children:e.jsx(P,{style:{height:"100%",padding:24,paddingTop:6},children:e.jsxs(n,{sx:{mt:2},children:[e.jsx(m,{variant:"h5",children:"Navigation"}),e.jsx(n,{sx:{my:1},children:h&&h.map((s,t)=>{var j;const o=I===t,c=b.has(t),r=s.children&&s.children.length>0,i=M[s.icon];return e.jsxs(n,{children:[e.jsx(n,{onClick:()=>{r?g(t):p(l,t,(s==null?void 0:s.url)||"")},sx:{cursor:"pointer",textDecoration:"none",color:"inherit"},children:e.jsxs(k,{sx:a=>({display:"flex",flexDirection:"row",gap:2,ml:0,width:"100%",lineHeight:2,p:1,transition:"all 0.3s",borderRadius:"5px",backgroundColor:o&&!r?"#E0EFFF":"",color:o&&!r?a.palette.common.black:"","&:hover":{backgroundColor:o&&!r?"#E0EFFF":"#f5f5f5"},justifyContent:"space-between",alignItems:"center"}),children:[e.jsxs(n,{sx:{display:"flex",alignItems:"center",gap:2},children:[i?e.jsx(i,{style:{fontSize:16}}):e.jsx(F,{style:{fontSize:16}}),e.jsx(m,{variant:"subtitle1",children:s.label})]}),r&&(c?e.jsx(T,{size:16}):e.jsx(A,{size:16}))]})}),r&&e.jsx(B,{in:c,children:e.jsx(n,{sx:{ml:3,mt:1},children:(j=s.children)==null?void 0:j.map((a,C)=>{const x=f.pathname===a.url,d=M[a.icon];return e.jsx(n,{onClick:()=>p(l,t,(a==null?void 0:a.url)||""),sx:{cursor:"pointer",textDecoration:"none",color:"inherit",mb:.5},children:e.jsxs(k,{sx:v=>({display:"flex",flexDirection:"row",gap:2,ml:0,width:"100%",lineHeight:2,p:1,transition:"all 0.3s",borderRadius:"5px",backgroundColor:x?"#E0EFFF":"",color:x?v.palette.common.black:"","&:hover":{backgroundColor:x?"#E0EFFF":"#f5f5f5"}}),children:[d?e.jsx(d,{style:{fontSize:14}}):e.jsx(F,{style:{fontSize:14}}),e.jsx(m,{variant:"body2",children:a.label})]})},C)})})})]},t)})})]})})})},ae=({menuCode:h,fromScreen:p,callback:I,data:l,app_label:f,model_name:u,goBackUrl:b,assignUserCallback:y,headerContent:g,tabsData:s,onTabClick:t})=>{const o=O(),c=_(),{id:r,tab:i}=$();Y();const{isOpen:j,hide:a,toggleOpen:C}=K(),x=`${f}.${u}`,d=L(v=>v.customise.sidenav.showMobileMenu);return S.useEffect(()=>{c(H({showMobileMenu:!1})),c(N({code:h,from:p}))},[]),e.jsx(n,{sx:{width:"100%"},children:e.jsxs(n,{sx:{mt:1},children:[e.jsxs(n,{sx:{py:1,display:"flex",alignItems:"center",justifyContent:"space-between",gap:2},children:[e.jsxs(m,{variant:"h4",sx:{display:"flex",alignItems:"center",gap:1,cursor:"pointer",fontWeight:"500"},onClick:()=>{o(b,{relative:"path"})},children:[e.jsx(W,{size:24}),`${l==null?void 0:l.code}`]}),e.jsxs(n,{sx:{display:"flex",alignItems:"center",gap:2},children:[e.jsx(J,{instance_id:r||"",modal_path:x,callback:y}),g&&g]})]}),e.jsxs(w,{container:!0,spacing:2,sx:{mt:1},children:[e.jsx(w,{size:{xs:12,lg:3.3,xl:d?2.3:2.7},sx:{display:{lg:"block",xs:"none"}},children:e.jsx(z,{tabsData:s,onTabClick:t,currentTab:i?+i:0,id:r||""})}),e.jsxs(w,{size:{xs:12,lg:8.7,xl:d?9.7:9.3},children:[e.jsx(E,{sx:{display:{lg:"none",xs:"block"}},children:e.jsxs(n,{children:[e.jsx(q,{onClick:()=>{C()},children:e.jsx(G,{size:20})}),e.jsx(Q,{open:j,onClose:a,sx:{width:288,"& .MuiDrawer-paper":{width:288}},children:e.jsx(z,{tabsData:s,onTabClick:t,currentTab:i?+i:0,id:r||""})})]})}),e.jsx(E,{sx:{mt:{xs:2,lg:0},height:"100%"},children:e.jsx(Z,{children:e.jsx(U,{variant:"elevation",sx:{p:2,borderRadius:"10px"},children:e.jsx(V,{})})})})]})]})]})})};export{ae as S};
