import{j as e,T as I,ak as g,b as M}from"./mui-vendor-CkIVaoQP.js";import{r as o}from"./react-vendor-CmFgShSM.js";import{fG as b,A as m,v as i,p as H,G as a,S as c,W as F,ll as R,X as q}from"./index-Cr86_nOs.js";import{f as k,u as T}from"./redux-vendor-B7uoacJt.js";import{S as D}from"./SimpleTable-CWlU9uE0.js";import"./index-IuzvFnSU.js";import"./Close-C8iZ2Qr6.js";import"./Search-DLgMQCPC.js";import"./Delete-CTUmuli-.js";const G=()=>{const{inventoryData:s}=k(t=>t.liveStockSlice),[Y,d]=o.useState([]),p=T();o.useEffect(()=>{p(b())},[]);const{freezingRequests:r}=k(t=>t.liveStockSlice),[,,n,x,l,C]=o.useContext(m);o.useEffect(()=>{const t=i(new Date).format("YYYY-MM-DD");x(t),C(t)},[]);const y=()=>{!n||!l||p(R({role:q(),date1:n,date2:l}))};o.useEffect(()=>{y()},[n,l]),o.useEffect(()=>{if(!r||!Array.isArray(r)){d([]);return}const t=r.filter(u=>(u==null?void 0:u.state)==="accepted").map((u,L)=>{var f,A,j,h,S;return[L+1,((f=u==null?void 0:u.coldHouse)==null?void 0:f.name)||"-",((j=(A=u==null?void 0:u.killHouseRequest)==null?void 0:A.killHouseRequestInfo)==null?void 0:j.poultryName)||"-",((S=(h=u==null?void 0:u.killHouseRequest)==null?void 0:h.killHouseRequestInfo)==null?void 0:S.killHouseFullname)||"-",(u==null?void 0:u.quantity)||"-",(u==null?void 0:u.weight)||"-",H(u==null?void 0:u.createDate)||"-","در انتظار تایید"]});d(t||[])},[r]);const E=e.jsxs(a,{container:!0,alignItems:"center",gap:c.SMALL,children:[e.jsx(a,{container:!0,gap:c.TINY,children:e.jsx(I,{children:"تخصیص برای انجماد"})}),e.jsxs(a,{container:!0,gap:c.SMALL,children:[e.jsx(a,{children:e.jsx(F,{label:"از تاریخ",id:"date",renderInput:t=>e.jsx(g,{size:"small",style:{width:"160px"},...t}),value:n,onChange:t=>{x(i(t).format("YYYY-MM-DD"))}})}),e.jsx(a,{children:e.jsx(F,{label:"تا تاریخ",id:"date",renderInput:t=>e.jsx(g,{size:"small",style:{width:"160px"},...t}),value:l,onChange:t=>{C(i(t).format("YYYY-MM-DD"))}})})]})]});return e.jsxs(a,{container:!0,xs:12,justifyContent:"center",alignItems:"center",mt:2,children:[e.jsx(D,{name:`موجودی انبار ${(s==null?void 0:s.name)||""}`,columns:["تعداد کل","وزن کل"],data:[[s!=null&&s.totalQuantity?s.totalQuantity.toLocaleString():"-",s!=null&&s.totalWeight?s.totalWeight.toLocaleString():"-"]]}),e.jsx(a,{container:!0,mt:4,xs:12,children:e.jsx(D,{name:E,columns:["ردیف","سردخانه","مرغدار","کشتارگاه","تعداد","وزن","تاریخ ثبت","وضعیت"],data:Y})})]})},U=()=>e.jsx(M,{display:"flex",justifyContent:"center",children:e.jsx(a,{container:!0,direction:"column",justifyContent:"center",xs:12,sm:12,md:10,lg:10,children:e.jsx(a,{container:!0,justifyContent:"space-between",gap:c.SMALL,mt:2,children:e.jsx(a,{xs:12,children:e.jsx(G,{})})})})});export{U as default};
