import{j as u,aJ as p,cq as x,b1 as d,T as j,p as m,I as F,b as y}from"./mui-vendor-CkIVaoQP.js";import{r as a,u as E}from"./react-vendor-CmFgShSM.js";import{u as v,f as S}from"./redux-vendor-B7uoacJt.js";import{A as R}from"./AdvancedTable-BvRVoK6m.js";import{p as b,G as c,S as i,iO as w,Q as D,iz as L}from"./index-Cr86_nOs.js";import{d as T}from"./Plagiarism-DvlRWu4f.js";import{C as B,a as I}from"./ChartLenear-WgLA0J0V.js";import"./index-IuzvFnSU.js";import"./Close-C8iZ2Qr6.js";import"./Search-DLgMQCPC.js";import"./Delete-CTUmuli-.js";import"./chart-vendor-sE2SUVPW.js";import"./auto-gcBAg08D.js";const f=({data:s})=>{const[t,C]=a.useState({datasets:[]}),[l,h]=a.useState({datasets:[]});return a.useEffect(()=>{var o,e,n,g,A;C({labels:(o=s==null?void 0:s.hatchingChart)==null?void 0:o.map(r=>b(r==null?void 0:r.date)),datasets:[{label:"تعداد",backgroundColor:["rgba(33, 72, 214, 0.7)"],data:(e=s==null?void 0:s.hatchingChart)==null?void 0:e.map(r=>r==null?void 0:r.quantity),borderRadius:5},{label:"تلفات",backgroundColor:["rgba(100, 130, 160, 0.7)"],data:(n=s.hatchingChart)==null?void 0:n.map(r=>r==null?void 0:r.losses),borderRadius:5}]}),h({labels:(g=s==null?void 0:s.weightChart)==null?void 0:g.map(r=>b(r==null?void 0:r.date)),datasets:[{label:"قیمت",backgroundColor:["rgba(33, 72, 214, 0.7)"],data:(A=s==null?void 0:s.weightChart)==null?void 0:A.map(r=>r==null?void 0:r.weight),borderRadius:5}]})},[]),u.jsx(c,{mb:i.LARGE,children:u.jsxs(c,{container:!0,mt:i.MEDIUM,gap:i.SMALL,justifyContent:"space-between",children:[u.jsx(p,{sx:{width:"45%"},children:u.jsx(x,{children:u.jsxs(d,{children:[u.jsx(j,{gutterBottom:!0,variant:"body1",children:"نمودار حجم جوجه ریزی و تلفات دوره"}),u.jsx(B,{chartData:t})]})})}),u.jsx(p,{sx:{width:"45%"},children:u.jsx(x,{children:u.jsxs(d,{children:[u.jsx(j,{gutterBottom:!0,variant:"body1",children:"نمودار پایش وزن و بهره وری وزن"}),u.jsx(I,{chartData:l})]})})})]})})};f.propTypes={data:m.PropTypes.any};const z=()=>{const s=v(),{reports:t}=S(o=>o.avicultureSlice),[C,l]=a.useState(),h=E();return a.useEffect(()=>{s(w())},[]),a.useEffect(()=>{const o=t==null?void 0:t.table.map((e,n)=>[n+1,e.hatchingPeriod,D(new Date(e==null?void 0:e.hatchingDate),"yyyy/MM/dd"),e.hatchingChickenBreed,e.age,e.quantity,e.weightOfSuffering,e.averageFee,e.averageWeight,e.salesPrice.toLocaleString(),e.totalAmount.toLocaleString(),e.paidState==="paid"?"پرداخت شده":e.paidState==="pending"?"در انتظار پرداخت":"ندارد",u.jsx(F,{"aria-label":"delete",color:"primary",className:"avicultureActiveRequestsBtn",onClick:()=>h(L+(e==null?void 0:e.requestId)),children:u.jsx(T,{})},n)]);l(o)},[t]),u.jsx(y,{display:"flex",justifyContent:"center",children:u.jsx(c,{container:!0,direction:"column",justifyContent:"center",xs:12,sm:12,md:10,lg:10,children:u.jsxs(c,{xs:12,mt:i.SMALL,children:[u.jsx(c,{width:"100%",className:"avicultureActiveRequestsView",children:u.jsx(p,{children:u.jsx(R,{name:"گزارش مرغدار",columns:["ردیف","دوره جوجه ریزی","تاریخ جوجه ریزی","نژاد","سن","تعداد","رنج وزن","قیمت رنج","میانگین وزن شما","قیمت فروش","جمع مبلغ به تومان","تراکنش مالی","نمایش پرونده"],data:C})})}),u.jsx(f,{data:t})]})})})};export{z as default};
