  <div *ngIf="stakeholder && canEdit" >
    <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('chartType')"
               type="select" [options]="[all].concat(indicatorUtils.allChartTypes)"
               label="Chart Type"></div>
        </div>
        <div>
          <div dashboard-input [formInput]="filters.get('privacy')"
               type="select" [options]="[all].concat(indicatorUtils.isPublic)"
               label="Privacy"></div>
        </div>
        <div>
          <div dashboard-input [formInput]="filters.get('status')"
               type="select" [options]="[all].concat(indicatorUtils.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 indicator"></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 class="uk-child-width-1-2 uk-flex-middle" uk-grid>
     <!-- <div>
        <ul class="uk-breadcrumb">
          <li><span>{{stakeholder.topics[topicIndex].name}}</span></li>
          <li>
            <span>{{stakeholder.topics[topicIndex].categories[categoryIndex].name}}</span></li>
          <li>
            <span class="md-color-blue-900 uk-text-bold">
              {{stakeholder.topics[topicIndex].categories[categoryIndex].subCategories[subcategoryIndex].name}}
            </span>
          </li>
        </ul>
      </div>-->
      <div class="uk-flex uk-flex-right">
        <a class="md-btn  md-btn-primary waves-button waves-effect">
          <i class="material-icons uk-margin-small-right">remove_red_eye</i>
          Preview
          <i class="material-icons uk-margin-small-left">keyboard_arrow_down</i>
        </a>
        <div #element uk-dropdown="mode: click; pos: bottom-right; offset: 5; delay-hide: 0; flip: false"
             class="uk-padding-remove-horizontal">
          <ul class="uk-nav uk-dropdown-nav uk-margin-left">
            <li><a target="_blank" [routerLink]="preview" [queryParams]="{view: 'public'}" (click)="hide(element)">Public</a>
            </li>
            <li><a target="_blank" [routerLink]="preview" [queryParams]="{view: 'private'}" (click)="hide(element)">Private</a>
            </li>
          </ul>
        </div>
      </div>
    </div>
    <h4 class="uk-text-bold">Number Indicators</h4>
    <div *ngIf="numberSections">
      <ng-template ngFor [ngForOf]="displayNumbers" let-number let-i="index">
        <div [class.list-view]="!grid" [id]="'number-' + number._id" [class.section]="isAdministrator"
             class="uk-grid-match  uk-grid-small uk-grid uk-margin-top"
             uk-sortable="group: number" uk-grid>
          <div *ngIf="grid" class="tools disable-sortable uk-sortable-nodrag">
            <div *ngIf="isAdministrator" class="actions">
              <a [class.uk-disabled]="editing" class="" (click)="createSection(i, 'number')"
                      title="Create a new section"><i
                uk-icon="icon:plus;ratio:0.8"></i></a>
              <!--<button class="md-btn md-btn-mini"><i class="material-icons rotate-90">drag_indicator</i></button>-->
              <a [class.uk-disabled]="editing || number.defaultId  " class=""
                      [title]="(number.defaultId?'Default sections cannot be deleted':'Delete section')"
                      (click)="deleteSectionOpen(number, i, 'number', 'delete')"><i uk-icon="icon:close;ratio:0.8"></i>
              </a>
              <!--              <ng-container *ngIf="!stakeholder.defaultId">-->
              <!--                <button   [disabled]="editing || number.defaultId  " class="md-btn md-btn-mini"-->
              <!--                          [title]="(number.defaultId?'Default sections cannot be deleted':'Delete all related sections')"-->
              <!--                          (click)="deleteSectionOpen(number, i, 'number', 'delete')"><i class="material-icons">highlight_off</i>-->
              <!--                </button>-->
              <!--                <button   [disabled]="editing || number.defaultId  " class="md-btn md-btn-mini"-->
              <!--                          [title]="(number.defaultId?'Default sections cannot be deleted':'Delete section and disconnect related')"-->
              <!--                          (click)="deleteSectionOpen(number, i, 'number', 'disconnect')"><i class="material-icons">link_off</i>-->
              <!--                </button>-->
              <!--              </ng-container>-->
            </div>
          </div>
          <div *ngIf="grid && numberSections.at(i)"
               class="uk-form-row uk-width-1-1 uk-grid-medium uk-flex uk-flex-middle uk-margin-bottom disable-sortable uk-sortable-nodrag"
               uk-grid>
            <div dashboard-input class="uk-width-2-3 uk-width-1-3@m" [formInput]="numberSections.at(i).get('title')"
                 label="Add a section title"></div>
            <div class="uk-width-expand">
              <button *ngIf="numberSections.at(i).dirty" class="md-btn" [disabled]="editing"
                      (click)="saveSection(numberSections.at(i).value, i, 'number')">
                Save
              </button>
            </div>
          </div>
          <div *ngIf="!grid && number.title" class="uk-width-1-1 disable-sortable uk-sortable-nodrag">
            <h4>{{number.title}}</h4>
          </div>
          <ng-template ngFor [ngForOf]="number.indicators" let-indicator let-j="index">
            <div *ngIf="indicator" [id]="indicator._id"
                 [class.uk-width-1-5@m]="grid && indicator.width === 'small'"
                 [class.uk-width-1-3@m]="grid && indicator.width === 'medium'"
                 [class.uk-width-1-2@m]="!grid || indicator.width === 'large'"
                 [class.disable-sortable]="!canReorder"
                 [class.uk-sortable-nodrag]="!canReorder">
              <div class="uk-card uk-card-default" [class.md-card-hover]="canReorder">
                <div class="uk-padding-small uk-card-header">
                  <div class="md-card-toolbar-actions uk-float-right" [class.uk-flex-middle]="!grid" [class.uk-flex]="!grid">
                    <ng-template [ngIf]="!grid">
                      <div class="uk-margin-medium-right uk-flex uk-flex-middle">
                        <i class="material-icons md-24 uk-margin-small-right">{{indicatorUtils.isPublicIcon.get(indicator.isPublic)}}</i>
                        {{(indicator.isPublic) ? 'Public' : 'Private'}}
                      </div>
                      <div 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]="indicator.isActive">{{indicatorUtils.isActiveIcon}}</i>
                        {{(indicator.isActive) ? 'Active' : 'Inactive'}}
                      </div>
                    </ng-template>
                    <div class="md-card-dropdown uk-inline">
                      <i uk-icon="more-vertical"></i>
                      <div #element uk-dropdown="mode: click; pos: bottom-right; delay-hide: 0; flip: false"
                           class="uk-padding-remove-horizontal">
                        <ul class="uk-nav uk-dropdown-nav uk-margin-left">
                          <li *ngIf="isAdministrator && !indicator.defaultId && !editing"><a
                              (click)="editNumberIndicatorOpen(number, indicator._id)">Edit</a></li>
                          <li *ngIf="!editing"><a (click)="toggleIndicatorStatus(number._id, indicator);hide(element)">
                            {{indicator.isActive ? 'Inactive' : 'Active'}}</a>
                          </li>
                          <li *ngIf="!editing"><a (click)="toggleIndicatorAccess(number._id, indicator);hide(element)">
                            {{indicator.isPublic ? 'Private' : 'Public'}}</a>
                          </li>
                          <hr *ngIf="isAdministrator && !indicator.defaultId" class="uk-nav-divider">
                          <li *ngIf="isAdministrator && !indicator.defaultId && !editing"><a
                              (click)="deleteIndicatorOpen(number, indicator._id, 'number', 'delete');hide(element)">Delete</a>
                            <!--                            <ng-container *ngIf="!stakeholder.defaultId">-->
                            <!--                              <a (click)="deleteIndicatorOpen(number, indicator._id, 'number', 'delete');hide(element)">Delete from all profiles</a>-->
                            <!--                              <a (click)="deleteIndicatorOpen(number, indicator._id, 'number', 'disconnect');hide(element)">Delete and disconnect from all profiles</a>-->
                            <!--                            </ng-container>-->
                          </li>
                        </ul>
                      </div>
                    </div>
                  </div>
                  <div class="uk-card-title">
                    {{indicator.name ? indicator.name : 'No title available'}}
                  </div>
                </div>
                <div *ngIf="grid" class="uk-card-body">
                  <div class="uk-flex uk-flex-center" uk-grid>
                    <div class="uk-width-1-1">
                      {{indicator.description}}
                    </div>
                    <div class="uk-width-1-2 uk-text-center"
                         title="{{indicator.isPublic?'Visible to all users':'Visible to members'}}">
                      <i class="material-icons md-24">{{indicatorUtils.isPublicIcon.get(indicator.isPublic)}}</i>
                      <div>{{(indicator.isPublic) ? 'Public' : 'Private'}}</div>
                    </div>
                    <div class="uk-width-1-2 uk-text-center"
                         title="{{indicator.isActive?'Included in the indicators list':'Available only through administration dashboard'}}">
                      <i class="material-icons md-24"
                         [class.md-color-green-300]="indicator.isActive">{{indicatorUtils.isActiveIcon}}</i>
                      <div>{{(indicator.isActive) ? 'Active' : 'Inactive'}}</div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </ng-template>
          <div *ngIf="isAdministrator" class="disable-sortable uk-sortable-nodrag"
               [class.uk-width-1-3@m]="grid"
               [class.uk-width-1-1@m]="!grid">
            <div class="uk-card uk-card-default clickable" (click)="editNumberIndicatorOpen(number)">
              <div class="uk-padding-small uk-card-header">
                <div class="uk-card-title"
                     [class.uk-flex-middle]="!grid"
                     [class.uk-flex]="!grid"
                     [class.uk-flex-center]="!grid">
                  <i *ngIf="!grid" uk-icon="plus"></i>
                  <span>Create a custom Indicator</span>
                </div>
              </div>
              <div *ngIf="grid" class="uk-card-body">
                <div uk-grid>
                  <div class="uk-width-1-1">
                    Create a new number Indicator
                  </div>
                  <div class="uk-width-1-1 uk-flex uk-flex-center">
                    <i uk-icon="plus"></i>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </ng-template>
      <div *ngIf="grid && isAdministrator" class="new-section uk-margin-top">
        <div class="tools uk-flex uk-flex-middle">
          <button class="uk-margin-small-right uk-icon-button portal-button" (click)="createSection(-1, 'number')">
            <i  uk-icon="plus"></i>
          </button>
          <span>Create a new section</span>
        </div>
      </div>
    </div>
    <h4 class="uk-text-bold">Chart Indicators</h4>
    <div *ngIf="chartSections">
      <ng-template ngFor [ngForOf]="displayCharts" let-chart let-i="index">
        <div [class.list-view]="!grid" [id]="'chart-' + chart._id"
             class="uk-grid-match section uk-grid-small uk-grid uk-margin-top"
             uk-sortable="group: chart" uk-grid>
          <div *ngIf="grid" class="tools disable-sortable uk-sortable-nodrag">
            <div class="actions">
              <a [class.uk-disabled]="editing" class="" (click)="createSection(i)"
                      title="Create a new section"><i
                uk-icon="icon:plus;ratio:0.8"></i></a>
              <!--<button class="md-btn md-btn-mini"><i class="material-icons rotate-90">drag_indicator</i></button>-->
              <a [class.uk-disabled]="editing || chart.defaultId  "
                      [title]="(chart.defaultId?'Default sections cannot be deleted':'Delete section')"
                      class="" (click)="deleteSectionOpen(chart, i, 'chart', 'delete')"><i
                   uk-icon="icon:close;ratio:0.8"></i>
              </a>
              <!--              <ng-container *ngIf="!stakeholder.defaultId">-->
              <!--                <button   [disabled]="editing || chart.defaultId  " class="md-btn md-btn-mini"-->
              <!--                          [title]="(chart.defaultId?'Default sections cannot be deleted':'Delete all related sections')"-->
              <!--                          (click)="deleteSectionOpen(chart, i, 'chart', 'delete')"><i class="material-icons">highlight_off</i>-->
              <!--                </button>-->
              <!--                <button   [disabled]="editing || chart.defaultId  " class="md-btn md-btn-mini"-->
              <!--                          [title]="(chart.defaultId?'Default sections cannot be deleted':'Delete section and disconnect related')"-->
              <!--                          (click)="deleteSectionOpen(chart, i, 'chart', 'disconnect')"><i class="material-icons">link_off</i>-->
              <!--                </button>-->
              <!--              </ng-container>-->
            </div>
          </div>
          <div *ngIf="grid && chartSections.at(i)"
               class="uk-form-row uk-width-1-1 uk-grid-medium uk-flex uk-flex-middle uk-margin-bottom disable-sortable uk-sortable-nodrag"
               uk-grid>
            <div dashboard-input class="uk-width-2-3 uk-width-1-3@m" [formInput]="chartSections.at(i).get('title')"
                 label="Add a section title"></div>
            <div class="uk-width-expand">
              <button *ngIf="chartSections.at(i).dirty" class="md-btn" [disabled]="editing"
                      (click)="saveSection(chartSections.at(i).value, i)">
                Save
              </button>
            </div>
          </div>
          <div *ngIf="!grid && chart.title" class="uk-width-1-1 disable-sortable uk-sortable-nodrag">
            <h4>{{chart.title}}</h4>
          </div>
          <ng-template ngFor [ngForOf]="chart.indicators" let-indicator let-j="index">
            <div *ngIf="indicator" [id]="indicator._id"
                 [class.uk-width-1-3@m]="grid && indicator.width === 'small'"
                 [class.uk-width-1-2@m]="grid && indicator.width === 'medium'"
                 [class.uk-width-1-1@m]="!grid || indicator.width === 'large'"
                 [class.disable-sortable]="!canReorder"
                 [class.uk-sortable-nodrag]="!canReorder">
              <div class="uk-card uk-card-default" [class.md-card-hover]="canReorder">
                <div class="uk-padding-small uk-card-header">
                  <div class="md-card-toolbar-actions uk-float-right" [class.uk-flex-middle]="!grid" [class.uk-flex]="!grid">
                    <ng-template [ngIf]="!grid">
                      <div *ngFor="let indicatorPath of indicator.indicatorPaths"
                           class="uk-margin-medium-right uk-text-capitalize uk-flex uk-flex-middle">
                        <i class="material-icons md-24 uk-margin-small-right">
                          {{indicatorUtils.chartTypesIcons.get(indicatorPath.type)}}
                        </i>
                        {{indicatorPath.type + ' Chart'}}
                      </div>
                    </ng-template>
                    <div *ngIf="!grid" class="uk-margin-medium-right uk-flex uk-flex-middle"
                         title="{{indicator.isPublic?'Visible to all users':'Visible to members'}}">
                      <i class="material-icons md-24 uk-margin-small-right">
                        {{indicatorUtils.isPublicIcon.get(indicator.isPublic)}}
                      </i>
                      {{(indicator.isPublic) ? 'Public' : 'Private'}}
                    </div>
                    <div *ngIf="!grid" class="uk-margin-medium-right uk-flex uk-flex-middle"
                         title="{{indicator.isActive?'Included in the indicators list':'Available only through administration dashboard'}}">
                      <i class="material-icons md-24 uk-margin-small-right"
                         [class.md-color-green-300]="indicator.isActive">
                        {{indicatorUtils.isActiveIcon}}
                      </i>
                      {{(indicator.isActive) ? 'Active' : 'Inactive'}}
                    </div>
                    <div class="md-card-dropdown uk-inline">
                      <i uk-icon="more-vertical"></i>
                      <div #element uk-dropdown="mode: click; pos: bottom-right; delay-hide: 0; flip: false"
                           class="uk-padding-remove-horizontal">
                        <ul class="uk-nav uk-dropdown-nav uk-margin-left">
                          <li *ngIf="!editing"><a (click)="editChartIndicatorOpen(chart, indicator._id);hide(element)">Edit</a>
                          </li>
                          <li *ngIf="!editing"><a (click)="toggleIndicatorStatus(chart._id, indicator);hide(element)">
                            {{indicator.isActive ? 'Inactive' : 'Active'}}</a>
                          </li>
                          <li *ngIf="!editing"><a (click)="toggleIndicatorAccess(chart._id, indicator);hide(element)">
                            {{indicator.isPublic ? 'Private' : 'Public'}}</a>
                          </li>
                          <hr *ngIf="!indicator.defaultId " class="uk-nav-divider">
                          <li *ngIf="!editing && !indicator.defaultId "><a
                              (click)="deleteIndicatorOpen(chart, indicator._id, 'chart', 'delete');hide(element)">
                            Delete</a>
                            <!--                            <a (click)="deleteIndicatorOpen(chart, indicator._id, 'chart', 'delete');hide(element)">Delete from all profiles</a>-->
                            <!--                            <a (click)="deleteIndicatorOpen(chart, indicator._id, 'chart', 'disconnect');hide(element)">Delete and disconnect from all profiles</a>-->
                          </li>
                        </ul>
                      </div>
                    </div>
                  </div>
                  <div class="">
                    {{indicator.name}}
                  </div>
                </div>
                <div *ngIf="grid" class="uk-card-body">
                  <div class="uk-flex uk-flex-center" uk-grid>

                    <div class="uk-width-1-3 uk-text-center"
                         [ngClass]="'uk-child-width-1-' + indicator.indicatorPaths.length" uk-grid>
                      <div *ngFor="let indicatorPath of indicator.indicatorPaths">
                        <i class="material-icons md-24">
                          {{indicatorUtils.chartTypesIcons.get(indicatorPath.type)}}
                        </i>
                        <div class="uk-text-capitalize">{{indicatorPath.type + ' Chart'}}</div>
                      </div>
                    </div>
                    <div class="uk-width-1-3 uk-text-center"
                         title="{{indicator.isPublic?'Visible to all users':'Visible to members'}}">
                      <i class="material-icons md-24">
                        {{indicatorUtils.isPublicIcon.get(indicator.isPublic)}}
                      </i>
                      <div>{{(indicator.isPublic) ? 'Public' : 'Private'}}</div>
                    </div>
                    <div class="uk-width-1-3 uk-text-center"
                         title="{{indicator.isActive?'Included in the indicators list':'Available only through administration dashboard'}}">
                      <i class="material-icons md-24" [class.md-color-green-300]="indicator.isActive">
                        {{indicatorUtils.isActiveIcon}}
                      </i>
                      <div>{{(indicator.isActive) ? 'Active' : 'Inactive'}}</div>
                    </div>
                    <iframe *ngIf="indicator.indicatorPaths[0] && indicator.indicatorPaths[0].source !== 'image' &&
                                  safeUrls.get(indicatorUtils.getFullUrl(stakeholder, indicator.indicatorPaths[0]))"
                            [src]="safeUrls.get(indicatorUtils.getFullUrl(stakeholder, indicator.indicatorPaths[0]))"
                            class="uk-width-1-1 uk-height-medium"></iframe>
                    <div *ngIf="indicator.indicatorPaths[0] && indicator.indicatorPaths[0].source === 'image'">
                      <img class="uk-width-1-1 uk-height-medium" [src]="indicator.indicatorPaths[0].url">
                    </div>
                    <div class="uk-width-1-1 uk-text-muted uk-text-small">
                      {{indicator.description ? indicator.description : ''}}
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </ng-template>
          <div class="disable-sortable uk-sortable-nodrag"
               [class.uk-width-1-3@m]="grid"
               [class.uk-width-1-1@m]="!grid">
            <div class="uk-card uk-card-default clickable" (click)="editChartIndicatorOpen(chart)">
              <div class="uk-padding-small uk-card-header">
                <div class=""
                     [class.uk-flex-middle]="!grid"
                     [class.uk-flex]="!grid"
                     [class.uk-flex-center]="!grid">
                  <i *ngIf="!grid" uk-icon="plus"></i>
                  <span>Create a custom Indicator</span>
                </div>
              </div>
              <div *ngIf="grid" class="uk-card-body">
                <div uk-grid>
                  <div class="uk-width-1-1">
                    Use our advance tool to create a custom Indicator that suit the needs of your funding
                    KPI's.
                  </div>
                  <div class="uk-width-1-1 uk-flex uk-flex-center">
                    <i uk-icon="plus"></i>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </ng-template>
      <div *ngIf="grid" class="new-section uk-margin-top">
        <div class="tools uk-flex uk-flex-middle">
          <button [disabled]="editing" class="uk-margin-small-right uk-icon-button portal-button" (click)="createSection()">
            <i uk-icon="plus"></i>
          </button>
          <span>Create a new section</span>
        </div>
      </div>
    </div>
  </div>

  <modal-alert #editNumberModal
             [classBody]="'large-modal'"
             (alertOutput)="saveIndicator()"
             [okDisabled]="numberIndicatorFb && (numberIndicatorFb.invalid || numberIndicatorFb.pristine)">
  <div *ngIf="numberIndicatorFb" class="uk-padding-small" [formGroup]="numberIndicatorFb">
    <div dashboard-input class="uk-form-row" [formInput]="numberIndicatorFb.get('name')" label="Title"></div>
    <div dashboard-input class="uk-form-row" [formInput]="numberIndicatorFb.get('description')"
         label="Description" type="textarea">
    </div>
    <div class="uk-form-row uk-flex uk-flex-middle">
      <div dashboard-input class="uk-width-small" [formInput]="numberIndicatorFb.get('isPublic')"
           label="Accessibility" [options]="indicatorUtils.isPublic" type="select">
      </div>
      <div dashboard-input class="uk-margin-small-left uk-width-small" [formInput]="numberIndicatorFb.get('isActive')"
           label="Visibility" [options]="indicatorUtils.isActive" type="select">
      </div>
      <div dashboard-input class="uk-margin-small-left uk-width-small" [formInput]="numberIndicatorFb.get('width')"
           type="select" [options]="indicatorUtils.indicatorSizes"
           label="Number Size">
      </div>
    </div>
    <h5 class="uk-text-bold uk-margin-top uk-margin-bottom">
      Number Settings
    </h5>
    <div *ngIf="numberIndicatorPaths" formArrayName="indicatorPaths">
      <div *ngFor="let indicatorPath of numberIndicatorPaths.controls; let i=index"
           [formGroup]="indicatorPath">
        <div class="uk-grid-medium uk-form-row uk-flex uk-flex-middle" uk-grid>
          <div class="uk-width-2-3@s">
            <div dashboard-input [formInput]="indicatorPath.get('url')" type="textarea" rows="3"
                 label="Number path url"></div>
          </div>
          <div *ngIf="urlParameterizedMessage.length > 0" class="uk-alert-warning uk-alert">
            {{urlParameterizedMessage}}
          </div>
          <div class="uk-width-1-3@s">
            <div dashboard-input [formInput]="indicatorPath.get('source')" label="Source"
                 type="select" [options]="indicatorUtils.sourceTypes">
            </div>
          </div>
        </div>
        <div formArrayName="jsonPath">
          <div class="uk-margin-top uk-margin-bottom uk-text-large">
            JSON Path
          </div>
          <div class="uk-grid uk-grid-medium" uk-grid>
            <div *ngFor="let jsonPath of getJsonPath(i).controls; let j=index" class="uk-flex uk-flex-middle">
              <div dashboard-input class="uk-width-small"
                   [formInput]="jsonPath"
                   [label]="'Level ' + +(j + 1)"></div>
              <i *ngIf="getJsonPath(i).length !== 1"
                 class="material-icons md-24 uk-margin-left uk-text-danger clickable" (click)="removeJsonPath(i, j)">close</i>
              <div *ngIf="j < (getJsonPath(i).length - 1)" class="uk-text-center uk-margin-left">
                <i class="material-icons">arrow_forward</i>
              </div>
              <div *ngIf="j === (getJsonPath(i).length - 1)" class="uk-margin-left">
                <button class="md-btn md-btn-small md-btn-primary" (click)="addJsonPath(i)">Add level</button>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</modal-alert>
