<ion-header class="ion-no-border">
  <app-header></app-header>
</ion-header>

<ion-header class="ion-no-border init-event-header">
  <ion-label>
    <p class="time ion-text-center">{{customDate}}</p>
  </ion-label>
  <ion-label>
    <p *ngIf="totalEvent==1" class="event-number p-small ion-text-center"> <strong>{{totalEvent}}</strong> evento agendado para hoje</p>
    <p *ngIf="totalEvent!=1"class="event-number p-small ion-text-center"> <strong>{{totalEvent}}</strong> eventos agendados para hoje</p>
  </ion-label>
  <div class="next-meeting">
    <div class="meeting-time" *ngIf="currentHoursMinutes">{{currentHoursMinutes | date: 'HH:mm'}}</div>
    <div class="meeting-description" *ngIf="currentEvent"> "{{currentEvent}}"</div>
  </div>

</ion-header>

<ion-content class="main " ng-controller="AppController">
  <ion-refresher slot="fixed" (ionRefresh)="doRefresh($event)">
    <ion-refresher-content>
    </ion-refresher-content>
  </ion-refresher>

    <ion-progress-bar type="indeterminate" *ngIf="showLoader"></ion-progress-bar>

    <div class="conteiner-box px-20 height-100" ng-swipe-up="swipe($event)">
      <div class="schedule height-100">
        <div class="schedule-header">
          <div class="title">
            <ion-icon class="icon" slot="end" src="assets/images/icons-default-agenda.svg" ></ion-icon>
            <div class="text">A sua Agenda</div>
          </div>
          <button class="btn-no-color" [routerLink]="['/home/agenda']">
            <ion-icon
            *ngIf="ThemeService.currentTheme == 'default' "
            class="icon-next"
            slot="end"
            src="assets/images/icons-arrow-circle-arrow-right.svg"
            ></ion-icon>

            <ion-icon
            *ngIf="ThemeService.currentTheme == 'gov' "
            class="icon-next"
            slot="end"
            src="assets/images/theme/gov/icons-arrow-circle-arrow-right.svg"
            ></ion-icon>

            <ion-icon
            *ngIf="ThemeService.currentTheme == 'tribunal' "
            class="icon-next"
            slot="end"
            src="assets/images/theme/tribunal/icons-arrow-circle-arrow-right.svg"
            ></ion-icon>

          </button>
        </div>
        <div class="content overflow-y-auto flex-grow-1 height-100">

          <ion-list>
            <ion-item class="item-hover cursor-pointer" lines="none" *ngFor="let event of listToPresent"
              (click)="goToEvent(event.EventId)"
            >
            <div class="d-flex  content-{{loggeduser.Profile}}-{{event.CalendarName}}">

              <div class="schedule-time">
                <div *ngIf="!event.IsAllDayEvent" class="time-start">{{event.StartDate | date: 'HH:mm'}}</div>
                <div *ngIf="!event.IsAllDayEvent" class="time-end">{{event.EndDate | date: 'HH:mm'}}</div>

                <div *ngIf="event.IsAllDayEvent" class="time-start"> Todo </div>
                <div *ngIf="event.IsAllDayEvent" class="time-end text-center"> o dia </div>
                <div></div>
              </div>
              <div class="schedule-details">
                <div class="location">{{event.Location}}</div>
                <div class="description">
                  <p>{{event.Subject}}</p>
                </div>
              </div>
            </div>
            </ion-item>

          </ion-list>
          <!--
          <div class="resume">
            <div class="title">
              Resumo para Amnahã
            </div>
            <div class="event-num">4 eventos ageandados para amanhã</div>
            <div class="first-event-time">08:30 "Reunião Staff" no Palácio Presidencial</div>
          </div>
          -->
        </div>
      </div>

      <div class="schedule height-100">
        <div class="schedule-header">
          <div class="title">
            <ion-icon class="icon" slot="end" src="assets/images/icons-correspondencias.svg"></ion-icon>
            <div class="text">Correspondência por ler</div>
          </div>
          <button (click)="viewExpedientListPage()" class="btn-no-color cursor-pointer">
            <ion-icon
            *ngIf="ThemeService.currentTheme == 'default' "
            class="icon-next"
            slot="end"
            src="assets/images/icons-arrow-circle-arrow-right.svg"
            ></ion-icon>

            <ion-icon
            *ngIf="ThemeService.currentTheme == 'gov' "
            class="icon-next"
            slot="end"
            src="assets/images/theme/gov/icons-arrow-circle-arrow-right.svg"
            ></ion-icon>

            <ion-icon
            *ngIf="ThemeService.currentTheme == 'tribunal' "
            class="icon-next"
            slot="end"
            src="assets/images/theme/tribunal/icons-arrow-circle-arrow-right.svg"
            ></ion-icon>
          </button>
        </div>
        <div class="content overflow-y-auto flex-grow-1 height-100">
          <ion-list>
            <ion-item class="item-hover cursor-pointer" lines="none" *ngFor = "let task of listToPresentexpediente"
            (click)="goToExpediente(task.SerialNumber)">
            <div class="item-exp d-flex">
              <div class="schedule-date">
                <div class="time-end">{{task.taskStartDate | date: 'dd-MM-yyyy'}}</div>
                <div class="time-start">{{task.taskStartDate | date: 'HH:mm'}}</div>
              </div>
              <div class="schedule-details pointer">
                <div class="description">{{ task.Subject }}</div>
                <div class="location">{{ task.Senders }}</div>
              </div>
            </div>
            </ion-item>

          </ion-list>
        </div>
      </div>
    </div>

    <!-- <iframe id="home-iframe" style="width: 100%;" src="/assets/www/pdfjs/web/viewer.html?file=/assets/www/pdfjs/web/compressed.tracemonkey-pldi-09.pdf.pdf"></iframe> -->
</ion-content>
