some changes

This commit is contained in:
2026-01-19 15:18:50 +03:30
parent 4fe6e70525
commit 5b251732a9
12 changed files with 275 additions and 46 deletions

View File

@@ -39,6 +39,7 @@ import FilterAltIcon from "@mui/icons-material/FilterAlt";
import { provincePolicyGetWeightRange } from "../../../province/services/province-policy-get-weight-range";
import { isValidIndexWeight } from "../../../../utils/isValidIndexWeight";
import { checkPathStartsWith } from "../../../../utils/checkPathStartsWith";
import { provinceGetSellForFreezingStatus } from "../../../province/services/province-get-sell-for-freezing-status";
export const SlaughterSubmitFreeBuy = ({ edit, updateTable }) => {
const dispatch = useDispatch();
@@ -48,6 +49,7 @@ export const SlaughterSubmitFreeBuy = ({ edit, updateTable }) => {
const [selectedAge2, setSelectedAge2] = useState(1);
const [showSearchFields, setShowSearchFields] = useState(false);
const [editPoultry, setEditPoultry] = useState(false);
const [sellForFreezing, setSellForFreezing] = useState(false);
const selectedSubUser = useSelector(
(state) => state.userSlice.selectedSubUser
);
@@ -110,6 +112,9 @@ export const SlaughterSubmitFreeBuy = ({ edit, updateTable }) => {
: "",
})
);
dispatch(provinceGetSellForFreezingStatus()).then((r) => {
setSellForFreezing(r.payload.data.permission);
});
fetchData();
}, [selectedSubUser?.key]);
@@ -130,6 +135,7 @@ export const SlaughterSubmitFreeBuy = ({ edit, updateTable }) => {
poultryPrice: edit ? edit.amount : 0,
hatching_key: edit?.poultryHatching?.key || null,
paymentDeadlineDays: edit?.paymentDeadlineDays?.key,
freezing: false,
};
const onSubmit = (values) => {
if (!paymentDeadlineDays && values.paymentDeadlineDays === 0) {
@@ -165,6 +171,7 @@ export const SlaughterSubmitFreeBuy = ({ edit, updateTable }) => {
chicken_breed: selectedPolutry?.chickenBreed,
cash: true,
credit: false,
freezing: values.freezing,
sms_payment: false,
kill_house_key: values.killhouse,
killer_kill_house_key: values.killerPlace ? values.killerPlace : null,
@@ -1049,6 +1056,15 @@ export const SlaughterSubmitFreeBuy = ({ edit, updateTable }) => {
/>
</Grid>
)}
{sellForFreezing && (
<Typography variant="body2">
<Checkbox
id="freezing"
onChange={formik.handleChange}
/>
انجماد
</Typography>
)}
{!edit && (
<Button