import{jasu,Tasy,akasP,Bas$,pasW,iaspu,Iasgu,b0asxu,anasAu,aoasG,b4asH,apasU,basfu}from"./mui-vendor-CkIVaoQP.js";import{jasL,Aaslu,LasT,NasV,hasF,uasFu,casvu,basyu,Masou,Gasa,Sasf,rasmu,Xasw,k2asju,Oasbu,CasIu,k3as_u,k4asEu}from"./index-Cr86_nOs.js";import{rasi,basSu,uasTu,fasLu}from"./react-vendor-CmFgShSM.js";import{aasq,uascu}from"./redux-vendor-B7uoacJt.js";import{RasBu}from"./ResponsiveTable-Dua7tTwQ.js";import{Iasku,fasRu}from"./toBase64-CmPKyXM7.js";import{daszu}from"./DeleteOutlineOutlined-O-wCemP7.js";import{dasNu}from"./Visibility-DGGnwazK.js";import{dasOu}from"./Tune-m0V6JHJm.js";import{RasDu}from"./index.esm-Bu7XMDZU.js";import"./FilterAlt-RwhTl5ac.js";import"./styled-components.browser.esm-gS9mh05b.js";import"./PublishedWithChanges-wX45M9wC.js";import"./Delete-CTUmuli-.js";import"./iconBase-BEJYyZsk.js";constiu=q("VET_FARM_NEW_INSPECT",asyncr=>{const{data:C,status:g}=awaitL.post("vet_farm_inspection/",r);return{data:C,status:g}}),wu=q("VET_GET_HATCHING",asyncr=>{const{data:C,status:g}=awaitL.get("poultry_hatching/?key="+r);return{data:C,status:g}}),Cu=({id:r,hall:C,poultrykey:g,updateTable:m})=>{varh,b,k,R;constn=cu(),[d,B]=i.useState(""),[j,x]=Su.useState([]),M=(o,I)=>{x(o)},[l]=i.useContext(lu);i.useEffect(()=>{n(T()),n(wu(r+"&hall="+C)).then(o=>{o.error?(l({vertical:"top",horizontal:"center",msg:"اطلاعات جوجه ریزی یافت نشد!",severity:"error"}),n(V({right:!1,bottom:!1,content:null}))):(B(o.payload.data),o.payload.data.length||B(null),n(F())),n(F())})},[]);constt=Fu({initialValues:{topic:"",description:"",losses:""},validationSchema:vu({topic:ou().required("این فیلد اجباری است!").typeError("لطفا فیلد را به درستی وارد کنید!"),description:ou().required("این فیلد اجباری است!").typeError("لطفا فیلد را به درستی وارد کنید!"),losses:yu().typeError("لطفا فیلد را به درستی وارد کنید!")})});returni.useEffect(()=>{t.validateForm()},[]),u.jsx(a,{container:!0,gap:f.SMALL,direction:"column",flex:"1",height:"100%",justifyContent:"space-between",children:u.jsxs(a,{container:!0,direction:"column",gap:f.SMALL,children:[d&&u.jsxs(u.Fragment,{children:[u.jsxs(a,{sx:{textAlign:"justify"},children:[u.jsx(y,{variant:"body2",mr:f.TINY,color:o=>o.palette.grey.A700,children:"دوره جوجه ریزی"}),u.jsx(y,{variant:"body2",mr:f.TINY,fontWeight:"bold",children:`دوره ${(h=d[0])==null?void0:h.period} سالن ${(b=d[0])==null?void0:b.hall} نژاد ${(k=d[0])==null?void0:k.chickenBreed} باقیمانده ${(R=d[0])==null?void0:R.leftOver} قطعه`})," "]}),u.jsx(a,{children:u.jsx(P,{id:"losses",label:"درصورت وجود تلفات، مقدار آن را وارد کنید",variant:"outlined",sx:{width:"100%"},value:t.values.losses,error:t.touched.losses?!!t.errors.losses:null,onChange:t.handleChange,onBlur:t.handleBlur,helperText:t.touched.losses&&t.errors.losses?t.errors.losses:null})})]}),u.jsx(a,{children:u.jsx(P,{id:"topic",label:"موضوع",variant:"outlined",sx:{width:"100%"},value:t.values.topic,error:t.touched.topic?!!t.errors.topic:null,onChange:t.handleChange,onBlur:t.handleBlur,helperText:t.touched.topic&&t.errors.topic?t.errors.topic:null})}),u.jsx(a,{children:u.jsx(P,{multiline:!0,rows:4,id:"description",label:"توضیحات",variant:"outlined",sx:{width:"100%"},value:t.values.description,error:t.touched.description?!!t.errors.description:null,onChange:t.handleChange,onBlur:t.handleBlur,helperText:t.touched.description&&t.errors.description?t.errors.description:null})}),u.jsx(y,{children:"پیوست تصویر"}),u.jsx(a,{mb:f.SMALL,children:u.jsx(ku,{id:"image",onChange:M,images:j,maxNumber:4,title:"بارگذاری سند",value:t.values.image,error:t.touched.image?!!t.errors.image:null,onBlur:t.handleBlur,helperText:t.touched.image&&t.errors.image?t.errors.image:null})}),u.jsx(a,{mb:f.SMALL,children:u.jsx($,{disabled:!t.isValid,fullWidth:!0,variant:"contained",onClick:()=>{var