<div id="divHelpContents">

        <div class="menubar ">

            <div *ngIf="!selectedPageId" class="divHelpContent-title uk-text-large">Class help texts</div>
            <div *ngIf="selectedPageId && page" class="divHelpContent-title uk-text-large">Class help texts of page '{{page.name}}'</div>

            <div *ngIf="updateErrorMessage" class="uk-alert-danger" uk-alert>
              <a class="uk-alert-close" uk-close></a>
              {{updateErrorMessage}}
            </div>

            <div *ngIf="!errorMessage && !showLoading" class="page-controls">
                <div class="  filters ">
                    <div class="show-options uk-float-right">
                      <button class="uk-button" type="button">Bulk Actions</button>
                      <div uk-dropdown="mode: click">
                        <ul class="uk-nav uk-navbar-dropdown-nav"
                            [attr.uk-tooltip]="getSelectedDivHelpContents().length == 0 ? 'pos:left; cls: uk-active' : 'cls: uk-invisible'"
                            title="Select at least one help text">
                          <li><a [class]="getSelectedDivHelpContents().length == 0 ? 'uk-disabled' : ''" (click)="toggleDivHelpContents(true,getSelectedDivHelpContents())"><i></i> Activate </a></li>
                          <li><a [class]="getSelectedDivHelpContents().length == 0 ? 'uk-disabled' : ''" (click)="toggleDivHelpContents(false,getSelectedDivHelpContents())"><i></i> Deactivate </a></li>
                          <li><a [class]="getSelectedDivHelpContents().length == 0 ? 'uk-disabled' : ''" (click)="confirmDeleteSelectedDivHelpContents()"><i></i> Delete </a></li>
                        </ul>
                      </div>
                    </div>
                </div>
            </div>
            <!-- <a *ngIf="!selectedPageId" [queryParams]="{communityId: selectedCommunityPid}" routerLink="/classContents/new" class="uk-button uk-button-primary uk-float-right"><i></i> New help text </a> -->
            <!-- <a *ngIf="selectedPageId" [queryParams]="{communityId: selectedCommunityPid, pageId: selectedPageId}" routerLink="/classContents/new" class="uk-button uk-button-primary uk-float-right"><i></i> New class help text </a> -->
            <div class="uk-grid uk-margin-bottom">
            <form target="BSFormPanel_Admin_1" class="search">
                <!-- <input #inputstring (keyup.enter)="filterBySearch(inputstring.value)" placeholder="Class Help text..." type="text" class="uk-input uk-width-medium"/>
                <button class="uk-button" type="submit">Search</button> -->
                <input type="text" class="uk-input uk-width-medium" placeholder="Class name, content..." aria-describedby="sizing-addon2"  [(ngModel)]="keyword"  name="keyword" >
                <button (click)="filterBySearch(keyword)"  type="submit" class=" uk-button">
                   <span class="uk-icon">
                   <svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="search" ratio="1"><circle fill="none" stroke="#000" stroke-width="1.1" cx="9" cy="9" r="7"></circle><path fill="none" stroke="#000" stroke-width="1.1" d="M14,14 L18,18 L14,14 Z"></path></svg>
                   </span>Search
                 </button>
            </form>
            <div *ngIf="!selectedPageId" class="filters marginBottom20">
                <div class="links form-group form-inline">
                    <span>Filter by page:</span>
                    <select class="uk-select uk-width-medium" (change)="filterByPage($event)">
                        <option value="">-- none selected --</option>
                        <option *ngFor="let page of pages" value="{{page._id}}">{{page.name}}</option>
                    </select>
                </div>
            </div>
          </div>
        </div>

        <div class="content-wrapper" id="contentWrapper">
            <div>
                <div class="contentPanel">
                    <div *ngIf="errorMessage" class="uk-alert uk-alert-danger  uk-margin-large-top" role="alert">{{errorMessage}}</div>
                    <div [style.display]="showLoading ? 'inline' : 'none'" class="uk-animation-fade uk-margin-large-top  uk-width-1-1" role="alert"><img class="uk-align-center loading-gif"></div>

                    <div *ngIf="!errorMessage && !showLoading">
                        <div class="gwt-HTML">
                            <div class="users-list"> <!--"row" class removed"-->
                                <div class="col-md-12">

                                  <!-- <div *ngIf="!selectedPageId" class="filters marginBottom20">
                                      <div class="links form-group form-inline">
                                          <span>Filter by community:</span>
                                          <select class="uk-select uk-width-medium" (change)="filterByCommunity($event)">
                                              <option *ngFor="let community of communities" value="{{community.pid}}">{{community.name}}</option>
                                          </select>
                                      </div>
                                  </div> -->
                                  <div class="uk-alert uk-alert-primary uk-margin-top-large">
                                       <span class="uk-margin-small-right uk-icon" uk-icon="info"></span>
                                      Enable or disable help text to show or hide it from the dashboard

                                    </div>

                                  <ul uk-tab class="links">
                                      <li [ngClass]="{'uk-active' : filters.active==null}" (click)="displayAllDivHelpContents()">
                                          <a>All class help texts <span class="uk-badge">{{counter.all | number}}</span></a>
                                      </li>
                                      <li [ngClass]="{'uk-active' : filters.active==true}" (click)="displayActiveDivHelpContents()">
                                          <a>Active <span class="uk-badge">{{counter.active | number}}</span></a>
                                      </li>
                                      <li [ngClass]="{'uk-active' : filters.active==false}" (click)="displayInactiveDivHelpContents()">
                                          <a>Inactive <span class="uk-badge">{{counter.inactive | number}}</span></a>
                                      </li>
                                  </ul>

                                  <table class="uk-table uk-table-striped">
                                    <thead>
                                        <tr>
                                            <th><input id="allDivHelpContentsCheckbox" type="checkbox" (change)="toggleCheckBoxes($event)"></th>
                                            <th *ngIf="!selectedPageId">Page</th>
                                            <!--th *ngIf="!selectedPageId">Community</th-->
                                            <th>Class</th>
                                            <th>Content</th>
                                            <th>Change status</th>
                                            <th>Actions</th>
                                        </tr>
                                    </thead>
                                    <tbody >
                                        <tr *ngFor="let check of checkboxes; let i=index">
                                            <td><input id="{{check.divHelpContent._id}}" class="checkBox" type="checkbox"
                                                                                name="entitiescb[]" value="{{check.divHelpContent._id}}" [(ngModel)]="check.checked">
                                            </td>
                                            <td *ngIf="!selectedPageId">
                                                <!-- <div class="page" href="#">{{check.divHelpContent.divId.page.name}}</div> -->
                                                <div class="pages" href="#">
                                                  <span *ngFor="let page of check.divHelpContent.divId.pages let i=index">{{page.name}}<span *ngIf="i<(check.divHelpContent.divId.pages.length-1)">, </span></span>
                                                </div>
                                            </td>
                                            <!--td *ngIf="!selectedPageId">
                                                <div class="community" href="#">{{check.divHelpContent.community.name}}</div>
                                            </td-->
                                            <td>
                                                <div class="divId" href="#">{{check.divHelpContent.divId.name}}</div>
                                            </td>
                                            <td>
