Files
Rasadyar_FrontEnd/build/assets/SlaughterShowProducts-C1xLq8AA.js

2 lines
5.4 KiB
JavaScript

import{i as w,j as u,d as k,I as M,ak as O,al as y,am as R,an as Y,B as $}from"./mui-vendor-D_SVL-Dx.js";import{r as T,G as l,a0 as p,O as m,ku as G,kQ as I,v as i,A as P,$ as _,C as N,j as U}from"./index-D80MdVQn.js";import{r as C,f as b}from"./react-vendor-CmFgShSM.js";import{f as x,u as W}from"./redux-vendor-CfkcHgWN.js";import{R as B}from"./ResponsiveTable-bUYl0qDM.js";import{d as H}from"./SystemUpdateAlt-QYMcO5S3.js";import{c as K}from"./checkPathStartsWith-DedybDvj.js";var S={},q=w;Object.defineProperty(S,"__esModule",{value:!0});var z=S.default=void 0,V=q(T()),Q=u;z=S.default=(0,V.default)((0,Q.jsx)("path",{d:"M9.64 7.64c.23-.5.36-1.05.36-1.64 0-2.21-1.79-4-4-4S2 3.79 2 6s1.79 4 4 4c.59 0 1.14-.13 1.64-.36L10 12l-2.36 2.36C7.14 14.13 6.59 14 6 14c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4c0-.59-.13-1.14-.36-1.64L12 14l7 7h3v-1zM6 8c-1.1 0-2-.89-2-2s.9-2 2-2 2 .89 2 2-.9 2-2 2m0 12c-1.1 0-2-.89-2-2s.9-2 2-2 2 .89 2 2-.9 2-2 2m6-7.5c-.28 0-.5-.22-.5-.5s.22-.5.5-.5.5.22.5.5-.22.5-.5.5M19 3l-6 6 2 2 7-7V3z"}),"ContentCut");const ru=()=>{const{slaughterProducts:n,distributionInfo:o}=x(a=>a.slaughterSlice),[r,h]=C.useState(),{pathname:A}=b(),d=W(),g=a=>{var e,s,t,c;return p()==="KillHouse"?[(e=a==null?void 0:a.totalGovernmentalCarcassesWeight)==null?void 0:e.toLocaleString(),(s=a==null?void 0:a.provinceFreeCarcassesWeight)==null?void 0:s.toLocaleString()]:[(t=a==null?void 0:a.receiveGovernmentalCarcassesWeight)==null?void 0:t.toLocaleString(),(c=a==null?void 0:a.receiveFreeCarcassesWeight)==null?void 0:c.toLocaleString()]};C.useEffect(()=>{const a=n==null?void 0:n.map((e,s)=>{var t,c,j,v,D,E,f,L;return[s+1,e==null?void 0:e.name,...g(e),(t=e==null?void 0:e.freeBuyingCarcassesWeight)==null?void 0:t.toLocaleString(),(c=e==null?void 0:e.totalCarcassesWeight)==null?void 0:c.toLocaleString(),(j=e==null?void 0:e.realAllocatedWeight)==null?void 0:j.toLocaleString(),(v=e==null?void 0:e.totalRemainWeight)==null?void 0:v.toLocaleString(),(D=o==null?void 0:o.totalGovernmentalRemainWeight)==null?void 0:D.toLocaleString(),(E=o==null?void 0:o.totalFreeRemainWeight)==null?void 0:E.toLocaleString(),(f=o==null?void 0:o.totalGovernmentalInputWeight)==null?void 0:f.toLocaleString(),(L=o==null?void 0:o.totalFreeInputWeight)==null?void 0:L.toLocaleString()]});h(a)},[n,o]);const F=()=>A===G||A===I?[]:["مانده دولتی (کیلوگرم)"," مانده آزاد (کیلوگرم)","وزن دولتی (کیلوگرم)","وزن آزاد (کیلوگرم)"];return u.jsx(l,{container:!0,xs:12,justifyContent:"center",alignItems:"center",children:u.jsx(B,{noPagination:(r==null?void 0:r.length)===1,paginated:!(r!=null&&r.length)===1,operation:u.jsx(l,{container:!0,children:p()==="KillHouse"&&u.jsx(k,{title:"خروجی اکسل",placement:"top",children:u.jsx(M,{color:"primary",onClick:()=>{d(m({title:"دریافت خروجی اکسل",content:u.jsx(J,{})}))},children:u.jsx(H,{})})})}),title:"موجودی انبار",columns:["ردیف","نام محصول","وزن خریدهای دولتی داخل استان (کیلوگرم)","وزن خریدهای آزاد داخل استان (کیلوگرم)","وزن خریدهای خارج استان (کیلوگرم)","کل ورودی به انبار (کیلوگرم)","کل فروش (کیلوگرم)","مانده انبار (کیلوگرم)",...F()],data:r,customColors:[{name:"ردیف",color:"red"},{name:"نام محصول",color:"red"},{name:"کل ورودی به انبار (کیلوگرم)",color:"red"},{name:"وزن خریدهای دولتی داخل استان (کیلوگرم)",color:"red"},{name:"وزن خریدهای آزاد داخل استان (کیلوگرم)",color:"red"},{name:"وزن خریدهای خارج استان (کیلوگرم)",color:"red"},{name:"کل فروش (کیلوگرم)",color:"red"},{name:"مانده انبار (کیلوگرم)",color:"green"}]})})},J=()=>{const[n,o]=C.useState("withdate"),r=x(t=>t.userSlice.selectedSubUser),h=t=>{o(t.target.value)},A=x(t=>t.userSlice.userProfile.key),[d,g]=C.useState(i(new Date).format("YYYY-MM-DD")),[F,a]=C.useState(i(new Date).format("YYYY-MM-DD")),e=W(),[s]=C.useContext(P);return u.jsxs(l,{container:!0,xs:12,justifyContent:"center",alignItems:"center",gap:2,children:[u.jsxs(O,{row:!0,"aria-labelledby":"radio-group-label",name:"radio-buttons-group",value:n,onChange:h,children:[u.jsx(y,{value:"withdate",control:u.jsx(R,{}),label:"دانلود بر اساس بازه"}),u.jsx(y,{value:"nodate",control:u.jsx(R,{}),label:"دانلود کلی"})]}),n==="withdate"&&u.jsxs(l,{container:!0,xs:12,justifyContent:"center",alignItems:"center",gap:2,children:[u.jsx(l,{children:u.jsx(_,{label:"از تاریخ",id:"date",renderInput:t=>u.jsx(Y,{style:{width:"160px"},...t}),value:d,onChange:t=>{g(i(t).format("YYYY-MM-DD"))}})}),u.jsx(l,{children:u.jsx(_,{label:"تا تاریخ",id:"date",renderInput:t=>u.jsx(Y,{style:{width:"160px"},...t}),value:F,onChange:t=>{a(i(t).format("YYYY-MM-DD"))}})})]}),u.jsx($,{fullWidth:!0,variant:"contained",onClick:()=>{e(N()),s({vertical:"top",horizontal:"center",msg:"فایل اکسل در حال دانلود می باشد، این علمیات ممکن است زمان بر باشد لطفا صبر کنید.",severity:"success"});const t=`${U.defaults.baseURL}kill_house_inventory_data/?role=${p()}${K("slaughter")?`&role_key=${r==null?void 0:r.key}`:""}&key=${A}${n==="withdate"?`&date1=${d}&date2=${F}`:""}`;window.location.href=t},children:"دانلود فایل اکسل"})]})};export{ru as S,z as d};