<aside id="sidebar_main">
  <div id="sidebar_content">
  <div *ngIf="stakeholder" class="sidebar_main_header uk-margin-remove-bottom uk-text-center">
    <img  *ngIf="properties.environment =='beta' || properties.environment =='development'" class="badge"
          [src]="'assets/common-assets/'+(properties.environment =='beta'?'beta_flag.svg':'prototype_flag.svg')"
          [alt]="properties.environment">
    <div class="uk-position-relative uk-margin-small-top">
<!--      <div *ngIf="!stakeholder.defaultId" class="uk-badge default">Default</div>-->
<!--      <img class="logo" *ngIf="stakeholder.logoUrl" [src]="stakeholder.logoUrl">-->
<!--      <div class="uk-margin-top" *ngIf="!stakeholder.logoUrl" >{{stakeholder.name}}</div>-->
      <a [href]="properties.domain + properties.baseLink"><div   class="portalLogo logo" ></div></a>
    </div>
  </div>
  <div *ngIf="stakeholder" class="menu_section">
    <ul class="uk-list">
      <li class="uk-margin-bottom md-bg-blue-900 uk-padding-small">
        <a [routerLink]="'../'" class="md-color-white">
          <span class="menu_icon"><i class="material-icons md-color-white">arrow_back</i></span>
          <div class="menu_title uk-width-expand uk-text-uppercase">
            Back
          </div>
        </a>
      </li>
      <li [class.current_section]="analysisOpen"
          [class.act_section]="analysisOpen"
          class="submenu_trigger">
        <a href="#" (click)="analysisOpen = !analysisOpen; $event.preventDefault()">
<!--          <span class="menu_icon"><i class="material-icons">donut_large</i></span>-->
          <span class="menu_title uk-width-expand">Analysis Indicators</span>
        </a>
        <ul [style.display]="(analysisOpen?'block':'none')" class="uk-list">
          <ng-template ngFor [ngForOf]="stakeholder.topics" let-topic let-i="index">
            <li
              [title]="topic.name+': '+(topic.isActive?'Active':'Inactive')+', '+(topic.isPublic?'Public':'Private')"
              class="uk-margin-top uk-margin-small-right">
              <a [routerLink]="topic.alias" class="uk-flex">
               <span *ngIf="topic.icon" class="menu_icon">
                  <span   [innerHTML]="satinizeHTML(topic.icon)"></span>
                </span>
                <div class="menu_title uk-width-expand">
                  {{topic.name}}
                  <!--<i
                    class="material-icons md-18 uk-margin-small-left">{{topic.isPublic ? 'public' : 'lock'}}</i>
                  <i class="material-icons md-18"
                     [class.md-color-green-300]="topic.isActive">brightness_1</i>-->
                </div>
                <div class="menu_on_hover" (click)="$event.stopPropagation();$event.preventDefault()">
                  <i class=" onHover" uk-icon="more-vertical"></i>
                  <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-list">
                      <li><a (click)="editTopicOpen(i); hide(element)">Edit</a></li>
                      <li><a (click)="toggleTopicStatus(topic); hide(element)">
                        {{topic.isActive ? 'Inactive' : 'Active'}}</a>
                      </li>
                      <li><a (click)="toggleTopicAccess(topic); hide(element)">
                          {{topic.isPublic?'Private':'Public'}}</a>
                      </li>
                      <hr *ngIf="!topic.defaultId" class="uk-nav-divider">
                      <li *ngIf="!topic.defaultId"><a (click)="deleteTopicOpen(i, 'delete'); hide(element)">Delete</a>
<!--                        <ng-container *ngIf="!stakeholder.defaultId">-->
<!--                          <a (click)="deleteTopicOpen(i, 'delete'); hide(element)">Delete from all profiles</a>-->
<!--                          <a (click)="deleteTopicOpen(i, 'disconnect'); hide(element)">Delete and disconnect from all profiles</a>-->
<!--                        </ng-container>-->
                      </li>
                    </ul>
                  </div>
                </div>
              </a>
            </li>
          </ng-template>
          <li>
            <a href="#" (click)="editTopicOpen(); $event.preventDefault()">
              <span class="menu_icon"><i class="material-icons">add</i></span>
              <span class="menu_title">Create new Topic</span>
            </a>
          </li>
        </ul>
      </li>
    </ul>
  </div>
  </div>
