<ion-header class="ion-no-border px-20">
  <ion-toolbar class="px-10">
    <ion-title class="pa-0">Adicionar intervenientes</ion-title>
  </ion-toolbar>
  <ion-searchbar class="attendee-search-bar" (ionChange)="onChange($event)" placeholder="Insira email para adicionar destinatário"></ion-searchbar><!-- [(ngModel)]="searchCountryString" -->
  <ion-progress-bar type="indeterminate" *ngIf="showLoader"></ion-progress-bar>
</ion-header>

<ion-content class="height-100 overflow-y-auto">

  <ion-item-group class="d-flex flex-column height-100 ">
    <ion-list lines="none"  class="flex-grow-1 overflow-y-auto height-100" >
      <ion-item-sliding class="px-20">
        <div *ngFor="let attendee of contacts;">
          <ion-item (click)="selectContact(attendee)" class="cursor-pointer" *ngIf="filterSearchList(attendee)" >
            <div class="pr-10">
              <ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="font-35" src="assets/images/icons-default-profile.svg"></ion-icon>
              <ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="font-35" src="assets/images/theme/gov/icons-profile.svg"></ion-icon>
            </div>
            <ion-label>
              <h3>{{ attendee.Name }}</h3>
              <p>{{ attendee.EmailAddress }}</p>
            </ion-label>
            <div>
              <ion-icon *ngIf="ThemeService.currentTheme == 'default' "   class="font-35" src="assets/images/icons-add-25.svg" ></ion-icon>
              <ion-icon *ngIf="ThemeService.currentTheme == 'gov' "    class="font-35" src="assets/images/theme/gov/icons-add-25.svg" ></ion-icon>
            </div>
          </ion-item>
        </div>

      </ion-item-sliding>
    </ion-list>
    <hr/>

    <ion-list lines="none" *ngIf="LtaskParticipants.length >= 1 && adding == 'intervenient' " class="flex-grow-1 overflow-y-auto height-100 pb-0" >
      <div  class="px-20 font-15 pt-20" style="border-top:1px solid #ebebeb;font-weight: 500;" *ngIf="LtaskParticipants.length >= 1 || LtaskParticipantsCc.length >= 1"  > Destinatário</div>
      <ion-item-sliding class="px-20">
        <ion-item *ngFor="let attendee of LtaskParticipants;" class="d-flex">
          <div class="pr-10">
            <ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="font-35" src="assets/images/icons-default-profile.svg"></ion-icon>
            <ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="font-35" src="assets/images/theme/gov/icons-profile.svg"></ion-icon>
          </div>
          <ion-label>
            <h3>{{ attendee.Name }}</h3>
            <p>{{ attendee.EmailAddress }}</p>
          </ion-label>
          <div class="cursor-pointer" (click)="remove(attendee)">
            <ion-icon class="font-35" src="assets/images/icons-delete-25.svg"></ion-icon>
          </div>
        </ion-item>
      </ion-item-sliding>
    </ion-list>
    <ion-list lines="none" *ngIf="LtaskParticipantsCc.length >= 1 && adding == 'CC' " class="flex-grow-1 overflow-y-auto height-100 pb-0" >
      <div  class="px-20 font-15 pt-20" style="border-top:1px solid #ebebeb;font-weight: 500;" *ngIf="LtaskParticipants.length >= 1 || LtaskParticipantsCc.length >= 1"  > Destinatário</div>

      <ion-item-sliding class="px-20">
        <ion-item *ngFor="let attendee of LtaskParticipantsCc;" class="d-flex">
          <div class="pr-10">
            <ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="font-35" src="assets/images/icons-default-profile.svg"></ion-icon>
            <ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="font-35" src="assets/images/theme/gov/icons-profile.svg"></ion-icon>
          </div>
          <ion-label>
            <h3>{{ attendee.Name }}</h3>
            <p>{{ attendee.EmailAddress }}</p>
          </ion-label>
          <div class="cursor-pointer" (click)="remove(attendee)">
            <ion-icon class="font-35" src="assets/images/icons-delete-25.svg"></ion-icon>
          </div>
        </ion-item>
      </ion-item-sliding>
    </ion-list>
  </ion-item-group>

</ion-content>

<!-- Hide footer in gabinete-digital -->
<ion-footer class="ion-no-border" *ngIf="footer" >
  <ion-toolbar class="width-100 d-flex justify-space-between px-20">
    <ion-buttons slot="start">
      <button class="btn-cancel" fill="clear" color="#061b52" (click)="close()">
        <ion-label>Cancelar</ion-label>
      </button>
    </ion-buttons>
    <ion-buttons slot="end">
      <button class="btn-ok" fill="clear" color="#fff" (click)="save()">
        <ion-label>Gravar</ion-label>
      </button>
    </ion-buttons>
  </ion-toolbar>
</ion-footer>
