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-aa586041.js";import{G}from"./GoBack-45a9138d.js";import{R as L}from"./ReadMoreText-3b0ffff0.js";import{T as I}from"./index-a2d739d4.js";import{A as H}from"./index-bee3342a.js";import"./CustomDatepicker-26155063.js";import"./index-e3cd0864.js";import"./ScrollableList-fcc6a14c.js";import"./index.esm-5d8102a7.js";import{S as K}from"./SectionDivider-2f9208fa.js";import{C as N}from"./CardContent-c0781282.js";import"./LoadingButton-0d97f498.js";import"./index-c5e91153.js";import"./index-1d230708.js";import"./useMediaQuery-64e46ff0.js";import"./useControlled-e0c526ba.js";import"./resolveProps-185f0451.js";import"./composeClasses-b42b2e69.js";import"./Link-03d388f2.js";import"./Dialog-26aea2b0.js";import"./DialogTitle-35e72887.js";import"./DialogContent-5a256860.js";import"./DialogActions-90af69f6.js";import"./TableCell-171b9885.js";import"./TableRow-6b2aeb5d.js";import"./index-67899cd7.js";import"./TableHead-a20733cc.js";import"./createSvgIcon-26e7576d.js";import"./TablePagination-e8098a58.js";import"./Toolbar-707eb110.js";import"./Select-03e2ed06.js";import"./Menu-3823c2ca.js";import"./isHostComponent-73d6e646.js";import"./Grow-6aaee206.js";import"./List-d99f3a17.js";import"./useSlotProps-01ed14c0.js";import"./OutlinedInput-8f0d0162.js";import"./useFormControl-1a7e7d92.js";import"./MenuItem-0cb185cb.js";import"./dividerClasses-db0c3f8b.js";import"./listItemTextClasses-6f04b047.js";import"./KeyboardArrowRight-881c4d45.js";import"./LastPage-90e6357c.js";import"./index.esm-c1bef48d.js";import"./yup-75085264.js";import"./SelectComponent-aad66251.js";import"./objectSpread2-e05f2ee3.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-fa135afd.js";import"./TextArea-1d2de9d0.js";import"./TextField-5fe8ef1a.js";import"./FormControl-fed32f2b.js";import"./Avatar-7233b687.js";import"./Delete-4a28de8e.js";import"./createSvgIcon-e25b7f83.js";import"./ListItem-195e8e21.js";import"./ListItemText-b18322e5.js";import"./DialogContentText-ab749083.js";import"./Divider-f92c640b.js";import"./InputAdornment-2dac8dca.js";import"./popper-f3391c26.js";import"./styled-a6efd9c3.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};
