import{b4 as M,c as O,a as T,li as z,r as k,ls 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-6fe66247.js";import{G}from"./GoBack-1a012f90.js";import{R as L}from"./ReadMoreText-c7712d2a.js";import{T as I}from"./index-2cc408cd.js";import{A as H}from"./index-7eb6485e.js";import"./CustomDatepicker-8082706c.js";import"./index-b6aec95e.js";import"./ScrollableList-0f8e556e.js";import"./index.esm-34c2a639.js";import{S as K}from"./SectionDivider-ea552de1.js";import{C as N}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 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,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,(u=t==null?void 0:t.asset)!=null&&u.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?(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};
