menu.service.ts 1.75 KB
import { Injectable } from '@angular/core';

export interface BadgeItem {
  type: string;
  value: string;
}

export interface ChildrenItems {
  state: string;
  name: string;
  type?: string;
}

export interface Menu {
  state: string;
  name: string;
  type: string;
  icon: string;
  badge?: BadgeItem[];
  children?: ChildrenItems[];
}

const MENUITEMS = [
  {
    state: '/',
    name: 'Dashboard',
    type: 'link',
    icon: 'explore'
  },
  {
    state: 'search',
    name: 'Search',
    type: 'sub',
    icon: 'search',
    children: [{ state: 'transfer-history', name: 'Transfer History' },
    { state: 'operation-log', name: 'Operation Logs' }]
  },
  {
    state: 'manage-players',
    name: 'Manage Players',
    type: 'sub',
    icon: 'directions_run',
    children: [{ state: 'view-players', name: 'View Players' },
    ]
  },
  {
    state: 'manage-payments',
    name: 'Manage Payments',
    type: 'sub',
    icon: 'payment',
    children: [{ state: 'deposits', name: 'Deposits' },
    { state: 'withdrawals', name: 'Withdrawals' }]
  },
  {
    state: 'manage-affiliates',
    name: 'Manage Affiliates',
    type: 'sub',
    icon: 'person ',
    children: [{ state: 'view-affiliates', name: 'View Affiliates' }]
  },
  {
    state: 'manage-operators',
    name: 'Manage Operators',
    type: 'sub',
    icon: 'airline_seat_recline_extra',
    children: [{ state: 'view-operators', name: 'View Operators' }]
  },
  {
    state: 'manage-roles',
    name: 'Manage  Roles',
    type: 'sub',
    icon: 'group_work',
    children: [{ state: 'view-roles', name: 'View Roles' },
    { state: 'role-access', name: 'Role Access' }]
  },
];

@Injectable()
export class MenuService {
  getAll(): Menu[] {
    return MENUITEMS;
  }

  add(menu: Menu) {
    MENUITEMS.push(menu);
  }
}