<modal-alert #editChartModal
             [classBody]="'large-modal'"
             (alertOutput)="saveIndicator()"
             [okDisabled]="chartIndicatorFb && (chartIndicatorFb.invalid || chartIndicatorFb.pristine)">
  <div *ngIf="chartIndicatorFb" class="uk-padding-small" [formGroup]="chartIndicatorFb">
    <div dashboard-input class="uk-form-row" [formInput]="chartIndicatorFb.get('name')" label="Title"></div>
    <div dashboard-input class="uk-form-row" [formInput]="chartIndicatorFb.get('description')"
         label="Description" type="textarea">
    </div>
    <div class="uk-form-row uk-flex uk-flex-middle">
      <div dashboard-input class="uk-width-small" [formInput]="chartIndicatorFb.get('isPublic')"
           label="Accessibility" [options]="indicatorUtils.isPublic" type="select">
      </div>
      <div dashboard-input class="uk-margin-small-left uk-width-small" [formInput]="chartIndicatorFb.get('isActive')"
           label="Visibility" [options]="indicatorUtils.isActive" type="select">
      </div>
      <div dashboard-input class="uk-margin-small-left uk-width-small" [formInput]="chartIndicatorFb.get('width')"
           type="select" [options]="indicatorUtils.indicatorSizes"
           label="Chart Size">
      </div>
    </div>
    <h5 class="uk-text-bold uk-margin-top uk-margin-bottom">
      Chart Settings
    </h5>
    <div *ngIf="chartIndicatorPaths" formArrayName="indicatorPaths">
      <div *ngFor="let indicatorPath of chartIndicatorPaths.controls; let i=index"
           [formGroup]="indicatorPath">
        <div dashboard-input class="uk-form-row"
             [title]="indicatorPath.get('url').disabled?'Default chart URLs cannot change':''"
             [formInput]="indicatorPath.get('url')"
             label="Chart Url"></div>
        <div *ngIf="urlParameterizedMessage.length > 0" class="uk-alert-warning uk-alert">
          {{urlParameterizedMessage}}
        </div>
        <div formArrayName="parameters">
          <div *ngIf="getParameter(i, 'title')" class="uk-form-row">
            <div dashboard-input
                 [formInput]="getParameter(i, 'title').get('value')"
                 label="Chart Title"></div>
          </div>
          <div *ngIf="getParameter(i, 'subtitle')" class="uk-form-row">
            <div dashboard-input
                 [formInput]="getParameter(i, 'subtitle').get('value')"
                 label="Chart Subtitle"></div>
          </div>
          <div class="uk-grid-medium uk-form-row" uk-grid>
            <div *ngIf="!getParameter(i, 'type')" class="uk-width-1-3@s">
              <div dashboard-input [formInput]="indicatorPath.get('type')"
                   type="select"
                   [options]="(indicatorPath.get('type').value == 'table' && getParameter(i, 'data_title_0'))?indicatorUtils.getChartTypes(indicatorPath.get('type').value):indicatorUtils.allChartTypes"
                   label="Chart Type"></div>
            </div>
            <div *ngIf="getParameter(i, 'type')" class="uk-width-1-3@s">
              <div dashboard-input [formInput]="getParameter(i, 'type').get('value')"
                   type="select" [options]="indicatorUtils.getChartTypes(getParameter(i, 'type').get('value').value)"
                   label="Chart Type"></div>
            </div>
            <div *ngIf="getParameter(i, 'xAxisTitle')" class="uk-width-1-3@s">
              <div dashboard-input [formInput]="getParameter(i, 'xAxisTitle').get('value')"
                   label="X-Axis Title"></div>
            </div>
            <div *ngIf="getParameter(i, 'yAxisTitle')" class="uk-width-1-3@s">
              <div dashboard-input [formInput]="getParameter(i, 'yAxisTitle').get('value')"
                   label="Y-Axis Title"></div>
            </div>
            <div *ngIf="getParameter(i, 'data_title_0')" class="uk-width-1-3@s">
              <div dashboard-input [formInput]="getParameter(i, 'data_title_0').get('value')"
                   label="Data title"></div>
            </div>
            <div *ngIf="getParameter(i, 'data_title_1')" class="uk-width-1-3@s">
              <div dashboard-input [formInput]="getParameter(i, 'data_title_1').get('value')"
                   label="Data title"></div>
            </div>
            <div *ngIf="getParameter(i, 'start_year')" class="uk-width-1-3@s">
              <div dashboard-input [formInput]="getParameter(i, 'start_year').get('value')"
                   label="Year (From)"></div>
            </div>
            <div *ngIf="getParameter(i, 'end_year')" class="uk-width-1-3@s">
              <div dashboard-input [formInput]="getParameter(i, 'end_year').get('value')"
                   label="Year (To)"></div>
            </div>
          </div>
        </div>
        <div *ngIf="indicator && indicator.indicatorPaths[i] && indicator.indicatorPaths[i].safeResourceUrl"
             class="uk-margin-medium-top uk-position-relative">
          <div *ngIf="(hasDifference(i)) && !indicatorPath.invalid"
               class="uk-width-1-1 uk-height-medium refresh-iframe">
            <div class="uk-position-relative uk-height-1-1">
              <div class="uk-position-center md-color-white uk-text-center clickable"
                   (click)="refreshIndicator()">
                <div><i class="material-icons md-color-white">refresh</i></div>
                <span>Click to refresh the graph view</span>
              </div>
            </div>
          </div>
          <iframe *ngIf="indicator.indicatorPaths[i].source !== 'image'"
                  [src]="indicator.indicatorPaths[i].safeResourceUrl"
                  class="uk-width-1-1 uk-height-medium"></iframe>
          <div *ngIf="indicator.indicatorPaths[i].source === 'image'">
            <img class="uk-width-1-1 uk-height-medium" [src]="indicator.indicatorPaths[i].url">
          </div>
        </div>
      </div>
    </div>
  </div>
