<div id="page_content">
  <div class="uk-padding-small md-bg-white" uk-grid>
    <div *ngIf="filters" class="uk-width-2-3@m uk-width-1-1 uk-child-width-1-3@m uk-child-width-1-1" uk-grid>
      <div>
        <div dashboard-input [formInput]="filters.get('privacy')"
             type="select" [options]="[all].concat(stakeholderUtils.isPublic)"
             label="Privacy"></div>
      </div>
      <div>
        <div dashboard-input [formInput]="filters.get('status')"
             type="select" [options]="[all].concat(stakeholderUtils.isActive)"
             label="Status"></div>
      </div>
    </div>
    <div class="uk-width-expand@m uk-width-1-1 uk-flex uk-flex-middle uk-flex-right">
      <div class="uk-inline uk-width-medium">
        <span class="uk-position-center-right"><i class="material-icons">search</i></span>
        <div dashboard-input [formInput]="filters.get('keyword')" label="Locate Stakeholder"></div>
      </div>
      <div [class.uk-active]="grid" class="uk-margin-small-left">
        <a [routerLink]="" class="uk-icon-button" (click)="changeGrid(true)"><i
          class="material-icons">view_module</i></a>
      </div>
      <div [class.uk-active]="!grid" class="uk-margin-small-left">
        <a [routerLink]="" class="uk-icon-button" (click)="changeGrid(false)"><i class="material-icons">list</i></a>
      </div>
    </div>
  </div>
  <div id="page_content_inner">
    <h4 class="uk-text-bold main">Default Profiles</h4>
    <div [class.uk-child-width-1-4@m]="grid"
         [class.uk-child-width-1-3@s]="grid"
         [class.uk-child-width-1-1]="!grid"
         [class.max-width-large]="!grid"
         class="uk-grid-match uk-grid-small"
         uk-grid>
      <loading *ngIf="loading"></loading>
      <ng-template ngFor [ngForOf]="displayDefaultStakeholders" let-stakeholder let-i="index">
        <div *ngIf="stakeholder">
          <div class="md-card">
            <div class="md-card-toolbar">
              <div class="md-card-toolbar-actions" [class.uk-flex-middle]="!grid" [class.uk-flex]="!grid">
                <span *ngIf="!grid" class="uk-margin-medium-right uk-flex uk-flex-middle">
                  <i
                    class="material-icons md-24 uk-margin-small-right">{{stakeholderUtils.isPublicIcon.get(stakeholder.isPublic)}}</i>
                  {{(stakeholder.isPublic) ? 'Public' : 'Private'}}
                </span>
                <span *ngIf="!grid" class="uk-margin-medium-right uk-flex uk-flex-middle">
                  <i class="material-icons md-24 uk-margin-small-right"
                     [class.md-color-green-300]="stakeholder.isActive">{{stakeholderUtils.isActiveIcon}}</i>
                  {{(stakeholder.isActive) ? 'Active' : 'Inactive'}}
                </span>
                <div class="md-card-dropdown uk-inline">
                  <i class="md-icon material-icons">more_vert</i>
                  <div uk-dropdown="mode: click; pos: bottom-right" class="uk-padding-remove-horizontal">
                    <ul class="uk-nav uk-dropdown-nav">
                      <li><a (click)="editIndicatorOpen(i)">Edit</a></li>
                      <li><a (click)="deleteIndicatorOpen(i, 'number')">Delete</a></li>
                    </ul>
                  </div>
                </div>
              </div>
              <div class="md-card-toolbar-heading-text">{{stakeholder.index_name}}</div>
            </div>
            <div *ngIf="grid" class="md-card-content">
              <div class="uk-flex uk-flex-center" uk-grid>
                <div class="uk-width-1-2 uk-text-center">
                  <i class="material-icons md-24">{{stakeholderUtils.isPublicIcon.get(stakeholder.isPublic)}}</i>
                  <div>{{(stakeholder.isPublic) ? 'Public' : 'Private'}}</div>
                </div>
                <div class="uk-width-1-2 uk-text-center">
                  <i class="material-icons md-24"
                     [class.md-color-green-300]="stakeholder.isActive">{{stakeholderUtils.isActiveIcon}}</i>
                  <div>{{(stakeholder.isActive) ? 'Active' : 'Inactive'}}</div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </ng-template>
    </div>
    <h4 class="uk-text-bold">Stakeholders</h4>
    <div [class.uk-child-width-1-4@m]="grid"
         [class.uk-child-width-1-3@s]="grid"
         [class.uk-child-width-1-1]="!grid"
         [class.max-width-large]="!grid"
         class="uk-grid-match uk-grid-small"
         uk-grid>
      <loading *ngIf="loading"></loading>
      <ng-template ngFor [ngForOf]="displayStakeholders" let-stakeholder let-i="index">
        <a *ngIf="stakeholder" [routerLink]="stakeholder.alias">
          <div class="md-card">
            <div class="md-card-toolbar">
              <div class="md-card-toolbar-actions" [class.uk-flex-middle]="!grid" [class.uk-flex]="!grid">
                <span *ngIf="!grid" class="uk-margin-medium-right uk-flex uk-flex-middle">
                  <i
                    class="material-icons md-24 uk-margin-small-right">{{stakeholderUtils.isPublicIcon.get(stakeholder.isPublic)}}</i>
                  {{(stakeholder.isPublic) ? 'Public' : 'Private'}}
                </span>
                <span *ngIf="!grid" class="uk-margin-medium-right uk-flex uk-flex-middle">
                  <i class="material-icons md-24 uk-margin-small-right"
                     [class.md-color-green-300]="stakeholder.isActive">{{stakeholderUtils.isActiveIcon}}</i>
                  {{(stakeholder.isActive) ? 'Active' : 'Inactive'}}
                </span>
                <div class="md-card-dropdown uk-inline">
                  <i class="md-icon material-icons"
                     (click)="$event.stopPropagation();$event.preventDefault()">more_vert</i>
                  <div uk-dropdown="mode: click; pos: bottom-right" class="uk-padding-remove-horizontal">
                    <ul class="uk-nav uk-dropdown-nav">
                      <li><a
                        (click)="$event.stopPropagation();editStakeholder(stakeholder);$event.preventDefault()">Edit</a>
                      </li>
                      <li><a
                        (click)="$event.stopPropagation();deleteStakeholderOpen(stakeholder);$event.preventDefault()">Delete</a>
                      </li>
                    </ul>
                  </div>
                </div>
              </div>
              <div class="md-card-toolbar-heading-text">{{stakeholder.index_name}}</div>
            </div>
            <div *ngIf="grid" class="md-card-content">
              <div class="uk-flex uk-flex-center" uk-grid>
                <div class="uk-width-1-2 uk-text-center">
                  <i class="material-icons md-24">{{stakeholderUtils.isPublicIcon.get(stakeholder.isPublic)}}</i>
                  <div>{{(stakeholder.isPublic) ? 'Public' : 'Private'}}</div>
                </div>
                <div class="uk-width-1-2 uk-text-center">
                  <i class="material-icons md-24"
                     [class.md-color-green-300]="stakeholder.isActive">{{stakeholderUtils.isActiveIcon}}</i>
                  <div>{{(stakeholder.isActive) ? 'Active' : 'Inactive'}}</div>
                </div>
              </div>
            </div>
          </div>
        </a>
      </ng-template>
    </div>
  </div>
