Files
Rasadyar_FrontEnd/build/assets/SlaughterStockWrapper-KWfSoKoo.js

2 lines
29 KiB
JavaScript
Raw Normal View History

2026-02-09 09:53:38 +03:30
import{j as u,T as q,aj as Lu,ak as zu,al as fu,am as $u,an as B,B as R,d as Wu,I as Bu,a_ as Qu,ay as e6,az as a6,aA as wu,b3 as r6,b5 as Ju,b6 as bu}from"./mui-vendor-D_SVL-Dx.js";import{L as vu,j as J,h as m,A as Ru,u as Hu,c as qu,b as _u,G as C,S as L,C as Vu,g4 as Eu,O as Su,v as O,a0 as N,p as ku,$ as Z,W as Xu,fG as Zu,k$ as s6}from"./index-D80MdVQn.js";import{r as l}from"./react-vendor-CmFgShSM.js";import{S as t6}from"./SlaughterShowProducts-C1xLq8AA.js";import{a as l6,f as V,u as uu}from"./redux-vendor-CfkcHgWN.js";import{R as U}from"./ResponsiveTable-bUYl0qDM.js";import{p as n6}from"./province-policy-drop-limit-D3SVePgA.js";import{c as D}from"./checkPathStartsWith-DedybDvj.js";import{d as o6}from"./Settings-Cboitw62.js";import{R as Du,a as c6}from"./index.esm-C1-dCPnj.js";import{b as Uu,c as C6,s as d6,a as mu,S as i6,v as h6}from"./vet-farm-get-out-province-dashboard-BLT-TxVO.js";import{S as u6}from"./ShowImage-DxnwAx1k.js";import{d as g6}from"./ToggleOffOutlined-C41wua6U.js";import{d as p6}from"./ToggleOn-Cv1P2E48.js";import{d as x6}from"./SystemUpdateAlt-QYMcO5S3.js";import{C as F6}from"./ChechClearanceCode-C2pygfym.js";import{d as y6}from"./Tune-BBzxV8DK.js";const A6=l6("SLAUGHTER_SUBMIT_REAL_INVENTORY",async(a,{dispatch:F})=>{F(vu());try{const{data:s,status:k}=await J.put("ware-house-accept-kill-house-request/0/",a);return F(m()),{data:s,status:k}}catch(s){return F(m()),{error:s.response.data.result}}}),j6=({item:a,updateTable:F})=>{var z,$,P;const[s,k]=l.useState("weight"),[t,A]=l.useState("0"),[g,f]=l.useState({min:0,max:100}),S=V(y=>y.userSlice.selectedSubUser),d=y=>{k(y.target.value)},[v,E]=l.useState(a!=null&&a.killer?"killer":"self"),W=y=>{E(y.target.value)},[w]=l.useContext(Ru),x=uu();l.useEffect(()=>{x(n6()).then(y=>{var j;(j=y.payload)!=null&&j.data&&f({min:parseFloat(y.payload.data.killHouseLimitPercentDown),max:parseFloat(y.payload.data.killHouseLimitPercentUp)})})},[]);const p=Hu({initialValues:{realNumber:a!=null&&a.acceptedRealQuantity?a==null?void 0:a.acceptedRealQuantity:"",realWeight:a!=null&&a.wareHouseAcceptedRealWeight?a==null?void 0:a.wareHouseAcceptedRealWeight:0},validationSchema:qu({realNumber:_u().typeError("لطفا فیلد را به درستی وارد کنید.!").required("این فیلد اجباری است!").min(0,"مقدار نمی‌تواند منفی باشد"),realWeight:_u().typeError("لطفا فیلد را به درستی وارد کنید.!").required("این فیلد اجباری است!").min(0,"مقدار نمی‌تواند منفی باشد")})}),h=Hu({initialValues:{lossWeight:""},validationSchema:qu({lossWeight:_u().typeError("لطفا فیلد را به درستی وارد کنید.!").required("این فیلد اجباری است!").min(g.min,`درصد افت باید بین ${g.min} تا ${g.max} درصد باشد!`).max(g.max,`درصد افت باید بین ${g.min} تا ${g.max} درصد باشد!`)})});l.useEffect(()=>{if(s==="weight")if(a!=null&&a.acceptedRealWeight&&p.values.realWeight){const j=(a.acceptedRealWeight-p.values.realWeight)/a.acceptedRealWeight*100;A(j.toFixed(2))}else A(0);else if(a!=null&&a.acceptedRealWeight&&h.values.lossWeight){const y=a.acceptedRealWeight/100*h.values.lossWeight;A((a.acceptedRealWeight-y).toFixed(2))}else A(0)},[p.values.realWeight,h.values.lossWeight,s,a]);const _=()=>s==="weight"?t>=g.min&&t<=g.max:h.isValid,b=()=>s==="weight"?p.isValid&&_():h.isValid,T=()=>{if(!b())return;const y=s==="weight"?{input_type:"input_weight",ware_house_accepted_real_quantity:parseInt(p.values.realNumber),ware_house_accepted_real_weight:parseInt(p.values.realWeight),kill_house_request_key:a==null?void 0:a.key,loss_percent:parseFloat(t)}:{input_type:"loss_weight",loss_percent:parseInt(h.values.lossWeight),kill_house_request_key:a==null?void 0:a.key};x(A6({...y,...a!=null&&a.killer?{input_warehouse:v}:{}})).then(j=>{j.payload.error?w({vertical:"top",horizontal:"center",msg:j.payload.error,severity:"error"}):(x(Vu()),F(),x(Eu({role_key:D("slaughter")?S==null?void 0:S.key:""})),Y())})},Y=()=>{x(Su({title:"عملیات با موفقیت