Files
Rasadyar_FrontEnd/build/assets/AdminStatics-EagIwpMs.js

3 lines
30 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import{j as e,aA as A,T as c,B as F,ag as q,aw as T,ax as v,d as R,ak as I,aI as S,av as Q,aU as ee}from"./mui-vendor-CkIVaoQP.js";import{X as C,G as g,Q as Y,p as B,hK as ue,u as V,W as M,L as te,a9 as k,h as z,c as re,M as se,fI as P,S as $,v as ne}from"./index-N50kY0pn.js";import{r as a}from"./react-vendor-CmFgShSM.js";import{f as y,u as ae}from"./redux-vendor-B7uoacJt.js";import{N,B as L,C as E,M as H,L as U}from"./chart-vendor-sE2SUVPW.js";import"./auto-gcBAg08D.js";import{a as G}from"./index.esm-Bu7XMDZU.js";import{p as oe}from"./chartjs-plugin-datalabels.esm-DvNX1Acq.js";import{h as le}from"./html2canvas.esm-BfYXEYrK.js";import{d as ie}from"./Download-BrPzZJNP.js";import"./iconBase-BEJYyZsk.js";const ce=({province:r})=>{var d,n,h,t,j;const[u,i]=a.useState([]),[x,l]=a.useState(!1),{authToken:s}=y(_=>_.userSlice);return a.useEffect(()=>{fetch(`${r}total_poultry_hatching_dashboard/?role=${C()}`,{headers:{Authorization:`Bearer ${s}`}}).then(_=>_.json()).then(_=>{i(_),l(!1)}).catch(_=>{console.error("Error fetching data:",_),l(!1)})},[r]),e.jsx(e.Fragment,{children:x?e.jsx(A,{}):e.jsxs(g,{container:!0,direction:"column",justifyContent:"center",alignItems:"center",children:[e.jsx(c,{my:2,fontWeight:"bold",children:"فارم های فعال"}),e.jsxs(g,{container:!0,direction:"column",alignItems:"start",children:[e.jsxs(c,{color:"primary",variant:"body2",mb:1,children:["تعداد فارم: ",(d=u==null?void 0:u.poultry_counts)==null?void 0:d.toLocaleString()," واحد"]}),e.jsxs(c,{color:"primary",variant:"body2",mb:1,children:["جوجه ریزی:"," ",(n=u==null?void 0:u.total_poultry_hatchings_quantity)==null?void 0:n.toLocaleString()," قطعه"]}),e.jsxs(c,{color:"primary",variant:"body2",mb:1,children:["تلفات (10٪): ",(h=u==null?void 0:u.losses)==null?void 0:h.toLocaleString()," قطعه"]}),e.jsxs(c,{color:"primary",variant:"body2",mb:1,children:["کشتار شده:"," ",(t=u==null?void 0:u.total_kill_house_request_quantity)==null?void 0:t.toLocaleString()," قطعه"]}),e.jsxs(c,{color:"primary",variant:"body2",mb:1,children:["مانده در سالن:"," ",(j=u==null?void 0:u.total_poultry_hatchings_left)==null?void 0:j.toLocaleString()," قطعه"]})]})]})})},de=({province:r})=>{var d,n,h;const[u,i]=a.useState([]),[x,l]=a.useState(!1),{authToken:s}=y(t=>t.userSlice);return a.useEffect(()=>{fetch(`${r}total_system_user_profile_dashboard/?role=${C()}`,{headers:{Authorization:`Bearer ${s}`}}).then(t=>t.json()).then(t=>{i(t),l(!1)}).catch(t=>{console.error("Error fetching data:",t),l(!1)})},[r]),e.jsx(e.Fragment,{children:x?e.jsx(A,{}):e.jsxs(g,{container:!0,direction:"column",justifyContent:"center",alignItems:"center",children:[e.jsx(c,{my:2,fontWeight:"bold",children:"کاربران"}),e.jsxs(g,{container:!0,direction:"column",alignItems:"start",children:[e.jsxs(c,{color:"primary",variant:"body2",mb:1,children:["کل: ",(d=u==null?void 0:u.users)==null?void 0:d.toLocaleString()]}),e.jsxs(c,{color:"primary",variant:"body2",mb:1,children:["مرغداران: ",(n=u==null?void 0:u.poultries)==null?void 0:n.toLocaleString()]}),e.jsxs(c,{color:"primary",variant:"body2",mb:1,children:["اصناف: ",(h=u==null?void 0:u.guilds)==null?void 0:h.toLocaleString()]})]})]})})};L.font.family="iranyekan";console.log(E);const he=({province:r})=>{var h;const[u,i]=a.useState([]),[x,l]=a.useState(!0),{authToken:s}=y(t=>t.userSlice);a.useEffect(()=>{fetch(`${r}hatching_age_range/?role=${C()}`,{headers:{Authorization:`Bearer ${s}`}}).then(t=>t.json()).then(t=>{i(t),l(!1)}).catch(t=>{console.error("Error fetching data:",t),l(!1)})},[r]);const d={labels:u==null?void 0:u.filter(t=>t==null?void 0:t.quantity).map(t=>t.type),datasets:[{label:"تعداد جوجه ریزی",data:(h=u==null?void 0:u.filter(t=>t.quantity))==null?void 0:h.map(t=>t.quantity),backgroundColor:"rgba(75,192,192,0.2)",borderColor:"rgba(75,192,192,1)",borderWidth:1}]},n={scales:{y:{beginAtZero:!0}},plugins:{rtl:!0}};return e.jsx(e.Fragment,{children:x?e.jsx(A,{}):e.jsxs(e.Fragment,{children:[e.jsxs(c,{className:"header-stats",children:["موجودی جوجه ریزی (مانده در سالن) بر اساس بازه سنی",(C()==="ProvinceOperator"||C()==="SuperAdmin")&&e.jsx("a",{href:`${r}hatching_age_range_excel/`,children:e.jsx(F,{children:"دانلود اکسل"})})]}),e.jsx(N,{style:{direction:"ltr"},data:d,options:n})]})})};L.font.family="iranyekan";console.log(E);const xe=({province:r})=>{var h;const[u,i]=a.useState([]),[x,l]=a.useState(!0),{authToken:s}=y(t=>t.userSlice);a.useEffect(()=>{fetch(`${r}single_hatching_age_range/?role=${C()}`,{headers:{Authorization:`Bearer ${s}`}}).then(t=>t.json()).then(t=>{i(t),l(!1)}).catch(t=>{console.error("Error fetching data:",t),l(!1)})},[r]);const d={labels:(h=u==null?void 0:u.filter(t=>t==null?void 0:t.quantity))==null?void 0:h.map(t=>t==null?void 0:t.type),datasets:[{label:"تعداد جوجه ریزی",data:u.filter(t=>t==null?void 0:t.quantity).map(t=>t==null?void 0:t.quantity),backgroundColor:"rgba(9, 132, 227,0.3)",borderColor:"rgba(9, 132, 227,1.0)",borderWidth:1}]},n={scales:{y:{beginAtZero:!0}},plugins:{rtl:!0}};return e.jsx(e.Fragment,{children:x?e.jsx(A,{}):e.jsxs(e.Fragment,{children:[e.jsxs(c,{className:"header-stats",children:["موجودی جوجه ریزی (مانده در سالن) بر اساس سن",(C()==="ProvinceOperator"||C()==="SuperAdmin")&&e.jsx("a",{href:`${r}single_hatching_age_range_excel/`,children:e.jsx(F,{children:"دانلود اکسل"})})]}),e.jsx(N,{style:{direction:"ltr"},data:d,options:n})]})})};L.font.family="iranyekan";console.log(E);const ge=({province:r})=>{const[u,i]=a.useState([]),[x,l]=a.useState(!1),{authToken:s}=y(m=>m.userSlice),d=y(m=>m.userSlice.userProfile.key),n=new Date,h=Y(new Date(n),"M"),[t,j]=a.useState(h),_=m=>{j(m.target.value)},o={labels:u.map(m=>m.city),datasets:[{data:u.map(m=>m.percent),quantity:u.map(m=>m.quantity),backgroundColor:["#FF6384","#36A2EB","#FFCE56","#4CAF50","#9C27B0"]}]};a.useEffect(()=>{fetch(`${r}doughnut_hatching/?month=${t}&role=${C()}`,{headers:{Authorization:`Bearer ${s}`}}).then(m=>m.json()).then(m=>{i(m),l(!1)}).catch(m=>{console.error("Error fetching data:",m),l(!1)})},[t,r]);const p={plugins:{legend:{display:!0,position:"bottom"},tooltip:{callbacks:{label:m=>{const b=m.label||"",D=m.formattedValue,w=m.dataset.quantity[m.dataIndex];return`${b}: %${D} - ${w==null?void 0:w.toLocaleString()} قطعه`}}},datalabels:{color:"#fff",formatter:(m,b)=>`${`${b.chart.data.labels[b.dataIndex]}: ٪${m}`}`}}},f=["فروردین","اردیبهشت","خرداد","تیر","مرداد","شهریور","مهر","آبان","آذر","دی","بهمن","اسفند"];return e.jsx(e.Fragment,{children:x?e.jsx(A,{}):e.jsxs(e.Fragment,{children:[e.jsx(c,{className:"header-stats",children:e.jsxs(g,{container:!0,alignItems:"center",gap:2,justifyContent:"center",children:["گزارش کل جوجه ریزی بر اساس شهرستان",e.jsx(q,{style:{width:"120px"},children:e.jsx(T,{value:t,onChange:_,children:f.map((m,b)=>e.jsx(v,{value:b+1,children:m},b))})}),e.jsx(R,{title:"خروجی اکسل",children:e.jsx("a",{href:`${r}doughnut_hatching_excel/?role=${C()}&key=${d}&token=${s}`,rel:"noreferrer",children:e.jsx(F,{color:"success",children:e.jsx(G,{size:32})})})})]})}),e.jsx("div",{style:{height:"400px",width:"600px",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"},children:e.jsx(H,{data:o,options:p,style:{direction:"ltr"}})})]})})};E.register(oe);L.font.family="iranyekan";console.log(E);const me=({province:r})=>{const[u,i]=a.useState([]),[x,l]=a.useState(!1),{authToken:s}=y(f=>f.userSlice),d=new Date,n=Y(new Date(d),"M"),[h,t]=a.useState(n),j=f=>{t(f.target.value)},_=["فروردین","اردیبهشت","خرداد","تیر","مرداد","شهریور","مهر","آبان","آذر","دی","بهمن","اسفند"],o={labels:u.filter(f=>f.percent).map(f=>f.city),datasets:[{label:"جوجه ریزی",data:u.filter(f=>f.percent).map(f=>f.percent),quantity:u.map(f=>f.quantity),backgroundColor:["#FF6384","#36A2EB","#FFCE56","#4CAF50","#9C27B0"]}]};a.useEffect(()=>{fetch(`${r}doughnut_left_hatching/?month=${h}&role=${C()}`,{headers:{Authorization:`Bearer ${s}`}}).then(f=>f.json()).then(f=>{i(f),l(!1)}).catch(f=>{console.error("Error fetching data:",f),l(!1)})},[h,r]);const p={plugins:{legend:{display:!0,position:"bottom"},tooltip:{callbacks:{label:f=>{const m=f.label||"",b=f.formattedValue,D=f.dataset.quantity[f.dataIndex];return`${m}: %${b} - ${D==null?void 0:D.toLocaleString()} قطعه`}}},datalabels:{color:"#fff",formatter:(f,m)=>`${`${m.chart.data.labels[m.dataIndex]}: ٪${f}`}`}}};return e.jsx(e.Fragment,{children:x?e.jsx(A,{}):e.jsxs(e.Fragment,{children:[e.jsx(c,{className:"header-stats",children:e.jsxs(g,{container:!0,alignItems:"center",gap:2,justifyContent:"center",children:["گزارش مانده جوجه ریزی بر اساس شهرستان",e.jsx(q,{style:{width:"120px"},children:e.jsx(T,{value:h,onChange:j,children:_.map((f,m)=>e.jsx(v,{value:m+1,children:f},m))})}),e.jsx(R,{title:"خروجی اکسل",children:e.jsx("a",{href:`${r}doughnut_left_hatching_excel/?month=${h}&token=${s}`,rel:"noreferrer",children:e.jsx(F,{color:"success",children:e.jsx(G,{size:32})})})})]})}),e.jsx("div",{style:{height:"400px",width:"600px",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"},children:e.jsx(H,{data:o,options:p,style:{direction:"ltr"}})})]})})},fe=({province:r})=>{var d,n,h,t;const[u,i]=a.useState([]),[x,l]=a.useState(!1),{authToken:s}=y(j=>j.userSlice);return a.useEffect(()=>{fetch(`${r}total_poultry_request_dashboard/?role=${C()}`,{headers:{Authorization:`Bearer ${s}`}}).then(j=>j.json()).then(j=>{i(j),l(!1)}).catch(j=>{console.error("Error fetching data:",j),l(!1)})},[r]),e.jsx(e.Fragment,{children:x?e.jsx(A,{}):e.jsxs(g,{container:!0,direction:"column",justifyContent:"center",alignItems:"center",children:[e.jsx(c,{my:2,fontWeight:"bold",children:"درخواست های کشتار"}),e.jsxs(g,{container:!0,direction:"column",alignItems:"start",children:[e.jsxs(c,{color:"primary",variant:"body2",mb:1,children:["کل درخواست ها:"," ",(d=u==null?void 0:u.total_poultry_request_quantity)==null?void 0:d.toLocaleString()," قطعه"]}),e.jsxs(c,{color:"primary",variant:"body2",mb:1,children:["تایید شده:"," ",(n=u==null?void 0:u.accepted_poultry_request_quantity)==null?void 0:n.toLocaleString()," قطعه"]}),e.jsxs(c,{color:"primary",variant:"body2",mb:1,children:["کل بارها:"," ",(h=u==null?void 0:u.total_kill_house_request_quantity)==null?void 0:h.toLocaleString()," قطعه"]}),e.jsxs(c,{color:"primary",variant:"body2",mb:1,children:["تخلیه شده:"," ",(t=u==null?void 0:u.accepted_kill_house_request_quantity)==null?void 0:t.toLocaleString()," ","قطعه"]})]})]})})};L.font.family="iranyekan";console.log(E);const je=({province:r})=>{const[u,i]=a.useState([]),[x,l]=a.useState(!0),{authToken:s}=y(o=>o.userSlice),d=y(o=>o.userSlice.userProfile.key),[n,h]=a.useState(10),t=o=>{h(o.target.value)};a.useEffect(()=>{fetch(`${r}number_of_kills/?day=${n}&role=${C()}`,{headers:{Authorization:`Bearer ${s}`}}).then(o=>o.json()).then(o=>{i(o),l(!1)}).catch(o=>{console.error("Error fetching data:",o),l(!1)})},[n,r]);const j={labels:u.map(o=>B(o.date)),datasets:[{label:"تعداد کشتار",data:u.map(o=>o.quantity),backgroundColor:"rgba(75,192,192,0.2)",borderColor:"rgba(75,192,192,1)",borderWidth:1}]},_={scales:{y:{beginAtZero:!0}},plugins:{rtl:!0}};return e.jsx(e.Fragment,{children:x?e.jsx(A,{}):e.jsxs(e.Fragment,{children:[e.jsxs(g,{container:!0,className:"header-stats",alignItems:"center",justifyContent:"center",gap:1,children:[e.jsx(c,{children:"گزارش تعداد کشتار"}),e.jsx(g,{children:e.jsx(q,{variant:"outlined",children:e.jsxs(T,{value:n,onChange:t,children:[e.jsx(v,{value:"10",children:"10"}),e.jsx(v,{value:"20",children:"20"}),e.jsx(v,{value:"30",children:"30"}),e.jsx(v,{value:"45",children:"45"})]})})}),e.jsx(c,{children:"روز گذشته (براساس بار)"}),e.jsx("a",{href:`${r}number_of_kills_excel/?day=${n}&role=${C()}&key=${d}`,children:e.jsx(F,{children:"دانلود اکسل"})})]}),e.jsx(U,{style:{direction:"ltr"},data:j,options:_})]})})},pe=({province:r})=>{var d;const[u,i]=a.useState([]),[x,l]=a.useState(!1),{authToken:s}=y(n=>n.userSlice);return a.useEffect(()=>{fetch(`${r}total_pricing_dashboard/`,{headers:{Authorization:`Bearer ${s}`}}).then(n=>n.json()).then(n=>{i(n),l(!1)}).catch(n=>{console.error("Error fetching data:",n),l(!1)})},[r]),e.jsx(e.Fragment,{children:x?e.jsx(A,{}):e.jsxs(g,{container:!0,direction:"column",justifyContent:"center",alignItems:"center",children:[e.jsx(c,{my:2,fontWeight:"bold",children:"قیمت روز مرغ"}),e.jsxs(g,{container:!0,direction:"column",alignItems:"start",children:[e.jsxs(c,{color:"primary",variant:"body2",mb:1,children:["آخرین قیمت: ",(d=u==null?void 0:u.last_price)==null?void 0:d.toLocaleString()," ﷼"]}),e.jsxs(c,{color:"primary",variant:"body2",mb:1,children:["تاریخ بروزرسانی: ",B(u==null?void 0:u.last_change)]})]})]})})};L.font.family="iranyekan";console.log(E);const Ce=({province:r})=>{const[u,i]=a.useState([]),[x,l]=a.useState(!0),{authToken:s}=y(o=>o.userSlice),d=y(o=>o.userSlice.userProfile.key),[n,h]=a.useState(10),t=o=>{h(o.target.value)};a.useEffect(()=>{fetch(`${r}number_of_kills_weight/?day=${n}&role=${C()}`,{headers:{Authorization:`Bearer ${s}`}}).then(o=>o.json()).then(o=>{i(o),l(!1)}).catch(o=>{console.error("Error fetching data:",o),l(!1)})},[n,r]);const j={labels:u.map(o=>B(o.date)),datasets:[{label:"وزن کشتار",data:u.map(o=>o.weight),backgroundColor:"rgba(75,192,192,0.2)",borderColor:"rgba(75,192,192,1)",borderWidth:1}]},_={scales:{y:{beginAtZero:!0}},plugins:{rtl:!0}};return e.jsx(e.Fragment,{children:x?e.jsx(A,{}):e.jsxs(e.Fragment,{children:[e.jsxs(g,{container:!0,alignItems:"center",justifyContent:"center",gap:1,className:"header-stats",children:[e.jsx(c,{children:"گزارش وزن کشتار"}),e.jsx(g,{children:e.jsx(q,{variant:"outlined",children:e.jsxs(T,{value:n,onChange:t,children:[e.jsx(v,{value:"10",children:"10"}),e.jsx(v,{value:"20",children:"20"}),e.jsx(v,{value:"30",children:"30"}),e.jsx(v,{value:"45",children:"45"})]})})}),e.jsx(c,{children:"روز گذشته (براساس بار)"}),e.jsx("a",{href:`${r}number_of_kills_weight_excel/?day=${n}&role=${C()}&key=${d}`,children:e.jsx(F,{children:"دانلود اکسل"})})]}),e.jsx(U,{style:{direction:"ltr"},data:j,options:_})]})})},ye=({province:r})=>{var d,n,h,t;const[u,i]=a.useState([]),[x,l]=a.useState(!1),{authToken:s}=y(j=>j.userSlice);return a.useEffect(()=>{fetch(`${r}total_file_poultry_request_dashboard/?role=${C()}`,{headers:{Authorization:`Bearer ${s}`}}).then(j=>j.json()).then(j=>{i(j),l(!1)}).catch(j=>{console.error("Error fetching data:",j),l(!1)})},[r]),e.jsx(e.Fragment,{children:x?e.jsx(A,{}):e.jsxs(g,{container:!0,direction:"column",justifyContent:"center",alignItems:"center",children:[e.jsx(c,{my:2,fontWeight:"bold",children:"پرونده های کشتار"}),e.jsxs(g,{container:!0,direction:"column",alignItems:"start",children:[e.jsxs(c,{color:"primary",variant:"body2",mb:1,children:["کل پرونده ها:"," ",(d=u==null?void 0:u.total_poultry_request_quantity)==null?void 0:d.toLocaleString()]}),e.jsxs(c,{color:"primary",variant:"body2",mb:1,children:["تایید شده:"," ",(n=u==null?void 0:u.accepted_poultry_request_quantity)==null?void 0:n.toLocaleString()]}),e.jsxs(c,{color:"primary",variant:"body2",mb:1,children:["رد شده:"," ",(h=u==null?void 0:u.rejected_poultry_request_quantity)==null?void 0:h.toLocaleString()]}),e.jsxs(c,{color:"primary",variant:"body2",mb:1,children:["بایگانی شده:"," ",(t=u==null?void 0:u.archive_poultry_request_quantity)==null?void 0:t.toLocaleString()]})]})]})})},_e=({province:r})=>{var d,n,h;const[u,i]=a.useState([]),[x,l]=a.useState(!0),{authToken:s}=y(t=>t.userSlice);return a.useEffect(()=>{fetch(`${r}poultry_request_killing_process/?role=${C()}`,{headers:{Authorization:`Bearer ${s}`}}).then(t=>t.json()).then(t=>{i(t),l(!1)}).catch(t=>{console.error("Error fetching data:",t),l(!1)})},[]),e.jsx(e.Fragment,{children:x?e.jsx(A,{}):e.jsxs(g,{container:!0,direction:"column",className:"stats-wrap",children:[e.jsx(c,{my:2,className:"stats-title",fontWeight:"bold",children:"درخواست کشتار"}),e.jsxs(g,{container:!0,className:"stats-content",direction:"column",alignItems:"start",children:[e.jsxs(c,{children:["تعداد مرغدار: ",(d=u==null?void 0:u.poultry_quantity)==null?void 0:d.toLocaleString()," فارم"]}),e.jsxs(c,{children:["تعداد: ",(n=u==null?void 0:u.poultry_request_quantity)==null?void 0:n.toLocaleString()," قطعه"]}),e.jsxs(c,{children:["وزن : ",(h=u==null?void 0:u.poultry_request_index_weight)==null?void 0:h.toLocaleString()," ","کیلوگرم"]}),e.jsx("a",{href:`${r}total_poultry_request_dashboard_excel/`,target:"_blank",rel:"noreferrer",style:{width:"100%"},children:e.jsx(F,{fullWidth:!0,variant:"outlined",style:{marginTop:"10px"},children:"دانلود اکسل"})})]})]})})},Ae=({province:r})=>{var d,n,h;const[u,i]=a.useState([]),[x,l]=a.useState(!0),{authToken:s}=y(t=>t.userSlice);return a.useEffect(()=>{fetch(`${r}province_kill_request_killing_process/?role=${C()}`,{headers:{Authorization:`Bearer ${s}`}}).then(t=>t.json()).then(t=>{i(t),l(!1)}).catch(t=>{console.error("Error fetching data:",t),l(!1)})},[]),e.jsx(e.Fragment,{children:x?e.jsx(A,{}):e.jsxs(g,{container:!0,direction:"column",className:"stats-wrap",children:[e.jsx(c,{my:2,className:"stats-title",fontWeight:"bold",children:"تخصیصات"}),e.jsxs(g,{container:!0,className:"stats-content",direction:"column",alignItems:"start",children:[e.jsxs(c,{children:["تعداد کشتارگاه: ",(d=u==null?void 0:u.kill_house_quantity)==null?void 0:d.toLocaleString()," واحد"]}),e.jsxs(c,{children:["تعداد: ",(n=u==null?void 0:u.province_kill_request_quantity)==null?void 0:n.toLocaleString()," ","قطعه"]}),e.jsxs(c,{children:["وزن : ",(h=u==null?void 0:u.province_kill_request_index_weight)==null?void 0:h.toLocaleString()," ","کیلوگرم"]}),e.jsx("a",{href:`${r}allocated_excel/`,style:{width:"100%"},children:e.jsx(F,{fullWidth:!0,variant:"outlined",style:{marginTop:"10px"},children:"دانلود اکسل"})})]})]})})},be=({province:r})=>{var d,n,h;const[u,i]=a.useState([]),[x,l]=a.useState(!0),{authToken:s}=y(t=>t.userSlice);return a.useEffect(()=>{fetch(`${r}kill_house__request_vetfarm_killing_process/?role=${C()}`,{headers:{Authorization:`Bearer ${s}`}}).then(t=>t.json()).then(t=>{i(t),l(!1)}).catch(t=>{console.error("Error fetching data:",t),l(!1)})},[]),e.jsx(e.Fragment,{children:x?e.jsx(A,{}):e.jsxs(g,{container:!0,direction:"column",className:"stats-wrap",children:[e.jsx(c,{my:2,className:"stats-title",fontWeight:"bold",children:"مسئول فنی مزرعه"}),e.jsxs(g,{container:!0,className:"stats-content",direction:"column",alignItems:"start",children:[e.jsxs(c,{children:["کد قرنطینه: ",(d=u==null?void 0:u.clearance_code_counter)==null?void 0:d.toLocaleString()," بار"]}),e.jsxs(c,{children:["تعداد: ",(n=u==null?void 0:u.kill_house_quantity)==null?void 0:n.toLocaleString()," قطعه"]}),e.jsxs(c,{children:["وزن : ",(h=u==null?void 0:u.kill_house_request_weight)==null?void 0:h.toLocaleString()," کیلوگرم"]}),e.jsx(F,{fullWidth:!0,variant:"outlined",style:{marginTop:"10px"},children:"دانلود اکسل"})]})]})})},Fe=({province:r})=>{var d,n,h;const[u,i]=a.useState([]),[x,l]=a.useState(!0),{authToken:s}=y(t=>t.userSlice);return a.useEffect(()=>{fetch(`${r}kill_house__request_vet_killing_process/?role=${C()}`,{headers:{Authorization:`Bearer ${s}`}}).then(t=>t.json()).then(t=>{i(t),l(!1)}).catch(t=>{console.error("Error fetching data:",t),l(!1)})},[]),e.jsx(e.Fragment,{children:x?e.jsx(A,{}):e.jsxs(g,{container:!0,direction:"column",className:"stats-wrap",children:[e.jsx(c,{my:2,className:"stats-title",fontWeight:"bold",children:"کشتارگاه"}),e.jsxs(g,{container:!0,className:"stats-content",direction:"column",alignItems:"start",children:[e.jsxs(c,{children:["بار تخلیه شده: ",(d=u==null?void 0:u.vet_check_counter)==null?void 0:d.toLocaleString()," بار"]}),e.jsxs(c,{children:["تعداد: ",(n=u==null?void 0:u.kill_house_quantity)==null?void 0:n.toLocaleString()," قطعه"]}),e.jsxs(c,{children:["وزن : ",(h=u==null?void 0:u.kill_house_request_weight)==null?void 0:h.toLocaleString()," کیلوگرم"]}),e.jsx(F,{fullWidth:!0,variant:"outlined",style:{marginTop:"10px"},children:"دانلود اکسل"})]})]})})},Se=re({startDate:P().required("تاریخ شروع الزامی است"),endDate:P().required("تاریخ پایان الزامی است"),textInput:se().required("سن الزامی است")}),ve=({province:r})=>{const u=ae(),[i,x]=a.useState([]),[l,s]=a.useState(!0),{authToken:d}=y(p=>p.userSlice),n=()=>{u(te()),fetch(`${r}forecast_hatching_left_over/?date1=${k(o.values.startDate).format("YYYY-MM-DD")}&date2=${k(o.values.endDate).format("YYYY-MM-DD")}&age=${o.values.textInput}&role=${C()}`,{headers:{Authorization:`Bearer ${d}`}}).then(p=>p.json()).then(p=>{x(p),s(!1),u(z())}).catch(p=>{console.error("Error fetching data:",p),s(!1),u(z())})};a.useEffect(()=>{n()},[r]);const h={labels:i.map(p=>B(p.date)),datasets:[{label:"تعداد جوجه ریزی",data:i.map(p=>p.hatching_left_over),backgroundColor:"rgba(75,192,192,0.2)",borderColor:"rgba(75,192,192,1)",borderWidth:1}]},t={scales:{y:{beginAtZero:!0}},plugins:{rtl:!0}},j=new Date,_=ue(j,1),o=V({initialValues:{startDate:j,endDate:_,textInput:"45"},validationSchema:Se,onSubmit:p=>{n()}});return e.jsxs(g,{container:!0,direction:"column",children:[e.jsxs(g,{container:!0,justifyContent:"center",alignItems:"center",width:"100%",className:"header-stats",p:1,children:[e.jsx(c,{children:"جوجه ریزی مانده در سالن براساس بازه زمانی و سن (تلفات پیش فرض 10٪)"}),e.jsx("form",{onSubmit:o.handleSubmit,children:e.jsxs(g,{container:!0,direction:"row",alignItems:"center",gap:2,children:[e.jsx(g,{children:e.jsx(M,{label:"از تاریخ",value:o.values.startDate,onChange:p=>o.setFieldValue("startDate",p),renderInput:p=>e.jsx(I,{...p,error:o.touched.startDate&&!!o.errors.startDate,helperText:o.touched.startDate&&o.errors.startDate})})}),e.jsx(g,{children:e.jsx(M,{label:"تا تاریخ",value:o.values.endDate,onChange:p=>o.setFieldValue("endDate",p),renderInput:p=>e.jsx(I,{...p,error:o.touched.endDate&&!!o.errors.endDate,helperText:o.touched.endDate&&o.errors.endDate})})}),e.jsx(g,{children:e.jsx(I,{name:"textInput",label:"سن",type:"number",fullWidth:!0,margin:"normal",value:o.values.textInput,onChange:o.handleChange,onBlur:o.handleBlur,error:o.touched.textInput&&!!o.errors.textInput,helperText:o.touched.textInput&&o.errors.textInput})}),e.jsx(g,{children:e.jsx(F,{type:"submit",size:"large",variant:"contained",color:"primary",children:"ارسال اطلاعات"})})]})})]}),e.jsx(g,{children:l?e.jsx(A,{}):e.jsx(N,{style:{direction:"ltr"},data:h,options:t})})]})};function K(r,u){return De(r)||$e(r,u)||ke(r,u)||Ee()}function De(r){if(Array.isArray(r))return r}function $e(r,u){var i=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(i!=null){var x=[],l=!0,s=!1,d,n;try{for(i=i.call(r);!(l=(d=i.next()).done)&&(x.push(d.value),!(u&&x.length===u));l=!0);}catch(h){s=!0,n=h}finally{try{!l&&i.return!=null&&i.return()}finally{if(s)throw n}}return x}}function ke(r,u){if(r){if(typeof r=="string")return O(r,u);var i=Object.prototype.toString.call(r).slice(8,-1);if(i==="Object"&&r.constructor&&(i=r.constructor.name),i==="Map"||i==="Set")return Array.from(r);if(i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return O(r,u)}}function O(r,u){(u==null||u>r.length)&&(u=r.length);for(var i=0,x=new Array(u);i<u;i++)x[i]=r[i];return x}function Ee(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var Le=function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=u.type,x=u.quality,l=a.useState(null),s=K(l,2),d=s[0],n=s[1],h=a.useState(null),t=K(h,2),j=t[0],_=t[1],o=function(f){if(!f)throw new Error("You should provide correct html node.");return le(f).then(function(m){var b=document.createElement("canvas"),D=b.getContext("2d"),w=0,Z=0,X=m.width,J=m.height;b.width=X,b.height=J,D.drawImage(m,Z,w);var W=b.toDataURL(i,x);return n(W),W}).catch(_)};return[d,o,{error:j}]};const we=({province:r})=>{const[u,i]=a.useState(k(new Date).format("YYYY-MM-DD")),[x,l]=a.useState(k(new Date).format("YYYY-MM-DD"));return a.useEffect(()=>{var s=k(u),d=s.add(7,"days").format("YYYY-MM-DD");l(d)},[u]),e.jsxs(g,{container:!0,alignItems:"center",gap:$.SMALL,children:[e.jsxs(g,{container:!0,alignItems:"center",gap:$.TINY,children:[e.jsx(c,{children:"روند کشتار بر اساس بازه"}),e.jsx(M,{label:"از تاریخ",id:"date",renderInput:s=>e.jsx(I,{style:{width:"160px"},...s}),value:u,onChange:s=>{i(k(s).format("YYYY-MM-DD"))}})," ",e.jsx(M,{label:"تا تاریخ",id:"date",disabled:!0,renderInput:s=>e.jsx(I,{style:{width:"160px"},...s}),value:x,onChange:s=>{l(k(s).format("YYYY-MM-DD"))}})]}),e.jsx("a",{href:`${r}killing_process_from_date_excel/?start=${u}&end=${x}`,rel:"noreferrer",children:e.jsx(F,{variant:"outlined",size:"large",children:"دانلود"})})]})},Ie=()=>[{name:"همدان",link:"https://habackend.rasadyar.com/"},{name:"مرکزی",link:"https://mabackend.rasadyar.com/"},{name:"بوشهر",link:"https://bubackend.rasadyar.com/"}],qe=({province:r})=>{var s,d,n;const[u,i]=a.useState([]),[x,l]=a.useState(!0);return a.useEffect(()=>{fetch(`${r}steward_guilds_allocations_for_statistical_profile/?date=${ne(new Date).format("YYYY-MM-DD")}&?role=${C()}`,{}).then(h=>h.json()).then(h=>{i(h),l(!1)}).catch(h=>{console.error("Error fetching data:",h),l(!1)})},[r]),e.jsx(e.Fragment,{children:x?e.jsx(A,{}):e.jsxs(g,{container:!0,direction:"column",className:"stats-wrap",children:[e.jsx(c,{my:2,className:"stats-title",fontWeight:"bold",children:"توزیع لاشه"}),e.jsxs(g,{container:!0,className:"stats-content",direction:"column",alignItems:"start",children:[e.jsxs(c,{children:["تعداد واحد: ",(s=u==null?void 0:u.allocations)==null?void 0:s.toLocaleString()," بار"]}),e.jsxs(c,{children:["حجم لاشه: ",(d=u==null?void 0:u.real_number_of_carcasses)==null?void 0:d.toLocaleString()," قطعه"]}),e.jsxs(c,{children:["وزن لاشه : ",(n=u==null?void 0:u.real_weight_of_carcasses)==null?void 0:n.toLocaleString()," ","کیلوگرم"]}),e.jsx(F,{fullWidth:!0,variant:"outlined",style:{marginTop:"10px"},children:"دانلود اکسل"})]})]})})},Ve=()=>{const r=a.createRef(null),[u,i]=Le(),x=()=>i(r.current),l=y(n=>n.userSlice.userPath);a.useEffect(()=>{if(u){const n=document.createElement("a");n.href=u,n.setAttribute("download","report.png"),n.click()}},[u]);const s=V({initialValues:{province:l}});a.useEffect(()=>{s.validateForm()},[]);const d=window.innerWidth<=600;return e.jsxs(S,{style:{display:"flex",alignItems:"center",justifyContent:"center",marginTop:"10px",flexDirection:"column"},children:[e.jsxs(g,{style:{marginBottom:"10px"},container:!0,xs:10,mt:$.SMALL,justifyContent:"flex-end",children:[e.jsx(g,{xs:6,lg:2,md:4,sm:2,children:(C()==="Observatory"||C()==="AdminX")&&e.jsxs(q,{children:[e.jsx(Q,{id:"demo-simple-select-label",children:"انتخاب استان"}),e.jsx(T,{size:"small",displayEmpty:!0,labelId:"demo-simple-select-label",id:"province",value:s.values.province,error:s.touched.province?!!s.errors.province:null,onChange:n=>{s.setFieldValue("province",n.target.value)},onBlur:s.handleBlur,children:Ie().map(n=>e.jsx(v,{value:n.link,children:n.name},n.link))}),e.jsx(ee,{children:s.touched.province&&s.errors.province?s.errors.province:null})]})}),e.jsx(g,{xs:4,lg:2,md:4,sm:2,children:e.jsx(F,{startIcon:e.jsx(ie,{}),onClick:x,children:"دانلود آمار"})})]}),e.jsxs(S,{ref:r,style:{display:"flex",alignItems:"center",justifyContent:"center",marginTop:"10px",paddingBottom:"50px",flexDirection:"column"},children:[e.jsx(S,{sx:{boxShadow:4,borderRadius:"20px",padding:"20px"},width:"80%",mt:$.SMALL,mb:$.SMALL,children:e.jsxs(g,{container:!0,xs:12,justifyContent:"space-between",children:[e.jsx(g,{xs:12,md:12,sm:12,lg:3,children:e.jsx(fe,{province:s.values.province})}),e.jsx(g,{xs:12,md:12,sm:12,lg:2,children:e.jsx(ye,{province:s.values.province})}),e.jsx(g,{xs:12,md:12,sm:12,lg:3,children:e.jsx(ce,{province:s.values.province})}),e.jsx(g,{xs:12,md:12,sm:12,lg:2,children:e.jsx(de,{province:s.values.province})}),e.jsx(g,{xs:12,md:12,sm:12,lg:2,children:e.jsx(pe,{province:s.values.province})})]})}),e.jsxs(S,{style:{width:"80%",display:"flex",justifyContent:"space-between",marginTop:"40px",flexDirection:"column",alignItems:"start"},children:[e.jsxs(g,{container:!0,width:"100%",justifyContent:"space-between",alignItems:"center",children:[e.jsxs(c,{children:["روند کشتار امروز مورخ ",Y(new Date,"yyyy/MM/dd")]}),e.jsx(we,{province:s.values.province})]}),e.jsxs(S,{mb:$.MEDIUM,gap:$.TINY,style:{display:"flex",justifyContent:"space-between",marginTop:"20px",width:"100%"},children:[e.jsx(_e,{province:s.values.province}),e.jsx(Ae,{province:s.values.province}),e.jsx(be,{province:s.values.province}),e.jsx(Fe,{province:s.values.province}),e.jsx(qe,{province:s.values.province})]})]}),e.jsxs(S,{style:{width:d?"40%":"80%",display:"flex",justifyContent:"space-between",flexDirection:"column",gap:$.MEDIUM},children:[e.jsx(he,{province:s.values.province}),e.jsx("br",{}),e.jsx(xe,{province:s.values.province})]}),e.jsxs(S,{style:{width:"80%",display:"flex",justifyContent:"space-between",marginTop:"40px"},children:[e.jsx(S,{style:{width:"48%"},children:e.jsx(ge,{province:s.values.province})}),e.jsx(S,{style:{width:"48%"},children:e.jsx(me,{province:s.values.province})})]}),e.jsxs(S,{style:{width:"80%",display:"flex",justifyContent:"space-between",marginTop:"40px"},children:[e.jsx(S,{style:{width:"48%"},children:e.jsx(je,{province:s.values.province})}),e.jsx(S,{style:{width:"48%"},children:e.jsx(Ce,{province:s.values.province})})]}),e.jsx(S,{style:{width:"80%",display:"flex",justifyContent:"space-between",marginTop:"40px"},children:e.jsx(ve,{province:s.values.province})})]})]})};export{Ve as default};