import{b5 as A,c as M,a as z,kL as B,r as f,kV as R,y as T,j as o,q as D,K as p,B as m,w as L,M as Y,T as j}from"./index-d9e0bbb9.js";import{G as q}from"./GoBack-a3ff988c.js";import{R as E}from"./ReadMoreText-b81fb88e.js";import{T as G}from"./index-07650f16.js";import{A as I}from"./index-9eab50b6.js";import"./CustomDatepicker-9495774a.js";import"./index-e61c8ded.js";import"./ScrollableList-03cda798.js";import"./index.esm-65c50bc3.js";import{S as V}from"./SectionDivider-95fcfa90.js";import{C as H}from"./CardContent-0df4f94a.js";import"./LoadingButton-378d10f9.js";import"./index-3bec8271.js";import"./index-1253245b.js";import"./useMediaQuery-1b7ae287.js";import"./useControlled-ba6710bb.js";import"./resolveProps-ba55e2df.js";import"./composeClasses-b42b2e69.js";import"./Link-3b5544a4.js";import"./Dialog-ef39ad8f.js";import"./DialogTitle-60c6eefe.js";import"./DialogContent-4a855a79.js";import"./DialogActions-2abea93f.js";import"./TableCell-643437b4.js";import"./TableRow-113a14fe.js";import"./index-3220221a.js";import"./TableHead-2fc5d5a1.js";import"./createSvgIcon-c99d086f.js";import"./TablePagination-bee8c9bb.js";import"./Toolbar-eaf493cd.js";import"./Select-661ba76b.js";import"./Menu-c23c1491.js";import"./isHostComponent-73d6e646.js";import"./Grow-ca477235.js";import"./List-c3ed6b04.js";import"./useSlotProps-a7d9b3b8.js";import"./OutlinedInput-8f17518b.js";import"./useFormControl-8bb67ca0.js";import"./MenuItem-086da23e.js";import"./dividerClasses-35463663.js";import"./listItemTextClasses-2867fd89.js";import"./KeyboardArrowRight-80f086b2.js";import"./LastPage-cf4835f4.js";import"./index.esm-97139da9.js";import"./yup-267c2267.js";import"./SelectComponent-0a507d7b.js";import"./objectSpread2-7f959c25.js";import"./toPropertyKey-720374c3.js";import"./floating-ui.dom-cd6c919d.js";import"./InputLabel-8c8abfdd.js";import"./Checkbox-74feb846.js";import"./SwitchBase-8b88dd2c.js";import"./TextArea-18d8079e.js";import"./TextField-14942967.js";import"./FormControl-664346ce.js";import"./Avatar-1439ea34.js";import"./Delete-c7a2409b.js";import"./createSvgIcon-ac93a629.js";import"./ListItem-84bb2168.js";import"./ListItemText-ee3c83e5.js";import"./DialogContentText-b49b6920.js";import"./Divider-82724a0a.js";import"./InputAdornment-978b4608.js";import"./popper-f3391c26.js";import"./styled-8fd62552.js";const ti=()=>{var d,x,h;const{id:e}=A(),k=M(),{StockDown:{selectedData:i,pageParams:n},system:{userAccessList:K,systemPreferences:{preferences:{is_inventory:_}={}}={}}}=z(s=>B(s));f.useEffect(()=>{k(R({id:e||""}))},[e]);const S=[{label:"Code",value:i==null?void 0:i.code},{label:"Created On",value:T(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(E,{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(q,{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(L,{children:o.jsxs(H,{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(Y,{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(V,{title:"Item Details"})}),o.jsx(m,{children:o.jsx(G,{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{ti as default};
