<div id="pageHelpContents">
        <div class="menubar ">
            <div *ngIf="!selectedPageId" class="pageHelpContent-title uk-text-large">Page help texts</div>
            <div *ngIf="selectedPageId && page" class="pageHelpContent-title uk-text-large">Page 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>

            <!-- <a *ngIf="selectedPageId" [queryParams]="{communityId: selectedCommunityPid, pageId: selectedPageId}" routerLink="/pageContents/new" class="uk-button uk-button-primary uk-float-right"><i></i> New Page Content </a> -->
            <!-- <a *ngIf="!selectedPageId" [queryParams]="{communityId: selectedCommunityPid}" routerLink="/pageContents/new" class="uk-button uk-button-primary uk-float-right"><i></i> New help text </a> -->
            <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]="getSelectedPageHelpContents().length == 0 ? 'pos:left; cls: uk-active' : 'cls: uk-invisible'"
                            title="Select at least one help text">
                            <li><a [class]="getSelectedPageHelpContents().length == 0 ? 'uk-disabled' : ''" (click)="togglePageHelpContents(true,getSelectedPageHelpContents())"><i></i> Activate </a></li>
                            <li><a [class]="getSelectedPageHelpContents().length == 0 ? 'uk-disabled' : ''" (click)="togglePageHelpContents(false,getSelectedPageHelpContents())"><i></i> Deactivate </a></li>
                            <li><a [class]="getSelectedPageHelpContents().length == 0 ? 'uk-disabled' : ''" (click)="confirmDeleteSelectedPageHelpContents()"><i></i> Delete </a></li>
                        </ul>
                      </div>
                    </div>
                </div>
            </div>
            <div class="uk-grid uk-margin-bottom">
              <form target="BSFormPanel_Admin_1" class="search">
                  <!-- <input #inputstring (keyup.enter)="filterBySearch(inputstring.value)" placeholder="Page 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="Page 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 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)="displayAllPageHelpContents()">
                                          <a>All help texts <span class="uk-badge">{{counter.all | number}}</span></a>
                                      </li>
                                      <li [ngClass]="{'uk-active' : filters.active==true}" (click)="displayActivePageHelpContents()">
                                          <a>Active <span class="uk-badge">{{counter.active | number}}</span></a>
                                      </li>
                                      <li [ngClass]="{'uk-active' : filters.active==false}" (click)="displayInactivePageHelpContents()">
                                          <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="allPageHelpContentsCheckbox" type="checkbox" (change)="toggleCheckBoxes($event)"></th>
                                            <th *ngIf="!selectedPageId">Page</th>
                                            <th *ngIf="!selectedPageId">Community</th>
                                            <th>Content</th>
                                            <th>Placement</th>
                                            <th>Order</th>
                                            <!--<th>Before</th>-->
                                            <th>Change status</th>
                                            <th>Actions</th>
                                        </tr>
                                    </thead>
                                    <tbody >
                                        <tr *ngFor="let check of checkboxes; let i=index">
                                            <td><input id="{{check.pageHelpContent._id}}" class="checkBox" type="checkbox"
                                                                                name="entitiescb[]" value="{{check.pageHelpContent._id}}" [(ngModel)]="check.checked">
                                            </td>
                                            <td *ngIf="!selectedPageId">
                                                <div class="page" href="#">{{check.pageHelpContent.page.name}}</div>
                                            </td>
                                            <td *ngIf="!selectedPageId">
                                                <div class="community" href="#">{{check.pageHelpContent.community.name}}</div>
                                            </td>
                                            <td>
<!--                                          <div class="content" [innerHtml]="check.pageHelpContent.content | safeHtml"></div>-->
                                              <div class="content">{{check.pageHelpContent.content}}</div>
                                            </td>
                                            <td>
                                                <div class="placement" href="#">{{check.pageHelpContent.placement}}</div>
                                            </td>
                                            <td>
                                                <div class="order" href="#">{{check.pageHelpContent.order}}
                                                </div>
                                            </td>
                                            <!--<td>
                                                <div class="isPriorTo" href="#">{{check.pageHelpContent.isPriorTo}}
                                                </div>
                                            </td>-->
                                            <td>
                                              <mat-slide-toggle [checked]="check.pageHelpContent.isActive"
                                                                (change)="($event.source.checked = check.pageHelpContent.isActive);togglePageHelpContents(!check.pageHelpContent.isActive,[check.pageHelpContent._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)="editPageHelpContent(check.pageHelpContent._id)">
                                                    <input title="Delete" src="assets/imgs/icn_trash.png" class="delete" type="image" (click)="confirmDeletePageHelpContent(check.pageHelpContent._id)">
                                                </div>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>

                                    <div *ngIf="checkboxes.length==0" class="col-md-12">
                                        <div class="uk-alert-warning" uk-alert>No page contents 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)="newPageContent()"></fab>
</div>

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