import { Component , OnInit } from '@angular/core' ; import { ActivatedRoute } from "@angular/router" ; import { GroupService } from "../../services/groups/group.service" ; import { UtilsService } from "../../services/utils.service" ; import { PendingApprovalActionsComponent } from "../../secondary-components/pending-approval-actions/pending-approval-actions.component" ; import { TableHeader } from "../../models/table-header.model" ; import { ContextService } from "../../services/context.service" ; import { UsersUtilsService } from "../../services/users/users-utils.service" ; import * as _ from "lodash" ; @ Component ( { selector : 'app-pending-approval' , templateUrl : './pending-approval.component.html' , styleUrls : [ './pending-approval.component.scss' ] } ) export class PendingApprovalComponent implements OnInit { public requestsSent ; public tableConfig ; public user ; public allGroups ; constructor ( private activatedRoute , private groupService , private context , private usersUtils , private utils ) { this . requestsSent = this . activatedRoute . snapshot . data [ 'requestsSent' ] ; this . user = this . context . getUser ( ) ; this . allGroups = this . context . getAllGroups ( ) ; this . tableConfig = { selectable : false , headers : [ new TableHeader ( 'Group Name' , '' , 'function' , ( element ) => { return _ . find ( this . allGroups , { id : element . object } ) . name ; } ) , new TableHeader ( 'Reason' , 'openReason' , 'string' ) , new TableHeader ( 'Owner' , '' , 'function' , ( element ) => { let group = _ . find ( this . allGroups , { id : element . object } ) ; return this . usersUtils . displayOwners ( group , this . user ) ; } ) , ] , actionsComponent : PendingApprovalActionsComponent } ; } ngOnInit ( ) { } }