Files
Rasadyar_FrontEnd/build/assets/InspectorEditAviculture-ClEg2r50.js

2 lines
13 KiB
JavaScript
Raw Normal View History

2026-01-19 15:55:00 +03:30
import{a as k,u as S}from"./redux-vendor-B7uoacJt.js";import{j as W,A as q,u as H,c as O,M as y,b as x,v as w,L as E,h as N,G as l,S as G,W as Z,e4 as L,N as R}from"./index-Vwb3Bce5.js";import{j as e,ak as s,B as M,p as o,al as D,ag as uu,av as eu,aw as ru,ax as a}from"./mui-vendor-CkIVaoQP.js";import{r as t}from"./react-vendor-CmFgShSM.js";import{c as U,a as Y}from"./city-get-city-DPzaFpLT.js";const iu=k("INSPECTOR_CHANGE_USER_STATE",async C=>{const{data:p,status:m}=await W.delete("system_user_profile/0/",{params:C});return{data:p,status:m}}),z=k("INSPECTOR_UPDATE_USER_PROFILE",async C=>{const{data:p,status:m}=await W.put("system_user_profile/0/",C);return{data:p,status:m}}),au=({id:C,birthday:p,nationalCode:m,nationalId:b,firstName:F,lastName:f,password:j,phone:B})=>{const[d]=t.useContext(q),[,_]=t.useState([]),[,T]=t.useState([]),[A]=t.useState(),[,P]=t.useState(!0),i=S(),r=H({initialValues:{fname:F||"",lname:f||"",nationalcode:b||"",nationalId:m||"",password:j||"",phone:B||"",birthday:p||w(Date()).format("YYYY-MM-DD hh:mm:ss")},validationSchema:O({fname:y().typeError("لطفا فیلد را پر کنید!"),lname:y().typeError("لطفا فیلد را پر کنید!"),nationalcode:y().typeError("لطفا مقادیر را به درستی وارد کنید!"),nationalId:x().test("len","کد ملی میبایست ده رقم باشد.",(c,v)=>{if(v.originalValue)return v.originalValue.length===10}),password:y().typeError("لطفا مقادیر را به درستی وارد کنید!")})});return t.useEffect(()=>{r.validateForm()},[]),t.useEffect(()=>{var c;(c=i(U()))==null||c.then(v=>{_(v.payload.data)})},[]),t.useEffect(()=>{A&&(i(E()),i(Y(A)).then(c=>{T(c.payload.data),P(!1),i(N())}))},[A]),e.jsx(e.Fragment,{children:e.jsx(l,{children:e.jsxs(l,{container:!0,gap:G.SMALL,direction:"column",children:[e.jsx(l,{children:e.jsx(s,{id:"fname",label:"نام",variant:"outlined",sx:{width:"100%"},value:r.values.fname,error:r.touched.fname?!!r.errors.fname:null,onChange:r.handleChange,onBlur:r.handleBlur,helperText:r.touched.fname&&r.errors.fname?r.errors.fname:null})}),e.jsx(l,{children:e.jsx(s,{id:"lname",label:"نام خانوادگی ",variant:"outlined",sx:{width:"100%"},value:r.values.lname,error:r.touched.lname?!!r.errors.lname:null,onChange:r.handleChange,onBlur:r.handleBlur,helperText:r.touched.lname&&r.errors.lname?r.errors.lname:null})}),e.jsx(l,{children:e.jsx(Z,{fullWidth:!0,label:"تاریخ تولد",id:"birthday",renderInput:c=>e.jsx(s,{...c}),value:r.values.birthday,error:r.touched.birthday?!!r.errors.birthday:null,onChange:c=>{r.setFieldValue("birthday",w(c).format("YYYY-MM-DD hh:mm:ss"))},onBlur:r.handleBlur,helperText:r.touched.birthday&&r.errors.birthday?r.errors.birthday:null})}),e.jsx(l,{children:e.jsx(s,{id:"nationalcode",label:"شماره شناسنامه",variant:"outlined",sx:{width:"100%"},value:r.values.nationalcode,error:r.touched.nationalcode?!!r.errors.nationalcode:null,onChange:r.handleChange,onBlur:r.handleBlur,helperText:r.touched.nationalcode&&r.errors.nationalcode?r.errors.nationalcode:null})}),e.jsx(l,{children:e.jsx(s,{id:"nationalId",label:"کد ملی",type:"nationalId",variant:"outlined",sx:{width:"100%"},value:r.values.nationalId,error:r.touched.nationalId?!!r.errors.nationalId:null,onChange:r.handleChange,onBlur:r.handleBlur,helperText:r.touched.nationalId&&r.errors.nationalId?r.errors.nationalId:null})}),e.jsx(l,{children:e.jsx(s,{id:"phone",label:"تلفن",variant:"outlined",sx:{width:"100%"},value:r.values.phone,error:r.touched.phone?!!r.errors.phone:null,onChange:r.handleChange,onBlur:r.handleBlur,helperText:r.touched.phone&&r.errors.phone?r.errors.phone:null})}),e.jsx(l,{children:e.jsx(s,{id:"password",label:"کلمه عبور",variant:"outlined",sx:{width:"100%"},value:r.values.password,error:r.touched.password?!!r.errors.password:null,onChange:r.handleChange,onBlur:r.handleBlur,helperText:r.touched.password&&r.errors.password?r.errors.password:null})}),e.jsx(M,{fullWidth:!0,color:"primary",variant:"contained",onClick:()=>{i(E()),i(z({type:"self_profile",person_type:"operator",u