import{jase,agasE,avasL,awasN,axasA,akasg,Tasw,Bask,pasx}from"./mui-vendor-CkIVaoQP.js";import{jasD,AasG,uasF,casv,MasR,bas_,Gasp,SasC,LasM,hasV,jIasP,jJasW,NasH,vasm}from"./index-Cr86_nOs.js";import{rasf,bash}from"./react-vendor-CmFgShSM.js";import{IasO,fasU}from"./toBase64-CmPKyXM7.js";import{aasq,uasz}from"./redux-vendor-B7uoacJt.js";const$=q("SLAUGHTER_NEW_COMPLAINT",asyncr=>{const{data:l,status:o}=awaitD.post("kill_house_complaint/",r);return{data:l,status:o}}),J=({barKey:r,role:l})=>{const[o]=f.useContext(G),t=z(),[n,j]=h.useState(10),[S,B]=h.useState([]),[i,y]=h.useState([]),b=(a,c)=>{B(a),y(a.map(d=>U(d.data_url)))},I=a=>{switch(a){case10:returns.isValid&&u.isValid&&i.length;default:returnu.isValid&&i.length}},T=a=>{j(a.target.value)},u=F({initialValues:{description:""},validationSchema:v({description:R().required("این فیلد اجباری است!").typeError("لطفا فیلد را پر کنید!")})}),s=F({initialValues:{looses:""},validationSchema:v({looses:_().required("این فیلد اجباری است!").typeError("لطفا عدد وارد کنید!")})});returnf.useEffect(()=>{u.validateForm(),s.validateForm()},[]),e.jsxs(p,{container:!0,gap:C.SMALL,direction:"column",flex:"1",height:"100%",justifyContent:"space-between",children:[e.jsxs(p,{container:!0,direction:"column",gap:C.SMALL,children:[e.jsxs(E,{fullWidth:!0,children:[e.jsx(L,{id:"demo-simple-select-label",children:"موضوع"}),e.jsxs(N,{labelId:"demo-simple-select-label",id:"demo-simple-select",value:n,label:"موضوع",onChange:T,children:[e.jsx(A,{value:10,children:"مغایرت درصد تلفات با واقعیت"}),e.jsx(A,{value:20,children:"دیگر"})]})]}),n===10&&e.jsx(g,{id:"looses",label:"درصد تلفات",variant:"outlined",sx:{width:"100%",height:"100%"},value:s.values.looses,error:s.touched.looses?!!s.errors.looses:null,onChange:s.handleChange,onBlur:s.handleBlur,helperText:s.touched.looses&&s.errors.looses?s.errors.looses:null}),e.jsx(g,{id:"description",label:"توضیحات",multiline:!0,rows:5,variant:"outlined",sx:{width:"100%",height:"100%"},value:u.values.description,error:u.touched.description?!!u.errors.description:null,onChange:u.handleChange,onBlur:u.handleBlur,helperText:u.touched.description&&u.errors.description?u.errors.description:null}),e.jsx(w,{children:"پیوست تصویر"}),e.jsx(p,{mb:C.SMALL,children:e.jsx(O,{id:"image",onChange:b,images:S,maxNumber:4,title:"بارگذاری سند",value:u.values.image,error:u.touched.image?!!u.errors.image:null,onBlur:u.handleBlur,helperText:u.touched.image&&u.errors.image?u.errors.image:null})})]}),e.jsx(k,{fullWidth:!0,variant:"contained",disabled:!I(n),onClick:()=>{vara,c;t(M()),t($({bar_key:r,image:i,title:n===10?" مغایرت درصد تلفات با واقعیت":"دیگر",description:u.values.description,percent:(a=s.values)!=null&&a.looses?(c=s.values)==null?void0:c.looses:null,role:l})).then(d=>{t(V()),d.error?o({vertical:"top",horizontal:"center",msg:"مشکلی پیش آمده است",severity:"error"}):(t(P()),t(W()),t(H({right:!1,bottom:!1,content:null})),o({vertical:"top",horizontal:"center",msg:"عملیات با موفقیت انجام شد!",severity:"success"}))})},children:"ثبت اطلاعات"})]})};J.propTypes={barKey:x.PropTypes.any,role:x.PropTypes.any};constuu=r=>{constl=m(newDate(r)),o=m(),t=l.diff(o);returnm.duration(t).asSeconds()};export{JasS,uuasg};