<!--                                              <div class="content" [innerHTML]="check.divHelpContent.content | safeHtml"></div>-->
                                              <div class="content">{{check.divHelpContent.content}}</div>
                                            </td>
                                            <td>
                                              <mat-slide-toggle [checked]="check.divHelpContent.isActive"
                                                                (change)="($event.source.checked = check.divHelpContent.isActive);toggleDivHelpContents(!check.divHelpContent.isActive,[check.divHelpContent._id])"></mat-slide-toggle>
                                            </td>
                                            <td>
                                                <div class="actions" href="#">
                                                    <input title="Edit" src="assets/imgs/icn_edit.png" class="edit uk-margin-small-right" type="image" (click)="editDivHelpContent(check.divHelpContent._id)">
                                                    <input title="Delete" src="assets/imgs/icn_trash.png" class="delete" type="image" (click)="confirmDeleteDivHelpContent(check.divHelpContent._id)">
                                                </div>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>

                                    <div *ngIf="checkboxes.length==0" class="col-md-12">
                                        <div class="uk-alert-warning" uk-alert>No class help texts found</div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <a *ngIf="selectedPageId && page" [queryParams]="{type: page.type, communityId: selectedCommunityPid}" routerLink="/pages">Go back to {{page.type}} pages</a>
                    </div>
                </div>
            </div>
        </div>
        <fab (clicked)="newClassContent()"></fab>
</div>

<!-- <delete-confirmation-dialog #deleteConfirmationModal [isModalShown]="isModalShown" (emmitObject)="confirmedDeleteDivHelpContents($event)">
    Are you sure you want to delete the selected help text(s)?
</delete-confirmation-dialog> -->
<modal-alert #AlertModalDeleteDivHelpContents (alertOutput)="confirmedDeleteDivHelpContents($event)"></modal-alert>
