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-7414fd54.js";import{G}from"./GoBack-069f986f.js";import{R as L}from"./ReadMoreText-e5224c8d.js";import{T as I}from"./index-04819da2.js";import{A as H}from"./index-77e66e7c.js";import"./CustomDatepicker-6be798ca.js";import"./index-b6124309.js";import"./ScrollableList-abce50c2.js";import"./index.esm-24ac0554.js";import{S as K}from"./SectionDivider-ec0341fc.js";import{C as N}from"./CardContent-8ed30fb2.js";import"./LoadingButton-75c9b57b.js";import"./index-b7f52b29.js";import"./index-89446b48.js";import"./useMediaQuery-c16b4b9b.js";import"./useControlled-dcaff400.js";import"./resolveProps-3552295b.js";import"./composeClasses-b42b2e69.js";import"./Link-152aa696.js";import"./Dialog-8695d0ea.js";import"./DialogTitle-68b28184.js";import"./DialogContent-05d9166f.js";import"./DialogActions-0c149659.js";import"./TableCell-3cadf061.js";import"./TableRow-34be244e.js";import"./index-aa118901.js";import"./TableHead-4965c3b4.js";import"./createSvgIcon-76207f66.js";import"./TablePagination-748823c3.js";import"./Toolbar-1aeab16d.js";import"./Select-48086034.js";import"./Menu-1900bd36.js";import"./isHostComponent-73d6e646.js";import"./Grow-2a8f811c.js";import"./List-5ed8845c.js";import"./useSlotProps-60b9b089.js";import"./OutlinedInput-dd801d4f.js";import"./useFormControl-99b033b3.js";import"./MenuItem-a928b422.js";import"./dividerClasses-5fe46a73.js";import"./listItemTextClasses-aec56de0.js";import"./KeyboardArrowRight-13711303.js";import"./LastPage-4b7b4114.js";import"./index.esm-87a8ddec.js";import"./yup-42c56a9b.js";import"./SelectComponent-e3e501a9.js";import"./objectSpread2-8ef7a44c.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-d3b034a6.js";import"./TextArea-5df59b36.js";import"./TextField-ee00f42e.js";import"./FormControl-0c273f44.js";import"./Avatar-4ca5c5e5.js";import"./Delete-79cac24b.js";import"./createSvgIcon-95ed2313.js";import"./ListItem-fe933826.js";import"./ListItemText-199ec7df.js";import"./DialogContentText-ab6f5201.js";import"./Divider-64d3eb58.js";import"./InputAdornment-038fa482.js";import"./popper-f3391c26.js";import"./styled-c92acce6.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};
