<ion-header>
  <div class="title width-100">
    <div class="title-container d-flex justify-space-between">
      <span class="text-center mt-0 aside-title px-20"><label>Eventos para Aprovação</label></span>
      <button class="btn-no-color" (click)="doRefresh()">
        <ion-icon class="title-icon font-awesome" name="reload-circle"></ion-icon>
      </button>
    </div>
    <ion-toolbar>
      <ion-segment [(ngModel)]="segment" (ionChange)="segmentChanged($event)">
        <ion-segment-button value="MDGPR">
          Meu calendário
        </ion-segment-button>
        <ion-segment-button value="PR">
          Presidente da República
        </ion-segment-button>
      </ion-segment>
    </ion-toolbar>
   </div>
</ion-header>
<ion-content>
  <ion-refresher name="refresher" slot="fixed" (ionRefresh)="doRefresh()">
     <ion-refresher-content>
    </ion-refresher-content>
  </ion-refresher>
  <div class="main-content overflow-y-auto height-100" [ngSwitch]="segment">

    <ion-progress-bar type="indeterminate" *ngIf="showLoader"></ion-progress-bar>
    <div *ngSwitchCase="'MDGPR'" class="height-100">

      <div *ngIf="eventaprovacaostore.listmd.length != 0">

        <ion-list class="width-100"  >
          <div
            class="expediente item-hover ion-no-padding ion-no-margin cursor-pointer"
            *ngFor="let event of eventaprovacaostore.listmd"
            (click)="goToEventDetail(event)"
          >
            <!-- (click)="openApproveModal(event)" -->
            <div class="event-mdgpr-{{event.workflowInstanceDataFields.Agenda}} width-100">
              <div class="approve-event-time">
                <p>{{event.workflowInstanceDataFields.StartDate | date: 'HH:mm'}}</p>
                <p>{{event.workflowInstanceDataFields.EndDate | date: 'HH:mm'}}</p>
              </div>
              <div class="approve-event-detail">
                <p *ngIf="toDateString(event.workflowInstanceDataFields.StartDate) != toDateString(event.workflowInstanceDataFields.EndDate)">{{event.workflowInstanceDataFields.StartDate | date: 'd/M/yy' }} - {{ event.workflowInstanceDataFields.EndDate | date: 'dd/M/yy'}}  |  {{event.workflowInstanceDataFields.Location}}</p>
                <p *ngIf="toDateString(event.workflowInstanceDataFields.StartDate) == toDateString(event.workflowInstanceDataFields.EndDate)">{{event.workflowInstanceDataFields.StartDate | date: 'd/M/yy' }}  |  {{event.workflowInstanceDataFields.Location}}</p>
                <h3>{{event.workflowInstanceDataFields.Subject}}</h3>
              </div>
            </div>
          </div>
        </ion-list>
      </div>

      <div  *ngIf="eventaprovacaostore.listmd.length == 0" class="centered-div">
        <div *ngSwitchCase="'MDGPR'" >
          <div class="d-flex height-90 align-center justify-content-center"
            >
            Lista vazia
          </div>
        </div>
      </div>
  </div>
  <div *ngSwitchCase="'PR'">
    <div *ngIf="eventaprovacaostore.listpr.length != 0">
      <ion-list class="width-100" *ngSwitchCase="'PR'">
        <div class="width-100" *ngIf="eventaprovacaostore.listpr">
          <div
            class="expediente item-hover ion-no-padding ion-no-margin cursor-pointer"
            *ngFor="let event of eventaprovacaostore.listpr"
            (click)="goToEventDetail(event)"
          >
            <div class="item event-pr-{{event.workflowInstanceDataFields.Agenda}} width-100">
              <div class="approve-event-time">
                <p>{{event.workflowInstanceDataFields.StartDate | date: 'HH:mm'}}</p>
                <p>{{event.workflowInstanceDataFields.EndDate | date: 'HH:mm'}}</p>
              </div>
              <div class="approve-event-detail">
                <p *ngIf="toDateString(event.workflowInstanceDataFields.StartDate) != toDateString(event.workflowInstanceDataFields.EndDate)">{{event.workflowInstanceDataFields.StartDate | date: 'd/M/yy' }} - {{ event.workflowInstanceDataFields.EndDate | date: 'dd/M/yy'}}  |  {{event.workflowInstanceDataFields.Location}}</p>
                <p *ngIf="toDateString(event.workflowInstanceDataFields.StartDate) == toDateString(event.workflowInstanceDataFields.EndDate)">{{event.workflowInstanceDataFields.StartDate | date: 'd/M/yy' }}  |  {{event.workflowInstanceDataFields.Location}}</p>
                <h3>{{event.workflowInstanceDataFields.Subject}}</h3>
              </div>
            </div>
          </div>
        </div>
      </ion-list>

    </div>

    <div  *ngIf="eventaprovacaostore.listpr.length == 0" class="centered-div d-flex height-90 align-center justify-content-center">
      <div *ngSwitchCase="'PR'" >
        <div class="d-flex align-center justify-content-center"
          *ngIf="eventaprovacaostore.listpr.length < 1">
          Lista vazia
        </div>
      </div>
    </div>
  </div>
</div>

</ion-content>
