add badge for sidebar

This commit is contained in:
Amirhossein Mahmoodi
2024-08-27 13:00:17 +03:30
parent 1bd0f7f606
commit cb2248e108
7 changed files with 80 additions and 3 deletions

View File

@@ -0,0 +1,14 @@
export const getValueByPath = (obj, path) => {
const keys = path.split(".");
let value = obj;
for (const key of keys) {
if (value === undefined) {
return undefined;
}
value = value[key];
}
return value;
}

View File

@@ -91,6 +91,7 @@ export const pageMenu = [
type: "menu",
icon: <FactCheckIcon sx={{ width: "inherit", height: "inherit" }} />,
hasSubitems: true,
badges: ['road_items.total'],
Subitems: [
{
id: "roadItemManagmentSupervisor",
@@ -98,6 +99,7 @@ export const pageMenu = [
type: "menu",
icon: <SpeedIcon sx={{ width: "inherit", height: "inherit" }} />,
hasSubitems: true,
badges: ['road_items.supervise_cnt'],
Subitems: [
{
id: "roadItemManagmentSupervisorCartable",
@@ -117,6 +119,7 @@ export const pageMenu = [
type: "menu",
icon: <EngineeringIcon sx={{ width: "inherit", height: "inherit" }} />,
hasSubitems: true,
badges: ['road_items.operation_cnt'],
Subitems: [
{
id: "roadItemManagmentOparationCreate",
@@ -166,6 +169,7 @@ export const pageMenu = [
type: "menu",
icon: <FireTruckIcon sx={{ width: "inherit", height: "inherit" }} />,
hasSubitems: true,
badges: ['road_patrols.total'],
Subitems: [
{
id: "roadPatrolManagmentSupervisor",
@@ -173,6 +177,7 @@ export const pageMenu = [
type: "menu",
icon: <SpeedIcon sx={{ width: "inherit", height: "inherit" }} />,
hasSubitems: true,
badges: ['road_patrols.supervise_cnt'],
Subitems: [
{
id: "roadPatrolManagmentSupervisorCartable",
@@ -192,6 +197,7 @@ export const pageMenu = [
type: "menu",
icon: <EngineeringIcon sx={{ width: "inherit", height: "inherit" }} />,
hasSubitems: true,
badges: ['road_patrols.operation_cnt'],
Subitems: [
{
id: "roadPatrolManagmentOparationCreate",
@@ -271,6 +277,7 @@ export const pageMenu = [
type: "menu",
icon: <RouteIcon sx={{ width: "inherit", height: "inherit" }} />,
hasSubitems: true,
badges: ['safety_and_privacy.step_one', 'safety_and_privacy.step_two'],
Subitems: [
{
id: "safetyAndPrivacyManagmentOparation",
@@ -333,6 +340,7 @@ export const pageMenu = [
type: "menu",
icon: <ElectricBoltIcon sx={{ width: "inherit", height: "inherit" }} />,
hasSubitems: true,
badges: ['road_observations.total'],
Subitems: [
{
id: "roadObservationsManagmentSupervisor",
@@ -340,6 +348,7 @@ export const pageMenu = [
type: "menu",
icon: <SpeedIcon sx={{ width: "inherit", height: "inherit" }} />,
hasSubitems: true,
badges: ['road_observations.supervise_cnt'],
Subitems: [
{
id: "roadObservationsManagmentSupervisorCartable",
@@ -364,6 +373,7 @@ export const pageMenu = [
type: "menu",
icon: <EngineeringIcon sx={{ width: "inherit", height: "inherit" }} />,
hasSubitems: true,
badges: ['road_observations.operation_cnt'],
Subitems: [
{
id: "roadObservationsManagmentOparationCartable",

View File

@@ -4,5 +4,6 @@ export const GET_USER_ROUTE = api + "/webapi/user/get-permission";
export const GET_LOGIN_ROUTE = api + "/login_dev";
export const GET_INQUIRY_PRIVACY_FENCING_ROUTE = api + "/api/v3/harim/divarkeshi";
export const GET_PERMISSIONS_ROUTE = api + "/webapi/user/get-permission";
export const GET_SIDEBAR_BADGE_ROUTE = api + "/v2/activity_statistics";
export const SET_INQUIRE_PRIVACY_FENCING = api + "/api/v3/harim/divarkeshi/store";