Files
Rasadyar_FrontEnd/build/assets/SlaughterRequestsPage-BVWg-CD6.js
2026-01-19 16:15:09 +03:30

3 lines
130 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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 u,T as I,ao as W6,ap as e6,aq as t6,a3 as W,ag as wu,av as Ou,aw as qu,ax as Cu,ak as N,ai as I0,aX as M0,aU as Xu,B as G,d as Yu,I as ou,aJ as D0,p as vu,aO as r6,aP as n6,aQ as a6,aR as o6,aS as l6,aT as s6,am as N6,i as $6,al as Pu,b0 as i6,an as z6,b4 as K6,b as c6,b2 as d6,b3 as Zu,aA as U6,aa as V6}from"./mui-vendor-CkIVaoQP.js";import{A as Q,$ as G6,u as _u,c as fu,v as J,c2 as Q6,M as bu,b as Tu,X as xu,af as C6,L as cu,fl as h6,h as X,aZ as X6,S as k,Q as Bu,W as uu,j1 as p0,O as Iu,C as Ru,N as hu,a9 as Eu,p as iu,G as v,j2 as A0,j3 as f0,j4 as x0,j5 as g0,j6 as y0,j7 as v0,j8 as F0,j9 as B0,ey as Z6,ja as H0,jb as O0,jc as q0,jd as j0,g5 as Mu,g6 as Uu,a1 as J6,j as Su,m as ue,je as Ju,a5 as b0,n as w0,r as ee,jf as P0,jg as u0,t as p6,_ as A6,o as te,l as re,h$ as ne,i0 as ae,jh as oe,ji as E0,jj as f6,jk as x6,fn as c0,fm as le,jl as se,jm as ie,jn as ce,jo as de,jp as Ce,jq as he,jr as pe}from"./index-BHF9XhlR.js";import{d as o0}from"./Delete-BMbGwban.js";import{u as lu,f as Fu,a as Lu}from"./redux-vendor-B7uoacJt.js";import{r as p,f as g6,u as Vu,b as P,j as y6}from"./react-vendor-CmFgShSM.js";import{s as Ae,a as fe}from"./slaughter-new-request-DLPDxW9-.js";import{D as xe}from"./DialogAlert-DKhMdDI2.js";import{d as ge}from"./Done-CXPGvgsL.js";import{N as e0}from"./NumberFormatCustom-DwWPj40N.js";import{C as ye}from"./CustomCard-B-6dDbAN.js";import{R as Wu}from"./ResponsiveTable-cmj--TTX.js";import{N as ku}from"./NavLink-D2GD_ItM.js";import{L as Du}from"./LinkItem-B0NRrkKX.js";import{a as Y0,b as ve,d as Fe,e as je,f as be}from"./index.esm-BcDC8KuM.js";import{F as d0,v as Ee,d as Se}from"./index.esm-BY9chGNa.js";import{L as C0}from"./LineWithText-BpnpjRWf.js";import{a as ke}from"./index.esm-CjWvmHks.js";import{S as De}from"./SlaughterActiveRequests-Nv_YdEXx.js";import{A as Hu}from"./AdvancedTable-Bc9rwJrH.js";import{d as Nu}from"./Plagiarism-DQa3b2yK.js";import{d as $u}from"./Edit-DE-0ja3Q.js";import{A as we}from"./index-rXDbFGCK.js";import{d as v6}from"./PictureAsPdf-Cvt23rlE.js";import{l as _e}from"./ChickenLogo-BK6_Z2uq.js";import{d as W0,S as me}from"./SlaughterSellCarcass-CzkBnIKQ.js";import{a as Te,c as Re}from"./province-policy-get-slaughter-buying-price-status-JdZbZ6vD.js";import{d as F6}from"./Tune-rHyTJYQA.js";import{d as Le}from"./AddCircleOutline-CRCPZlAA.js";import{s as Ie}from"./SlaughterManageBars-CAcB76Qi.js";import{S as Me}from"./SlaghterEnterBarInfo-Dv7mM5A-.js";import{S as N0,s as Be}from"./SlaughterPayProvinceFactorForm-CIOvWYq1.js";import{S as $0}from"./SimpleTable-OFQqh0WK.js";import{B as He}from"./BackButton-C3p7AEJl.js";import{I as Oe,f as qe}from"./toBase64-UEKXUH-t.js";import{s as Pe,b as Ye,c as We,E as Ne,a as $e,P as ze}from"./EnterAuthCodeDirectBuy-BqAphWuG.js";import{R as Ke,a as Ue}from"./index.esm-Bu7XMDZU.js";import"./FilterAlt-C5yvLNoT.js";import"./styled-components.browser.esm-gS9mh05b.js";import"./iconBase-BEJYyZsk.js";import"./index-CV2Xug6a.js";import"./Close-Daz6UZes.js";import"./Search-D4DyWpQE.js";import"./SlaughterAllocateToGuild-Cby2dVLp.js";import"./slaughter-get-guilds-for-allocate-C8knIfiI.js";import"./province-policy-upload-image-5mb7pb-s.js";import"./LabelField-CY9emCr4.js";import"./SlaughterManageInventoryAllocationOperations-DwMu8HQu.js";import"./CheckCircleOutline-DQJcYWuR.js";import"./ShowImage-CIUzwOaR.js";import"./Download-Cvgxm3sz.js";import"./guild-allocated-stock-operation-CS9lfBf3.js";import"./getProvinceName-BujSmyBy.js";import"./Sms-B-2HP--h.js";import"./getAllocationType-76F45b0K.js";import"./SystemUpdateAlt-CyVYimcg.js";import"./resizeImage-Csf2MO3w.js";import"./VetFarmEditTrafficCode-5BQu9QAe.js";import"./isValidIndexWeight-C_ik-uYa.js";import"./SlaughterEnterNoneReciept-C0DQMtkh.js";import"./ReceiptLong-bKyUw9IL.js";import"./getDocumentStates-BIJJPFXZ.js";import"./FileUploader-D2gYZs7M.js";import"./CloudUpload-BmRtl-rF.js";import"./CheckCircle-DVOR8q2_.js";import"./Add-B14uoYzg.js";import"./PublishedWithChanges-DLwGJTcV.js";import"./DoneOutline-CT7FzDqR.js";import"./ThumbUpAlt-D5KcH6HI.js";import"./aviculture-get-hatching-data-BR9pqiDJ.js";import"./province-get-sell-for-freezing-status-3W-n3Zfh.js";import"./ProvinceSettlementPdfKillRequest-CWbm18ML.js";const Ve=()=>{var f,Y,H,_,a,C,L;const[e]=p.useContext(Q),t=lu(),[,r]=G6(),{profile:n,slaughterGetKillerKillhouses:i}=Fu(b=>b.slaughterSlice),[,,A,,h]=p.useContext(Q),o=_u({initialValues:{capacity:"",recieveTime:"",selectedKillhouse:"",selectedKillerKillhouse:"",race:"آرین",sellType:{cash:!0,haveTime:!1},weightType:{under2AndHalf:!1,over2AndHalf:!1},recieveDate:J(Date()).format("YYYY-MM-DD hh:mm:ss"),isAccepted:xu()==="ProvinceOperator",indexWeight:2.7},validationSchema:fu({capacity:Tu().required("این فیلد اجباری است!").typeError("لطفا عدد وارد کنید!"),selectedKillhouse:bu().required("این فیلد اجباری است!"),selectedKillerKillhouse:(f=n==null?void 0:n.killHouseOperator)!=null&&f.killer?bu().required("این فیلد اجباری است!"):bu(),recieveTime:bu().required("این فیلد اجباری است!").typeError("لطفا وزن را وارد کنید!"),sellType:fu().test("sellType","نحوه فروش را انتخاب کنید!",(b,g)=>g.originalValue&&Object.values(g.originalValue).some(D=>D===!0)).required("این فیلد اجباری است!"),isAccepted:Q6().test("req","باید تعهد نامه را بپذیرید!",(b,g)=>g.originalValue&&g.originalValue===!0).required("این فیلد اجباری است!")})}),c=o.values.capacity*1e3,y=u.jsxs(u.Fragment,{children:[u.jsxs(I,{variant:"body1",children:["اینجانب ",r.fullname," موافقت خود را نسبت به موارد ذکر شده اعلام می نمایم."]}),u.jsxs(W6,{children:[u.jsx(e6,{children:u.jsx(ge,{})}),u.jsx(t6,{primary:`بر اساس این توافق نامه در صورت لغو کشتار ${o.values.capacity} قطعه
مرغ ${c} ریال جریمه خواهم شد.`})]})]});p.useEffect(()=>{t(C6()),t(cu()),t(h6()).then(b=>{t(X())}),o.validateForm()},[]);const[d,s]=p.useState(!0),x=b=>{s(b.target.checked)},[l,E]=p.useState(!1),w=b=>{E(b.target.checked)},{provincePrices:T}=Fu(b=>b.provinceSlice),S=T!=null&&T.length?((H=(Y=T[0])==null?void 0:Y.liveChickenPrice)==null?void 0:H.toLocaleString())+" ﷼":"نامشخص",m=T!=null&&T.length?(_=T[0])==null?void 0:_.createDate:Date();return p.useEffect(()=>{t(X6())},[]),u.jsx(u.Fragment,{children:u.jsxs(W,{className:"slaughter-new-request-form",container:!0,gap:k.SMALL,direction:"column",flex:"1",justifyContent:"space-between",children:[u.jsx(ye,{title:"قیمت روز مرغ",value:S+" - "+Bu(new Date(m),"yyyy/MM/dd")}),u.jsxs(W,{container:!0,direction:"column",gap:k.SMALL,children:[u.jsxs(wu,{fullWidth:!0,error:o.errors.selectedOption&&o.touched.selectedOption,children:[u.jsxs(Ou,{children:[(a=n==null?void 0:n.killHouseOperator)!=null&&a.killer?"کشتارکن":"محل کشتار"," را انتخاب کنید"]}),u.jsx(qu,{label:"محل کشتار را انتخاب کنید",id:"selectedKillhouse",name:"selectedKillhouse",value:o.values.selectedKillhouse,onChange:o.handleChange,onBlur:o.handleBlur,children:(C=n==null?void 0:n.killHouse)==null?void 0:C.map(b=>u.jsx(Cu,{value:b.key,children:b.name},b))}),o.errors.selectedOption&&o.touched.selectedOption&&u.jsx("div",{children:o.errors.selectedOption})]}),((L=n==null?void 0:n.killHouseOperator)==null?void 0:L.killer)&&u.jsxs(wu,{fullWidth:!0,error:o.errors.selectedKillerKillhouse&&o.touched.selectedKillerKillhouse,children:[u.jsx(Ou,{children:"کشتارگاه را انتخاب کنید"}),u.jsx(qu,{label:"کشتارگاه را انتخاب کنید",id:"selectedKillerKillhouse",name:"selectedKillerKillhouse",value:o.values.selectedKillerKillhouse,onChange:o.handleChange,onBlur:o.handleBlur,children:i==null?void 0:i.map(b=>u.jsx(Cu,{value:b.key,children:b.name},b))}),o.errors.selectedKillerKillhouse&&o.touched.selectedKillerKillhouse&&u.jsx("div",{children:o.errors.selectedKillerKillhouse})]}),u.jsx(W,{children:u.jsx(e0,{allowLeadingZeros:!0,thousandSeparator:",",id:"capacity",fullWidth:!0,label:"حجم کشتار را در روز به قطعه وارد کنید",variant:"outlined",value:o.values.capacity,error:o.touched.capacity?!!o.errors.capacity:null,onChange:o.handleChange,onBlur:o.handleBlur,helperText:o.touched.capacity&&o.errors.capacity?o.errors.capacity:null})}),u.jsx(W,{children:u.jsxs(wu,{fullWidth:!0,sx:{minWidth:210},children:[u.jsx(Ou,{children:"بازه زمانی دریافت مرغ مرغدار"}),u.jsxs(qu,{id:"recieveTime",value:o.values.recieveTime,label:"بازه زمانی دریافت مرغ مرغدار",onChange:b=>{o.setFieldValue("recieveTime",b.target.value)},children:[u.jsx(Cu,{value:"12 - 14",children:"12 - 14"}),u.jsx(Cu,{value:"14 - 16",children:"14 - 16"}),u.jsx(Cu,{value:"16 - 18",children:"16 - 18"}),u.jsx(Cu,{value:"18 - 20",children:"18 - 20"}),u.jsx(Cu,{value:"20 - 22",children:"20 - 22"}),u.jsx(Cu,{value:"22 - 24",children:"22 - 24"})]})]})}),u.jsx(W,{children:u.jsx(uu,{label:"تاریخ کشتار",id:"recieveDate",renderInput:b=>u.jsx(N,{...b}),value:o.values.recieveDate,error:o.touched.recieveDate?!!o.errors.recieveDate:null,onChange:b=>{o.setFieldValue("recieveDate",J(b).format("YYYY-MM-DD hh:mm:ss"))},onBlur:o.handleBlur,helperText:o.touched.recieveDate&&o.errors.recieveDate?o.errors.recieveDate:null})})]}),u.jsx(I0,{control:u.jsx(M0,{checked:l,onChange:w,color:"primary"}),label:"تعیین نژاد/وزن مرغ"}),l&&u.jsxs(W,{container:!0,direction:"column",gap:k.TINY,children:[u.jsxs(wu,{fullWidth:!0,children:[u.jsx(Ou,{id:"demo-simple-select-label",children:"نژاد مرغ"}),u.jsxs(qu,{labelId:"demo-simple-select-label",id:"race",label:"نژاد مرغ",value:o.values.race,error:o.touched.race?!!o.errors.race:null,onChange:b=>{o.setFieldValue("race",b.target.value)},onBlur:o.handleBlur,children:[u.jsx(Cu,{value:"آرین",children:"آرین"}),u.jsx(Cu,{value:"راس",children:"راس"}),u.jsx(Cu,{value:"آربراکرز (آپلاس)",children:"آربراکرز (آپلاس)"}),u.jsx(Cu,{value:"کاب",children:"کاب"}),u.jsx(Cu,{value:"هوبارد",children:"هوبارد"}),u.jsx(Cu,{value:"ترکیبی",children:"ترکیبی"}),u.jsx(Cu,{value:"وارداتی",children:"وارداتی"})]}),u.jsx(Xu,{children:o.touched.race&&o.errors.race?o.errors.race:null})]}),u.jsx(W,{children:u.jsx(e0,{allowLeadingZeros:!0,thousandSeparator:",",id:"indexWeight",fullWidth:!0,label:"وزن مرغ",variant:"outlined",value:o.values.indexWeight,error:o.touched.indexWeight?!!o.errors.indexWeight:null,onChange:o.handleChange,onBlur:o.handleBlur,helperText:o.touched.indexWeight&&o.errors.indexWeight?o.errors.indexWeight:null})})]}),u.jsxs(W,{children:[xu()!=="ProvinceOperator"&&u.jsx(xe,{title:"تعهد نامه",content:y,actions:u.jsxs(W,{container:!0,justifyContent:"end",gap:k.TINY,children:[u.jsx(G,{variant:"outlined",color:"error",onClick:()=>{o.setFieldValue("isAccepted",!1)},children:"رد"}),u.jsx(G,{variant:"contained",color:"success",onClick:()=>{o.setFieldValue("isAccepted",!0)},children:"موافقم"})]}),btnTitle:"با تعهد نامه موافق هستم!",isAccepted:o.values.isAccepted}),u.jsx(W,{children:u.jsx(I0,{style:{fontSize:"10px"},control:u.jsx(M0,{checked:d,onChange:x}),label:u.jsx(Yu,{title:"5000 تومان",arrow:!0,children:u.jsx(I,{variant:"caption",children:"مایل به دریافت پیامک اطلاع رسانی هستم!"})})})})]}),u.jsx(W,{container:!0,mt:k.SMALL,justifyContent:"center",children:u.jsx(G,{fullWidth:!0,variant:"contained",component:"label",disabled:!o.isValid,size:"large",onClick:()=>{t(cu()),t(Ae({kill_capacity:o.values.capacity,recive_time:o.values.recieveTime,recive_date:o.values.recieveDate,low_weight:o.values.weightType.under2AndHalf,high_weight:o.values.weightType.over2AndHalf,Index_weight:l?o.values.indexWeight:2.7,chicken_breed:l?o.values.race:"تعیین نشده",cash:o.values.sellType.cash,credit:o.values.sellType.haveTime,sms_payment:d,kill_house_key:o.values.selectedKillhouse,killer_kill_house_key:o.values.selectedKillerKillhouse?o.values.selectedKillerKillhouse:null,role:xu()})).then(b=>{t(X()),b.payload.error?e({vertical:"top",horizontal:"center",msg:b.payload.error,severity:"error"}):(t(p0({selectedDate1:A,selectedDate2:h})),t(Iu({title:b.payload.data.result,content:u.jsx(G,{variant:"contained",onClick:()=>{t(Ru())},color:"primary",children:"تایید"})})),e({vertical:"top",horizontal:"center",msg:"عملیات با موفقیت انجام شد.",severity:"success"}),t(hu({right:!1,bottom:!1,content:null})))})},children:"ثبت درخواست"})})]})})},Ge=()=>{const[e,t]=p.useState([]),{slaughterRequests:r}=Fu(d=>d.slaughterSlice),n=lu(),[i]=p.useContext(Q),[,,A,h,o,c]=p.useContext(Q);p.useEffect(()=>{const d=Eu(new Date).format("YYYY-MM-DD");h(d),c(d)},[]),p.useEffect(()=>{n(p0({selectedDate1:A,selectedDate2:o}))},[A,o]),p.useEffect(()=>{const d=r==null?void 0:r.map((s,x)=>{var E,w;let l;return s.state==="archive"?l="بایگانی شده":s.provinceState==="pending"?l="در انتظار تایید استان":s.provinceState==="accepted"?l="تایید شده توسط استان":s.provinceState==="rejected"&&(l="رد شده توسط استان"),[x+1,s.killHouse.name,iu(s==null?void 0:s.createDate),s.provinceQuantity?s.provinceQuantity.toLocaleString():(E=s.killCapacity)==null?void 0:E.toLocaleString(),s.provinceQuantity?(w=s.killCapacity)==null?void 0:w.toLocaleString():0,s.reciveTime,iu(s==null?void 0:s.reciveDate),l,u.jsx(ou,{"aria-label":"delete",color:"error",onClick:()=>{n(Iu({title:"آیا مطمئن هستید؟",content:u.jsxs(W,{container:!0,alignItems:"center",justifyContent:"center",children:[u.jsx(G,{variant:"contained",onClick:()=>{n(cu()),n(fe({id:s.id})).then(T=>{n(Ru()),n(X()),T.error?T.error.message.includes("403")?i({vertical:"top",horizontal:"center",msg:"این درخواست از سمت استان پذیرفته شده و قابل حذف نمی باشد!",severity:"error"}):i({vertical:"top",horizontal:"center",msg:"مشکلی پیش آمده است!",severity:"error"}):n(p0({selectedDate1:A,selectedDate2:o})).then(()=>{i({vertical:"top",horizontal:"center",msg:"عملیات با موفقیت انجام شد.",severity:"success"})})})},children:"تایید"}),u.jsx(G,{onClick:()=>{n(Ru())},children:"لغو"})]})}))},children:u.jsx(o0,{})},x)]});t(d)},[r]);const[y]=p.useState(["ردیف","نام کشتارگاه","تاریخ ایجاد درخواست","تعداد درخواست اولیه","تعداد مورد تایید","زمان دریافت","تاریخ درخواستی کشتار","وضعیت","حذف درخواست"]);return u.jsx(u.Fragment,{children:u.jsxs(W,{xs:12,container:!0,alignItems:"center",gap:k.SMALL,justifyContent:"flex-start",children:[u.jsx(G,{className:"new-request-form-button",variant:"contained",onClick:()=>{n(hu({right:!(window.innerWidth<=600),bottom:window.innerWidth<=600,content:u.jsx(Ve,{}),title:"ثبت درخواست کشتار"}))},children:"ثبت درخواست کشتار جدید"}),u.jsx(W,{children:u.jsx(uu,{label:"از تاریخ",id:"date",renderInput:d=>u.jsx(N,{style:{width:"160px"},...d}),value:A,onChange:d=>{h(Eu(d).format("YYYY-MM-DD"))}})}),u.jsx(W,{children:u.jsx(uu,{label:"تا تاریخ",id:"date",renderInput:d=>u.jsx(N,{style:{width:"160px"},...d}),value:o,onChange:d=>{c(Eu(d).format("YYYY-MM-DD"))}})}),u.jsx(Wu,{title:"درخواست های ثبت شده",columns:y,data:e,paginated:!0})]})})},Qe=({hasPermission:e})=>{const{pathname:t}=g6();return u.jsxs(v,{container:!0,gap:k.SMALL,p:k.SMALL,direction:{xs:"column",md:"row"},justifyContent:"center",style:{placeContent:"baseline"},children:[e&&u.jsxs(u.Fragment,{children:[u.jsxs(v,{container:!0,direction:"column",style:{width:"100%"},children:[u.jsx(v,{children:u.jsx(C0,{text:"درخواست ها"})}),u.jsxs(v,{container:!0,gap:k.SMALL,justifyContent:"center",children:[u.jsx(ku,{to:A0,active:t===A0?"true":null,children:u.jsx(Du,{icon:u.jsx(Y0,{size:30,color:"#244CCC"}),title:"ثبت درخواست",description:"مدیریت و ثبت درخواست های کشتار"})}),u.jsx(ku,{to:f0,active:t===f0?"true":null,children:u.jsx(Du,{icon:u.jsx(Y0,{size:30,color:"#244CCC"}),title:"خرید مستقیم"})}),u.jsx(ku,{to:x0,active:t===x0?"true":null,children:u.jsx(Du,{icon:u.jsx(ve,{size:30,color:"#244CCC"}),title:"صادرات"})}),u.jsx(ku,{to:g0,active:t===g0?"true":null,children:u.jsx(Du,{icon:u.jsx(Fe,{size:30,color:"#244CCC"}),title:u.jsxs(v,{container:!0,direction:"column",children:[u.jsx(I,{variant:"caption",children:"سفارش های دریافت شده"}),u.jsx(I,{variant:"caption",children:"(در انتظار تایید)"})]}),description:"مشاهد درخواست های در انتظار تایید اتحادیه"})}),u.jsx(ku,{to:y0,active:t===y0?"true":null,children:u.jsx(Du,{icon:u.jsx(ke,{size:30,color:"#244CCC"}),title:"تخصیصات",description:"مشاهده و تخصیص درخواست ها"})})]})]}),u.jsxs(v,{container:!0,direction:"column",style:{width:"100%"},children:[u.jsx(v,{children:u.jsx(C0,{text:"بار ها"})}),u.jsxs(v,{container:!0,justifyContent:"center",gap:k.SMALL,children:[u.jsx(ku,{to:v0,active:t===v0?"true":null,children:u.jsx(Du,{icon:u.jsx(je,{size:30,color:"#244CCC"}),title:"تخصیص خودرو",description:"اختصاص خودرو به درخواست"})}),u.jsx(ku,{to:F0,active:t===F0?"true":null,children:u.jsx(Du,{icon:u.jsx(d0,{size:30,color:"#244CCC"}),title:"وارد کردن اطلاعات بار",description:"درخواست های در انتظار عملیات وارد کردن اطلاعات بارهای دریافتی"})}),u.jsx(ku,{to:B0,active:t===B0?"true":null,children:u.jsx(Du,{icon:u.jsx(Ee,{size:30,color:"#244CCC"}),title:"انبار و توزیع",description:"درخواست های در انتظار عملیات وارد کردن اطلاعات بارهای دریافتی"})})]})]})]}),!e&&u.jsxs(v,{container:!0,justifyContent:"center",alignItems:"center",xs:12,gap:1,children:[u.jsx(Z6,{color:"primary"}),u.jsx(I,{color:"secondary",variant:"body1",children:"بدلیل عدم پرداخت تعرفه ، امکان استفاده از خدمات سامانه را ندارید!"})]}),u.jsxs(v,{container:!0,direction:"column",style:{width:"100%"},children:[u.jsx(v,{children:u.jsx(C0,{text:"مالی"})}),u.jsxs(v,{container:!0,justifyContent:"center",gap:k.SMALL,children:[u.jsx(ku,{to:H0,active:t===H0?"true":null,children:u.jsx(Du,{icon:u.jsx(d0,{size:30,color:"#244CCC"}),title:"مدیریت تعرفه ها"})}),u.jsx(ku,{to:O0,active:t===O0?"true":null,children:u.jsx(Du,{icon:u.jsx(be,{size:30,color:"#244CCC"}),title:"کیف پول"})}),u.jsx(ku,{to:q0,active:t===q0?"true":null,children:u.jsx(Du,{icon:u.jsx(Se,{size:30,style:{color:"#4285F4"},color:"#244CCC"}),title:"مدیریت تراکنش ها"})}),u.jsx(ku,{to:j0,active:t===j0?"true":null,children:u.jsx(Du,{icon:u.jsx(d0,{size:30,color:"#244CCC"}),title:"مدیریت فاکتورها",description:"درخواست های در پرداخت"})})]})]})]})},Xe=()=>{const e=Vu(),[,,t,r,n,i]=p.useContext(Q);p.useEffect(()=>{const s=J(new Date).format("YYYY-MM-DD");r(s),i(s)},[]);const[A,h]=p.useState([]),{slaughterActiveRequests:o}=Fu(s=>s.slaughterSlice),c=lu();p.useEffect(()=>{c(Mu({selectedDate1:t,selectedDate2:n}))},[t,n]),p.useEffect(()=>{const s=o==null?void 0:o.filter((l,E)=>l.provinceKillState==="rejected"),x=s==null?void 0:s.map((l,E)=>[E+1,l.orderCode,Bu(new Date(l==null?void 0:l.sendDate),"yyyy/MM/dd"),l.poultryName,l.poultryMobile,l.city,l.province,l.age,l.quantity,u.jsx(ou,{"aria-label":"delete",color:"primary",onClick:()=>e(Uu+l.poultryReqId),children:u.jsx(Nu,{})},E)]);h(x)},[o]);const[y]=p.useState(["ردیف","کد سفارش","تاریخ درخواست","مرغدار","تلفن مرغدار","شهر","استان","سن مرغ","تعداد","مشاهده"]),d=_u({initialValues:{capacity:"",recieveTime:"",recieveDate:J(Date()).format("YYYY-MM-DD hh:mm:ss")},validationSchema:fu({capacity:Tu().required("این فیلد اجباری است!").typeError("لطفا عدد وارد کنید!"),recieveTime:bu().required("این فیلد اجباری است!").typeError("لطفا وزن را وارد کنید!")})});return p.useEffect(()=>{d.validateForm()},[]),u.jsx(W,{container:!0,alignItems:"center",justifyContent:"space-between",gap:k.SMALL,mt:k.MEDIUM,children:u.jsx(D0,{sx:{width:"100%"},children:u.jsx(Hu,{name:u.jsxs(W,{container:!0,alignItems:"center",gap:k.SMALL,children:[u.jsx(W,{children:u.jsx(I,{children:"درخواست های رد شده"})}),u.jsx(W,{children:u.jsx(uu,{label:"از تاریخ",id:"date",renderInput:s=>u.jsx(N,{style:{width:"160px"},...s}),value:t,onChange:s=>{r(J(s).format("YYYY-MM-DD"))}})}),u.jsx(W,{children:u.jsx(uu,{label:"تا تاریخ",id:"date",renderInput:s=>u.jsx(N,{style:{width:"160px"},...s}),value:n,onChange:s=>{i(J(s).format("YYYY-MM-DD"))}})})]}),columns:y,data:A})})})},Ze=()=>{const e=Vu(),t=lu(),[r,n]=p.useState([]),{avicultureRequests:i}=Fu(d=>d.avicultureSlice),[,,A,h,o,c]=p.useContext(Q);p.useEffect(()=>{const d=Eu(new Date).format("YYYY-MM-DD");h(d),c(d)},[]),p.useEffect(()=>{t(cu()),t(J6({selectedDate1:A,selectedDate2:o})).then(()=>{t(X())})},[A,o]),p.useEffect(()=>{const d=i==null?void 0:i.filter((x,l)=>x.inspector!=null),s=d==null?void 0:d.map((x,l)=>{var E,w,T,S,m,f,Y,H,_,a,C,L;return[l+1,x.orderCode,iu(x==null?void 0:x.createDate),iu(x==null?void 0:x.sendDate),(w=(E=x==null?void 0:x.process)==null?void 0:E.poultry)==null?void 0:w.poultryName,(S=(T=x==null?void 0:x.process)==null?void 0:T.poultry)==null?void 0:S.poultryMobile,(f=(m=x==null?void 0:x.process)==null?void 0:m.poultry)==null?void 0:f.poultryCity,(H=(Y=x==null?void 0:x.process)==null?void 0:Y.poultry)==null?void 0:H.poultryProvince,(a=(_=x==null?void 0:x.process)==null?void 0:_.poultry)==null?void 0:a.age,(L=(C=x==null?void 0:x.process)==null?void 0:C.poultry)==null?void 0:L.poultryQuantity,u.jsx(ou,{"aria-label":"delete",color:"primary",onClick:()=>{var b,g;return e(Uu+((g=(b=x==null?void 0:x.process)==null?void 0:b.poultry)==null?void 0:g.poultryRequestId))},children:u.jsx(Nu,{})},l)]});n(s)},[i]);const[y]=p.useState(["ردیف","کد سفارش","تاریخ ثبت درخواست","تاریخ درخواست","مرغدار","تلفن مرغدار","شهر","استان","سن مرغ","تعداد","مشاهده"]);return u.jsx(D0,{children:u.jsx(Hu,{name:u.jsxs(v,{container:!0,alignItems:"center",gap:k.SMALL,children:[u.jsx(v,{children:u.jsx(I,{children:"درخواست های بایگانی شده"})}),u.jsx(v,{children:u.jsx(uu,{label:"از تاریخ",id:"date",renderInput:d=>u.jsx(N,{style:{width:"160px"},...d}),value:A,onChange:d=>{h(Eu(d).format("YYYY-MM-DD"))}})}),u.jsx(v,{children:u.jsx(uu,{label:"تا تاریخ",id:"date",renderInput:d=>u.jsx(N,{style:{width:"160px"},...d}),value:o,onChange:d=>{c(Eu(d).format("YYYY-MM-DD"))}})})]}),expandable:!0,columns:y,data:r})})};var Je={attributes:!0,characterData:!0,subtree:!0,childList:!0};function ut(e,t,r=Je){p.useEffect(()=>{if(e.current){const n=new MutationObserver(t);return n.observe(e.current,r),()=>{n.disconnect()}}},[t,r])}var j6=function(){if(typeof Map<"u")return Map;function e(t,r){var n=-1;return t.some(function(i,A){return i[0]===r?(n=A,!0):!1}),n}return function(){function t(){this.__entries__=[]}return Object.defineProperty(t.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),t.prototype.get=function(r){var n=e(this.__entries__,r),i=this.__entries__[n];return i&&i[1]},t.prototype.set=function(r,n){var i=e(this.__entries__,r);~i?this.__entries__[i][1]=n:this.__entries__.push([r,n])},t.prototype.delete=function(r){var n=this.__entries__,i=e(n,r);~i&&n.splice(i,1)},t.prototype.has=function(r){return!!~e(this.__entries__,r)},t.prototype.clear=function(){this.__entries__.splice(0)},t.prototype.forEach=function(r,n){n===void 0&&(n=null);for(var i=0,A=this.__entries__;i<A.length;i++){var h=A[i];r.call(n,h[1],h[0])}},t}()}(),S0=typeof window<"u"&&typeof document<"u"&&window.document===document,t0=function(){return typeof global<"u"&&global.Math===Math?global:typeof self<"u"&&self.Math===Math?self:typeof window<"u"&&window.Math===Math?window:Function("return this")()}(),et=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(t0):function(e){return setTimeout(function(){return e(Date.now())},1e3/60)}}(),tt=2;function rt(e,t){var r=!1,n=!1,i=0;function A(){r&&(r=!1,e()),n&&o()}function h(){et(A)}function o(){var c=Date.now();if(r){if(c-i<tt)return;n=!0}else r=!0,n=!1,setTimeout(h,t);i=c}return o}var nt=20,at=["top","right","bottom","left","width","height","size","weight"],ot=typeof MutationObserver<"u",lt=function(){function e(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=rt(this.refresh.bind(this),nt)}return e.prototype.addObserver=function(t){~this.observers_.indexOf(t)||this.observers_.push(t),this.connected_||this.connect_()},e.prototype.removeObserver=function(t){var r=this.observers_,n=r.indexOf(t);~n&&r.splice(n,1),!r.length&&this.connected_&&this.disconnect_()},e.prototype.refresh=function(){var t=this.updateObservers_();t&&this.refresh()},e.prototype.updateObservers_=function(){var t=this.observers_.filter(function(r){return r.gatherActive(),r.hasActive()});return t.forEach(function(r){return r.broadcastActive()}),t.length>0},e.prototype.connect_=function(){!S0||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),ot?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},e.prototype.disconnect_=function(){!S0||!this.connected_||(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},e.prototype.onTransitionEnd_=function(t){var r=t.propertyName,n=r===void 0?"":r,i=at.some(function(A){return!!~n.indexOf(A)});i&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e}(),b6=function(e,t){for(var r=0,n=Object.keys(t);r<n.length;r++){var i=n[r];Object.defineProperty(e,i,{value:t[i],enumerable:!1,writable:!1,configurable:!0})}return e},zu=function(e){var t=e&&e.ownerDocument&&e.ownerDocument.defaultView;return t||t0},E6=l0(0,0,0,0);function r0(e){return parseFloat(e)||0}function z0(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return t.reduce(function(n,i){var A=e["border-"+i+"-width"];return n+r0(A)},0)}function st(e){for(var t=["top","right","bottom","left"],r={},n=0,i=t;n<i.length;n++){var A=i[n],h=e["padding-"+A];r[A]=r0(h)}return r}function it(e){var t=e.getBBox();return l0(0,0,t.width,t.height)}function ct(e){var t=e.clientWidth,r=e.clientHeight;if(!t&&!r)return E6;var n=zu(e).getComputedStyle(e),i=st(n),A=i.left+i.right,h=i.top+i.bottom,o=r0(n.width),c=r0(n.height);if(n.boxSizing==="border-box"&&(Math.round(o+A)!==t&&(o-=z0(n,"left","right")+A),Math.round(c+h)!==r&&(c-=z0(n,"top","bottom")+h)),!Ct(e)){var y=Math.round(o+A)-t,d=Math.round(c+h)-r;Math.abs(y)!==1&&(o-=y),Math.abs(d)!==1&&(c-=d)}return l0(i.left,i.top,o,c)}var dt=function(){return typeof SVGGraphicsElement<"u"?function(e){return e instanceof zu(e).SVGGraphicsElement}:function(e){return e instanceof zu(e).SVGElement&&typeof e.getBBox=="function"}}();function Ct(e){return e===zu(e).document.documentElement}function ht(e){return S0?dt(e)?it(e):ct(e):E6}function pt(e){var t=e.x,r=e.y,n=e.width,i=e.height,A=typeof DOMRectReadOnly<"u"?DOMRectReadOnly:Object,h=Object.create(A.prototype);return b6(h,{x:t,y:r,width:n,height:i,top:r,right:t+n,bottom:i+r,left:t}),h}function l0(e,t,r,n){return{x:e,y:t,width:r,height:n}}var At=function(){function e(t){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=l0(0,0,0,0),this.target=t}return e.prototype.isActive=function(){var t=ht(this.target);return this.contentRect_=t,t.width!==this.broadcastWidth||t.height!==this.broadcastHeight},e.prototype.broadcastRect=function(){var t=this.contentRect_;return this.broadcastWidth=t.width,this.broadcastHeight=t.height,t},e}(),ft=function(){function e(t,r){var n=pt(r);b6(this,{target:t,contentRect:n})}return e}(),xt=function(){function e(t,r,n){if(this.activeObservations_=[],this.observations_=new j6,typeof t!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=t,this.controller_=r,this.callbackCtx_=n}return e.prototype.observe=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(t instanceof zu(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var r=this.observations_;r.has(t)||(r.set(t,new At(t)),this.controller_.addObserver(this),this.controller_.refresh())}},e.prototype.unobserve=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(t instanceof zu(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var r=this.observations_;r.has(t)&&(r.delete(t),r.size||this.controller_.removeObserver(this))}},e.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},e.prototype.gatherActive=function(){var t=this;this.clearActive(),this.observations_.forEach(function(r){r.isActive()&&t.activeObservations_.push(r)})},e.prototype.broadcastActive=function(){if(this.hasActive()){var t=this.callbackCtx_,r=this.activeObservations_.map(function(n){return new ft(n.target,n.broadcastRect())});this.callback_.call(t,r,t),this.clearActive()}},e.prototype.clearActive=function(){this.activeObservations_.splice(0)},e.prototype.hasActive=function(){return this.activeObservations_.length>0},e}(),S6=typeof WeakMap<"u"?new WeakMap:new j6,k6=function(){function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var r=lt.getInstance(),n=new xt(t,r,this);S6.set(this,n)}return e}();["observe","unobserve","disconnect"].forEach(function(e){k6.prototype[e]=function(){var t;return(t=S6.get(this))[e].apply(t,arguments)}});var gt=function(){return typeof t0.ResizeObserver<"u"?t0.ResizeObserver:k6}(),yt=({mutationObservables:e,resizeObservables:t,refresh:r})=>{const[n,i]=p.useState(0),A=p.useRef(document.documentElement||document.body);function h(c){const y=Array.from(c);for(const d of y)if(e){if(!d.attributes)continue;e.find(x=>d.matches(x))&&r(!0)}}function o(c){const y=Array.from(c);for(const d of y)if(t){if(!d.attributes)continue;t.find(x=>d.matches(x))&&i(n+1)}}return ut(A,c=>{for(const y of c)y.addedNodes.length!==0&&(h(y.addedNodes),o(y.addedNodes)),y.removedNodes.length!==0&&(h(y.removedNodes),o(y.removedNodes))},{childList:!0,subtree:!0}),p.useEffect(()=>{if(!t)return;const c=new gt(()=>{r()});for(const y of t){const d=document.querySelector(y);d&&c.observe(d)}return()=>{c.disconnect()}},[t,n]),null},vt=yt;function Qu(e){let t=D6;return e&&(t=e.getBoundingClientRect()),t}function Ft(e,t){const[r,n]=p.useState(D6),i=p.useCallback(()=>{e!=null&&e.current&&n(Qu(e==null?void 0:e.current))},[e==null?void 0:e.current]);return p.useEffect(()=>(i(),window.addEventListener("resize",i),()=>window.removeEventListener("resize",i)),[e==null?void 0:e.current,t]),r}var D6={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0};function jt(e,t){return new Promise(r=>{if(!(e instanceof Element))throw new TypeError("Argument 1 must be an Element");let n=0,i=null;const A=Object.assign({behavior:"smooth"},t);e.scrollIntoView(A),requestAnimationFrame(h);function h(){const o=e==null?void 0:e.getBoundingClientRect().top;if(o===i){if(n++>2)return r(null)}else n=0,i=o;requestAnimationFrame(h)}})}function Gu(e){return e<0?0:e}function bt(e){return typeof e=="object"&&e!==null?{thresholdX:e.x||0,thresholdY:e.y||0}:{thresholdX:e||0,thresholdY:e||0}}function s0(){const e=Math.max(document.documentElement.clientWidth,window.innerWidth||0),t=Math.max(document.documentElement.clientHeight,window.innerHeight||0);return{w:e,h:t}}function Et({top:e,right:t,bottom:r,left:n,threshold:i}){const{w:A,h}=s0(),{thresholdX:o,thresholdY:c}=bt(i);return e<0&&r-e>h?!0:e>=0+c&&n>=0+o&&r<=h-c&&t<=A-o}var K0=(e,t)=>e>t,U0=(e,t)=>e>t;function St(e,t=[]){const r=(n,i)=>t.includes(n)?1:t.includes(i)?-1:0;return Object.keys(e).map(n=>({position:n,value:e[n]})).sort((n,i)=>i.value-n.value).sort((n,i)=>r(n.position,i.position)).filter(n=>n.value>0).map(n=>n.position)}var h0=10;function k0(e=h0){return Array.isArray(e)?e.length===1?[e[0],e[0],e[0],e[0]]:e.length===2?[e[1],e[0],e[1],e[0]]:e.length===3?[e[0],e[1],e[2],e[1]]:e.length>3?[e[0],e[1],e[2],e[3]]:[h0,h0]:[e,e,e,e]}var kt={maskWrapper:()=>({opacity:.7,left:0,top:0,position:"fixed",zIndex:99999,pointerEvents:"none",color:"#000"}),svgWrapper:({windowWidth:e,windowHeight:t,wpt:r,wpl:n})=>({width:e,height:t,left:Number(n),top:Number(r),position:"fixed"}),maskArea:({x:e,y:t,width:r,height:n})=>({x:e,y:t,width:r,height:n,fill:"black",rx:0}),maskRect:({windowWidth:e,windowHeight:t,maskID:r})=>({x:0,y:0,width:e,height:t,fill:"currentColor",mask:`url(#${r})`}),clickArea:({windowWidth:e,windowHeight:t,clipID:r})=>({x:0,y:0,width:e,height:t,fill:"currentcolor",pointerEvents:"auto",clipPath:`url(#${r})`}),highlightedArea:({x:e,y:t,width:r,height:n})=>({x:e,y:t,width:r,height:n,pointerEvents:"auto",fill:"transparent",display:"none"})};function Dt(e){return(t,r)=>{const n=kt[t](r),i=e[t];return i?i(n,r):n}}var wt=({padding:e=10,wrapperPadding:t=0,onClick:r,onClickHighlighted:n,styles:i={},sizes:A,className:h,highlightedAreaClassName:o,maskId:c,clipId:y})=>{const d=c||V0("mask__"),s=y||V0("clip__"),x=Dt(i),[l,E,w,T]=k0(e),[S,m,f,Y]=k0(t),{w:H,h:_}=s0(),a=Gu((A==null?void 0:A.width)+T+E),C=Gu((A==null?void 0:A.height)+l+w),L=Gu((A==null?void 0:A.top)-l-S),b=Gu((A==null?void 0:A.left)-T-Y),g=H-Y-m,D=_-S-f,$=x("maskArea",{x:b,y:L,width:a,height:C}),eu=x("highlightedArea",{x:b,y:L,width:a,height:C});return P.createElement("div",{style:x("maskWrapper",{}),onClick:r,className:h},P.createElement("svg",{width:g,height:D,xmlns:"http://www.w3.org/2000/svg",style:x("svgWrapper",{windowWidth:g,windowHeight:D,wpt:S,wpl:Y})},P.createElement("defs",null,P.createElement("mask",{id:d},P.createElement("rect",{x:0,y:0,width:g,height:D,fill:"white"}),P.createElement("rect",{style:$,rx:$.rx?1:void 0})),P.createElement("clipPath",{id:s},P.createElement("polygon",{points:`0 0, 0 ${D}, ${b} ${D}, ${b} ${L}, ${b+a} ${L}, ${b+a} ${L+C}, ${b} ${L+C}, ${b} ${D}, ${g} ${D}, ${g} 0`}))),P.createElement("rect",{style:x("maskRect",{windowWidth:g,windowHeight:D,maskID:d})}),P.createElement("rect",{style:x("clickArea",{windowWidth:g,windowHeight:D,top:L,left:b,width:a,height:C,clipID:s})}),P.createElement("rect",{style:eu,className:o,onClick:n,rx:eu.rx?1:void 0})))},_t=wt;function V0(e){return e+Math.random().toString(36).substring(2,16)}var mt=Object.defineProperty,n0=Object.getOwnPropertySymbols,w6=Object.prototype.hasOwnProperty,_6=Object.prototype.propertyIsEnumerable,G0=(e,t,r)=>t in e?mt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Q0=(e,t)=>{for(var r in t||(t={}))w6.call(t,r)&&G0(e,r,t[r]);if(n0)for(var r of n0(t))_6.call(t,r)&&G0(e,r,t[r]);return e},Tt=(e,t)=>{var r={};for(var n in e)w6.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&n0)for(var n of n0(e))t.indexOf(n)<0&&_6.call(e,n)&&(r[n]=e[n]);return r},Rt={popover:()=>({position:"fixed",maxWidth:353,backgroundColor:"#fff",padding:"24px 30px",boxShadow:"0 0.5em 3em rgba(0, 0, 0, 0.3)",color:"inherit",zIndex:1e5,transition:"transform 0.3s",top:0,left:0})};function Lt(e){return(t,r)=>{const n=Rt[t](r),i=e[t];return i?i(n,r):n}}var It=e=>{var t=e,{children:r,position:n="bottom",padding:i=10,styles:A={},sizes:h,refresher:o}=t,c=Tt(t,["children","position","padding","styles","sizes","refresher"]);const y=p.useRef(null),d=p.useRef(""),s=p.useRef(""),x=p.useRef(""),{w:l,h:E}=s0(),w=Lt(A),T=Ft(y,o),{width:S,height:m}=T,[f,Y,H,_]=k0(i),a=(h==null?void 0:h.left)-_,C=(h==null?void 0:h.top)-f,L=(h==null?void 0:h.right)+Y,b=(h==null?void 0:h.bottom)+H,g=n&&typeof n=="function"?n({width:S,height:m,windowWidth:l,windowHeight:E,top:C,left:a,right:L,bottom:b,x:h.x,y:h.y},T):n,D={left:a,right:l-L,top:C,bottom:E-b},$=(q,F,z)=>{switch(q){case"top":return D.top>m+H;case"right":return F?!1:D.right>S+_;case"bottom":return z?!1:D.bottom>m+f;case"left":return D.left>S+Y;default:return!1}},eu=(q,F,z)=>{const R=St(D,z?["right","left"]:F?["top","bottom"]:[]);for(let U=0;U<R.length;U++)if($(R[U],F,z))return d.current=R[U],q[R[U]];return d.current="center",q.center},B=(q=>{if(Array.isArray(q)){const Z=K0(q[0],l),su=U0(q[1],E);return d.current="custom",[Z?l/2-S/2:q[0],su?E/2-m/2:q[1]]}const F=K0(a+S,l),z=U0(b+m,E),R=F?Math.min(a,l-S):Math.max(a,0),U=z?m>D.bottom?Math.max(b-m,0):Math.max(C,0):C;z&&m>D.bottom?s.current="bottom":s.current="top",F?x.current="left":x.current="right";const tu={top:[R-_,C-m-H],right:[L+_,U-f],bottom:[R-_,b+f],left:[a-S-Y,U-f],center:[l/2-S/2,E/2-m/2]};return q==="center"||$(q,F,z)&&!F&&!z?(d.current=q,tu[q]):eu(tu,F,z)})(g);return P.createElement("div",Q0({className:"reactour__popover",style:Q0({transform:`translate(${Math.round(B[0])}px, ${Math.round(B[1])}px)`},w("popover",{position:d.current,verticalAlign:s.current,horizontalAlign:x.current,helperRect:T,targetRect:h})),ref:y},c),r)},Mt=It,Bt=Object.defineProperty,Ht=Object.defineProperties,Ot=Object.getOwnPropertyDescriptors,a0=Object.getOwnPropertySymbols,m6=Object.prototype.hasOwnProperty,T6=Object.prototype.propertyIsEnumerable,X0=(e,t,r)=>t in e?Bt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Au=(e,t)=>{for(var r in t||(t={}))m6.call(t,r)&&X0(e,r,t[r]);if(a0)for(var r of a0(t))T6.call(t,r)&&X0(e,r,t[r]);return e},_0=(e,t)=>Ht(e,Ot(t)),Ku=(e,t)=>{var r={};for(var n in e)m6.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&a0)for(var n of a0(e))t.indexOf(n)<0&&T6.call(e,n)&&(r[n]=e[n]);return r},qt={bottom:0,height:0,left:0,right:0,top:0,width:0,windowWidth:0,windowHeight:0,x:0,y:0};function Pt(e,t={block:"center",behavior:"smooth",inViewThreshold:0}){const[r,n]=p.useState(!1),[i,A]=p.useState(!1),[h,o]=p.useState(!1),[c,y]=p.useState(null),[d,s]=p.useState(qt),x=(e==null?void 0:e.selector)instanceof Element?e==null?void 0:e.selector:document.querySelector(e==null?void 0:e.selector),l=p.useCallback(()=>{const w=Z0(x,e==null?void 0:e.highlightedSelectors,e==null?void 0:e.bypassElem),{hasHighligtedElems:T}=w,S=Ku(w,["hasHighligtedElems"]);Object.entries(d).some(([m,f])=>S[m]!==f)&&s(S)},[x,e==null?void 0:e.highlightedSelectors,d]);p.useEffect(()=>(l(),window.addEventListener("resize",l),()=>window.removeEventListener("resize",l)),[x,e==null?void 0:e.highlightedSelectors,c]),p.useEffect(()=>{!Et(_0(Au({},d),{threshold:t.inViewThreshold}))&&x&&(n(!0),jt(x,t).then(()=>{i||y(Date.now())}).finally(()=>{n(!1)}))},[d]);const E=p.useCallback(()=>{A(!0);const w=Z0(x,e==null?void 0:e.highlightedSelectors,e==null?void 0:e.bypassElem),{hasHighligtedElems:T}=w,S=Ku(w,["hasHighligtedElems"]);o(T),s(S),A(!1)},[x,e==null?void 0:e.highlightedSelectors,d]);return{sizes:d,transition:r,target:x,observableRefresher:E,isHighlightingObserved:h}}function Z0(e,t=[],r=!0){let n=!1;const{w:i,h:A}=s0();if(!t)return _0(Au({},Qu(e)),{windowWidth:i,windowHeight:A,hasHighligtedElems:!1});let h=Qu(e),o={bottom:0,height:0,left:i,right:0,top:A,width:0};for(const y of t){const d=document.querySelector(y);if(!d||d.style.display==="none"||d.style.visibility==="hidden")continue;const s=Qu(d);n=!0,r||!e?(s.top<o.top&&(o.top=s.top),s.right>o.right&&(o.right=s.right),s.bottom>o.bottom&&(o.bottom=s.bottom),s.left<o.left&&(o.left=s.left),o.width=o.right-o.left,o.height=o.bottom-o.top):(s.top<h.top&&(h.top=s.top),s.right>h.right&&(h.right=s.right),s.bottom>h.bottom&&(h.bottom=s.bottom),s.left<h.left&&(h.left=s.left),h.width=h.right-h.left,h.height=h.bottom-h.top)}const c=r||!e?o.width>0&&o.height>0:!1;return{left:(c?o:h).left,top:(c?o:h).top,right:(c?o:h).right,bottom:(c?o:h).bottom,width:(c?o:h).width,height:(c?o:h).height,windowWidth:i,windowHeight:A,hasHighligtedElems:n,x:h.x,y:h.y}}var Yt=({disableKeyboardNavigation:e,setCurrentStep:t,currentStep:r,setIsOpen:n,stepsLength:i,disable:A,rtl:h,clickProps:o,keyboardHandler:c})=>{function y(d){if(d.stopPropagation(),e===!0||A)return;let s,x,l;e&&(s=e.includes("esc"),x=e.includes("right"),l=e.includes("left"));function E(){t(Math.min(r+1,i-1))}function w(){t(Math.max(r-1,0))}c&&typeof c=="function"?c(d,o,{isEscDisabled:s,isRightDisabled:x,isLeftDisabled:l}):(d.keyCode===27&&!s&&(d.preventDefault(),n(!1)),d.keyCode===39&&!x&&(d.preventDefault(),h?w():E()),d.keyCode===37&&!l&&(d.preventDefault(),h?E():w()))}return p.useEffect(()=>(window.addEventListener("keydown",y,!1),()=>{window.removeEventListener("keydown",y)}),[A,t,r]),null},Wt=Yt,Nt={badge:()=>({position:"absolute",fontFamily:"monospace",background:"var(--reactour-accent,#007aff)",height:"1.875em",lineHeight:2,paddingLeft:"0.8125em",paddingRight:"0.8125em",fontSize:"1em",borderRadius:"1.625em",color:"white",textAlign:"center",boxShadow:"0 0.25em 0.5em rgba(0, 0, 0, 0.3)",top:"-0.8125em",left:"-0.8125em"}),controls:()=>({display:"flex",marginTop:24,alignItems:"center",justifyContent:"space-between"}),navigation:()=>({counterReset:"dot",display:"flex",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap"}),button:({disabled:e})=>({display:"block",padding:0,border:0,background:"none",cursor:e?"not-allowed":"pointer"}),arrow:({disabled:e})=>({color:e?"#caccce":"#646464",width:16,height:12,flex:"0 0 16px"}),dot:({current:e,disabled:t,showNumber:r})=>({counterIncrement:"dot",width:8,height:8,border:e?"0":"1px solid #caccce",borderRadius:"100%",padding:0,display:"block",margin:4,transition:"opacity 0.3s, transform 0.3s",cursor:t?"not-allowed":"pointer",transform:`scale(${e?1.25:1})`,color:e?"var(--reactour-accent, #007aff)":"#caccce",background:e?"var(--reactour-accent, #007aff)":"none"}),close:({disabled:e})=>({position:"absolute",top:22,right:22,width:9,height:9,"--rt-close-btn":e?"#caccce":"#5e5e5e","--rt-close-btn-disabled":e?"#caccce":"#000"}),svg:()=>({display:"block"})};function i0(e){return(t,r)=>{const n=Nt[t](r),i=e[t];return i?i(n,r):n}}var $t=({styles:e={},children:t})=>{const r=i0(e);return P.createElement("span",{style:r("badge",{})},t)},zt=$t,Kt=e=>{var t=e,{styles:r={},onClick:n,disabled:i}=t,A=Ku(t,["styles","onClick","disabled"]);const h=i0(r);return P.createElement("button",Au({className:"reactour__close-button",style:Au(Au({},h("button",{})),h("close",{disabled:i})),onClick:n},A),P.createElement("svg",{viewBox:"0 0 9.1 9.1","aria-hidden":!0,role:"presentation",style:Au({},h("svg",{}))},P.createElement("path",{fill:"currentColor",d:"M5.9 4.5l2.8-2.8c.4-.4.4-1 0-1.4-.4-.4-1-.4-1.4 0L4.5 3.1 1.7.3C1.3-.1.7-.1.3.3c-.4.4-.4 1 0 1.4l2.8 2.8L.3 7.4c-.4.4-.4 1 0 1.4.2.2.4.3.7.3s.5-.1.7-.3L4.5 6l2.8 2.8c.3.2.5.3.8.3s.5-.1.7-.3c.4-.4.4-1 0-1.4L5.9 4.5z"})))},Ut=Kt,Vt=({content:e,setCurrentStep:t,transition:r,isHighlightingObserved:n,currentStep:i,setIsOpen:A})=>typeof e=="function"?e({setCurrentStep:t,transition:r,isHighlightingObserved:n,currentStep:i,setIsOpen:A}):e,Gt=Vt,Qt=({styles:e={},steps:t,setCurrentStep:r,currentStep:n,setIsOpen:i,nextButton:A,prevButton:h,disableDots:o,hideDots:c,hideButtons:y,disableAll:d,rtl:s,Arrow:x=R6})=>{const l=t.length,E=i0(e),w=({onClick:T,kind:S="next",children:m,hideArrow:f})=>{function Y(){d||(T&&typeof T=="function"?T():r(S==="next"?Math.min(n+1,l-1):Math.max(n-1,0)))}return P.createElement("button",{style:E("button",{kind:S,disabled:d||(S==="next"?l-1===n:n===0)}),onClick:Y,"aria-label":`Go to ${S} step`},f?null:P.createElement(x,{styles:e,inverted:s?S==="prev":S==="next",disabled:d||(S==="next"?l-1===n:n===0)}),m)};return P.createElement("div",{style:E("controls",{}),dir:s?"rtl":"ltr"},y?null:h&&typeof h=="function"?h({Button:w,setCurrentStep:r,currentStep:n,stepsLength:l,setIsOpen:i,steps:t}):P.createElement(w,{kind:"prev"}),c?null:P.createElement("div",{style:E("navigation",{})},Array.from({length:l},(T,S)=>S).map(T=>{var S;return P.createElement("button",{style:E("dot",{current:T===n,disabled:o||d}),onClick:()=>{!o&&!d&&r(T)},key:`navigation_dot_${T}`,"aria-label":((S=t[T])==null?void 0:S.navDotAriaLabel)||`Go to step ${T+1}`})})),y?null:A&&typeof A=="function"?A({Button:w,setCurrentStep:r,currentStep:n,stepsLength:l,setIsOpen:i,steps:t}):P.createElement(w,null))},Xt=Qt,R6=({styles:e={},inverted:t=!1,disabled:r})=>{const n=i0(e);return P.createElement("svg",{viewBox:"0 0 18.4 14.4",style:n("arrow",{inverted:t,disabled:r})},P.createElement("path",{d:t?"M17 7.2H1M10.8 1L17 7.2l-6.2 6.2":"M1.4 7.2h16M7.6 1L1.4 7.2l6.2 6.2",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeMiterlimit:"10"}))},Zt={Badge:zt,Close:Ut,Content:Gt,Navigation:Xt,Arrow:R6},Jt=e=>Au(Au({},Zt),e),ur=({styles:e,components:t={},badgeContent:r,accessibilityOptions:n,disabledActions:i,onClickClose:A,steps:h,setCurrentStep:o,currentStep:c,transition:y,isHighlightingObserved:d,setIsOpen:s,nextButton:x,prevButton:l,disableDotsNavigation:E,rtl:w,showPrevNextButtons:T=!0,showCloseButton:S=!0,showNavigation:m=!0,showBadge:f=!0,showDots:Y=!0,meta:H,setMeta:_,setSteps:a})=>{const C=h[c],{Badge:L,Close:b,Content:g,Navigation:D,Arrow:$}=Jt(t),eu=r&&typeof r=="function"?r({currentStep:c,totalSteps:h.length,transition:y}):c+1;function pu(){i||(A&&typeof A=="function"?A({setCurrentStep:o,setIsOpen:s,currentStep:c,steps:h,meta:H,setMeta:_,setSteps:a}):s(!1))}return P.createElement(P.Fragment,null,f?P.createElement(L,{styles:e},eu):null,S?P.createElement(b,{styles:e,"aria-label":n==null?void 0:n.closeButtonAriaLabel,disabled:i,onClick:pu}):null,P.createElement(g,{content:C==null?void 0:C.content,setCurrentStep:o,currentStep:c,transition:y,isHighlightingObserved:d,setIsOpen:s}),m?P.createElement(D,{setCurrentStep:o,currentStep:c,setIsOpen:s,steps:h,styles:e,"aria-hidden":!(n!=null&&n.showNavigationScreenReaders),nextButton:x,prevButton:l,disableDots:E,hideButtons:!T,hideDots:!Y,disableAll:i,rtl:w,Arrow:$}):null)},er=ur,tr=e=>{var t=e,{currentStep:r,setCurrentStep:n,setIsOpen:i,steps:A=[],setSteps:h,styles:o={},scrollSmooth:c,afterOpen:y,beforeClose:d,padding:s=10,position:x,onClickMask:l,onClickHighlighted:E,keyboardHandler:w,className:T="reactour__popover",maskClassName:S="reactour__mask",highlightedMaskClassName:m,clipId:f,maskId:Y,disableInteraction:H,disableKeyboardNavigation:_,inViewThreshold:a,disabledActions:C,setDisabledActions:L,disableWhenSelectorFalsy:b,rtl:g,accessibilityOptions:D={closeButtonAriaLabel:"Close Tour",showNavigationScreenReaders:!0},ContentComponent:$,Wrapper:eu,meta:pu,setMeta:B,onTransition:q=()=>"center"}=t,F=Ku(t,["currentStep","setCurrentStep","setIsOpen","steps","setSteps","styles","scrollSmooth","afterOpen","beforeClose","padding","position","onClickMask","onClickHighlighted","keyboardHandler","className","maskClassName","highlightedMaskClassName","clipId","maskId","disableInteraction","disableKeyboardNavigation","inViewThreshold","disabledActions","setDisabledActions","disableWhenSelectorFalsy","rtl","accessibilityOptions","ContentComponent","Wrapper","meta","setMeta","onTransition"]),z;const R=A[r],U=Au(Au({},o),R==null?void 0:R.styles),{sizes:tu,transition:Z,observableRefresher:su,isHighlightingObserved:du,target:gu}=Pt(R,{block:"center",behavior:c?"smooth":"auto",inViewThreshold:a});p.useEffect(()=>(y&&typeof y=="function"&&y(gu),()=>{d&&typeof d=="function"&&d(gu)}),[]);const{maskPadding:mu,popoverPadding:j,wrapperPadding:O}=nr((z=R==null?void 0:R.padding)!=null?z:s),V={setCurrentStep:n,setIsOpen:i,currentStep:r,setSteps:h,steps:A,setMeta:B,meta:pu};function ru(){C||(l&&typeof l=="function"?l(V):i(!1))}const nu=typeof(R==null?void 0:R.stepInteraction)=="boolean"?!(R!=null&&R.stepInteraction):H?typeof H=="boolean"?H:H(V):!1;p.useEffect(()=>(R!=null&&R.action&&typeof(R==null?void 0:R.action)=="function"&&(R==null||R.action(gu)),(R==null?void 0:R.disableActions)!==void 0&&L(R==null?void 0:R.disableActions),()=>{R!=null&&R.actionAfter&&typeof(R==null?void 0:R.actionAfter)=="function"&&(R==null||R.actionAfter(gu))}),[R]);const au=Z?q:R!=null&&R.position?R==null?void 0:R.position:x,ju=eu||P.Fragment;return R?P.createElement(ju,null,P.createElement(vt,{mutationObservables:R==null?void 0:R.mutationObservables,resizeObservables:R==null?void 0:R.resizeObservables,refresh:su}),P.createElement(Wt,{setCurrentStep:n,currentStep:r,setIsOpen:i,stepsLength:A.length,disableKeyboardNavigation:_,disable:C,rtl:g,clickProps:V,keyboardHandler:w}),(!b||gu)&&P.createElement(_t,{sizes:Z?ar:tu,onClick:ru,styles:Au({highlightedArea:yu=>_0(Au({},yu),{display:nu?"block":"none"})},U),padding:Z?0:mu,highlightedAreaClassName:m,className:S,onClickHighlighted:yu=>{yu.preventDefault(),yu.stopPropagation(),E&&E(yu,V)},wrapperPadding:O,clipId:f,maskId:Y}),(!b||gu)&&P.createElement(Mt,{sizes:tu,styles:U,position:au,padding:j,"aria-labelledby":D==null?void 0:D.ariaLabelledBy,className:T,refresher:r},$?P.createElement($,Au({styles:U,setCurrentStep:n,currentStep:r,setIsOpen:i,steps:A,accessibilityOptions:D,disabledActions:C,transition:Z,isHighlightingObserved:du,rtl:g},F)):P.createElement(er,Au({styles:U,setCurrentStep:n,currentStep:r,setIsOpen:i,steps:A,setSteps:h,accessibilityOptions:D,disabledActions:C,transition:Z,isHighlightingObserved:du,rtl:g,meta:pu,setMeta:B},F)))):null},rr=tr;function nr(e){return typeof e=="object"&&e!==null?{maskPadding:e.mask,popoverPadding:e.popover,wrapperPadding:e.wrapper}:{maskPadding:e,popoverPadding:e,wrapperPadding:0}}var ar={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0},or={isOpen:!1,setIsOpen:()=>!1,currentStep:0,setCurrentStep:()=>0,steps:[],setSteps:()=>[],setMeta:()=>"",disabledActions:!1,setDisabledActions:()=>!1,components:{}},lr=P.createContext(or),sr=e=>{var t=e,{children:r,defaultOpen:n=!1,startAt:i=0,steps:A,setCurrentStep:h,currentStep:o}=t,c=Ku(t,["children","defaultOpen","startAt","steps","setCurrentStep","currentStep"]);const[y,d]=p.useState(n),[s,x]=p.useState(i),[l,E]=p.useState(A),[w,T]=p.useState(""),[S,m]=p.useState(!1),f=Au({isOpen:y,setIsOpen:d,currentStep:o||s,setCurrentStep:h&&typeof h=="function"?h:x,steps:l,setSteps:E,disabledActions:S,setDisabledActions:m,meta:w,setMeta:T},c);return P.createElement(lr.Provider,{value:f},r,y?P.createElement(rr,Au({},f)):null)};const ir=[{selector:".new-request-form-button",content:({goTo:e,inDOM:t})=>u.jsx("div",{children:"برای ثبت درخواست کشتار اینجا کلیک کنید."})},{selector:".slaughter-submited-requests",content:({goTo:e,inDOM:t})=>u.jsx("div",{children:"درخواست های ثبت شده خود را در این قسمت مشاهده می کنید."})},{selector:".slaughter-archived-requests",content:({goTo:e,inDOM:t})=>u.jsx("div",{children:"درخواست های بایگانی شده شما در این قسمت نمایش داده می شود."})}],J0=Lu("CHECK_REQUEST_BY_SLAUGHTER",async e=>{const{data:t,status:r}=await Su.post("kill_house_check_request/",e);return{data:t,status:r}});function L6({reqKey:e,poultryRequestKey:t}){const[r]=p.useContext(Q),[n,i]=p.useState(!1),A=lu(),{id:h}=y6(),[,,o,,c]=p.useContext(Q),y=_u({initialValues:{rejectText:""},validationSchema:fu({rejectText:bu().required("این فیلد اجباری است!").typeError("لطفا دلیل خود را بیان کنید.")})}),d=xu()==="ProvinceOperator"?"ثبت اطلاعات بجای کشتارگاه":"ثبت اطلاعات و ارسال به استان",s=xu()==="ProvinceOperator"?"رد اطلاعات بجای کشتارگاه":"رد اطلاعات و پیام به استان";return u.jsx(v,{children:u.jsx(v,{container:!0,gap:k.SMALL,padding:k.SMALL,children:u.jsx(we,{children:n?u.jsx(ue.div,{animate:{x:-10,opacity:1},transition:{duration:.3},initial:{opacity:0},exit:{opacity:0},children:u.jsxs(v,{flexDirection:"column",container:!0,gap:k.SMALL,children:[u.jsx(v,{children:u.jsx(N,{multiline:!0,rows:4,fullWidth:!0,id:"rejectText",label:"پیام خود را وارد کنید",variant:"outlined",value:y.values.rejectText,error:y.touched.rejectText?!!y.errors.rejectText:null,onChange:y.handleChange,onBlur:y.handleBlur,helperText:y.touched.rejectText&&y.errors.rejectText?y.errors.rejectText:null})}),u.jsxs(v,{container:!0,gap:k.SMALL,children:[u.jsx(v,{children:u.jsx(G,{variant:"outlined",color:"secondary",onClick:()=>{i(!1)},children:"لغو"})}),u.jsx(v,{children:u.jsx(G,{variant:"outlined",onClick:()=>{A(cu()),A(J0({message:y.values.rejectText,province_kill_request_key:e,state:"rejected"})).then(x=>{A(X()),x.error?r({vertical:"top",horizontal:"center",msg:"مشکلی پیش آمده است!",severity:"error"}):(A(hu({right:!1,bottom:!1,top:!1,content:null})),A(Ju({id:h})),i(!1),A(b0({key:t})),A(Mu({selectedDate1:o,selectedDate2:c})),r({vertical:"top",horizontal:"center",msg:"عملیات با موفقیت انجام شد.",severity:"success"}))})},children:"رد اطلاعات و پیام به استان"})})]})]})}):u.jsxs(v,{container:!0,gap:k.SMALL,children:[u.jsx(G,{variant:"outlined",color:"secondary",onClick:()=>{i(!0)},children:s}),u.jsx(G,{variant:"outlined",onClick:()=>{A(cu()),A(J0({province_kill_request_key:e,state:"accepted",role:xu()})).then(x=>{A(X()),x.error?r({vertical:"top",horizontal:"center",msg:"مشکلی پیش آمده است!",severity:"error"}):(A(hu({right:!1,bottom:!1,top:!1,content:null})),A(Ju({id:h})),A(b0({key:t})),A(Mu({selectedDate1:o,selectedDate2:c})),r({vertical:"top",horizontal:"center",msg:"عملیات با موفقیت انجام شد.",severity:"success"}),A(Iu({title:"عملیات با موفقیت انجام شد.",content:u.jsxs(v,{container:!0,direction:"column",gap:k.MEDIUM,alignItems:"center",justifyContent:"center",children:[u.jsx(v,{children:u.jsx(I,{color:"green",children:"پرونده به کارتابل (تخصیص خودرو) انتقال پیدا کرد."})}),u.jsx(v,{children:u.jsx(G,{variant:"contained",color:"success",onClick:()=>{A(Ru())},children:"تایید"})})]})})))})},children:d})]})})})})}L6.propTypes={reqKey:vu.PropTypes.string,poultryRequestKey:vu.PropTypes.string};const I6=({item:e})=>u.jsx(u.Fragment,{children:u.jsxs(r6,{sx:{alignSelf:"flex-start",width:"100%"},children:[u.jsxs(n6,{children:[u.jsx(a6,{color:"secondary"}),u.jsx(o6,{})]}),u.jsxs(v,{container:!0,direction:"column",flexWrap:"nowrap",flex:"1",children:[u.jsxs(v,{container:!0,children:[u.jsx(v,{children:u.jsx(l6,{variant:"body1",fontWeight:"bold",color:"secondary",children:"انجام عملیات"})}),u.jsx(v,{children:u.jsx(s6,{color:"textSecondary",children:u.jsx(I,{variant:"body2",children:"در این مرحله تخصیص را تایید یا رد کنید."})})})]}),u.jsx(v,{children:u.jsx(v,{container:!0,direction:"column",alignItems:"start",mt:k.TINY,children:u.jsx(L6,{reqKey:e.provinceKillReqKey,poultryRequestKey:e.poultryReqKey},e.provinceKillReqKey)},e.date.valueOf())})]})]})});I6.propTypes={item:vu.PropTypes.object,i:vu.PropTypes.any,poultryRequestKey:vu.PropTypes.any};const cr=()=>{const e=Vu(),[t,r]=p.useState([]),{slaughterActiveRequests:n}=Fu(s=>s.slaughterSlice),i=lu(),[,,A,h,o,c]=p.useContext(Q);p.useEffect(()=>{const s=J(new Date).format("YYYY-MM-DD");h(s),c(s)},[]),p.useEffect(()=>{i(Mu({selectedDate1:A,selectedDate2:o}))},[A,o]),p.useEffect(()=>{const s=n==null?void 0:n.filter(l=>l.provinceKillState==="pending"),x=s==null?void 0:s.map((l,E)=>[E+1,l.orderCode,l!=null&&l.freezing?"انجماد":l!=null&&l.export?"صادرات":"عادی",(l==null?void 0:l.freeSaleInProvince)===!1?"دولتی":"آزاد",Bu(new Date(l==null?void 0:l.sendDate),"yyyy/MM/dd"),`${l.poultryName} (${l.poultryMobile})`,`${l.killHouseName} (${l.killHouseMobile})`,l.city,l.province,l.age,l.mainQuantity.toLocaleString()+" قطعه",l.amount.toLocaleString()+" ﷼",l.chickenBreed,l.indexWeight+" کیلوگرم",u.jsx(ou,{color:"primary",onClick:()=>{i(hu({title:"انجام عملیات تخصیص",top:!(window.innerWidth<=600),bottom:window.innerWidth<=600,content:u.jsx(I6,{item:l,i:E})}))},children:u.jsx($u,{})},E),u.jsx(ou,{"aria-label":"delete",color:"primary",onClick:()=>e(Uu+l.poultryReqId),children:u.jsx(Nu,{})},E)]);r(x)},[n]);const[y]=p.useState(["ردیف","کد سفارش","کشتار","فروش","تاریخ درخواست","مرغدار","خریدار","شهر","استان","سن مرغ","تعداد","قیمت مرغ زنده","نژاد","میانگین وزن","عملیات","مشاهده"]),d=_u({initialValues:{capacity:"",recieveTime:"",recieveDate:J(Date()).format("YYYY-MM-DD hh:mm:ss")},validationSchema:fu({capacity:Tu().required("این فیلد اجباری است!").typeError("لطفا عدد وارد کنید!"),recieveTime:bu().required("این فیلد اجباری است!").typeError("لطفا وزن را وارد کنید!")})});return p.useEffect(()=>{d.validateForm()},[]),u.jsxs(W,{container:!0,direction:"column",gap:k.SMALL,mt:k.MEDIUM,children:[u.jsxs(W,{container:!0,alignItems:"center",gap:k.SMALL,children:[u.jsx(uu,{label:"از تاریخ",id:"date",renderInput:s=>u.jsx(N,{style:{width:"160px"},...s}),value:A,onChange:s=>{h(J(s).format("YYYY-MM-DD"))}}),u.jsx(uu,{label:"تا تاریخ",id:"date",renderInput:s=>u.jsx(N,{style:{width:"160px"},...s}),value:o,onChange:s=>{c(J(s).format("YYYY-MM-DD"))}})]}),u.jsx(Wu,{title:"درخواست های در انتظار تایید",columns:y,data:t,paginated:!0})]})},dr=()=>{const e=Fu(t=>t.userSlice.userPath);return e==="https://check.rasadyaar.ir"||e.includes("localhost")?"خرم آباد، مطهری، شرکت آرتامهر آرتان":e==="https://mabackend.rasadyar.com/"?"مرودشت، رو به روی شبکه دامپزشکی شهرستان اراک، اتحادیه مرغداران استان مرکزی":e==="https://arbackend.rasadyar.com/"?"آدرس : اردبیل، شهرک کارشناسان ،جنب ساختمان نظام مهندسی، ساختمان فرهنگ، طبقه دوم تلفن : 33749254 تلفاکس : 33749253 ":e==="https://habackend.rasadyar.com/"?"همدان، بلوار آیت اله مدنی، کوچه امامزاده یحیی یک تلفن: 081 32523689 ":e==="https://shabackend.rasadyar.com/"?"تبریز خیابان راه آهن نبش کوی اشکان ساختمان ۱۴ طبقه دوم تلفن: 041 34502363":e==="https://ghabackend.rasadyar.com/"?"آدرس استان آذربایجان غربی":e==="https://bubackend.rasadyar.com/"?"بوشهر، خيابان امام خمينی، جنب مديريت برق، ساختمان رضايي، طبقه 3":"آدرس تست"},K={page:{width:"210mm",margin:"0 auto",display:"flex",flexDirection:"column",position:"relative",direction:"rtl",fontFamily:"nazanin",fontWeight:"bold"},logo:{width:"60px",height:"auto",marginBottom:"10px"},contentContainer:{display:"flex",justifyContent:"space-between",marginTop:"20px",marginLeft:"20px",marginRight:"30px"},contentInLine:{display:"flex",flexDirection:"column",alignItems:"center"},mainTitle:{fontFamily:"nazanin",fontSize:11,pAlign:"center",fontWeight:"bolder"},watermarkContainer:{position:"fixed",top:450,left:0,right:30,bottom:0,justifyContent:"center",alignItems:"center",opacity:.2,zIndex:-1},watermarkp:{fontSize:100,fontWeight:"bolder",color:"grey",transform:"rotate(-45deg)",left:"50%"},title:{fontSize:12,fontWeight:"bolder",pAlign:"center"},titleTopic:{marginTop:"10px",fontSize:12,fontWeight:"bolder",pAlign:"center"},firsttitle:{fontSize:14,fontWeight:"bolder",marginLeft:"20px",pAlign:"center"},options:{padding:"10px",marginTop:"15px",display:"flex",flexDirection:"column",alignItems:"flex-start"},divider:{width:"100%",height:"2px",backgroundColor:"red",marginBottom:15},divider2:{width:"100%",height:"1px",background:"repeating-linear-gradient(90deg, transparent, transparent 5px, #f00 5px, #f00 10px)"},pTitleContainer:{margin:"15px",textAlign:"justify",textJustify:"inter-word",fontSize:"20px"},footer:{pageBreakAfter:"always",position:"fixed",left:0,bottom:0,width:"100%"},centerText:{fontSize:"20px",alignSelf:"center",textAlign:"center"},cutIcon:{zIndex:2,transform:"rotate(180deg)",opacity:"60%"}},m0=p.forwardRef((e,t)=>{const{date:r}=e,{amount:n}=e,{breeder:i}=e,{buyer:A}=e,h=w0(),o=dr();return u.jsxs("div",{style:K.page,ref:t,children:[u.jsxs("div",{style:K.contentContainer,children:[u.jsxs("div",{style:K.contentInLine,children:[u.jsx("img",{alt:"logo",src:_e,style:K.logo}),u.jsx("span",{style:K.mainTitle,children:"اتحادیه شرکتهاي تعاونی کشاورزي"}),u.jsxs("span",{style:K.title,children:["مرغداران "," "," ",h]}),u.jsx("span",{style:K.title,children:"ثبت : 5203 تاسیس : 1383"})]}),u.jsx("div",{children:u.jsx("span",{style:K.firsttitle,children:"بسمه تعالی"})}),u.jsxs("div",{style:K.options,children:[u.jsx("span",{style:K.title,children:"شماره: "}),u.jsxs("span",{style:K.titleTopic,children:["تاریخ: ",iu(r)]})]})]}),u.jsx("div",{style:K.watermarkContainer,children:u.jsx("p",{style:K.watermarkp,children:"سامانه رصدیار "})}),u.jsx("hr",{style:K.divider}),u.jsx("p",{style:K.centerText,children:u.jsx("strong",{children:"تاییدیه خریدار"})}),u.jsxs("p",{style:K.pTitleContainer,children:["این حواله در تاریخ "," "," ",iu(r)," جهت بارگیري تعداد"," ",n.toLocaleString()," قطعه مرغ زنده تحویل مرغداري ",i," گردید.",u.jsx("br",{}),u.jsx("br",{}),u.jsx("br",{})]}),u.jsx("span",{style:K.centerText,children:u.jsx("span",{style:K.centerText,children:u.jsxs("strong",{children:["امضا خریدار آقا/خانم ",A]})})}),u.jsx("br",{}),u.jsx("br",{}),u.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",justifyItems:"center",marginBottom:15},children:[u.jsx(W0,{style:K.cutIcon}),u.jsx("div",{style:K.divider2})]}),u.jsxs("p",{style:K.pTitleContainer,children:["مطابق برگ باسکول پیوستی، خروج تعداد ",n.toLocaleString()," قطعه به وزن ......................... کیلوگرم در تاریخ "," ",iu(r)," از مرغداري آقا/خانم"," ",i," "," مورد تایید اینجانب می باشد.",u.jsx("br",{}),u.jsx("br",{}),u.jsx("br",{})]}),u.jsx("span",{style:K.centerText,children:u.jsxs("strong",{children:["امضا خریدار آقا/خانم ",A]})}),u.jsx("br",{}),u.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",justifyItems:"center",marginBottom:15},children:[u.jsx(W0,{style:K.cutIcon}),u.jsx("div",{style:K.divider2})]}),u.jsx("p",{style:K.centerText,children:u.jsx("strong",{children:"تاییدیه مرغداری"})}),u.jsxs("p",{style:K.pTitleContainer,children:["مطابق برگ باسکول پیوستی، خروج تعداد ",n.toLocaleString()," قطعه به وزن ......................... کیلوگرم توسط آقا/خانم "," ",A," "," مورد تائید اینجانب "," ",i," "," مالک / نماینده قانونی مرغداری "," ",i," "," باشد."]}),u.jsx("br",{}),u.jsx("span",{style:K.centerText,children:u.jsxs("strong",{children:["مهر و امضا ",i," "," "," ","اثر انگشت"]})}),u.jsx("br",{}),u.jsxs("div",{style:K.footer,children:[u.jsx("div",{style:K.divider}),u.jsx("p",{style:{fontSize:13,padding:"10px",marginRight:"10px"},children:o})]})]})});m0.displayName="SlaughterSendKillerInvoice";m0.propTypes={item:vu.PropTypes.any};const Cr=Lu("SLAUGHTER_EDIT_CHICKEN_PRICE_SERVICE",async(e,{dispatch:t})=>{t(cu());try{const{data:r,status:n}=await Su.put("province_kill_request/0/",e);return t(X()),{data:r,status:n}}catch(r){return t(X()),{error:r.response.data.result}}}),M6=({fetchData:e,item:t})=>{const r=lu(),[n]=p.useContext(Q),i=_u({initialValues:{chickenPrice:""},validationSchema:fu({chickenPrice:Tu().required("این فیلد اجباری است!").positive("مقدار مثبت وارد کنید!").typeError("لطفا عدد وارد کنید!").min(t!=null&&t.freeSaleInProvince?4e5:(t==null?void 0:t.amount)/100*40,t!=null&&t.freeSaleInProvince?"حداقل قیمت قابل ثبت چهل هزار تومان است!":"اختلاف قیمت وارد شده و قیمت مرغدار باید کمتر از شصت درصد باشد!").max(t!=null&&t.freeSaleInProvince?2e6:(t==null?void 0:t.amount)/100*60+(t==null?void 0:t.amount),t!=null&&t.freeSaleInProvince?"قیمت متعارف وارد کنید!":"اختلاف قیمت وارد شده و قیمت مرغدار باید کمتر از شصت درصد باشد!")}),onSubmit:A=>{r(Cr({province_kill_request_key:t==null?void 0:t.provinceKillReqKey,kill_house_price:A.chickenPrice,role:xu()})).then(h=>{h.payload.error?n({vertical:"top",horizontal:"center",msg:h.payload.error,severity:"error"}):(n({vertical:"top",horizontal:"center",msg:"عملیات با موفقیت انجام شد.",severity:"success"}),r(Ru()),e())})}});return u.jsxs("form",{onSubmit:i.handleSubmit,children:[u.jsx(I,{variant:"body1",color:"primary",mb:1,children:"اطلاعات سفارش"}),u.jsx(N6,{style:{width:"100%"}}),u.jsxs(v,{container:!0,xs:12,gap:1,mt:1,children:[u.jsx(I,{variant:"body2",style:{color:"gray"},children:"نام مرغدار:"}),u.jsx(I,{variant:"body2",color:"primary",children:`${t.poultryName} (${t.poultryMobile})`})]}),u.jsxs(v,{container:!0,xs:12,gap:1,children:[u.jsx(I,{variant:"body2",style:{color:"gray"},children:"قیمت مرغدار:"}),u.jsx(I,{variant:"body2",color:"primary",children:t.amount.toLocaleString()+" ﷼"})]}),u.jsxs(v,{container:!0,xs:12,gap:1,children:[u.jsx(I,{variant:"body2",style:{color:"gray"},children:"میانگین وزنی:"}),u.jsx(I,{variant:"body2",color:"primary",children:(t==null?void 0:t.indexWeight)+" کیلوگرم"})]}),u.jsxs(v,{container:!0,xs:12,gap:1,children:[u.jsx(I,{variant:"body2",style:{color:"gray"},children:"حجم تخصیص:"}),u.jsx(I,{variant:"body2",color:"primary",children:t.mainQuantity.toLocaleString()+" قطعه"})]}),u.jsx(N,{style:{minWidth:"350px"},fullWidth:!0,id:"chickenPrice",name:"chickenPrice",label:"قیمت خرید هر کیلو مرغ زنده را ثبت کنید",value:i.values.chickenPrice,onChange:i.handleChange,error:i.touched.chickenPrice&&!!i.errors.chickenPrice,helperText:i.touched.chickenPrice&&i.errors.chickenPrice,margin:"normal"}),u.jsx(G,{color:"primary",variant:"contained",fullWidth:!0,type:"submit",children:"ثبت"})]})};var T0={},hr=$6;Object.defineProperty(T0,"__esModule",{value:!0});var B6=T0.default=void 0,pr=hr(ee()),Ar=u;B6=T0.default=(0,pr.default)((0,Ar.jsx)("path",{d:"M14 12c0-1.1-.9-2-2-2s-2 .9-2 2 .9 2 2 2 2-.9 2-2m-2-9c-4.97 0-9 4.03-9 9H0l4 4 4-4H5c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.51 0-2.91-.49-4.06-1.3l-1.42 1.44C8.04 20.3 9.94 21 12 21c4.97 0 9-4.03 9-9s-4.03-9-9-9"}),"SettingsBackupRestore");const fr=Lu("SLAUGHTER_DELETE_ALLOCATED_BACK_KILL_REQUEST_SERVICE",async(e,{dispatch:t})=>{t(cu());try{const{data:r,status:n}=await Su.delete(`province_kill_request/0/?return_allocation_quantity=true&province_kill_request_key=${e.provinceKillRequestKey}`,e);return t(X()),{data:r,status:n}}catch(r){return t(X()),{error:r.response.data.result}}}),xr=Lu("SLAUGHTER_REMOVE_ALLOCATE_CAR_SERVICE",async(e,{dispatch:t})=>{t(cu());try{const{data:r,status:n}=await Su.delete("kill_house_request/0/",{params:{kill_house_request_key:e}});return t(X()),{data:r,status:n}}catch(r){return t(X()),{error:r.response.data.result}}}),gr=Lu("SLAUGHTER_EDIT_ALLOCATED_CAR_SERVICE",async(e,{dispatch:t})=>{var r,n;t(cu());try{const{data:i,status:A}=await Su.put("kill_house_requests/0/",e);return t(X()),{data:i,status:A}}catch(i){return t(X()),{error:((n=(r=i.response)==null?void 0:r.data)==null?void 0:n.result)||i.message}}}),H6=(e,t,r)=>{const n=lu(),[i,A]=p.useState([]);return p.useEffect(()=>{e?n(P0({id:e,killHouseKey:t,killRequestKey:r})).then(h=>A(h.payload.data)):n(P0()).then(h=>A(h.payload.data))},[]),i||[]},O6=({item:e,updateTable:t,poultryRequestKey:r,killHouseKey:n,killRequestKey:i})=>{const A=lu(),[h]=p.useContext(Q),o=H6(r,n,i),c=_u({initialValues:{car:null,trafficCode:(e==null?void 0:e.trafficCode)||"",amount:(e==null?void 0:e.barAmount)||""},validationSchema:fu({car:fu().nullable(),trafficCode:bu(),amount:Tu().positive("قیمت باید عدد مثبت باشد").nullable()})});p.useEffect(()=>{c.validateForm()},[]),p.useEffect(()=>{if(o&&e){const d=o.find(s=>s.key===e.carKey);d&&c.setFieldValue("car",d)}},[o,e]);const y=()=>{var s;if(!c.values.car&&!c.values.trafficCode&&!c.values.amount){h({vertical:"top",horizontal:"center",msg:"لطفا حداقل یکی از فیلدها را پر کنید",severity:"error"});return}const d={key:e==null?void 0:e.killHouseRequestKey};c.values.car||c.values.trafficCode?((s=c.values.car)!=null&&s.key&&c.values.car.key!==(e==null?void 0:e.carKey)&&(d.car_key=c.values.car.key),c.values.trafficCode&&c.values.trafficCode!==(e==null?void 0:e.trafficCode)&&(d.traffic_code=c.values.trafficCode),c.values.amount&&c.values.amount!==(e==null?void 0:e.barAmount)&&(d.amount=c.values.amount)):c.values.amount&&(d.amount=c.values.amount),A(gr(d)).then(x=>{var l;(l=x.payload)!=null&&l.error?h({vertical:"top",horizontal:"center",msg:x.payload.error,severity:"error"}):(h({vertical:"top",horizontal:"center",msg:"ویرایش با موفقیت انجام شد",severity:"success"}),A(Ru()),t&&t())})};return u.jsxs(v,{container:!0,direction:"column",gap:k.SMALL,sx:{width:{xs:"300px",md:"400px"},p:2},children:[u.jsxs(wu,{fullWidth:!0,children:[u.jsx(Pu,{options:o||[],getOptionLabel:d=>{if(d){const s=d.type==="exclusive"?"اختصاصی":"اجاره ای";return`${d.driverName} (${d.driverMobile}) ${d.typeCar} پلاک ${d.pelak} (${s})`}return""},value:c.values.car,onChange:(d,s)=>{c.setFieldValue("car",s),s!=null&&s.healthCode&&c.setFieldValue("trafficCode",s.healthCode)},onBlur:c.handleBlur,renderInput:d=>u.jsx(N,{...d,label:"انتخاب خودرو و راننده (اختیاری)",error:c.touched.car?!!c.errors.car:null})}),u.jsx(Xu,{children:c.touched.car&&c.errors.car?c.errors.car:null})]}),u.jsx(wu,{fullWidth:!0,children:u.jsx(N,{id:"trafficCode",label:"کد حمل و نقل (اختیاری)",value:c.values.trafficCode,error:c.touched.trafficCode?!!c.errors.trafficCode:null,onChange:c.handleChange,onBlur:c.handleBlur,helperText:c.touched.trafficCode&&c.errors.trafficCode?c.errors.trafficCode:null,variant:"outlined"})}),u.jsx(wu,{fullWidth:!0,children:u.jsx(N,{id:"amount",name:"amount",label:"قیمت (اختیاری)",type:"number",value:c.values.amount,error:c.touched.amount?!!c.errors.amount:null,onChange:c.handleChange,onBlur:c.handleBlur,helperText:c.touched.amount&&c.errors.amount?c.errors.amount:null,variant:"outlined"})}),u.jsx(G,{variant:"contained",color:"primary",onClick:y,disabled:!c.values.car&&!c.values.trafficCode&&!c.values.amount,fullWidth:!0,children:"ثبت تغییرات"})]})};O6.propTypes={item:vu.PropTypes.object.isRequired,updateTable:vu.PropTypes.func,poultryRequestKey:vu.PropTypes.string,killHouseKey:vu.PropTypes.string,killRequestKey:vu.PropTypes.string};const yr=Lu("POST_SLAUGHTER_CAR_ALLOCATION",async(e,{dispatch:t})=>{try{const{data:r,status:n}=await Su.post("kill_house_request/",e);return t(cu()),{data:r,status:n}}catch(r){return t(X()),{error:r.response.data.result}}}),q6=({poultryRequestKey:e,provinceAllocationLimit:t,killRequestKey:r,killHouseKey:n,killHouseCheckKey:i,indexWeight:A,item:h})=>{const o={},[c]=p.useContext(Q),y=H6(e,n,r),[,,d,,s]=p.useContext(Q),[x,l]=p.useState(!1),E=()=>{m(Te()).then(g=>{l(g.payload.data)})};p.useEffect(()=>{E()},[]);const{id:w}=y6(),T=xu()==="ProvinceOperator"?"ثبت اطلاعات خودرو بجای کشتارگاه":"ثبت اطلاعات خودرو",S=()=>x!=null&&x.allow?x==null?void 0:x.limitation:3100,m=lu(),f=_u({initialValues:{quantity:"",car:"",realCar:"",shippingCode:""},validationSchema:fu({quantity:Tu().typeError("لطفا ظرفیت را به عدد وارد کنید!").required("این فیلد اجباری است!").min(1,"یک مقدار مجاز وارد کنید!").max(S(),`حداکثر میزان تخصیص به ماشین ${S()} قطعه میباشد`),shippingCode:bu().required("این فیلد اجباری است!"),car:fu().required("این فیلد اجباری است!"),realCar:fu()})});p.useEffect(()=>{f.validateForm()},[]),p.useEffect(()=>{o.killHouseWinner&&f.setFieldValue("selectedRequest","not required")},[]),p.useEffect(()=>{o.killHouseWinner&&f.setFieldValue("selectedRequest","not required")},[]);const[Y]=p.useState(!1),[H,_]=p.useState(),[a,C]=p.useState();p.useEffect(()=>{h!=null&&h.exclusiveKiller&&m(Ie()).then(g=>{_(g.payload.data)})},[]);const L=g=>{C(g==null?void 0:g.target.value)},b=()=>H&&H.length>0?a&&f.isValid:f.isValid;return u.jsx(u.Fragment,{children:u.jsxs(r6,{sx:{alignSelf:"flex-start",width:"100%"},children:[u.jsxs(n6,{children:[u.jsx(a6,{color:"secondary"}),u.jsx(o6,{})]}),u.jsxs(v,{container:!0,direction:"column",flexWrap:"nowrap",flex:"1",children:[u.jsxs(v,{container:!0,children:[u.jsx(v,{children:u.jsx(l6,{variant:"body1",fontWeight:"bold",color:"secondary",children:"انجام عملیات"})}),u.jsx(v,{children:u.jsx(s6,{color:"textSecondary",children:u.jsx(I,{variant:"body2"})})})]}),u.jsx(v,{container:!0,justifyContent:"space-between",children:u.jsxs(v,{container:!0,alignItems:"start",direction:"column",gap:k.SMALL,mt:k.SMALL,children:[u.jsxs(v,{container:!0,gap:k.SMALL,children:[u.jsx(v,{xs:12,children:u.jsx(I,{sx:{fontSize:"12px"},color:"secondary",children:"خودرو دارای کد بهداشتی حمل"})}),u.jsxs(v,{container:!0,direction:"column",alignItems:"start",children:[u.jsxs(wu,{sx:{width:"300px"},children:[u.jsx(Pu,{options:y||[],getOptionLabel:g=>{if(g){const D=g.type==="exclusive"?"اختصاصی":"اجاره ای";return`${g.driverName} (${g.driverMobile}) ${g.typeCar} پلاک ${g.pelak} (${D})`}return""},value:f.values.car,onChange:(g,D)=>{f.setFieldValue("car",D),f.setFieldValue("shippingCode",D?D.healthCode:"")},onBlur:f.handleBlur,renderInput:g=>u.jsx(N,{...g,label:"انتخاب خودرو و راننده",error:f.touched.car?!!f.errors.car:null})}),u.jsx(Xu,{children:f.touched.car&&f.errors.car?f.errors.car:null})]}),Y&&u.jsxs(wu,{sx:{width:"300px"},children:[u.jsx(Pu,{options:y||[],getOptionLabel:g=>{if(g){const D=g.type==="exclusive"?"اختصاصی":"اجاره ای";return`${g.driverName} (${g.driverMobile}) ${g.typeCar} پلاک ${g.pelak} ظرفیت ${g.capocity} قطعه (${D})`}return""},value:f.values.realCar,onChange:(g,D)=>{f.setFieldValue("realCar",D)},onBlur:f.handleBlur,renderInput:g=>u.jsx(N,{...g,label:"انتخاب خودرو و راننده",error:f.touched.car?!!f.errors.realCar:null})}),u.jsx(Xu,{children:f.touched.realCar&&f.errors.realCar?f.errors.realCar:null})]}),(H==null?void 0:H.length)>0&&u.jsxs(u.Fragment,{children:[u.jsx(v,{xs:12,children:u.jsx(I,{sx:{fontSize:"12px"},color:"red",mb:1,mt:1,children:"انتخاب کشتارکن جهت تخصیص"})}),u.jsxs(wu,{children:[u.jsx(Ou,{id:"demo-simple-select-label",children:"انتخاب کشتارکن (اجباری)"}),u.jsx(qu,{label:"کشتارکن",value:a,onChange:L,children:H==null?void 0:H.map((g,D)=>u.jsx(Cu,{value:g==null?void 0:g.key,children:g==null?void 0:g.name},D))})]})]}),u.jsx(v,{container:!0,textAlign:"start",direction:"column",mt:k.TINY,children:y.filter(g=>g.busy).map((g,D)=>{const $=`راننده ${g.driverName} ${g.typeCar} با پلاک ${g.pelak} جهت حمل بار کشتارگاه دیگری رزرو شده است.`;return u.jsx(v,{children:u.jsx(I,{variant:"caption",children:$})},"car"+D)})})]}),u.jsx(v,{children:u.jsx(N,{allowLeadingZeros:!0,thousandSeparator:",",id:"shippingCode",label:"کد بهداشتی حمل و نقل",value:f.values.shippingCode,error:f.touched.shippingCode?!!f.errors.shippingCode:null,onChange:f.handleChange,onBlur:f.handleBlur,helperText:f.touched.shippingCode&&f.errors.shippingCode?f.errors.shippingCode:null,variant:"outlined"})}),u.jsxs(v,{children:[u.jsx(N,{allowLeadingZeros:!0,thousandSeparator:",",id:"quantity",label:"ظرفیت (قطعه)",value:f.values.quantity,error:f.touched.quantity?!!f.errors.quantity:null,onChange:f.handleChange,onBlur:f.handleBlur,helperText:f.touched.quantity&&f.errors.quantity?f.errors.quantity:null,autoComplete:"current-password",variant:"outlined"}),u.jsxs(v,{container:!0,mt:k.TINY,gap:k.TINY,alignItems:"center",children:[u.jsx(I,{color:g=>g.palette.grey.A700,variant:"caption",children:"ظرفیت مجاز ماشین:"}),u.jsxs(I,{variant:"button",children:[S()," قطعه"]})]}),u.jsxs(v,{container:!0,mt:k.TINY,gap:k.TINY,alignItems:"center",children:[u.jsx(I,{color:g=>g.palette.grey.A700,variant:"caption",children:"باقی مانده:"}),u.jsxs(I,{variant:"button",children:[t-Number(f.values.quantity)>=0?t-Number(f.values.quantity):0," ","قطعه"]})]}),u.jsxs(v,{container:!0,mt:k.TINY,gap:k.TINY,alignItems:"center",children:[u.jsx(I,{color:g=>g.palette.grey.A700,variant:"caption",children:"مازاد:"}),u.jsxs(I,{variant:"button",children:[Number(f.values.quantity)>t?Math.abs(Number(f.values.quantity)-t):0," ","قطعه"]})]}),u.jsxs(v,{container:!0,mt:k.TINY,gap:k.TINY,alignItems:"center",children:[u.jsx(I,{color:g=>g.palette.grey.A700,variant:"caption",children:"وزن تقریبی هرقطعه مرغ:"}),u.jsxs(I,{variant:"button",children:[A.toLocaleString()," کیلوگرم"]})]})]}),u.jsx(v,{container:!0,alignItems:"start",gap:k.SMALL,children:u.jsxs(v,{container:!0,mt:k.TINY,gap:k.TINY,alignItems:"center",children:[u.jsx(I,{color:g=>g.palette.grey.A700,children:"="}),u.jsx(I,{color:g=>g.palette.grey.A700,variant:"caption",children:"وزن تقریبی بار:"}),u.jsxs(I,{variant:"button",children:[(Number(f.values.quantity)*A).toLocaleString()," ","کیلوگرم"]})]})})]}),u.jsx(v,{container:!0,children:u.jsx(G,{size:"large",variant:"contained",disabled:!b(),onClick:()=>{m(cu());let g={};o.killHouseWinner?g={winner_key:o.killHouseWinner.killHouseWinnerKey,quantity:Number(f.values.quantity),killer_key:a||null,car:{id:f.values.car.id,key:f.values.car.key,driver_name:f.values.car.driverName,driver_mobile:f.values.car.driverMobile,name:f.values.car.name,type_car:f.values.car.typeCar,type_weight:f.values.car.typeWeight,pelak:f.values.car.pelak,capocity:f.values.car.capocity,weight_without_load:f.values.car.weightWithoutLoad,health_code:f.values.car.helathCode}}:g={killer_key:a||null,kill_house_check_key:i,quantity:Number(f.values.quantity),traffic_code:f.values.shippingCode,real_car_key:f.values.realCar.key,role:xu(),car:{id:f.values.car.id,key:f.values.car.key,driver_name:f.values.car.driverName,driver_mobile:f.values.car.driverMobile,name:f.values.car.name,type_car:f.values.car.typeCar,type_weight:f.values.car.typeWeight,pelak:f.values.car.pelak,capocity:f.values.car.capocity,weight_without_load:f.values.car.weightWithoutLoad,health_code:f.values.car.helathCode}},m(yr(g)).then(D=>{m(X()),D.payload.error?c({vertical:"top",horizontal:"center",msg:D.payload.error,severity:"error"}):(m(X()),m(Mu({isCar:!0,selectedDate1:d,selectedDate2:s})),m(u0({selectedDate1:d,selectedDate2:s})),m(Ju({id:w})),m(b0({key:e})),m(Ju()),m(hu({right:!1,bottom:!1,top:!1,content:null})),c({vertical:"top",horizontal:"center",msg:"عملیات با موفقیت انجام شد.",severity:"success"}))})},children:T})})]})})]})]})})};q6.propTypes={file:vu.PropTypes.object,provinceAllocationLimit:vu.PropTypes.any};const u6=({item:e,updateTable:t,isAllocatedCar:r=!1,selectedDate1:n,selectedDate2:i,submitStatus:A})=>{const[h,o]=p.useState(null),[c,,y,,d]=p.useContext(Q),s=lu(),x=n||y,l=i||d,E=g=>{o(g.currentTarget)},w=()=>{o(null)},T=Vu(),S=!!h,m=S?"popover":void 0,f=()=>{s(xr(e.killHouseRequestKey)).then(g=>{var D;(D=g.payload)!=null&&D.error?c({vertical:"top",horizontal:"center",msg:g.payload.error,severity:"error"}):(c({vertical:"top",horizontal:"center",msg:"عملیات با موفقیت انجام شد.",severity:"success"}),s(Ru()),s(Mu({isCar:!0,selectedDate1:x,selectedDate2:l})),s(u0({selectedDate1:x,selectedDate2:l})),t&&t())})},Y=()=>{w(),s(Iu({title:"تایید حذف",content:u.jsxs(v,{container:!0,direction:"column",gap:k.SMALL,sx:{p:2,minWidth:"300px"},children:[u.jsx(I,{variant:"body1",children:"آیا از حذف تخصیص این خودرو اطمینان دارید؟"}),u.jsxs(v,{container:!0,gap:k.SMALL,justifyContent:"space-between",xs:12,children:[u.jsx(G,{variant:"outlined",color:"secondary",onClick:()=>s(Ru()),children:"انصراف"}),u.jsx(G,{variant:"contained",color:"error",onClick:f,children:"حذف"})]})]})}))},H=()=>{s(Iu({title:"ویرایش خودرو و کد حمل",content:u.jsx(O6,{item:e,updateTable:()=>{s(Mu({isCar:!0,selectedDate1:x,selectedDate2:l})),s(u0({selectedDate1:x,selectedDate2:l})),t&&t()},poultryRequestKey:e==null?void 0:e.poultryReqKey,killHouseKey:e==null?void 0:e.killHouseKey,killRequestKey:e==null?void 0:e.killRequestKey})})),w()},_=()=>{T(Uu+e.poultryReqId)},a=()=>{s(fr({provinceKillRequestKey:e==null?void 0:e.provinceKillRequestKey,returnAllocationQuantity:!0})).then(g=>{g.error?c({vertical:"top",horizontal:"center",msg:g.error,severity:"error"}):(t&&t(),c({vertical:"top",horizontal:"center",msg:"عملیات برگشت تخصیص با موفقیت انجام شد.",severity:"success"}))})},C=()=>{A===!0&&(e==null?void 0:e.killHousePrice)===0?s(Iu({title:"ثبت قیمت مرغ زنده",content:u.jsx(M6,{item:e,fetchData:t})})):s(hu({title:"انجام عملیات تخصیص",top:!(window.innerWidth<=600),bottom:window.innerWidth<=600,content:u.jsx(q6,{indexWeight:e.indexWeight,killHouseName:e.killHouseName,killHouseCheckKey:e.killHouseCheckKey,killHouseKey:e.killHouseKey,killRequestKey:e.killRequestKey,poultryRequestKey:e.poultryReqKey,provinceAllocationLimit:e.remainQuantity||0,item:e})}))},L=[];if(!r){const g=A===!0&&((e==null?void 0:e.killHousePrice)||0)===0;L.push({key:"register",label:"ثبت خودرو",color:g?"error.main":"primary.main",icon:Le,action:C}),L.push({key:"viewFile",label:"مشاهده پرونده",color:"primary.main",icon:Nu,action:_});const D=(e==null?void 0:e.allocatedQuantity)>0;L.push({key:"return",label:"برگشت تخصیص",color:D?"text.disabled":"warning.main",icon:B6,action:a,disabled:D})}r&&(L.push({key:"editAllocated",label:"ویرایش خودرو و کد حمل",color:"info.main",icon:$u,action:H}),L.push({key:"deleteAllocated",label:"حذف تخصیص خودرو",color:"error.main",icon:o0,action:Y}));const b=g=>{g.disabled||(w(),g.action())};return u.jsxs(v,{container:!0,children:[u.jsx(ou,{size:"small","aria-describedby":m,variant:"contained",color:"primary",onClick:E,children:u.jsx(F6,{})}),u.jsx(i6,{anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"left"},id:m,open:S,anchorEl:h,onClose:w,children:u.jsx(z6,{sx:{minWidth:150,p:.5},children:L.map(g=>{const D=g.icon,$=g.disabled?"text.disabled":g.color;return u.jsxs(K6,{disabled:g.disabled,onClick:()=>b(g),sx:{borderRadius:1,mb:.25,py:.5,"&:last-of-type":{mb:0}},children:[u.jsx(e6,{sx:{color:$,minWidth:32},children:u.jsx(D,{fontSize:"small"})}),u.jsx(t6,{primary:g.label,primaryTypographyProps:{sx:{color:$,fontSize:"0.82rem",fontWeight:600}}})]},g.key)})})})]})},vr=()=>{const e=p.useRef(),[t,r]=p.useState(),[n,i]=p.useState([]),[A,h]=p.useState([]),{slaughterActiveRequests:o,slaughterGetAllocatedCars:c}=Fu(a=>a.slaughterSlice),y=w0(),d=lu(),[,,s,x,l,E]=p.useContext(Q),[w,T]=p.useState(),S=()=>{d(Mu({isCar:!0,selectedDate1:s,selectedDate2:l})),d(u0({selectedDate1:s,selectedDate2:l})),d(Re()).then(a=>{T(a.payload.data.allow)})};p.useEffect(()=>{S()},[s,l]);const m=p6.useReactToPrint({content:()=>e.current,documentTitle:"حواله خرید"}),f=()=>{S()},Y=a=>{r(a)};p.useEffect(()=>{const a=o==null?void 0:o.map((C,L)=>{var b;return[L+1,C.orderCode,C!=null&&C.freezing?"انجماد":C!=null&&C.export?"صادرات":"عادی",C!=null&&C.freeSaleInProvince?"آزاد":"دولتی",C!=null&&C.directBuying?"خرید مستقیم":"اتحادیه",Bu(new Date(C==null?void 0:C.sendDate),"yyyy/MM/dd"),`${C.poultryName} (${C.poultryMobile})`,`${C.killHouseName} (${C.killHouseMobile})`,`${C.province}/${C.city}`,C.age,C.indexWeight,C==null?void 0:C.totalWeight.toLocaleString(),C.mainQuantity.toLocaleString()+" قطعه",C.amount.toLocaleString()+" ﷼",C.allocatedQuantity.toLocaleString()+" قطعه",C.remainQuantity.toLocaleString()+" قطعه",(C==null?void 0:C.killHousePrice)>0?u.jsxs(W,{container:!0,alignItems:"center",gap:1,children:[((b=C==null?void 0:C.killHousePrice)==null?void 0:b.toLocaleString())+" ریال",iu(C==null?void 0:C.sendDate)===iu(new Date)?u.jsx(ou,{size:"small",color:"primary",onClick:()=>{d(Iu({title:"ویرایش قیمت مرغ زنده",content:u.jsx(M6,{item:C,fetchData:S})}))},children:u.jsx($u,{fontSize:"small"})}):null]},L):u.jsx("span",{children:"0"},L),u.jsx(u6,{updateTable:f,item:C,submitStatus:w},L)]});i(a)},[o,w]),p.useEffect(()=>{const a=c==null?void 0:c.filter(C=>C.vetState==="pending").map((C,L)=>{var b,g,D,$;return[L+1,C==null?void 0:C.orderCode,C==null?void 0:C.barcod,C!=null&&C.freezing?"انجماد":C!=null&&C.export?"صادرات":"عادی",C!=null&&C.freeSaleInProvince?"آزاد":"دولتی",iu(C==null?void 0:C.sendDate),A6(C==null?void 0:C.killHouseCreateDate),`${C==null?void 0:C.poultryName} (${C.poultryMobile})`,`${C==null?void 0:C.killHouseName} (${C.killHouseMobile})`,C!=null&&C.killer?`${(b=C==null?void 0:C.killer)==null?void 0:b.killerName} (${(g=C==null?void 0:C.killer)==null?void 0:g.killerMobile})`:"-",C==null?void 0:C.driverName,C==null?void 0:C.typeCar,C==null?void 0:C.pelak,(C==null?void 0:C.acceptedRealQuantity.toLocaleString())+" قطعه",C==null?void 0:C.acceptedRealWeight.toLocaleString(),((D=C==null?void 0:C.amount)==null?void 0:D.toLocaleString())+" ﷼",C==null?void 0:C.trafficCode,(($=C==null?void 0:C.barAmount)==null?void 0:$.toLocaleString())+" ﷼",u.jsxs(W,{container:!0,gap:1,children:[u.jsx(u6,{item:C,updateTable:f,isAllocatedCar:!0,selectedDate1:s,selectedDate2:l},L),y==="استان اردبیل"?u.jsx(Yu,{title:"خروجی PDF",children:u.jsx(ou,{onClick:()=>{m(),Y(C)},size:"large","aria-label":"pdf",color:"success",children:u.jsx(v6,{})})}):null]},L)]});h(a)},[c]);const[H]=p.useState(["ردیف","کد سفارش","کشتار","فروش","درخواست","تاریخ کشتار","مرغدار","خریدار","استان/شهر","سن","میانگین وزن","وزن کل (کیلوگرم)","تعداد","قیمت مرغدار","تخصیص به خودرو","مانده قابل تخصیص","قیمت کشتارگاه","عملیات"]),_=_u({initialValues:{capacity:"",recieveTime:"",recieveDate:J(Date()).format("YYYY-MM-DD hh:mm:ss")},validationSchema:fu({capacity:Tu().required("این فیلد اجباری است!").typeError("لطفا عدد وارد کنید!"),recieveTime:bu().required("این فیلد اجباری است!").typeError("لطفا وزن را وارد کنید!")})});return p.useEffect(()=>{_.validateForm()},[]),u.jsxs(W,{container:!0,alignItems:"center",justifyContent:"space-between",gap:k.SMALL,mt:k.MEDIUM,children:[t&&u.jsx("div",{style:{visibility:"hidden",position:"absolute"},children:u.jsx(m0,{ref:e,date:s,amount:t==null?void 0:t.quantity,breeder:t==null?void 0:t.poultryName,buyer:t==null?void 0:t.killHouseName})}),u.jsxs(W,{container:!0,alignItems:"center",gap:k.SMALL,children:[u.jsx(W,{children:u.jsx(uu,{label:"از تاریخ",id:"date",renderInput:a=>u.jsx(N,{style:{width:"160px"},...a}),value:s,onChange:a=>{x(J(a).format("YYYY-MM-DD"))}})}),u.jsx(W,{children:u.jsx(uu,{label:"تا تاریخ",id:"date",renderInput:a=>u.jsx(N,{style:{width:"160px"},...a}),value:l,onChange:a=>{E(J(a).format("YYYY-MM-DD"))}})})]}),u.jsx(Wu,{paginated:!0,title:"در انتظار تخصیص خودرو",columns:H,data:n}),u.jsx(Wu,{title:"خودروهای تخصیص داده شده",paginated:!0,columns:["ردیف","کد سفارش","کد بار","کشتار","فروش","تاریخ کشتار","تاریخ ثبت خودرو","مرغدار","خریدار","کشتارکن اختصاصی","راننده","ماشین","پلاک","تعداد","وزن (کیلوگرم)","قیمت مرغ زنده","کد حمل و نقل","قیمت مرغ زنده‌ی بار","عملیات"],data:A})]})},M={page:{width:"210mm",margin:"0 auto",display:"flex",flexDirection:"column",position:"relative",direction:"rtl",fontFamily:"nazanin",fontWeight:"bold"},container:{width:"95%",alignSelf:"center",pageBreakInside:"avoid"},invoiceTable:{width:"100%",borderCollapse:"collapse",alignSelf:"center",marginBottom:"2px"},tableCell:{border:"1px solid #000",pAlign:"left",textAlign:"center",fontSize:11},tableHeader:{backgroundColor:"rgba(211, 211, 211, 0.3)",pageBreakAfter:"auto"},headerRow:{backgroundColor:"rgba(211, 211, 211, 0.3)",color:"black",pageBreakInside:"avoid",pageBreakAfter:"auto"},logo:{width:"60px",height:"auto",marginBottom:"10px"},contentContainer:{display:"flex",justifyContent:"space-between",marginTop:"20px",marginLeft:"100px",marginRight:"30px"},contentInLine:{display:"flex",flexDirection:"column",alignItems:"center"},mainTitle:{fontFamily:"nazanin",fontSize:11,pAlign:"center",fontWeight:"bolder"},signature:{display:"flex",flexDirection:"column",alignItems:"flex-end",marginLeft:"20px"},watermarkContainer:{position:"fixed",top:450,left:0,right:30,bottom:0,justifyContent:"center",alignItems:"center",opacity:.2,zIndex:-1},watermarkp:{fontSize:100,fontWeight:"bolder",color:"grey",transform:"rotate(-45deg)",left:"50%"},title:{fontSize:12,fontWeight:"bolder",pAlign:"center"},titleTopic:{marginTop:"10px",fontSize:12,fontWeight:"bolder",pAlign:"center"},firsttitle:{fontSize:14,fontWeight:"bolder",marginLeft:"40px",pAlign:"center"},options:{marginLeft:"50px",padding:"10px",marginTop:"15px",display:"flex",flexDirection:"column",alignItems:"flex-start"},divider:{width:"100%",height:"2px",backgroundColor:"red",marginBottom:15},tableHeaderCell:{backgroundColor:"rgba(211, 211, 211, 0.3)",fontSize:10,border:"1px solid #000",padding:"4px",textAlign:"center",fontWeight:"bold"}},R0=p.forwardRef((e,t)=>{var A,h,o,c,y,d,s,x,l,E,w,T,S,m,f,Y,H,_,a;const{item:r}=e,n=w0(),i=te();return u.jsxs("div",{style:M.page,ref:t,children:[u.jsxs("div",{style:M.contentContainer,children:[u.jsxs("div",{style:M.contentInLine,children:[u.jsx("img",{alt:"logo",src:re,style:M.logo}),u.jsx("span",{style:M.mainTitle,children:"اتحادیه سراسری تعاونی‌های کشاورزی پرورش دهندگان مرغ گوشتی ایران"}),u.jsxs("span",{style:M.title,children:["اتحادیه شرکت های تعاونی کشاورزی مرغداران "," "," ",n]})]}),u.jsx("div",{children:u.jsx("span",{style:M.firsttitle,children:"بسمه تعالی"})}),u.jsxs("div",{style:M.options,children:[u.jsx("span",{style:M.title,children:"شماره:"}),u.jsx("span",{style:M.titleTopic,children:"تاریخ:"})]})]}),u.jsx("hr",{style:M.divider}),u.jsx("strong",{style:{fontSize:"20px",textAlign:"center"},children:"فاکتور فروش"}),u.jsx("br",{}),u.jsxs("div",{style:M.container,children:[u.jsx("table",{style:{...M.invoiceTable,marginBottom:"5px"},children:u.jsx("tbody",{children:u.jsxs("tr",{children:[u.jsx("td",{style:{...M.tableCell,width:"3%",backgroundColor:"grey"},children:u.jsxs("span",{style:{writingMode:"vertical-lr",textOrientation:"mixed",fontSize:14,fontWeight:"bold",color:"white"},children:["خریدار"," "]})}),u.jsxs("td",{style:{...M.tableCell,width:"90%",textAlign:"right"},children:[" "," ",(d=(y=(c=(o=(h=(A=r==null?void 0:r.provinceCheckInfo)==null?void 0:A.killHouseAssignment)==null?void 0:h.killHouseRequest)==null?void 0:o.killhouseUser)==null?void 0:c.killHouseOperator)==null?void 0:y.user)==null?void 0:d.fullname]})]})})}),u.jsx("table",{style:{...M.invoiceTable,marginBottom:"5px"},children:u.jsx("tbody",{children:u.jsxs("tr",{children:[u.jsx("td",{style:{...M.tableCell,width:"3%",backgroundColor:"grey"},children:u.jsxs("span",{style:{writingMode:"vertical-lr",textOrientation:"mixed",fontSize:14,fontWeight:"bold",color:"white"},children:["فروشنده"," "]})}),u.jsxs("td",{style:{...M.tableCell,width:"90%",textAlign:"right"},children:[" "," ","اتحادیه شرکت های تعاونی کشاورزی مرغداران "," "," ",n]})]})})}),u.jsxs("table",{style:M.invoiceTable,children:[u.jsx("tr",{children:u.jsxs("table",{style:M.invoiceTable,children:[u.jsx("thead",{style:M.tableHeader,children:u.jsxs("tr",{style:M.headerRow,children:[u.jsx("th",{style:M.tableHeaderCell,children:"ردیف"}),u.jsx("th",{style:M.tableHeaderCell,children:"شرح"}),u.jsx("th",{style:M.tableHeaderCell,children:"وزن (کیلوگرم)"}),u.jsx("th",{style:M.tableHeaderCell,children:"قیمت مرغ زنده (کیلوگرم)"}),u.jsx("th",{style:M.tableHeaderCell,children:"قیمت کل (ریال)"})]})}),u.jsx("tbody",{children:u.jsxs("tr",{children:[u.jsx("td",{style:M.tableCell,children:"1"}),u.jsxs("td",{style:M.tableCell,children:["بار شماره",(l=(x=(s=r==null?void 0:r.provinceCheckInfo)==null?void 0:s.killHouseAssignment)==null?void 0:x.killHouseRequest)==null?void 0:l.barCode,"مرغداری :"," ",`${(E=r==null?void 0:r.poultryRequest)==null?void 0:E.poultryName} (${(w=r==null?void 0:r.poultryRequest)==null?void 0:w.poultryUserMobile})`]}),u.jsx("td",{style:M.tableCell,children:(T=r==null?void 0:r.provinceFactorToKillHouse.netWeight)==null?void 0:T.toLocaleString()}),u.jsx("td",{style:M.tableCell,children:((S=r==null?void 0:r.factorFee)==null?void 0:S.toLocaleString())+" ﷼"}),u.jsx("td",{style:M.tableCell,children:((f=(m=r==null?void 0:r.provinceFactorToKillHouse)==null?void 0:m.totalFactorAmount)==null?void 0:f.toLocaleString())+" ﷼"})]})})]})}),u.jsx("tr",{children:u.jsxs("table",{style:M.invoiceTable,children:[u.jsx("thead",{style:M.tableHeader,children:u.jsxs("tr",{style:M.headerRow,children:[u.jsx("th",{colSpan:4,style:M.tableHeaderCell,children:"جمع فاکتور"}),u.jsx("th",{style:M.tableHeaderCell,children:((H=(Y=r==null?void 0:r.provinceFactorToKillHouse)==null?void 0:Y.totalFactorAmount)==null?void 0:H.toLocaleString())+" ﷼"})]})}),u.jsxs("tbody",{style:M.tableCell,children:[u.jsxs("tr",{children:[u.jsx("td",{colSpan:3}),u.jsx("td",{style:M.tableCell,children:"تخفیف"}),u.jsx("td",{style:M.tableCell,children:"0"})]}),u.jsxs("tr",{children:[u.jsx("td",{colSpan:3}),u.jsx("td",{style:M.tableCell,children:"مالیات"}),u.jsx("td",{style:M.tableCell,children:"0"})]}),u.jsxs("tr",{children:[u.jsx("td",{colSpan:3}),u.jsx("td",{style:M.tableCell,children:"عوارض"}),u.jsx("td",{style:M.tableCell,children:"0"})]}),u.jsxs("tr",{children:[u.jsx("td",{style:M.tableCell,colSpan:3,children:"مبلغ قابل پرداخت (ریال)"}),u.jsx("td",{colSpan:2,style:M.tableCell,children:((a=(_=r==null?void 0:r.provinceFactorToKillHouse)==null?void 0:_.totalFactorAmount)==null?void 0:a.toLocaleString())+" ﷼"})]})]})]})})]}),u.jsx("div",{style:{flexDirection:"row",marginTop:"20px"},children:u.jsx("div",{style:M.signature,children:u.jsxs("div",{style:M.contentInLine,children:[u.jsx("span",{style:M.title,children:i}),u.jsxs("span",{style:M.title,children:["مدیرعامل اتحادیه مرغداران"," ",n]})]})})}),u.jsx("div",{style:M.watermarkContainer,children:u.jsx("p",{style:M.watermarkp,children:"سامانه رصدیار "})})]})]})});R0.displayName="SlaughterNewFactorFile";R0.propTypes={item:vu.PropTypes.any};const Fr=()=>{const e=Vu(),[t,r]=p.useState([]),[n,i]=p.useState([]),{slaughterGetPayFactorRequests:A,slaughterGetPaiedFactors:h}=Fu(_=>_.slaughterSlice),o=lu(),[,,c,y,d,s]=p.useContext(Q);p.useEffect(()=>{const _=J(new Date).format("YYYY-MM-DD");y(_),s(_)},[]),p.useEffect(()=>{o(ne({selectedDate1:c,selectedDate2:d})),o(ae({selectedDate1:c,selectedDate2:d}))},[c,d]),p.useEffect(()=>{const _=h==null?void 0:h.map((a,C)=>{var b,g,D,$,eu,pu,B,q,F,z,R,U,tu,Z,su,du,gu,mu;let L="";return a.state==="accepted"?L="تایید شده":a.state==="rejected"?L="رد شده":a.state==="pending"&&(L="در انتظار تایید"),[C+1,(b=a==null?void 0:a.provinceFactor)==null?void 0:b.factorBarCode,(B=(pu=(eu=($=(D=(g=a==null?void 0:a.provinceFactor)==null?void 0:g.provinceCheckInfo)==null?void 0:D.killHouseAssignment)==null?void 0:$.killHouseRequest)==null?void 0:eu.killRequest)==null?void 0:pu.killHouse)==null?void 0:B.name,(su=(Z=(tu=(U=(R=(z=(F=(q=a==null?void 0:a.provinceFactor)==null?void 0:q.provinceCheckInfo)==null?void 0:F.killHouseAssignment)==null?void 0:z.killHouseRequest)==null?void 0:R.killRequest)==null?void 0:U.killHouse)==null?void 0:tu.killHouseOperator)==null?void 0:Z.user)==null?void 0:su.mobile,iu((du=a==null?void 0:a.provinceFactor)==null?void 0:du.createDate),iu(a==null?void 0:a.createDate),((mu=(gu=a==null?void 0:a.provinceFactor)==null?void 0:gu.totalPrice)==null?void 0:mu.toLocaleString())+" ﷼",Number(a==null?void 0:a.paymentCode),L,u.jsx("a",{href:a.factorImage,children:u.jsx("img",{src:a.factorImage,width:"50",height:"50",alt:"بدون بار",className:"images-file"})},"provinceKillRequests"),u.jsx(ou,{disabled:a.state==="accepted",color:"primary",onClick:()=>{var j,O,V,ru,nu,au,ju,yu,L0;o(hu({title:"انجام عملیات تایید / رد درخواست",top:!(window.innerWidth<=600),bottom:window.innerWidth<=600,content:u.jsx(N0,{factorKey:a.key,price:(j=a==null?void 0:a.provinceFactor)==null?void 0:j.totalPrice,provinceFactorToKillHouse:(O=a==null?void 0:a.provinceFactor)==null?void 0:O.provinceFactorToKillHouse,isRejected:((ru=(V=a==null?void 0:a.provinceFactor)==null?void 0:V.killHouseFactorToProvince)==null?void 0:ru.factorState)==="rejected",killHouseFactorToProvince:(nu=a==null?void 0:a.provinceFactor)==null?void 0:nu.killHouseFactorToProvince,barCode:(L0=(yu=(ju=(au=a==null?void 0:a.provinceFactor)==null?void 0:au.provinceCheckInfo)==null?void 0:ju.killHouseAssignment)==null?void 0:yu.killHouseRequest)==null?void 0:L0.barCode},`SlaughterPayProvinceFactorForm${C}`)}))},children:u.jsx($u,{})},C),u.jsx(ou,{"aria-label":"delete",color:"primary",onClick:()=>{var j,O;e(oe+((O=(j=a==null?void 0:a.provinceFactor)==null?void 0:j.poultryRequest)==null?void 0:O.poultryRequestId))},children:u.jsx(Nu,{})},C)]});i(_)},[h]),p.useEffect(()=>{const _=A==null?void 0:A.filter(a=>a.paidState!=="paid").map((a,C)=>{var D,$,eu,pu,B,q,F,z,R;const L=`${a.provinceInputAmount?(D=a.provinceInputAmount)==null?void 0:D.toLocaleString():"نامشخص"} ﷼ (شرح: ${a!=null&&a.reason?a==null?void 0:a.reason:"نامشخص"})`;let b=a.provinceInputAmountType;b==="plus"?b=u.jsxs(I,{variant:"caption",children:["اضافه شد: ",L]}):b=u.jsxs(I,{variant:"caption",children:["کسر شد: ",L]});const g=u.jsxs(I,{variant:"caption",children:["کسر شد: ",(($=a.killHouseFactorPaymentRemain)==null?void 0:$.toLocaleString())+" ﷼"]});return[C+1,(B=(pu=(eu=a.provinceCheckInfo)==null?void 0:eu.killHouseAssignment)==null?void 0:pu.killHouseRequest)==null?void 0:B.barCode,Bu(new Date((q=a==null?void 0:a.poultryRequest)==null?void 0:q.sendDate),"yyyy/MM/dd"),`${a.poultryRequest.poultryName} (${a.poultryRequest.poultryUserMobile})`,a.provinceFactorToKillHouse.killPlace,(F=a.provinceFactorToKillHouse.realQuantity)==null?void 0:F.toLocaleString(),(z=a.provinceFactorToKillHouse.netWeight)==null?void 0:z.toLocaleString(),Bu(new Date(a==null?void 0:a.factorDate),"yyyy/MM/dd"),((R=a.provinceFactorToKillHouse.totalFactorAmount)==null?void 0:R.toLocaleString())+" ﷼",u.jsx(Yu,{title:"خروجی PDF",children:u.jsx(ou,{onClick:()=>{H(a)},size:"large","aria-label":"delete",color:"success",children:u.jsx(v6,{})})},C),u.jsx(ou,{color:"primary",onClick:()=>{var U,tu,Z,su,du,gu,mu,j,O,V,ru,nu,au,ju,yu;o(hu({title:"انجام عملیات پرداخت فاکتور",top:!(window.innerWidth<=600),bottom:window.innerWidth<=600,content:u.jsxs(W,{container:!0,width:"100%",children:[u.jsxs(W,{width:"100%",children:[u.jsx($0,{name:"اطلاعات فاکتور",columns:["کد بار","تاریخ کشتار","مرغدار","محل کشتار","تعداد واقعی","وزن خالص بار (کیلوگرم)","سند بدون بار","سند با بار"],data:[[a.provinceCheckInfo.killHouseAssignment.killHouseRequest.barCode,(U=a==null?void 0:a.poultryRequest)!=null&&U.sendDate?Bu(new Date((tu=a==null?void 0:a.poultryRequest)==null?void 0:tu.sendDate),"yyyy/MM/dd"):"",`${a.poultryRequest.poultryUserName} (${a.poultryRequest.poultryUserMobile})`,a.provinceFactorToKillHouse.killPlace,(Z=a.provinceFactorToKillHouse.realQuantity)==null?void 0:Z.toLocaleString(),((su=a.provinceFactorToKillHouse.netWeight)==null?void 0:su.toLocaleString())+" کیلوگرم",u.jsx("a",{href:a.provinceCheckInfo.killHouseAssignment.carWeightWithoutLoadImage,children:u.jsx("img",{alt:"vvv",width:"50",src:a.provinceCheckInfo.killHouseAssignment.carWeightWithoutLoadImage})},"ddd"),u.jsx("a",{href:a.provinceCheckInfo.killHouseAssignment.carWeightWithLoadImage,children:u.jsx("img",{alt:"vvv",width:"50",src:a.provinceCheckInfo.killHouseAssignment.carWeightWithLoadImage})},"ddd")]]}),u.jsx($0,{name:"اطلاعات فاکتور",columns:["قیمت مرغ زنده (کیلوگرم)","مبلغ خالص بار","سهم مرغدار","سهم استان","هزینه پیامک اطلاع رسانی","مبلغ کسر/اضافه","واریزی فاکتور اولیه","مبلغ فاکتور نهایی"],data:[[((du=a.factorFee)==null?void 0:du.toLocaleString())+" ﷼",((gu=a.provinceFactorToKillHouse.realAmountFactor)==null?void 0:gu.toLocaleString())+" ﷼",((mu=a.provinceFactorToKillHouse.poultryShare)==null?void 0:mu.toLocaleString())+" ﷼",((j=a.provinceFactorToKillHouse.provinceShare)==null?void 0:j.toLocaleString())+" ﷼",(au=(nu=(ru=(V=(O=a.provinceFactorToKillHouse.item)==null?void 0:O.provinceCheckInfo)==null?void 0:V.killHouseAssignment)==null?void 0:ru.killHouseRequest)==null?void 0:nu.killRequest)!=null&&au.smsPayment?"دارد - 50000 ﷼":"ندارد",b,g,((ju=a==null?void 0:a.totalPrice)==null?void 0:ju.toLocaleString())+" ﷼"]]})]}),u.jsx(N0,{factorKey:a.key,price:a.totalPrice,item:a,provinceFactorToKillHouse:a.provinceFactorToKillHouse,isRejected:((yu=a==null?void 0:a.killHouseFactorToProvince)==null?void 0:yu.factorState)==="rejected",killHouseFactorToProvince:a.killHouseFactorToProvince,barCode:a.provinceCheckInfo.killHouseAssignment.killHouseRequest.barCode},`SlaughterPayProvinceFactorForm${C}`)]})}))},children:u.jsx($u,{})},C),u.jsx(ou,{"aria-label":"delete",color:"primary",onClick:()=>e(Uu+a.poultryReqId),children:u.jsx(Nu,{})},C)]});r(_)},[A]);const[x]=p.useState(["ردیف","کد بار","تاریخ کشتار","مرغدار","محل کشتار","تعداد واقعی","وزن خالص (کیلوگرم)","تاریخ صدور فاکتور","مبلغ نهایی فاکتور","دانلود فاکتور","عملیات","مشاهده"]),l=_u({initialValues:{capacity:"",recieveTime:"",recieveDate:J(Date()).format("YYYY-MM-DD hh:mm:ss")},validationSchema:fu({capacity:Tu().required("این فیلد اجباری است!").typeError("لطفا عدد وارد کنید!"),recieveTime:bu().required("این فیلد اجباری است!").typeError("لطفا وزن را وارد کنید!")})});p.useEffect(()=>{l.validateForm()},[]);const[E,w]=p.useState(0),T=(_,a)=>{w(a)},[S,m]=p.useState(),f=p.useRef(),Y=p6.useReactToPrint({content:()=>f.current,documentTitle:"فاکتور پرداخت",onAfterPrint:()=>{m(null)}}),H=_=>{m(_)};return p.useEffect(()=>{S&&Y()},[S,Y]),u.jsxs(W,{container:!0,alignItems:"center",justifyContent:"center",gap:k.SMALL,mt:k.MEDIUM,children:[u.jsx("div",{style:{visibility:"hidden",position:"absolute"},children:u.jsx(R0,{ref:f,item:S})}),u.jsx(W,{children:u.jsx(c6,{sx:{borderBottom:1,borderColor:"divider"},children:u.jsxs(d6,{value:E,onChange:T,"aria-label":"basic tabs example",children:[u.jsx(Zu,{label:"فاکتور های جدید"}),u.jsx(Zu,{label:"فاکتورهای پرداخت شده"})]})})}),u.jsxs(D0,{sx:{width:"100%"},children:[E===0&&u.jsx(Hu,{name:u.jsxs(W,{container:!0,alignItems:"center",gap:k.SMALL,children:[u.jsx(W,{xs:12,sm:12,md:12,lg:2,children:u.jsx(I,{children:"فاکتورهای در انتظار پرداخت"})}),u.jsx(W,{children:u.jsx(uu,{label:"از تاریخ",id:"date",renderInput:_=>u.jsx(N,{style:{width:"160px"},..._}),value:c,onChange:_=>{y(J(_).format("YYYY-MM-DD"))}})}),u.jsx(W,{children:u.jsx(uu,{label:"تا تاریخ",id:"date",renderInput:_=>u.jsx(N,{style:{width:"160px"},..._}),value:d,onChange:_=>{s(J(_).format("YYYY-MM-DD"))}})})]}),columns:x,data:t}),E===1&&u.jsx(Hu,{name:u.jsxs(W,{container:!0,alignItems:"center",gap:k.SMALL,children:[u.jsx(W,{xs:12,sm:12,md:12,lg:2,children:u.jsx(I,{children:"فاکتورهای پرداخت شده"})}),u.jsx(W,{children:u.jsx(uu,{label:"از تاریخ",id:"date",renderInput:_=>u.jsx(N,{style:{width:"160px"},..._}),value:c,onChange:_=>{y(J(_).format("YYYY-MM-DD"))}})}),u.jsx(W,{children:u.jsx(uu,{label:"تا تاریخ",id:"date",renderInput:_=>u.jsx(N,{style:{width:"160px"},..._}),value:d,onChange:_=>{s(J(_).format("YYYY-MM-DD"))}})})]}),columns:["ردیف","شناسه فاکتور","کشتارگاه","تلفن کشتارگاه","تاریخ صدور فاکتور","تاریخ پرداخت فاکتور","مبلغ فاکتور نهایی","شناسه پرداخت","وضعیت","سند پرداختی","ویرایش سند پرداخت","مشاهده"],data:n})]})]})},jr=Lu("SLAUGHTER_PAY_FACTOR_SERVICE",async(e,{dispatch:t})=>{t(cu());const{data:r,status:n}=await Su.post("kill_request_factor_payment/",e);return t(X()),{data:r,status:n}}),br=fu({paymentCode:bu().required("This field is required")}),P6=({factorKey:e,isFinalFactor:t})=>{const[r,n]=P.useState(),[i,A]=P.useState([]),h=lu(),[o]=p.useContext(Q),[,,c,,y]=p.useContext(Q),d=_u({initialValues:{paymentCode:"",doc:"",amount:""},validationSchema:br,onSubmit:x=>{t?h(Be({key:e,factor_image:x.doc,payment_code:x.paymentCode,role:xu()})).then(l=>{h(E0({selectedDate1:c,selectedDate2:y})),h(f6()),h(hu({right:!1,bottom:!1,content:null})),o({vertical:"top",horizontal:"center",msg:"عملیات با موفقیت انجام شد.",severity:"success"})}):h(jr({factor_key:e,image:x.doc,payment_code:x.paymentCode,amount:x.amount})).then(l=>{h(hu({right:!1,bottom:!1,content:null})),o({vertical:"top",horizontal:"center",msg:"عملیات با موفقیت انجام شد.",severity:"success"})})}}),s=(x,l)=>{var E;x[0]&&n(qe((E=x[0])==null?void 0:E.data_url)),A(x)};return p.useEffect(()=>{d.setFieldValue("doc",r)},[r]),u.jsx("div",{children:u.jsxs("form",{onSubmit:d.handleSubmit,children:[u.jsx(N,{label:"شناسه پرداخت",name:"paymentCode",variant:"outlined",margin:"normal",fullWidth:!0,error:d.touched.paymentCode&&!!d.errors.paymentCode,helperText:d.touched.paymentCode&&d.errors.paymentCode,value:d.values.paymentCode,onChange:d.handleChange}),!t&&u.jsx(e0,{allowLeadingZeros:!0,thousandSeparator:",",label:"مبلغ واریزی (ریال)",id:"amount",variant:"outlined",margin:"normal",fullWidth:!0,error:d.touched.amount&&!!d.errors.amount,helperText:d.touched.amount&&d.errors.amount,value:d.values.amount,onChange:d.handleChange}),u.jsx(v,{mb:k.SMALL,children:u.jsx(Oe,{onChange:s,images:i,maxNumber:1,title:"بارگذاری سند"})}),u.jsx(G,{fullWidth:!0,type:"submit",variant:"contained",color:"primary",children:"ثبت"})]})})},Er=Lu("SLAUGHTER_DELETE_FACTOR_SERVICE",async(e,{dispatch:t})=>{t(cu());try{const{data:r,status:n}=await Su.put("kill_request_factor/0/",e);return t(X()),{data:r,status:n}}catch(r){return t(X()),{error:r.response.data.result}}}),Sr=()=>{const e=lu(),[t]=p.useContext(Q),[,,r,n,i,A]=p.useContext(Q);p.useEffect(()=>{const s=Eu(new Date).format("YYYY-MM-DD");n(s),A(s)},[]);const{slaughterFactors:h}=Fu(s=>s.slaughterSlice),[o,c]=p.useState([]),[y,d]=p.useState([]);return p.useEffect(()=>{const s=h==null?void 0:h.filter(l=>l.state==="pending").map(l=>{var w,T,S,m,f,Y,H,_,a,C;let E;switch(l.state){case"pending":E="در انتظار پرداخت";break;case"paid":E="پرداخت شده";break;case"unpaid":E="پرداخت نشده";break;default:E="در انتظار پرداخت"}return[(T=(w=l==null?void 0:l.killRequest)==null?void 0:w.slaughterHouse)!=null&&T.name?(m=(S=l==null?void 0:l.killRequest)==null?void 0:S.slaughterHouse)==null?void 0:m.name:(Y=(f=l==null?void 0:l.killRequest)==null?void 0:f.killHouse)==null?void 0:Y.name,iu(l==null?void 0:l.createDate),(H=l==null?void 0:l.killRequest)==null?void 0:H.IndexWeight,l.killRequest.oldChickenBreed?l.killRequest.oldChickenBreed:(_=l==null?void 0:l.killRequest)==null?void 0:_.chickenBreed,l.killRequest.chickenBreed,l.killRequest.provinceQuantity?l.killRequest.provinceQuantity.toLocaleString():(a=l.killRequest.killCapacity)==null?void 0:a.toLocaleString(),l.killRequest.provinceQuantity?(C=l.killRequest.killCapacity)==null?void 0:C.toLocaleString():0,(l==null?void 0:l.amount.toLocaleString())+" ﷼",(l==null?void 0:l.minimumAmount.toLocaleString())+" ﷼",E,u.jsx(ou,{disabled:l.state==="paid",color:"primary",onClick:()=>{e(hu({title:"پرداخت فاکتور",right:!(window.innerWidth<=600),bottom:window.innerWidth<=600,content:u.jsx(P6,{factorKey:l.key})}))},children:u.jsx(x6,{})},"ee"),u.jsx(ou,{disabled:l.paidState==="paid",color:"error",onClick:()=>{e(Iu({title:"لغو سفارش",content:u.jsxs(v,{container:!0,direction:"column",alignItems:"center",justifyContent:"center",width:"100%",gap:k.SMALL,children:[u.jsx(v,{children:u.jsx(I,{children:"در صورت لغو فاکتور درخواست اولیه شما هم لغو می گردد."})}),u.jsx(v,{children:u.jsx(G,{variant:"contained",color:"error",onClick:()=>{e(Er({state:"cancel",factor_key:l.key})).then(L=>{L.payload.error?(e(Ru()),t({vertical:"top",horizontal:"center",msg:L.payload.error,severity:"error"})):(e(E0({selectedDate1:r,selectedDate2:i})),e(Ru()),t({vertical:"top",horizontal:"center",msg:"سفارش با موفقیت لغو شد.",severity:"success"}))})},children:"لغو سفارش"})})]})}))},children:u.jsx(o0,{})},"ee")]});c(s);const x=h==null?void 0:h.filter(l=>l.state==="paid"||l.state==="unpaid").map(l=>{var w,T,S,m,f,Y,H,_,a,C;let E;switch(l.state){case"pending":E="در انتظار پرداخت";break;case"paid":E="پرداخت شده";break;case"unpaid":E="پرداخت نشده";break;default:E="در انتظار پرداخت"}return[(T=(w=l==null?void 0:l.killRequest)==null?void 0:w.slaughterHouse)!=null&&T.name?(m=(S=l==null?void 0:l.killRequest)==null?void 0:S.slaughterHouse)==null?void 0:m.name:(Y=(f=l==null?void 0:l.killRequest)==null?void 0:f.killHouse)==null?void 0:Y.name,iu(l==null?void 0:l.createDate),(H=l==null?void 0:l.killRequest)==null?void 0:H.IndexWeight,l.killRequest.oldChickenBreed?l.killRequest.oldChickenBreed:(_=l==null?void 0:l.killRequest)==null?void 0:_.chickenBreed,l.killRequest.chickenBreed,l.killRequest.provinceQuantity?l.killRequest.provinceQuantity.toLocaleString():(a=l.killRequest.killCapacity)==null?void 0:a.toLocaleString(),l.killRequest.provinceQuantity?(C=l.killRequest.killCapacity)==null?void 0:C.toLocaleString():0,(l==null?void 0:l.amount.toLocaleString())+" ﷼",(l==null?void 0:l.minimumAmount.toLocaleString())+" ﷼",E]});d(x)},[h]),p.useEffect(()=>{e(E0({selectedDate1:r,selectedDate2:i}))},[r,i]),u.jsxs(v,{container:!0,flex:1,children:[u.jsx(v,{width:"100%",children:u.jsx(Hu,{name:u.jsxs(v,{container:!0,alignItems:"center",gap:k.SMALL,children:[u.jsx(v,{children:u.jsx(I,{children:"فاکتور همراه با ثبت درخواست کشتار"})}),u.jsx(v,{children:u.jsx(uu,{label:"از تاریخ",id:"date",renderInput:s=>u.jsx(N,{style:{width:"160px"},...s}),value:r,onChange:s=>{n(Eu(s).format("YYYY-MM-DD"))}})}),u.jsx(v,{children:u.jsx(uu,{label:"تا تاریخ",id:"date",renderInput:s=>u.jsx(N,{style:{width:"160px"},...s}),value:i,onChange:s=>{A(Eu(s).format("YYYY-MM-DD"))}})})]}),columns:["کاربر","تاریخ درخواست","وزن","نژاد درخواستی","نژاد تایید شده","تعداد درخواستی","تعداد تایید شده","مبلغ پیش فاکتور","حداقل پرداختی (70%)","وضعیت","پرداخت","لغو سفارش"],data:o})}),u.jsx(v,{width:"100%",children:u.jsx(Hu,{name:"بایگانی",columns:["کاربر","تاریخ درخواست","وزن","نژاد درخواستی","نژاد تایید شده","تعداد درخواستی","تعداد تایید شده","مبلغ پیش فاکتور","حداقل پرداختی (70%)","وضعیت"],data:y})})]})},kr=()=>{const e=lu(),{slaughterFinalFactors:t}=Fu(c=>c.slaughterSlice),[,,r,n,i,A]=p.useContext(Q);p.useEffect(()=>{const c=Eu(new Date).format("YYYY-MM-DD");n(c),A(c)},[]);const[h,o]=p.useState([]);return p.useEffect(()=>{const c=t==null?void 0:t.map(y=>{let d;switch(y.paidState){case"pending":d="در انتظار پرداخت";break;case"paid":d="پرداخت شده";break;default:d="در انتظار پرداخت"}return[y==null?void 0:y.factorBarCode,d,(y==null?void 0:y.factorFee.toLocaleString())+" ﷼",(y==null?void 0:y.totalPrice.toLocaleString())+" ﷼",y==null?void 0:y.totalWeight,u.jsx(ou,{disabled:y.paidState==="paid",color:"primary",onClick:()=>{e(hu({title:"پرداخت فاکتور",right:!(window.innerWidth<=600),bottom:window.innerWidth<=600,content:u.jsx(P6,{factorKey:y.key,isFinalFactor:!0})}))},children:u.jsx(x6,{})},"ee")]});o(c)},[t]),p.useEffect(()=>{e(f6({selectedDate1:r,selectedDate2:i}))},[r,i]),u.jsx(v,{container:!0,flex:1,children:u.jsx(v,{width:"100%",children:u.jsx(Hu,{name:u.jsxs(v,{container:!0,alignItems:"center",gap:k.SMALL,children:[u.jsx(v,{children:u.jsx(I,{children:"فاکتور نهایی"})}),u.jsx(v,{children:u.jsx(uu,{label:"از تاریخ",id:"date",renderInput:c=>u.jsx(N,{style:{width:"160px"},...c}),value:r,onChange:c=>{n(Eu(c).format("YYYY-MM-DD"))}})}),u.jsx(v,{children:u.jsx(uu,{label:"تا تاریخ",id:"date",renderInput:c=>u.jsx(N,{style:{width:"160px"},...c}),value:i,onChange:c=>{A(Eu(c).format("YYYY-MM-DD"))}})})]}),columns:["کدبار","وضعیت","قیمت هرکیلو","قابل پرداخت","وزن","پرداخت"],data:h})})})},Dr=Lu("SLAUGHTER_GET_EXPORT_ALLOW_STATE",async(e,{dispatch:t})=>{t(cu());const{data:r,status:n}=await Su.get("allow_direct_buying/",{params:{role:xu()}});return t(X()),{data:r,status:n}}),wr=Lu("SLAUGHTER_GET_COUNTRIES",async(e,{dispatch:t})=>{t(cu());const{data:r,status:n}=await Su.get("get_country/");return t(X()),{data:r,status:n}}),Y6=({edit:e,updateTable:t,item:r})=>{var b,g,D,$,eu,pu,B,q,F,z,R,U,tu,Z,su,du,gu,mu;const[n,i]=p.useState(1),[A,h]=p.useState(1),o=lu(),[c]=p.useContext(Q),[y,d]=p.useState(0),[s,x]=p.useState(!1),[l,E]=p.useState([]),[w,T]=p.useState(r!=null&&r.exportCountry?r==null?void 0:r.exportCountry:""),{slaughterGetPoultries:S,slaughterGetKillerKillhouses:m,slaughterGetKillhouses:f}=Fu(j=>j.slaughterSlice);p.useEffect(()=>{o(c0()),o(C6()),o(h6()),o(le()),o(wr()).then(j=>{E(j.payload.data)})},[]);const Y={killhouse:null,killerPlace:null,poultry:null,killDate:r?new Date(r.createDate):new Date,numberForBuy:r?r.killCapacity:null,indexWeight:r?r.IndexWeight:""},H=j=>{var O,V,ru,nu,au,ju;o(Ye({kill_capacity:j.numberForBuy,recive_time:"12 - 14",recive_date:j.killDate,low_weight:!1,high_weight:!1,Index_weight:j.indexWeight,chicken_breed:(nu=(ru=(V=(O=a==null?void 0:a.values)==null?void 0:O.poultry)==null?void 0:V.item)==null?void 0:ru.hatchingAge)==null?void 0:nu.breed,cash:!0,credit:!1,sms_payment:!1,kill_house_key:j.killhouse,killer_kill_house_key:j.killerPlace?j.killerPlace:null,role:xu(),poultry_key:(ju=(au=a==null?void 0:a.values)==null?void 0:au.poultry)==null?void 0:ju.value,export_status:!0,export_country:w})).then(yu=>{yu.payload.error?c({vertical:"top",horizontal:"center",msg:yu.payload.error,severity:"error"}):(t(),c({vertical:"top",horizontal:"center",msg:"عملیات با موفقیت انجام شد.",severity:"success"}),o(hu({right:!1,bottom:!1,left:!1,content:null})))})};p.useEffect(()=>{var j,O,V,ru,nu,au;r&&d(((O=(j=r==null?void 0:r.poultry)==null?void 0:j.lastHatchingDiffrentRequestQuantity)==null?void 0:O.leftExportQuantity)===null?(ru=(V=r.poultry)==null?void 0:V.lastHatchingDiffrentRequestQuantity)==null?void 0:ru.lastHatchingRemainQuantity:(au=(nu=r==null?void 0:r.poultry)==null?void 0:nu.lastHatchingDiffrentRequestQuantity)==null?void 0:au.leftExportQuantity)},[]);const _=fu().shape({killhouse:bu().typeError("این فیلد الزامی است").required("این فیلد الزامی است"),poultry:fu("").typeError("این فیلد الزامی است").required("این فیلد الزامی است"),numberForBuy:Tu().typeError("لطفا عدد وارد کنید").max(y,"تعداد بیش از حد مجاز است").required("لطفا عدد وارد کنید").positive("لطفا عدد وارد کنید").integer("لطفا عدد وارد کنید"),indexWeight:Tu().typeError("لطفا عدد وارد کنید").required("لطفا عدد وارد کنید").positive("لطفا عدد وارد کنید")}),a=_u({initialValues:Y,validationSchema:_,onSubmit:H});p.useEffect(()=>{var V,ru,nu,au;let j=a.values.indexWeight;const O=(au=(nu=(ru=(V=a.values)==null?void 0:V.indexWeight)==null?void 0:ru.toString())==null?void 0:nu.split("."))==null?void 0:au.join("");a.values.indexWeight&&O.length<=3&&(O.length===2&&(j=O[0]+"."+O[1]),O.length===3&&(j=O[0]+"."+O[1]+O[2])),isNaN(Number.parseFloat(j))?a.setFieldValue("indexWeight",""):a.setFieldValue("indexWeight",Number.parseFloat(j))},[a.values.indexWeight]);const C=async j=>{j.preventDefault(),o(c0({min_age:n||1,max_age:A||1}))},L=async j=>{j.preventDefault(),i(1),h(1),o(c0())};return u.jsx("form",{onSubmit:a.handleSubmit,children:u.jsxs(v,{container:!0,direction:"column",gap:k.SMALL,children:[!e&&u.jsxs(u.Fragment,{children:[f!=null&&f.length?u.jsx(Pu,{id:"killhouse",disableClearable:!0,options:f==null?void 0:f.map(j=>({label:(j!=null&&j.killer?"کشتارکن":"کشتارگاه")+" "+j.name,value:j.key,killer:j.killer,item:j,disabled:j.allowDirectBuying})),getOptionDisabled:j=>!j.disabled,getOptionLabel:j=>j.label,onChange:(j,O)=>{x(O.killer),a.setFieldValue("killhouse",O.value)},onBlur:a.handleBlur,renderInput:j=>u.jsx(N,{...j,label:"انتخاب کشتارگاه/کشتارکن",variant:"outlined",error:a.touched.killhouse&&!!a.errors.killhouse,helperText:a.touched.killhouse&&a.errors.killhouse})}):u.jsx(U6,{}),s&&u.jsx(Pu,{id:"killerPlace",disableClearable:!0,options:m==null?void 0:m.map(j=>({label:"کشتارگاه "+j.name,value:j.key})),getOptionLabel:j=>j.label,onChange:(j,O)=>a.setFieldValue("killerPlace",O.value),onBlur:a.handleBlur,renderInput:j=>u.jsx(N,{...j,label:"انتخاب محل کشتار",variant:"outlined",error:a.touched.killerPlace&&!!a.errors.killerPlace,helperText:a.touched.killerPlace&&a.errors.killerPlace})}),u.jsxs(v,{container:!0,alignItems:"center",gap:k.SMALL,style:{padding:"10px",border:"1px solid #bbb",borderRadius:"10px"},children:[u.jsx(v,{style:{width:"70px"},children:u.jsx(N,{fullWidth:!0,size:"small",label:"از سن",id:"outlined-controlled",value:n,onChange:j=>{i(j.target.value)}})}),u.jsx(v,{style:{width:"70px"},children:u.jsx(N,{fullWidth:!0,size:"small",label:"تا سن",id:"outlined-controlled",value:A,onChange:j=>{h(j.target.value)}})}),u.jsxs(v,{display:"grid",alignItems:"center",children:[u.jsx(G,{disabled:n>A||n<1||A<1,onClick:C,children:"جستجو"}),u.jsx(G,{color:"error",onClick:L,children:"حذف فیلتر"})]})]}),S!=null&&S.length?u.jsx(Pu,{id:"poultry",disableClearable:!0,options:S==null?void 0:S.map(j=>{var O,V;return{label:`${j.unitName} (${j.user.fullname}) سن: ${(O=j.lastHatchingDiffrentRequestQuantity)==null?void 0:O.age} روز / نژاد: ${(V=j.lastHatchingDiffrentRequestQuantity)==null?void 0:V.breed}`,value:j.key,item:j}}),getOptionLabel:j=>j.label,onChange:(j,O)=>{var V,ru,nu,au,ju;a.setFieldValue("poultry",O),d(((ru=(V=O==null?void 0:O.item)==null?void 0:V.lastHatchingDiffrentRequestQuantity)==null?void 0:ru.leftExportQuantity)===null?(nu=O.item)==null?void 0:nu.lastHatchingRemainQuantity:(ju=(au=O==null?void 0:O.item)==null?void 0:au.lastHatchingDiffrentRequestQuantity)==null?void 0:ju.leftExportQuantity)},onBlur:a.handleBlur,renderInput:j=>u.jsx(N,{...j,label:"انتخاب مرغداری",variant:"outlined",error:a.touched.poultry&&!!a.errors.poultry,helperText:a.touched.poultry&&a.errors.poultry})}):u.jsx(I,{color:"error",variant:"body2",children:"موردی یافت نشد!"}),a.values.poultry&&u.jsxs(v,{container:!0,direction:"column",justifyContent:"space-between",children:[u.jsxs(v,{container:!0,gap:k.TINY,children:[u.jsx(I,{children:"نام و نام خانوادگی:"}),u.jsx(I,{children:(g=(b=a==null?void 0:a.values)==null?void 0:b.poultry)==null?void 0:g.item.user.fullname})]}),u.jsxs(v,{container:!0,gap:k.TINY,children:[u.jsx(I,{children:"تلفن:"}),u.jsx(I,{children:($=(D=a==null?void 0:a.values)==null?void 0:D.poultry)==null?void 0:$.item.user.mobile})]}),u.jsxs(v,{container:!0,gap:k.TINY,children:[u.jsx(I,{children:"آدرس:"}),u.jsx(I,{children:`${(pu=(eu=a==null?void 0:a.values)==null?void 0:eu.poultry)==null?void 0:pu.item.address.province.name} - ${(q=(B=a==null?void 0:a.values)==null?void 0:B.poultry)==null?void 0:q.item.address.city.name} - ${(z=(F=a==null?void 0:a.values)==null?void 0:F.poultry)==null?void 0:z.item.address.address}`})]}),u.jsxs(v,{container:!0,gap:k.TINY,children:[u.jsx(I,{children:"سن جوجه:"}),u.jsxs(I,{children:[(Z=(tu=(U=(R=a==null?void 0:a.values)==null?void 0:R.poultry)==null?void 0:U.item)==null?void 0:tu.lastHatchingDiffrentRequestQuantity)==null?void 0:Z.age," ","روز"]})]}),u.jsxs(v,{container:!0,gap:k.TINY,children:[u.jsx(I,{children:"مانده در سالن:"}),u.jsxs(I,{children:[(mu=(gu=(du=(su=a==null?void 0:a.values)==null?void 0:su.poultry)==null?void 0:du.item)==null?void 0:gu.lastHatchingRemainQuantity)==null?void 0:mu.toLocaleString()," ","قطعه"]})]}),u.jsxs(v,{container:!0,gap:k.TINY,children:[u.jsx(I,{color:"error",children:" مانده قابل صادرات:"}),u.jsxs(I,{color:"error",children:[y==null?void 0:y.toLocaleString()," قطعه"]})]})]})]}),u.jsx(uu,{fullWidth:!0,label:"تاریخ کشتار",id:"killDate",renderInput:j=>u.jsx(N,{...j}),value:a.values.killDate,error:a.touched.killDate?!!a.errors.killDate:null,onChange:j=>{a.setFieldValue("killDate",Eu(j).format("YYYY-MM-DD hh:mm:ss"))},onBlur:a.handleBlur,helperText:a.touched.killDate&&a.errors.killDate?a.errors.killDate:null}),u.jsx(e0,{allowLeadingZeros:!0,thousandSeparator:",",id:"numberForBuy",name:"numberForBuy",label:"قطعه",variant:"outlined",value:a.values.numberForBuy,onChange:a.handleChange,onBlur:a.handleBlur,error:a.touched.numberForBuy&&!!a.errors.numberForBuy,helperText:a.touched.numberForBuy&&a.errors.numberForBuy}),u.jsx(N,{id:"indexWeight",name:"indexWeight",label:"میانگین وزنی",variant:"outlined",value:a.values.indexWeight,onChange:a.handleChange,onBlur:a.handleBlur,InputProps:{endAdornment:u.jsx(V6,{position:"end",children:"کیلوگرم"})},error:a.touched.indexWeight&&!!a.errors.indexWeight,helperText:a.touched.indexWeight&&a.errors.indexWeight}),u.jsxs(wu,{children:[u.jsx(Ou,{id:"hour-label",children:"کشور مقصد"}),u.jsx(qu,{labelId:"hour-label",label:"کشور مقصد",id:"hour-select",value:w,onChange:j=>T(j.target.value),children:l==null?void 0:l.map(j=>u.jsx(Cu,{value:j.fa,children:j.fa},j.fa))})]}),!e&&u.jsx(G,{type:"submit",variant:"contained",color:"primary",fullWidth:!0,disabled:!w,children:"ثبت"}),e&&u.jsx(G,{disabled:!a.values.numberForBuy||!a.values.killDate||!a.values.indexWeight||a.values.numberForBuy>y||!w,variant:"contained",color:"primary",fullWidth:!0,onClick:()=>{o(Pe({role:xu(),kill_capacity:a.values.numberForBuy,recive_date:a.values.killDate,Index_weight:a.values.indexWeight,kill_request_key:r.key,remain_quantity:a.values.numberForBuy,export_status:!0})).then(j=>{var O,V;(O=j==null?void 0:j.payload)!=null&&O.error?c({vertical:"top",horizontal:"center",msg:(V=j==null?void 0:j.payload)==null?void 0:V.error,severity:"error"}):(t(),c({vertical:"top",horizontal:"center",msg:"عملیات با موفقیت انجام شد.",severity:"success"}),o(hu({right:!1,bottom:!1,left:!1,content:null})))})},children:"ثبت ویرایش"})]})})},_r=({item:e,updateTable:t})=>{const r=lu(),[n,i]=p.useState(null),[A]=p.useContext(Q),h=d=>{i(d.currentTarget)},o=()=>{i(null)},c=!!n,y=c?"popover":void 0;return u.jsxs(v,{container:!0,children:[u.jsx(ou,{"aria-describedby":y,variant:"contained",color:"primary",onClick:h,children:u.jsx(F6,{})}),u.jsx(i6,{anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"left"},id:y,open:c,anchorEl:n,onClose:o,children:u.jsx("div",{style:{padding:"20px",display:"flex",flexDirection:"column"},children:u.jsxs(v,{container:!0,direction:"column",children:[u.jsx(Yu,{title:"ویرایش",placement:"right",children:u.jsx(ou,{color:"primary",onClick:()=>{o(),r(hu({title:"ویرایش درخواست صادرات",content:u.jsx(Y6,{updateTable:t,edit:!0,item:e}),right:!(window.innerWidth<=600),bottom:window.innerWidth<=600}))},children:u.jsx($u,{})})}),u.jsx(Yu,{title:"حذف",children:u.jsx(ou,{color:"error",onClick:()=>{r(We(e.key)).then(d=>{d.error?A({vertical:"top",horizontal:"center",msg:d.error,severity:"error"}):(t(),A({vertical:"top",horizontal:"center",msg:"عملیات با موفقیت انجام شد.",severity:"success"}))})},children:u.jsx(o0,{})})})]})})})]})},mr=()=>{const e=lu(),[t,r]=p.useState();p.useEffect(()=>{e(Dr()).then(B=>{r(B.payload.data)})},[]);const[n,i]=p.useState(0),A=(B,q)=>{i(q)},[,,h,o,c,y]=p.useContext(Q);p.useEffect(()=>{const B=J(new Date).format("YYYY-MM-DD");o(B),y(B)},[]);const d=B=>{m(B.target.value)},[s,x]=p.useState([]),[l,E]=p.useState(0),[w,T]=p.useState(10),[S,m]=p.useState(""),[f,Y]=p.useState(1),[H,_]=p.useState([]),[a,C]=p.useState([]),L=async B=>{let q;e(cu()),q=await Su.get(`kill_request/?export=true&type=${n===0?"pending":"archive"}&search=filter&value=${S}&role=${xu()}&date1=${h}&date2=${c}&page=${B}&page_size=${w}`),e(X()),x(q.data.results),E(q.data.count)},b=B=>{L(B),Y(B)},g=B=>{T(B),Y(1)},D=()=>{L(f!==0?f:1)};p.useEffect(()=>{L(1)},[]);const $=B=>{let q="";return B.exportState==="pending"?q="در انتظار تایید":B.exportState==="rejected"?q="رد شده":B.exportState==="accepted"?q="تایید شده":B.exportState==="deleted"&&(q="حذف شده"),q};p.useEffect(()=>{const B=s==null?void 0:s.map((F,z)=>{var R,U,tu,Z,su,du;return[f===1?z+1:z+w*(f-1)+1,iu(F==null?void 0:F.createDate),iu(F.reciveDate),`${F.killHouse.name} (${F.killHouse.killHouseOperator.user.mobile})`,F!=null&&F.slaughterHouse?(R=F==null?void 0:F.slaughterHouse)==null?void 0:R.name:(U=F==null?void 0:F.killHouse)==null?void 0:U.name,F==null?void 0:F.exportCountry,`${(Z=(tu=F==null?void 0:F.poultry)==null?void 0:tu.userprofile)==null?void 0:Z.fullName} (${(du=(su=F==null?void 0:F.poultry)==null?void 0:su.userprofile)==null?void 0:du.mobile})`,F.killCapacity,F.IndexWeight,(F.IndexWeight*F.killCapacity).toLocaleString(),u.jsx(u.Fragment,{children:F!=null&&F.inputDirectBuyingCode?F==null?void 0:F.inputDirectBuyingCode:u.jsx(G,{onClick:()=>{e(Iu({title:"ثبت کد احراز",content:u.jsx(Ne,{item:F,updateTable:D})}))},children:"ثبت کداحراز"})}),$(F),n===0?u.jsx(_r,{updateTable:D,item:F},z):"-"]});_(B);const q=s==null?void 0:s.map((F,z)=>{var R,U,tu,Z,su,du;return[f===1?z+1:z+w*(f-1)+1,iu(F==null?void 0:F.createDate),iu(F.reciveDate),`${F.killHouse.name} (${F.killHouse.killHouseOperator.user.mobile})`,F!=null&&F.slaughterHouse?(R=F==null?void 0:F.slaughterHouse)==null?void 0:R.name:(U=F==null?void 0:F.killHouse)==null?void 0:U.name,F==null?void 0:F.exportCountry,`${(Z=(tu=F==null?void 0:F.poultry)==null?void 0:tu.userprofile)==null?void 0:Z.fullName} (${(du=(su=F==null?void 0:F.poultry)==null?void 0:su.userprofile)==null?void 0:du.mobile})`,F.killCapacity,F.IndexWeight,(F.IndexWeight*F.killCapacity).toLocaleString(),$(F),F!=null&&F.acceptRejectDate?A6(F==null?void 0:F.acceptRejectDate):"-",F==null?void 0:F.directBuyingMessage]});C(q)},[s]),p.useEffect(()=>{L(1)},[h,c,w,n]);const eu=async B=>{B.preventDefault(),e(cu());try{const q=await Su.get(`kill_request/?export=true&type=${n===0?"pending":"archive"}&role=${xu()}&search=filter&value=${S}&date1=${h}&date2=${c}&page=1&page_size=${w}`);x(q.data.results),E(q.data.count),e(X())}catch(q){console.error("Error fetching data:",q)}},pu=Fu(B=>B.userSlice.userProfile.key);return u.jsxs(v,{container:!0,direction:"column",flexWrap:"nowrap",mt:k.SMALL,children:[u.jsx(v,{container:!0,justifyContent:"center",alignItems:"center",my:k.SMALL,children:u.jsxs(d6,{scrollButtons:"auto",variant:"scrollable",allowScrollButtonsMobile:!0,value:n,onChange:A,children:[u.jsx(Zu,{label:"درخواست های جدید"}),u.jsx(Zu,{label:"بایگانی"})]})}),u.jsxs(v,{container:!0,mt:k.MEDIUM,alignItems:"center",justifyContent:"center",gap:2,children:[u.jsx(G,{variant:"contained",disabled:!(t!=null&&t.exportStatus),onClick:()=>{e(hu({title:"ثبت درخواست صادرات",content:u.jsx(Y6,{updateTable:D}),right:!(window.innerWidth<=600),bottom:window.innerWidth<=600}))},children:"ثبت درخواست صادرات"}),u.jsx("form",{onSubmit:eu,children:u.jsxs(v,{container:!0,alignItems:"center",gap:k.SMALL,children:[u.jsx(N,{size:"small",autoComplete:"off",label:"جستجو",variant:"outlined",style:{width:250},onChange:d}),u.jsx(G,{type:"submit",onClick:eu,endIcon:u.jsx(Ke,{}),children:"جستجو"}),u.jsx(v,{children:u.jsx(uu,{label:"از تاریخ",id:"date",renderInput:B=>u.jsx(N,{style:{width:"160px"},...B}),value:h,onChange:B=>{o(J(B).format("YYYY-MM-DD"))}})}),u.jsx(v,{children:u.jsx(uu,{label:"تا تاریخ",id:"date",renderInput:B=>u.jsx(N,{style:{width:"160px"},...B}),value:c,onChange:B=>{y(J(B).format("YYYY-MM-DD"))}})}),n===1&&u.jsx(v,{children:u.jsx(Yu,{title:"خروجی اکسل",children:u.jsx("a",{href:`${Su.defaults.baseURL}export_kill_house_excel/?date1=${h}&date2=${c}&role=${xu()}&key=${pu}`,rel:"noreferrer",children:u.jsx(G,{color:"success",children:u.jsx(Ue,{size:32})})})})})]})}),n===0?u.jsx(Wu,{data:H,columns:["ردیف","تاریخ ثبت درخواست","تاریخ کشتار","خریدار","محل کشتار","کشور مقصد","مرغدار (تلفن)","تعداد درخواست (قطعه)","میانگین وزنی (کیلوگرم)","وزن کل (کیلوگرم)","کد احراز","وضعیت","عملیات"],handlePageChange:b,totalRows:l,page:f,perPage:w,handlePerRowsChange:g,title:"صادرات"}):u.jsx(Wu,{data:a,columns:["ردیف","تاریخ ثبت درخواست","تاریخ کشتار","خریدار","محل کشتار","کشور مقصد","مرغدار (تلفن)","تعداد درخواست (قطعه)","میانگین وزنی (کیلوگرم)","وزن کل (کیلوگرم)","وضعیت","تاریخ تایید/رد","دلیل رد"],handlePageChange:b,totalRows:l,page:f,perPage:w,handlePerRowsChange:g,title:"بایگانی صادرات"})]})]})},Gn=()=>{const{pathname:e}=g6(),{slaughterPermissionState:t}=Fu(r=>r.slaughterSlice);return u.jsx(u.Fragment,{children:u.jsx(c6,{display:"flex",justifyContent:"center",children:u.jsxs(v,{container:!0,direction:"column",justifyContent:"center",xs:12,sm:12,md:10,lg:10,children:[e===se?u.jsxs(v,{justifyContent:"center",my:k.MEDIUM,children:[u.jsx(v,{children:u.jsx(I,{variant:"h6",children:"صفحه مدیریت درخواست های کشتارگاه"})}),u.jsx(Qe,{hasPermission:t})]}):u.jsx(He,{}),u.jsxs(v,{container:!0,justifyContent:"space-between",gap:k.SMALL,children:[u.jsxs(v,{xs:12,children:[e===A0&&u.jsx(sr,{steps:ir,disableDotsNavigation:!0,showButtons:!1,children:u.jsx(Ge,{})}),e===ie&&u.jsx(De,{}),e===g0&&u.jsx(cr,{}),e===v0&&u.jsx(vr,{}),e===ce&&u.jsx(Xe,{})," ",e===de&&u.jsx(Ze,{}),e===F0&&u.jsx(Me,{}),e===Ce&&u.jsx(me,{}),e===j0&&u.jsx(Fr,{}),e===he&&u.jsx(Sr,{}),e===pe&&u.jsx(kr,{}),e===f0&&u.jsx($e,{}),e===x0&&u.jsx(mr,{})]}),e===y0&&u.jsx(ze,{})]})]})})})};export{Gn as default};