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

<ion-content class="container-wrapper">
  <div class="main-content d-flex height-100 overflow-hidden">
    <div class="content d-flex flex-column" *ngIf="task">
      <div class="main-header">
        <div class="title-content width-100 d-flex justify-space-between">
          <div class="font-30 cursor-pointer" (click)="goBack()" defaultHref="#">
            <ion-icon  *ngIf="ThemeService.currentTheme == 'default' " slot="end" src='assets/images/icons-arrow-arrow-left.svg'></ion-icon>
            <ion-icon *ngIf="ThemeService.currentTheme == 'gov' " slot="end" src='assets/images/theme/gov/icons-calendar-arrow-left.svg'></ion-icon>
          </div>
          <div class="middle d-flex align-center flex-grow-1 ">
            <ion-label class="title">{{ task.Folio}}</ion-label>
          </div>
          <div class="div-icon" (click)="openOptions()">
              <!-- <ion-menu-button autoHide="false">
                <ion-icon name="ellipsis-vertical-outline"></ion-icon>
              </ion-menu-button> -->
              <ion-icon class="font-25 cursor-pointer" name="ellipsis-vertical-outline"></ion-icon>
          </div>
        </div>
      </div>
      <div class="upper-content">
        <div class="content-details">
          <ion-label>
            <p><span class="date">{{customDate}}</span><span class="label">{{ task.activityInstanceName }}</span></p>
            <p><span class="color-red">{{ task.DeadlineType }}</span></p>
          </ion-label>
        </div>
      </div>
      <div class="line"></div>
      <div class="middle-content">
        <h5 *ngIf="intervenientes">Intervenientes</h5>
        <ion-item class="ion-no-margin ion-no-padding">
          <ion-label>
            <div *ngFor="let interveniente of intervenientes">
              <p>{{interveniente.Name}}</p>
            </div>
          </ion-label>
        </ion-item>
        <div *ngIf="cc.length > 0">
          <h5>Com conhecimento</h5>
          <ion-item class="ion-no-margin ion-no-padding">
            <ion-label>
              <div *ngFor="let c of cc">
                <p>{{c.Name}}</p>
              </div>
            </ion-label>
          </ion-item>
        </div>
        <div *ngIf="fulltask.workflowInstanceDataFields.TaskMessage">
          <h5>Detalhes</h5>
          <ion-item class="ion-no-margin ion-no-padding">
              <p [innerHTML]="fulltask.workflowInstanceDataFields.TaskMessage"></p>
          </ion-item>
        </div>
      </div>
      <div class="bottom-content width-100">
        <ion-list>
          <h5>Documentos Anexados</h5>
          <ion-item *ngFor="let attachment of attachments"
            class="ion-no-margin ion-no-padding cursor-pointer"
          >
            <ion-label
              (click)="viewDocument(attachment.DocId, attachment)"
            >
              <p *ngIf="attachment.Assunto" class="attach-title-item">{{ attachment.Assunto }}<span class="span-right color-red btn-size"><ion-icon hidden name="close"></ion-icon></span></p>
              <p *ngIf="!attachment.Assunto" class="attach-title-item">{{ attachment.DocNumber }}<span class="span-right color-red btn-size"><ion-icon hidden name="close"></ion-icon></span></p>
              <p><span class="span-left">{{attachment.Sender}}</span><span class="span-right">{{ attachment.DocDate | date: 'dd/MM/yy' }}</span></p>
            </ion-label>
        </ion-item>
        </ion-list>
      </div>
    </div>

    <div *ngIf="task" class="aside-right flex-column height-100 overflow-y-auto">
      <div class="buttons">
        <button (click)="Assinar()" class="btn-cancel" shape="round" >Assinado</button>
        <div class="solid"></div>
      </div>
    </div>

    <div *ngIf="!task">
      <ion-list>
        <ion-list-header>
          <ion-label>
            <ion-skeleton-text animated style="width: 50%"></ion-skeleton-text>
          </ion-label>
        </ion-list-header>
        <ion-item>
          <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>
          </ion-label>
        </ion-item>
        <ion-item>
          <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>
          </ion-label>
        </ion-item>
        <ion-item>
          <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>
          </ion-label>
        </ion-item>
        <button color="medium" shape="round" expand="block">
          <!-- <ion-icon color="medium" name="attach" slot="start"></ion-icon> -->
          <ion-skeleton-text animated style="width: 50%"></ion-skeleton-text>
        </button>
      </ion-list>
    </div>
  </div>
</ion-content>

