import { Router, ActivatedRoute } from '@angular/router'; import { MdDialog, MdDialogConfig } from '@angular/material'; import { ITdDataTableColumn, ITdDataTableSortChangeEvent, TdDataTableService, TdDataTableSortingOrder, TdPagingBarComponent } from '@covalent/core'; import { IPageChangeEvent } from '@covalent/core'; import { Component, ViewChild, AfterViewInit } from '@angular/core'; import { TdMediaService } from '@covalent/core'; import { OrganizationsService } from '../resources/organizations'; import { PackFormComponent } from '../forms/pack.form.component'; import { LocaleService } from '../common/i18n'; import { ListingBase } from './base'; var org_example = { id: 1, code: 'BP01', creation_timestamp: 1418384454000, name: 'British Petroleum', org_parent_id:2, org_parent_name:"CurisTec", users_ids: [ 'rym' ] } @Component({ selector: 'organization-list', templateUrl: 'src/app/listing/organization.list.component.html' }) export class OrganizationListComponent extends ListingBase implements AfterViewInit { columns: ITdDataTableColumn[] = [ { name: 'code', label: 'Code', tooltip: 'Organization code' }, { name: 'name', label: 'Organization name' }, { name: 'creation_timestamp', label: 'Creation date' }, { name: 'menu', label: '' } ]; pack_menu_options : any[] = [{ command: 'edit', name: 'Edit' },{ command: 'cancel', name: 'Cancel' }] constructor(_dataTableService: TdDataTableService, private media: TdMediaService, private router: Router, private $L: LocaleService, private applicationForm: PackFormComponent, private organizations: OrganizationsService) { super(_dataTableService); this.organizations.get().subscribe( (list : any[]) => { this.data = list; this.refresh(); }, (err: any) => console.error(err) ); } showRelatedPacks(org : any) : void { this.router.navigate(['packs/'], {queryParams: {organizationId: org.id, name: org.name}}); } isActionAvailable(org : any) : boolean { return true; } create() : void { this.router.navigate(['organizations/create']); } edit(eleId: number | string) : void { this.router.navigate([`organizations/edit/${eleId}`]); } }