Files
Rasadyar_FrontEnd/build/assets/VetFarm-B7xC-uJE.js

2 lines
12 KiB
JavaScript
Raw Normal View History

2026-01-19 15:55:00 +03:30
import{j as u,T as y,ak as P,B as $,p as W,i as pu,I as gu,b0 as xu,an as Au,ao as G,b4 as H,ap as U,b as fu}from"./mui-vendor-CkIVaoQP.js";import{j as L,A as lu,L as T,N as V,h as F,u as Fu,c as vu,b as yu,M as ou,G as a,S as f,r as mu,X as w,k2 as ju,O as bu,C as Iu,k3 as _u,k4 as Eu}from"./index-Vwb3Bce5.js";import{r as i,b as Su,u as Tu,f as Lu}from"./react-vendor-CmFgShSM.js";import{a as q,u as cu}from"./redux-vendor-B7uoacJt.js";import{R as Bu}from"./ResponsiveTable-DugzNG82.js";import{I as ku,f as Ru}from"./toBase64-DB8tmZmy.js";import{d as zu}from"./DeleteOutlineOutlined-BatOxAQI.js";import{d as Nu}from"./Visibility-Dotz22eQ.js";import{d as Ou}from"./Tune-DzkdDfJZ.js";import{R as Du}from"./index.esm-Bu7XMDZU.js";import"./FilterAlt-CTDmPS36.js";import"./styled-components.browser.esm-gS9mh05b.js";import"./PublishedWithChanges-BErs-ATv.js";import"./Delete-DHYHiC8G.js";import"./iconBase-BEJYyZsk.js";const iu=q("VET_FARM_NEW_INSPECT",async r=>{const{data:C,status:g}=await L.post("vet_farm_inspection/",r);return{data:C,status:g}}),wu=q("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,k,R;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(V({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} نژاد ${(k=d[0])==null?void 0:k.chickenBreed} باقیمانده ${(R=d[0])==null?void 0: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