Files
Rasadyar_FrontEnd/build/assets/SenfInventoryPage-DTU5E_1E.js

2 lines
11 KiB
JavaScript
Raw Normal View History

2026-01-19 15:55:00 +03:30
import{j as u,ak as x,aa as M,B as j,T as v,am as P,ai as m,aX as Y,ag as $,ah as K,aj as I,b as X}from"./mui-vendor-CkIVaoQP.js";import{G as n,S as g,lg as S,L as J,j as Q,h as V,A as b,u as D,c as O,X as w,lh as N,li as T,jw as L,lj as k,C as E,b as y,M as G,V as H,p as Z,O as z,W as uu,a9 as eu,lk as au}from"./index-Vwb3Bce5.js";import{B as ru}from"./BackButton-CX1bfrW9.js";import{V as su}from"./index.esm-CjWvmHks.js";import{L as tu}from"./LinkItem-Cp7DiDkz.js";import{N as nu}from"./NavLink-D2GD_ItM.js";import{f as W,r as d}from"./react-vendor-CmFgShSM.js";import{a as ou,u as B,f as lu}from"./redux-vendor-B7uoacJt.js";import{S as cu}from"./SimpleTable-B3_6HY_p.js";import{A as iu}from"./AdvancedTable-B0ObjV8k.js";import{g as U}from"./guild-allocated-stock-operation-BZvss5_H.js";import"./iconBase-BEJYyZsk.js";import"./index-CgNdnt2v.js";import"./Close-8pFLGZ5w.js";import"./Search-CLlOaERQ.js";import"./Delete-DHYHiC8G.js";const Cu=()=>{const{pathname:a}=W();return u.jsx(n,{container:!0,gap:g.SMALL,p:g.SMALL,direction:{xs:"column",md:"row"},justifyContent:"center",style:{placeContent:"baseline"},children:u.jsx(nu,{to:S,active:a===S?"true":null,children:u.jsx(tu,{icon:u.jsx(su,{size:30,color:"#244CCC"}),title:"موجودی انبار"})})})},du=ou("GUILD_UPDATE_ALLOCATED_STOCK_SERVICE",async(a,{dispatch:o})=>{o(J());try{const{data:c,status:l}=await Q.put("steward-allocation/0/",a);return o(V()),{data:c,status:l}}catch(c){return o(V()),{error:c.response.data.result}}}),hu=O().shape({quantity:y().required("وارد کردن تعداد اجباری است"),weight:y().required("وارد کردن وزن اجباری است")}),gu=({item:a})=>{const[o]=d.useContext(b),[,,c]=d.useContext(b),l=B(),s=D({initialValues:{quantity:a==null?void 0:a.receiverRealNumberOfCarcasses,weight:a==null?void 0:a.receiverRealWeightOfCarcasses},validationSchema:hu,onSubmit:t=>{l(du({steward:!0,allocation_key:a.key,receiver_real_number_of_carcasses:Number(t.quantity),receiver_real_weight_of_carcasses:Number(t.weight)})).then(h=>{h.payload.error?o({vertical:"top",horizontal:"center",msg:h.payload.error,severity:"error"}):(w()==="senf"?(l(N({date:c})),l(T({date:c}))):(l(L({date:c})),l(k({date:c}))),o({vertical:"top",horizontal:"center",msg:"عملیات با موفقیت انجام شد.",severity:"success"}),l(E()))})}});return d.useEffect(()=>{s.validateForm()},[]),d.useEffect(()=>{const t=s.values.weight/a.indexWeight;s.setFieldValue("quantity",t.toFixed(0))},[s.values.weight]),u.jsx(n,{container:!0,direction:"column",width:"100%",children:u.jsx("form",{onSubmit:s.handleSubmit,children:u.jsxs(n,{container:!0,gap:g.SMALL,children:[u.jsx(x,{id:"weight",name:"weight",label:"وزن واقعی تحویلی",InputProps:{endAdornment:u.jsx(M,{position:"end",children:"کیلوگرم"})},value:s.values.weight,onChange:s.handleChange,error:s.touched.weight&&s.errors.weight,helperText:s.touched.weight&&s.errors.weight}),u.jsx(x,{id:"quantity",name:"quantity",label:"تعداد واقعی تحویلی",disabled:!0,InputProps:{endAdornment:u.jsx(M,{position:"end",children:"قطعه"})},value:s.values.quantity,onChange:s.handleChange,error:s.touched.quantity&&s.errors.quantity,helperText:s.touched.quantity&&s.errors.quantity}),u.jsx(j,{type:"submit",fullWidth:!0,variant:"contained",children:"ثبت"})]})})})},pu=({item:a})=>{const o=B(),[,,c]=d.useContext(b),[l]=d.useContext(b),[s,t]=d.useState("option1"),h=C=>{t(C.target.value)},p={authCode:""},e=O({authCode:G().required("کداحراز اجباری است")}),i=D({initialValues:p,validationSchema:e,onSubmit:C=>{}}),[A,F]=d.useState(!1),_=()=>{F(!A)},r=D({initialValues:{number:"",weight:""},validationSchema:O({number:y().required("این فیلد اجباری است!").typeError("لطفا عدد وارد کنید!"),weight:y().required("این فیلد اجباری است!").typeError("لطفا وزن را وارد کنید!")})});return d.useEffect(()=>{i.validateForm(),r.validateForm()},[]),u.jsxs(n,{container:!0,width:"100%",direction:"column",justifyContent:"space-between",gap:g.TINY,children:[u.jsxs(n,{con