<ion-header>
  <ion-toolbar class="header-toolbar-new">
      <ion-buttons slot="start">
        <nav-buttons backLink="/home"></nav-buttons>
      </ion-buttons>
      <ion-title>WORK LIST</ion-title>
  </ion-toolbar>
</ion-header>


<ion-content>
  <div class="contentBg">
    <div class="result-graph">
      <div class="request-heading">
        <span>Open Request Analysis</span>
      </div>
      <div class="result-text-container">
          <h2>{{totalRequestCount}}</h2>
          <span>TOTAL <br> OPEN REQUEST</span>
      </div>
      <p-chart class="today-graph" type="doughnut" [data]="data" [options]="options"></p-chart>
    </div>

    <ion-row class="filters-row">
      <ion-slides [options]="slideOptsOne">
          <ion-slide *ngFor="let filter of filters;  let i=index" [ngClass]="filter.disable === true ? 'disable-filter' : ''">
              <app-card-filter
                [value]="filter.value"
                [text]="filter.name"
                [color]="filter.color"
                [active]="filter.active"
                (click)="activeFilter(i)"
              ></app-card-filter>
          </ion-slide>
      </ion-slides>
    </ion-row>
    
    <ion-row class="search-container">
        <ion-col style="float: left;" size=[6] *ngIf="showSearchButton" (click)="clearSearch()">
            <span style="margin-left: 5px;">Clear Search</span>
            <ion-icon name="close" ></ion-icon>
        </ion-col>
        <ion-col style="float: right;" size=[6] (click)="openSearchModal()" *ngIf="selectedFilter === 'ALL'">
            <ion-icon name="search" ></ion-icon>
            <span>Advanced Search</span>
        </ion-col> 
    </ion-row>
    <!-- <div class="total-result" *ngIf="isEmptyObject() && selectedFilter === 'ALL' && showSearchButton === false">
      <span>showing {{newWorkListResponse.length}} of {{filters[0].value}}</span>
    </div> -->

    <ion-row *ngIf='selectedFilter === "ITG"'>
      <ion-col>
        <ion-slides>
          <ion-slide class='slideCss' *ngFor="let segment of ITGSegment">
            <span [ngClass]="segment.style? 'text-span-active': 'text-span'" (click)="setActive(segment.code)">
                {{segment.name}}              
            </span>
          </ion-slide>
        </ion-slides>
      </ion-col>
    </ion-row>

    <div [ngClass]="isEmptyObject() ? 'work-list-container' : ''" *ngIf='selectedFilter != "ITG"'>
        <div *ngFor="let data of showFormattedData | keyvalue;  let i = index">
          <span class="date-span">{{data.key}}</span>
          <div (click)="openNotificationDetail(data.value)" class="date-data" *ngFor="let workList of data.value;  let j = index">
            <p>{{workList.SUBJECT}}</p>
          </div>
        </div>
    </div>


    <div [ngClass]="isEmptyObject() ? 'work-list-container' : ''" *ngIf="selectedFilter == 'ITG'" >
        <div  *ngFor='let segmentInfo of ITGItem[0]; let i= index' (click)='openITG(segmentInfo)'>
          <span class="date-span">{{segmentInfo.ModifiedDate |date}}</span>
          <div class="date-data">
            <p>{{segmentInfo.Title}}</p>
          </div>
        </div>
    </div>
  

    <div class="no-data-available" *ngIf="!isEmptyObject()">
      <span>No Data Available</span>
    </div>
  </div>
  
  <ion-infinite-scroll (ionInfinite)="doInfinite($event)">
    <ion-infinite-scroll-content></ion-infinite-scroll-content>
  </ion-infinite-scroll>

</ion-content>

