<ion-header  class="ion-no-border">
  <ion-toolbar class="header-toolbar">
    <div class="main-header width-100">
      <div class="title-content width-100">
        <div class="back-icon cursor-pointer">
          <button class="btn-no-color" (click)="openGroupMessagesPage()">
            <ion-icon *ngIf="ThemeService.currentTheme == 'default' " slot="end" src='assets/images/icons-arrow-arrow-left.svg'></ion-icon>
            <ion-icon *ngIf="ThemeService.currentTheme == 'gov' " slot="end" src='assets/images/theme/gov/icons-calendar-arrow-left.svg'></ion-icon>
          </button>
        </div>
        <div class="div-title">
          <ion-label class="title">Contactos</ion-label>
        </div>
        <div>
          <button class="btn-no-color adicionar" (click)="updateGroup()">
            <ion-label>Adicionar</ion-label>
          </button>
        </div>
      </div>
    </div>
  </ion-toolbar>
  <ion-toolbar class="toolbar-search">
    <div class="search">
      <ion-searchbar debounce="500" (ionChange)="onChange($event)" placeholder="Pesquisar por contacto" ></ion-searchbar>
    </div>
  </ion-toolbar>
</ion-header>

<ion-content class="width-100">
  <ion-refresher  name="refresher" slot="fixed" (ionRefresh)="doRefresh($event)">
      <ion-progress-bar type="indeterminate" *ngIf="showLoader"></ion-progress-bar>
      <ion-refresher-content>
      </ion-refresher-content>
    </ion-refresher>

  <div class="main-content width-100">
    <div class="members" *ngIf="members">
      <ion-label class="members-label">Contactos selecção:</ion-label>
      <ion-list class="members-list" *ngFor="let user of members">
        <div class="members-checkbox">
          <ion-checkbox disabled checked color="primary"></ion-checkbox>
          <p>{{user.name}}</p>
          <ion-icon  class="{{user.status}}" name="ellipse"></ion-icon>
          <button (click)="deleteMember(user)" class="btn-no-color detele-item-icon">
            <ion-icon color="danger" name="close"></ion-icon>
          </button>
        </div>
      </ion-list>
    </div>

    <ion-virtual-scroll [items]="users | filter:textSearch: 'name'" approxItemHeight="70px" [headerFn]="separateLetter">

      <div class="item-divider" *virtualHeader="let header">
        <ion-label>{{header}}</ion-label>
      </div>

      <div *virtualItem="let user" class="item-checkbox">
        <ion-checkbox (ionChange)="selectedContact(user)" color="primary"></ion-checkbox>
        <ion-label>{{user.name}}</ion-label>
        <div class="icon"><ion-icon class="{{user.status}}" name="ellipse"></ion-icon></div>
      </div>

    </ion-virtual-scroll>

  </div>
</ion-content>
