Files
Rasadyar_FrontEnd/build/assets/ChainCompany-CoIO96Tn.js

2 lines
12 KiB
JavaScript
Raw Permalink Normal View History

import{j as t,T as x,ak as W,B as w,d as S,ag as _,av as L,aw as E,ax as R,b as G}from"./mui-vendor-CkIVaoQP.js";import{r as s,f as V}from"./react-vendor-CmFgShSM.js";import{A as Y,j as a,X as c,G as l,S as f,_ as A,V as P,lm as X,ln as J}from"./index-Cr86_nOs.js";import{f as Z}from"./redux-vendor-B7uoacJt.js";import{R as uu,a as T}from"./index.esm-Bu7XMDZU.js";import{P as eu}from"./PageTable-whKVbv5q.js";import{a as tu}from"./ChainBarManagement-BrSz4Hwe.js";import"./iconBase-BEJYyZsk.js";import"./styled-components.browser.esm-gS9mh05b.js";import"./ResponsiveTable-Dua7tTwQ.js";import"./FilterAlt-RwhTl5ac.js";import"./Edit-DVocKJob.js";import"./Settings-BSDlStEO.js";import"./Tune-m0V6JHJm.js";import"./Delete-CTUmuli-.js";import"./CarPelak-Ddy5J5I5.js";import"./Pageview-Dg_y1yOR.js";import"./AddCircleOutline-CCVNHzAe.js";const ru=()=>{const[o,v]=s.useState(0),[C,F]=s.useState(0),[k,p]=s.useState([]),[M,n]=s.useState(!1),[N,h]=s.useState(0),[g,m]=s.useState(10),[d,z]=s.useState(""),I=Z(u=>u.userSlice.userProfile.key),K=u=>{z(u.target.value)};s.useEffect(()=>{$(1)},[]);const[b]=s.useContext(Y),y=u=>{let e="";return e=u.quantity-u.losses-u.leftOver,e},$=async(u,e)=>{n(!0);let r;e?r=await a.get(`poultry_hatching?search=filter&value=${e}&role=${c()}&page=${u}&page_size=${g}&chain=true`):o&&C?r=await a.get(`poultry_hatching?role=${c()}&age1=${o}&age2=${C}&page=${u}&page_size=${g}&chain=true`):r=await a.get(`poultry_hatching/?role=${c()}&page=${u}&page_size=${g}&chain=true`),p(r.data.results),h(r.data.count),n(!1)},D=u=>{$(u,d)},H=async(u,e)=>{n(!0);let r;d?r=await a.get(`poultry_hatching?search=filter&value=${d}&page=${e}&page_size=${u}&search=filter&value=${d}&chain=true`):o&&C?r=await a.get(`poultry_hatching?role=${c()}&age1=${o}&age2=${C}&page=${e}&page_size=${g}&chain=true`):r=await a.get(`poultry_hatching/?role=${c()}&page=${e}&page_size=${u}&chain=true`),p(r.data.results),h(r.data.count),m(u),n(!1)},j=async u=>{u.preventDefault(),n(!0);try{const e=await a.get(`poultry_hatching/?role=${c()}&search=filter&value=${d}&chain=true`);p(e.data.results),h(e.data.count)}catch(e){console.error("Error fetching data:",e)}finally{n(!1)}},B=async u=>{u.preventDefault(),v(null),F(null),n(!0);try{const e=await a.get(`poultry_hatching/?role=${c()}&chain=true&search=filter&value=`);p(e.data.results),h(e.data.count)}catch(e){console.error("Error fetching data:",e)}finally{n(!1)}},Q=async u=>{u.preventDefault(),n(!0);try{const e=await a.get(`poultry_hatching?role=${c()}&age1=${o}&age2=${C}&chain=true`);p(e.data.results),h(e.data.count)}catch(e){console.error("Error fetching data:",e)}finally{n(!1)}};let U=[{name:"ردیف",selector:(u,e)=>e+1,sortable:!1,wrap:!0,allowOverflow:!0,center:!0,width:"30px"},{name:"شرکت زنجیره",selector:(u,e)=>{var r,i;return`${(r=u==null?void 0:u.chainCompany)==null?void 0:r.name} (${(i=u==null?void 0:u.chainCompany)==null?void 0:i.user.mobile})`},sortable:!1,wrap:!0,allowOverflow:!0,center:!0,width:"80px"},{name:"وضعیت",selector:(u,e)=>t.jsx(x,{variant:"body2",color:u.violation?"error":"black",children:u.violation?"متخلف":"عادی"}),sortable:!1,wrap:!0,allowOverflow:!0,center:!0,width:"60px"},{name:"نام فارم",selector:u=>u.poultry.unitName,sortable:!0,wrap:!0,allowOverflow:!0,center:!0,width:"90px"},{name:"مرغدار",selector:u=>`${u.poultry.userprofile.fullName} (${u.poultry.userprofile.mobile})`,sortable:!0,wrap:!0,allowOverflow:!0,center:!0,width:"80px"},{name:"شهر/تعاونی",selector:u=>{var e,r,i;return`${(e=u==null?void 0:u.poultry)==null?void 0:e.address.city.name}/${(r=u==null?void 0:u.poultry)!=null&&r.cityOperator?(i=u==null?void 0:u.poultry)==null?void 0:i.cityOperator:"بدون تعاونی"}`},sortable:!0,wrap:!0,allowOverflow:!0,center:!0,width:"80px"},{name:"دامپزشک فارم",selector:u=>{var e,r,i;return(e=u==null?void 0:u.vetFarm)!=null&&e.vetFarmMobile?`${(r=u==null?void 0:u.vetFarm)==null?void 0:r.vetFarmFullName} (${(i=u==null?void 0:u.vetFarm)==null?void 0:i.vetFarmMobile})`:"-"},sortable:!0,wrap:!0,allowOverflow:!0,center:!0,width:"80px"},{name:"<EFBFBD>