role-access.component.ts 2.18 KB
import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-role-access',
  templateUrl: './role-access.component.html',
  styleUrls: ['./role-access.component.scss']
})
export class RoleAccessComponent implements OnInit {

  roleAccessDataSource = ROLE_ACCESS_DATA;
  current_item = 0;

  constructor() { }

  ngOnInit() { }

  triggerCheckBoxEventrow(event, n: number) {
    let data = this.roleAccessDataSource.find(i => i.id === this.current_item)
    if (event.checked) {
      data.isDisabled = n + 1;
    } else {
      data.isDisabled = n;
    }
    return;
  }
}

export interface RoleAccessDataElement {
  id: number;
  menu: string;
  childMenu: string;
  status: number;
  operation: string;
  action: string;
  isDisabled: number;
}
const ROLE_ACCESS_DATA: RoleAccessDataElement[] = [
  {
    id: 1,
    menu: "Search",
    childMenu: "Operation Log",
    status: 0,
    operation: "",
    action: "Edit | Delete",
    isDisabled: 1

  }, {
    id: 2,
    menu: "Search",
    childMenu: "Transfer History",
    status: 0,
    operation: "",
    action: "Edit | Delete",
    isDisabled: 1
  }, {
    id: 3,
    menu: "Manage Player",
    childMenu: "View Player",
    status: 0,
    operation: "",
    action: "Edit | Delete",
    isDisabled: 1
  }, {
    id: 4,
    menu: "Manage Payment",
    childMenu: "Deposits",
    status: 0,
    operation: "",
    action: "Edit | Delete",
    isDisabled: 1
  }, {
    id: 5,
    menu: "Manage Payment",
    childMenu: "Withdrawals",
    status: 0,
    operation: "",
    action: "Edit | Delete",
    isDisabled: 1
  }, {
    id: 6,
    menu: "Manage Operator",
    childMenu: "View Operator",
    status: 0,
    operation: "Add",
    action: "Edit | Delete",
    isDisabled: 1
  }, {
    id: 7,
    menu: "Manage Affiliate",
    childMenu: "View Affiliates",
    status: 0,
    operation: "Add",
    action: "Edit | Delete",
    isDisabled: 1
  }, {
    id: 8,
    menu: "Manage Role",
    childMenu: "View Roles",
    status: 0,
    operation: "",
    action: "Edit | Delete",
    isDisabled: 1
  }, {
    id: 9,
    menu: "Manage Role",
    childMenu: "Role Access",
    status: 0,
    operation: "",
    action: "Edit | Delete",
    isDisabled: 1
  }
];