</modal-alert>
<modal-alert #deleteModal (alertOutput)="deleteIndicator()">
  You are about to delete <span class="uk-text-bold" *ngIf="indicator && index !== -1">
  "{{indicator.name ? indicator.name : indicator.indicatorPaths[0].parameters.title}}"</span> indicator permanently.
  <div *ngIf="indicatorChildrenActionOnDelete == 'delete'" class="uk-text-bold">
    Indicators of all profiles based on this default indicator, will be deleted as well.
  </div>
  <!--  <span *ngIf="indicatorChildrenActionOnDelete == 'disconnect'" class="uk-text-bold">-->
  <!--    Indicators of all profiles based on this default indicator, will not be marked as copied from default anymore.-->
  <!--  </span>-->
  Are you sure you want to proceed?
</modal-alert>
<!--<modal-alert #deleteAllModal (alertOutput)="deleteIndicator('delete')">-->
<!--  You are about to delete <span class="uk-text-bold" *ngIf="indicator && index !== -1">-->
<!--  "{{indicator.name ? indicator.name : indicator.indicatorPaths[0].parameters.title}}"</span> indicator permanently.-->
<!--  <span class="uk-text-bold">Indicators of all profiles based on this default indicator, will be deleted as well.</span>-->
<!--  Are you sure you want to proceed?-->
<!--</modal-alert>-->
<!--<modal-alert #deleteAndDisconnectModal (alertOutput)="deleteIndicator('disconnect')">-->
<!--  You are about to delete <span class="uk-text-bold" *ngIf="indicator && index !== -1">-->
<!--  "{{indicator.name ? indicator.name : indicator.indicatorPaths[0].parameters.title}}"</span> indicator permanently.-->
<!--  <span class="uk-text-bold">Indicators of all profiles based on this default indicator, will not be marked as copied from default anymore.</span>-->
<!--  Are you sure you want to proceed?-->
<!--</modal-alert>-->
<modal-alert #deleteSectionModal (alertOutput)="deleteSection()">
  You are about to delete this section and its indicators permanently.
  <div *ngIf="sectionChildrenActionOnDelete == 'delete' && !stakeholder.defaultId" class="uk-text-bold">
    Sections of all profiles based on this default section and their contents, will be deleted as well.
  </div>
  <!--  <span *ngIf="sectionChildrenActionOnDelete == 'disconnect'" class="uk-text-bold">-->
  <!--    Sections of all profiles based on this default section and their contents, will not be marked as copied from default anymore.-->
  <!--  </span>-->
  Are you sure you want to proceed?
</modal-alert>
<!--<modal-alert #deleteNumberSectionModal (alertOutput)="deleteSection('number')">-->
<!--  You are about to delete this section and its indicators permanently.-->
<!--  Are you sure you want to proceed?-->
<!--</modal-alert>-->
<!--<modal-alert #deleteChartSectionModal (alertOutput)="deleteSection()">-->
<!--  You are about to delete this section and its indicators permanently.-->
<!--  Are you sure you want to proceed?-->
<!--</modal-alert>-->
