import{j as s,I as T,aJ as H,T as U,ak as v}from"./mui-vendor-CkIVaoQP.js";import{u as L,r as o}from"./react-vendor-CmFgShSM.js";import{A as N}from"./AdvancedTable-BvRVoK6m.js";import{d as P}from"./Plagiarism-DvlRWu4f.js";import{f as G,u as Q}from"./redux-vendor-B7uoacJt.js";import{A as B,a9 as w,fa as W,Q as i,G as j,S as Y,W as q,X as J,fb as X}from"./index-Cr86_nOs.js";const $=()=>{const{awaitingPaymentRequests:a}=G(u=>u.generalSlice),M=L(),[k,R]=o.useState([]),S=window.location.pathname.split("/")[1],[,,t,E,n,r]=o.useContext(B);o.useEffect(()=>{const u=w(new Date).format("YYYY-MM-DD");E(u),r(u)},[]);const b=Q();return o.useEffect(()=>{b(W({selectedDate1:t,selectedDate2:n}))},[t,n]),o.useEffect(()=>{const u="/"+S+"/file/",I=a==null?void 0:a.map((e,l)=>{var c,p,d,A,y,C,f,x,F,g,D;return[l+1,(d=(p=(c=e.provinceCheckInfo)==null?void 0:c.killHouseAssignment)==null?void 0:p.killHouseRequest)==null?void 0:d.barCode,i(new Date((A=e==null?void 0:e.poultryRequest)==null?void 0:A.sendDate),"yyyy/MM/dd"),i(new Date(e==null?void 0:e.factorDate),"yyyy/MM/dd"),(y=e==null?void 0:e.poultryRequest)==null?void 0:y.poultryName,(F=(x=(f=(C=e.provinceCheckInfo)==null?void 0:C.killHouseAssignment)==null?void 0:f.killHouseRequest)==null?void 0:x.killRequest)==null?void 0:F.killHouse.name,e.provinceCheckInfo.killHouseAssignment.netWeight.toLocaleString()+" کیلوگرم",((D=(g=e.provinceCheckInfo)==null?void 0:g.killHouseAssignment)==null?void 0:D.realQuantity.toLocaleString())+" قطعه",e.totalPrice.toLocaleString()+" ﷼",s.jsx(T,{"aria-label":"delete",color:"primary",onClick:()=>{var h;return M(u+((h=e==null?void 0:e.poultryRequest)==null?void 0:h.poultryRequestId))},children:s.jsx(P,{})},l)]});R(I)},[a]),s.jsx(H,{children:s.jsx(N,{name:s.jsxs(j,{container:!0,alignItems:"center",gap:Y.SMALL,children:[s.jsx(j,{container:!0,gap:Y.TINY,children:s.jsx(U,{children:"درخواست های در انتظار پرداخت"})}),s.jsxs(j,{container:!0,gap:Y.SMALL,children:[s.jsx(j,{children:s.jsx(q,{label:"از تاریخ",id:"date",renderInput:u=>s.jsx(v,{style:{width:"160px"},...u}),value:t,onChange:u=>{E(w(u).format("YYYY-MM-DD"))}})}),s.jsx(j,{children:s.jsx(q,{label:"تا تاریخ",id:"date",renderInput:u=>s.jsx(v,{style:{width:"160px"},...u}),value:n,onChange:u=>{r(w(u).format("YYYY-MM-DD"))}})})]})]}),columns:["ردیف","بارکد","تاریخ کشتار","تاریخ صدور فاکتور","مرغدار","کشتارگاه","وزن","تعداد","مبلغ کل فاکتور","مشاهده"],data:k})})},m=()=>{const{awaitingInspectionRequests:a}=G(r=>r.generalSlice),M=L(),[k,R]=o.useState([]),S=window.location.pathname.split("/")[1],t=Q(),E=J();o.useEffect(()=>{t(X(E+"&inspector"))},[]),o.useEffect(()=>{const r="/"+S+"/file/",b=a==null?void 0:a.map((u,I)=>{var e,l,c,p,d,A,y,C,f,x,F,g;return[I+1,u.orderCode,i(new Date(u.createDate),"yyyy/MM/dd"),i(new Date(u.sendDate),"yyyy/MM/dd"),(l=(e=u==null?void 0:u.process)==null?void 0:e.poultry)==null?void 0:l.poultryName,(p=(c=u==null?void 0:u.process)==null?void 0:c.poultry)==null?void 0:p.poultryMobile,(A=(d=u==null?void 0:u.process)==null?void 0:d.poultry)==null?void 0:A.poultryCity,(C=(y=u==null?void 0:u.process)==null?void 0:y.poultry)==null?void 0:C.poultryProvince,(x=(f=u==null?void 0:u.process)==null?void 0:f.poultry)==null?void 0:x.age,(g=(F=u==null?void 0:u.process)==null?void 0:F.poultry)==null?void 0:g.poultryQuantity,s.jsx(T,{"aria-label":"delete",color:"primary",onClick:()=>{var D,h;return M(r+((h=(D=u==null?void 0:u.process)==null?void 0:D.poultry)==null?void 0:h.poultryRequestId))},children:s.jsx(P,{})},u==null?void 0:u.orderCode)]});R(b)},[a]);const[n]=o.useState(["ردیف","کد سفارش","تاریخ ثبت درخواست","تاریخ درخواست","مرغدار","تلفن مرغدار","شهر","استان","سن مرغ","تعداد","مشاهده"]);return s.jsx(H,{children:s.jsx(N,{expandable:!0,name:"درخواست های در انتظار بررسی بازرس",columns:n,data:k})})};export{$ as R,m as a};
