fixed slaughter submit out province sell
This commit is contained in:
@@ -21,9 +21,9 @@ import moment from "moment";
|
|||||||
import { fetchSlaughterBroadcastAndProducts } from "../../services/handle-fetch-slaughter-products";
|
import { fetchSlaughterBroadcastAndProducts } from "../../services/handle-fetch-slaughter-products";
|
||||||
|
|
||||||
const validationSchema = Yup.object().shape({
|
const validationSchema = Yup.object().shape({
|
||||||
quarantineCode: Yup.string().required("کد قرنطینه الزامی است"),
|
clearance_code: Yup.string().required("کد قرنطینه الزامی است"),
|
||||||
carcassCount: Yup.number().required("حجم لاشه الزامی است"),
|
number_of_carcasses: Yup.number().required("حجم لاشه الزامی است"),
|
||||||
carcassWeight: Yup.number().required("وزن لاشه الزامی است"),
|
weight_of_carcasses: Yup.number().required("وزن لاشه الزامی است"),
|
||||||
date: Yup.string().required("تاریخ الزامی است"),
|
date: Yup.string().required("تاریخ الزامی است"),
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -38,9 +38,9 @@ export const SlaughterSubmitOutProvinceSell = ({
|
|||||||
const [openNotif] = useContext(AppContext);
|
const [openNotif] = useContext(AppContext);
|
||||||
|
|
||||||
const initialValues = {
|
const initialValues = {
|
||||||
quarantineCode: item?.clearanceCode || "",
|
clearance_code: item?.clearanceCode || "",
|
||||||
carcassCount: item?.numberOfCarcasses || "",
|
number_of_carcasses: item?.numberOfCarcasses || "",
|
||||||
carcassWeight: item?.weightOfCarcasses || "",
|
weight_of_carcasses: item?.weightOfCarcasses || "",
|
||||||
date: item?.date || moment().format("YYYY-MM-DD HH:mm:ss"),
|
date: item?.date || moment().format("YYYY-MM-DD HH:mm:ss"),
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -53,12 +53,12 @@ export const SlaughterSubmitOutProvinceSell = ({
|
|||||||
const payload = {
|
const payload = {
|
||||||
...values,
|
...values,
|
||||||
date: values.date,
|
date: values.date,
|
||||||
number_of_carcasses: values.carcassCount,
|
number_of_carcasses: values.number_of_carcasses,
|
||||||
weight_of_carcasses: values.carcassWeight,
|
weight_of_carcasses: values.weight_of_carcasses,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (values.quarantineCode !== item?.quarantineCode) {
|
if (values.clearance_code !== item?.clearanceCode) {
|
||||||
payload.quarantineCode = values.quarantineCode;
|
payload.clearance_code = values.clearance_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
const service = stewardKey
|
const service = stewardKey
|
||||||
@@ -123,24 +123,29 @@ export const SlaughterSubmitOutProvinceSell = ({
|
|||||||
<Grid item xs={12}>
|
<Grid item xs={12}>
|
||||||
<Field
|
<Field
|
||||||
as={TextField}
|
as={TextField}
|
||||||
name="quarantineCode"
|
name="clearance_code"
|
||||||
label="کد قرنطینه"
|
label="کد قرنطینه"
|
||||||
fullWidth
|
fullWidth
|
||||||
error={
|
error={
|
||||||
touched.quarantineCode && Boolean(errors.quarantineCode)
|
touched.clearance_code && Boolean(errors.clearance_code)
|
||||||
}
|
}
|
||||||
helperText={touched.quarantineCode && errors.quarantineCode}
|
helperText={touched.clearance_code && errors.clearance_code}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={12}>
|
<Grid item xs={12}>
|
||||||
<Field
|
<Field
|
||||||
as={TextField}
|
as={TextField}
|
||||||
name="carcassCount"
|
name="number_of_carcasses"
|
||||||
label="حجم لاشه"
|
label="حجم لاشه"
|
||||||
type="number"
|
type="number"
|
||||||
fullWidth
|
fullWidth
|
||||||
error={touched.carcassCount && Boolean(errors.carcassCount)}
|
error={
|
||||||
helperText={touched.carcassCount && errors.carcassCount}
|
touched.number_of_carcasses &&
|
||||||
|
Boolean(errors.number_of_carcasses)
|
||||||
|
}
|
||||||
|
helperText={
|
||||||
|
touched.number_of_carcasses && errors.number_of_carcasses
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={12}>
|
<Grid item xs={12}>
|
||||||
@@ -164,12 +169,17 @@ export const SlaughterSubmitOutProvinceSell = ({
|
|||||||
<Grid item xs={12}>
|
<Grid item xs={12}>
|
||||||
<Field
|
<Field
|
||||||
as={TextField}
|
as={TextField}
|
||||||
name="carcassWeight"
|
name="weight_of_carcasses"
|
||||||
label="وزن لاشه"
|
label="وزن لاشه"
|
||||||
type="number"
|
type="number"
|
||||||
fullWidth
|
fullWidth
|
||||||
error={touched.carcassWeight && Boolean(errors.carcassWeight)}
|
error={
|
||||||
helperText={touched.carcassWeight && errors.carcassWeight}
|
touched.weight_of_carcasses &&
|
||||||
|
Boolean(errors.weight_of_carcasses)
|
||||||
|
}
|
||||||
|
helperText={
|
||||||
|
touched.weight_of_carcasses && errors.weight_of_carcasses
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={12}>
|
<Grid item xs={12}>
|
||||||
|
|||||||
Reference in New Issue
Block a user