stewards management
This commit is contained in:
@@ -23,6 +23,7 @@ import {
|
||||
} from "../../../lib/redux/slices/appSlice";
|
||||
import { getRoleFromUrl } from "../../../utils/getRoleFromUrl";
|
||||
import BoxList from "../../../components/box-list/BoxList";
|
||||
import { provinceGetTotalGuildsService } from "../../province/services/province-get-total-guilds";
|
||||
|
||||
const GuildMaangeGuilds = () => {
|
||||
const dispatch = useDispatch();
|
||||
@@ -42,8 +43,14 @@ const GuildMaangeGuilds = () => {
|
||||
|
||||
const fetchApiData = async (page, textValue) => {
|
||||
setLoading(true);
|
||||
let response = await axios.get(
|
||||
`total_guilds/?role=Guilds&steward=true&search=filter&value=${textValue}&page=${page}&page_size=${perPage}`
|
||||
const response = await dispatch(
|
||||
provinceGetTotalGuildsService({
|
||||
steward: true,
|
||||
search: "filter",
|
||||
value: textValue,
|
||||
page,
|
||||
page_size: perPage,
|
||||
})
|
||||
);
|
||||
|
||||
setData(response.data.results);
|
||||
@@ -57,9 +64,14 @@ const GuildMaangeGuilds = () => {
|
||||
|
||||
const handlePerRowsChange = async (newPerPage, page) => {
|
||||
setLoading(true);
|
||||
|
||||
let response = await axios.get(
|
||||
`total_guilds/?role=Guilds&steward=true&search=filter&value=${textValue}&page=${page}&page_size=${newPerPage}`
|
||||
const response = await dispatch(
|
||||
provinceGetTotalGuildsService({
|
||||
steward: true,
|
||||
search: "filter",
|
||||
value: textValue,
|
||||
page,
|
||||
page_size: perPage,
|
||||
})
|
||||
);
|
||||
|
||||
setData(response.data.results);
|
||||
@@ -248,8 +260,12 @@ const GuildMaangeGuilds = () => {
|
||||
event.preventDefault();
|
||||
setLoading(true);
|
||||
try {
|
||||
const response = await axios.get(
|
||||
`total_guilds/?role=${getRoleFromUrl()}&search=filter&value=${textValue}&steward=true`
|
||||
const response = await dispatch(
|
||||
provinceGetTotalGuildsService({
|
||||
steward: true,
|
||||
search: "filter",
|
||||
value: textValue,
|
||||
})
|
||||
);
|
||||
setData(response.data.results);
|
||||
setTotalRows(response.data.count);
|
||||
|
||||
@@ -495,7 +495,7 @@ export const CreateGuilds = ({ guild, updateTable }) => {
|
||||
<Grid container gap={SPACING.TINY} direction="column">
|
||||
<Grid item xs={12}>
|
||||
<Typography variant="h6" gutterBottom>
|
||||
اطلاعات صنفی
|
||||
اطلاعات واحد
|
||||
</Typography>
|
||||
</Grid>
|
||||
|
||||
@@ -531,7 +531,7 @@ export const CreateGuilds = ({ guild, updateTable }) => {
|
||||
fullWidth
|
||||
sx={{ mb: 2 }}
|
||||
>
|
||||
افزودن واحد صنفی
|
||||
{`افزودن واحد`}
|
||||
</Button>
|
||||
</Grid>
|
||||
)}
|
||||
|
||||
@@ -70,7 +70,7 @@ export const GuildInfoSection = ({
|
||||
{!hideTitle && (
|
||||
<Grid item xs={12}>
|
||||
<Typography variant="h6" gutterBottom>
|
||||
اطلاعات صنفی
|
||||
اطلاعات واحد
|
||||
</Typography>
|
||||
</Grid>
|
||||
)}
|
||||
|
||||
@@ -20,4 +20,3 @@ export const InfoBox = ({ icon: Icon, label, value, iconSx }) => (
|
||||
</Box>
|
||||
</Box>
|
||||
);
|
||||
|
||||
|
||||
@@ -17,7 +17,11 @@ import { provinceResendRegisterCodeStateService } from "../../services/province-
|
||||
import { getRoleFromUrl } from "../../../../utils/getRoleFromUrl";
|
||||
import { ViewGuildDetails } from "../view-guild-details/ViewGuildDetails";
|
||||
|
||||
export const ManageGuildsRequestsOperations = ({ guild, updateTable }) => {
|
||||
export const ManageGuildsRequestsOperations = ({
|
||||
guild,
|
||||
updateTable,
|
||||
userType,
|
||||
}) => {
|
||||
const [popoverOpen, setPopoverOpen] = useState(false);
|
||||
const [anchorEl, setAnchorEl] = useState(null);
|
||||
|
||||
@@ -108,7 +112,9 @@ export const ManageGuildsRequestsOperations = ({ guild, updateTable }) => {
|
||||
dispatch(
|
||||
OPEN_MODAL({
|
||||
title: "مشاهده جزییات صنف",
|
||||
content: <ViewGuildDetails guild={guild} />,
|
||||
content: (
|
||||
<ViewGuildDetails guild={guild} userType={userType} />
|
||||
),
|
||||
size: window.innerWidth <= 600 ? "small" : "auto",
|
||||
})
|
||||
);
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { Button, TextField } from "@mui/material";
|
||||
import { useDispatch } from "react-redux";
|
||||
import axios from "axios";
|
||||
import { RiSearchLine } from "react-icons/ri";
|
||||
import {
|
||||
// DRAWER,
|
||||
LOADING_END,
|
||||
LOADING_START,
|
||||
OPEN_MODAL,
|
||||
@@ -14,8 +12,12 @@ import { Grid } from "../../../../components/grid/Grid";
|
||||
import ResponsiveTable from "../../../../components/responsive-table/ResponsiveTable";
|
||||
import { ManageGuildsRequestsOperations } from "../manage-guilds-requests-operations/ManageGuildsRequestsOperations";
|
||||
import { CreateGuilds } from "../create-guilds/CreateGuilds";
|
||||
import { provinceGetTotalGuildsService } from "../../services/province-get-total-guilds";
|
||||
import { provinceGetTotalStewardsService } from "../../services/province-get-total-stewards";
|
||||
|
||||
export const ManageGuildsRequests = () => {
|
||||
export const ManageGuildsRequests = ({ userType }) => {
|
||||
const IS_STEWARD = userType === "steward";
|
||||
const TABLE_TITLE = `درخواستهای ثبت ${IS_STEWARD ? "مباشر" : "صنف"}`;
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const handleTextChange = (event) => {
|
||||
@@ -31,8 +33,24 @@ export const ManageGuildsRequests = () => {
|
||||
|
||||
const fetchApiData = async (page) => {
|
||||
dispatch(LOADING_START());
|
||||
const response = await axios.get(
|
||||
`total_guilds/?search=filter&value=${textValue}&role=${getRoleFromUrl()}&page=${page}&page_size=${perPage}&check=true&state=pending`
|
||||
const response = await dispatch(
|
||||
IS_STEWARD
|
||||
? provinceGetTotalStewardsService({
|
||||
search: "filter",
|
||||
value: textValue,
|
||||
page,
|
||||
page_size: perPage,
|
||||
check: true,
|
||||
state: "pending",
|
||||
})
|
||||
: provinceGetTotalGuildsService({
|
||||
search: "filter",
|
||||
value: textValue,
|
||||
page,
|
||||
page_size: perPage,
|
||||
check: true,
|
||||
state: "pending",
|
||||
})
|
||||
);
|
||||
dispatch(LOADING_END());
|
||||
setData(response.data?.results || []);
|
||||
@@ -57,14 +75,6 @@ export const ManageGuildsRequests = () => {
|
||||
const d = data?.map((item, i) => {
|
||||
return [
|
||||
page === 1 ? i + 1 : i + perPage * (page - 1) + 1,
|
||||
// item?.killHouseInfo?.length
|
||||
// ? item?.killHouseInfo
|
||||
// ?.map((item) => {
|
||||
// const type = item?.killer ? "کشتارکن" : "کشتارگاه";
|
||||
// return `${type} ${item?.name} (${item?.mobile})`;
|
||||
// })
|
||||
// .join(" - ")
|
||||
// :
|
||||
`${item?.registerarFullname || ""} ${
|
||||
item?.registerarMobile ? "(" + item?.registerarMobile + " )" : " "
|
||||
}`,
|
||||
@@ -78,13 +88,13 @@ export const ManageGuildsRequests = () => {
|
||||
`${item?.address?.province?.name || "-"}/${
|
||||
item?.address?.city?.name || "-"
|
||||
}/${item?.address?.address || "-"}`,
|
||||
item?.steward ? "می باشد" : "نمی باشد",
|
||||
item?.hasInquiry ? "استعلامی" : "دستی",
|
||||
item?.activeRegisterCode ? "انجام شده" : "انجام نشده",
|
||||
<ManageGuildsRequestsOperations
|
||||
updateTable={updateTable}
|
||||
key={item?.guildsName}
|
||||
guild={item}
|
||||
userType={userType}
|
||||
/>,
|
||||
];
|
||||
});
|
||||
@@ -101,8 +111,15 @@ export const ManageGuildsRequests = () => {
|
||||
dispatch(LOADING_START());
|
||||
|
||||
try {
|
||||
const response = await axios.get(
|
||||
`total_guilds/?role=${getRoleFromUrl()}&search=filter&value=${textValue}&page=${1}&page_size=${perPage}&check=true&state=pending`
|
||||
const response = await dispatch(
|
||||
provinceGetTotalGuildsService({
|
||||
search: "filter",
|
||||
value: textValue,
|
||||
page: 1,
|
||||
page_size: perPage,
|
||||
check: true,
|
||||
state: "pending",
|
||||
})
|
||||
);
|
||||
setData(response.data?.results || []);
|
||||
setTotalRows(response.data?.count || 0);
|
||||
@@ -128,14 +145,14 @@ export const ManageGuildsRequests = () => {
|
||||
onClick={() => {
|
||||
dispatch(
|
||||
OPEN_MODAL({
|
||||
title: "ثبت واحد جدید",
|
||||
title: `ثبت ${IS_STEWARD ? "مباشر" : "صنف"} جدید`,
|
||||
size: window.innerWidth <= 600 ? "small" : "auto",
|
||||
content: <CreateGuilds updateTable={updateTable} />,
|
||||
})
|
||||
);
|
||||
}}
|
||||
>
|
||||
ثبت واحد جدید
|
||||
{`ثبت ${IS_STEWARD ? "مباشر" : "صنف"} جدید`}
|
||||
</Button>
|
||||
)}
|
||||
|
||||
@@ -150,7 +167,6 @@ export const ManageGuildsRequests = () => {
|
||||
onChange={handleTextChange}
|
||||
/>
|
||||
<Button
|
||||
// disabled={!textValue}
|
||||
type="submit"
|
||||
onClick={handleSubmit}
|
||||
endIcon={<RiSearchLine />}
|
||||
@@ -166,15 +182,14 @@ export const ManageGuildsRequests = () => {
|
||||
columns={[
|
||||
"ردیف",
|
||||
"ثبت کننده",
|
||||
"شناسه صنف",
|
||||
"نام واحد صنفی",
|
||||
`${IS_STEWARD ? "مباشر" : "صنف"} شناسه`,
|
||||
`نام ${IS_STEWARD ? "مباشر" : "واحد صنفی"}`,
|
||||
"نام شخص/شرکت",
|
||||
"کدملی",
|
||||
"نوع فعالیت",
|
||||
"حوزه فعالیت",
|
||||
"کدپستی",
|
||||
"استان/شهر/آدرس",
|
||||
"مباشر",
|
||||
"نوع ثبت",
|
||||
"احراز شماره موبایل",
|
||||
"عملیات",
|
||||
@@ -184,7 +199,7 @@ export const ManageGuildsRequests = () => {
|
||||
page={page}
|
||||
perPage={perPage}
|
||||
handlePerRowsChange={handlePerRowsChange}
|
||||
title="درخواست های ثبت صنف"
|
||||
title={TABLE_TITLE}
|
||||
/>
|
||||
</Grid>
|
||||
);
|
||||
|
||||
@@ -14,7 +14,11 @@ import { SimpleTable } from "../../../../components/simple-table/SimpleTable";
|
||||
import { CreateGuilds } from "../create-guilds/CreateGuilds";
|
||||
import { checkPathStartsWith } from "../../../../utils/checkPathStartsWith";
|
||||
|
||||
export const MaangeGuilds = () => {
|
||||
export const ManageGuilds = ({ userType }) => {
|
||||
const IS_STEWARD = userType === "steward";
|
||||
const TABLE_TITLE = `مدیریت ${
|
||||
IS_STEWARD ? "مباشرین" : "اصناف"
|
||||
} حقیقی داخل استان`;
|
||||
const userKey = useSelector((state) => state.userSlice?.userProfile?.key);
|
||||
const dispatch = useDispatch();
|
||||
const selectedSubUser = useSelector(
|
||||
@@ -112,11 +116,11 @@ export const MaangeGuilds = () => {
|
||||
]);
|
||||
dispatch(
|
||||
OPEN_MODAL({
|
||||
title: "مباشرین",
|
||||
title: IS_STEWARD ? "مباشرین" : "اصناف",
|
||||
content: (
|
||||
<SimpleTable
|
||||
paginated
|
||||
title={"مباشرین"}
|
||||
title={IS_STEWARD ? "مباشرین" : "اصناف"}
|
||||
columns={["ردیف", "نام و نام خانوادگی", "تلفن"]}
|
||||
data={tableData}
|
||||
/>
|
||||
@@ -259,13 +263,13 @@ export const MaangeGuilds = () => {
|
||||
right: !(window.innerWidth <= 600),
|
||||
bottom: window.innerWidth <= 600,
|
||||
size: window.innerWidth <= 600 ? "small" : "auto",
|
||||
title: "ثبت واحد جدید",
|
||||
title: `ثبت ${IS_STEWARD ? "مباشر" : "صنف"} جدید`,
|
||||
content: <CreateGuilds updateTable={updateTable} />,
|
||||
})
|
||||
);
|
||||
}}
|
||||
>
|
||||
ثبت واحد جدید
|
||||
{`ثبت ${IS_STEWARD ? "مباشر" : "صنف"} جدید`}
|
||||
</Button>
|
||||
)}
|
||||
|
||||
@@ -410,7 +414,7 @@ export const MaangeGuilds = () => {
|
||||
page={page}
|
||||
perPage={perPage}
|
||||
handlePerRowsChange={handlePerRowsChange}
|
||||
title="مدیریت اصناف"
|
||||
title={TABLE_TITLE}
|
||||
/>
|
||||
</Grid>
|
||||
);
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
import { useState } from "react";
|
||||
import { Tab, Tabs } from "@mui/material";
|
||||
// import { useState } from "react";
|
||||
// import { Tab, Tabs } from "@mui/material";
|
||||
import { Grid } from "../../../../components/grid/Grid";
|
||||
import { MaangeGuilds } from "../manage-guilds/ManageGuilds";
|
||||
import { PspActiveSession } from "../../../psp-company/components/psp-active-session/PspActiveSession";
|
||||
import { getRoleFromUrl } from "../../../../utils/getRoleFromUrl";
|
||||
import { ManageGuilds } from "../manage-guilds/ManageGuilds";
|
||||
// import { PspActiveSession } from "../../../psp-company/components/psp-active-session/PspActiveSession";
|
||||
// import { getRoleFromUrl } from "../../../../utils/getRoleFromUrl";
|
||||
|
||||
export const ManageTab = () => {
|
||||
const [value, setValue] = useState(0);
|
||||
// const [value, setValue] = useState(0);
|
||||
|
||||
const handleChange = (event, newValue) => {
|
||||
setValue(newValue);
|
||||
};
|
||||
// const handleChange = (event, newValue) => {
|
||||
// setValue(newValue);
|
||||
// };
|
||||
return (
|
||||
<Grid container alignItems="center" justifyContent="center">
|
||||
<Grid xs={12} container alignItems="center" justifyContent="center">
|
||||
{/* <Grid xs={12} container alignItems="center" justifyContent="center">
|
||||
<Tabs
|
||||
scrollButtons="auto"
|
||||
variant="scrollable"
|
||||
@@ -27,10 +27,10 @@ export const ManageTab = () => {
|
||||
<Tab label="نشست ها" value={1} />
|
||||
)}
|
||||
</Tabs>
|
||||
</Grid>
|
||||
</Grid> */}
|
||||
|
||||
{value === 0 && <MaangeGuilds readOnly={true} />}
|
||||
{value === 1 && <PspActiveSession readOnly={true} />}
|
||||
<ManageGuilds />
|
||||
{/* {value === 1 && <PspActiveSession readOnly={true} />} */}
|
||||
</Grid>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -393,7 +393,13 @@ const InquiryForm = ({ onInquiry, nationalCode, setNationalCode }) => {
|
||||
);
|
||||
};
|
||||
|
||||
export const ProvinceLegalGuildsForm = ({ onClose, updateTable, guild }) => {
|
||||
export const ProvinceLegalGuildsForm = ({
|
||||
onClose,
|
||||
updateTable,
|
||||
guild,
|
||||
userType,
|
||||
}) => {
|
||||
const IS_STEWARD = userType === "steward";
|
||||
const dispatch = useDispatch();
|
||||
const [openNotif] = useContext(AppContext);
|
||||
const [nationalCode, setNationalCode] = useState(
|
||||
@@ -454,7 +460,7 @@ export const ProvinceLegalGuildsForm = ({ onClose, updateTable, guild }) => {
|
||||
// Update modal with larger size
|
||||
dispatch(
|
||||
OPEN_MODAL({
|
||||
title: "ثبت واحد حقوقی",
|
||||
title: `ثبت ${IS_STEWARD ? "مباشر" : "صنف"} حقوقی`,
|
||||
content: (
|
||||
<ProvinceLegalGuildsForm
|
||||
onClose={onClose}
|
||||
|
||||
@@ -12,7 +12,9 @@ import { ProvinceLegalGuildsOperations } from "./ProvinceLegalGuildsOperations";
|
||||
import ResponsiveTable from "../../../../components/responsive-table/ResponsiveTable";
|
||||
import { RiSearchLine } from "react-icons/ri";
|
||||
|
||||
export const ProvinceLegalGuildsInProvince = () => {
|
||||
export const ProvinceLegalGuildsInProvince = ({ userType }) => {
|
||||
const IS_STEWARD = userType === "steward";
|
||||
const TABLE_TITLE = `${IS_STEWARD ? "مباشرین" : "اصناف"} حقوقی داخل استان`;
|
||||
const dispatch = useDispatch();
|
||||
const [data, setData] = useState([]);
|
||||
const [totalRows, setTotalRows] = useState(0);
|
||||
@@ -89,6 +91,7 @@ export const ProvinceLegalGuildsInProvince = () => {
|
||||
key={`operations-${item?.key || i}`}
|
||||
guild={item}
|
||||
updateTable={updateTableData}
|
||||
userType={userType}
|
||||
/>,
|
||||
];
|
||||
});
|
||||
@@ -139,11 +142,12 @@ export const ProvinceLegalGuildsInProvince = () => {
|
||||
const handleOpenModal = () => {
|
||||
dispatch(
|
||||
OPEN_MODAL({
|
||||
title: "ثبت واحد حقوقی",
|
||||
title: `ثبت ${IS_STEWARD ? "مباشر جدید" : "صنف جدید"}`,
|
||||
content: (
|
||||
<ProvinceLegalGuildsForm
|
||||
onClose={() => dispatch(CLOSE_MODAL())}
|
||||
updateTable={updateTableData}
|
||||
userType={userType}
|
||||
/>
|
||||
),
|
||||
size: 400,
|
||||
@@ -161,9 +165,8 @@ export const ProvinceLegalGuildsInProvince = () => {
|
||||
gap={SPACING.SMALL}
|
||||
>
|
||||
<Button variant="contained" color="primary" onClick={handleOpenModal}>
|
||||
ثبت واحد حقوقی
|
||||
{`ثبت ${IS_STEWARD ? "مباشر" : "واحد صنفی"}`}
|
||||
</Button>
|
||||
|
||||
<form onSubmit={handleSubmit}>
|
||||
<Grid container alignItems="center" gap={SPACING.SMALL}>
|
||||
<TextField
|
||||
@@ -211,7 +214,7 @@ export const ProvinceLegalGuildsInProvince = () => {
|
||||
|
||||
<Grid item xs={12}>
|
||||
<ResponsiveTable
|
||||
title="واحدهای حقوقی"
|
||||
title={TABLE_TITLE}
|
||||
columns={[
|
||||
"ردیف",
|
||||
"شناسه حقوقی",
|
||||
|
||||
@@ -17,7 +17,12 @@ import { OPEN_MODAL, CLOSE_MODAL } from "../../../../lib/redux/slices/appSlice";
|
||||
import { ProvinceLegalGuildsForm } from "./ProvinceLegalGuildsForm";
|
||||
import TuneIcon from "@mui/icons-material/Tune";
|
||||
|
||||
export const ProvinceLegalGuildsOperations = ({ guild, updateTable }) => {
|
||||
export const ProvinceLegalGuildsOperations = ({
|
||||
guild,
|
||||
updateTable,
|
||||
userType,
|
||||
}) => {
|
||||
const IS_STEWARD = userType === "steward";
|
||||
const dispatch = useDispatch();
|
||||
const [checked, setChecked] = useState(guild?.active);
|
||||
const [popoverOpen, setPopoverOpen] = useState(false);
|
||||
@@ -47,7 +52,9 @@ export const ProvinceLegalGuildsOperations = ({ guild, updateTable }) => {
|
||||
content: (
|
||||
<Box sx={{ p: 2, minWidth: 300 }}>
|
||||
<Typography sx={{ mb: 3 }}>
|
||||
آیا از حذف این واحد حقوقی اطمینان دارید؟
|
||||
{`آیا از حذف این ${
|
||||
IS_STEWARD ? "مباشر" : "صنف"
|
||||
} حقوقی اطمینان دارید؟`}
|
||||
</Typography>
|
||||
<Grid container direction="row" justifyContent="space-between">
|
||||
<Button
|
||||
@@ -78,7 +85,7 @@ export const ProvinceLegalGuildsOperations = ({ guild, updateTable }) => {
|
||||
closePopover();
|
||||
dispatch(
|
||||
OPEN_MODAL({
|
||||
title: "ویرایش واحد حقوقی",
|
||||
title: `ویرایش ${IS_STEWARD ? "مباشر" : "صنف"} حقوقی`,
|
||||
content: (
|
||||
<ProvinceLegalGuildsForm
|
||||
guild={guild}
|
||||
|
||||
@@ -12,7 +12,9 @@ import { RiSearchLine } from "react-icons/ri";
|
||||
import { fetchOutProvinceLegalBuyers } from "../../services/province-out-province-buyers";
|
||||
import { ProvinceTrueGuildsOutProvinceOperations } from "../province-true-guilds-out-province/ProvinceTrueGuildsOutProvinceOperations";
|
||||
|
||||
export const ProvinceLegalGuildsOutProvince = () => {
|
||||
export const ProvinceLegalGuildsOutProvince = ({ userType }) => {
|
||||
const IS_STEWARD = userType === "steward";
|
||||
const TABLE_TITLE = `${IS_STEWARD ? "مباشرین" : "اصناف"} حقوقی خارج استان`;
|
||||
const handleTextChange = (event) => {
|
||||
setTextValue(event.target.value);
|
||||
};
|
||||
@@ -63,7 +65,6 @@ export const ProvinceLegalGuildsOutProvince = () => {
|
||||
? `${killHouseName} (${killHouseOperator})`
|
||||
: killHouseName;
|
||||
|
||||
console.log(item);
|
||||
return [
|
||||
page === 1 ? i + 1 : i + perPage * (page - 1) + 1,
|
||||
item?.unitName || "-",
|
||||
@@ -145,7 +146,7 @@ export const ProvinceLegalGuildsOutProvince = () => {
|
||||
page={page}
|
||||
perPage={perPage}
|
||||
handlePerRowsChange={handlePerRowsChange}
|
||||
title="اصناف حقوقی خارج استان"
|
||||
title={TABLE_TITLE}
|
||||
/>
|
||||
</Grid>
|
||||
);
|
||||
|
||||
@@ -12,7 +12,9 @@ import { RiSearchLine } from "react-icons/ri";
|
||||
import { fetchOutProvinceRealBuyers } from "../../services/province-out-province-buyers";
|
||||
import { ProvinceTrueGuildsOutProvinceOperations } from "./ProvinceTrueGuildsOutProvinceOperations";
|
||||
|
||||
export const ProvinceTrueGuildsOutProvince = () => {
|
||||
export const ProvinceTrueGuildsOutProvince = ({ userType }) => {
|
||||
const IS_STEWARD = userType === "steward";
|
||||
const TABLE_TITLE = `${IS_STEWARD ? "مباشرین" : "اصناف"} حقیقی خارج استان`;
|
||||
const handleTextChange = (event) => {
|
||||
setTextValue(event.target.value);
|
||||
};
|
||||
@@ -75,6 +77,7 @@ export const ProvinceTrueGuildsOutProvince = () => {
|
||||
item?.requestsInfo?.totalWeight?.toLocaleString() || "0",
|
||||
<ProvinceTrueGuildsOutProvinceOperations
|
||||
key={item?.unitName}
|
||||
userType={userType}
|
||||
item={item}
|
||||
updateTable={() => fetchApiData(1)}
|
||||
/>,
|
||||
@@ -144,7 +147,7 @@ export const ProvinceTrueGuildsOutProvince = () => {
|
||||
page={page}
|
||||
perPage={perPage}
|
||||
handlePerRowsChange={handlePerRowsChange}
|
||||
title="اصناف حقیقی خارج استان"
|
||||
title={TABLE_TITLE}
|
||||
/>
|
||||
</Grid>
|
||||
);
|
||||
|
||||
@@ -16,7 +16,9 @@ import { SlaughterSellCarcassOutProvinceAddBuyer } from "../../../slaughter-hous
|
||||
export const ProvinceTrueGuildsOutProvinceOperations = ({
|
||||
item,
|
||||
updateTable,
|
||||
userType,
|
||||
}) => {
|
||||
const IS_STEWARD = userType === "steward";
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const [anchorEl, setAnchorEl] = useState(null);
|
||||
@@ -78,7 +80,7 @@ export const ProvinceTrueGuildsOutProvinceOperations = ({
|
||||
handleClose();
|
||||
dispatch(
|
||||
DRAWER({
|
||||
title: "ویرایش واحد",
|
||||
title: `ویرایش ${IS_STEWARD ? "مباشر" : "صنف"}`,
|
||||
right: !(window.innerWidth <= 600),
|
||||
bottom: window.innerWidth <= 600,
|
||||
content: (
|
||||
|
||||
@@ -7,7 +7,7 @@ export const deleteOutProvinceTrueGuilds = createAsyncThunk(
|
||||
const { data, status } = await axios.delete(
|
||||
"out-province-carcasses-buyer/0",
|
||||
{
|
||||
params: { buyer_key: d.buyer_key },
|
||||
params: d,
|
||||
}
|
||||
);
|
||||
return { data, status };
|
||||
|
||||
@@ -3,34 +3,27 @@ import axios from "axios";
|
||||
import { LOADING_END, LOADING_START } from "../../../lib/redux/slices/appSlice";
|
||||
import { getRoleFromUrl } from "../../../utils/getRoleFromUrl";
|
||||
|
||||
/*
|
||||
props {
|
||||
search = "filter",
|
||||
value = "",
|
||||
page = 1,
|
||||
page_size = 10,
|
||||
steward = false,
|
||||
active_state = "active",
|
||||
is_real_person = true,
|
||||
role_key = "",
|
||||
}
|
||||
*/
|
||||
export const provinceGetTotalGuildsService = createAsyncThunk(
|
||||
"PROVINCE_GET_TOTAL_GUILDS_SERVICE",
|
||||
async (
|
||||
{
|
||||
search = "filter",
|
||||
value = "",
|
||||
page = 1,
|
||||
page_size = 10,
|
||||
steward = false,
|
||||
active_state = "active",
|
||||
is_real_person = true,
|
||||
role_key = "",
|
||||
},
|
||||
{ dispatch }
|
||||
) => {
|
||||
async (d, { dispatch }) => {
|
||||
try {
|
||||
dispatch(LOADING_START());
|
||||
const { data, status } = await axios.get("total_guilds/", {
|
||||
params: {
|
||||
search,
|
||||
value,
|
||||
...d,
|
||||
role: getRoleFromUrl(),
|
||||
page,
|
||||
page_size,
|
||||
steward,
|
||||
active_state,
|
||||
is_real_person,
|
||||
role_key: role_key,
|
||||
},
|
||||
});
|
||||
dispatch(LOADING_END());
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
import { createAsyncThunk } from "@reduxjs/toolkit";
|
||||
import axios from "axios";
|
||||
import { LOADING_END, LOADING_START } from "../../../lib/redux/slices/appSlice";
|
||||
import { getRoleFromUrl } from "../../../utils/getRoleFromUrl";
|
||||
|
||||
/*
|
||||
props {
|
||||
role_key = "",
|
||||
state: "",
|
||||
check: boolean,
|
||||
page,
|
||||
pageSize,
|
||||
search : "filter"
|
||||
value: '',
|
||||
}
|
||||
*/
|
||||
export const provinceGetTotalStewardsService = createAsyncThunk(
|
||||
"PROVINCE_GET_TOTAL_STEWARDS_SERVICE",
|
||||
async (d, { dispatch }) => {
|
||||
try {
|
||||
dispatch(LOADING_START());
|
||||
const { data, status } = await axios.get("main_steward_view/", {
|
||||
params: {
|
||||
...d,
|
||||
role: getRoleFromUrl(),
|
||||
},
|
||||
});
|
||||
dispatch(LOADING_END());
|
||||
return { data, status };
|
||||
} catch (e) {
|
||||
dispatch(LOADING_END());
|
||||
return {
|
||||
error:
|
||||
e.response?.data?.result ||
|
||||
e.response?.data ||
|
||||
"خطا در دریافت اطلاعات",
|
||||
};
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -42,6 +42,11 @@ import {
|
||||
} from "../routes/routes";
|
||||
import { Box } from "@mui/material";
|
||||
import { getRoleFromUrl } from "../utils/getRoleFromUrl";
|
||||
import { ManageGuildsRequests } from "../features/province/components/manage-guilds-requests/ManageGuildsRequests";
|
||||
import { ProvinceLegalGuildsInProvince } from "../features/province/components/province-legal-guilds-in-province/ProvinceLegalGuildsInProvince";
|
||||
import { ProvinceTrueGuildsOutProvince } from "../features/province/components/province-true-guilds-out-province/ProvinceTrueGuildsOutProvince";
|
||||
import { ProvinceLegalGuildsOutProvince } from "../features/province/components/province-legal-guilds-out-province/ProvinceLegalGuildsOutProvince";
|
||||
import { ManageGuilds } from "../features/province/components/manage-guilds/ManageGuilds";
|
||||
|
||||
const ProvinceManageStewards = () => {
|
||||
const { pathname } = useLocation();
|
||||
@@ -192,6 +197,21 @@ const ProvinceManageStewards = () => {
|
||||
</NavLink>
|
||||
</>
|
||||
)}
|
||||
{STEWARDS_IN_PROVINCE_REQUESTS === pathname && (
|
||||
<ManageGuildsRequests userType="steward" />
|
||||
)}
|
||||
{STEWARDS_IN_PROVINCE_TRUE === pathname && (
|
||||
<ManageGuilds userType="steward" />
|
||||
)}
|
||||
{STEWARDS_IN_PROVINCE_LEGAL === pathname && (
|
||||
<ProvinceLegalGuildsInProvince userType="steward" />
|
||||
)}
|
||||
{STEWARDS_OUT_PROVINCE_TRUE === pathname && (
|
||||
<ProvinceTrueGuildsOutProvince userType="steward" />
|
||||
)}
|
||||
{STEWARDS_OUT_PROVINCE_LEGAL === pathname && (
|
||||
<ProvinceLegalGuildsOutProvince userType={"steward"} />
|
||||
)}
|
||||
</Grid>
|
||||
</Box>
|
||||
);
|
||||
|
||||
@@ -1010,6 +1010,21 @@ const consolidatedRouting = [
|
||||
ROUTES.ROUTE_ADMINX_ROUTE_MANAGE_STEWARDS_OUT_PROVINCE,
|
||||
ROUTES.ROUTE_SUPER_ADMIN_ROUTE_MANAGE_STEWARDS_OUT_PROVINCE,
|
||||
ROUTES.ROUTE_PROVINCE_ROUTE_MANAGE_STEWARDS_OUT_PROVINCE,
|
||||
ROUTES.ROUTE_ADMINX_ROUTE_MANAGE_STEWARDS_IN_PROVINCE_STEWARDS_REQUESTS,
|
||||
ROUTES.ROUTE_SUPER_ADMIN_ROUTE_MANAGE_STEWARDS_IN_PROVINCE_STEWARDS_REQUESTS,
|
||||
ROUTES.ROUTE_PROVINCE_ROUTE_MANAGE_STEWARDS_IN_PROVINCE_STEWARDS_REQUESTS,
|
||||
ROUTES.ROUTE_ADMINX_ROUTE_MANAGE_STEWARDS_IN_PROVINCE_LEGAL,
|
||||
ROUTES.ROUTE_SUPER_ADMIN_ROUTE_MANAGE_STEWARDS_IN_PROVINCE_LEGAL,
|
||||
ROUTES.ROUTE_PROVINCE_ROUTE_MANAGE_STEWARDS_IN_PROVINCE_LEGAL,
|
||||
ROUTES.ROUTE_ADMINX_ROUTE_MANAGE_STEWARDS_OUT_PROVINCE_TRUE,
|
||||
ROUTES.ROUTE_SUPER_ADMIN_ROUTE_MANAGE_STEWARDS_OUT_PROVINCE_TRUE,
|
||||
ROUTES.ROUTE_PROVINCE_ROUTE_MANAGE_STEWARDS_OUT_PROVINCE_TRUE,
|
||||
ROUTES.ROUTE_ADMINX_ROUTE_MANAGE_STEWARDS_OUT_PROVINCE_LEGAL,
|
||||
ROUTES.ROUTE_SUPER_ADMIN_ROUTE_MANAGE_STEWARDS_OUT_PROVINCE_LEGAL,
|
||||
ROUTES.ROUTE_PROVINCE_ROUTE_MANAGE_STEWARDS_OUT_PROVINCE_LEGAL,
|
||||
ROUTES.ROUTE_ADMINX_ROUTE_MANAGE_STEWARDS_IN_PROVINCE_TRUE,
|
||||
ROUTES.ROUTE_SUPER_ADMIN_ROUTE_MANAGE_STEWARDS_IN_PROVINCE_TRUE,
|
||||
ROUTES.ROUTE_PROVINCE_ROUTE_MANAGE_STEWARDS_IN_PROVINCE_TRUE,
|
||||
],
|
||||
Page: ManageStewards,
|
||||
exact: false,
|
||||
|
||||
Reference in New Issue
Block a user