formatting
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
export function filterMenuItems(items, _permissions = []) {
|
||||
return items.reduce((acc, item) => {
|
||||
if (item.permissions) {
|
||||
if (item.permissions.some(permission => _permissions.includes(permission))) {
|
||||
if (item.permissions.some((permission) => _permissions.includes(permission))) {
|
||||
acc.push(item);
|
||||
}
|
||||
} else if (item.hasSubitems) {
|
||||
@@ -14,4 +14,4 @@ export function filterMenuItems(items, _permissions = []) {
|
||||
}
|
||||
return acc;
|
||||
}, []);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Security } from "@mui/icons-material";
|
||||
const prefix = process.env.NODE_ENV === 'production' ? '/v3' : ''
|
||||
const prefix = process.env.NODE_ENV === "production" ? "/v3" : "";
|
||||
|
||||
export const pageMenu = [
|
||||
{
|
||||
@@ -8,7 +8,7 @@ export const pageMenu = [
|
||||
type: "page",
|
||||
route: prefix + "/dashboard",
|
||||
icon: <Security sx={{ width: "inherit", height: "inherit" }} />,
|
||||
permissions: ["all"]
|
||||
permissions: ["all"],
|
||||
},
|
||||
{
|
||||
id: "userManagement",
|
||||
@@ -16,7 +16,7 @@ export const pageMenu = [
|
||||
type: "page",
|
||||
route: process.env.NEXT_PUBLIC_API_URL + "/v2/user_management",
|
||||
icon: <Security sx={{ width: "inherit", height: "inherit" }} />,
|
||||
permissions: ['full-user-management', 'limited-user-management']
|
||||
permissions: ["full-user-management", "limited-user-management"],
|
||||
},
|
||||
{
|
||||
id: "projectsManagment",
|
||||
@@ -31,7 +31,7 @@ export const pageMenu = [
|
||||
type: "page",
|
||||
route: process.env.NEXT_PUBLIC_API_URL + "/v2/rahdari_projects/finance",
|
||||
icon: <Security sx={{ width: "inherit", height: "inherit" }} />,
|
||||
permissions: ['show-contract', 'show-contract-province'],
|
||||
permissions: ["show-contract", "show-contract-province"],
|
||||
},
|
||||
{
|
||||
id: "projectsManagmentList",
|
||||
@@ -39,7 +39,7 @@ export const pageMenu = [
|
||||
type: "page",
|
||||
route: process.env.NEXT_PUBLIC_API_URL + "/v2/rahdari_projects/projects_list",
|
||||
icon: <Security sx={{ width: "inherit", height: "inherit" }} />,
|
||||
permissions: ["all"]
|
||||
permissions: ["all"],
|
||||
},
|
||||
{
|
||||
id: "projectsManagmentProposal",
|
||||
@@ -47,7 +47,7 @@ export const pageMenu = [
|
||||
type: "page",
|
||||
route: process.env.NEXT_PUBLIC_API_URL + "/v2/rahdari_projects/proposal",
|
||||
icon: <Security sx={{ width: "inherit", height: "inherit" }} />,
|
||||
permissions: ['show-proposal', 'show-proposal-province']
|
||||
permissions: ["show-proposal", "show-proposal-province"],
|
||||
},
|
||||
{
|
||||
id: "projectsManagmentLawmaker",
|
||||
@@ -55,7 +55,7 @@ export const pageMenu = [
|
||||
type: "page",
|
||||
route: process.env.NEXT_PUBLIC_API_URL + "/v2/rahdari_projects/lawmakers",
|
||||
icon: <Security sx={{ width: "inherit", height: "inherit" }} />,
|
||||
permissions: ['show-lawmaker', 'show-lawmaker-province']
|
||||
permissions: ["show-lawmaker", "show-lawmaker-province"],
|
||||
},
|
||||
{
|
||||
id: "projectsManagmentMap",
|
||||
@@ -63,7 +63,7 @@ export const pageMenu = [
|
||||
type: "page",
|
||||
route: process.env.NEXT_PUBLIC_API_URL + "/v2/map?type=rahdari_projects",
|
||||
icon: <Security sx={{ width: "inherit", height: "inherit" }} />,
|
||||
permissions: ["all"]
|
||||
permissions: ["all"],
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -86,7 +86,10 @@ export const pageMenu = [
|
||||
label: "کارتابل",
|
||||
type: "page",
|
||||
route: process.env.NEXT_PUBLIC_API_URL + "/v2/road_items/supervisor/cartable",
|
||||
permissions: ['show-road-item-supervise-cartable', 'show-road-item-supervise-cartable-province']
|
||||
permissions: [
|
||||
"show-road-item-supervise-cartable",
|
||||
"show-road-item-supervise-cartable-province",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -102,14 +105,14 @@ export const pageMenu = [
|
||||
label: "ثبت فعالیت",
|
||||
type: "page",
|
||||
route: process.env.NEXT_PUBLIC_API_URL + "/v2/road_items/operator/create",
|
||||
permissions: ['create-road-item']
|
||||
permissions: ["create-road-item"],
|
||||
},
|
||||
{
|
||||
id: "roadItemManagmentOparationCartable",
|
||||
label: "کارتابل",
|
||||
type: "page",
|
||||
route: process.env.NEXT_PUBLIC_API_URL + "/v2/road_items/operator/cartable",
|
||||
permissions: ['create-road-item']
|
||||
permissions: ["create-road-item"],
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -119,7 +122,11 @@ export const pageMenu = [
|
||||
type: "page",
|
||||
route: process.env.NEXT_PUBLIC_API_URL + "/v2/map?type=road_items",
|
||||
icon: <Security sx={{ width: "inherit", height: "inherit" }} />,
|
||||
permissions: ['show-road-item-supervise-cartable', 'show-road-item-supervise-cartable-province', 'create-road-item']
|
||||
permissions: [
|
||||
"show-road-item-supervise-cartable",
|
||||
"show-road-item-supervise-cartable-province",
|
||||
"create-road-item",
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "roadItemManagmentReport",
|
||||
@@ -127,7 +134,11 @@ export const pageMenu = [
|
||||
type: "page",
|
||||
route: process.env.NEXT_PUBLIC_API_URL + "/v2/road_items/report",
|
||||
icon: <Security sx={{ width: "inherit", height: "inherit" }} />,
|
||||
permissions: ['show-road-item-supervise-cartable', 'show-road-item-supervise-cartable-province', 'create-road-item']
|
||||
permissions: [
|
||||
"show-road-item-supervise-cartable",
|
||||
"show-road-item-supervise-cartable-province",
|
||||
"create-road-item",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -150,7 +161,10 @@ export const pageMenu = [
|
||||
label: "کارتابل",
|
||||
type: "page",
|
||||
route: process.env.NEXT_PUBLIC_API_URL + "/road_patrols/supervisor/cartable",
|
||||
permissions: ['show-road-patrol-supervise-cartable', 'show-road-patrol-supervise-cartable-province']
|
||||
permissions: [
|
||||
"show-road-patrol-supervise-cartable",
|
||||
"show-road-patrol-supervise-cartable-province",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -166,14 +180,14 @@ export const pageMenu = [
|
||||
label: "ثبت اقدام",
|
||||
type: "page",
|
||||
route: process.env.NEXT_PUBLIC_API_URL + "/v2/road_patrols/operator/create",
|
||||
permissions: ['add-road-patrol']
|
||||
permissions: ["add-road-patrol"],
|
||||
},
|
||||
{
|
||||
id: "roadPatrolManagmentOparationCartable",
|
||||
label: "کارتابل",
|
||||
type: "page",
|
||||
route: process.env.NEXT_PUBLIC_API_URL + "/v2/road_patrols/operator/cartable",
|
||||
permissions: ['add-road-patrol']
|
||||
permissions: ["add-road-patrol"],
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -183,7 +197,11 @@ export const pageMenu = [
|
||||
type: "page",
|
||||
route: process.env.NEXT_PUBLIC_API_URL + "/v2/map?type=road_patrols",
|
||||
icon: <Security sx={{ width: "inherit", height: "inherit" }} />,
|
||||
permissions: ['add-road-patrol', 'show-road-patrol-supervise-cartable', 'show-road-patrol-supervise-cartable-province']
|
||||
permissions: [
|
||||
"add-road-patrol",
|
||||
"show-road-patrol-supervise-cartable",
|
||||
"show-road-patrol-supervise-cartable-province",
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "roadPatrolManagmentReport",
|
||||
@@ -191,7 +209,11 @@ export const pageMenu = [
|
||||
type: "page",
|
||||
route: process.env.NEXT_PUBLIC_API_URL + "/v2/road_patrols/report",
|
||||
icon: <Security sx={{ width: "inherit", height: "inherit" }} />,
|
||||
permissions: ['add-road-patrol', 'show-road-patrol-supervise-cartable', 'show-road-patrol-supervise-cartable-province']
|
||||
permissions: [
|
||||
"add-road-patrol",
|
||||
"show-road-patrol-supervise-cartable",
|
||||
"show-road-patrol-supervise-cartable-province",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -207,23 +229,23 @@ export const pageMenu = [
|
||||
label: "احداث و بهره برداری دیوارکشی و مستحدثات",
|
||||
type: "page",
|
||||
route: prefix + "/dashboard/inquiry_privacy/fencing",
|
||||
permissions: ['all']
|
||||
permissions: ["all"],
|
||||
},
|
||||
{
|
||||
id: "inquiryPrivacyManagmentRoad",
|
||||
label: "احداث راه دسترسی اختصاصی",
|
||||
type: "page",
|
||||
route: prefix + "/dashboard/inquiry_privacy/road",
|
||||
permissions: ['all']
|
||||
permissions: ["all"],
|
||||
},
|
||||
{
|
||||
id: "inquiryPrivacyManagmentInfrastructure",
|
||||
label: "احداث و بهره برداری تاسیسات زیربنایی",
|
||||
type: "page",
|
||||
route: prefix + "/dashboard/inquiry_privacy/infrastructure",
|
||||
permissions: ['all']
|
||||
permissions: ["all"],
|
||||
},
|
||||
]
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "safetyAndPrivacyManagment",
|
||||
@@ -244,14 +266,18 @@ export const pageMenu = [
|
||||
label: "ثبت فعالیت",
|
||||
type: "page",
|
||||
route: process.env.NEXT_PUBLIC_API_URL + "/safety_and_privacy/operator/first_step",
|
||||
permissions: ['add-safety-and-privacy']
|
||||
permissions: ["add-safety-and-privacy"],
|
||||
},
|
||||
{
|
||||
id: "safetyAndPrivacyManagmentOparationCartable",
|
||||
label: "کارتابل",
|
||||
type: "page",
|
||||
route: process.env.NEXT_PUBLIC_API_URL + "/v2/safety_and_privacy/operator/cartable",
|
||||
permissions: ['show-safety-and-privacy-operator-cartable', 'show-safety-and-privacy-operator-cartable-province', 'show-safety-and-privacy-operator-cartable-edarate-shahri']
|
||||
permissions: [
|
||||
"show-safety-and-privacy-operator-cartable",
|
||||
"show-safety-and-privacy-operator-cartable-province",
|
||||
"show-safety-and-privacy-operator-cartable-edarate-shahri",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -261,8 +287,12 @@ export const pageMenu = [
|
||||
type: "page",
|
||||
route: process.env.NEXT_PUBLIC_API_URL + "/v2/map?type=safety_and_privacy",
|
||||
icon: <Security sx={{ width: "inherit", height: "inherit" }} />,
|
||||
permissions: ['show-safety-and-privacy-operator-cartable', 'show-safety-and-privacy-operator-cartable-province',
|
||||
'show-safety-and-privacy-operator-cartable-edarate-shahri', 'add-safety-and-privacy']
|
||||
permissions: [
|
||||
"show-safety-and-privacy-operator-cartable",
|
||||
"show-safety-and-privacy-operator-cartable-province",
|
||||
"show-safety-and-privacy-operator-cartable-edarate-shahri",
|
||||
"add-safety-and-privacy",
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "safetyAndPrivacyManagmentReport",
|
||||
@@ -270,8 +300,12 @@ export const pageMenu = [
|
||||
type: "page",
|
||||
route: process.env.NEXT_PUBLIC_API_URL + "/v2/safety_and_privacy/report",
|
||||
icon: <Security sx={{ width: "inherit", height: "inherit" }} />,
|
||||
permissions: ['show-safety-and-privacy-operator-cartable', 'show-safety-and-privacy-operator-cartable-province',
|
||||
'show-safety-and-privacy-operator-cartable-edarate-shahri', 'add-safety-and-privacy']
|
||||
permissions: [
|
||||
"show-safety-and-privacy-operator-cartable",
|
||||
"show-safety-and-privacy-operator-cartable-province",
|
||||
"show-safety-and-privacy-operator-cartable-edarate-shahri",
|
||||
"add-safety-and-privacy",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -294,7 +328,7 @@ export const pageMenu = [
|
||||
label: "کارتابل",
|
||||
type: "page",
|
||||
route: process.env.NEXT_PUBLIC_API_URL + "/v2/road_observations/supervisor/cartable",
|
||||
permissions: ['supervise-fast-react', 'supervise-fast-react-province']
|
||||
permissions: ["supervise-fast-react", "supervise-fast-react-province"],
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -304,7 +338,7 @@ export const pageMenu = [
|
||||
type: "page",
|
||||
route: process.env.NEXT_PUBLIC_API_URL + "/v2/road_observations",
|
||||
icon: <Security sx={{ width: "inherit", height: "inherit" }} />,
|
||||
permissions: ['show-fast-react', 'show-fast-react-province', 'show-fast-react-edarate-shahri']
|
||||
permissions: ["show-fast-react", "show-fast-react-province", "show-fast-react-edarate-shahri"],
|
||||
},
|
||||
{
|
||||
id: "roadObservationsManagmentOparation",
|
||||
@@ -318,7 +352,7 @@ export const pageMenu = [
|
||||
label: "کارتابل",
|
||||
type: "page",
|
||||
route: process.env.NEXT_PUBLIC_API_URL + "/v2/road_observations/operator/cartable",
|
||||
permissions: ['show-fast-react', 'show-fast-react-province', 'show-fast-react-edarate-shahri']
|
||||
permissions: ["show-fast-react", "show-fast-react-province", "show-fast-react-edarate-shahri"],
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -328,7 +362,7 @@ export const pageMenu = [
|
||||
type: "page",
|
||||
route: process.env.NEXT_PUBLIC_API_URL + "/v2/map?type=road_observations",
|
||||
icon: <Security sx={{ width: "inherit", height: "inherit" }} />,
|
||||
permissions: ["all"]
|
||||
permissions: ["all"],
|
||||
},
|
||||
{
|
||||
id: "roadObservationsManagmentReport",
|
||||
@@ -336,7 +370,7 @@ export const pageMenu = [
|
||||
type: "page",
|
||||
route: process.env.NEXT_PUBLIC_API_URL + "/v2/road_observations/report/index",
|
||||
icon: <Security sx={{ width: "inherit", height: "inherit" }} />,
|
||||
permissions: ["all"]
|
||||
permissions: ["all"],
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -353,7 +387,7 @@ export const pageMenu = [
|
||||
type: "page",
|
||||
route: process.env.NEXT_PUBLIC_API_URL + "/v2/winter_camp",
|
||||
icon: <Security sx={{ width: "inherit", height: "inherit" }} />,
|
||||
permissions: ['show-camp', 'show-camp-province']
|
||||
permissions: ["show-camp", "show-camp-province"],
|
||||
},
|
||||
{
|
||||
id: "winterCampManagmentFirstRing",
|
||||
@@ -361,7 +395,7 @@ export const pageMenu = [
|
||||
type: "page",
|
||||
route: process.env.NEXT_PUBLIC_API_URL + "/v2/map?type=camp",
|
||||
icon: <Security sx={{ width: "inherit", height: "inherit" }} />,
|
||||
permissions: ['show-camp', 'show-camp-province']
|
||||
permissions: ["show-camp", "show-camp-province"],
|
||||
},
|
||||
{
|
||||
id: "winterCampManagmentReport",
|
||||
@@ -369,7 +403,7 @@ export const pageMenu = [
|
||||
type: "page",
|
||||
route: process.env.NEXT_PUBLIC_API_URL + "/v2/map?type=campNew",
|
||||
icon: <Security sx={{ width: "inherit", height: "inherit" }} />,
|
||||
permissions: ['show-camp', 'show-camp-province']
|
||||
permissions: ["show-camp", "show-camp-province"],
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -392,7 +426,7 @@ export const pageMenu = [
|
||||
label: "کارتابل",
|
||||
type: "page",
|
||||
route: process.env.NEXT_PUBLIC_API_URL + "/v2/receipt",
|
||||
permissions: ["all"]
|
||||
permissions: ["all"],
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -402,7 +436,7 @@ export const pageMenu = [
|
||||
type: "page",
|
||||
route: process.env.NEXT_PUBLIC_API_URL + "/v2/receipt/report",
|
||||
icon: <Security sx={{ width: "inherit", height: "inherit" }} />,
|
||||
permissions: ["all"]
|
||||
permissions: ["all"],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
@@ -3,4 +3,4 @@ const api = process.env.NEXT_PUBLIC_API_URL;
|
||||
export const GET_USER_ROUTE = api + "/webapi/user/get-permission";
|
||||
export const GET_LOGIN_ROUTE = api + "/login_dev";
|
||||
|
||||
export const GET_PERMISSIONS_ROUTE = api + "/webapi/user/get-permission";
|
||||
export const GET_PERMISSIONS_ROUTE = api + "/webapi/user/get-permission";
|
||||
|
||||
Reference in New Issue
Block a user