import{b4 as M,c as O,a as T,lj as z,r as k,lt 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-55b8aeb0.js";import{G}from"./GoBack-c779b7da.js";import{R as L}from"./ReadMoreText-e0b60f2c.js";import{T as I}from"./index-9b42a4fa.js";import{A as H}from"./index-1b631966.js";import"./CustomDatepicker-9892b2ee.js";import"./index-7c560a47.js";import"./ScrollableList-a069ff95.js";import"./index.esm-8f37a121.js";import{S as K}from"./SectionDivider-0fcc86df.js";import{C as N}from"./CardContent-5d45e66d.js";import"./LoadingButton-90290e16.js";import"./index-b46d078b.js";import"./index-3c3af0a2.js";import"./useMediaQuery-74f5c38e.js";import"./useControlled-dc1d5a3a.js";import"./resolveProps-950d970c.js";import"./composeClasses-b42b2e69.js";import"./Link-433ffec8.js";import"./Dialog-5977b5ec.js";import"./DialogTitle-37cbd0b5.js";import"./DialogContent-c61b109b.js";import"./DialogActions-57cb8efb.js";import"./TableCell-53983040.js";import"./TableRow-abb96e14.js";import"./index-136ea595.js";import"./TableHead-75c76b5a.js";import"./createSvgIcon-61f1439a.js";import"./TablePagination-52f19a14.js";import"./Toolbar-880b00d0.js";import"./Select-67acd544.js";import"./Menu-755754ee.js";import"./isHostComponent-73d6e646.js";import"./Grow-f7742528.js";import"./List-131a37dd.js";import"./useSlotProps-999c26ad.js";import"./OutlinedInput-113a096e.js";import"./useFormControl-0fae9ee7.js";import"./MenuItem-60289e9c.js";import"./dividerClasses-8edbe511.js";import"./listItemTextClasses-425c9ee5.js";import"./KeyboardArrowRight-6d59349d.js";import"./LastPage-1a2e56d1.js";import"./index.esm-31587b9b.js";import"./yup-21078b88.js";import"./SelectComponent-2bce8639.js";import"./objectSpread2-1e39d65c.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-0efc058b.js";import"./TextArea-c15d3047.js";import"./TextField-54536ec2.js";import"./FormControl-ff03dcb8.js";import"./Avatar-81057b61.js";import"./Delete-79fcc96b.js";import"./createSvgIcon-229e54d4.js";import"./ListItem-20c1dcd1.js";import"./ListItemText-1a8db100.js";import"./DialogContentText-766272a6.js";import"./Divider-37961cd0.js";import"./InputAdornment-a1329ca0.js";import"./popper-f3391c26.js";import"./styled-ea700eba.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,j,f;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?(j=t==null?void 0:t.asset)==null?void 0:j.name:"",((f=t==null?void 0:t.asset)==null?void 0:f.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};
