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

3 lines
30 KiB
JavaScript
Raw Permalink Normal View History

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-Cr86_nOs.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-Br3kJHkt.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:["موجودی جوجه <EFBFBD>
2026-01-19 15:40:45 +03:30
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:"f