import{b4 as A,c as M,a as T,kJ as z,r as f,kT as B,y as R,j as o,q as D,K as p,B as m,w as Y,M as q,T as j}from"./index-1350aa97.js";import{G as E}from"./GoBack-98f02bc3.js";import{R as G}from"./ReadMoreText-16725341.js";import{T as L}from"./index-5a1f70d0.js";import{A as I}from"./index-0c915e5d.js";import"./CustomDatepicker-9019a583.js";import"./index-bd875dae.js";import"./ScrollableList-3f260516.js";import"./index.esm-74444d29.js";import{S as H}from"./SectionDivider-474af95d.js";import{C as J}from"./CardContent-ded20b1f.js";import"./LoadingButton-1c15b99a.js";import"./index-dd1e751c.js";import"./index-8daffd3f.js";import"./useMediaQuery-a3126238.js";import"./useControlled-39301d68.js";import"./resolveProps-d26bdf8f.js";import"./composeClasses-b42b2e69.js";import"./Link-93a82ccf.js";import"./Dialog-e78460a0.js";import"./DialogTitle-549fa0f9.js";import"./DialogContent-c8c72209.js";import"./DialogActions-4ba990ac.js";import"./TableCell-a6f79ef2.js";import"./TableRow-c7fca392.js";import"./index-78814c8f.js";import"./TableHead-ad1c6add.js";import"./createSvgIcon-2e83c7e0.js";import"./TablePagination-e8711540.js";import"./Toolbar-d333937b.js";import"./Select-8eee5a8a.js";import"./Menu-4f31c92d.js";import"./isHostComponent-73d6e646.js";import"./Grow-ffb74095.js";import"./List-538d4780.js";import"./useSlotProps-618d2e24.js";import"./OutlinedInput-8de92ced.js";import"./useFormControl-dd6168e4.js";import"./MenuItem-5b6ab204.js";import"./dividerClasses-15d7c20c.js";import"./listItemTextClasses-8ebe873e.js";import"./KeyboardArrowRight-d6b7e992.js";import"./LastPage-718ed1f4.js";import"./index.esm-e43efa83.js";import"./yup-eafdc449.js";import"./SelectComponent-d2f070a3.js";import"./objectSpread2-07822c35.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-13efa73d.js";import"./TextArea-c6344fb4.js";import"./TextField-db0e4632.js";import"./FormControl-08732dac.js";import"./Avatar-cb5b344c.js";import"./Delete-18a9fe9f.js";import"./createSvgIcon-9bc0b323.js";import"./ListItem-67d0b30b.js";import"./ListItemText-49793c78.js";import"./DialogContentText-e9b61a7a.js";import"./Divider-020e5cdd.js";import"./InputAdornment-0139a25d.js";import"./popper-f3391c26.js";import"./styled-a7d7cd46.js";const ii=()=>{var d,x,h;const{id:e}=A(),k=M(),{StockDown:{selectedData:i,pageParams:n},system:{userAccessList:K,systemPreferences:{preferences:{is_inventory:_}={}}={}}}=T(s=>z(s));f.useEffect(()=>{k(B({id:e||""}))},[e]);const S=[{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:_?"Projct":"Location",value:(d=i==null?void 0:i.location)==null?void 0:d.name}],b=[{title:"S.No",width:100},{title:"Asset",width:100},{title:"Quantity",width:100},{title:"Description",width:100}];function c(s,r,t,a){return{index:s,name:r,quantity:t,description:a}}const l=f.useMemo(()=>{var s,r;return(r=(s=i==null?void 0:i.stock_down_items)==null?void 0:s.filter(t=>!(t!=null&&t.dodelete)))==null?void 0:r.map((t,a)=>{var g,u;const C=(n.page-1)*n.page_size+(a+1),P=o.jsx(G,{text:(t==null?void 0:t.description)||"",maxLength:35});return c(C,(g=t==null?void 0:t.asset)!=null&&g.name?(u=t==null?void 0:t.asset)==null?void 0:u.name:"",t!=null&&t.quantity?t==null?void 0:t.quantity:0,P)})},[i,c]),y=(s,r)=>{},v=s=>{};return D(),o.jsx(p,{container:!0,spacing:2,children:o.jsx(p,{size:{xs:12},children:o.jsx(E,{is_goback:!0,go_back_url:"/stockdown",title:"StockDown Details",showSaveButton:!1,loading:!1,extra:o.jsx(I,{instance_id:e||"",modal_path:"openingstock.openingstock",app_label:"openingstock",model_name:"openingstock"}),children:o.jsx(m,{children:o.jsx(Y,{children:o.jsxs(J,{children:[o.jsx(m,{px:2,sx:{borderRadius:2},children:o.jsx(p,{container:!0,spacing:1,children:S.map(s=>o.jsx(p,{size:{xs:12,md:6,lg:4,xl:3},children:o.jsxs(q,{sx:{flexDirection:{md:"row",lg:"column"},gap:1},children:[o.jsxs(j,{sx:{display:"inline",fontWeight:"bold"},children:[s.label,":"," "]}),o.jsxs(j,{children:[" ",s==null?void 0:s.value]})]})}))})}),o.jsx(m,{sx:{mt:1},children:o.jsx(H,{title:"Item Details"})}),o.jsx(m,{children:o.jsx(L,{showPagination:!1,containerHeight:440,count:(x=i==null?void 0:i.stock_down_items)!=null&&x.length?(h=i==null?void 0:i.stock_down_items)==null?void 0:h.length:0,columns:b,rows:l||[],loading:!1,page:n.page,pageSize:n.page_size,handleChangePage:y,handleChangeRowsPerPage:v})})]})})})})})})};export{ii as default};
