import{b4 as P,c as A,a as M,le as O,r as u,lf as z,y as B,j as o,q as R,K as p,B as m,w as T,M as Y,T as f}from"./index-6fe66247.js";import{G as q}from"./GoBack-1a012f90.js";import{R as E}from"./ReadMoreText-c7712d2a.js";import{T as G}from"./index-2cc408cd.js";import{A as L}from"./index-7eb6485e.js";import"./CustomDatepicker-8082706c.js";import"./index-b6aec95e.js";import"./ScrollableList-0f8e556e.js";import"./index.esm-34c2a639.js";import{S as I}from"./SectionDivider-ea552de1.js";import{C as H}from"./CardContent-6b060104.js";import"./LoadingButton-0d8774cc.js";import"./index-25f54021.js";import"./index-b6605ad3.js";import"./useMediaQuery-0f3d61e0.js";import"./useControlled-e803b382.js";import"./resolveProps-d8ef25a0.js";import"./composeClasses-b42b2e69.js";import"./Link-de7e0135.js";import"./Dialog-649880d3.js";import"./DialogTitle-00f16647.js";import"./DialogContent-24cef02f.js";import"./DialogActions-1be7e947.js";import"./TableCell-1aea1cc4.js";import"./TableRow-3949f515.js";import"./index-bf51d29c.js";import"./TableHead-d8cbb45f.js";import"./createSvgIcon-00102b53.js";import"./TablePagination-5e52cd9b.js";import"./Toolbar-928aa284.js";import"./Select-f9dfa240.js";import"./Menu-e61076f9.js";import"./isHostComponent-73d6e646.js";import"./Grow-b68a569b.js";import"./List-11a0d6f8.js";import"./useSlotProps-d14db7f9.js";import"./OutlinedInput-982baeac.js";import"./useFormControl-35c6f1af.js";import"./MenuItem-cae4b005.js";import"./dividerClasses-9c506d69.js";import"./listItemTextClasses-5758b05f.js";import"./KeyboardArrowRight-8a542f89.js";import"./LastPage-fa4056a6.js";import"./index.esm-8dc7c617.js";import"./yup-ef931f05.js";import"./SelectComponent-378c45a1.js";import"./objectSpread2-dd5dc5f3.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-76d7f8cb.js";import"./TextArea-34c19bec.js";import"./TextField-0748ea02.js";import"./FormControl-cc4d9109.js";import"./Avatar-711191fc.js";import"./Delete-ce0b1fc6.js";import"./createSvgIcon-d8706e41.js";import"./ListItem-86680823.js";import"./ListItemText-1b44a7ef.js";import"./DialogContentText-0d0d743e.js";import"./Divider-e9f3667a.js";import"./InputAdornment-33eb10d0.js";import"./popper-f3391c26.js";import"./styled-a478ed92.js";const ti=()=>{var l,g,d;const{id:s}=P(),j=A(),{OpeningStock:{selectedData:i,pageParams:n},system:{userAccessList:K,systemPreferences:{preferences:{is_inventory:k}={}}={}}}=M(e=>O(e));u.useEffect(()=>{j(z({id:s||""}))},[s]);const _=[{label:"Code",value:i==null?void 0:i.code},{label:"Created On",value:B(i==null?void 0:i.date).format("DD-MM-YYYY")},{label:k?"Project":"Location",value:(l=i==null?void 0:i.location)==null?void 0:l.name}],S=[{title:"S.No",width:100},{title:"Asset",width:100},{title:"Quantity",width:100}];function a(e,r,t){return{index:e,name:r,quantity:t}}const c=u.useMemo(()=>{var e,r;return(r=(e=i==null?void 0:i.opening_stock_items)==null?void 0:e.filter(t=>!(t!=null&&t.dodelete)))==null?void 0:r.map((t,v)=>{var x,h;const C=(n.page-1)*n.page_size+(v+1);return E,t!=null&&t.description,a(C,(x=t==null?void 0:t.asset)!=null&&x.name?(h=t==null?void 0:t.asset)==null?void 0:h.name:"",t!=null&&t.quantity?t==null?void 0:t.quantity:0)})},[i,a]),b=(e,r)=>{},y=e=>{};return R(),o.jsx(p,{container:!0,spacing:2,children:o.jsx(p,{size:{xs:12},children:o.jsx(q,{is_goback:!0,go_back_url:"/openingstock",title:"Opening Stock Details",showSaveButton:!1,loading:!1,extra:o.jsx(L,{instance_id:s||"",modal_path:"openingstock.openingstock",app_label:"openingstock",model_name:"openingstock"}),children:o.jsx(m,{children:o.jsx(T,{children:o.jsxs(H,{children:[o.jsx(m,{px:2,sx:{borderRadius:2},children:o.jsx(p,{container:!0,spacing:1,children:_.map(e=>o.jsx(p,{size:{xs:12,md:6,lg:4,xl:3},children:o.jsxs(Y,{sx:{flexDirection:{md:"row",lg:"column"},gap:1},children:[o.jsxs(f,{sx:{display:"inline",fontWeight:"bold"},children:[e.label,":"," "]}),o.jsxs(f,{children:[" ",e==null?void 0:e.value]})]})}))})}),o.jsx(m,{sx:{mt:1},children:o.jsx(I,{title:"Item Details"})}),o.jsx(m,{children:o.jsx(G,{showPagination:!1,containerHeight:440,count:(g=i==null?void 0:i.opening_stock_items)!=null&&g.length?(d=i==null?void 0:i.opening_stock_items)==null?void 0:d.length:0,columns:S,rows:c||[],loading:!1,page:n.page,pageSize:n.page_size,handleChangePage:b,handleChangeRowsPerPage:y})})]})})})})})})};export{ti as default};
