<ion-header class="ion-no-border">
  <div class="title">
    <div class="thetitle"><ion-label >Todas as tarefas</ion-label></div>
    <div class="theicon">
      <button class="btn-no-color" (click)="doRefresh()">
        <ion-icon slot="end" class="title-icon font-awesome" name="reload-circle"></ion-icon>
      </button>
    </div>
  </div>
</ion-header>
<ion-content>

  <ion-refresher name="refresher" slot="fixed" (ionRefresh)="doRefresh()">
      <ion-refresher-content
        pullingIcon="chevron-down-circle-outline"
        pullingText="deslize para actualizar"
        refreshingSpinner="circles"
        refreshingText="A actualizar...">
      </ion-refresher-content>

  </ion-refresher>

  <div class="overflow-y-auto height-100 width-100">
    <ion-progress-bar type="indeterminate" *ngIf="skeletonLoader"></ion-progress-bar>

    <div  *ngIf="allProcessesList.length >= 0">
      <ion-item-sliding class="overflow-y-auto height-100">
        <div class="listview">
          <ion-list *ngIf="allProcessesList">
            <div
              class="item-wrapper item-hover ion-no-padding cursor-pointer"
              *ngFor = "let task of allProcessesList"
              (click)="goToProcess(task.SerialNumber, task.WorkflowName, task.activityInstanceName)">
              <div class="item width-100">
                <div class="item-top-detail">
                  <div class="item-subject">
                    <ion-label>{{ task.Folio }}</ion-label>
                  </div>
                  <div *ngIf="task.DocumentsQty != 0" class="item-icon">
                    <ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/icons-expediente-attachment.svg"></ion-icon>
                    <ion-icon *ngIf="ThemeService.currentTheme == 'gov' " src="assets/images/theme/gov/icons-expediente-attachment.svg"></ion-icon>
                    <label>{{task.DocumentsQty}}</label>
                  </div>
                </div>
                <div class="item-middle-detail">
                  <div class="item-remetente">
                    <ion-label>{{task.Senders}}</ion-label>
                  </div>
                </div>
                <div *ngIf="task.Agenda" class="item-middle-detail">
                  <div class="item-remetente">
                    <ion-label>{{task.customDate}}</ion-label>
                  </div>
                </div>
                <div *ngIf="task.Agenda" class="item-middle-detail-extra">
                  <div class="item-middle-detail-extra-text">
                    <ion-label *ngIf=" task.WorkflowName == 'Agenda Oficial PR' || task.WorkflowName == 'Agenda Pessoal PR'">
                      Agenda {{task.Agenda}} do Presidente da República
                    </ion-label>
                    <ion-label *ngIf=" task.WorkflowName == 'Agenda Oficial MDGPR' || task.WorkflowName == 'Agenda Pessoal MDGPR'">
                      A sua agenda {{task.Agenda}}
                    </ion-label>
                  </div>
                </div>
                <div class="item-bottom-detail d-flex align-items-center">
                  <div class="item-workflow">
                    <span class="label">{{task.activityInstanceName}}</span>
                  </div>
                  <div class="item-date">
                    <ion-label>{{ task.CreateDate | date: 'dd-MM-yyyy HH:mm' }}</ion-label>
                  </div>
                </div>
              </div>
            </div>
          </ion-list>
        </div>
      </ion-item-sliding>
    </div>

    <div
      *ngIf="!skeletonLoader && allProcessesList.length == 0"
      class="empty-list d-flex height-100 align-center justify-content-center"
    >
      <span>Lista vazia</span>
    </div>

    <div *ngIf="skeletonLoader && allProcessesList.length == 0">

      <ion-list>
        <ion-item>
          <ion-thumbnail slot="end">
            <ion-skeleton-text animated></ion-skeleton-text>
          </ion-thumbnail>
          <ion-label>
            <h3><ion-skeleton-text animated style="width: 50%"></ion-skeleton-text></h3>
            <p><ion-skeleton-text animated style="width: 80%"></ion-skeleton-text></p>
            <p><ion-skeleton-text animated style="width: 60%"></ion-skeleton-text></p>
          </ion-label>
        </ion-item>
        <ion-item>
          <ion-thumbnail slot="end">
            <ion-skeleton-text animated></ion-skeleton-text>
          </ion-thumbnail>
          <ion-label>
            <h3><ion-skeleton-text animated style="width: 50%"></ion-skeleton-text></h3>
            <p><ion-skeleton-text animated style="width: 80%"></ion-skeleton-text></p>
            <p><ion-skeleton-text animated style="width: 60%"></ion-skeleton-text></p>
          </ion-label>
        </ion-item>
      </ion-list>
    </div>

  </div>


</ion-content>


