2 lines
12 KiB
JavaScript
2 lines
12 KiB
JavaScript
|
|
import{j as u,T as y,an as P,B as V,ah as W,i as pu,I as gu,b3 as xu,aq as Au,ar as q,b7 as G,as as H,b as fu}from"./mui-vendor-D_SVL-Dx.js";import{j as L,A as lu,L as T,W as $,h as F,u as Fu,c as vu,b as yu,V as ou,G as a,S as f,r as mu,a0 as w,lt as ju,O as bu,C as Iu,lu as _u,lv as Eu}from"./index-D80MdVQn.js";import{r as i,b as Su,u as Tu,f as Lu}from"./react-vendor-CmFgShSM.js";import{a as U,u as cu}from"./redux-vendor-CfkcHgWN.js";import{R as Bu}from"./ResponsiveTable-bUYl0qDM.js";import{I as Ru,f as ku}from"./toBase64-UDzdrM-n.js";import{d as zu}from"./DeleteOutlineOutlined-BmausW-i.js";import{d as Ou}from"./Visibility-Cb7r65bM.js";import{d as Du}from"./Tune-BBzxV8DK.js";import{R as Nu}from"./index.esm-C1-dCPnj.js";import"./FilterAlt-DZsHj-WQ.js";import"./styled-components.browser.esm-gS9mh05b.js";import"./PublishedWithChanges-Dz7dEVRv.js";import"./Delete-CIwpNviU.js";const iu=U("VET_FARM_NEW_INSPECT",async r=>{const{data:C,status:g}=await L.post("vet_farm_inspection/",r);return{data:C,status:g}}),wu=U("VET_GET_HATCHING",async r=>{const{data:C,status:g}=await L.get("poultry_hatching/?key="+r);return{data:C,status:g}}),Cu=({id:r,hall:C,poultrykey:g,updateTable:m})=>{var h,b,R,k;const n=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($({right:!1,bottom:!1,content:null}))):(B(o.payload.data),o.payload.data.length||B(null),n(F())),n(F())})},[]);const t=Fu({initialValues:{topic:"",description:"",losses:""},validationSchema:vu({topic:ou().required("این فیلد اجباری است!").typeError("لطفا فیلد را به درستی وارد کنید!"),description:ou().required("این فیلد اجباری است!").typeError("لطفا فیلد را به درستی وارد کنید!"),losses:yu().typeError("لطفا فیلد را به درستی وارد کنید!")})});return i.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?void 0:h.period} سالن ${(b=d[0])==null?void 0:b.hall} نژاد ${(R=d[0])==null?void 0:R.chickenBreed} باقیمانده ${(k=d[0])==null?void 0:k.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(Ru,{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(V,{disabled:!t.isValid,fullWidth:!0,variant:"contained",onClick:()=>{var I;n(T());const o=j.map(c=>ku(
|