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-c910e189.js";import{G as q}from"./GoBack-68feabba.js";import{R as E}from"./ReadMoreText-a1326720.js";import{T as G}from"./index-ece39440.js";import{A as L}from"./index-1cb83362.js";import"./CustomDatepicker-fa2ab383.js";import"./index-f58a077c.js";import"./ScrollableList-4f192da2.js";import"./index.esm-4b824583.js";import{S as I}from"./SectionDivider-782acfa4.js";import{C as H}from"./CardContent-66856645.js";import"./LoadingButton-97812789.js";import"./index-3e499916.js";import"./index-eec67340.js";import"./useMediaQuery-f2cfdb18.js";import"./useControlled-e4156ecd.js";import"./resolveProps-d3929786.js";import"./composeClasses-b42b2e69.js";import"./Link-48695511.js";import"./Dialog-a2882bbb.js";import"./DialogTitle-9a53d260.js";import"./DialogContent-589114d5.js";import"./DialogActions-d05865c7.js";import"./TableCell-f4de0f25.js";import"./TableRow-778e2904.js";import"./index-2b6d61d0.js";import"./TableHead-e4842399.js";import"./createSvgIcon-482c4579.js";import"./TablePagination-d388f34f.js";import"./Toolbar-ef2f3b22.js";import"./Select-11d028f2.js";import"./Menu-0b919c7f.js";import"./isHostComponent-73d6e646.js";import"./Grow-4f2c0713.js";import"./List-5ca02ce5.js";import"./useSlotProps-81a688b7.js";import"./OutlinedInput-5e0321ba.js";import"./useFormControl-2acc5484.js";import"./MenuItem-424dbae4.js";import"./dividerClasses-f84f5755.js";import"./listItemTextClasses-ac790319.js";import"./KeyboardArrowRight-bd6f3607.js";import"./LastPage-e4e9bf3d.js";import"./index.esm-cb7a914e.js";import"./yup-e6171339.js";import"./SelectComponent-34494e1c.js";import"./objectSpread2-ae4dd896.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-8a73326d.js";import"./TextArea-173e49c2.js";import"./TextField-d2437cd2.js";import"./FormControl-aa398a78.js";import"./Avatar-4bda1c81.js";import"./Delete-d8e81270.js";import"./createSvgIcon-0635653a.js";import"./ListItem-66a23e49.js";import"./ListItemText-43ff9877.js";import"./DialogContentText-1b4ebcf7.js";import"./Divider-108afcb2.js";import"./InputAdornment-9bf084ba.js";import"./popper-f3391c26.js";import"./styled-015539db.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};
