2 lines
15 KiB
JavaScript
2 lines
15 KiB
JavaScript
import{j as e,T as M,ak as $,B as eu,I as U,aJ as ou,b as nu}from"./mui-vendor-CkIVaoQP.js";import{G as n,S as j,iP as z,iQ as k,iR as W,iS as B,iT as Q,iU as V,iV as m,A as tu,a9 as Y,p as y,W as N,j as P,X as q,N as lu,iW as G,iX as cu}from"./index-Cr86_nOs.js";import{N as D}from"./NavLink-D2GD_ItM.js";import{L as I}from"./LinkItem-Tk56BMy7.js";import{V as Cu,a as uu}from"./index.esm-CjWvmHks.js";import{a as pu}from"./index.esm-BVxcT1y_.js";import{a as du}from"./index.esm-YBNW__9r.js";import{c as iu,R as ru}from"./index.esm-Bu7XMDZU.js";import{u as wu}from"./index.esm-BY9chGNa.js";import{f as au,u as J,r as l}from"./react-vendor-CmFgShSM.js";import{d as H}from"./Plagiarism-DvlRWu4f.js";import{d as Au,C as fu,P as xu}from"./ProvinceFreeSales-CxTZ9QPc.js";import{P as su}from"./PageTable-whKVbv5q.js";import{u as hu}from"./redux-vendor-B7uoacJt.js";import{u as gu,A as ju}from"./AvicultureArchivedRequests-CmfkY5Ow.js";import{A as Fu}from"./AdvancedTable-BvRVoK6m.js";import{F as Eu}from"./FileInformation-fRM8Kqvl.js";import{R as yu,a as vu}from"./RequestsAwaitingInspections-D782YKR1.js";import{B as bu}from"./BackButton-7Uc4b2uz.js";import"./iconBase-BEJYyZsk.js";import"./useRequestFile-ByYalRZI.js";import"./index-D5z1lNNf.js";import"./LabelField-DYohZZRX.js";import"./aviculture-get-hatching-data-AN0s4-CK.js";import"./Delete-CTUmuli-.js";import"./Add-CdBsyA2e.js";import"./NumberFormatCustom-DwWPj40N.js";import"./DialogAlert-SqFkjSUs.js";import"./Done-DKABlQmU.js";import"./aviculture-get-unions---djX8PF.js";import"./CarPelak-Ddy5J5I5.js";import"./index-IuzvFnSU.js";import"./Close-C8iZ2Qr6.js";import"./Search-DLgMQCPC.js";import"./isValidIndexWeight-C_ik-uYa.js";import"./ResponsiveTable-Dua7tTwQ.js";import"./FilterAlt-RwhTl5ac.js";import"./styled-components.browser.esm-gS9mh05b.js";import"./Tune-m0V6JHJm.js";import"./Edit-DVocKJob.js";import"./VetFarmSubmitClearanceCode-BazH-e43.js";import"./Pageview-Dg_y1yOR.js";import"./ToggleOn-D04ugvmE.js";import"./ToggleOff-CR3_Rv22.js";import"./Check-CtJeUoc2.js";import"./Sms-C6ncfLc1.js";import"./SimpleTable-CWlU9uE0.js";const Su=()=>{const{pathname:o}=au();return e.jsx(n,{container:!0,gap:j.SMALL,p:j.SMALL,direction:{xs:"column",md:"row"},justifyContent:"center",style:{placeContent:"baseline"},children:e.jsx(n,{container:!0,direction:"column",style:{width:"100%"},children:e.jsxs(n,{container:!0,gap:j.SMALL,justifyContent:"center",children:[e.jsx(D,{to:z,active:o===z?"true":null,children:e.jsx(I,{icon:e.jsx(Cu,{size:30,color:"#244CCC"}),title:"درخواست های جدید",description:"درخواست های در انتظار بررسی"})}),e.jsx(D,{to:k,active:o===k?"true":null,children:e.jsx(I,{icon:e.jsx(uu,{size:30,color:"#244CCC"}),title:"درخواست های فعال",description:"مشاهده درخواست های در جریان"})}),e.jsx(D,{to:W,active:o===W?"true":null,children:e.jsx(I,{icon:e.jsx(pu,{size:30,color:"#244CCC"}),title:"در انتظار پرداخت",description:"مشاهده درخواست های در انتظار پرداخت کشتارگاه"})}),e.jsx(D,{to:B,active:o===B?"true":null,children:e.jsx(I,{icon:e.jsx(du,{className:"svg-icon-color",color:"#244CCC",size:30}),title:"در انتظار بازرسی",description:"درخواست های در انتظار بررسی بازرس"})}),e.jsx(D,{to:Q,active:o===Q?"true":null,children:e.jsx(I,{icon:e.jsx(iu,{className:"svg-icon-color",color:"#244CCC",size:30}),title:"درخواست های رد شده",description:"مشاهده درخواست هایی که به دلایل مختلف توسط اتحادیه رد شده است"})}),e.jsx(D,{to:V,active:o===V?"true":null,children:e.jsx(I,{icon:e.jsx(uu,{size:30,color:"#244CCC"}),title:"فروش خارج از استان"})}),e.jsx(D,{to:m,active:o===m?"true":null,children:e.jsx(I,{icon:e.jsx(wu,{className:"svg-icon-color",color:"#244CCC",size:30}),title:"بایگانی",description:"درخواست های پایان یافته"})})]})})})},Ru=()=>{const o=hu(),h=J(),[,,i,C,w,A]=l.useContext(tu);l.useEffect(()=>{const u=Y(new Date).format("YYYY-MM-DD");C(u),A(u)},[]);const[v,r]=l.useState([]),[p,d]=l.useState(!1),[F,g]=l.useState(0),[b,f]=l.useState(10),[x,O]=l.useState(""),S=u=>{O(u.target.value)},E=async(u,a)=>{d(!0);let c=await P.get(`Poultry_Request/?state=pending&date1=${i}&date2=${w}&search=filter&value=${a||""}&role=${q()}&page=${u}&page_size=${b}`);r(c.data.results),g(c.data.count),d(!1)},_=u=>{E(u,x)},R=async(u,a)=>{d(!0);let c=await P.get(`Poultry_Request/?state=pending&date1=${i}&date2=${w}&search=filter&value=${x||""}&page=${a}&page_size=${u}`);r(c.data.results),g(c.data.count),f(u),d(!1)};l.useEffect(()=>{E(1)},[i,w,b]);const T=async u=>{u.preventDefault(),d(!0);try{const a=await P.get(`Poultry_Request/?state=pending&date1=${i}&date2=${w}&role=${q()}&search=filter&value=${x||""}`);r(a.data.results),g(a.data.count)}catch(a){console.error("Error fetching data:",a)}finally{d(!1)}},t=()=>{E(1)},s=[{name:"کدسفارش",selector:u=>u==null?void 0:u.orderCode,sortable:!1,wrap:!0,allowOverflow:!0,center:!0,width:"90px"},{name:"تاریخ ثبت درخواست",selector:u=>y(u==null?void 0:u.createDate),sortable:!1,wrap:!0,allowOverflow:!0,center:!0,width:"90px"},{name:"نوع کشتار",selector:u=>u!=null&&u.freezing?"انجماد":u!=null&&u.export?"صادرات":"عادی",sortable:!0,wrap:!0,allowOverflow:!0,center:!0,width:"90px"},{name:"تاریخ کشتار",selector:u=>y(u==null?void 0:u.sendDate),sortable:!1,wrap:!0,allowOverflow:!0,center:!0,width:"90px"},{name:"مرغداری",selector:u=>{var a,c,L;return`${(a=u==null?void 0:u.poultry)==null?void 0:a.unitName} (${(L=(c=u==null?void 0:u.poultry)==null?void 0:c.user)==null?void 0:L.mobile})`},sortable:!1,wrap:!0,allowOverflow:!0,center:!0,width:"90px"},{name:"دامپزشک فارم",selector:u=>{var a,c;return`${(a=u==null?void 0:u.vetFarm)==null?void 0:a.vetFarmFullname} (${(c=u==null?void 0:u.vetFarm)==null?void 0:c.vetFarmMobile})`},sortable:!1,wrap:!0,allowOverflow:!0,center:!0,width:"90px"},{name:"استان/شهر",selector:u=>{var a,c,L,X,K,Z;return`${(L=(c=(a=u==null?void 0:u.poultry)==null?void 0:a.address)==null?void 0:c.province)==null?void 0:L.name}/${(Z=(K=(X=u==null?void 0:u.poultry)==null?void 0:X.address)==null?void 0:K.city)==null?void 0:Z.name}`},sortable:!1,wrap:!0,allowOverflow:!0,center:!0,width:"90px"},{name:"تعاونی",selector:u=>{var a;return(a=u==null?void 0:u.poultry)==null?void 0:a.cityOperator},sortable:!1,wrap:!0,allowOverflow:!0,center:!0,width:"90px"},{name:"تاریخ جوجه ریزی",selector:u=>{var a;return y((a=u==null?void 0:u.hatching)==null?void 0:a.hatchingDate)},sortable:!1,wrap:!0,allowOverflow:!0,center:!0,width:"90px"},{name:"سن",selector:u=>{var a;return(a=u==null?void 0:u.hatching)==null?void 0:a.age},sortable:!1,wrap:!0,allowOverflow:!0,center:!0,width:"90px"},{name:"میانگین وزن (کیلوگرم)",selector:u=>u==null?void 0:u.IndexWeight,sortable:!1,wrap:!0,allowOverflow:!0,center:!0,width:"90px"},{name:"تعداد (قطعه)",selector:u=>u==null?void 0:u.quantity,sortable:!1,wrap:!0,allowOverflow:!0,center:!0,width:"90px"},{name:"وزن بار (کیلوگرم)",selector:u=>((u==null?void 0:u.quantity)*(u==null?void 0:u.IndexWeight)).toLocaleString(),sortable:!1,wrap:!0,allowOverflow:!0,center:!0,width:"90px"},{name:"عملیات",selector:u=>e.jsx(U,{color:"primary",onClick:()=>o(lu({right:!(window.innerWidth<=600),bottom:window.innerWidth<=600,content:e.jsx(fu,{updateTable:t,id:u.id,file:u}),title:"انجام عملیات شهرستان"})),children:e.jsx(Au,{})}),sortable:!1,wrap:!0,allowOverflow:!0,center:!0},{name:"مشاهده",selector:u=>e.jsx(U,{"aria-label":"delete",color:"primary",onClick:()=>h(G+(u==null?void 0:u.id)),children:e.jsx(H,{})}),sortable:!1,wrap:!0,allowOverflow:!0,center:!0}];return e.jsx(e.Fragment,{children:e.jsx(n,{alignItems:"center",justifyContent:"center",mt:4,children:e.jsx(su,{title:e.jsx(n,{container:!0,alignItems:"center",justifyContent:"space-between",gap:2,paddingTop:2,mb:1,children:e.jsxs(n,{container:!0,alignItems:"center",gap:j.SMALL,children:[e.jsx(M,{children:"درخواست های جدید فروش اتحادیه"}),e.jsxs(n,{container:!0,gap:j.SMALL,children:[e.jsx(n,{children:e.jsx(N,{label:"از تاریخ",id:"date",renderInput:u=>e.jsx($,{style:{width:"160px"},...u}),value:i,onChange:u=>{C(Y(u).format("YYYY-MM-DD"))}})}),e.jsx(n,{children:e.jsx(N,{label:"تا تاریخ",id:"date",renderInput:u=>e.jsx($,{style:{width:"160px"},...u}),value:w,onChange:u=>{A(Y(u).format("YYYY-MM-DD"))}})})]}),e.jsxs("form",{onSubmit:T,children:[e.jsx($,{id:"outlined-basic",size:"small",label:"جستجو",variant:"outlined",style:{width:250},onChange:S}),e.jsx(eu,{type:"submit",onClick:T,endIcon:e.jsx(ru,{}),children:"جستجو"})]})]})}),columns:s,data:v,progressPending:p,pagination:!0,paginationServer:!0,paginationTotalRows:F,onChangeRowsPerPage:R,onChangePage:_})})})},Tu=()=>{const o=J(),[,,h,i,C,w]=l.useContext(tu);l.useEffect(()=>{const t=Y(new Date).format("YYYY-MM-DD");i(t),w(t)},[]);const[A,v]=l.useState([]),[r,p]=l.useState(!1),[d,F]=l.useState(0),[g,b]=l.useState(10),[f,x]=l.useState(""),O=t=>{x(t.target.value)},S=async(t,s)=>{p(!0);let u=await P.get(`Poultry_Request/?state=accepted&date1=${h}&date2=${C}&search=filter&value=${s||""}&role=${q()}&page=${t}&page_size=${g}`);v(u.data.results),F(u.data.count),p(!1)},E=t=>{S(t,f)},_=async(t,s)=>{p(!0);let u=await P.get(`Poultry_Request/?state=accepted&date1=${h}&date2=${C}&search=filter&value=${f||""}&page=${s}&page_size=${t}`);v(u.data.results),F(u.data.count),b(t),p(!1)};l.useEffect(()=>{S(1)},[h,C,g]);const R=async t=>{t.preventDefault(),p(!0);try{const s=await P.get(`Poultry_Request/?state=accepted&date1=${h}&date2=${C}&role=${q()}&search=filter&value=${f||""}`);v(s.data.results),F(s.data.count)}catch(s){console.error("Error fetching data:",s)}finally{p(!1)}},T=[{name:"ردیف",selector:(t,s)=>s+1,sortable:!1,wrap:!0,allowOverflow:!0,center:!0,width:"40px"},{name:"وضعیت",selector:t=>e.jsx(M,{variant:"body2",color:t.provinceState==="rejected"?"error":"promary",children:t.provinceState==="pending"?"درانتظار تایید استان":t.provinceState==="accepted"?"تایید شده توسط استان":"رد شده"}),sortable:!1,wrap:!0,allowOverflow:!0,center:!0},{name:"کدسفارش",selector:t=>t.orderCode,sortable:!1,wrap:!0,allowOverflow:!0,center:!0},{name:"تاریخ ثبت درخواست",selector:t=>y(t.createDate),sortable:!1,wrap:!0,allowOverflow:!0,center:!0},{name:"نوع کشتار",selector:t=>t!=null&&t.freezing?"انجماد":t!=null&&t.export?"صادرات":"عادی",sortable:!0,wrap:!0,allowOverflow:!0,center:!0,width:"80px"},{name:"تاریخ کشتار",selector:t=>y(t.sendDate),sortable:!1,wrap:!0,allowOverflow:!0,center:!0},{name:"مرغداری",selector:t=>{var s,u,a;return`${(s=t==null?void 0:t.poultry)==null?void 0:s.unitName} (${(a=(u=t==null?void 0:t.poultry)==null?void 0:u.user)==null?void 0:a.mobile})`},sortable:!1,wrap:!0,allowOverflow:!0,center:!0},{name:"شهر",selector:t=>{var s,u,a;return(a=(u=(s=t==null?void 0:t.poultry)==null?void 0:s.address)==null?void 0:u.city)==null?void 0:a.name},sortable:!1,wrap:!0,allowOverflow:!0,center:!0},{name:"استان",selector:t=>{var s,u,a;return(a=(u=(s=t==null?void 0:t.poultry)==null?void 0:s.address)==null?void 0:u.province)==null?void 0:a.name},sortable:!1,wrap:!0,allowOverflow:!0,center:!0},{name:"تاریخ جوجه ریزی",selector:t=>y(t.hatching.hatchingDate),sortable:!1,wrap:!0,allowOverflow:!0,center:!0},{name:"سن",selector:t=>t.hatching.age,sortable:!1,wrap:!0,allowOverflow:!0,center:!0},{name:"تعداد (قطعه)",selector:t=>t==null?void 0:t.quantity,sortable:!1,wrap:!0,allowOverflow:!0,center:!0},{name:"مشاهده",selector:t=>e.jsx(U,{"aria-label":"delete",color:"primary",onClick:()=>o(G+(t==null?void 0:t.id)),children:e.jsx(H,{})}),sortable:!1,wrap:!0,allowOverflow:!0,center:!0}];return e.jsx(e.Fragment,{children:e.jsx(n,{alignItems:"center",justifyContent:"center",mt:4,children:e.jsx(su,{title:e.jsx(n,{container:!0,alignItems:"center",justifyContent:"space-between",gap:2,paddingTop:2,mb:1,children:e.jsxs(n,{container:!0,alignItems:"center",gap:j.SMALL,children:[e.jsx(M,{children:"درخواست های فعال"}),e.jsxs(n,{container:!0,gap:j.SMALL,children:[e.jsx(n,{children:e.jsx(N,{label:"از تاریخ",id:"date",renderInput:t=>e.jsx($,{style:{width:"160px"},...t}),value:h,onChange:t=>{i(Y(t).format("YYYY-MM-DD"))}})}),e.jsx(n,{children:e.jsx(N,{label:"تا تاریخ",id:"date",renderInput:t=>e.jsx($,{style:{width:"160px"},...t}),value:C,onChange:t=>{w(Y(t).format("YYYY-MM-DD"))}})})]}),e.jsxs("form",{onSubmit:R,children:[e.jsx($,{id:"outlined-basic",size:"small",label:"جستجو",variant:"outlined",style:{width:250},onChange:O}),e.jsx(eu,{type:"submit",onClick:R,endIcon:e.jsx(ru,{}),children:"جستجو"})]})]})}),columns:T,data:A,progressPending:r,pagination:!0,paginationServer:!0,paginationTotalRows:d,onChangeRowsPerPage:_,onChangePage:E})})})},Du=()=>{const o=J(),[h,i]=l.useState([]),C=gu();l.useEffect(()=>{const A=C==null?void 0:C.filter((r,p)=>r.stateProcess==="rejected"),v=A==null?void 0:A.map((r,p)=>{var d,F,g,b,f,x,O,S,E,_,R,T;return[p+1,r.orderCode,y(r==null?void 0:r.createDate),y(r==null?void 0:r.sendDate),(F=(d=r==null?void 0:r.process)==null?void 0:d.poultry)==null?void 0:F.poultryName,(b=(g=r==null?void 0:r.process)==null?void 0:g.poultry)==null?void 0:b.poultryMobile,(x=(f=r==null?void 0:r.process)==null?void 0:f.poultry)==null?void 0:x.poultryCity,(S=(O=r==null?void 0:r.process)==null?void 0:O.poultry)==null?void 0:S.poultryProvince,(_=(E=r==null?void 0:r.process)==null?void 0:E.poultry)==null?void 0:_.age,(T=(R=r==null?void 0:r.process)==null?void 0:R.poultry)==null?void 0:T.poultryQuantity,e.jsx(U,{"aria-label":"delete",color:"primary",onClick:()=>{var t,s;return o(G+((s=(t=r==null?void 0:r.process)==null?void 0:t.poultry)==null?void 0:s.poultryRequestId))},children:e.jsx(H,{})},p)]});i(v)},[]);const[w]=l.useState(["ردیف","کد سفارش","تاریخ ثبت درخواست","تاریخ درخواست","مرغدار","تلفن مرغدار","شهر","استان","سن مرغ","تعداد","مشاهده"]);return e.jsx(ou,{children:e.jsx(Fu,{expandable:!0,name:"درخواست های رد شده",columns:w,expandedComponentHandler:A=>e.jsx(Eu,{id:A[0]}),data:h})})},y0=()=>{const{pathname:o}=au();return e.jsx(e.Fragment,{children:e.jsx(nu,{display:"flex",justifyContent:"center",children:e.jsxs(n,{container:!0,direction:"column",justifyContent:"center",xs:12,sm:12,md:10,lg:10,children:[o===cu?e.jsxs(n,{justifyContent:"center",my:j.MEDIUM,children:[e.jsx(n,{children:e.jsx(M,{variant:"h6",children:"صفحه مدیریت درخواست ها (شهرستان)"})}),e.jsx(Su,{})]}):e.jsx(bu,{}),e.jsx(n,{container:!0,justifyContent:"space-between",gap:j.SMALL,children:e.jsxs(n,{xs:12,children:[o===z&&e.jsx(Ru,{}),o===k&&e.jsx(Tu,{}),o===Q&&e.jsx(Du,{}),o===m&&e.jsx(ju,{}),o===W&&e.jsx(yu,{}),o===B&&e.jsx(vu,{}),o===V&&e.jsx(xu,{})]})})]})})})};export{y0 as default};
|