</aside>
<div id="page_content">
  <div id="page_content_inner" class="uk-padding-large">
    <h4 class="uk-text-bold uk-margin-top">
      Customise your Monitor Dashboard!
    </h4>
    <div class="uk-text-large uk-margin-bottom">
      <div>
        Modify or add new topics, categories and content.<br><br>
        Start your navigation through the <span class="md-color-blue-900">left side menu!</span>
      </div>
      <div class="uk-margin-small-top uk-margin-small-bottom uk-margin-large-left">
        <svg xmlns="http://www.w3.org/2000/svg" width="30" height="88" viewBox="0 0 30 88">
          <g id="Group_749" data-name="Group 749" transform="translate(-872.168 -490.5)">
            <text class="fill_text" id="OR" transform="translate(872.168 540.271)" font-size="18"
                  font-family="OpenSans-Bold, Open Sans" font-weight="900" opacity="0.8">
              <tspan x="0" y="0">OR</tspan>
            </text>
            <line class="stroke_line" id="Line_225" data-name="Line 225" y2="30" transform="translate(885.5 490.5)"
                  fill="none" stroke="#000" stroke-width="1" opacity="0.2"></line>
            <line class="stroke_line" id="Line_226" data-name="Line 226" y2="30" transform="translate(885.5 548.5)"
                  fill="none" stroke="#000" stroke-width="1" opacity="0.2"></line>
          </g>
        </svg>
      </div>
      <div class="uk-width-1-1">
        Select one of the <span class="md-color-blue-900">topics below</span>!
      </div>
    </div>
    <div *ngIf="stakeholder" class="uk-child-width-1-3@m uk-child-width-1-1@s uk-grid-match uk-grid-medium" uk-grid>
      <ng-template ngFor [ngForOf]="stakeholder.topics" let-topic>
        <div>
          <a [routerLink]="topic.alias" class="uk-card uk-card-default">
            <div class="md-card-toolbar">
              <!--<div class="md-card-toolbar-actions" >

                <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">
                      <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>
                        &lt;!&ndash;                            <a (click)="deleteIndicatorOpen(chart, indicator._id, 'chart', 'delete');hide(element)">Delete from all profiles</a>&ndash;&gt;
                        &lt;!&ndash;                            <a (click)="deleteIndicatorOpen(chart, indicator._id, 'chart', 'disconnect');hide(element)">Delete and disconnect from all profiles</a>&ndash;&gt;
                      </li>
                    </ul>
                  </div>
                </div>
              </div>-->
              <div class="uk-card-header">
                {{topic.name}}
              </div>
            </div>
            <div class="uk-card-body uk-grid">
<!--              <h6 class="uk-text-bold">{{topic.name}}</h6>-->
              <div class="uk-width-1-2 uk-text-center"
                   title="{{topic.isPublic?'Visible to all users':'Visible to members'}}">
                <i class="material-icons md-24">
                  {{indicatorUtils.isPublicIcon.get(topic.isPublic)}}
                </i>
                <div>{{(topic.isPublic) ? 'Public' : 'Private'}}</div>
              </div>
              <div class="uk-width-1-2 uk-text-center"
                   title="{{topic.isActive?'Included in the indicators list':'Available only through administration dashboard'}}">
                <i class="material-icons md-24" [class.md-color-green-300]="topic.isActive">
                  {{indicatorUtils.isActiveIcon}}
                </i>
                <div>{{(topic.isActive) ? 'Active' : 'Inactive'}}</div>
              </div>
              <div *ngIf="topic.description && topic.description.length > 0 " class="uk-text-secondary uk-margin-top">
                {{topic.description}}
              </div>
            </div>
          </a>
        </div>
      </ng-template>
    </div>
  </div>
</div>
<modal-alert #deleteModal (alertOutput)="deleteTopic()">
  You are about to delete <span class="uk-text-bold" *ngIf="index !== -1">"{{stakeholder.topics[index].name}}"</span> topic permanently.
  <div *ngIf="topicChildrenActionOnDelete == 'delete'" class="uk-text-bold">
    Topics of all profiles based on this default topic, will be deleted as well.
  </div>
<!--  <span *ngIf="topicChildrenActionOnDelete == 'disconnect'" class="uk-text-bold">-->
<!--    Topics of all profiles based on this default topic, will not be marked as copied from default anymore.-->
<!--  </span>-->
  Are you sure you want to proceed?
</modal-alert>
<modal-alert #editModal (alertOutput)="saveTopic(index)">
  <div *ngIf="form" class="uk-padding-small" [formGroup]="form">
    <div dashboard-input class="uk-form-row" [formInput]="form.get('name')" label="Title"></div>
    <div dashboard-input class="uk-form-row" [formInput]="form.get('description')"
         label="Description" type="textarea">
    </div>
    <div dashboard-input class="uk-form-row" [formInput]="form.get('icon')"
         label="Icon(SVG)" type="textarea">
    </div>
    <div class="uk-form-row uk-flex uk-flex-middle">
      <div dashboard-input class="uk-width-small" [formInput]="form.get('isPublic')"
           label="Accessibility" [options]="stakeholderUtils.isPublic" type="select">
      </div>
      <div dashboard-input class="uk-margin-small-left uk-width-small" [formInput]="form.get('isActive')"
           label="Visibility" [options]="stakeholderUtils.isActive" type="select">
      </div>
    </div>
  </div>
</modal-alert>
