import{b8 as h,r as m,u as N,j as t,B as i,T as x,b9 as S,ba as v}from"./index-B1H8BCL7.js";import{C as b}from"./Card-Dkp4tDNB.js";import{D as C,a as D}from"./DynamicTabs-MJtPCrx5.js";import{G as u}from"./Grid-CTEl0Elf.js";import"./Autocomplete-D8_Y_gp5.js";import"./ClickAwayListener-CqfRJnqH.js";import"./Stack-BIAbaqpj.js";import"./useThemeProps-DL_l3A7P.js";import"./InputAdornment-BMBVR6Ec.js";import"./Checkbox-C0X963rT.js";import"./SwitchBase-BKMEO22T.js";import"./FormControlLabel-DYmaLmBq.js";import"./TablePagination-CVPyh-M-.js";import"./KeyboardArrowRight-DXPl9fjq.js";import"./LastPage-BEvmfPvn.js";import"./TableCell-D8CotAsC.js";import"./colorManipulator-B4HuGLt1.js";import"./useThemeProps-DcBTMaaC.js";import"./AddCircleOutlineOutlined-xJ_QWEuj.js";import"./tabClasses-Dx7YJmjE.js";import"./useSlotProps-eBp3I9mO.js";function T(){const{activeItems:e,setActiveItems:r,setMaxTabsOpen:o,setActiveTab:a}=h(),[c,M]=m.useState([]),[p,f]=m.useState({page:0,pageSize:10}),g=N(),P=[{field:"id",headerName:"Sl.No",flex:1,minWidth:100},{field:"productName",headerName:"Product Name",flex:1,minWidth:150,align:"left",headerAlign:"left"},{field:"partNumber",headerName:"Part No",flex:1,minWidth:120,align:"left",headerAlign:"left"}],j=s=>{f(s)},w=s=>{const l=e.findIndex(n=>n.id===s.id);if(l===-1){if(e.length>=5){o(!0);return}const n={...s.row,moduleRoute:"/master/test"};g(S({type:"product",tabData:[...e,n]})),r([...e,n]),a(e.length+1)}else a(l+1)};return t.jsx(i,{p:2,component:"form",sx:{"& .MuiTextField-root":{m:1,width:"100%"},width:"100%",overflow:"hidden"},children:t.jsxs(t.Fragment,{children:[t.jsx(i,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:"10px"},children:t.jsx(x,{variant:"h5",children:"PRODUCT LIST"})}),t.jsx(b,{sx:{padding:"2%",borderRadius:"15px",width:"100%",boxShadow:"0px 4px 12px rgba(0,0,0,0.1)",overflowX:"auto",height:"80vh"},children:t.jsx(i,{sx:{width:"100%",border:"1.2px solid #eee",maxHeight:"80svh",overflow:"auto"},children:t.jsx(C,{columns:P,rows:y,paginationMode:"server",initialState:{pagination:{paginationModel:p}},pageSizeOptions:[10,25,50,100],checkboxSelection:!1,disableRowSelectionOnClick:!0,paginationModel:p,onPaginationModelChange:j,onRowClick:w})})})]})})}const y=[{id:1,productName:"Product A",partNumber:"P-001"},{id:2,productName:"Product B",partNumber:"P-002"},{id:3,productName:"Product C",partNumber:"P-003"},{id:4,productName:"Product D",partNumber:"P-004"},{id:5,productName:"Product E",partNumber:"P-005"}],A=()=>{const{activeItems:d,activeTab:e}=h(),r=d[e-1],o=(a,c)=>t.jsx(u,{item:!0,xs:12,sm:4,md:4,lg:4,children:t.jsxs(i,{children:[t.jsxs("span",{children:[a,":"]}),t.jsxs(x,{sx:{pl:2,fontWeight:"bold"},children:[" ",c||"-"]})]})});return console.log(r),t.jsxs(i,{width:"100%",maxHeight:"80svh",p:2,children:[t.jsx(i,{display:"flex",justifyContent:"space-between",position:"sticky",top:-2,sx:{backdropFilter:"blur(10px)"},children:t.jsx("h3",{children:"Product View"})}),t.jsx(b,{children:t.jsxs(u,{container:!0,spacing:3,p:2,children:[o("Product Name1",r.productName||""),o("Part Number",r.partNumber||"")]})})]})},Z=()=>t.jsx(v,{children:t.jsx(D,{type:"product",title:"All Products",parentComponent:T,childComponent:A})});export{Z as default};
