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-c1429e77.js";import{G}from"./GoBack-8fdc2295.js";import{R as L}from"./ReadMoreText-09ad412c.js";import{T as I}from"./index-50437a1d.js";import{A as H}from"./index-af79683d.js";import"./CustomDatepicker-9a80af6c.js";import"./index-938f4514.js";import"./ScrollableList-85f6c22b.js";import"./index.esm-85841cf7.js";import{S as K}from"./SectionDivider-0f38a779.js";import{C as N}from"./CardContent-195cd99b.js";import"./LoadingButton-a5f23242.js";import"./index-6d8a6cf3.js";import"./index-10a98b8b.js";import"./useMediaQuery-6763b70c.js";import"./useControlled-f1a5b61d.js";import"./resolveProps-3c56301c.js";import"./composeClasses-b42b2e69.js";import"./Link-a63687a8.js";import"./Dialog-f34656f2.js";import"./DialogTitle-7578ca2e.js";import"./DialogContent-189c94c5.js";import"./DialogActions-7758c09d.js";import"./TableCell-f7ad5597.js";import"./TableRow-18e2a4e3.js";import"./index-0710c981.js";import"./TableHead-89a0b6da.js";import"./createSvgIcon-74b4ff5d.js";import"./TablePagination-8b574091.js";import"./Toolbar-d8e3299a.js";import"./Select-ea3744da.js";import"./Menu-3e8761c1.js";import"./isHostComponent-73d6e646.js";import"./Grow-67aedb5f.js";import"./List-7dd83a15.js";import"./useSlotProps-8fc8da82.js";import"./OutlinedInput-7d44f8dd.js";import"./useFormControl-674270c6.js";import"./MenuItem-352b4536.js";import"./dividerClasses-91c74733.js";import"./listItemTextClasses-7e80198b.js";import"./KeyboardArrowRight-e84473c8.js";import"./LastPage-931a2b6d.js";import"./index.esm-e372dd1f.js";import"./yup-0d492cec.js";import"./SelectComponent-f3230d63.js";import"./objectSpread2-a3c10d55.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-e729048c.js";import"./TextArea-d5dc99f9.js";import"./TextField-2ccc0cd3.js";import"./FormControl-63806889.js";import"./Avatar-9137e935.js";import"./Delete-16bef469.js";import"./createSvgIcon-5a007a35.js";import"./ListItem-8bd35e37.js";import"./ListItemText-0c99222a.js";import"./DialogContentText-7ab1972a.js";import"./Divider-cbc7fe29.js";import"./InputAdornment-7b2a78bf.js";import"./popper-f3391c26.js";import"./styled-54544d88.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};
