import{j as a,I as E,a3 as r,aJ as M,T as Y,ak as p}from"./mui-vendor-CkIVaoQP.js";import{A as v,v as o,g5 as S,Q as g,g6 as b,u as I,c as T,M as k,b as w,S as l,W as y}from"./index-Cr86_nOs.js";import{A as q}from"./AdvancedTable-BvRVoK6m.js";import{f as L,u as R}from"./redux-vendor-B7uoacJt.js";import{u as U,r as t}from"./react-vendor-CmFgShSM.js";import{d as G}from"./Plagiarism-DvlRWu4f.js";const H=()=>{const A=U(),[x,f]=t.useState([]),{slaughterActiveRequests:s}=L(u=>u.slaughterSlice),[,,n,d,c,C]=t.useContext(v);t.useEffect(()=>{const u=o(new Date).format("YYYY-MM-DD");d(u),C(u)},[]);const m=R();t.useEffect(()=>{m(S({selectedDate1:n,selectedDate2:c}))},[n,c]),t.useEffect(()=>{const u=s==null?void 0:s.filter((e,i)=>e.provinceKillState!=="rejected"),F="orderCode",j=[...new Map(u==null?void 0:u.map(e=>[e[F],e])).values()].map((e,i)=>[i+1,e.orderCode,g(new Date(e==null?void 0:e.sendDate),"yyyy/MM/dd"),e.poultryName,e.poultryMobile,e.city,e.province,e.age,e.mainQuantity+" قطعه",a.jsx(E,{"aria-label":"delete",color:"primary",onClick:()=>A(b+e.poultryReqId),children:a.jsx(G,{})},i)]);f(j)},[s]);const[h]=t.useState(["ردیف","کد سفارش","تاریخ درخواست","مرغدار","تلفن مرغدار","شهر","استان","سن مرغ","تعداد","مشاهده"]),D=I({initialValues:{capacity:"",recieveTime:"",recieveDate:o(Date()).format("YYYY-MM-DD hh:mm:ss")},validationSchema:T({capacity:w().required("این فیلد اجباری است!").typeError("لطفا عدد وارد کنید!"),recieveTime:k().required("این فیلد اجباری است!").typeError("لطفا وزن را وارد کنید!")})});return t.useEffect(()=>{D.validateForm()},[]),a.jsx(r,{container:!0,alignItems:"center",justifyContent:"space-between",gap:l.SMALL,mt:l.MEDIUM,children:a.jsx(M,{sx:{width:"100%"},children:a.jsx(q,{name:a.jsxs(r,{container:!0,alignItems:"center",gap:l.SMALL,children:[a.jsx(r,{children:a.jsx(Y,{children:"درخواست های فعال"})}),a.jsx(r,{children:a.jsx(y,{label:"از تاریخ",id:"date",renderInput:u=>a.jsx(p,{style:{width:"160px"},...u}),value:n,onChange:u=>{d(o(u).format("YYYY-MM-DD"))}})}),a.jsx(r,{children:a.jsx(y,{label:"تا تاریخ",id:"date",renderInput:u=>a.jsx(p,{style:{width:"160px"},...u}),value:c,onChange:u=>{C(o(u).format("YYYY-MM-DD"))}})})]}),columns:h,data:x})})})};export{H as S};
