import{jasu,akasz,BasR,aiasE,b5asL,TasV,iasP,agasU,ahasY,ajasN,IasQ,b0asX,anasK,b4asJ,apasZ,aqasuu}from"./mui-vendor-CkIVaoQP.js";import{rasd}from"./react-vendor-CmFgShSM.js";import{Las_,jasF,h,AasS,uasD,casH,XasG,Naseu,fAasru,MasT,csastu,GasA,CasW,rasou,fjasau,Oasw}from"./index-Vwb3Bce5.js";import{aask,uasI,fassu}from"./redux-vendor-B7uoacJt.js";import{dasnu}from"./Tune-DzkdDfJZ.js";import{aaslu}from"./index.esm-Bu7XMDZU.js";import{Fasiu}from"./FileUploader-C5K2edqw.js";import{dascu}from"./Add-C-nZhvlM.js";import{dasdu}from"./Sms-DJEGTBb8.js";const$=k("ARCHIVE_HATCHING_SERVICE",async(e,{dispatch:t})=>{t(_());try{const{data:o,status:s}=awaitF.put("poultry_hatching/0/",e);returnt(h()),{data:o,status:s}}catch(o){returnt(h()),{error:o.response.data.result}}}),Cu=H({name:T()}),Iu=({item:e,selectedAge1:t,selectedAge2:o,updateTable:s})=>{const[r]=d.useContext(S),c=I(),n=D({initialValues:{name:""},validationSchema:Cu,onSubmit:m=>{c($({key:e.key,archive_state:"",message:m.name,role:G()})).then(p=>{p.payload.error?r({vertical:"top",horizontal:"center",msg:p.payload.error,severity:"error"}):(c(eu({right:!1,bottom:!1,content:null})),t&&c(ru({selectedAge1:t,selectedAge2:o})),s(),r({vertical:"top",horizontal:"center",msg:"عملیات با موفقیت انجام شد.",severity:"success"}))})}});returnu.jsxs("form",{onSubmit:n.handleSubmit,children:[u.jsx(z,{id:"name",name:"name",label:"توضیحات",variant:"outlined",multiline:!0,rows:4,fullWidth:!0,margin:"normal",value:n.values.name,onChange:n.handleChange,onBlur:n.handleBlur,helperText:n.touched.name&&n.errors.name,error:n.touched.name&&!!n.errors.name}),u.jsx(R,{type:"submit",variant:"contained",color:"primary",fullWidth:!0,children:"ثبت"})]})},hu=k("HATCHING_UNDO_ARCHIVE_SERVICE",async(e,{dispatch:t})=>{try{t(_());const{data:o,status:s}=awaitF.put("poultry_hatching/0/",e);returnt(h()),{data:o,status:s}}catch(o){returnt(h()),{error:o.response.data.result}}}),pu=({item:e,updateTable:t,isArchive:o})=>{const[s,r]=d.useState(e==null?void0:e.violation),[c,n]=d.useState(!1),m=I(),p=i=>{r(i.target.checked)},x=i=>{n(i.target.checked)},[y]=d.useContext(S),[b,C]=d.useState([]),B=i=>{C(i)},l=D({initialValues:{reportText:e==null?void0:e.violationReport,bar_image:""},validationSchema:H({reportText:T().required("این فیلد اجباری است!").typeError("لطفا گزارش خود را بیان کنید."),bar_image:tu()})});returnd.useEffect(()=>{l.validateForm()},[]),u.jsxs(A,{container:!0,xs:12,justifyContent:"center",alignItems:"center",gap:2,children:[u.jsx(E,{control:u.jsx(L,{checked:s,onChange:p,color:"primary"}),label:s?"متخلف":"بدون تخلف",style:{justifyContent:"center",alignItems:"center",display:"flex"}}),!o&&u.jsx(E,{control:u.jsx(L,{checked:c,onChange:x,color:"primary"}),label:"انتقال به بایگانی",style:{justifyContent:"center",alignItems:"center",display:"flex"}}),u.jsx(z,{multiline:!0,rows:4,fullWidth:!0,id:"reportText",label:"متن گزارش",variant:"outlined",value:l.values.reportText,error:l.touched.reportText?!!l.errors.reportText:null,onChange:l.handleChange,onBlur:l.handleBlur,helperText:l.touched.reportText&&l.errors.reportText?l.errors.reportText:null}),u.jsx(V,{color:"error",children:"در صورت آپلود فایل جدید، سندهای پیشین حذف میشوند!"}),u.jsx(iu,{onChange:B}),u.jsx(R,{mt:2,disabled:!l.isValid||l.isSubmitting,fullWidth:!0,variant:"contained",onClick:async()=>{try{consti={key:e==null?void0:e.key,violation_check:!0,violation:s,violation_report:l.values.reportText,archive:c},v=newFormData;Object.entries(i).forEach(([f,g])=>{v.append(f,g)}),b.forEach((f,g)=>{v.append(`violation_image_${g}`,f)});constj=awaitm($(b.length?v:i));if(j.error)thrownewError(j.error);t(1),m(W()),y({vertical:"top",horizontal:"center",msg:"عملیات با موفقیت انجام شد.",severity:"success"})}catch(i){y({vertical:"top",horizontal:"center",msg:i.message||"خطا در ارسال اطلاعات",severity:"erro