main
This commit is contained in:
@@ -12,7 +12,7 @@ import {
|
||||
import { checkRequestBySlaughter } from "../../services/checkRequestBySlaughter";
|
||||
import { useFormik } from "formik";
|
||||
import { Yup } from "../../../../lib/yup/yup";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { PropTypes } from "prop-types";
|
||||
import { getAllocationInformation } from "../../services/get-allocation-information";
|
||||
import { Grid } from "../../../../components/grid/Grid";
|
||||
@@ -22,16 +22,13 @@ import { useContext } from "react";
|
||||
import { AppContext } from "../../../../contexts/AppContext";
|
||||
import { getRoleFromUrl } from "../../../../utils/getRoleFromUrl";
|
||||
import { slaughterGetActiveRequests } from "../../../slaughter-house/services/slaughter-get-active-requests";
|
||||
import { checkPathStartsWith } from "../../../../utils/checkPathStartsWith";
|
||||
|
||||
export default function CheckRequestItem({ reqKey, poultryRequestKey }) {
|
||||
const [openNotif] = useContext(AppContext);
|
||||
const [isDenyed, setisDenyed] = useState(false);
|
||||
const dispatch = useDispatch();
|
||||
const { id } = useParams();
|
||||
const selectedSubUser = useSelector(
|
||||
(state) => state.userSlice.selectedSubUser
|
||||
);
|
||||
|
||||
const [, , selectedDate1, , selectedDate2] = useContext(AppContext);
|
||||
|
||||
const formik = useFormik({
|
||||
@@ -134,30 +131,17 @@ export default function CheckRequestItem({ reqKey, poultryRequestKey }) {
|
||||
})
|
||||
);
|
||||
// getFileFromApi(roles, id, dispatch);
|
||||
dispatch(
|
||||
getAcceptedSlaughterRequest({
|
||||
id,
|
||||
role_key: checkPathStartsWith("slaughter")
|
||||
? selectedSubUser?.key || ""
|
||||
: "",
|
||||
})
|
||||
);
|
||||
dispatch(getAcceptedSlaughterRequest({ id }));
|
||||
setisDenyed(false);
|
||||
dispatch(
|
||||
getAllocationInformation({
|
||||
key: poultryRequestKey,
|
||||
role_key: checkPathStartsWith("slaughter")
|
||||
? selectedSubUser?.key || ""
|
||||
: "",
|
||||
})
|
||||
);
|
||||
dispatch(
|
||||
slaughterGetActiveRequests({
|
||||
selectedDate1,
|
||||
selectedDate2,
|
||||
role_key: checkPathStartsWith("slaughter")
|
||||
? selectedSubUser?.key || ""
|
||||
: "",
|
||||
})
|
||||
);
|
||||
openNotif({
|
||||
@@ -215,29 +199,14 @@ export default function CheckRequestItem({ reqKey, poultryRequestKey }) {
|
||||
content: null,
|
||||
})
|
||||
);
|
||||
dispatch(getAcceptedSlaughterRequest({ id }));
|
||||
dispatch(
|
||||
getAcceptedSlaughterRequest({
|
||||
id,
|
||||
role_key: checkPathStartsWith("slaughter")
|
||||
? selectedSubUser?.key || ""
|
||||
: "",
|
||||
})
|
||||
);
|
||||
dispatch(
|
||||
getAllocationInformation({
|
||||
key: poultryRequestKey,
|
||||
role_key: checkPathStartsWith("slaughter")
|
||||
? selectedSubUser?.key || ""
|
||||
: "",
|
||||
})
|
||||
getAllocationInformation({ key: poultryRequestKey })
|
||||
);
|
||||
dispatch(
|
||||
slaughterGetActiveRequests({
|
||||
selectedDate1,
|
||||
selectedDate2,
|
||||
role_key: checkPathStartsWith("slaughter")
|
||||
? selectedSubUser?.key || ""
|
||||
: "",
|
||||
})
|
||||
);
|
||||
openNotif({
|
||||
|
||||
Reference in New Issue
Block a user