<div *ngIf="updateErrorMessage" class="uk-alert uk-alert-danger" role="alert">{{updateErrorMessage}}</div>
<div *ngIf="errorMessage" class="uk-alert uk-alert-danger" role="alert">{{errorMessage}}</div>
<div [style.display]="showLoading ? 'inline' : 'none'" class="uk-animation-fade uk-width-1-1" role="alert"><img class="uk-align-center loading-gif"></div>
<div class="uk-alert uk-alert-primary uk-margin-top-large">
     <span class="uk-margin-small-right uk-icon" uk-icon="info"></span>
    Create or edit help text
    <div class="uk-text-small">
      Select the class to be displayed, add the content and click active to make it visible to dashboard
    </div>

  </div>
<form *ngIf="!errorMessage && !showLoading" [formGroup]="myForm">
    <div class="form-group">
        <div class="uk-margin-bottom" *ngIf="selectedDiv">Class content displayed in page(s): <span *ngFor="let page of selectedDiv.pages let i=index">{{page.name}}<span *ngIf="i<(selectedDiv.pages.length-1)">, </span></span></div>

      <div *ngIf="showPageSelect && !editMode" class="form-group">
        <label for="pageTag">Select Page</label>
          <select id="pageTag" (change)="pageSelected($event)" [value]="pageId ? pageId : ''">
<!--              <option *ngIf="!pageId">No page selected</option>-->
              <option *ngFor="let page of availablePages" [value]="page._id">{{page.name}}</option>
          </select>
      </div>

      <div *ngIf="pageId || selectedDiv" class="form-group">
        <label for="divTag">Select Class</label>
        <select formControlName="divId" id="divTag" class="form-control">
            <!-- <option *ngIf="selectedDiv" [value]="selectedDiv._id">{{selectedDiv.name}}</option> -->
            <option *ngFor="let div of availableDivs" [value]="div._id" (click)="divIdSelected(div)">{{div.name}}</option>
        </select>
      </div>

    </div>
    <div class="form-group" [ngClass]="{'has-error':!myForm.controls.content.valid && myForm.controls.content.dirty}">
        <label>Content</label>
        <div>
            <!-- [config]="{allowedContent: true,extraAllowedContent : '*(*)'}"> -->
            <ckeditor
                    [readonly]="false"
                    debounce="500"
                    formControlName="content"
                    [config]="{ extraAllowedContent: '* [uk-*](*) ; span', disallowedContent: 'script; *[on*]', removeButtons: 'Save,NewPage,DocProps,Preview,Print',
                                extraPlugins: 'divarea'}">
            </ckeditor>
        </div>
    </div>
    <div class="form-group">
        <label>Select Status</label>
        <label class="checkbox">
            <span style="font-weight: normal;">Active</span>
            <input tabindex="0" type="checkbox" formControlName="isActive">

        </label>
    </div>
    <input type="hidden" formControlName="_id">
</form>
<!-- <div *ngIf="selectedDiv"><span *ngFor="let page of selectedDiv.pages">{{page.name}} </span></div> -->
