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-7d3dbb9c.js";import{G}from"./GoBack-3bb20b9f.js";import{R as L}from"./ReadMoreText-51f037d9.js";import{T as I}from"./index-7a00ca34.js";import{A as H}from"./index-4b211bdc.js";import"./CustomDatepicker-6d5ad1ab.js";import"./index-b5c17d61.js";import"./ScrollableList-ffeab0b0.js";import"./index.esm-9d396c5f.js";import{S as K}from"./SectionDivider-be0a23cf.js";import{C as N}from"./CardContent-184f4e92.js";import"./LoadingButton-323cc52e.js";import"./index-7976e00d.js";import"./index-e9cb9551.js";import"./useMediaQuery-77b67f07.js";import"./useControlled-338e346b.js";import"./resolveProps-4b8623f7.js";import"./composeClasses-b42b2e69.js";import"./Link-19ee87c9.js";import"./Dialog-d125aee1.js";import"./DialogTitle-a3176c12.js";import"./DialogContent-d34f4ba4.js";import"./DialogActions-99629c3a.js";import"./TableCell-26014f2c.js";import"./TableRow-23a8435a.js";import"./index-3cd7bbe9.js";import"./TableHead-ec26fced.js";import"./createSvgIcon-25cfe1a8.js";import"./TablePagination-f03db3c2.js";import"./Toolbar-b85f9581.js";import"./Select-762ec619.js";import"./Menu-5245abf0.js";import"./isHostComponent-73d6e646.js";import"./Grow-1b15246b.js";import"./List-d7c020ab.js";import"./useSlotProps-f2e72ab1.js";import"./OutlinedInput-e6d419ce.js";import"./useFormControl-7314cc67.js";import"./MenuItem-02b6c30e.js";import"./dividerClasses-59256fce.js";import"./listItemTextClasses-626eaddb.js";import"./KeyboardArrowRight-ff7c065c.js";import"./LastPage-7938a031.js";import"./index.esm-12cc9f7b.js";import"./yup-55e79238.js";import"./SelectComponent-b1bc4bdd.js";import"./objectSpread2-947328ce.js";import"./toPropertyKey-720374c3.js";import"./floating-ui.dom-cd6c919d.js";import"./InputLabel-ade41a0b.js";import"./Checkbox-4b8e4bb1.js";import"./SwitchBase-d834be30.js";import"./TextArea-4d76f175.js";import"./TextField-a362d747.js";import"./FormControl-f3d9cdb4.js";import"./Avatar-4afe3b6a.js";import"./Delete-42c54f4b.js";import"./createSvgIcon-d159d1d4.js";import"./ListItem-409b4a2b.js";import"./ListItemText-86a8a23f.js";import"./DialogContentText-9128b573.js";import"./Divider-f0aceb0b.js";import"./InputAdornment-bbfa18ee.js";import"./popper-f3391c26.js";import"./styled-446e5583.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};
