Fix: some issues like dispatch and wrong keys
This commit is contained in:
@@ -24,7 +24,7 @@ import { getRoleFromUrl } from "../../../utils/getRoleFromUrl";
|
|||||||
import { senfGetInventoryStockService } from "../services/senf-get-inventory-stock";
|
import { senfGetInventoryStockService } from "../services/senf-get-inventory-stock";
|
||||||
import { senfGetInventoryAllocatedService } from "../services/senf-get-inventory-allocated";
|
import { senfGetInventoryAllocatedService } from "../services/senf-get-inventory-allocated";
|
||||||
|
|
||||||
export const GuildReceiveBarOperation = ({ item }) => {
|
export const GuildReceiveBarOperation = ({ item, onSuccess }) => {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const [, , selectedDate1] = useContext(AppContext);
|
const [, , selectedDate1] = useContext(AppContext);
|
||||||
const [openNotif] = useContext(AppContext);
|
const [openNotif] = useContext(AppContext);
|
||||||
@@ -251,6 +251,7 @@ export const GuildReceiveBarOperation = ({ item }) => {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
onSuccess?.();
|
||||||
openNotif({
|
openNotif({
|
||||||
vertical: "top",
|
vertical: "top",
|
||||||
horizontal: "center",
|
horizontal: "center",
|
||||||
@@ -283,16 +284,30 @@ export const GuildReceiveBarOperation = ({ item }) => {
|
|||||||
severity: "error",
|
severity: "error",
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
dispatch(
|
if (getRoleFromUrl() === "senf") {
|
||||||
guildGetInventoryStockService({
|
dispatch(
|
||||||
date: selectedDate1,
|
senfGetInventoryStockService({
|
||||||
})
|
date: selectedDate1,
|
||||||
);
|
})
|
||||||
dispatch(
|
);
|
||||||
guildGetInventoryAllocatedService({
|
dispatch(
|
||||||
date: selectedDate1,
|
senfGetInventoryAllocatedService({
|
||||||
})
|
date: selectedDate1,
|
||||||
);
|
})
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
dispatch(
|
||||||
|
guildGetInventoryStockService({
|
||||||
|
date: selectedDate1,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
dispatch(
|
||||||
|
guildGetInventoryAllocatedService({
|
||||||
|
date: selectedDate1,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
onSuccess?.();
|
||||||
openNotif({
|
openNotif({
|
||||||
vertical: "top",
|
vertical: "top",
|
||||||
horizontal: "center",
|
horizontal: "center",
|
||||||
|
|||||||
@@ -155,6 +155,7 @@ export const StewardSegmentSubmitOperation = ({
|
|||||||
Object.entries(req).filter(([, val]) => val !== null)
|
Object.entries(req).filter(([, val]) => val !== null)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
req.role_key = selectedSubUser?.key;
|
||||||
|
|
||||||
dispatch(stewardSegmentSubmitService(req)).then((r) => {
|
dispatch(stewardSegmentSubmitService(req)).then((r) => {
|
||||||
if (r.payload.error) {
|
if (r.payload.error) {
|
||||||
|
|||||||
@@ -5,11 +5,13 @@ import { useLocation } from "react-router-dom";
|
|||||||
import {
|
import {
|
||||||
ROUTE_ADMINX_COMPANY_ROUTE_ACTIVE_SESSION,
|
ROUTE_ADMINX_COMPANY_ROUTE_ACTIVE_SESSION,
|
||||||
ROUTE_ADMINX_COMPANY_ROUTE_DEVICES,
|
ROUTE_ADMINX_COMPANY_ROUTE_DEVICES,
|
||||||
|
ROUTE_ADMINX_ROUTE_DEVICES_V2,
|
||||||
ROUTE_PSP_COMPANY_ROUTE_ACTIVE_SESSION,
|
ROUTE_PSP_COMPANY_ROUTE_ACTIVE_SESSION,
|
||||||
ROUTE_PSP_COMPANY_ROUTE_DEVICES,
|
ROUTE_PSP_COMPANY_ROUTE_DEVICES,
|
||||||
ROUTE_PSP_COMPANY_ROUTE_DEVICES_V2,
|
ROUTE_PSP_COMPANY_ROUTE_DEVICES_V2,
|
||||||
ROUTE_SUPER_ADMIN_COMPANY_ROUTE_ACTIVE_SESSION,
|
ROUTE_SUPER_ADMIN_COMPANY_ROUTE_ACTIVE_SESSION,
|
||||||
ROUTE_SUPER_ADMIN_COMPANY_ROUTE_DEVICES,
|
ROUTE_SUPER_ADMIN_COMPANY_ROUTE_DEVICES,
|
||||||
|
ROUTE_SUPER_ADMIN_ROUTE_DEVICES_V2,
|
||||||
// ROUTE_PSP_COMPANY_ROUTE_GUILDS,
|
// ROUTE_PSP_COMPANY_ROUTE_GUILDS,
|
||||||
} from "../../../../routes/routes";
|
} from "../../../../routes/routes";
|
||||||
import LinkItem from "../../../../components/link-item/LinkItem";
|
import LinkItem from "../../../../components/link-item/LinkItem";
|
||||||
@@ -28,14 +30,22 @@ export const PspOperations = () => {
|
|||||||
justifyContent="center"
|
justifyContent="center"
|
||||||
>
|
>
|
||||||
<NavLink
|
<NavLink
|
||||||
to={ROUTE_PSP_COMPANY_ROUTE_DEVICES_V2}
|
to={
|
||||||
|
getRoleFromUrl() === "PosCompany"
|
||||||
|
? ROUTE_PSP_COMPANY_ROUTE_DEVICES_V2
|
||||||
|
: getRoleFromUrl() === "SuperAdmin"
|
||||||
|
? ROUTE_SUPER_ADMIN_ROUTE_DEVICES_V2
|
||||||
|
: getRoleFromUrl() === "AdminX"
|
||||||
|
? ROUTE_ADMINX_ROUTE_DEVICES_V2
|
||||||
|
: null
|
||||||
|
}
|
||||||
active={
|
active={
|
||||||
getRoleFromUrl() === "PosCompany"
|
getRoleFromUrl() === "PosCompany"
|
||||||
? pathname === ROUTE_PSP_COMPANY_ROUTE_DEVICES
|
? pathname === ROUTE_PSP_COMPANY_ROUTE_DEVICES_V2
|
||||||
: getRoleFromUrl() === "SuperAdmin"
|
: getRoleFromUrl() === "SuperAdmin"
|
||||||
? pathname === ROUTE_SUPER_ADMIN_COMPANY_ROUTE_DEVICES
|
? pathname === ROUTE_SUPER_ADMIN_ROUTE_DEVICES_V2
|
||||||
: getRoleFromUrl() === "AdminX"
|
: getRoleFromUrl() === "AdminX"
|
||||||
? pathname === ROUTE_ADMINX_COMPANY_ROUTE_DEVICES
|
? pathname === ROUTE_ADMINX_ROUTE_DEVICES_V2
|
||||||
: null
|
: null
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -36,12 +36,13 @@ export const SenfStock = () => {
|
|||||||
const selectedSubUser = useSelector(
|
const selectedSubUser = useSelector(
|
||||||
(state) => state.userSlice.selectedSubUser
|
(state) => state.userSlice.selectedSubUser
|
||||||
);
|
);
|
||||||
useEffect(() => {
|
|
||||||
|
const handleRefreshServices = () => {
|
||||||
dispatch(
|
dispatch(
|
||||||
senfGetAllocationDashboardService({
|
senfGetAllocationDashboardService({
|
||||||
date1: selectedDate1,
|
date1: selectedDate1,
|
||||||
date2: selectedDate2,
|
date2: selectedDate2,
|
||||||
role_key: checkPathStartsWith("senf") ? selectedSubUser?.key : "",
|
role_key: selectedSubUser?.key || "",
|
||||||
search: text,
|
search: text,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
@@ -49,17 +50,21 @@ export const SenfStock = () => {
|
|||||||
senfGetInventoryAllocatedService({
|
senfGetInventoryAllocatedService({
|
||||||
date1: selectedDate1,
|
date1: selectedDate1,
|
||||||
date2: selectedDate2,
|
date2: selectedDate2,
|
||||||
role_key: checkPathStartsWith("senf") ? selectedSubUser?.key : "",
|
role_key: selectedSubUser?.key || "",
|
||||||
type: statusTab,
|
type: statusTab,
|
||||||
search: text,
|
search: text,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
dispatch(
|
dispatch(
|
||||||
guildSalesInfoDashboardService({
|
guildSalesInfoDashboardService({
|
||||||
role_key: checkPathStartsWith("senf") ? selectedSubUser?.key : "",
|
role_key: selectedSubUser?.key,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}, [selectedDate1, selectedDate2, selectedSubUser?.key, statusTab, dispatch]);
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
handleRefreshServices();
|
||||||
|
}, [selectedDate1, selectedDate2, selectedSubUser?.key, statusTab]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const items = senfGetInventoryAllocated?.results || [];
|
const items = senfGetInventoryAllocated?.results || [];
|
||||||
@@ -93,19 +98,16 @@ export const SenfStock = () => {
|
|||||||
`${sellerRoleFa} ${sellerName} (${sellerMobile})`,
|
`${sellerRoleFa} ${sellerName} (${sellerMobile})`,
|
||||||
formatJustDate(item.date),
|
formatJustDate(item.date),
|
||||||
(item?.weightOfCarcasses || 0).toLocaleString() + " کیلوگرم",
|
(item?.weightOfCarcasses || 0).toLocaleString() + " کیلوگرم",
|
||||||
|
item?.quota === "free" ? "آزاد" : "دولتی",
|
||||||
<Grid container direction="column" key={item.key}>
|
<Grid container direction="column" key={item.key}>
|
||||||
{item?.receiverRealNumberOfCarcasses && (
|
{/* <Typography variant="caption">
|
||||||
<>
|
{item?.receiverRealNumberOfCarcasses?.toLocaleString() + " قطعه"}
|
||||||
<Typography variant="caption">
|
</Typography> */}
|
||||||
{item?.receiverRealNumberOfCarcasses?.toLocaleString() +
|
<Typography variant="caption">
|
||||||
" قطعه"}
|
{item?.receiverRealWeightOfCarcasses?.toLocaleString() +
|
||||||
</Typography>
|
" کیلوگرم"}
|
||||||
<Typography variant="caption">
|
</Typography>
|
||||||
{item?.receiverRealWeightOfCarcasses?.toLocaleString() +
|
|
||||||
" کیلوگرم"}
|
|
||||||
</Typography>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
{/* {item?.receiverState === "pending" && (
|
{/* {item?.receiverState === "pending" && (
|
||||||
<Grid>
|
<Grid>
|
||||||
<Button
|
<Button
|
||||||
@@ -132,7 +134,12 @@ export const SenfStock = () => {
|
|||||||
dispatch(
|
dispatch(
|
||||||
OPEN_MODAL({
|
OPEN_MODAL({
|
||||||
title: "ثبت تحویل بار",
|
title: "ثبت تحویل بار",
|
||||||
content: <GuildReceiveBarOperation item={item} />,
|
content: (
|
||||||
|
<GuildReceiveBarOperation
|
||||||
|
item={item}
|
||||||
|
onSuccess={handleRefreshServices}
|
||||||
|
/>
|
||||||
|
),
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
@@ -208,7 +215,7 @@ export const SenfStock = () => {
|
|||||||
(
|
(
|
||||||
guildSalesInfoDashboard?.totalFreeOutputWeight || 0
|
guildSalesInfoDashboard?.totalFreeOutputWeight || 0
|
||||||
).toLocaleString(),
|
).toLocaleString(),
|
||||||
"0",
|
guildSalesInfoDashboard?.segmentationsWeight || "0",
|
||||||
"0",
|
"0",
|
||||||
(
|
(
|
||||||
guildSalesInfoDashboard?.totalGovernmentalRemainWeight || 0
|
guildSalesInfoDashboard?.totalGovernmentalRemainWeight || 0
|
||||||
@@ -317,14 +324,16 @@ export const SenfStock = () => {
|
|||||||
"فروشنده",
|
"فروشنده",
|
||||||
"تاریخ تخصیص",
|
"تاریخ تخصیص",
|
||||||
"وزن تخصیص",
|
"وزن تخصیص",
|
||||||
"تعداد/وزن واقعی تحویلی",
|
"نوع فروش",
|
||||||
|
"وزن واقعی تحویلی",
|
||||||
]
|
]
|
||||||
: [
|
: [
|
||||||
"ردیف",
|
"ردیف",
|
||||||
"فروشنده",
|
"فروشنده",
|
||||||
"تاریخ تخصیص",
|
"تاریخ تخصیص",
|
||||||
"وزن تخصیص",
|
"وزن تخصیص",
|
||||||
"تعداد/وزن واقعی تحویلی",
|
"نوع فروش",
|
||||||
|
"وزن واقعی تحویلی",
|
||||||
"عملیات",
|
"عملیات",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -504,6 +504,7 @@ export const SlaughterManageDispensersForm = ({
|
|||||||
city: values.city || currentUserInfo?.city || "",
|
city: values.city || currentUserInfo?.city || "",
|
||||||
mobile: values.mobile,
|
mobile: values.mobile,
|
||||||
role: getRoleFromUrl(),
|
role: getRoleFromUrl(),
|
||||||
|
role_key: selectedSubUser?.key || "",
|
||||||
};
|
};
|
||||||
|
|
||||||
if (dispenser?.key) {
|
if (dispenser?.key) {
|
||||||
|
|||||||
@@ -14,14 +14,14 @@ import {
|
|||||||
ROUTE_ADMINX_ROUTE_OUT_PROVINCE_TRUE_GUILDS,
|
ROUTE_ADMINX_ROUTE_OUT_PROVINCE_TRUE_GUILDS,
|
||||||
ROUTE_SLAUGHTER_INVENTORY_SELL_CARCASS_OUT_PROVINCE,
|
ROUTE_SLAUGHTER_INVENTORY_SELL_CARCASS_OUT_PROVINCE,
|
||||||
ROUTE_SLAUGHTER_MANAGE_GUILDS_OUT_PROVINCE_TRUE,
|
ROUTE_SLAUGHTER_MANAGE_GUILDS_OUT_PROVINCE_TRUE,
|
||||||
ROUTE_STEWARD_SALE_OUT_PROVINCE
|
ROUTE_STEWARD_SALE_OUT_PROVINCE,
|
||||||
} from "../../../../routes/routes";
|
} from "../../../../routes/routes";
|
||||||
import {
|
import {
|
||||||
handleSetFormDataFromTableDataForStewardAddBuyer,
|
handleSetFormDataFromTableDataForStewardAddBuyer,
|
||||||
handleSubmitForStewardAddBuyer,
|
handleSubmitForStewardAddBuyer,
|
||||||
InquiryForStewardAddBuyer,
|
InquiryForStewardAddBuyer,
|
||||||
StewardAddBuyerForm,
|
StewardAddBuyerForm,
|
||||||
validationSchemaForStewardAddBuyer
|
validationSchemaForStewardAddBuyer,
|
||||||
} from "./InquiryForStewardAddBuyer";
|
} from "./InquiryForStewardAddBuyer";
|
||||||
import { useAddBuyer } from "./hooks/useAddBuyer";
|
import { useAddBuyer } from "./hooks/useAddBuyer";
|
||||||
import { slaughterGetCitiesService } from "../../../slaughter-house/services/slaughter-get-provinces";
|
import { slaughterGetCitiesService } from "../../../slaughter-house/services/slaughter-get-provinces";
|
||||||
@@ -30,7 +30,7 @@ import {
|
|||||||
handleSubmitForSlaughterAddBuyer,
|
handleSubmitForSlaughterAddBuyer,
|
||||||
InquiryForSlaughterAddBuyer,
|
InquiryForSlaughterAddBuyer,
|
||||||
SlaughterAddBuyerForm,
|
SlaughterAddBuyerForm,
|
||||||
validationSchemaForSlaughterAddBuyer
|
validationSchemaForSlaughterAddBuyer,
|
||||||
} from "./InquiryForSlaughterAddBuyer";
|
} from "./InquiryForSlaughterAddBuyer";
|
||||||
import { useFormik } from "formik";
|
import { useFormik } from "formik";
|
||||||
import {
|
import {
|
||||||
@@ -38,7 +38,7 @@ import {
|
|||||||
handleSetFormDataFromTableDataForAdminAddBuyer,
|
handleSetFormDataFromTableDataForAdminAddBuyer,
|
||||||
handleSubmitForAdminAddBuyer,
|
handleSubmitForAdminAddBuyer,
|
||||||
InquiryForAdminAddBuyer,
|
InquiryForAdminAddBuyer,
|
||||||
validationSchemaForAdminAddBuyer
|
validationSchemaForAdminAddBuyer,
|
||||||
} from "./InquiryForAdminAddBuyer";
|
} from "./InquiryForAdminAddBuyer";
|
||||||
import { inspectorGetKillHousesService } from "../../../inspector/services/inspector-get-kill-houses";
|
import { inspectorGetKillHousesService } from "../../../inspector/services/inspector-get-kill-houses";
|
||||||
import { slaughterGetStewardsForAllocateService } from "../../../slaughter-house/services/slaughter-get-guilds-for-allocate";
|
import { slaughterGetStewardsForAllocateService } from "../../../slaughter-house/services/slaughter-get-guilds-for-allocate";
|
||||||
@@ -64,7 +64,7 @@ const getCurrentPage = (role, pathname) => {
|
|||||||
ROUTE_ADMINX_ROUTE_OUT_PROVINCE_TRUE_GUILDS,
|
ROUTE_ADMINX_ROUTE_OUT_PROVINCE_TRUE_GUILDS,
|
||||||
ROUTE_ADMINX_ROUTE_OUT_PROVINCE_LEGAL_GUILDS,
|
ROUTE_ADMINX_ROUTE_OUT_PROVINCE_LEGAL_GUILDS,
|
||||||
ROUTE_ADMINX_ROUTE_MANAGE_STEWARDS_OUT_PROVINCE_LEGAL,
|
ROUTE_ADMINX_ROUTE_MANAGE_STEWARDS_OUT_PROVINCE_LEGAL,
|
||||||
ROUTE_ADMINX_ROUTE_MANAGE_STEWARDS_OUT_PROVINCE_TRUE
|
ROUTE_ADMINX_ROUTE_MANAGE_STEWARDS_OUT_PROVINCE_TRUE,
|
||||||
];
|
];
|
||||||
if (routes.some((r) => r === pathname)) {
|
if (routes.some((r) => r === pathname)) {
|
||||||
return "admin_add_buyer";
|
return "admin_add_buyer";
|
||||||
@@ -79,20 +79,20 @@ const getInitialValues = (page) => {
|
|||||||
lastName: "",
|
lastName: "",
|
||||||
unit_name: "",
|
unit_name: "",
|
||||||
province: "",
|
province: "",
|
||||||
city: ""
|
city: "",
|
||||||
};
|
};
|
||||||
if (page === "steward_add_buyer" || page === "slaughter_manage_add_buyer") {
|
if (page === "steward_add_buyer" || page === "slaughter_manage_add_buyer") {
|
||||||
return initialValues;
|
return initialValues;
|
||||||
} else if (page === "slaughter_add_buyer") {
|
} else if (page === "slaughter_add_buyer") {
|
||||||
return {
|
return {
|
||||||
...initialValues,
|
...initialValues,
|
||||||
nationalId: ""
|
nationalId: "",
|
||||||
};
|
};
|
||||||
} else if (page === "admin_add_buyer") {
|
} else if (page === "admin_add_buyer") {
|
||||||
return {
|
return {
|
||||||
...initialValues,
|
...initialValues,
|
||||||
role_key: "",
|
role_key: "",
|
||||||
type: ""
|
type: "",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return initialValues;
|
return initialValues;
|
||||||
@@ -103,7 +103,7 @@ export const StewardAddBuyer = ({
|
|||||||
isEdit = false,
|
isEdit = false,
|
||||||
data,
|
data,
|
||||||
isRealPerson,
|
isRealPerson,
|
||||||
buyerType = ""
|
buyerType = "",
|
||||||
// buyerYype => "Guilds" | "Steward"
|
// buyerYype => "Guilds" | "Steward"
|
||||||
}) => {
|
}) => {
|
||||||
const role = getRoleFromUrl();
|
const role = getRoleFromUrl();
|
||||||
@@ -124,7 +124,7 @@ export const StewardAddBuyer = ({
|
|||||||
cityData,
|
cityData,
|
||||||
setCityData,
|
setCityData,
|
||||||
userData,
|
userData,
|
||||||
setUserData
|
setUserData,
|
||||||
} = useAddBuyer(page);
|
} = useAddBuyer(page);
|
||||||
|
|
||||||
const { selectedSubUser } = useSelector((state) => state.userSlice);
|
const { selectedSubUser } = useSelector((state) => state.userSlice);
|
||||||
@@ -141,7 +141,7 @@ export const StewardAddBuyer = ({
|
|||||||
? validationSchemaForSlaughterAddBuyer(isRealPerson, isEdit)
|
? validationSchemaForSlaughterAddBuyer(isRealPerson, isEdit)
|
||||||
: IS_ADMIN_ADD_BUYER
|
: IS_ADMIN_ADD_BUYER
|
||||||
? validationSchemaForAdminAddBuyer(isRealPerson, isEdit)
|
? validationSchemaForAdminAddBuyer(isRealPerson, isEdit)
|
||||||
: Yup.object({})
|
: Yup.object({}),
|
||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -157,7 +157,7 @@ export const StewardAddBuyer = ({
|
|||||||
} else {
|
} else {
|
||||||
dispatch(
|
dispatch(
|
||||||
slaughterGetStewardsForAllocateService({
|
slaughterGetStewardsForAllocateService({
|
||||||
free: true
|
free: true,
|
||||||
})
|
})
|
||||||
).then((r) => {
|
).then((r) => {
|
||||||
setStewards(r.payload.data || []);
|
setStewards(r.payload.data || []);
|
||||||
|
|||||||
@@ -314,6 +314,7 @@ export const StewardSellOutOfProvinceSubmitSell = ({
|
|||||||
dispatch(
|
dispatch(
|
||||||
stewardSellOuutSubmitSell({
|
stewardSellOuutSubmitSell({
|
||||||
buyer_key: buyerSelected,
|
buyer_key: buyerSelected,
|
||||||
|
role_key: selectedSubUser?.key,
|
||||||
number_of_carcasses:
|
number_of_carcasses:
|
||||||
Math.round(
|
Math.round(
|
||||||
values?.weight_of_carcasses / productKey?.weightAverage
|
values?.weight_of_carcasses / productKey?.weightAverage
|
||||||
|
|||||||
@@ -9,11 +9,11 @@ import {
|
|||||||
} from "@mui/material";
|
} from "@mui/material";
|
||||||
import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
|
import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
|
||||||
import { stewardGetBarsInfo } from "../../services/steward-get-bars-info";
|
import { stewardGetBarsInfo } from "../../services/steward-get-bars-info";
|
||||||
|
import { fetchStewardBroadcastAndProducts } from "../../services/handle-fetch-steward-products";
|
||||||
import { Grid } from "../../../../components/grid/Grid";
|
import { Grid } from "../../../../components/grid/Grid";
|
||||||
import { StewardShowProducts } from "../steward-show-products/StewardShowProducts";
|
import { StewardShowProducts } from "../steward-show-products/StewardShowProducts";
|
||||||
import ResponsiveTable from "../../../../components/responsive-table/ResponsiveTable";
|
import ResponsiveTable from "../../../../components/responsive-table/ResponsiveTable";
|
||||||
import { StewardShowAllocations } from "../steward-show-allocations/StewardShowAllocations";
|
import { StewardShowAllocations } from "../steward-show-allocations/StewardShowAllocations";
|
||||||
import { checkPathStartsWith } from "../../../../utils/checkPathStartsWith";
|
|
||||||
|
|
||||||
export const StewardStock = () => {
|
export const StewardStock = () => {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
@@ -27,12 +27,18 @@ export const StewardStock = () => {
|
|||||||
const handleUpdate = () => {
|
const handleUpdate = () => {
|
||||||
dispatch(
|
dispatch(
|
||||||
stewardGetBarsInfo({
|
stewardGetBarsInfo({
|
||||||
role_key: checkPathStartsWith("steward") ? selectedSubUser?.key : "",
|
role_key: selectedSubUser?.key || "",
|
||||||
})
|
})
|
||||||
).then((r) => {
|
).then((r) => {
|
||||||
setBarsInfo(r.payload.data);
|
setBarsInfo(r.payload.data);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
dispatch(
|
||||||
|
fetchStewardBroadcastAndProducts({
|
||||||
|
role_key: selectedSubUser?.key || "",
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
if (notEnteredRef.current) {
|
if (notEnteredRef.current) {
|
||||||
notEnteredRef.current.updateTable();
|
notEnteredRef.current.updateTable();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ import { StewardStock } from "../features/steward/components/steward-stock/Stewa
|
|||||||
import { StewardPurchaseOutProvince } from "../features/steward/components/steward-purchase-out-province/StewardPurchaseOutProvince";
|
import { StewardPurchaseOutProvince } from "../features/steward/components/steward-purchase-out-province/StewardPurchaseOutProvince";
|
||||||
import { StewardSellOutOfProvince } from "../features/steward/components/steward-sell-out-of-province/StewardSellOutOfProvince";
|
import { StewardSellOutOfProvince } from "../features/steward/components/steward-sell-out-of-province/StewardSellOutOfProvince";
|
||||||
import { StewardSellInProvince } from "../features/steward/components/steward-sell-in-province/StewardSellInProvince";
|
import { StewardSellInProvince } from "../features/steward/components/steward-sell-in-province/StewardSellInProvince";
|
||||||
import { checkPathStartsWith } from "../utils/checkPathStartsWith";
|
|
||||||
|
|
||||||
const StewardInventoryPage = () => {
|
const StewardInventoryPage = () => {
|
||||||
const { pathname } = useLocation();
|
const { pathname } = useLocation();
|
||||||
@@ -44,11 +43,11 @@ const StewardInventoryPage = () => {
|
|||||||
) {
|
) {
|
||||||
dispatch(
|
dispatch(
|
||||||
fetchStewardBroadcastAndProducts({
|
fetchStewardBroadcastAndProducts({
|
||||||
role_key: checkPathStartsWith("steward") ? selectedSubUser?.key : "",
|
role_key: selectedSubUser?.key || "",
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}, [dispatch, pathname, selectedSubUser?.key]);
|
}, [pathname, selectedSubUser?.key]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|||||||
@@ -188,6 +188,12 @@ const ManageStewards = lazy(() =>
|
|||||||
lazyRetry(() => import("../pages/ProvinceManageStewards"))
|
lazyRetry(() => import("../pages/ProvinceManageStewards"))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const PspDevicesV2 = lazy(() =>
|
||||||
|
lazyRetry(() =>
|
||||||
|
import("../features/psp-company/components/psp-devices-v2/PspDevicesV2")
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
const consolidatedRouting = [
|
const consolidatedRouting = [
|
||||||
{
|
{
|
||||||
path: [ROUTES.ROUTE_ADMINX_BASE_NEW_HOME],
|
path: [ROUTES.ROUTE_ADMINX_BASE_NEW_HOME],
|
||||||
@@ -981,6 +987,15 @@ const consolidatedRouting = [
|
|||||||
exact: false,
|
exact: false,
|
||||||
props: {},
|
props: {},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: [
|
||||||
|
ROUTES.ROUTE_SUPER_ADMIN_ROUTE_DEVICES_V2,
|
||||||
|
ROUTES.ROUTE_ADMINX_ROUTE_DEVICES_V2,
|
||||||
|
],
|
||||||
|
Page: PspDevicesV2,
|
||||||
|
exact: false,
|
||||||
|
props: {},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: [
|
path: [
|
||||||
ROUTES.ROUTE_ADMINX_POULTRIES_DETAILS,
|
ROUTES.ROUTE_ADMINX_POULTRIES_DETAILS,
|
||||||
|
|||||||
@@ -1365,7 +1365,8 @@ export const ROUTE_SUPER_ADMIN_COMPANY_ROUTE_ACTIVE_SESSION =
|
|||||||
ROUTE_SUPER_ADMIN_BASE + "/active-session/session";
|
ROUTE_SUPER_ADMIN_BASE + "/active-session/session";
|
||||||
export const ROUTE_SUPER_ADMIN_COMPANY_ROUTE_DEVICES =
|
export const ROUTE_SUPER_ADMIN_COMPANY_ROUTE_DEVICES =
|
||||||
ROUTE_SUPER_ADMIN_BASE + "/devices";
|
ROUTE_SUPER_ADMIN_BASE + "/devices";
|
||||||
|
export const ROUTE_SUPER_ADMIN_ROUTE_DEVICES_V2 =
|
||||||
|
ROUTE_SUPER_ADMIN_BASE + "/devices-v2";
|
||||||
export const ROUTE_SUPER_ADMIN_ROUTE_INSPECTION =
|
export const ROUTE_SUPER_ADMIN_ROUTE_INSPECTION =
|
||||||
ROUTE_SUPER_ADMIN_BASE + "/inspection";
|
ROUTE_SUPER_ADMIN_BASE + "/inspection";
|
||||||
|
|
||||||
@@ -1687,7 +1688,7 @@ export const ROUTE_ADMINX_COMPANY_ROUTE_ACTIVE_SESSION =
|
|||||||
ROUTE_ADMINX_BASE + "/active-session/session";
|
ROUTE_ADMINX_BASE + "/active-session/session";
|
||||||
export const ROUTE_ADMINX_COMPANY_ROUTE_DEVICES =
|
export const ROUTE_ADMINX_COMPANY_ROUTE_DEVICES =
|
||||||
ROUTE_ADMINX_BASE + "/devices";
|
ROUTE_ADMINX_BASE + "/devices";
|
||||||
|
export const ROUTE_ADMINX_ROUTE_DEVICES_V2 = ROUTE_ADMINX_BASE + "/devices-v2";
|
||||||
export const ROUTE_ADMINX_ROUTE_INSPECTION = ROUTE_ADMINX_BASE + "/inspection";
|
export const ROUTE_ADMINX_ROUTE_INSPECTION = ROUTE_ADMINX_BASE + "/inspection";
|
||||||
|
|
||||||
// Supporter
|
// Supporter
|
||||||
|
|||||||
Reference in New Issue
Block a user