import{j as u,T as I,ar as z6,as as t6,at as r6,a5 as W,aj as Du,ay as Hu,az as Ou,aA as qu,aX as Pu,an as N,al as M0,a_ as B0,B as Q,d as Nu,I as su,aM as w0,ah as Fu,aR as n6,aS as o6,aT as a6,aU as l6,aV as s6,aW as i6,ap as K6,i as V6,ao as Yu,b3 as c6,aq as G6,b7 as Q6,b as d6,b5 as C6,b6 as u0,aD as U6,ac as X6}from"./mui-vendor-D_SVL-Dx.js";import{A as Z,a4 as Z6,u as wu,c as gu,v as uu,al as h6,L as Cu,fG as p6,h as X,b3 as J6,a0 as vu,S as D,$ as eu,ce as ue,V as bu,b as mu,km as f0,O as Iu,C as Ru,W as fu,af as Eu,p as du,G as F,kn as y0,ko as x0,kp as g0,kq as v0,kr as F0,ks as j0,kt as b0,F as C0,ku as H0,kv as ee,eT as te,kw as O0,kx as q0,ky as P0,T as re,kz as E0,gu as Mu,X as Wu,gv as Uu,a6 as ne,j as ku,m as oe,kA as e0,aa as k0,ad as $u,n as T0,r as ae,kB as Y0,kC as t0,t as A6,a3 as f6,o as le,l as se,iu as ie,iv as ce,kD as de,kE as S0,kF as y6,kG as x6,fI as h0,fH as Ce,kH as he,kI as pe,kJ as Ae,kK as fe,kL as ye,kM as xe,kN as ge}from"./index-D80MdVQn.js";import{d as s0}from"./Delete-CIwpNviU.js";import{u as iu,f as tu,a as Lu}from"./redux-vendor-CfkcHgWN.js";import{r as f,f as g6,u as Xu,b as P,j as v6}from"./react-vendor-CmFgShSM.js";import{s as ve,a as Fe}from"./slaughter-new-request-ycYOSjTQ.js";import{d as je}from"./Done-CKhyNcU8.js";import{D as be}from"./DialogAlert-CML4Ua46.js";import{N as r0}from"./NumberFormatCustom-BXcOcGV4.js";import{c as z}from"./checkPathStartsWith-DedybDvj.js";import{R as zu}from"./ResponsiveTable-bUYl0qDM.js";import{N as Su}from"./NavLink-Uri4Pz8C.js";import{L as _u}from"./LinkItem-Din4toX7.js";import{a as W0,b as Ee,d as ke,e as Se,f as _e}from"./index.esm-D0kIaQoT.js";import{L as p0}from"./LineWithText-D8cjSeS5.js";import{a as De}from"./index.esm-DYumyMPq.js";import{S as we}from"./SlaughterActiveRequests-CConydyx.js";import{A as Bu}from"./AdvancedTable-DF_gMS-x.js";import{d as Ku}from"./Plagiarism-BibpZV6P.js";import{A as Te}from"./index-C-DZrBTM.js";import{d as F6}from"./PictureAsPdf-CIzo5EaA.js";import{l as me}from"./ChickenLogo-BK6_Z2uq.js";import{d as N0}from"./SlaughterShowProducts-C1xLq8AA.js";import{a as Re,c as Le}from"./province-policy-get-slaughter-buying-price-status-BoLkCLxQ.js";import{d as j6}from"./Tune-BBzxV8DK.js";import{d as Ie}from"./AddCircleOutline-5cdNoXZy.js";import{s as Me}from"./SlaughterManageBars-DS0speaj.js";import{S as Be}from"./SlaghterEnterBarInfo-DbNp5HJB.js";import{S as $0,s as He}from"./SlaughterPayProvinceFactorForm-BwQZlEga.js";import{S as z0}from"./SimpleTable-tm4uaKUf.js";import{B as Oe}from"./BackButton-Dr-K0JXJ.js";import{I as qe,f as Pe}from"./toBase64-UDzdrM-n.js";import{s as Ye,b as We,c as Ne,E as $e,a as ze,P as Ke}from"./EnterAuthCodeDirectBuy-B5Vyosnn.js";import{R as Ve,a as Ge}from"./index.esm-C1-dCPnj.js";import{S as Qe}from"./SlaughterSellCarcass-CF90lydo.js";import"./FilterAlt-DZsHj-WQ.js";import"./styled-components.browser.esm-gS9mh05b.js";import"./index-Eu1ghc4Y.js";import"./Close-J1gH5PMD.js";import"./Search-TgPAjvS8.js";import"./SystemUpdateAlt-QYMcO5S3.js";import"./resizeImage-Csf2MO3w.js";import"./ShowImage-DxnwAx1k.js";import"./Download-CJYPO5Fu.js";import"./VetFarmEditTrafficCode-C5Hod_My.js";import"./isValidIndexWeight-C_ik-uYa.js";import"./SlaughterEnterNoneReciept-By4AAznT.js";import"./ReceiptLong-BODgrrI9.js";import"./getDocumentStates-X7qXjbQL.js";import"./FileUploader-DvFCJiD0.js";import"./CloudUpload-DcjFxp8C.js";import"./CheckCircle-DhdOmw2t.js";import"./Add-CiyqkOpq.js";import"./PublishedWithChanges-Dz7dEVRv.js";import"./DoneOutline-EWJfR8n9.js";import"./ThumbUpAlt-CxZVQloD.js";import"./aviculture-get-hatching-data-BHS_PijM.js";import"./province-get-sell-for-freezing-status-q8iW-gS-.js";import"./Sms-C-zLQmIm.js";import"./ProvinceSettlementPdfKillRequest-D9Y_HkeH.js";import"./SlaughterAllocateToGuild-CeWc5BWf.js";import"./slaughter-allocate-steward-CCu9314u.js";import"./slaughter-get-guilds-for-allocate-CQRKvxsV.js";import"./province-policy-upload-image-DZLwIF5K.js";import"./MonthlyDataCalendar-_xfuL-Zd.js";import"./LabelField-BYhJrYEE.js";import"./SlaughterManageInventoryAllocationOperations-P9wf5kfn.js";import"./CheckCircleOutline-fmBK9poN.js";import"./guild-allocated-stock-operation-BLvN06p9.js";import"./getProvinceName-BZC9apsX.js";import"./getAllocationType-76F45b0K.js";const Ue=["12 - 14","14 - 16","16 - 18","18 - 20","20 - 22","22 - 24"],b6=["آرین","راس","آربراکرز (آپلاس)","کاب","هوبارد","ترکیبی","وارداتی"],E6=2.7,Xe=1e3,Ze="5000 تومان",Je=e=>({capacity:"",recieveTime:"",selectedKillhouse:(e==null?void 0:e.key)||"",selectedKillerKillhouse:"",race:b6[0],sellType:{cash:!0,haveTime:!1},weightType:{under2AndHalf:!1,over2AndHalf:!1},recieveDate:uu().format("YYYY-MM-DD hh:mm:ss"),isAccepted:vu()==="ProvinceOperator",indexWeight:E6}),ut=e=>gu({capacity:mu().required("این فیلد اجباری است!").typeError("لطفا عدد وارد کنید!"),selectedKillhouse:bu().required("این فیلد اجباری است!"),selectedKillerKillhouse:e!=null&&e.killer?bu().required("این فیلد اجباری است!"):bu(),recieveTime:bu().required("این فیلد اجباری است!").typeError("لطفا وزن را وارد کنید!"),sellType:gu().test("sellType","نحوه فروش را انتخاب کنید!",(t,r)=>r.originalValue&&Object.values(r.originalValue).some(n=>n===!0)).required("این فیلد اجباری است!"),isAccepted:ue().test("req","باید تعهد نامه را بپذیرید!",(t,r)=>r.originalValue&&r.originalValue===!0).required("این فیلد اجباری است!")}),et=()=>{var S;const[e,,t,,r]=f.useContext(Z),n=iu(),[,l]=Z6(),{profile:d,slaughterGetKillerKillhouses:C}=tu(j=>j.slaughterSlice),a=tu(j=>j.userSlice.selectedSubUser),[i,x]=f.useState(!0),[c,p]=f.useState(!1),o=wu({initialValues:Je(a),validationSchema:ut(a)}),s=o.values.capacity*Xe,v=u.jsxs(u.Fragment,{children:[u.jsxs(I,{variant:"body1",children:["اینجانب ",l.fullname," موافقت خود را نسبت به موارد ذکر شده اعلام می نمایم."]}),u.jsxs(z6,{children:[u.jsx(t6,{children:u.jsx(je,{})}),u.jsx(r6,{primary:`بر اساس این توافق نامه در صورت لغو کشتار ${o.values.capacity} قطعه مرغ ${s} ریال جریمه خواهم شد.`})]})]});f.useEffect(()=>{n(h6({role_key:z("slaughter")&&(a==null?void 0:a.key)||""})),n(Cu()),n(p6({role_key:z("slaughter")&&(a==null?void 0:a.key)||""})).then(()=>{n(X())}),n(J6()),o.validateForm()},[a==null?void 0:a.key]);const T=async()=>{n(Cu());const j=await n(ve({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:c?o.values.indexWeight:E6,chicken_breed:c?o.values.race:"تعیین نشده",cash:o.values.sellType.cash,credit:o.values.sellType.haveTime,sms_payment:i,kill_house_key:o.values.selectedKillhouse,killer_kill_house_key:o.values.selectedKillerKillhouse||null,role:vu()}));if(n(X()),j.payload.error){e({vertical:"top",horizontal:"center",msg:j.payload.error,severity:"error"});return}n(f0({selectedDate1:t,selectedDate2:r,role_key:z("slaughter")&&(a==null?void 0:a.key)||""})),n(Iu({title:j.payload.data.result,content:u.jsx(Q,{variant:"contained",onClick:()=>n(Ru()),color:"primary",children:"تایید"})})),e({vertical:"top",horizontal:"center",msg:"عملیات با موفقیت انجام شد.",severity:"success"}),n(fu({right:!1,bottom:!1,content:null}))},w=vu()==="ProvinceOperator";return u.jsxs(W,{className:"slaughter-new-request-form",container:!0,gap:D.SMALL,direction:"column",flex:"1",justifyContent:"space-between",children:[u.jsxs(W,{container:!0,direction:"column",gap:D.SMALL,children:[!(a!=null&&a.key)&&u.jsxs(Du,{fullWidth:!0,error:o.errors.selectedKillhouse&&o.touched.selectedKillhouse,children:[u.jsxs(Hu,{children:[a!=null&&a.killer?"کشتارکن":"محل کشتار"," را انتخاب کنید"]}),u.jsx(Ou,{label:"محل کشتار را انتخاب کنید",id:"selectedKillhouse",name:"selectedKillhouse",value:o.values.selectedKillhouse,onChange:o.handleChange,onBlur:o.handleBlur,children:(S=d==null?void 0:d.killHouse)==null?void 0:S.map(j=>u.jsx(qu,{value:j.key,children:j.name},j.key))}),o.errors.selectedKillhouse&&o.touched.selectedKillhouse&&u.jsx(Pu,{children:o.errors.selectedKillhouse})]}),(a==null?void 0:a.killer)&&u.jsxs(Du,{fullWidth:!0,error:o.errors.selectedKillerKillhouse&&o.touched.selectedKillerKillhouse,children:[u.jsx(Hu,{children:"محل کشتار را انتخاب کنید"}),u.jsx(Ou,{label:"محل کشتار را انتخاب کنید",id:"selectedKillerKillhouse",name:"selectedKillerKillhouse",value:o.values.selectedKillerKillhouse,onChange:o.handleChange,onBlur:o.handleBlur,children:C==null?void 0:C.map(j=>u.jsx(qu,{value:j.key,children:j.name},j.key))}),o.errors.selectedKillerKillhouse&&o.touched.selectedKillerKillhouse&&u.jsx(Pu,{children:o.errors.selectedKillerKillhouse})]}),u.jsx(W,{children:u.jsx(r0,{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(Du,{fullWidth:!0,sx:{minWidth:210},children:[u.jsx(Hu,{children:"بازه زمانی دریافت مرغ مرغدار"}),u.jsx(Ou,{id:"recieveTime",value:o.values.recieveTime,label:"بازه زمانی دریافت مرغ مرغدار",onChange:j=>{o.setFieldValue("recieveTime",j.target.value)},children:Ue.map(j=>u.jsx(qu,{value:j,children:j},j))})]})}),u.jsx(W,{children:u.jsx(eu,{label:"تاریخ کشتار",id:"recieveDate",renderInput:j=>u.jsx(N,{...j}),value:o.values.recieveDate,error:o.touched.recieveDate?!!o.errors.recieveDate:null,onChange:j=>{o.setFieldValue("recieveDate",uu(j).format("YYYY-MM-DD hh:mm:ss"))},onBlur:o.handleBlur,helperText:o.touched.recieveDate&&o.errors.recieveDate?o.errors.recieveDate:null})})]}),u.jsx(M0,{control:u.jsx(B0,{checked:c,onChange:j=>p(j.target.checked),color:"primary"}),label:"تعیین نژاد/وزن مرغ"}),c&&u.jsxs(W,{container:!0,direction:"column",gap:D.TINY,children:[u.jsxs(Du,{fullWidth:!0,children:[u.jsx(Hu,{id:"race-select-label",children:"نژاد مرغ"}),u.jsx(Ou,{labelId:"race-select-label",id:"race",label:"نژاد مرغ",value:o.values.race,error:o.touched.race?!!o.errors.race:null,onChange:j=>{o.setFieldValue("race",j.target.value)},onBlur:o.handleBlur,children:b6.map(j=>u.jsx(qu,{value:j,children:j},j))}),u.jsx(Pu,{children:o.touched.race&&o.errors.race?o.errors.race:null})]}),u.jsx(W,{children:u.jsx(r0,{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:[!w&&u.jsx(be,{title:"تعهد نامه",content:v,actions:u.jsxs(W,{container:!0,justifyContent:"end",gap:D.TINY,children:[u.jsx(Q,{variant:"outlined",color:"error",onClick:()=>o.setFieldValue("isAccepted",!1),children:"رد"}),u.jsx(Q,{variant:"contained",color:"success",onClick:()=>o.setFieldValue("isAccepted",!0),children:"موافقم"})]}),btnTitle:"با تعهد نامه موافق هستم!",isAccepted:o.values.isAccepted}),u.jsx(W,{children:u.jsx(M0,{style:{fontSize:"10px"},control:u.jsx(B0,{checked:i,onChange:j=>x(j.target.checked)}),label:u.jsx(Nu,{title:Ze,arrow:!0,children:u.jsx(I,{variant:"caption",children:"مایل به دریافت پیامک اطلاع رسانی هستم!"})})})})]}),u.jsx(W,{container:!0,mt:D.SMALL,justifyContent:"center",children:u.jsx(Q,{fullWidth:!0,variant:"contained",disabled:!o.isValid,size:"large",onClick:T,children:"ثبت درخواست"})})]})},tt=()=>{const[e,t]=f.useState([]),{slaughterRequests:r}=tu(p=>p.slaughterSlice),n=iu(),[l]=f.useContext(Z),[,,d,C,a,i]=f.useContext(Z),x=tu(p=>p.userSlice.selectedSubUser);f.useEffect(()=>{const p=Eu(new Date).format("YYYY-MM-DD");C(p),i(p)},[]),f.useEffect(()=>{n(f0({selectedDate1:d,selectedDate2:a,role_key:z("slaughter")&&(x==null?void 0:x.key)||""}))},[d,a,x==null?void 0:x.key]),f.useEffect(()=>{const p=r==null?void 0:r.map((o,s)=>{var T,w;let v;return o.state==="archive"?v="بایگانی شده":o.provinceState==="pending"?v="در انتظار تایید استان":o.provinceState==="accepted"?v="تایید شده توسط استان":o.provinceState==="rejected"&&(v="رد شده توسط استان"),[s+1,o.killHouse.name,du(o==null?void 0:o.createDate),o.provinceQuantity?o.provinceQuantity.toLocaleString():(T=o.killCapacity)==null?void 0:T.toLocaleString(),o.provinceQuantity?(w=o.killCapacity)==null?void 0:w.toLocaleString():0,o.reciveTime,du(o==null?void 0:o.reciveDate),v,u.jsx(su,{"aria-label":"delete",color:"error",onClick:()=>{n(Iu({title:"آیا مطمئن هستید؟",content:u.jsxs(W,{container:!0,alignItems:"center",justifyContent:"center",children:[u.jsx(Q,{variant:"contained",onClick:()=>{n(Cu()),n(Fe({id:o.id})).then(S=>{n(Ru()),n(X()),S.error?S.error.message.includes("403")?l({vertical:"top",horizontal:"center",msg:"این درخواست از سمت استان پذیرفته شده و قابل حذف نمی باشد!",severity:"error"}):l({vertical:"top",horizontal:"center",msg:"مشکلی پیش آمده است!",severity:"error"}):n(f0({selectedDate1:d,selectedDate2:a,role_key:z("slaughter")&&(x==null?void 0:x.key)||""})).then(()=>{l({vertical:"top",horizontal:"center",msg:"عملیات با موفقیت انجام شد.",severity:"success"})})})},children:"تایید"}),u.jsx(Q,{onClick:()=>{n(Ru())},children:"لغو"})]})}))},children:u.jsx(s0,{})},s)]});t(p)},[r]);const[c]=f.useState(["ردیف","نام کشتارگاه","تاریخ ایجاد درخواست","تعداد درخواست اولیه","تعداد مورد تایید","زمان دریافت","تاریخ درخواستی کشتار","وضعیت","حذف درخواست"]);return u.jsx(u.Fragment,{children:u.jsxs(W,{xs:12,container:!0,alignItems:"center",gap:D.SMALL,justifyContent:"flex-start",children:[u.jsx(Q,{className:"new-request-form-button",variant:"contained",onClick:()=>{n(fu({right:!(window.innerWidth<=600),bottom:window.innerWidth<=600,content:u.jsx(et,{}),title:"ثبت درخواست کشتار"}))},children:"ثبت درخواست کشتار جدید"}),u.jsx(W,{children:u.jsx(eu,{label:"از تاریخ",id:"date",renderInput:p=>u.jsx(N,{style:{width:"160px"},...p}),value:d,onChange:p=>{C(Eu(p).format("YYYY-MM-DD"))}})}),u.jsx(W,{children:u.jsx(eu,{label:"تا تاریخ",id:"date",renderInput:p=>u.jsx(N,{style:{width:"160px"},...p}),value:a,onChange:p=>{i(Eu(p).format("YYYY-MM-DD"))}})}),u.jsx(zu,{title:"درخواست های ثبت شده",columns:c,data:e,paginated:!0})]})})},rt=({hasPermission:e})=>{const{pathname:t}=g6();return u.jsxs(F,{container:!0,gap:D.SMALL,p:D.SMALL,direction:{xs:"column",md:"row"},justifyContent:"center",style:{placeContent:"baseline"},children:[e&&u.jsxs(u.Fragment,{children:[u.jsxs(F,{container:!0,direction:"column",style:{width:"100%"},children:[u.jsx(F,{children:u.jsx(p0,{text:"درخواست ها"})}),u.jsxs(F,{container:!0,gap:D.SMALL,justifyContent:"center",children:[u.jsx(Su,{to:y0,active:t===y0?"true":null,children:u.jsx(_u,{icon:u.jsx(W0,{size:30,color:"#244CCC"}),title:"ثبت درخواست",description:"مدیریت و ثبت درخواست های کشتار"})}),u.jsx(Su,{to:x0,active:t===x0?"true":null,children:u.jsx(_u,{icon:u.jsx(W0,{size:30,color:"#244CCC"}),title:"خرید مستقیم"})}),u.jsx(Su,{to:g0,active:t===g0?"true":null,children:u.jsx(_u,{icon:u.jsx(Ee,{size:30,color:"#244CCC"}),title:"صادرات"})}),u.jsx(Su,{to:v0,active:t===v0?"true":null,children:u.jsx(_u,{icon:u.jsx(ke,{size:30,color:"#244CCC"}),title:u.jsxs(F,{container:!0,direction:"column",children:[u.jsx(I,{variant:"caption",children:"سفارش های دریافت شده"}),u.jsx(I,{variant:"caption",children:"(در انتظار تایید)"})]}),description:"مشاهد درخواست های در انتظار تایید اتحادیه"})}),u.jsx(Su,{to:F0,active:t===F0?"true":null,children:u.jsx(_u,{icon:u.jsx(De,{size:30,color:"#244CCC"}),title:"تخصیصات",description:"مشاهده و تخصیص درخواست ها"})})]})]}),u.jsxs(F,{container:!0,direction:"column",style:{width:"100%"},children:[u.jsx(F,{children:u.jsx(p0,{text:"بار ها"})}),u.jsxs(F,{container:!0,justifyContent:"center",gap:D.SMALL,children:[u.jsx(Su,{to:j0,active:t===j0?"true":null,children:u.jsx(_u,{icon:u.jsx(Se,{size:30,color:"#244CCC"}),title:"تخصیص خودرو",description:"اختصاص خودرو به درخواست"})}),u.jsx(Su,{to:b0,active:t===b0?"true":null,children:u.jsx(_u,{icon:u.jsx(C0,{size:30,color:"#244CCC"}),title:"وارد کردن اطلاعات بار",description:"درخواست های در انتظار عملیات وارد کردن اطلاعات بارهای دریافتی"})}),u.jsx(Su,{to:H0,active:t===H0?"true":null,children:u.jsx(_u,{icon:u.jsx(ee,{size:30,color:"#244CCC"}),title:"انبار و توزیع",description:"درخواست های در انتظار عملیات وارد کردن اطلاعات بارهای دریافتی"})})]})]})]}),!e&&u.jsxs(F,{container:!0,justifyContent:"center",alignItems:"center",xs:12,gap:1,children:[u.jsx(te,{color:"primary"}),u.jsx(I,{color:"secondary",variant:"body1",children:"بدلیل عدم پرداخت تعرفه ، امکان استفاده از خدمات سامانه را ندارید!"})]}),u.jsxs(F,{container:!0,direction:"column",style:{width:"100%"},children:[u.jsx(F,{children:u.jsx(p0,{text:"مالی"})}),u.jsxs(F,{container:!0,justifyContent:"center",gap:D.SMALL,children:[u.jsx(Su,{to:O0,active:t===O0?"true":null,children:u.jsx(_u,{icon:u.jsx(C0,{size:30,color:"#244CCC"}),title:"مدیریت تعرفه ها"})}),u.jsx(Su,{to:q0,active:t===q0?"true":null,children:u.jsx(_u,{icon:u.jsx(_e,{size:30,color:"#244CCC"}),title:"کیف پول"})}),u.jsx(Su,{to:P0,active:t===P0?"true":null,children:u.jsx(_u,{icon:u.jsx(re,{size:30,style:{color:"#4285F4"},color:"#244CCC"}),title:"مدیریت تراکنش ها"})}),u.jsx(Su,{to:E0,active:t===E0?"true":null,children:u.jsx(_u,{icon:u.jsx(C0,{size:30,color:"#244CCC"}),title:"مدیریت فاکتورها",description:"درخواست های در پرداخت"})})]})]})]})},nt=()=>{const e=Xu(),[,,t,r,n,l]=f.useContext(Z);f.useEffect(()=>{const p=uu(new Date).format("YYYY-MM-DD");r(p),l(p)},[]);const[d,C]=f.useState([]),{slaughterActiveRequests:a}=tu(p=>p.slaughterSlice),i=iu();f.useEffect(()=>{i(Mu({selectedDate1:t,selectedDate2:n}))},[t,n]),f.useEffect(()=>{const p=a==null?void 0:a.filter((s,v)=>s.provinceKillState==="rejected"),o=p==null?void 0:p.map((s,v)=>[v+1,s.orderCode,Wu(new Date(s==null?void 0:s.sendDate),"yyyy/MM/dd"),s.poultryName,s.poultryMobile,s.city,s.province,s.age,s.quantity,u.jsx(su,{"aria-label":"delete",color:"primary",onClick:()=>e(Uu+s.poultryReqId),children:u.jsx(Ku,{})},v)]);C(o)},[a]);const[x]=f.useState(["ردیف","کد سفارش","تاریخ درخواست","مرغدار","تلفن مرغدار","شهر","استان","سن مرغ","تعداد","مشاهده"]),c=wu({initialValues:{capacity:"",recieveTime:"",recieveDate:uu(Date()).format("YYYY-MM-DD hh:mm:ss")},validationSchema:gu({capacity:mu().required("این فیلد اجباری است!").typeError("لطفا عدد وارد کنید!"),recieveTime:bu().required("این فیلد اجباری است!").typeError("لطفا وزن را وارد کنید!")})});return f.useEffect(()=>{c.validateForm()},[]),u.jsx(W,{container:!0,alignItems:"center",justifyContent:"space-between",gap:D.SMALL,mt:D.MEDIUM,children:u.jsx(w0,{sx:{width:"100%"},children:u.jsx(Bu,{name:u.jsxs(W,{container:!0,alignItems:"center",gap:D.SMALL,children:[u.jsx(W,{children:u.jsx(I,{children:"درخواست های رد شده"})}),u.jsx(W,{children:u.jsx(eu,{label:"از تاریخ",id:"date",renderInput:p=>u.jsx(N,{style:{width:"160px"},...p}),value:t,onChange:p=>{r(uu(p).format("YYYY-MM-DD"))}})}),u.jsx(W,{children:u.jsx(eu,{label:"تا تاریخ",id:"date",renderInput:p=>u.jsx(N,{style:{width:"160px"},...p}),value:n,onChange:p=>{l(uu(p).format("YYYY-MM-DD"))}})})]}),columns:x,data:d})})})},ot=()=>{const e=Xu(),t=iu(),[r,n]=f.useState([]),{avicultureRequests:l}=tu(c=>c.avicultureSlice),[,,d,C,a,i]=f.useContext(Z);f.useEffect(()=>{const c=Eu(new Date).format("YYYY-MM-DD");C(c),i(c)},[]),f.useEffect(()=>{t(Cu()),t(ne({selectedDate1:d,selectedDate2:a})).then(()=>{t(X())})},[d,a]),f.useEffect(()=>{const c=l==null?void 0:l.filter((o,s)=>o.inspector!=null),p=c==null?void 0:c.map((o,s)=>{var v,T,w,S,j,g,H,q,m,h,A,y;return[s+1,o.orderCode,du(o==null?void 0:o.createDate),du(o==null?void 0:o.sendDate),(T=(v=o==null?void 0:o.process)==null?void 0:v.poultry)==null?void 0:T.poultryName,(S=(w=o==null?void 0:o.process)==null?void 0:w.poultry)==null?void 0:S.poultryMobile,(g=(j=o==null?void 0:o.process)==null?void 0:j.poultry)==null?void 0:g.poultryCity,(q=(H=o==null?void 0:o.process)==null?void 0:H.poultry)==null?void 0:q.poultryProvince,(h=(m=o==null?void 0:o.process)==null?void 0:m.poultry)==null?void 0:h.age,(y=(A=o==null?void 0:o.process)==null?void 0:A.poultry)==null?void 0:y.poultryQuantity,u.jsx(su,{"aria-label":"delete",color:"primary",onClick:()=>{var M,E;return e(Uu+((E=(M=o==null?void 0:o.process)==null?void 0:M.poultry)==null?void 0:E.poultryRequestId))},children:u.jsx(Ku,{})},s)]});n(p)},[l]);const[x]=f.useState(["ردیف","کد سفارش","تاریخ ثبت درخواست","تاریخ درخواست","مرغدار","تلفن مرغدار","شهر","استان","سن مرغ","تعداد","مشاهده"]);return u.jsx(w0,{children:u.jsx(Bu,{name:u.jsxs(F,{container:!0,alignItems:"center",gap:D.SMALL,children:[u.jsx(F,{children:u.jsx(I,{children:"درخواست های بایگانی شده"})}),u.jsx(F,{children:u.jsx(eu,{label:"از تاریخ",id:"date",renderInput:c=>u.jsx(N,{style:{width:"160px"},...c}),value:d,onChange:c=>{C(Eu(c).format("YYYY-MM-DD"))}})}),u.jsx(F,{children:u.jsx(eu,{label:"تا تاریخ",id:"date",renderInput:c=>u.jsx(N,{style:{width:"160px"},...c}),value:a,onChange:c=>{i(Eu(c).format("YYYY-MM-DD"))}})})]}),expandable:!0,columns:x,data:r})})};var at={attributes:!0,characterData:!0,subtree:!0,childList:!0};function lt(e,t,r=at){f.useEffect(()=>{if(e.current){const n=new MutationObserver(t);return n.observe(e.current,r),()=>{n.disconnect()}}},[t,r])}var k6=function(){if(typeof Map<"u")return Map;function e(t,r){var n=-1;return t.some(function(l,d){return l[0]===r?(n=d,!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),l=this.__entries__[n];return l&&l[1]},t.prototype.set=function(r,n){var l=e(this.__entries__,r);~l?this.__entries__[l][1]=n:this.__entries__.push([r,n])},t.prototype.delete=function(r){var n=this.__entries__,l=e(n,r);~l&&n.splice(l,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 l=0,d=this.__entries__;l0},e.prototype.connect_=function(){!_0||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),ht?(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(){!_0||!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,l=Ct.some(function(d){return!!~n.indexOf(d)});l&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e}(),S6=function(e,t){for(var r=0,n=Object.keys(t);r"u"||!(Element instanceof Object))){if(!(t instanceof Vu(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var r=this.observations_;r.has(t)||(r.set(t,new jt(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 Vu(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 bt(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}(),D6=typeof WeakMap<"u"?new WeakMap:new k6,w6=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=pt.getInstance(),n=new Et(t,r,this);D6.set(this,n)}return e}();["observe","unobserve","disconnect"].forEach(function(e){w6.prototype[e]=function(){var t;return(t=D6.get(this))[e].apply(t,arguments)}});var kt=function(){return typeof n0.ResizeObserver<"u"?n0.ResizeObserver:w6}(),St=({mutationObservables:e,resizeObservables:t,refresh:r})=>{const[n,l]=f.useState(0),d=f.useRef(document.documentElement||document.body);function C(i){const x=Array.from(i);for(const c of x)if(e){if(!c.attributes)continue;e.find(o=>c.matches(o))&&r(!0)}}function a(i){const x=Array.from(i);for(const c of x)if(t){if(!c.attributes)continue;t.find(o=>c.matches(o))&&l(n+1)}}return lt(d,i=>{for(const x of i)x.addedNodes.length!==0&&(C(x.addedNodes),a(x.addedNodes)),x.removedNodes.length!==0&&(C(x.removedNodes),a(x.removedNodes))},{childList:!0,subtree:!0}),f.useEffect(()=>{if(!t)return;const i=new kt(()=>{r()});for(const x of t){const c=document.querySelector(x);c&&i.observe(c)}return()=>{i.disconnect()}},[t,n]),null},_t=St;function Ju(e){let t=T6;return e&&(t=e.getBoundingClientRect()),t}function Dt(e,t){const[r,n]=f.useState(T6),l=f.useCallback(()=>{e!=null&&e.current&&n(Ju(e==null?void 0:e.current))},[e==null?void 0:e.current]);return f.useEffect(()=>(l(),window.addEventListener("resize",l),()=>window.removeEventListener("resize",l)),[e==null?void 0:e.current,t]),r}var T6={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0};function wt(e,t){return new Promise(r=>{if(!(e instanceof Element))throw new TypeError("Argument 1 must be an Element");let n=0,l=null;const d=Object.assign({behavior:"smooth"},t);e.scrollIntoView(d),requestAnimationFrame(C);function C(){const a=e==null?void 0:e.getBoundingClientRect().top;if(a===l){if(n++>2)return r(null)}else n=0,l=a;requestAnimationFrame(C)}})}function Zu(e){return e<0?0:e}function Tt(e){return typeof e=="object"&&e!==null?{thresholdX:e.x||0,thresholdY:e.y||0}:{thresholdX:e||0,thresholdY:e||0}}function c0(){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 mt({top:e,right:t,bottom:r,left:n,threshold:l}){const{w:d,h:C}=c0(),{thresholdX:a,thresholdY:i}=Tt(l);return e<0&&r-e>C?!0:e>=0+i&&n>=0+a&&r<=C-i&&t<=d-a}var V0=(e,t)=>e>t,G0=(e,t)=>e>t;function Rt(e,t=[]){const r=(n,l)=>t.includes(n)?1:t.includes(l)?-1:0;return Object.keys(e).map(n=>({position:n,value:e[n]})).sort((n,l)=>l.value-n.value).sort((n,l)=>r(n.position,l.position)).filter(n=>n.value>0).map(n=>n.position)}var A0=10;function D0(e=A0){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]]:[A0,A0]:[e,e,e,e]}var Lt={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 It(e){return(t,r)=>{const n=Lt[t](r),l=e[t];return l?l(n,r):n}}var Mt=({padding:e=10,wrapperPadding:t=0,onClick:r,onClickHighlighted:n,styles:l={},sizes:d,className:C,highlightedAreaClassName:a,maskId:i,clipId:x})=>{const c=i||Q0("mask__"),p=x||Q0("clip__"),o=It(l),[s,v,T,w]=D0(e),[S,j,g,H]=D0(t),{w:q,h:m}=c0(),h=Zu((d==null?void 0:d.width)+w+v),A=Zu((d==null?void 0:d.height)+s+T),y=Zu((d==null?void 0:d.top)-s-S),M=Zu((d==null?void 0:d.left)-w-H),E=q-H-j,_=m-S-g,$=o("maskArea",{x:M,y,width:h,height:A}),G=o("highlightedArea",{x:M,y,width:h,height:A});return P.createElement("div",{style:o("maskWrapper",{}),onClick:r,className:C},P.createElement("svg",{width:E,height:_,xmlns:"http://www.w3.org/2000/svg",style:o("svgWrapper",{windowWidth:E,windowHeight:_,wpt:S,wpl:H})},P.createElement("defs",null,P.createElement("mask",{id:c},P.createElement("rect",{x:0,y:0,width:E,height:_,fill:"white"}),P.createElement("rect",{style:$,rx:$.rx?1:void 0})),P.createElement("clipPath",{id:p},P.createElement("polygon",{points:`0 0, 0 ${_}, ${M} ${_}, ${M} ${y}, ${M+h} ${y}, ${M+h} ${y+A}, ${M} ${y+A}, ${M} ${_}, ${E} ${_}, ${E} 0`}))),P.createElement("rect",{style:o("maskRect",{windowWidth:E,windowHeight:_,maskID:c})}),P.createElement("rect",{style:o("clickArea",{windowWidth:E,windowHeight:_,top:y,left:M,width:h,height:A,clipID:p})}),P.createElement("rect",{style:G,className:a,onClick:n,rx:G.rx?1:void 0})))},Bt=Mt;function Q0(e){return e+Math.random().toString(36).substring(2,16)}var Ht=Object.defineProperty,a0=Object.getOwnPropertySymbols,m6=Object.prototype.hasOwnProperty,R6=Object.prototype.propertyIsEnumerable,U0=(e,t,r)=>t in e?Ht(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,X0=(e,t)=>{for(var r in t||(t={}))m6.call(t,r)&&U0(e,r,t[r]);if(a0)for(var r of a0(t))R6.call(t,r)&&U0(e,r,t[r]);return e},Ot=(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&&R6.call(e,n)&&(r[n]=e[n]);return r},qt={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 Pt(e){return(t,r)=>{const n=qt[t](r),l=e[t];return l?l(n,r):n}}var Yt=e=>{var t=e,{children:r,position:n="bottom",padding:l=10,styles:d={},sizes:C,refresher:a}=t,i=Ot(t,["children","position","padding","styles","sizes","refresher"]);const x=f.useRef(null),c=f.useRef(""),p=f.useRef(""),o=f.useRef(""),{w:s,h:v}=c0(),T=Pt(d),w=Dt(x,a),{width:S,height:j}=w,[g,H,q,m]=D0(l),h=(C==null?void 0:C.left)-m,A=(C==null?void 0:C.top)-g,y=(C==null?void 0:C.right)+H,M=(C==null?void 0:C.bottom)+q,E=n&&typeof n=="function"?n({width:S,height:j,windowWidth:s,windowHeight:v,top:A,left:h,right:y,bottom:M,x:C.x,y:C.y},w):n,_={left:h,right:s-y,top:A,bottom:v-M},$=(R,Y,b)=>{switch(R){case"top":return _.top>j+q;case"right":return Y?!1:_.right>S+m;case"bottom":return b?!1:_.bottom>j+g;case"left":return _.left>S+H;default:return!1}},G=(R,Y,b)=>{const L=Rt(_,b?["right","left"]:Y?["top","bottom"]:[]);for(let V=0;V{if(Array.isArray(R)){const J=V0(R[0],s),cu=G0(R[1],v);return c.current="custom",[J?s/2-S/2:R[0],cu?v/2-j/2:R[1]]}const Y=V0(h+S,s),b=G0(M+j,v),L=Y?Math.min(h,s-S):Math.max(h,0),V=b?j>_.bottom?Math.max(M-j,0):Math.max(A,0):A;b&&j>_.bottom?p.current="bottom":p.current="top",Y?o.current="left":o.current="right";const nu={top:[L-m,A-j-q],right:[y+m,V-g],bottom:[L-m,M+g],left:[h-S-H,V-g],center:[s/2-S/2,v/2-j/2]};return R==="center"||$(R,Y,b)&&!Y&&!b?(c.current=R,nu[R]):G(nu,Y,b)})(E);return P.createElement("div",X0({className:"reactour__popover",style:X0({transform:`translate(${Math.round(yu[0])}px, ${Math.round(yu[1])}px)`},T("popover",{position:c.current,verticalAlign:p.current,horizontalAlign:o.current,helperRect:w,targetRect:C})),ref:x},i),r)},Wt=Yt,Nt=Object.defineProperty,$t=Object.defineProperties,zt=Object.getOwnPropertyDescriptors,l0=Object.getOwnPropertySymbols,L6=Object.prototype.hasOwnProperty,I6=Object.prototype.propertyIsEnumerable,Z0=(e,t,r)=>t in e?Nt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,xu=(e,t)=>{for(var r in t||(t={}))L6.call(t,r)&&Z0(e,r,t[r]);if(l0)for(var r of l0(t))I6.call(t,r)&&Z0(e,r,t[r]);return e},m0=(e,t)=>$t(e,zt(t)),Qu=(e,t)=>{var r={};for(var n in e)L6.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&l0)for(var n of l0(e))t.indexOf(n)<0&&I6.call(e,n)&&(r[n]=e[n]);return r},Kt={bottom:0,height:0,left:0,right:0,top:0,width:0,windowWidth:0,windowHeight:0,x:0,y:0};function Vt(e,t={block:"center",behavior:"smooth",inViewThreshold:0}){const[r,n]=f.useState(!1),[l,d]=f.useState(!1),[C,a]=f.useState(!1),[i,x]=f.useState(null),[c,p]=f.useState(Kt),o=(e==null?void 0:e.selector)instanceof Element?e==null?void 0:e.selector:document.querySelector(e==null?void 0:e.selector),s=f.useCallback(()=>{const T=J0(o,e==null?void 0:e.highlightedSelectors,e==null?void 0:e.bypassElem),{hasHighligtedElems:w}=T,S=Qu(T,["hasHighligtedElems"]);Object.entries(c).some(([j,g])=>S[j]!==g)&&p(S)},[o,e==null?void 0:e.highlightedSelectors,c]);f.useEffect(()=>(s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s)),[o,e==null?void 0:e.highlightedSelectors,i]),f.useEffect(()=>{!mt(m0(xu({},c),{threshold:t.inViewThreshold}))&&o&&(n(!0),wt(o,t).then(()=>{l||x(Date.now())}).finally(()=>{n(!1)}))},[c]);const v=f.useCallback(()=>{d(!0);const T=J0(o,e==null?void 0:e.highlightedSelectors,e==null?void 0:e.bypassElem),{hasHighligtedElems:w}=T,S=Qu(T,["hasHighligtedElems"]);a(w),p(S),d(!1)},[o,e==null?void 0:e.highlightedSelectors,c]);return{sizes:c,transition:r,target:o,observableRefresher:v,isHighlightingObserved:C}}function J0(e,t=[],r=!0){let n=!1;const{w:l,h:d}=c0();if(!t)return m0(xu({},Ju(e)),{windowWidth:l,windowHeight:d,hasHighligtedElems:!1});let C=Ju(e),a={bottom:0,height:0,left:l,right:0,top:d,width:0};for(const x of t){const c=document.querySelector(x);if(!c||c.style.display==="none"||c.style.visibility==="hidden")continue;const p=Ju(c);n=!0,r||!e?(p.topa.right&&(a.right=p.right),p.bottom>a.bottom&&(a.bottom=p.bottom),p.leftC.right&&(C.right=p.right),p.bottom>C.bottom&&(C.bottom=p.bottom),p.left0&&a.height>0:!1;return{left:(i?a:C).left,top:(i?a:C).top,right:(i?a:C).right,bottom:(i?a:C).bottom,width:(i?a:C).width,height:(i?a:C).height,windowWidth:l,windowHeight:d,hasHighligtedElems:n,x:C.x,y:C.y}}var Gt=({disableKeyboardNavigation:e,setCurrentStep:t,currentStep:r,setIsOpen:n,stepsLength:l,disable:d,rtl:C,clickProps:a,keyboardHandler:i})=>{function x(c){if(c.stopPropagation(),e===!0||d)return;let p,o,s;e&&(p=e.includes("esc"),o=e.includes("right"),s=e.includes("left"));function v(){t(Math.min(r+1,l-1))}function T(){t(Math.max(r-1,0))}i&&typeof i=="function"?i(c,a,{isEscDisabled:p,isRightDisabled:o,isLeftDisabled:s}):(c.keyCode===27&&!p&&(c.preventDefault(),n(!1)),c.keyCode===39&&!o&&(c.preventDefault(),C?T():v()),c.keyCode===37&&!s&&(c.preventDefault(),C?v():T()))}return f.useEffect(()=>(window.addEventListener("keydown",x,!1),()=>{window.removeEventListener("keydown",x)}),[d,t,r]),null},Qt=Gt,Ut={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 d0(e){return(t,r)=>{const n=Ut[t](r),l=e[t];return l?l(n,r):n}}var Xt=({styles:e={},children:t})=>{const r=d0(e);return P.createElement("span",{style:r("badge",{})},t)},Zt=Xt,Jt=e=>{var t=e,{styles:r={},onClick:n,disabled:l}=t,d=Qu(t,["styles","onClick","disabled"]);const C=d0(r);return P.createElement("button",xu({className:"reactour__close-button",style:xu(xu({},C("button",{})),C("close",{disabled:l})),onClick:n},d),P.createElement("svg",{viewBox:"0 0 9.1 9.1","aria-hidden":!0,role:"presentation",style:xu({},C("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"})))},ur=Jt,er=({content:e,setCurrentStep:t,transition:r,isHighlightingObserved:n,currentStep:l,setIsOpen:d})=>typeof e=="function"?e({setCurrentStep:t,transition:r,isHighlightingObserved:n,currentStep:l,setIsOpen:d}):e,tr=er,rr=({styles:e={},steps:t,setCurrentStep:r,currentStep:n,setIsOpen:l,nextButton:d,prevButton:C,disableDots:a,hideDots:i,hideButtons:x,disableAll:c,rtl:p,Arrow:o=M6})=>{const s=t.length,v=d0(e),T=({onClick:w,kind:S="next",children:j,hideArrow:g})=>{function H(){c||(w&&typeof w=="function"?w():r(S==="next"?Math.min(n+1,s-1):Math.max(n-1,0)))}return P.createElement("button",{style:v("button",{kind:S,disabled:c||(S==="next"?s-1===n:n===0)}),onClick:H,"aria-label":`Go to ${S} step`},g?null:P.createElement(o,{styles:e,inverted:p?S==="prev":S==="next",disabled:c||(S==="next"?s-1===n:n===0)}),j)};return P.createElement("div",{style:v("controls",{}),dir:p?"rtl":"ltr"},x?null:C&&typeof C=="function"?C({Button:T,setCurrentStep:r,currentStep:n,stepsLength:s,setIsOpen:l,steps:t}):P.createElement(T,{kind:"prev"}),i?null:P.createElement("div",{style:v("navigation",{})},Array.from({length:s},(w,S)=>S).map(w=>{var S;return P.createElement("button",{style:v("dot",{current:w===n,disabled:a||c}),onClick:()=>{!a&&!c&&r(w)},key:`navigation_dot_${w}`,"aria-label":((S=t[w])==null?void 0:S.navDotAriaLabel)||`Go to step ${w+1}`})})),x?null:d&&typeof d=="function"?d({Button:T,setCurrentStep:r,currentStep:n,stepsLength:s,setIsOpen:l,steps:t}):P.createElement(T,null))},nr=rr,M6=({styles:e={},inverted:t=!1,disabled:r})=>{const n=d0(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"}))},or={Badge:Zt,Close:ur,Content:tr,Navigation:nr,Arrow:M6},ar=e=>xu(xu({},or),e),lr=({styles:e,components:t={},badgeContent:r,accessibilityOptions:n,disabledActions:l,onClickClose:d,steps:C,setCurrentStep:a,currentStep:i,transition:x,isHighlightingObserved:c,setIsOpen:p,nextButton:o,prevButton:s,disableDotsNavigation:v,rtl:T,showPrevNextButtons:w=!0,showCloseButton:S=!0,showNavigation:j=!0,showBadge:g=!0,showDots:H=!0,meta:q,setMeta:m,setSteps:h})=>{const A=C[i],{Badge:y,Close:M,Content:E,Navigation:_,Arrow:$}=ar(t),G=r&&typeof r=="function"?r({currentStep:i,totalSteps:C.length,transition:x}):i+1;function hu(){l||(d&&typeof d=="function"?d({setCurrentStep:a,setIsOpen:p,currentStep:i,steps:C,meta:q,setMeta:m,setSteps:h}):p(!1))}return P.createElement(P.Fragment,null,g?P.createElement(y,{styles:e},G):null,S?P.createElement(M,{styles:e,"aria-label":n==null?void 0:n.closeButtonAriaLabel,disabled:l,onClick:hu}):null,P.createElement(E,{content:A==null?void 0:A.content,setCurrentStep:a,currentStep:i,transition:x,isHighlightingObserved:c,setIsOpen:p}),j?P.createElement(_,{setCurrentStep:a,currentStep:i,setIsOpen:p,steps:C,styles:e,"aria-hidden":!(n!=null&&n.showNavigationScreenReaders),nextButton:o,prevButton:s,disableDots:v,hideButtons:!w,hideDots:!H,disableAll:l,rtl:T,Arrow:$}):null)},sr=lr,ir=e=>{var t=e,{currentStep:r,setCurrentStep:n,setIsOpen:l,steps:d=[],setSteps:C,styles:a={},scrollSmooth:i,afterOpen:x,beforeClose:c,padding:p=10,position:o,onClickMask:s,onClickHighlighted:v,keyboardHandler:T,className:w="reactour__popover",maskClassName:S="reactour__mask",highlightedMaskClassName:j,clipId:g,maskId:H,disableInteraction:q,disableKeyboardNavigation:m,inViewThreshold:h,disabledActions:A,setDisabledActions:y,disableWhenSelectorFalsy:M,rtl:E,accessibilityOptions:_={closeButtonAriaLabel:"Close Tour",showNavigationScreenReaders:!0},ContentComponent:$,Wrapper:G,meta:hu,setMeta:yu,onTransition:R=()=>"center"}=t,Y=Qu(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"]),b;const L=d[r],V=xu(xu({},a),L==null?void 0:L.styles),{sizes:nu,transition:J,observableRefresher:cu,isHighlightingObserved:pu,target:ru}=Vt(L,{block:"center",behavior:i?"smooth":"auto",inViewThreshold:h});f.useEffect(()=>(x&&typeof x=="function"&&x(ru),()=>{c&&typeof c=="function"&&c(ru)}),[]);const{maskPadding:Tu,popoverPadding:ju,wrapperPadding:k}=dr((b=L==null?void 0:L.padding)!=null?b:p),O={setCurrentStep:n,setIsOpen:l,currentStep:r,setSteps:C,steps:d,setMeta:yu,meta:hu};function U(){A||(s&&typeof s=="function"?s(O):l(!1))}const ou=typeof(L==null?void 0:L.stepInteraction)=="boolean"?!(L!=null&&L.stepInteraction):q?typeof q=="boolean"?q:q(O):!1;f.useEffect(()=>(L!=null&&L.action&&typeof(L==null?void 0:L.action)=="function"&&(L==null||L.action(ru)),(L==null?void 0:L.disableActions)!==void 0&&y(L==null?void 0:L.disableActions),()=>{L!=null&&L.actionAfter&&typeof(L==null?void 0:L.actionAfter)=="function"&&(L==null||L.actionAfter(ru))}),[L]);const au=J?R:L!=null&&L.position?L==null?void 0:L.position:o,lu=G||P.Fragment;return L?P.createElement(lu,null,P.createElement(_t,{mutationObservables:L==null?void 0:L.mutationObservables,resizeObservables:L==null?void 0:L.resizeObservables,refresh:cu}),P.createElement(Qt,{setCurrentStep:n,currentStep:r,setIsOpen:l,stepsLength:d.length,disableKeyboardNavigation:m,disable:A,rtl:E,clickProps:O,keyboardHandler:T}),(!M||ru)&&P.createElement(Bt,{sizes:J?Cr:nu,onClick:U,styles:xu({highlightedArea:Au=>m0(xu({},Au),{display:ou?"block":"none"})},V),padding:J?0:Tu,highlightedAreaClassName:j,className:S,onClickHighlighted:Au=>{Au.preventDefault(),Au.stopPropagation(),v&&v(Au,O)},wrapperPadding:k,clipId:g,maskId:H}),(!M||ru)&&P.createElement(Wt,{sizes:nu,styles:V,position:au,padding:ju,"aria-labelledby":_==null?void 0:_.ariaLabelledBy,className:w,refresher:r},$?P.createElement($,xu({styles:V,setCurrentStep:n,currentStep:r,setIsOpen:l,steps:d,accessibilityOptions:_,disabledActions:A,transition:J,isHighlightingObserved:pu,rtl:E},Y)):P.createElement(sr,xu({styles:V,setCurrentStep:n,currentStep:r,setIsOpen:l,steps:d,setSteps:C,accessibilityOptions:_,disabledActions:A,transition:J,isHighlightingObserved:pu,rtl:E,meta:hu,setMeta:yu},Y)))):null},cr=ir;function dr(e){return typeof e=="object"&&e!==null?{maskPadding:e.mask,popoverPadding:e.popover,wrapperPadding:e.wrapper}:{maskPadding:e,popoverPadding:e,wrapperPadding:0}}var Cr={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0},hr={isOpen:!1,setIsOpen:()=>!1,currentStep:0,setCurrentStep:()=>0,steps:[],setSteps:()=>[],setMeta:()=>"",disabledActions:!1,setDisabledActions:()=>!1,components:{}},pr=P.createContext(hr),Ar=e=>{var t=e,{children:r,defaultOpen:n=!1,startAt:l=0,steps:d,setCurrentStep:C,currentStep:a}=t,i=Qu(t,["children","defaultOpen","startAt","steps","setCurrentStep","currentStep"]);const[x,c]=f.useState(n),[p,o]=f.useState(l),[s,v]=f.useState(d),[T,w]=f.useState(""),[S,j]=f.useState(!1),g=xu({isOpen:x,setIsOpen:c,currentStep:a||p,setCurrentStep:C&&typeof C=="function"?C:o,steps:s,setSteps:v,disabledActions:S,setDisabledActions:j,meta:T,setMeta:w},i);return P.createElement(pr.Provider,{value:g},r,x?P.createElement(cr,xu({},g)):null)};const fr=[{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:"درخواست های بایگانی شده شما در این قسمت نمایش داده می شود."})}],u6=Lu("CHECK_REQUEST_BY_SLAUGHTER",async e=>{const{data:t,status:r}=await ku.post("kill_house_check_request/",e);return{data:t,status:r}});function B6({reqKey:e,poultryRequestKey:t}){const[r]=f.useContext(Z),[n,l]=f.useState(!1),d=iu(),{id:C}=v6(),a=tu(s=>s.userSlice.selectedSubUser),[,,i,,x]=f.useContext(Z),c=wu({initialValues:{rejectText:""},validationSchema:gu({rejectText:bu().required("این فیلد اجباری است!").typeError("لطفا دلیل خود را بیان کنید.")})}),p=vu()==="ProvinceOperator"?"ثبت اطلاعات بجای کشتارگاه":"ثبت اطلاعات و ارسال به استان",o=vu()==="ProvinceOperator"?"رد اطلاعات بجای کشتارگاه":"رد اطلاعات و پیام به استان";return u.jsx(F,{children:u.jsx(F,{container:!0,gap:D.SMALL,padding:D.SMALL,children:u.jsx(Te,{children:n?u.jsx(oe.div,{animate:{x:-10,opacity:1},transition:{duration:.3},initial:{opacity:0},exit:{opacity:0},children:u.jsxs(F,{flexDirection:"column",container:!0,gap:D.SMALL,children:[u.jsx(F,{children:u.jsx(N,{multiline:!0,rows:4,fullWidth:!0,id:"rejectText",label:"پیام خود را وارد کنید",variant:"outlined",value:c.values.rejectText,error:c.touched.rejectText?!!c.errors.rejectText:null,onChange:c.handleChange,onBlur:c.handleBlur,helperText:c.touched.rejectText&&c.errors.rejectText?c.errors.rejectText:null})}),u.jsxs(F,{container:!0,gap:D.SMALL,children:[u.jsx(F,{children:u.jsx(Q,{variant:"outlined",color:"secondary",onClick:()=>{l(!1)},children:"لغو"})}),u.jsx(F,{children:u.jsx(Q,{variant:"outlined",onClick:()=>{d(Cu()),d(u6({message:c.values.rejectText,province_kill_request_key:e,state:"rejected"})).then(s=>{d(X()),s.error?r({vertical:"top",horizontal:"center",msg:"مشکلی پیش آمده است!",severity:"error"}):(d(fu({right:!1,bottom:!1,top:!1,content:null})),d(e0({id:C,role_key:z("slaughter")&&(a==null?void 0:a.key)||""})),l(!1),d(k0({key:t,role_key:z("slaughter")&&(a==null?void 0:a.key)||""})),d(Mu({selectedDate1:i,selectedDate2:x,role_key:z("slaughter")&&(a==null?void 0:a.key)||""})),r({vertical:"top",horizontal:"center",msg:"عملیات با موفقیت انجام شد.",severity:"success"}))})},children:"رد اطلاعات و پیام به استان"})})]})]})}):u.jsxs(F,{container:!0,gap:D.SMALL,children:[u.jsx(Q,{variant:"outlined",color:"secondary",onClick:()=>{l(!0)},children:o}),u.jsx(Q,{variant:"outlined",onClick:()=>{d(Cu()),d(u6({province_kill_request_key:e,state:"accepted",role:vu()})).then(s=>{d(X()),s.error?r({vertical:"top",horizontal:"center",msg:"مشکلی پیش آمده است!",severity:"error"}):(d(fu({right:!1,bottom:!1,top:!1,content:null})),d(e0({id:C,role_key:z("slaughter")&&(a==null?void 0:a.key)||""})),d(k0({key:t,role_key:z("slaughter")&&(a==null?void 0:a.key)||""})),d(Mu({selectedDate1:i,selectedDate2:x,role_key:z("slaughter")&&(a==null?void 0:a.key)||""})),r({vertical:"top",horizontal:"center",msg:"عملیات با موفقیت انجام شد.",severity:"success"}),d(Iu({title:"عملیات با موفقیت انجام شد.",content:u.jsxs(F,{container:!0,direction:"column",gap:D.MEDIUM,alignItems:"center",justifyContent:"center",children:[u.jsx(F,{children:u.jsx(I,{color:"green",children:"پرونده به کارتابل (تخصیص خودرو) انتقال پیدا کرد."})}),u.jsx(F,{children:u.jsx(Q,{variant:"contained",color:"success",onClick:()=>{d(Ru())},children:"تایید"})})]})})))})},children:p})]})})})})}B6.propTypes={reqKey:Fu.PropTypes.string,poultryRequestKey:Fu.PropTypes.string};const H6=({item:e})=>u.jsx(u.Fragment,{children:u.jsxs(n6,{sx:{alignSelf:"flex-start",width:"100%"},children:[u.jsxs(o6,{children:[u.jsx(a6,{color:"secondary"}),u.jsx(l6,{})]}),u.jsxs(F,{container:!0,direction:"column",flexWrap:"nowrap",flex:"1",children:[u.jsxs(F,{container:!0,children:[u.jsx(F,{children:u.jsx(s6,{variant:"body1",fontWeight:"bold",color:"secondary",children:"انجام عملیات"})}),u.jsx(F,{children:u.jsx(i6,{color:"textSecondary",children:u.jsx(I,{variant:"body2",children:"در این مرحله تخصیص را تایید یا رد کنید."})})})]}),u.jsx(F,{children:u.jsx(F,{container:!0,direction:"column",alignItems:"start",mt:D.TINY,children:u.jsx(B6,{reqKey:e.provinceKillReqKey,poultryRequestKey:e.poultryReqKey},e.provinceKillReqKey)},e.date.valueOf())})]})]})});H6.propTypes={item:Fu.PropTypes.object,i:Fu.PropTypes.any,poultryRequestKey:Fu.PropTypes.any};const yr=()=>{const e=Xu(),[t,r]=f.useState([]),{slaughterActiveRequests:n}=tu(o=>o.slaughterSlice),l=iu(),[,,d,C,a,i]=f.useContext(Z),x=tu(o=>o.userSlice.selectedSubUser);f.useEffect(()=>{const o=uu(new Date).format("YYYY-MM-DD");C(o),i(o)},[]),f.useEffect(()=>{l(Mu({selectedDate1:d,selectedDate2:a,role_key:z("slaughter")&&(x==null?void 0:x.key)||""}))},[d,a,x==null?void 0:x.key]),f.useEffect(()=>{const o=n==null?void 0:n.filter(v=>v.provinceKillState==="pending"),s=o==null?void 0:o.map((v,T)=>[T+1,v.orderCode,v!=null&&v.freezing?"انجماد":v!=null&&v.export?"صادرات":"عادی",(v==null?void 0:v.freeSaleInProvince)===!1?"دولتی":"آزاد",Wu(new Date(v==null?void 0:v.sendDate),"yyyy/MM/dd"),`${v.poultryName} (${v.poultryMobile})`,`${v.killHouseName} (${v.killHouseMobile})`,v.city,v.province,v.age,v.mainQuantity.toLocaleString()+" قطعه",v.amount.toLocaleString()+" ﷼",v.chickenBreed,v.indexWeight+" کیلوگرم",u.jsx(su,{color:"primary",onClick:()=>{l(fu({title:"انجام عملیات تخصیص",top:!(window.innerWidth<=600),bottom:window.innerWidth<=600,content:u.jsx(H6,{item:v,i:T})}))},children:u.jsx($u,{})},T),u.jsx(su,{"aria-label":"delete",color:"primary",onClick:()=>e(Uu+v.poultryReqId),children:u.jsx(Ku,{})},T)]);r(s)},[n]);const[c]=f.useState(["ردیف","کد سفارش","کشتار","فروش","تاریخ درخواست","مرغدار","خریدار","شهر","استان","سن مرغ","تعداد","قیمت مرغ زنده","نژاد","میانگین وزن","عملیات","مشاهده"]),p=wu({initialValues:{capacity:"",recieveTime:"",recieveDate:uu(Date()).format("YYYY-MM-DD hh:mm:ss")},validationSchema:gu({capacity:mu().required("این فیلد اجباری است!").typeError("لطفا عدد وارد کنید!"),recieveTime:bu().required("این فیلد اجباری است!").typeError("لطفا وزن را وارد کنید!")})});return f.useEffect(()=>{p.validateForm()},[]),u.jsxs(W,{container:!0,direction:"column",gap:D.SMALL,mt:D.MEDIUM,children:[u.jsxs(W,{container:!0,alignItems:"center",gap:D.SMALL,children:[u.jsx(eu,{label:"از تاریخ",id:"date",renderInput:o=>u.jsx(N,{style:{width:"160px"},...o}),value:d,onChange:o=>{C(uu(o).format("YYYY-MM-DD"))}}),u.jsx(eu,{label:"تا تاریخ",id:"date",renderInput:o=>u.jsx(N,{style:{width:"160px"},...o}),value:a,onChange:o=>{i(uu(o).format("YYYY-MM-DD"))}})]}),u.jsx(zu,{title:"درخواست های در انتظار تایید",columns:c,data:t,paginated:!0})]})},xr=()=>{const e=tu(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%"}},R0=f.forwardRef((e,t)=>{const{date:r}=e,{amount:n}=e,{breeder:l}=e,{buyer:d}=e,C=T0(),a=xr();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:me,style:K.logo}),u.jsx("span",{style:K.mainTitle,children:"اتحادیه شرکتهاي تعاونی کشاورزي"}),u.jsxs("span",{style:K.title,children:["مرغداران "," ‌"," ",C]}),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:["تاریخ: ",du(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:["این حواله در تاریخ "," ‌"," ",du(r)," جهت بارگیري تعداد"," ",n.toLocaleString()," قطعه مرغ زنده تحویل مرغداري ",l," گردید.",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:["امضا خریدار آقا/خانم ",d]})})}),u.jsx("br",{}),u.jsx("br",{}),u.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",justifyItems:"center",marginBottom:15},children:[u.jsx(N0,{style:K.cutIcon}),u.jsx("div",{style:K.divider2})]}),u.jsxs("p",{style:K.pTitleContainer,children:["مطابق برگ باسکول پیوستی، خروج تعداد ",n.toLocaleString()," قطعه به وزن ......................... کیلوگرم در تاریخ "," ‌",du(r)," از مرغداري آقا/خانم"," ‌",l," ‌"," مورد تایید اینجانب می باشد.",u.jsx("br",{}),u.jsx("br",{}),u.jsx("br",{})]}),u.jsx("span",{style:K.centerText,children:u.jsxs("strong",{children:["امضا خریدار آقا/خانم ",d]})}),u.jsx("br",{}),u.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",justifyItems:"center",marginBottom:15},children:[u.jsx(N0,{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()," قطعه به وزن ......................... کیلوگرم توسط آقا/خانم "," ‌",d," ‌"," مورد تائید اینجانب "," ‌",l," ‌"," مالک / نماینده قانونی مرغداری "," ‌",l," ‌"," باشد."]}),u.jsx("br",{}),u.jsx("span",{style:K.centerText,children:u.jsxs("strong",{children:["مهر و امضا ",l," "," ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌"," ","اثر انگشت"]})}),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:a})]})]})});R0.displayName="SlaughterSendKillerInvoice";R0.propTypes={item:Fu.PropTypes.any};const gr=Lu("SLAUGHTER_EDIT_CHICKEN_PRICE_SERVICE",async(e,{dispatch:t})=>{t(Cu());try{const{data:r,status:n}=await ku.put("province_kill_request/0/",e);return t(X()),{data:r,status:n}}catch(r){return t(X()),{error:r.response.data.result}}}),O6=({fetchData:e,item:t})=>{const r=iu(),n=tu(C=>C.userSlice.selectedSubUser),[l]=f.useContext(Z),d=wu({initialValues:{chickenPrice:""},validationSchema:gu({chickenPrice:mu().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:C=>{r(gr({province_kill_request_key:t==null?void 0:t.provinceKillReqKey,kill_house_price:C.chickenPrice,role:vu(),role_key:z("slaughter")&&(n==null?void 0:n.key)||""})).then(a=>{a.payload.error?l({vertical:"top",horizontal:"center",msg:a.payload.error,severity:"error"}):(l({vertical:"top",horizontal:"center",msg:"عملیات با موفقیت انجام شد.",severity:"success"}),r(Ru()),e())})}});return u.jsxs("form",{onSubmit:d.handleSubmit,children:[u.jsx(I,{variant:"body1",color:"primary",mb:1,children:"اطلاعات سفارش"}),u.jsx(K6,{style:{width:"100%"}}),u.jsxs(F,{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(F,{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(F,{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(F,{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:d.values.chickenPrice,onChange:d.handleChange,error:d.touched.chickenPrice&&!!d.errors.chickenPrice,helperText:d.touched.chickenPrice&&d.errors.chickenPrice,margin:"normal"}),u.jsx(Q,{color:"primary",variant:"contained",fullWidth:!0,type:"submit",children:"ثبت"})]})};var L0={},vr=V6;Object.defineProperty(L0,"__esModule",{value:!0});var q6=L0.default=void 0,Fr=vr(ae()),jr=u;q6=L0.default=(0,Fr.default)((0,jr.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 br=Lu("SLAUGHTER_DELETE_ALLOCATED_BACK_KILL_REQUEST_SERVICE",async(e,{dispatch:t})=>{t(Cu());try{const{data:r,status:n}=await ku.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}}}),Er=Lu("SLAUGHTER_REMOVE_ALLOCATE_CAR_SERVICE",async(e,{dispatch:t})=>{t(Cu());try{const{data:r,status:n}=await ku.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}}}),kr=Lu("SLAUGHTER_EDIT_ALLOCATED_CAR_SERVICE",async(e,{dispatch:t})=>{var r,n;t(Cu());try{const{data:l,status:d}=await ku.put("kill_house_requests/0/",e);return t(X()),{data:l,status:d}}catch(l){return t(X()),{error:((n=(r=l.response)==null?void 0:r.data)==null?void 0:n.result)||l.message}}}),P6=(e,t,r)=>{const n=iu(),[l,d]=f.useState([]);return f.useEffect(()=>{e?n(Y0({id:e,killHouseKey:t,killRequestKey:r})).then(C=>d(C.payload.data)):n(Y0()).then(C=>d(C.payload.data))},[]),l||[]},Y6=({item:e,updateTable:t,poultryRequestKey:r,killHouseKey:n,killRequestKey:l})=>{const d=iu(),[C]=f.useContext(Z),a=P6(r,n,l),i=wu({initialValues:{car:null,trafficCode:(e==null?void 0:e.trafficCode)||"",amount:(e==null?void 0:e.barAmount)||""},validationSchema:gu({car:gu().nullable(),trafficCode:bu(),amount:mu().positive("قیمت باید عدد مثبت باشد").nullable()})});f.useEffect(()=>{i.validateForm()},[]),f.useEffect(()=>{if(a&&e){const c=a.find(p=>p.key===e.carKey);c&&i.setFieldValue("car",c)}},[a,e]);const x=()=>{var p;if(!i.values.car&&!i.values.trafficCode&&!i.values.amount){C({vertical:"top",horizontal:"center",msg:"لطفا حداقل یکی از فیلدها را پر کنید",severity:"error"});return}const c={key:e==null?void 0:e.killHouseRequestKey};i.values.car||i.values.trafficCode?((p=i.values.car)!=null&&p.key&&i.values.car.key!==(e==null?void 0:e.carKey)&&(c.car_key=i.values.car.key),i.values.trafficCode&&i.values.trafficCode!==(e==null?void 0:e.trafficCode)&&(c.traffic_code=i.values.trafficCode),i.values.amount&&i.values.amount!==(e==null?void 0:e.barAmount)&&(c.amount=i.values.amount)):i.values.amount&&(c.amount=i.values.amount),d(kr(c)).then(o=>{var s;(s=o.payload)!=null&&s.error?C({vertical:"top",horizontal:"center",msg:o.payload.error,severity:"error"}):(C({vertical:"top",horizontal:"center",msg:"ویرایش با موفقیت انجام شد",severity:"success"}),d(Ru()),t&&t())})};return u.jsxs(F,{container:!0,direction:"column",gap:D.SMALL,sx:{width:{xs:"300px",md:"400px"},p:2},children:[u.jsxs(Du,{fullWidth:!0,children:[u.jsx(Yu,{options:a||[],getOptionLabel:c=>{if(c){const p=c.type==="exclusive"?"اختصاصی":"اجاره ای";return`${c.driverName} (${c.driverMobile}) ${c.typeCar} پلاک ${c.pelak} (${p})`}return""},value:i.values.car,onChange:(c,p)=>{i.setFieldValue("car",p),p!=null&&p.healthCode&&i.setFieldValue("trafficCode",p.healthCode)},onBlur:i.handleBlur,renderInput:c=>u.jsx(N,{...c,label:"انتخاب خودرو و راننده (اختیاری)",error:i.touched.car?!!i.errors.car:null})}),u.jsx(Pu,{children:i.touched.car&&i.errors.car?i.errors.car:null})]}),u.jsx(Du,{fullWidth:!0,children:u.jsx(N,{id:"trafficCode",label:"کد حمل و نقل (اختیاری)",value:i.values.trafficCode,error:i.touched.trafficCode?!!i.errors.trafficCode:null,onChange:i.handleChange,onBlur:i.handleBlur,helperText:i.touched.trafficCode&&i.errors.trafficCode?i.errors.trafficCode:null,variant:"outlined"})}),u.jsx(Du,{fullWidth:!0,children:u.jsx(N,{id:"amount",name:"amount",label:"قیمت (اختیاری)",type:"number",value:i.values.amount,error:i.touched.amount?!!i.errors.amount:null,onChange:i.handleChange,onBlur:i.handleBlur,helperText:i.touched.amount&&i.errors.amount?i.errors.amount:null,variant:"outlined"})}),u.jsx(Q,{variant:"contained",color:"primary",onClick:x,disabled:!i.values.car&&!i.values.trafficCode&&!i.values.amount,fullWidth:!0,children:"ثبت تغییرات"})]})};Y6.propTypes={item:Fu.PropTypes.object.isRequired,updateTable:Fu.PropTypes.func,poultryRequestKey:Fu.PropTypes.string,killHouseKey:Fu.PropTypes.string,killRequestKey:Fu.PropTypes.string};const Sr=Lu("POST_SLAUGHTER_CAR_ALLOCATION",async(e,{dispatch:t})=>{try{const{data:r,status:n}=await ku.post("kill_house_request/",e);return t(Cu()),{data:r,status:n}}catch(r){return t(X()),{error:r.response.data.result}}}),W6=({poultryRequestKey:e,provinceAllocationLimit:t,killRequestKey:r,killHouseKey:n,killHouseCheckKey:l,indexWeight:d,item:C})=>{const a={},[i]=f.useContext(Z),x=P6(e,n,r),[,,c,,p]=f.useContext(Z),[o,s]=f.useState(!1),v=()=>{j(Re()).then(E=>{s(E.payload.data)})};f.useEffect(()=>{v()},[]);const{id:T}=v6(),w=vu()==="ProvinceOperator"?"ثبت اطلاعات خودرو بجای کشتارگاه":"ثبت اطلاعات خودرو",S=()=>o!=null&&o.allow?o==null?void 0:o.limitation:3100,j=iu(),g=wu({initialValues:{quantity:"",car:"",realCar:"",shippingCode:""},validationSchema:gu({quantity:mu().typeError("لطفا ظرفیت را به عدد وارد کنید!").required("این فیلد اجباری است!").min(1,"یک مقدار مجاز وارد کنید!").max(S(),`حداکثر میزان تخصیص به ماشین ${S()} قطعه میباشد`),shippingCode:bu().required("این فیلد اجباری است!"),car:gu().required("این فیلد اجباری است!"),realCar:gu()})});f.useEffect(()=>{g.validateForm()},[]),f.useEffect(()=>{a.killHouseWinner&&g.setFieldValue("selectedRequest","not required")},[]),f.useEffect(()=>{a.killHouseWinner&&g.setFieldValue("selectedRequest","not required")},[]);const[H]=f.useState(!1),[q,m]=f.useState(),[h,A]=f.useState();f.useEffect(()=>{C!=null&&C.exclusiveKiller&&j(Me()).then(E=>{m(E.payload.data)})},[]);const y=E=>{A(E==null?void 0:E.target.value)},M=()=>q&&q.length>0?h&&g.isValid:g.isValid;return u.jsx(u.Fragment,{children:u.jsxs(n6,{sx:{alignSelf:"flex-start",width:"100%"},children:[u.jsxs(o6,{children:[u.jsx(a6,{color:"secondary"}),u.jsx(l6,{})]}),u.jsxs(F,{container:!0,direction:"column",flexWrap:"nowrap",flex:"1",children:[u.jsxs(F,{container:!0,children:[u.jsx(F,{children:u.jsx(s6,{variant:"body1",fontWeight:"bold",color:"secondary",children:"انجام عملیات"})}),u.jsx(F,{children:u.jsx(i6,{color:"textSecondary",children:u.jsx(I,{variant:"body2"})})})]}),u.jsx(F,{container:!0,justifyContent:"space-between",children:u.jsxs(F,{container:!0,alignItems:"start",direction:"column",gap:D.SMALL,mt:D.SMALL,children:[u.jsxs(F,{container:!0,gap:D.SMALL,children:[u.jsx(F,{xs:12,children:u.jsx(I,{sx:{fontSize:"12px"},color:"secondary",children:"خودرو دارای کد بهداشتی حمل"})}),u.jsxs(F,{container:!0,direction:"column",alignItems:"start",children:[u.jsxs(Du,{sx:{width:"300px"},children:[u.jsx(Yu,{options:x||[],getOptionLabel:E=>{if(E){const _=E.type==="exclusive"?"اختصاصی":"اجاره ای";return`${E.driverName} (${E.driverMobile}) ${E.typeCar} پلاک ${E.pelak} (${_})`}return""},value:g.values.car,onChange:(E,_)=>{g.setFieldValue("car",_),g.setFieldValue("shippingCode",_?_.healthCode:"")},onBlur:g.handleBlur,renderInput:E=>u.jsx(N,{...E,label:"انتخاب خودرو و راننده",error:g.touched.car?!!g.errors.car:null})}),u.jsx(Pu,{children:g.touched.car&&g.errors.car?g.errors.car:null})]}),H&&u.jsxs(Du,{sx:{width:"300px"},children:[u.jsx(Yu,{options:x||[],getOptionLabel:E=>{if(E){const _=E.type==="exclusive"?"اختصاصی":"اجاره ای";return`${E.driverName} (${E.driverMobile}) ${E.typeCar} پلاک ${E.pelak} ظرفیت ${E.capocity} قطعه (${_})`}return""},value:g.values.realCar,onChange:(E,_)=>{g.setFieldValue("realCar",_)},onBlur:g.handleBlur,renderInput:E=>u.jsx(N,{...E,label:"انتخاب خودرو و راننده",error:g.touched.car?!!g.errors.realCar:null})}),u.jsx(Pu,{children:g.touched.realCar&&g.errors.realCar?g.errors.realCar:null})]}),(q==null?void 0:q.length)>0&&u.jsxs(u.Fragment,{children:[u.jsx(F,{xs:12,children:u.jsx(I,{sx:{fontSize:"12px"},color:"red",mb:1,mt:1,children:"انتخاب کشتارکن جهت تخصیص"})}),u.jsxs(Du,{children:[u.jsx(Hu,{id:"demo-simple-select-label",children:"انتخاب کشتارکن (اجباری)"}),u.jsx(Ou,{label:"کشتارکن",value:h,onChange:y,children:q==null?void 0:q.map((E,_)=>u.jsx(qu,{value:E==null?void 0:E.key,children:E==null?void 0:E.name},_))})]})]}),u.jsx(F,{container:!0,textAlign:"start",direction:"column",mt:D.TINY,children:x.filter(E=>E.busy).map((E,_)=>{const $=`راننده ${E.driverName} ${E.typeCar} با پلاک ${E.pelak} جهت حمل بار کشتارگاه دیگری رزرو شده است.`;return u.jsx(F,{children:u.jsx(I,{variant:"caption",children:$})},"car"+_)})})]}),u.jsx(F,{children:u.jsx(N,{allowLeadingZeros:!0,thousandSeparator:",",id:"shippingCode",label:"کد بهداشتی حمل و نقل",value:g.values.shippingCode,error:g.touched.shippingCode?!!g.errors.shippingCode:null,onChange:g.handleChange,onBlur:g.handleBlur,helperText:g.touched.shippingCode&&g.errors.shippingCode?g.errors.shippingCode:null,variant:"outlined"})}),u.jsxs(F,{children:[u.jsx(N,{allowLeadingZeros:!0,thousandSeparator:",",id:"quantity",label:"ظرفیت (قطعه)",value:g.values.quantity,error:g.touched.quantity?!!g.errors.quantity:null,onChange:g.handleChange,onBlur:g.handleBlur,helperText:g.touched.quantity&&g.errors.quantity?g.errors.quantity:null,autoComplete:"current-password",variant:"outlined"}),u.jsxs(F,{container:!0,mt:D.TINY,gap:D.TINY,alignItems:"center",children:[u.jsx(I,{color:E=>E.palette.grey.A700,variant:"caption",children:"ظرفیت مجاز ماشین:"}),u.jsxs(I,{variant:"button",children:[S()," قطعه"]})]}),u.jsxs(F,{container:!0,mt:D.TINY,gap:D.TINY,alignItems:"center",children:[u.jsx(I,{color:E=>E.palette.grey.A700,variant:"caption",children:"باقی مانده:"}),u.jsxs(I,{variant:"button",children:[t-Number(g.values.quantity)>=0?t-Number(g.values.quantity):0," ","قطعه"]})]}),u.jsxs(F,{container:!0,mt:D.TINY,gap:D.TINY,alignItems:"center",children:[u.jsx(I,{color:E=>E.palette.grey.A700,variant:"caption",children:"مازاد:"}),u.jsxs(I,{variant:"button",children:[Number(g.values.quantity)>t?Math.abs(Number(g.values.quantity)-t):0," ","قطعه"]})]}),u.jsxs(F,{container:!0,mt:D.TINY,gap:D.TINY,alignItems:"center",children:[u.jsx(I,{color:E=>E.palette.grey.A700,variant:"caption",children:"وزن تقریبی هرقطعه مرغ:"}),u.jsxs(I,{variant:"button",children:[d.toLocaleString()," کیلوگرم"]})]})]}),u.jsx(F,{container:!0,alignItems:"start",gap:D.SMALL,children:u.jsxs(F,{container:!0,mt:D.TINY,gap:D.TINY,alignItems:"center",children:[u.jsx(I,{color:E=>E.palette.grey.A700,children:"="}),u.jsx(I,{color:E=>E.palette.grey.A700,variant:"caption",children:"وزن تقریبی بار:"}),u.jsxs(I,{variant:"button",children:[(Number(g.values.quantity)*d).toLocaleString()," ","کیلوگرم"]})]})})]}),u.jsx(F,{container:!0,children:u.jsx(Q,{size:"large",variant:"contained",disabled:!M(),onClick:()=>{j(Cu());let E={};a.killHouseWinner?E={winner_key:a.killHouseWinner.killHouseWinnerKey,quantity:Number(g.values.quantity),killer_key:h||null,car:{id:g.values.car.id,key:g.values.car.key,driver_name:g.values.car.driverName,driver_mobile:g.values.car.driverMobile,name:g.values.car.name,type_car:g.values.car.typeCar,type_weight:g.values.car.typeWeight,pelak:g.values.car.pelak,capocity:g.values.car.capocity,weight_without_load:g.values.car.weightWithoutLoad,health_code:g.values.car.helathCode}}:E={killer_key:h||null,kill_house_check_key:l,quantity:Number(g.values.quantity),traffic_code:g.values.shippingCode,real_car_key:g.values.realCar.key,role:vu(),car:{id:g.values.car.id,key:g.values.car.key,driver_name:g.values.car.driverName,driver_mobile:g.values.car.driverMobile,name:g.values.car.name,type_car:g.values.car.typeCar,type_weight:g.values.car.typeWeight,pelak:g.values.car.pelak,capocity:g.values.car.capocity,weight_without_load:g.values.car.weightWithoutLoad,health_code:g.values.car.helathCode}},j(Sr(E)).then(_=>{j(X()),_.payload.error?i({vertical:"top",horizontal:"center",msg:_.payload.error,severity:"error"}):(j(X()),j(Mu({isCar:!0,selectedDate1:c,selectedDate2:p})),j(t0({selectedDate1:c,selectedDate2:p})),j(e0({id:T})),j(k0({key:e})),j(e0()),j(fu({right:!1,bottom:!1,top:!1,content:null})),i({vertical:"top",horizontal:"center",msg:"عملیات با موفقیت انجام شد.",severity:"success"}))})},children:w})})]})})]})]})})};W6.propTypes={file:Fu.PropTypes.object,provinceAllocationLimit:Fu.PropTypes.any};const e6=({item:e,updateTable:t,isAllocatedCar:r=!1,selectedDate1:n,selectedDate2:l,submitStatus:d})=>{const[C,a]=f.useState(null),[i,,x,,c]=f.useContext(Z),p=iu(),o=tu(_=>_.userSlice.selectedSubUser),s=n||x,v=l||c,T=_=>{a(_.currentTarget)},w=()=>{a(null)},S=Xu(),j=!!C,g=j?"popover":void 0,H=()=>{p(Er(e.killHouseRequestKey)).then(_=>{var $;($=_.payload)!=null&&$.error?i({vertical:"top",horizontal:"center",msg:_.payload.error,severity:"error"}):(i({vertical:"top",horizontal:"center",msg:"عملیات با موفقیت انجام شد.",severity:"success"}),p(Ru()),p(Mu({isCar:!0,selectedDate1:s,selectedDate2:v,role_key:z("slaughter")&&(o==null?void 0:o.key)||""})),p(t0({selectedDate1:s,selectedDate2:v,role_key:z("slaughter")&&(o==null?void 0:o.key)||""})),t&&t())})},q=()=>{w(),p(Iu({title:"تایید حذف",content:u.jsxs(F,{container:!0,direction:"column",gap:D.SMALL,sx:{p:2,minWidth:"300px"},children:[u.jsx(I,{variant:"body1",children:"آیا از حذف تخصیص این خودرو اطمینان دارید؟"}),u.jsxs(F,{container:!0,gap:D.SMALL,justifyContent:"space-between",xs:12,children:[u.jsx(Q,{variant:"outlined",color:"secondary",onClick:()=>p(Ru()),children:"انصراف"}),u.jsx(Q,{variant:"contained",color:"error",onClick:H,children:"حذف"})]})]})}))},m=()=>{p(Iu({title:"ویرایش خودرو و کد حمل",content:u.jsx(Y6,{item:e,updateTable:()=>{p(Mu({isCar:!0,selectedDate1:s,selectedDate2:v,role_key:z("slaughter")&&(o==null?void 0:o.key)||""})),p(t0({selectedDate1:s,selectedDate2:v,role_key:z("slaughter")&&(o==null?void 0:o.key)||""})),t&&t()},poultryRequestKey:e==null?void 0:e.poultryReqKey,killHouseKey:e==null?void 0:e.killHouseKey,killRequestKey:e==null?void 0:e.killRequestKey})})),w()},h=()=>{S(Uu+e.poultryReqId)},A=()=>{p(br({provinceKillRequestKey:e==null?void 0:e.provinceKillRequestKey,returnAllocationQuantity:!0})).then(_=>{_.error?i({vertical:"top",horizontal:"center",msg:_.error,severity:"error"}):(t&&t(),i({vertical:"top",horizontal:"center",msg:"عملیات برگشت تخصیص با موفقیت انجام شد.",severity:"success"}))})},y=()=>{d===!0&&(e==null?void 0:e.killHousePrice)===0?p(Iu({title:"ثبت قیمت مرغ زنده",content:u.jsx(O6,{item:e,fetchData:t})})):p(fu({title:"انجام عملیات تخصیص",top:!(window.innerWidth<=600),bottom:window.innerWidth<=600,content:u.jsx(W6,{indexWeight:e.indexWeight,killHouseName:e.killHouseName,killHouseCheckKey:e.killHouseCheckKey,killHouseKey:e.killHouseKey,killRequestKey:e.killRequestKey,poultryRequestKey:e.poultryReqKey,provinceAllocationLimit:e.remainQuantity||0,item:e})}))},M=[];if(!r){const _=d===!0&&((e==null?void 0:e.killHousePrice)||0)===0;M.push({key:"register",label:"ثبت خودرو",color:_?"error.main":"primary.main",icon:Ie,action:y}),M.push({key:"viewFile",label:"مشاهده پرونده",color:"primary.main",icon:Ku,action:h});const $=(e==null?void 0:e.allocatedQuantity)>0;M.push({key:"return",label:"برگشت تخصیص",color:$?"text.disabled":"warning.main",icon:q6,action:A,disabled:$})}r&&(M.push({key:"editAllocated",label:"ویرایش خودرو و کد حمل",color:"info.main",icon:$u,action:m}),M.push({key:"deleteAllocated",label:"حذف تخصیص خودرو",color:"error.main",icon:s0,action:q}));const E=_=>{_.disabled||(w(),_.action())};return u.jsxs(F,{container:!0,children:[u.jsx(su,{size:"small","aria-describedby":g,variant:"contained",color:"primary",onClick:T,children:u.jsx(j6,{})}),u.jsx(c6,{anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"left"},id:g,open:j,anchorEl:C,onClose:w,children:u.jsx(G6,{sx:{minWidth:150,p:.5},children:M.map(_=>{const $=_.icon,G=_.disabled?"text.disabled":_.color;return u.jsxs(Q6,{disabled:_.disabled,onClick:()=>E(_),sx:{borderRadius:1,mb:.25,py:.5,"&:last-of-type":{mb:0}},children:[u.jsx(t6,{sx:{color:G,minWidth:32},children:u.jsx($,{fontSize:"small"})}),u.jsx(r6,{primary:_.label,primaryTypographyProps:{sx:{color:G,fontSize:"0.82rem",fontWeight:600}}})]},_.key)})})})]})},_r=()=>{const e=f.useRef(),t=tu(A=>A.userSlice.selectedSubUser),[r,n]=f.useState(),[l,d]=f.useState([]),[C,a]=f.useState([]),{slaughterActiveRequests:i,slaughterGetAllocatedCars:x}=tu(A=>A.slaughterSlice),c=T0(),p=iu(),[,,o,s,v,T]=f.useContext(Z),[w,S]=f.useState(),j=()=>{p(Mu({isCar:!0,selectedDate1:o,selectedDate2:v,role_key:z("slaughter")&&(t==null?void 0:t.key)||""})),p(t0({selectedDate1:o,selectedDate2:v,role_key:z("slaughter")&&(t==null?void 0:t.key)||""})),p(Le({role_key:z("slaughter")&&(t==null?void 0:t.key)||""})).then(A=>{S(A.payload.data.allow)})};f.useEffect(()=>{j()},[o,v,t==null?void 0:t.key]);const g=A6.useReactToPrint({content:()=>e.current,documentTitle:"حواله خرید"}),H=()=>{j()},q=A=>{n(A)};f.useEffect(()=>{const A=i==null?void 0:i.map((y,M)=>{var E;return[M+1,y.orderCode,y!=null&&y.freezing?"انجماد":y!=null&&y.export?"صادرات":"عادی",y!=null&&y.freeSaleInProvince?"آزاد":"دولتی",y!=null&&y.directBuying?"خرید مستقیم":"اتحادیه",Wu(new Date(y==null?void 0:y.sendDate),"yyyy/MM/dd"),`${y.poultryName} (${y.poultryMobile})`,`${y.killHouseName} (${y.killHouseMobile})`,`${y.province}/${y.city}`,y.age,y.indexWeight,y==null?void 0:y.totalWeight.toLocaleString(),y.mainQuantity.toLocaleString()+" قطعه",y.amount.toLocaleString()+" ﷼",y.allocatedQuantity.toLocaleString()+" قطعه",y.remainQuantity.toLocaleString()+" قطعه",(y==null?void 0:y.killHousePrice)>0?u.jsxs(W,{container:!0,alignItems:"center",gap:1,children:[((E=y==null?void 0:y.killHousePrice)==null?void 0:E.toLocaleString())+" ریال",du(y==null?void 0:y.sendDate)===du(new Date)?u.jsx(su,{size:"small",color:"primary",onClick:()=>{p(Iu({title:"ویرایش قیمت مرغ زنده",content:u.jsx(O6,{item:y,fetchData:j})}))},children:u.jsx($u,{fontSize:"small"})}):null]},M):u.jsx("span",{children:"0"},M),u.jsx(e6,{updateTable:H,item:y,submitStatus:w},M)]});d(A)},[i,w]),f.useEffect(()=>{const A=x==null?void 0:x.filter(y=>y.vetState==="pending").map((y,M)=>{var E,_,$,G;return[M+1,y==null?void 0:y.orderCode,y==null?void 0:y.barcod,y!=null&&y.freezing?"انجماد":y!=null&&y.export?"صادرات":"عادی",y!=null&&y.freeSaleInProvince?"آزاد":"دولتی",du(y==null?void 0:y.sendDate),f6(y==null?void 0:y.killHouseCreateDate),`${y==null?void 0:y.poultryName} (${y.poultryMobile})`,`${y==null?void 0:y.killHouseName} (${y.killHouseMobile})`,y!=null&&y.killer?`${(E=y==null?void 0:y.killer)==null?void 0:E.killerName} (${(_=y==null?void 0:y.killer)==null?void 0:_.killerMobile})`:"-",y==null?void 0:y.driverName,y==null?void 0:y.typeCar,y==null?void 0:y.pelak,(y==null?void 0:y.acceptedRealQuantity.toLocaleString())+" قطعه",y==null?void 0:y.acceptedRealWeight.toLocaleString(),(($=y==null?void 0:y.amount)==null?void 0:$.toLocaleString())+" ﷼",y==null?void 0:y.trafficCode,((G=y==null?void 0:y.barAmount)==null?void 0:G.toLocaleString())+" ﷼",u.jsxs(W,{container:!0,gap:1,children:[u.jsx(e6,{item:y,updateTable:H,isAllocatedCar:!0,selectedDate1:o,selectedDate2:v},M),c==="استان اردبیل"?u.jsx(Nu,{title:"خروجی PDF",children:u.jsx(su,{onClick:()=>{g(),q(y)},size:"large","aria-label":"pdf",color:"success",children:u.jsx(F6,{})})}):null]},M)]});a(A)},[x]);const[m]=f.useState(["ردیف","کد سفارش","کشتار","فروش","درخواست","تاریخ کشتار","مرغدار","خریدار","استان/شهر","سن","میانگین وزن","وزن کل (کیلوگرم)","تعداد","قیمت مرغدار","تخصیص به خودرو","مانده قابل تخصیص","قیمت کشتارگاه","عملیات"]),h=wu({initialValues:{capacity:"",recieveTime:"",recieveDate:uu(Date()).format("YYYY-MM-DD hh:mm:ss")},validationSchema:gu({capacity:mu().required("این فیلد اجباری است!").typeError("لطفا عدد وارد کنید!"),recieveTime:bu().required("این فیلد اجباری است!").typeError("لطفا وزن را وارد کنید!")})});return f.useEffect(()=>{h.validateForm()},[]),u.jsxs(W,{container:!0,alignItems:"center",justifyContent:"space-between",gap:D.SMALL,mt:D.MEDIUM,children:[r&&u.jsx("div",{style:{visibility:"hidden",position:"absolute"},children:u.jsx(R0,{ref:e,date:o,amount:r==null?void 0:r.quantity,breeder:r==null?void 0:r.poultryName,buyer:r==null?void 0:r.killHouseName})}),u.jsxs(W,{container:!0,alignItems:"center",gap:D.SMALL,children:[u.jsx(W,{children:u.jsx(eu,{label:"از تاریخ",id:"date",renderInput:A=>u.jsx(N,{style:{width:"160px"},...A}),value:o,onChange:A=>{s(uu(A).format("YYYY-MM-DD"))}})}),u.jsx(W,{children:u.jsx(eu,{label:"تا تاریخ",id:"date",renderInput:A=>u.jsx(N,{style:{width:"160px"},...A}),value:v,onChange:A=>{T(uu(A).format("YYYY-MM-DD"))}})})]}),u.jsx(zu,{paginated:!0,title:"در انتظار تخصیص خودرو",columns:m,data:l}),u.jsx(zu,{title:"خودروهای تخصیص داده شده",paginated:!0,columns:["ردیف","کد سفارش","کد بار","کشتار","فروش","تاریخ کشتار","تاریخ ثبت خودرو","مرغدار","خریدار","کشتارکن اختصاصی","راننده","ماشین","پلاک","تعداد","وزن (کیلوگرم)","قیمت مرغ زنده","کد حمل و نقل","قیمت مرغ زنده‌ی بار","عملیات"],data:C})]})},B={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"}},I0=f.forwardRef((e,t)=>{var d,C,a,i,x,c,p,o,s,v,T,w,S,j,g,H,q,m,h;const{item:r}=e,n=T0(),l=le();return u.jsxs("div",{style:B.page,ref:t,children:[u.jsxs("div",{style:B.contentContainer,children:[u.jsxs("div",{style:B.contentInLine,children:[u.jsx("img",{alt:"logo",src:se,style:B.logo}),u.jsx("span",{style:B.mainTitle,children:"اتحادیه سراسری تعاونی‌های کشاورزی پرورش دهندگان مرغ گوشتی ایران"}),u.jsxs("span",{style:B.title,children:["اتحادیه شرکت های تعاونی کشاورزی مرغداران "," ‌"," ",n]})]}),u.jsx("div",{children:u.jsx("span",{style:B.firsttitle,children:"بسمه تعالی"})}),u.jsxs("div",{style:B.options,children:[u.jsx("span",{style:B.title,children:"شماره:"}),u.jsx("span",{style:B.titleTopic,children:"تاریخ:"})]})]}),u.jsx("hr",{style:B.divider}),u.jsx("strong",{style:{fontSize:"20px",textAlign:"center"},children:"فاکتور فروش"}),u.jsx("br",{}),u.jsxs("div",{style:B.container,children:[u.jsx("table",{style:{...B.invoiceTable,marginBottom:"5px"},children:u.jsx("tbody",{children:u.jsxs("tr",{children:[u.jsx("td",{style:{...B.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:{...B.tableCell,width:"90%",textAlign:"right"},children:[" ‌"," ‌",(c=(x=(i=(a=(C=(d=r==null?void 0:r.provinceCheckInfo)==null?void 0:d.killHouseAssignment)==null?void 0:C.killHouseRequest)==null?void 0:a.killhouseUser)==null?void 0:i.killHouseOperator)==null?void 0:x.user)==null?void 0:c.fullname]})]})})}),u.jsx("table",{style:{...B.invoiceTable,marginBottom:"5px"},children:u.jsx("tbody",{children:u.jsxs("tr",{children:[u.jsx("td",{style:{...B.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:{...B.tableCell,width:"90%",textAlign:"right"},children:[" ‌"," ‌","اتحادیه شرکت های تعاونی کشاورزی مرغداران "," ‌"," ",n]})]})})}),u.jsxs("table",{style:B.invoiceTable,children:[u.jsx("tr",{children:u.jsxs("table",{style:B.invoiceTable,children:[u.jsx("thead",{style:B.tableHeader,children:u.jsxs("tr",{style:B.headerRow,children:[u.jsx("th",{style:B.tableHeaderCell,children:"ردیف"}),u.jsx("th",{style:B.tableHeaderCell,children:"شرح"}),u.jsx("th",{style:B.tableHeaderCell,children:"وزن (کیلوگرم)"}),u.jsx("th",{style:B.tableHeaderCell,children:"قیمت مرغ زنده (کیلوگرم)"}),u.jsx("th",{style:B.tableHeaderCell,children:"قیمت کل (ریال)"})]})}),u.jsx("tbody",{children:u.jsxs("tr",{children:[u.jsx("td",{style:B.tableCell,children:"1"}),u.jsxs("td",{style:B.tableCell,children:["بار شماره",(s=(o=(p=r==null?void 0:r.provinceCheckInfo)==null?void 0:p.killHouseAssignment)==null?void 0:o.killHouseRequest)==null?void 0:s.barCode,"مرغداری :"," ",`${(v=r==null?void 0:r.poultryRequest)==null?void 0:v.poultryName} (${(T=r==null?void 0:r.poultryRequest)==null?void 0:T.poultryUserMobile})`]}),u.jsx("td",{style:B.tableCell,children:(w=r==null?void 0:r.provinceFactorToKillHouse.netWeight)==null?void 0:w.toLocaleString()}),u.jsx("td",{style:B.tableCell,children:((S=r==null?void 0:r.factorFee)==null?void 0:S.toLocaleString())+" ﷼"}),u.jsx("td",{style:B.tableCell,children:((g=(j=r==null?void 0:r.provinceFactorToKillHouse)==null?void 0:j.totalFactorAmount)==null?void 0:g.toLocaleString())+" ﷼"})]})})]})}),u.jsx("tr",{children:u.jsxs("table",{style:B.invoiceTable,children:[u.jsx("thead",{style:B.tableHeader,children:u.jsxs("tr",{style:B.headerRow,children:[u.jsx("th",{colSpan:4,style:B.tableHeaderCell,children:"جمع فاکتور"}),u.jsx("th",{style:B.tableHeaderCell,children:((q=(H=r==null?void 0:r.provinceFactorToKillHouse)==null?void 0:H.totalFactorAmount)==null?void 0:q.toLocaleString())+" ﷼"})]})}),u.jsxs("tbody",{style:B.tableCell,children:[u.jsxs("tr",{children:[u.jsx("td",{colSpan:3}),u.jsx("td",{style:B.tableCell,children:"تخفیف"}),u.jsx("td",{style:B.tableCell,children:"0"})]}),u.jsxs("tr",{children:[u.jsx("td",{colSpan:3}),u.jsx("td",{style:B.tableCell,children:"مالیات"}),u.jsx("td",{style:B.tableCell,children:"0"})]}),u.jsxs("tr",{children:[u.jsx("td",{colSpan:3}),u.jsx("td",{style:B.tableCell,children:"عوارض"}),u.jsx("td",{style:B.tableCell,children:"0"})]}),u.jsxs("tr",{children:[u.jsx("td",{style:B.tableCell,colSpan:3,children:"مبلغ قابل پرداخت (ریال)"}),u.jsx("td",{colSpan:2,style:B.tableCell,children:((h=(m=r==null?void 0:r.provinceFactorToKillHouse)==null?void 0:m.totalFactorAmount)==null?void 0:h.toLocaleString())+" ﷼"})]})]})]})})]}),u.jsx("div",{style:{flexDirection:"row",marginTop:"20px"},children:u.jsx("div",{style:B.signature,children:u.jsxs("div",{style:B.contentInLine,children:[u.jsx("span",{style:B.title,children:l}),u.jsxs("span",{style:B.title,children:["مدیرعامل اتحادیه مرغداران"," ‌",n]})]})})}),u.jsx("div",{style:B.watermarkContainer,children:u.jsx("p",{style:B.watermarkp,children:"سامانه رصدیار "})})]})]})});I0.displayName="SlaughterNewFactorFile";I0.propTypes={item:Fu.PropTypes.any};const Dr=()=>{const e=Xu(),[t,r]=f.useState([]),[n,l]=f.useState([]),{slaughterGetPayFactorRequests:d,slaughterGetPaiedFactors:C}=tu(m=>m.slaughterSlice),a=iu(),[,,i,x,c,p]=f.useContext(Z);f.useEffect(()=>{const m=uu(new Date).format("YYYY-MM-DD");x(m),p(m)},[]),f.useEffect(()=>{a(ie({selectedDate1:i,selectedDate2:c})),a(ce({selectedDate1:i,selectedDate2:c}))},[i,c]),f.useEffect(()=>{const m=C==null?void 0:C.map((h,A)=>{var M,E,_,$,G,hu,yu,R,Y,b,L,V,nu,J,cu,pu,ru,Tu;let y="";return h.state==="accepted"?y="تایید شده":h.state==="rejected"?y="رد شده":h.state==="pending"&&(y="در انتظار تایید"),[A+1,(M=h==null?void 0:h.provinceFactor)==null?void 0:M.factorBarCode,(yu=(hu=(G=($=(_=(E=h==null?void 0:h.provinceFactor)==null?void 0:E.provinceCheckInfo)==null?void 0:_.killHouseAssignment)==null?void 0:$.killHouseRequest)==null?void 0:G.killRequest)==null?void 0:hu.killHouse)==null?void 0:yu.name,(cu=(J=(nu=(V=(L=(b=(Y=(R=h==null?void 0:h.provinceFactor)==null?void 0:R.provinceCheckInfo)==null?void 0:Y.killHouseAssignment)==null?void 0:b.killHouseRequest)==null?void 0:L.killRequest)==null?void 0:V.killHouse)==null?void 0:nu.killHouseOperator)==null?void 0:J.user)==null?void 0:cu.mobile,du((pu=h==null?void 0:h.provinceFactor)==null?void 0:pu.createDate),du(h==null?void 0:h.createDate),((Tu=(ru=h==null?void 0:h.provinceFactor)==null?void 0:ru.totalPrice)==null?void 0:Tu.toLocaleString())+" ﷼",Number(h==null?void 0:h.paymentCode),y,u.jsx("a",{href:h.factorImage,children:u.jsx("img",{src:h.factorImage,width:"50",height:"50",alt:"بدون بار",className:"images-file"})},"provinceKillRequests"),u.jsx(su,{disabled:h.state==="accepted",color:"primary",onClick:()=>{var ju,k,O,U,ou,au,lu,Au,Gu;a(fu({title:"انجام عملیات تایید / رد درخواست",top:!(window.innerWidth<=600),bottom:window.innerWidth<=600,content:u.jsx($0,{factorKey:h.key,price:(ju=h==null?void 0:h.provinceFactor)==null?void 0:ju.totalPrice,provinceFactorToKillHouse:(k=h==null?void 0:h.provinceFactor)==null?void 0:k.provinceFactorToKillHouse,isRejected:((U=(O=h==null?void 0:h.provinceFactor)==null?void 0:O.killHouseFactorToProvince)==null?void 0:U.factorState)==="rejected",killHouseFactorToProvince:(ou=h==null?void 0:h.provinceFactor)==null?void 0:ou.killHouseFactorToProvince,barCode:(Gu=(Au=(lu=(au=h==null?void 0:h.provinceFactor)==null?void 0:au.provinceCheckInfo)==null?void 0:lu.killHouseAssignment)==null?void 0:Au.killHouseRequest)==null?void 0:Gu.barCode},`SlaughterPayProvinceFactorForm${A}`)}))},children:u.jsx($u,{})},A),u.jsx(su,{"aria-label":"delete",color:"primary",onClick:()=>{var ju,k;e(de+((k=(ju=h==null?void 0:h.provinceFactor)==null?void 0:ju.poultryRequest)==null?void 0:k.poultryRequestId))},children:u.jsx(Ku,{})},A)]});l(m)},[C]),f.useEffect(()=>{const m=d==null?void 0:d.filter(h=>h.paidState!=="paid").map((h,A)=>{var _,$,G,hu,yu,R,Y,b,L;const y=`${h.provinceInputAmount?(_=h.provinceInputAmount)==null?void 0:_.toLocaleString():"نامشخص"} ﷼ (شرح: ${h!=null&&h.reason?h==null?void 0:h.reason:"نامشخص"})`;let M=h.provinceInputAmountType;M==="plus"?M=u.jsxs(I,{variant:"caption",children:["اضافه شد: ",y]}):M=u.jsxs(I,{variant:"caption",children:["کسر شد: ",y]});const E=u.jsxs(I,{variant:"caption",children:["کسر شد: ",(($=h.killHouseFactorPaymentRemain)==null?void 0:$.toLocaleString())+" ﷼"]});return[A+1,(yu=(hu=(G=h.provinceCheckInfo)==null?void 0:G.killHouseAssignment)==null?void 0:hu.killHouseRequest)==null?void 0:yu.barCode,Wu(new Date((R=h==null?void 0:h.poultryRequest)==null?void 0:R.sendDate),"yyyy/MM/dd"),`${h.poultryRequest.poultryName} (${h.poultryRequest.poultryUserMobile})`,h.provinceFactorToKillHouse.killPlace,(Y=h.provinceFactorToKillHouse.realQuantity)==null?void 0:Y.toLocaleString(),(b=h.provinceFactorToKillHouse.netWeight)==null?void 0:b.toLocaleString(),Wu(new Date(h==null?void 0:h.factorDate),"yyyy/MM/dd"),((L=h.provinceFactorToKillHouse.totalFactorAmount)==null?void 0:L.toLocaleString())+" ﷼",u.jsx(Nu,{title:"خروجی PDF",children:u.jsx(su,{onClick:()=>{q(h)},size:"large","aria-label":"delete",color:"success",children:u.jsx(F6,{})})},A),u.jsx(su,{color:"primary",onClick:()=>{var V,nu,J,cu,pu,ru,Tu,ju,k,O,U,ou,au,lu,Au;a(fu({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(z0,{name:"اطلاعات فاکتور",columns:["کد بار","تاریخ کشتار","مرغدار","محل کشتار","تعداد واقعی","وزن خالص بار (کیلوگرم)","سند بدون بار","سند با بار"],data:[[h.provinceCheckInfo.killHouseAssignment.killHouseRequest.barCode,(V=h==null?void 0:h.poultryRequest)!=null&&V.sendDate?Wu(new Date((nu=h==null?void 0:h.poultryRequest)==null?void 0:nu.sendDate),"yyyy/MM/dd"):"",`${h.poultryRequest.poultryUserName} (${h.poultryRequest.poultryUserMobile})`,h.provinceFactorToKillHouse.killPlace,(J=h.provinceFactorToKillHouse.realQuantity)==null?void 0:J.toLocaleString(),((cu=h.provinceFactorToKillHouse.netWeight)==null?void 0:cu.toLocaleString())+" کیلوگرم",u.jsx("a",{href:h.provinceCheckInfo.killHouseAssignment.carWeightWithoutLoadImage,children:u.jsx("img",{alt:"vvv",width:"50",src:h.provinceCheckInfo.killHouseAssignment.carWeightWithoutLoadImage})},"ddd"),u.jsx("a",{href:h.provinceCheckInfo.killHouseAssignment.carWeightWithLoadImage,children:u.jsx("img",{alt:"vvv",width:"50",src:h.provinceCheckInfo.killHouseAssignment.carWeightWithLoadImage})},"ddd")]]}),u.jsx(z0,{name:"اطلاعات فاکتور",columns:["قیمت مرغ زنده (کیلوگرم)","مبلغ خالص بار","سهم مرغدار","سهم استان","هزینه پیامک اطلاع رسانی","مبلغ کسر/اضافه","واریزی فاکتور اولیه","مبلغ فاکتور نهایی"],data:[[((pu=h.factorFee)==null?void 0:pu.toLocaleString())+" ﷼",((ru=h.provinceFactorToKillHouse.realAmountFactor)==null?void 0:ru.toLocaleString())+" ﷼",((Tu=h.provinceFactorToKillHouse.poultryShare)==null?void 0:Tu.toLocaleString())+" ﷼",((ju=h.provinceFactorToKillHouse.provinceShare)==null?void 0:ju.toLocaleString())+" ﷼",(au=(ou=(U=(O=(k=h.provinceFactorToKillHouse.item)==null?void 0:k.provinceCheckInfo)==null?void 0:O.killHouseAssignment)==null?void 0:U.killHouseRequest)==null?void 0:ou.killRequest)!=null&&au.smsPayment?"دارد - 50000 ﷼":"ندارد",M,E,((lu=h==null?void 0:h.totalPrice)==null?void 0:lu.toLocaleString())+" ﷼"]]})]}),u.jsx($0,{factorKey:h.key,price:h.totalPrice,item:h,provinceFactorToKillHouse:h.provinceFactorToKillHouse,isRejected:((Au=h==null?void 0:h.killHouseFactorToProvince)==null?void 0:Au.factorState)==="rejected",killHouseFactorToProvince:h.killHouseFactorToProvince,barCode:h.provinceCheckInfo.killHouseAssignment.killHouseRequest.barCode},`SlaughterPayProvinceFactorForm${A}`)]})}))},children:u.jsx($u,{})},A),u.jsx(su,{"aria-label":"delete",color:"primary",onClick:()=>e(Uu+h.poultryReqId),children:u.jsx(Ku,{})},A)]});r(m)},[d]);const[o]=f.useState(["ردیف","کد بار","تاریخ کشتار","مرغدار","محل کشتار","تعداد واقعی","وزن خالص (کیلوگرم)","تاریخ صدور فاکتور","مبلغ نهایی فاکتور","دانلود فاکتور","عملیات","مشاهده"]),s=wu({initialValues:{capacity:"",recieveTime:"",recieveDate:uu(Date()).format("YYYY-MM-DD hh:mm:ss")},validationSchema:gu({capacity:mu().required("این فیلد اجباری است!").typeError("لطفا عدد وارد کنید!"),recieveTime:bu().required("این فیلد اجباری است!").typeError("لطفا وزن را وارد کنید!")})});f.useEffect(()=>{s.validateForm()},[]);const[v,T]=f.useState(0),w=(m,h)=>{T(h)},[S,j]=f.useState(),g=f.useRef(),H=A6.useReactToPrint({content:()=>g.current,documentTitle:"فاکتور پرداخت",onAfterPrint:()=>{j(null)}}),q=m=>{j(m)};return f.useEffect(()=>{S&&H()},[S,H]),u.jsxs(W,{container:!0,alignItems:"center",justifyContent:"center",gap:D.SMALL,mt:D.MEDIUM,children:[u.jsx("div",{style:{visibility:"hidden",position:"absolute"},children:u.jsx(I0,{ref:g,item:S})}),u.jsx(W,{children:u.jsx(d6,{sx:{borderBottom:1,borderColor:"divider"},children:u.jsxs(C6,{value:v,onChange:w,"aria-label":"basic tabs example",children:[u.jsx(u0,{label:"فاکتور های جدید"}),u.jsx(u0,{label:"فاکتورهای پرداخت شده"})]})})}),u.jsxs(w0,{sx:{width:"100%"},children:[v===0&&u.jsx(Bu,{name:u.jsxs(W,{container:!0,alignItems:"center",gap:D.SMALL,children:[u.jsx(W,{xs:12,sm:12,md:12,lg:2,children:u.jsx(I,{children:"فاکتورهای در انتظار پرداخت"})}),u.jsx(W,{children:u.jsx(eu,{label:"از تاریخ",id:"date",renderInput:m=>u.jsx(N,{style:{width:"160px"},...m}),value:i,onChange:m=>{x(uu(m).format("YYYY-MM-DD"))}})}),u.jsx(W,{children:u.jsx(eu,{label:"تا تاریخ",id:"date",renderInput:m=>u.jsx(N,{style:{width:"160px"},...m}),value:c,onChange:m=>{p(uu(m).format("YYYY-MM-DD"))}})})]}),columns:o,data:t}),v===1&&u.jsx(Bu,{name:u.jsxs(W,{container:!0,alignItems:"center",gap:D.SMALL,children:[u.jsx(W,{xs:12,sm:12,md:12,lg:2,children:u.jsx(I,{children:"فاکتورهای پرداخت شده"})}),u.jsx(W,{children:u.jsx(eu,{label:"از تاریخ",id:"date",renderInput:m=>u.jsx(N,{style:{width:"160px"},...m}),value:i,onChange:m=>{x(uu(m).format("YYYY-MM-DD"))}})}),u.jsx(W,{children:u.jsx(eu,{label:"تا تاریخ",id:"date",renderInput:m=>u.jsx(N,{style:{width:"160px"},...m}),value:c,onChange:m=>{p(uu(m).format("YYYY-MM-DD"))}})})]}),columns:["ردیف","شناسه فاکتور","کشتارگاه","تلفن کشتارگاه","تاریخ صدور فاکتور","تاریخ پرداخت فاکتور","مبلغ فاکتور نهایی","شناسه پرداخت","وضعیت","سند پرداختی","ویرایش سند پرداخت","مشاهده"],data:n})]})]})},wr=Lu("SLAUGHTER_PAY_FACTOR_SERVICE",async(e,{dispatch:t})=>{t(Cu());const{data:r,status:n}=await ku.post("kill_request_factor_payment/",e);return t(X()),{data:r,status:n}}),Tr=gu({paymentCode:bu().required("This field is required")}),N6=({factorKey:e,isFinalFactor:t})=>{const[r,n]=P.useState(),[l,d]=P.useState([]),C=iu(),[a]=f.useContext(Z),[,,i,,x]=f.useContext(Z),c=wu({initialValues:{paymentCode:"",doc:"",amount:""},validationSchema:Tr,onSubmit:o=>{t?C(He({key:e,factor_image:o.doc,payment_code:o.paymentCode,role:vu()})).then(s=>{C(S0({selectedDate1:i,selectedDate2:x})),C(y6()),C(fu({right:!1,bottom:!1,content:null})),a({vertical:"top",horizontal:"center",msg:"عملیات با موفقیت انجام شد.",severity:"success"})}):C(wr({factor_key:e,image:o.doc,payment_code:o.paymentCode,amount:o.amount})).then(s=>{C(fu({right:!1,bottom:!1,content:null})),a({vertical:"top",horizontal:"center",msg:"عملیات با موفقیت انجام شد.",severity:"success"})})}}),p=(o,s)=>{var v;o[0]&&n(Pe((v=o[0])==null?void 0:v.data_url)),d(o)};return f.useEffect(()=>{c.setFieldValue("doc",r)},[r]),u.jsx("div",{children:u.jsxs("form",{onSubmit:c.handleSubmit,children:[u.jsx(N,{label:"شناسه پرداخت",name:"paymentCode",variant:"outlined",margin:"normal",fullWidth:!0,error:c.touched.paymentCode&&!!c.errors.paymentCode,helperText:c.touched.paymentCode&&c.errors.paymentCode,value:c.values.paymentCode,onChange:c.handleChange}),!t&&u.jsx(r0,{allowLeadingZeros:!0,thousandSeparator:",",label:"مبلغ واریزی (ریال)",id:"amount",variant:"outlined",margin:"normal",fullWidth:!0,error:c.touched.amount&&!!c.errors.amount,helperText:c.touched.amount&&c.errors.amount,value:c.values.amount,onChange:c.handleChange}),u.jsx(F,{mb:D.SMALL,children:u.jsx(qe,{onChange:p,images:l,maxNumber:1,title:"بارگذاری سند"})}),u.jsx(Q,{fullWidth:!0,type:"submit",variant:"contained",color:"primary",children:"ثبت"})]})})},mr=Lu("SLAUGHTER_DELETE_FACTOR_SERVICE",async(e,{dispatch:t})=>{t(Cu());try{const{data:r,status:n}=await ku.put("kill_request_factor/0/",e);return t(X()),{data:r,status:n}}catch(r){return t(X()),{error:r.response.data.result}}}),Rr=()=>{const e=iu(),[t]=f.useContext(Z),[,,r,n,l,d]=f.useContext(Z);f.useEffect(()=>{const p=Eu(new Date).format("YYYY-MM-DD");n(p),d(p)},[]);const{slaughterFactors:C}=tu(p=>p.slaughterSlice),[a,i]=f.useState([]),[x,c]=f.useState([]);return f.useEffect(()=>{const p=C==null?void 0:C.filter(s=>s.state==="pending").map(s=>{var T,w,S,j,g,H,q,m,h,A;let v;switch(s.state){case"pending":v="در انتظار پرداخت";break;case"paid":v="پرداخت شده";break;case"unpaid":v="پرداخت نشده";break;default:v="در انتظار پرداخت"}return[(w=(T=s==null?void 0:s.killRequest)==null?void 0:T.slaughterHouse)!=null&&w.name?(j=(S=s==null?void 0:s.killRequest)==null?void 0:S.slaughterHouse)==null?void 0:j.name:(H=(g=s==null?void 0:s.killRequest)==null?void 0:g.killHouse)==null?void 0:H.name,du(s==null?void 0:s.createDate),(q=s==null?void 0:s.killRequest)==null?void 0:q.IndexWeight,s.killRequest.oldChickenBreed?s.killRequest.oldChickenBreed:(m=s==null?void 0:s.killRequest)==null?void 0:m.chickenBreed,s.killRequest.chickenBreed,s.killRequest.provinceQuantity?s.killRequest.provinceQuantity.toLocaleString():(h=s.killRequest.killCapacity)==null?void 0:h.toLocaleString(),s.killRequest.provinceQuantity?(A=s.killRequest.killCapacity)==null?void 0:A.toLocaleString():0,(s==null?void 0:s.amount.toLocaleString())+" ﷼",(s==null?void 0:s.minimumAmount.toLocaleString())+" ﷼",v,u.jsx(su,{disabled:s.state==="paid",color:"primary",onClick:()=>{e(fu({title:"پرداخت فاکتور",right:!(window.innerWidth<=600),bottom:window.innerWidth<=600,content:u.jsx(N6,{factorKey:s.key})}))},children:u.jsx(x6,{})},"ee"),u.jsx(su,{disabled:s.paidState==="paid",color:"error",onClick:()=>{e(Iu({title:"لغو سفارش",content:u.jsxs(F,{container:!0,direction:"column",alignItems:"center",justifyContent:"center",width:"100%",gap:D.SMALL,children:[u.jsx(F,{children:u.jsx(I,{children:"در صورت لغو فاکتور درخواست اولیه شما هم لغو می گردد."})}),u.jsx(F,{children:u.jsx(Q,{variant:"contained",color:"error",onClick:()=>{e(mr({state:"cancel",factor_key:s.key})).then(y=>{y.payload.error?(e(Ru()),t({vertical:"top",horizontal:"center",msg:y.payload.error,severity:"error"})):(e(S0({selectedDate1:r,selectedDate2:l})),e(Ru()),t({vertical:"top",horizontal:"center",msg:"سفارش با موفقیت لغو شد.",severity:"success"}))})},children:"لغو سفارش"})})]})}))},children:u.jsx(s0,{})},"ee")]});i(p);const o=C==null?void 0:C.filter(s=>s.state==="paid"||s.state==="unpaid").map(s=>{var T,w,S,j,g,H,q,m,h,A;let v;switch(s.state){case"pending":v="در انتظار پرداخت";break;case"paid":v="پرداخت شده";break;case"unpaid":v="پرداخت نشده";break;default:v="در انتظار پرداخت"}return[(w=(T=s==null?void 0:s.killRequest)==null?void 0:T.slaughterHouse)!=null&&w.name?(j=(S=s==null?void 0:s.killRequest)==null?void 0:S.slaughterHouse)==null?void 0:j.name:(H=(g=s==null?void 0:s.killRequest)==null?void 0:g.killHouse)==null?void 0:H.name,du(s==null?void 0:s.createDate),(q=s==null?void 0:s.killRequest)==null?void 0:q.IndexWeight,s.killRequest.oldChickenBreed?s.killRequest.oldChickenBreed:(m=s==null?void 0:s.killRequest)==null?void 0:m.chickenBreed,s.killRequest.chickenBreed,s.killRequest.provinceQuantity?s.killRequest.provinceQuantity.toLocaleString():(h=s.killRequest.killCapacity)==null?void 0:h.toLocaleString(),s.killRequest.provinceQuantity?(A=s.killRequest.killCapacity)==null?void 0:A.toLocaleString():0,(s==null?void 0:s.amount.toLocaleString())+" ﷼",(s==null?void 0:s.minimumAmount.toLocaleString())+" ﷼",v]});c(o)},[C]),f.useEffect(()=>{e(S0({selectedDate1:r,selectedDate2:l}))},[r,l]),u.jsxs(F,{container:!0,flex:1,children:[u.jsx(F,{width:"100%",children:u.jsx(Bu,{name:u.jsxs(F,{container:!0,alignItems:"center",gap:D.SMALL,children:[u.jsx(F,{children:u.jsx(I,{children:"فاکتور همراه با ثبت درخواست کشتار"})}),u.jsx(F,{children:u.jsx(eu,{label:"از تاریخ",id:"date",renderInput:p=>u.jsx(N,{style:{width:"160px"},...p}),value:r,onChange:p=>{n(Eu(p).format("YYYY-MM-DD"))}})}),u.jsx(F,{children:u.jsx(eu,{label:"تا تاریخ",id:"date",renderInput:p=>u.jsx(N,{style:{width:"160px"},...p}),value:l,onChange:p=>{d(Eu(p).format("YYYY-MM-DD"))}})})]}),columns:["کاربر","تاریخ درخواست","وزن","نژاد درخواستی","نژاد تایید شده","تعداد درخواستی","تعداد تایید شده","مبلغ پیش فاکتور","حداقل پرداختی (70%)","وضعیت","پرداخت","لغو سفارش"],data:a})}),u.jsx(F,{width:"100%",children:u.jsx(Bu,{name:"بایگانی",columns:["کاربر","تاریخ درخواست","وزن","نژاد درخواستی","نژاد تایید شده","تعداد درخواستی","تعداد تایید شده","مبلغ پیش فاکتور","حداقل پرداختی (70%)","وضعیت"],data:x})})]})},Lr=()=>{const e=iu(),{slaughterFinalFactors:t}=tu(i=>i.slaughterSlice),[,,r,n,l,d]=f.useContext(Z);f.useEffect(()=>{const i=Eu(new Date).format("YYYY-MM-DD");n(i),d(i)},[]);const[C,a]=f.useState([]);return f.useEffect(()=>{const i=t==null?void 0:t.map(x=>{let c;switch(x.paidState){case"pending":c="در انتظار پرداخت";break;case"paid":c="پرداخت شده";break;default:c="در انتظار پرداخت"}return[x==null?void 0:x.factorBarCode,c,(x==null?void 0:x.factorFee.toLocaleString())+" ﷼",(x==null?void 0:x.totalPrice.toLocaleString())+" ﷼",x==null?void 0:x.totalWeight,u.jsx(su,{disabled:x.paidState==="paid",color:"primary",onClick:()=>{e(fu({title:"پرداخت فاکتور",right:!(window.innerWidth<=600),bottom:window.innerWidth<=600,content:u.jsx(N6,{factorKey:x.key,isFinalFactor:!0})}))},children:u.jsx(x6,{})},"ee")]});a(i)},[t]),f.useEffect(()=>{e(y6({selectedDate1:r,selectedDate2:l}))},[r,l]),u.jsx(F,{container:!0,flex:1,children:u.jsx(F,{width:"100%",children:u.jsx(Bu,{name:u.jsxs(F,{container:!0,alignItems:"center",gap:D.SMALL,children:[u.jsx(F,{children:u.jsx(I,{children:"فاکتور نهایی"})}),u.jsx(F,{children:u.jsx(eu,{label:"از تاریخ",id:"date",renderInput:i=>u.jsx(N,{style:{width:"160px"},...i}),value:r,onChange:i=>{n(Eu(i).format("YYYY-MM-DD"))}})}),u.jsx(F,{children:u.jsx(eu,{label:"تا تاریخ",id:"date",renderInput:i=>u.jsx(N,{style:{width:"160px"},...i}),value:l,onChange:i=>{d(Eu(i).format("YYYY-MM-DD"))}})})]}),columns:["کدبار","وضعیت","قیمت هرکیلو","قابل پرداخت","وزن","پرداخت"],data:C})})})},Ir=Lu("SLAUGHTER_GET_EXPORT_ALLOW_STATE",async(e,{dispatch:t})=>{t(Cu());const{data:r,status:n}=await ku.get("allow_direct_buying/",{params:{role:vu(),...e}});return t(X()),{data:r,status:n}}),Mr=Lu("SLAUGHTER_GET_COUNTRIES",async(e,{dispatch:t})=>{t(Cu());const{data:r,status:n}=await ku.get("get_country/",{params:e});return t(X()),{data:r,status:n}}),$6=({edit:e,updateTable:t,item:r})=>{var E,_,$,G,hu,yu,R,Y,b,L,V,nu,J,cu,pu,ru,Tu,ju;const[n,l]=f.useState(1),[d,C]=f.useState(1),a=iu(),[i]=f.useContext(Z),[x,c]=f.useState(0),[p,o]=f.useState(!1),[s,v]=f.useState([]),[T,w]=f.useState(r!=null&&r.exportCountry?r==null?void 0:r.exportCountry:""),S=tu(k=>k.userSlice.selectedSubUser),{slaughterGetPoultries:j,slaughterGetKillerKillhouses:g,slaughterGetKillhouses:H}=tu(k=>k.slaughterSlice);f.useEffect(()=>{a(h0({role_key:z("slaughter")&&(S==null?void 0:S.key)||""})),a(h6({role_key:z("slaughter")&&(S==null?void 0:S.key)||""})),a(p6({role_key:z("slaughter")&&(S==null?void 0:S.key)||""})),a(Ce({role_key:z("slaughter")&&(S==null?void 0:S.key)||""})),a(Mr({role_key:z("slaughter")&&(S==null?void 0:S.key)||""})).then(k=>{v(k.payload.data)})},[S==null?void 0:S.key]);const q={killhouse:null,killerPlace:null,poultry:null,killDate:r?new Date(r.createDate):new Date,numberForBuy:r?r.killCapacity:null,indexWeight:r?r.IndexWeight:""},m=k=>{var O,U,ou,au,lu,Au;a(We({kill_capacity:k.numberForBuy,recive_time:"12 - 14",recive_date:k.killDate,low_weight:!1,high_weight:!1,Index_weight:k.indexWeight,chicken_breed:(au=(ou=(U=(O=A==null?void 0:A.values)==null?void 0:O.poultry)==null?void 0:U.item)==null?void 0:ou.hatchingAge)==null?void 0:au.breed,cash:!0,credit:!1,sms_payment:!1,kill_house_key:k.killhouse,killer_kill_house_key:k.killerPlace?k.killerPlace:null,role:vu(),poultry_key:(Au=(lu=A==null?void 0:A.values)==null?void 0:lu.poultry)==null?void 0:Au.value,export_status:!0,export_country:T})).then(Gu=>{Gu.payload.error?i({vertical:"top",horizontal:"center",msg:Gu.payload.error,severity:"error"}):(t(),i({vertical:"top",horizontal:"center",msg:"عملیات با موفقیت انجام شد.",severity:"success"}),a(fu({right:!1,bottom:!1,left:!1,content:null})))})};f.useEffect(()=>{var k,O,U,ou,au,lu;r&&c(((O=(k=r==null?void 0:r.poultry)==null?void 0:k.lastHatchingDiffrentRequestQuantity)==null?void 0:O.leftExportQuantity)===null?(ou=(U=r.poultry)==null?void 0:U.lastHatchingDiffrentRequestQuantity)==null?void 0:ou.lastHatchingRemainQuantity:(lu=(au=r==null?void 0:r.poultry)==null?void 0:au.lastHatchingDiffrentRequestQuantity)==null?void 0:lu.leftExportQuantity)},[]);const h=gu().shape({killhouse:bu().typeError("این فیلد الزامی است").required("این فیلد الزامی است"),poultry:gu("").typeError("این فیلد الزامی است").required("این فیلد الزامی است"),numberForBuy:mu().typeError("لطفا عدد وارد کنید").max(x,"تعداد بیش از حد مجاز است").required("لطفا عدد وارد کنید").positive("لطفا عدد وارد کنید").integer("لطفا عدد وارد کنید"),indexWeight:mu().typeError("لطفا عدد وارد کنید").required("لطفا عدد وارد کنید").positive("لطفا عدد وارد کنید")}),A=wu({initialValues:q,validationSchema:h,onSubmit:m});f.useEffect(()=>{var U,ou,au,lu;let k=A.values.indexWeight;const O=(lu=(au=(ou=(U=A.values)==null?void 0:U.indexWeight)==null?void 0:ou.toString())==null?void 0:au.split("."))==null?void 0:lu.join("");A.values.indexWeight&&O.length<=3&&(O.length===2&&(k=O[0]+"."+O[1]),O.length===3&&(k=O[0]+"."+O[1]+O[2])),isNaN(Number.parseFloat(k))?A.setFieldValue("indexWeight",""):A.setFieldValue("indexWeight",Number.parseFloat(k))},[A.values.indexWeight]);const y=async k=>{k.preventDefault(),a(h0({min_age:n||1,max_age:d||1,role_key:z("slaughter")&&(S==null?void 0:S.key)||""}))},M=async k=>{k.preventDefault(),l(1),C(1),a(h0({role_key:z("slaughter")}))};return u.jsx("form",{onSubmit:A.handleSubmit,children:u.jsxs(F,{container:!0,direction:"column",gap:D.SMALL,children:[!e&&u.jsxs(u.Fragment,{children:[H!=null&&H.length?u.jsx(Yu,{id:"killhouse",disableClearable:!0,options:H==null?void 0:H.map(k=>({label:(k!=null&&k.killer?"کشتارکن":"کشتارگاه")+" "+k.name,value:k.key,killer:k.killer,item:k,disabled:k.allowDirectBuying})),getOptionDisabled:k=>!k.disabled,getOptionLabel:k=>k.label,onChange:(k,O)=>{o(O.killer),A.setFieldValue("killhouse",O.value)},onBlur:A.handleBlur,renderInput:k=>u.jsx(N,{...k,label:"انتخاب کشتارگاه/کشتارکن",variant:"outlined",error:A.touched.killhouse&&!!A.errors.killhouse,helperText:A.touched.killhouse&&A.errors.killhouse})}):u.jsx(U6,{}),p&&u.jsx(Yu,{id:"killerPlace",disableClearable:!0,options:g==null?void 0:g.map(k=>({label:"کشتارگاه "+k.name,value:k.key})),getOptionLabel:k=>k.label,onChange:(k,O)=>A.setFieldValue("killerPlace",O.value),onBlur:A.handleBlur,renderInput:k=>u.jsx(N,{...k,label:"انتخاب محل کشتار",variant:"outlined",error:A.touched.killerPlace&&!!A.errors.killerPlace,helperText:A.touched.killerPlace&&A.errors.killerPlace})}),u.jsxs(F,{container:!0,alignItems:"center",gap:D.SMALL,style:{padding:"10px",border:"1px solid #bbb",borderRadius:"10px"},children:[u.jsx(F,{style:{width:"70px"},children:u.jsx(N,{fullWidth:!0,size:"small",label:"از سن",id:"outlined-controlled",value:n,onChange:k=>{l(k.target.value)}})}),u.jsx(F,{style:{width:"70px"},children:u.jsx(N,{fullWidth:!0,size:"small",label:"تا سن",id:"outlined-controlled",value:d,onChange:k=>{C(k.target.value)}})}),u.jsxs(F,{display:"grid",alignItems:"center",children:[u.jsx(Q,{disabled:n>d||n<1||d<1,onClick:y,children:"جستجو"}),u.jsx(Q,{color:"error",onClick:M,children:"حذف فیلتر"})]})]}),j!=null&&j.length?u.jsx(Yu,{id:"poultry",disableClearable:!0,options:j==null?void 0:j.map(k=>{var O,U;return{label:`${k.unitName} (${k.user.fullname}) سن: ${(O=k.lastHatchingDiffrentRequestQuantity)==null?void 0:O.age} روز / نژاد: ${(U=k.lastHatchingDiffrentRequestQuantity)==null?void 0:U.breed}`,value:k.key,item:k}}),getOptionLabel:k=>k.label,onChange:(k,O)=>{var U,ou,au,lu,Au;A.setFieldValue("poultry",O),c(((ou=(U=O==null?void 0:O.item)==null?void 0:U.lastHatchingDiffrentRequestQuantity)==null?void 0:ou.leftExportQuantity)===null?(au=O.item)==null?void 0:au.lastHatchingRemainQuantity:(Au=(lu=O==null?void 0:O.item)==null?void 0:lu.lastHatchingDiffrentRequestQuantity)==null?void 0:Au.leftExportQuantity)},onBlur:A.handleBlur,renderInput:k=>u.jsx(N,{...k,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(F,{container:!0,direction:"column",justifyContent:"space-between",children:[u.jsxs(F,{container:!0,gap:D.TINY,children:[u.jsx(I,{children:"نام و نام خانوادگی:"}),u.jsx(I,{children:(_=(E=A==null?void 0:A.values)==null?void 0:E.poultry)==null?void 0:_.item.user.fullname})]}),u.jsxs(F,{container:!0,gap:D.TINY,children:[u.jsx(I,{children:"تلفن:"}),u.jsx(I,{children:(G=($=A==null?void 0:A.values)==null?void 0:$.poultry)==null?void 0:G.item.user.mobile})]}),u.jsxs(F,{container:!0,gap:D.TINY,children:[u.jsx(I,{children:"آدرس:"}),u.jsx(I,{children:`${(yu=(hu=A==null?void 0:A.values)==null?void 0:hu.poultry)==null?void 0:yu.item.address.province.name} - ${(Y=(R=A==null?void 0:A.values)==null?void 0:R.poultry)==null?void 0:Y.item.address.city.name} - ${(L=(b=A==null?void 0:A.values)==null?void 0:b.poultry)==null?void 0:L.item.address.address}`})]}),u.jsxs(F,{container:!0,gap:D.TINY,children:[u.jsx(I,{children:"سن جوجه:"}),u.jsxs(I,{children:[(cu=(J=(nu=(V=A==null?void 0:A.values)==null?void 0:V.poultry)==null?void 0:nu.item)==null?void 0:J.lastHatchingDiffrentRequestQuantity)==null?void 0:cu.age," ","روز"]})]}),u.jsxs(F,{container:!0,gap:D.TINY,children:[u.jsx(I,{children:"مانده در سالن:"}),u.jsxs(I,{children:[(ju=(Tu=(ru=(pu=A==null?void 0:A.values)==null?void 0:pu.poultry)==null?void 0:ru.item)==null?void 0:Tu.lastHatchingRemainQuantity)==null?void 0:ju.toLocaleString()," ","قطعه"]})]}),u.jsxs(F,{container:!0,gap:D.TINY,children:[u.jsx(I,{color:"error",children:" مانده قابل صادرات:"}),u.jsxs(I,{color:"error",children:[x==null?void 0:x.toLocaleString()," قطعه"]})]})]})]}),u.jsx(eu,{fullWidth:!0,label:"تاریخ کشتار",id:"killDate",renderInput:k=>u.jsx(N,{...k}),value:A.values.killDate,error:A.touched.killDate?!!A.errors.killDate:null,onChange:k=>{A.setFieldValue("killDate",Eu(k).format("YYYY-MM-DD hh:mm:ss"))},onBlur:A.handleBlur,helperText:A.touched.killDate&&A.errors.killDate?A.errors.killDate:null}),u.jsx(r0,{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(X6,{position:"end",children:"کیلوگرم"})},error:A.touched.indexWeight&&!!A.errors.indexWeight,helperText:A.touched.indexWeight&&A.errors.indexWeight}),u.jsxs(Du,{children:[u.jsx(Hu,{id:"hour-label",children:"کشور مقصد"}),u.jsx(Ou,{labelId:"hour-label",label:"کشور مقصد",id:"hour-select",value:T,onChange:k=>w(k.target.value),children:s==null?void 0:s.map(k=>u.jsx(qu,{value:k.fa,children:k.fa},k.fa))})]}),!e&&u.jsx(Q,{type:"submit",variant:"contained",color:"primary",fullWidth:!0,disabled:!T,children:"ثبت"}),e&&u.jsx(Q,{disabled:!A.values.numberForBuy||!A.values.killDate||!A.values.indexWeight||A.values.numberForBuy>x||!T,variant:"contained",color:"primary",fullWidth:!0,onClick:()=>{a(Ye({role:vu(),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(k=>{var O,U;(O=k==null?void 0:k.payload)!=null&&O.error?i({vertical:"top",horizontal:"center",msg:(U=k==null?void 0:k.payload)==null?void 0:U.error,severity:"error"}):(t(),i({vertical:"top",horizontal:"center",msg:"عملیات با موفقیت انجام شد.",severity:"success"}),a(fu({right:!1,bottom:!1,left:!1,content:null})))})},children:"ثبت ویرایش"})]})})},Br=({item:e,updateTable:t})=>{const r=iu(),[n,l]=f.useState(null),[d]=f.useContext(Z),C=c=>{l(c.currentTarget)},a=()=>{l(null)},i=!!n,x=i?"popover":void 0;return u.jsxs(F,{container:!0,children:[u.jsx(su,{"aria-describedby":x,variant:"contained",color:"primary",onClick:C,children:u.jsx(j6,{})}),u.jsx(c6,{anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"left"},id:x,open:i,anchorEl:n,onClose:a,children:u.jsx("div",{style:{padding:"20px",display:"flex",flexDirection:"column"},children:u.jsxs(F,{container:!0,direction:"column",children:[u.jsx(Nu,{title:"ویرایش",placement:"right",children:u.jsx(su,{color:"primary",onClick:()=>{a(),r(fu({title:"ویرایش درخواست صادرات",content:u.jsx($6,{updateTable:t,edit:!0,item:e}),right:!(window.innerWidth<=600),bottom:window.innerWidth<=600}))},children:u.jsx($u,{})})}),u.jsx(Nu,{title:"حذف",children:u.jsx(su,{color:"error",onClick:()=>{r(Ne(e.key)).then(c=>{c.error?d({vertical:"top",horizontal:"center",msg:c.error,severity:"error"}):(t(),d({vertical:"top",horizontal:"center",msg:"عملیات با موفقیت انجام شد.",severity:"success"}))})},children:u.jsx(s0,{})})})]})})})]})},Hr=()=>{const e=iu(),[t,r]=f.useState(),n=tu(R=>R.userSlice.selectedSubUser);f.useEffect(()=>{e(Ir({role_key:z("slaughter")&&(n==null?void 0:n.key)||""})).then(R=>{r(R.payload.data)})},[n==null?void 0:n.key]);const[l,d]=f.useState(0),C=(R,Y)=>{d(Y)},[,,a,i,x,c]=f.useContext(Z);f.useEffect(()=>{const R=uu(new Date).format("YYYY-MM-DD");i(R),c(R)},[]);const p=R=>{g(R.target.value)},[o,s]=f.useState([]),[v,T]=f.useState(0),[w,S]=f.useState(10),[j,g]=f.useState(""),[H,q]=f.useState(1),[m,h]=f.useState([]),[A,y]=f.useState([]),M=async R=>{e(Cu());const Y=await ku.get(`kill_request/?export=true&type=${l===0?"pending":"archive"}&search=filter&value=${j}&role=${vu()}${z("slaughter")?`&role_key=${n==null?void 0:n.key}`:""}&date1=${a}&date2=${x}&page=${R}&page_size=${w}`);e(X()),s(Y.data.results),T(Y.data.count)},E=R=>{M(R),q(R)},_=R=>{S(R),q(1)},$=()=>{M(H!==0?H:1)};f.useEffect(()=>{M(1)},[n==null?void 0:n.key,a,x,w,l]);const G=R=>{let Y="";return R.exportState==="pending"?Y="در انتظار تایید":R.exportState==="rejected"?Y="رد شده":R.exportState==="accepted"?Y="تایید شده":R.exportState==="deleted"&&(Y="حذف شده"),Y};f.useEffect(()=>{const R=o==null?void 0:o.map((b,L)=>{var V,nu,J,cu,pu,ru;return[H===1?L+1:L+w*(H-1)+1,du(b==null?void 0:b.createDate),du(b.reciveDate),`${b.killHouse.name} (${b.killHouse.killHouseOperator.user.mobile})`,b!=null&&b.slaughterHouse?(V=b==null?void 0:b.slaughterHouse)==null?void 0:V.name:(nu=b==null?void 0:b.killHouse)==null?void 0:nu.name,b==null?void 0:b.exportCountry,`${(cu=(J=b==null?void 0:b.poultry)==null?void 0:J.userprofile)==null?void 0:cu.fullName} (${(ru=(pu=b==null?void 0:b.poultry)==null?void 0:pu.userprofile)==null?void 0:ru.mobile})`,b.killCapacity,b.IndexWeight,(b.IndexWeight*b.killCapacity).toLocaleString(),u.jsx(u.Fragment,{children:b!=null&&b.inputDirectBuyingCode?b==null?void 0:b.inputDirectBuyingCode:u.jsx(Q,{onClick:()=>{e(Iu({title:"ثبت کد احراز",content:u.jsx($e,{item:b,updateTable:$})}))},children:"ثبت کداحراز"})}),G(b),l===0?u.jsx(Br,{updateTable:$,item:b},L):"-"]});h(R);const Y=o==null?void 0:o.map((b,L)=>{var V,nu,J,cu,pu,ru;return[H===1?L+1:L+w*(H-1)+1,du(b==null?void 0:b.createDate),du(b.reciveDate),`${b.killHouse.name} (${b.killHouse.killHouseOperator.user.mobile})`,b!=null&&b.slaughterHouse?(V=b==null?void 0:b.slaughterHouse)==null?void 0:V.name:(nu=b==null?void 0:b.killHouse)==null?void 0:nu.name,b==null?void 0:b.exportCountry,`${(cu=(J=b==null?void 0:b.poultry)==null?void 0:J.userprofile)==null?void 0:cu.fullName} (${(ru=(pu=b==null?void 0:b.poultry)==null?void 0:pu.userprofile)==null?void 0:ru.mobile})`,b.killCapacity,b.IndexWeight,(b.IndexWeight*b.killCapacity).toLocaleString(),G(b),b!=null&&b.acceptRejectDate?f6(b==null?void 0:b.acceptRejectDate):"-",b==null?void 0:b.directBuyingMessage]});y(Y)},[o]);const hu=async R=>{R.preventDefault(),e(Cu());try{const Y=await ku.get(`kill_request/?export=true&type=${l===0?"pending":"archive"}&role=${vu()}${z("slaughter")?`&role_key=${n==null?void 0:n.key}`:""}&search=filter&value=${j}&date1=${a}&date2=${x}&page=1&page_size=${w}`);s(Y.data.results),T(Y.data.count),e(X())}catch(Y){console.error("Error fetching data:",Y)}},yu=tu(R=>R.userSlice.userProfile.key);return u.jsxs(F,{container:!0,direction:"column",flexWrap:"nowrap",mt:D.SMALL,children:[u.jsx(F,{container:!0,justifyContent:"center",alignItems:"center",my:D.SMALL,children:u.jsxs(C6,{scrollButtons:"auto",variant:"scrollable",allowScrollButtonsMobile:!0,value:l,onChange:C,children:[u.jsx(u0,{label:"درخواست های جدید"}),u.jsx(u0,{label:"بایگانی"})]})}),u.jsxs(F,{container:!0,mt:D.MEDIUM,alignItems:"center",justifyContent:"center",gap:2,children:[u.jsx(Q,{variant:"contained",disabled:!(t!=null&&t.exportStatus),onClick:()=>{e(fu({title:"ثبت درخواست صادرات",content:u.jsx($6,{updateTable:$}),right:!(window.innerWidth<=600),bottom:window.innerWidth<=600}))},children:"ثبت درخواست صادرات"}),u.jsx("form",{onSubmit:hu,children:u.jsxs(F,{container:!0,alignItems:"center",gap:D.SMALL,children:[u.jsx(N,{size:"small",autoComplete:"off",label:"جستجو",variant:"outlined",style:{width:250},onChange:p}),u.jsx(Q,{type:"submit",onClick:hu,endIcon:u.jsx(Ve,{}),children:"جستجو"}),u.jsx(F,{children:u.jsx(eu,{label:"از تاریخ",id:"date",renderInput:R=>u.jsx(N,{style:{width:"160px"},...R}),value:a,onChange:R=>{i(uu(R).format("YYYY-MM-DD"))}})}),u.jsx(F,{children:u.jsx(eu,{label:"تا تاریخ",id:"date",renderInput:R=>u.jsx(N,{style:{width:"160px"},...R}),value:x,onChange:R=>{c(uu(R).format("YYYY-MM-DD"))}})}),l===1&&u.jsx(F,{children:u.jsx(Nu,{title:"خروجی اکسل",children:u.jsx("a",{href:`${ku.defaults.baseURL}export_kill_house_excel/?date1=${a}&date2=${x}&role=${vu()}${z("slaughter")?`&role_key=${n==null?void 0:n.key}`:""}&key=${yu}`,rel:"noreferrer",children:u.jsx(Q,{color:"success",children:u.jsx(Ge,{size:32})})})})})]})}),l===0?u.jsx(zu,{data:m,columns:["ردیف","تاریخ ثبت درخواست","تاریخ کشتار","خریدار","محل کشتار","کشور مقصد","مرغدار (تلفن)","تعداد درخواست (قطعه)","میانگین وزنی (کیلوگرم)","وزن کل (کیلوگرم)","کد احراز","وضعیت","عملیات"],handlePageChange:E,totalRows:v,page:H,perPage:w,handlePerRowsChange:_,title:"صادرات"}):u.jsx(zu,{data:A,columns:["ردیف","تاریخ ثبت درخواست","تاریخ کشتار","خریدار","محل کشتار","کشور مقصد","مرغدار (تلفن)","تعداد درخواست (قطعه)","میانگین وزنی (کیلوگرم)","وزن کل (کیلوگرم)","وضعیت","تاریخ تایید/رد","دلیل رد"],handlePageChange:E,totalRows:v,page:H,perPage:w,handlePerRowsChange:_,title:"بایگانی صادرات"})]})]})},to=()=>{const{pathname:e}=g6(),{slaughterPermissionState:t}=tu(r=>r.slaughterSlice);return u.jsx(u.Fragment,{children:u.jsx(d6,{display:"flex",justifyContent:"center",children:u.jsxs(F,{container:!0,direction:"column",justifyContent:"center",xs:12,sm:12,md:10,lg:10,children:[e===he?u.jsxs(F,{justifyContent:"center",my:D.MEDIUM,children:[u.jsx(F,{children:u.jsx(I,{variant:"h6",children:"صفحه مدیریت درخواست های کشتارگاه"})}),u.jsx(rt,{hasPermission:t})]}):u.jsx(Oe,{}),u.jsxs(F,{container:!0,justifyContent:"space-between",gap:D.SMALL,children:[u.jsxs(F,{xs:12,children:[e===y0&&u.jsx(Ar,{steps:fr,disableDotsNavigation:!0,showButtons:!1,children:u.jsx(tt,{})}),e===pe&&u.jsx(we,{}),e===v0&&u.jsx(yr,{}),e===j0&&u.jsx(_r,{}),e===Ae&&u.jsx(nt,{})," ",e===fe&&u.jsx(ot,{}),e===b0&&u.jsx(Be,{}),e===ye&&u.jsx(Qe,{}),e===E0&&u.jsx(Dr,{}),e===xe&&u.jsx(Rr,{}),e===ge&&u.jsx(Lr,{}),e===x0&&u.jsx(ze,{}),e===g0&&u.jsx(Hr,{})]}),e===F0&&u.jsx(Ke,{})]})]})})})};export{to as default};