fixed slaughter manage guilds

This commit is contained in:
2026-01-27 10:55:17 +03:30
parent 66d71c9c25
commit d76c057f15
10 changed files with 180 additions and 103 deletions

View File

@@ -11,6 +11,7 @@ import {
ROUTE_PROVINCE_ROUTE_IN_PROVINCE_GUILDS_REQUESTS,
ROUTE_PROVINCE_ROUTE_IN_PROVINCE_GUILDS,
ROUTE_PROVINCE_ROUTE_MANAGE_GUILDS,
ROUTE_SLAUGHTER_ROUTE_MANAGE_GUILDS,
ROUTE_PROVINCE_ROUTE_OUT_PROVINCE_GUILDS,
// ROUTE_SUPER_ADMIN_ROUTE_GUILDS,
ROUTE_SUPER_ADMIN_ROUTE_IN_PROVINCE_GUILDS_REQUESTS,
@@ -40,15 +41,7 @@ export const GuildsOperations = () => {
return (
<>
{[
ROUTE_SUPER_ADMIN_ROUTE_IN_PROVINCE_GUILDS,
ROUTE_ADMINX_ROUTE_IN_PROVINCE_GUILDS,
ROUTE_PROVINCE_ROUTE_IN_PROVINCE_GUILDS,
ROUTE_SUPER_ADMIN_ROUTE_OUT_PROVINCE_GUILDS,
ROUTE_ADMINX_ROUTE_OUT_PROVINCE_GUILDS,
ROUTE_PROVINCE_ROUTE_OUT_PROVINCE_GUILDS,
].includes(pathname) && <BackButton />}
<BackButton />
<Grid
container
gap={SPACING.SMALL}
@@ -61,6 +54,7 @@ export const GuildsOperations = () => {
ROUTE_SUPER_ADMIN_ROUTE_MANAGE_GUILDS,
ROUTE_ADMINX_ROUTE_MANAGE_GUILDS,
ROUTE_PROVINCE_ROUTE_MANAGE_GUILDS,
ROUTE_SLAUGHTER_ROUTE_MANAGE_GUILDS,
].includes(pathname) && (
<>
<NavLink

View File

@@ -2,6 +2,7 @@ import React, { useEffect, useState } from "react";
import { Button, TextField } from "@mui/material";
import ResponsiveTable from "../../../../components/responsive-table/ResponsiveTable";
import {
DRAWER,
LOADING_END,
LOADING_START,
} from "../../../../lib/redux/slices/appSlice";
@@ -11,6 +12,7 @@ import { useDispatch } from "react-redux";
import { RiSearchLine } from "react-icons/ri";
import { fetchOutProvinceLegalBuyers } from "../../services/province-out-province-buyers";
import { ProvinceTrueGuildsOutProvinceOperations } from "../province-true-guilds-out-province/ProvinceTrueGuildsOutProvinceOperations";
import { SlaughterSellCarcassOutProvinceAddBuyer } from "../../../slaughter-house/components/slaughter-sell-carcass-out-province-add-buyer/SlaughterSellCarcassOutProvinceAddBuyer";
export const ProvinceLegalGuildsOutProvince = ({ userType }) => {
const IS_STEWARD = userType === "steward";
@@ -109,6 +111,31 @@ export const ProvinceLegalGuildsOutProvince = ({ userType }) => {
alignItems="center"
gap={2}
>
<Button
variant="contained"
onClick={() => {
dispatch(
DRAWER({
right: !(window.innerWidth <= 600),
bottom: window.innerWidth <= 600,
size: 340,
content: (
<SlaughterSellCarcassOutProvinceAddBuyer
updateTable={() => {
setPage(1);
fetchApiData(1);
}}
defaultPersonType={"legal"}
userType={userType}
/>
),
title: `افزودن ${IS_STEWARD ? "مباشر" : "صنف"} خارج از استان`,
})
);
}}
>
{`افزودن ${IS_STEWARD ? "مباشر" : "صنف"}`}
</Button>
<Grid>
<form onSubmit={handleSubmit}>
<TextField

View File

@@ -87,11 +87,11 @@ export const ReturnedCargo = ({
state,
item?.car?.pelak || "-",
item?.car?.driverName || "-",
item?.nonReceipt ? "دارد" : "ندارد",
item?.nonReceiptMessage || "-",
item?.clearanceCode || "-",
(item?.nonReceipt && item?.mainNonReceipt ? `کاربر` : "سیستم") +
" " +
formatTime(item?.modifyDate),
item?.nonReceiptMessage || "-",
];
if (["AdminX", "SuperAdmin"].includes(getRoleFromUrl())) {
@@ -137,9 +137,9 @@ export const ReturnedCargo = ({
"وضعیت تایید",
"پلاک خودرو",
"نام راننده",
"عدم دریافت",
"پیام عدم دریافت",
"کدرهگیری سامانه قرنطینه",
"نوع برگشت",
"پیام عدم دریافت",
];
if (["AdminX", "SuperAdmin"].includes(getRoleFromUrl())) {

View File

@@ -2,6 +2,7 @@ import React, { useEffect, useState } from "react";
import { Button, TextField } from "@mui/material";
import ResponsiveTable from "../../../../components/responsive-table/ResponsiveTable";
import {
DRAWER,
LOADING_END,
LOADING_START,
} from "../../../../lib/redux/slices/appSlice";
@@ -11,6 +12,8 @@ import { useDispatch } from "react-redux";
import { RiSearchLine } from "react-icons/ri";
import { fetchOutProvinceRealBuyers } from "../../services/province-out-province-buyers";
import { ProvinceTrueGuildsOutProvinceOperations } from "./ProvinceTrueGuildsOutProvinceOperations";
import { SlaughterSellCarcassOutProvinceAddBuyer } from "../../../slaughter-house/components/slaughter-sell-carcass-out-province-add-buyer/SlaughterSellCarcassOutProvinceAddBuyer";
import { SPACING } from "../../../../data/spacing";
export const ProvinceTrueGuildsOutProvince = ({ userType }) => {
const IS_STEWARD = userType === "steward";
@@ -109,6 +112,36 @@ export const ProvinceTrueGuildsOutProvince = ({ userType }) => {
>
<Grid>
<form onSubmit={handleSubmit}>
<Button
variant="contained"
sx={{
mr: SPACING.SMALL,
}}
onClick={() => {
dispatch(
DRAWER({
right: !(window.innerWidth <= 600),
bottom: window.innerWidth <= 600,
size: 340,
content: (
<SlaughterSellCarcassOutProvinceAddBuyer
updateTable={() => {
setPage(1);
fetchApiData(1);
}}
defaultPersonType={"real"}
userType={userType}
/>
),
title: `افزودن ${
IS_STEWARD ? "مباشر" : "صنف"
} خارج از استان`,
})
);
}}
>
{`افزودن ${IS_STEWARD ? "مباشر" : "صنف"}`}
</Button>
<TextField
id="outlined-basic"
size="small"

View File

@@ -15,6 +15,8 @@ import {
Grid,
TextField,
IconButton,
Tooltip,
Button,
} from "@mui/material";
import ToggleOffOutlinedIcon from "@mui/icons-material/ToggleOffOutlined";
import ToggleOnIcon from "@mui/icons-material/ToggleOn";
@@ -23,6 +25,7 @@ import { DatePicker } from "@mui/x-date-pickers";
import moment from "moment";
import { formatJustDate } from "../../../../utils/formatTime";
import { CheckCleanceCode } from "../../../../components/check-clearance-code/ChechClearanceCode";
import { RiFileExcel2Fill } from "react-icons/ri";
export const TotalCargoInformation = () => {
const [cargoInformation, setCargoInformation] = useState(null);
@@ -511,6 +514,26 @@ export const TotalCargoInformation = () => {
>
<SearchIcon />
</IconButton>
<Tooltip title="خروجی اکسل">
<a
href={`https://rsibackend.rasadyar.com/app/all_products_transport_excel/?${
selectedProduct
? "product_type=" + selectedProduct + "&"
: ""
}${selectedDate1 ? "date1=" + selectedDate1 + "&" : ""}${
selectedDate2 ? "date2=" + selectedDate2 + "&" : ""
}${
selectedProvince
? "destination_province=" + selectedProvince
: ""
}`}
rel="noreferrer"
>
<Button color="success">
<RiFileExcel2Fill size={32} />
</Button>
</a>
</Tooltip>
</Grid>
</Grid>
</Grid>

View File

@@ -159,7 +159,9 @@ export const ProvinceSellCarcassInProvince = ({ updateTable, priceInfo }) => {
"تایید شده"
) : item?.loggedRegistrationCode ? (
item.loggedRegistrationCode
) : item?.registrationCode ? (
) : item?.registrationCode &&
item?.allocationType !== "ColdHouse" &&
item?.activeExpireDateTime ? (
<SlaughterSellCarcassInProvinceSubmitRegistrationCode
key={i}
fetchApiData={fetchApiData}

View File

@@ -29,6 +29,8 @@ import { provinceGetNationalDocumentsService } from "../../../province/services/
import { LabelField } from "../../../../components/label-field/LabelField";
import { extractProvinceFromAddress } from "../../../../utils/address";
// userType enums = steward | steward_true | steward_legal | _true | _legal
export const SlaughterSellCarcassOutProvinceAddBuyer = ({
updateTable,
isEdit,
@@ -460,6 +462,7 @@ export const SlaughterSellCarcassOutProvinceAddBuyer = ({
/>
</RadioGroup>
</LabelField>
<Typography mt={2}>
{"استعلام "}
{formik2.values.personType === "legal"

View File

@@ -8,7 +8,6 @@ import { RiFileExcel2Fill, RiSearchLine } from "react-icons/ri";
import { AppContext } from "../../../../contexts/AppContext";
import ResponsiveTable from "../../../../components/responsive-table/ResponsiveTable";
import { getRoleFromUrl } from "../../../../utils/getRoleFromUrl";
import { getFaUserRole } from "../../../../utils/getFaUserRole";
import {
LOADING_END,
LOADING_START,
@@ -19,6 +18,7 @@ import { Grid } from "../../../../components/grid/Grid";
import { format } from "date-fns-jalali";
import { SPACING } from "../../../../data/spacing";
import { checkPathStartsWith } from "../../../../utils/checkPathStartsWith";
import { formatTime } from "../../../../utils/formatTime";
export const VetFarmDeletedBars = () => {
const [data, setData] = useState([]);
@@ -327,27 +327,10 @@ export const VetFarmDeletedBars = () => {
item?.trafficCode || "",
item?.amount ? item.amount.toLocaleString() + " ﷼" : "0 ﷼",
item?.clearanceCode || "-",
item?.barRemover
? `${item.barRemover?.fullName || ""} (${getFaUserRole(
item.barRemover?.role
)}) (${
item.barRemover?.date
? (() => {
try {
const date = new Date(item.barRemover.date);
return isNaN(date.getTime())
? "-"
: format(date, "yyyy/MM/dd");
} catch (error) {
console.error("Error formatting barRemover date:", error);
return "-";
}
})()
: "-"
})`
: "-",
item?.nonReceipt ? `(عدم وصول) ${item?.message || ""}` : "-",
(item?.nonReceipt && item?.mainNonReceipt ? `کاربر` : "سیستم") +
" " +
formatTime(item?.modifyDate),
item?.nonReceiptMessage || "-",
];
});
@@ -509,8 +492,8 @@ export const VetFarmDeletedBars = () => {
"کد بهداشتی حمل و نقل",
"قیمت مرغ زنده‌ی بار",
"کدرهگیری سامانه قرنطینه",
"حذف کننده",
"دلیل حذف",
"نوع برگشت",
"پیام عدم دریافت",
]}
handlePageChange={handlePageChange}
totalRows={totalRows}

View File

@@ -56,13 +56,13 @@ import {
ROUTE_SUPER_ADMIN_ROUTE_OUT_PROVINCE_LEGAL_GUILDS,
ROUTE_ADMINX_ROUTE_OUT_PROVINCE_LEGAL_GUILDS,
ROUTE_PROVINCE_ROUTE_OUT_PROVINCE_LEGAL_GUILDS,
ROUTE_SLAUGHTER_ROUTE_MANAGE_GUILDS,
} from "../routes/routes";
import { BackButton } from "../components/back-button/BackButton";
import { GuildsOperations } from "../features/province/components/guilds-operations/GuildsOperations";
import { ManageStewards } from "../features/province/components/manage-stewards/ManageStewards";
import { GuildsSettings } from "../features/province/components/guilds-settings/GuildsSettings";
import { GuildsOperationsCommerce } from "../features/commerce/components/guilds-operations-commerce/GuildsOperationsCommerce";
import { getRoleFromUrl } from "../utils/getRoleFromUrl";
import { ManageGuildsRequests } from "../features/province/components/manage-guilds-requests/ManageGuildsRequests";
import { GuildsOperationsCityJihad } from "../features/city-jihad/components/guilds-operations-city-jihad/GuildsOperationsCityJihad";
import { GuildRoomOperations } from "../features/guild-room/components/guild-room-operations/GuildRoomOperations";
@@ -75,6 +75,7 @@ import { ProvinceLegalGuildsOutProvince } from "../features/province/components/
const MANAGE_ROUTES = [
ROUTE_PROVINCE_ROUTE_MANAGE_GUILDS,
ROUTE_COMMERCE_ROUTE_MANAGE_GUILDS,
ROUTE_SLAUGHTER_ROUTE_MANAGE_GUILDS,
ROUTE_PROVINCE_SUPERVISOR_ROUTE_MANAGE_GUILDS,
ROUTE_GUILD_ROOM_ROUTE_MANAGE_GUILDS,
ROUTE_CITY_JIHAD_ROUTE_MANAGE_GUILDS,
@@ -93,6 +94,7 @@ const GUILDS_OPERATIONS_ROUTES = [
ROUTE_PROVINCE_ROUTE_MANAGE_GUILDS,
ROUTE_SUPER_ADMIN_ROUTE_MANAGE_GUILDS,
ROUTE_ADMINX_ROUTE_MANAGE_GUILDS,
ROUTE_SLAUGHTER_ROUTE_MANAGE_GUILDS,
ROUTE_SUPER_ADMIN_ROUTE_IN_PROVINCE_GUILDS,
ROUTE_ADMINX_ROUTE_IN_PROVINCE_GUILDS,
ROUTE_PROVINCE_ROUTE_IN_PROVINCE_GUILDS,
@@ -181,78 +183,70 @@ const isPathnameIncludes = (pathname, routes) =>
const Guilds = () => {
const { pathname } = useLocation();
const role = getRoleFromUrl();
const isKillHouse = role === "KillHouse";
return (
<>
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
{isPathnameIn(pathname, MANAGE_ROUTES) ? (
<Grid justifyContent="center" my={SPACING.MEDIUM}>
{isPathnameIn(pathname, GUILDS_OPERATIONS_ROUTES) && (
<GuildsOperations />
)}
{isPathnameIn(pathname, GUILDS_OPERATIONS_COMMERCE_ROUTES) && (
<GuildsOperationsCommerce />
)}
{isPathnameIn(pathname, GUILDS_OPERATIONS_CITY_JIHAD_ROUTES) && (
<GuildsOperationsCityJihad />
)}
{pathname === ROUTE_GUILD_ROOM_ROUTE_MANAGE_GUILDS && (
<GuildRoomOperations />
)}
</Grid>
) : (
<BackButton />
)}
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
lg={10}
>
{isPathnameIn(pathname, MANAGE_ROUTES) ? (
<Grid justifyContent="center" my={SPACING.MEDIUM}>
{isPathnameIn(pathname, GUILDS_OPERATIONS_ROUTES) && (
<GuildsOperations />
)}
{isPathnameIn(pathname, GUILDS_OPERATIONS_COMMERCE_ROUTES) && (
<GuildsOperationsCommerce />
)}
{isPathnameIn(pathname, GUILDS_OPERATIONS_CITY_JIHAD_ROUTES) && (
<GuildsOperationsCityJihad />
)}
{pathname === ROUTE_GUILD_ROOM_ROUTE_MANAGE_GUILDS && (
<GuildRoomOperations />
)}
</Grid>
) : (
<BackButton />
)}
<Grid container justifyContent="space-between" gap={SPACING.SMALL}>
<Grid xs={12}>
{(isPathnameIn(pathname, MANAGE_TAB_ROUTES) || isKillHouse) && (
<ManageTab />
)}
<Grid container justifyContent="space-between" gap={SPACING.SMALL}>
<Grid xs={12}>
{isPathnameIn(pathname, MANAGE_TAB_ROUTES) && <ManageTab />}
{isPathnameIncludes(pathname, STEWARDS_ROUTES) && (
<ManageStewards />
)}
{isPathnameIncludes(pathname, STEWARDS_ROUTES) && (
<ManageStewards />
)}
{isPathnameIn(pathname, GUILDS_SETTINGS_ROUTES) && (
<GuildsSettings />
)}
{isPathnameIn(pathname, GUILDS_SETTINGS_ROUTES) && (
<GuildsSettings />
)}
{isPathnameIn(pathname, GUILDS_REQUESTS_ROUTES) && (
<ManageGuildsRequests />
)}
{isPathnameIn(pathname, GUILDS_REQUESTS_ROUTES) && (
<ManageGuildsRequests />
)}
{isPathnameIn(pathname, GUILDS_DISTRIBUTIONS_ROUTES) && (
<ManageGuildDistributions />
)}
{isPathnameIn(pathname, GUILDS_DISTRIBUTIONS_ROUTES) && (
<ManageGuildDistributions />
)}
{isPathnameIn(pathname, TRUE_GUILDS_OUT_PROVINCE_ROUTES) && (
<ProvinceTrueGuildsOutProvince />
)}
{isPathnameIn(pathname, TRUE_GUILDS_OUT_PROVINCE_ROUTES) && (
<ProvinceTrueGuildsOutProvince />
)}
{isPathnameIn(pathname, LEGAL_GUILDS_IN_PROVINCE_ROUTES) && (
<ProvinceLegalGuildsInProvince />
)}
{isPathnameIn(pathname, LEGAL_GUILDS_IN_PROVINCE_ROUTES) && (
<ProvinceLegalGuildsInProvince />
)}
{isPathnameIn(pathname, LEGAL_GUILDS_OUT_PROVINCE_ROUTES) && (
<ProvinceLegalGuildsOutProvince />
)}
</Grid>
{isPathnameIn(pathname, LEGAL_GUILDS_OUT_PROVINCE_ROUTES) && (
<ProvinceLegalGuildsOutProvince />
)}
</Grid>
</Grid>
</Box>
</>
</Grid>
</Box>
);
};

View File

@@ -217,8 +217,7 @@ export const ROUTE_SLAUGHTER_FACTORS =
ROUTE_SLAUGHTER_BASE + "/requests/factors";
export const ROUTE_SLAUGHTER_FINAL_FACTORS =
ROUTE_SLAUGHTER_BASE + "/requests/final-factors";
export const ROUTE_SLAUGHTER_ROUTE_MANAGE_GUILDS =
ROUTE_SLAUGHTER_BASE + "/manage-guilds/";
export const ROUTE_SLAUGHTER_MANAGE_STEWARDS =
ROUTE_SLAUGHTER_BASE + "/manage-stewards/";
export const ROUTE_SLAUGHTER_MANAGE_STEWARDS_IN_PROVINCE =
@@ -235,6 +234,24 @@ export const ROUTE_SLAUGHTER_MANAGE_STEWARDS_OUT_PROVINCE_TRUE =
ROUTE_SLAUGHTER_BASE + "/manage-stewards/out-province/true";
export const ROUTE_SLAUGHTER_MANAGE_STEWARDS_OUT_PROVINCE_LEGAL =
ROUTE_SLAUGHTER_BASE + "/manage-stewards/out-province/legal";
export const ROUTE_SLAUGHTER_ROUTE_MANAGE_GUILDS =
ROUTE_SLAUGHTER_BASE + "/manage-guilds/";
export const ROUTE_SLAUGHTER_MANAGE_GUILDS_IN_PROVINCE =
ROUTE_SLAUGHTER_BASE + "/manage-guilds/in-province";
export const ROUTE_SLAUGHTER_MANAGE_GUILDS_IN_PROVINCE_GUILDS_REQUESTS =
ROUTE_SLAUGHTER_BASE + "/manage-guilds/in-province/guilds-requests";
export const ROUTE_SLAUGHTER_MANAGE_GUILDS_IN_PROVINCE_TRUE =
ROUTE_SLAUGHTER_BASE + "/manage-guilds/in-province/true";
export const ROUTE_SLAUGHTER_MANAGE_GUILDS_IN_PROVINCE_LEGAL =
ROUTE_SLAUGHTER_BASE + "/manage-guilds/in-province/legal";
export const ROUTE_SLAUGHTER_MANAGE_GUILDS_OUT_PROVINCE =
ROUTE_SLAUGHTER_BASE + "/manage-guilds/out-province";
export const ROUTE_SLAUGHTER_MANAGE_GUILDS_OUT_PROVINCE_TRUE =
ROUTE_SLAUGHTER_BASE + "/manage-guilds/out-province/true";
export const ROUTE_SLAUGHTER_MANAGE_GUILDS_OUT_PROVINCE_LEGAL =
ROUTE_SLAUGHTER_BASE + "/manage-guilds/out-province/legal";
export const ROUTE_SLAUGHTER_ROUTE_MANAGE_BARS =
ROUTE_SLAUGHTER_BASE + "/manage-bars/";
export const ROUTE_SLAUGHTER_FINANCIAL_TRANSACTIONS =
@@ -356,6 +373,8 @@ export const ROUTE_PROVINCE_ROUTE_OUT_PROVINCE_TRUE_GUILDS =
ROUTE_PROVINCE_BASE + "/manage-guilds/out-province/true-guilds";
export const ROUTE_PROVINCE_ROUTE_IN_PROVINCE_LEGAL_GUILDS =
ROUTE_PROVINCE_BASE + "/manage-guilds/in-province/legal-guilds";
export const ROUTE_PROVINCE_ROUTE_IN_PROVINCE_GUILDS_REQUESTS =
ROUTE_PROVINCE_BASE + "/manage-guilds/in-province/guilds-requests";
export const ROUTE_PROVINCE_ROUTE_IN_PROVINCE_TRUE_GUILDS =
ROUTE_PROVINCE_BASE + "/manage-guilds/in-province/true-guilds";
export const ROUTE_PROVINCE_ROUTE_GUILDS =
@@ -370,8 +389,7 @@ export const ROUTE_PROVINCE_ROUTE_STEWARD_SHARE =
ROUTE_PROVINCE_BASE + "/steward-share";
export const ROUTE_PROVINCE_ROUTE_AGENT_SHARE_ID =
ROUTE_PROVINCE_BASE + "/agent-share/:id/:date";
export const ROUTE_PROVINCE_ROUTE_IN_PROVINCE_GUILDS_REQUESTS =
ROUTE_PROVINCE_BASE + "/manage-guilds/in-province/guilds-requests";
export const ROUTE_PROVINCE_ROUTE_MANAGE_PROCESS =
ROUTE_PROVINCE_BASE + "/manage-process/";
export const ROUTE_PROVINCE_ROUTE_MANAGE_PROCESS_SLAUGHTER =