import{b4 as M,c as O,a as T,li as z,r as k,ls as B,y as R,j as o,q as Y,K as n,B as m,w as q,M as E,T as _}from"./index-5768b108.js";import{G}from"./GoBack-3005b0aa.js";import{R as L}from"./ReadMoreText-5c1b14c5.js";import{T as I}from"./index-fcf73630.js";import{A as H}from"./index-c42b07ed.js";import"./CustomDatepicker-c97efda4.js";import"./index-42cce9d5.js";import"./ScrollableList-c8e84a4e.js";import"./index.esm-85e2fec5.js";import{S as K}from"./SectionDivider-bc494fef.js";import{C as N}from"./CardContent-4b37116a.js";import"./LoadingButton-b684247e.js";import"./index-c58b1ae1.js";import"./index-4ca9e290.js";import"./useMediaQuery-493fa36e.js";import"./useControlled-821282b7.js";import"./resolveProps-5b0bdb14.js";import"./composeClasses-b42b2e69.js";import"./Link-a5e92257.js";import"./Dialog-82ae8e2c.js";import"./DialogTitle-399fe93b.js";import"./DialogContent-281dc416.js";import"./DialogActions-96d02ef8.js";import"./TableCell-73fa51e5.js";import"./TableRow-3593e946.js";import"./index-bed7b08c.js";import"./TableHead-1c4bab1f.js";import"./createSvgIcon-51b522b8.js";import"./TablePagination-e6e264e7.js";import"./Toolbar-96b35f70.js";import"./Select-3950b24e.js";import"./Menu-7988a333.js";import"./isHostComponent-73d6e646.js";import"./Grow-c21b912f.js";import"./List-2cd167d2.js";import"./useSlotProps-ed538db1.js";import"./OutlinedInput-8a98392b.js";import"./useFormControl-e91ce3d1.js";import"./MenuItem-51065bfa.js";import"./dividerClasses-a2ef427b.js";import"./listItemTextClasses-3e91d186.js";import"./KeyboardArrowRight-56dea4db.js";import"./LastPage-f21d7153.js";import"./index.esm-4803c918.js";import"./yup-7ddf262a.js";import"./SelectComponent-f4c81d57.js";import"./objectSpread2-d5d2b678.js";import"./defineProperty-83f36300.js";import"./toPropertyKey-d8419463.js";import"./typeof-7fd5df1e.js";import"./slicedToArray-f5e6f6d2.js";import"./floating-ui.dom-cd6c919d.js";import"./InputLabel-bfa922b7.js";import"./TextArea-286cc2d2.js";import"./TextField-265270c2.js";import"./FormControl-47bb025d.js";import"./Avatar-5307a35a.js";import"./Delete-83f8b568.js";import"./createSvgIcon-426f67cd.js";import"./ListItem-7a09a154.js";import"./ListItemText-8f95b578.js";import"./DialogContentText-28299755.js";import"./Divider-deb0f0d5.js";import"./InputAdornment-82d0c147.js";import"./popper-f3391c26.js";import"./styled-9a8473c9.js";const oi=()=>{var h,x,g;const{id:r}=M(),y=O(),{OpenStock:{selectedData:i,pageParams:p},system:{userAccessList:Q,systemPreferences:{preferences:{is_inventory:S}={}}={}}}=T(e=>z(e));k.useEffect(()=>{y(B({id:r||""}))},[r]);const b=[{label:"Code",value:i==null?void 0:i.code},{label:"Created On",value:R(i==null?void 0:i.date).format("DD-MM-YYYY")},{label:S?"Projct":"Location",value:(h=i==null?void 0:i.location)==null?void 0:h.name}],v=[{title:"S.No",width:100},{title:"Asset",width:100},{title:"Type",width:100},{title:"Quantity",width:100},{title:"Description",width:100}];function l(e,s,t,a,c){return{index:e,name:s,stock_choice_name:t,quantity:a,description:c}}const d=k.useMemo(()=>{var e,s;return(s=(e=i==null?void 0:i.stock_up_items)==null?void 0:e.filter(t=>!(t!=null&&t.dodelete)))==null?void 0:s.map((t,a)=>{var u,f,j;const c=(p.page-1)*p.page_size+(a+1),A=o.jsx(L,{text:(t==null?void 0:t.description)||"",maxLength:35});return l(c,(u=t==null?void 0:t.asset)!=null&&u.name?(f=t==null?void 0:t.asset)==null?void 0:f.name:"",((j=t==null?void 0:t.asset)==null?void 0:j.stock_choice_name)??"",t!=null&&t.quantity?t==null?void 0:t.quantity:0,A)})},[i,l]),C=(e,s)=>{},P=e=>{};return Y(),o.jsx(n,{container:!0,spacing:2,children:o.jsx(n,{size:{xs:12},children:o.jsx(G,{is_goback:!0,go_back_url:"/openstock",title:"Open Stock Details",showSaveButton:!1,loading:!1,extra:o.jsx(H,{instance_id:r||"",modal_path:"openingstock.openingstock",app_label:"openingstock",model_name:"openingstock"}),children:o.jsx(m,{children:o.jsx(q,{children:o.jsxs(N,{children:[o.jsx(m,{px:2,sx:{borderRadius:2},children:o.jsx(n,{container:!0,spacing:1,children:b.map(e=>o.jsx(n,{size:{xs:12,md:6,lg:4,xl:3},children:o.jsxs(E,{sx:{flexDirection:{md:"row",lg:"column"},gap:1},children:[o.jsxs(_,{sx:{display:"inline",fontWeight:"bold"},children:[e.label,":"," "]}),o.jsxs(_,{children:[" ",e==null?void 0:e.value]})]})}))})}),o.jsx(m,{sx:{mt:1},children:o.jsx(K,{title:"Item Details"})}),o.jsx(m,{children:o.jsx(I,{showPagination:!1,containerHeight:440,count:(x=i==null?void 0:i.stock_up_items)!=null&&x.length?(g=i==null?void 0:i.stock_up_items)==null?void 0:g.length:0,columns:v,rows:d||[],loading:!1,page:p.page,pageSize:p.page_size,handleChangePage:C,handleChangeRowsPerPage:P})})]})})})})})})};export{oi as default};
