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