</div>
<modal-alert #editStakeholderModal
             (alertOutput)="saveStakeholder()"
             [okDisabled]="stakeholderFb && (stakeholderFb.invalid || (!stakeholderFb.dirty && index !==-1))">
  <div *ngIf="stakeholderFb" class="uk-padding-small" [formGroup]="stakeholderFb">
    <div dashboard-input class="uk-form-row" [formInput]="stakeholderFb.get('index_name')" label="Name"></div>
    <div class="uk-form-row uk-flex uk-flex-middle uk-child-width-1-3" uk-grid>
      <div dashboard-input [formInput]="stakeholderFb.get('index_id')"
           label="ID">
      </div>
      <div dashboard-input [formInput]="stakeholderFb.get('index_shortName')"
           label="Short name">
      </div>
      <div dashboard-input [formInput]="stakeholderFb.get('alias')"
           label="Alias">
      </div>
    </div>
    <div class="uk-form-row uk-flex uk-flex-middle uk-child-width-1-3" uk-grid>
      <div dashboard-input [formInput]="stakeholderFb.get('isPublic')"
           label="Privacy" [options]="stakeholderUtils.isPublic" type="select">
      </div>
      <div dashboard-input [formInput]="stakeholderFb.get('isActive')"
           label="Status" [options]="stakeholderUtils.isActive" type="select">
      </div>
      <div dashboard-input [formInput]="stakeholderFb.get('type')"
           label="Type" [options]="stakeholderUtils.types" type="select">
      </div>
    </div>
  </div>
</modal-alert>
<modal-alert #deleteStakeholderModal (alertOutput)="deleteStakeholder()"></modal-alert>
