César Calvo
2017-03-15 abb9cc75e166c32cfa97244c497e6a69d14ea114
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<md-toolbar role="toolbar" class="mat-secondary">
  <span class="push-left-sm">
      <span class="md-title" i18n>License Packs</span>
  </span>
  <span class="push-left-sm" *ngIf="filteredItems < data.length">
      <span class="md-body-1">{{filteredItems}} of {{data.length}} packs filtered</span>
  </span>
  <td-search-box #searchBox class="push-right-sm" placeholder="Search here" (searchDebounce)="search($event)" flex>
  </td-search-box>
  <button md-mini-fab color="accent" (click)="createPack()">
      <md-icon>add</md-icon>
    </button>
</md-toolbar>
<md-divider></md-divider>
<div layout="row" layout-align="center center">
  <div flex="80" layout="column" layout-align="end center" >
<td-data-table [data]="filteredData" [columns]="columns" style="width: 100%">
  <template tdDataTableTemplate="used_licenses" let-row="row">
    <div layout="row">
        <td-notification-count color="secondary" [notifications]="row['num_licenses']">
        </td-notification-count>
        <td-notification-count color="primary" [notifications]="row['num_available']">
        </td-notification-count>
    </div>
  </template>
  <template tdDataTableTemplate="code" let-row="row" let-value="value">
    <div layout="row" layout-align="start center">
      <span style="white-space: nowrap">{{value}}</span>
    </div>
  </template>
  <template tdDataTableTemplate="menu" let-row="row" let-index="index">
    <div layout="row" layout-align="end center">
      <button md-icon-button (click)="editPack(row)" color="primary"><md-icon>edit</md-icon></button>
      <button md-icon-button [mdMenuTriggerFor]="packMenu" aria-label="Pack menu">
        <md-icon>more_vert</md-icon>
      </button>
       
      <md-menu #packMenu="mdMenu">
          <button md-menu-item *ngFor="let action of pack_menu_options" (click)="packAction(action.command, row)" [disabled]="!isActionAvailable(row)">
            <md-icon *ngIf="!!action.icon">{{ action.icon }}</md-icon> {{ action.name }}
          </button>
      </md-menu>
      <button md-icon-button (click)="showLicenses(row)" color="accent"><md-icon>arrow_forward</md-icon></button>
    </div>
  </template>
</td-data-table>
<td-paging-bar #pagingBar [pageSizes]="[10, 20, 40]" [total]="filteredTotal" (change)="page($event)" align="end">
  <span td-paging-bar-label hide-xs>Rows per page:</span> {{pagingBar.range}} <span hide-xs>of {{pagingBar.total}}</span>
</td-paging-bar>
</div>
</div>