import{b5 as M,c as O,a as T,lk as z,r as k,lu 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-d9e0bbb9.js";import{G}from"./GoBack-a3ff988c.js";import{R as L}from"./ReadMoreText-b81fb88e.js";import{T as I}from"./index-07650f16.js";import{A as H}from"./index-9eab50b6.js";import"./CustomDatepicker-9495774a.js";import"./index-e61c8ded.js";import"./ScrollableList-03cda798.js";import"./index.esm-65c50bc3.js";import{S as K}from"./SectionDivider-95fcfa90.js";import{C as N}from"./CardContent-0df4f94a.js";import"./LoadingButton-378d10f9.js";import"./index-3bec8271.js";import"./index-1253245b.js";import"./useMediaQuery-1b7ae287.js";import"./useControlled-ba6710bb.js";import"./resolveProps-ba55e2df.js";import"./composeClasses-b42b2e69.js";import"./Link-3b5544a4.js";import"./Dialog-ef39ad8f.js";import"./DialogTitle-60c6eefe.js";import"./DialogContent-4a855a79.js";import"./DialogActions-2abea93f.js";import"./TableCell-643437b4.js";import"./TableRow-113a14fe.js";import"./index-3220221a.js";import"./TableHead-2fc5d5a1.js";import"./createSvgIcon-c99d086f.js";import"./TablePagination-bee8c9bb.js";import"./Toolbar-eaf493cd.js";import"./Select-661ba76b.js";import"./Menu-c23c1491.js";import"./isHostComponent-73d6e646.js";import"./Grow-ca477235.js";import"./List-c3ed6b04.js";import"./useSlotProps-a7d9b3b8.js";import"./OutlinedInput-8f17518b.js";import"./useFormControl-8bb67ca0.js";import"./MenuItem-086da23e.js";import"./dividerClasses-35463663.js";import"./listItemTextClasses-2867fd89.js";import"./KeyboardArrowRight-80f086b2.js";import"./LastPage-cf4835f4.js";import"./index.esm-97139da9.js";import"./yup-267c2267.js";import"./SelectComponent-0a507d7b.js";import"./objectSpread2-7f959c25.js";import"./toPropertyKey-720374c3.js";import"./floating-ui.dom-cd6c919d.js";import"./InputLabel-8c8abfdd.js";import"./Checkbox-74feb846.js";import"./SwitchBase-8b88dd2c.js";import"./TextArea-18d8079e.js";import"./TextField-14942967.js";import"./FormControl-664346ce.js";import"./Avatar-1439ea34.js";import"./Delete-c7a2409b.js";import"./createSvgIcon-ac93a629.js";import"./ListItem-84bb2168.js";import"./ListItemText-ee3c83e5.js";import"./DialogContentText-b49b6920.js";import"./Divider-82724a0a.js";import"./InputAdornment-978b4608.js";import"./popper-f3391c26.js";import"./styled-8fd62552.js";const ii=()=>{var h,x,u;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 g,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,(g=t==null?void 0:t.asset)!=null&&g.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?(u=i==null?void 0:i.stock_up_items)==null?void 0:u.length:0,columns:v,rows:d||[],loading:!1,page:p.page,pageSize:p.page_size,handleChangePage:C,handleChangeRowsPerPage:P})})]})})})})})})};export{ii as default};
