<ol class="breadcrumb breadcrumb-arrow font-trirong">
  <li><a href="javascript://" [routerLink]="['/']"><clr-icon shape="home"></clr-icon></a></li>
  <li><a href="javascript://"> <clr-icon shape="crown"></clr-icon>Super Admin</a></li>
  <li><a href="javascript://">Form-Extension</a></li>
</ol>

<div class="dg-wrapper">
  <div class="clr-row">
    <div class="clr-col-8">
      <h3>Form-Extension <span *ngIf="getFormCode !== undefined">- {{getFormCode}}</span></h3>
    </div>
    <div class="clr-col-4" style="text-align: right;">


      <button id="add"  class="btn btn-primary"  (click)="goToAdd()" >
        <clr-icon shape="plus"></clr-icon>ADD
      </button>
    </div>
  </div>
  <clr-datagrid [clrDgLoading]="loading">
    
    <clr-dg-placeholder><ng-template #loadingSpinner><clr-spinner>Loading ... </clr-spinner></ng-template>
      <div *ngIf="error;else loadingSpinner">{{error}}</div></clr-dg-placeholder>
    
      <clr-dg-column [clrDgField]="''" style="max-width: 40px;"> <ng-container *clrDgHideableColumn="{hidden: false}">
      </ng-container></clr-dg-column>
  
      <clr-dg-column [clrDgField]="''"><ng-container *clrDgHideableColumn="{hidden: false}">
          Go To
      </ng-container></clr-dg-column>
    <clr-dg-column [clrDgField]="'fieldname'"> <ng-container *clrDgHideableColumn="{hidden: false}">
      Field Name
    </ng-container></clr-dg-column>
    <clr-dg-column [clrDgField]="'mapping'"> <ng-container *clrDgHideableColumn="{hidden: false}">
      Mapping
    </ng-container></clr-dg-column>
    <clr-dg-column [clrDgField]="' datatype'"> <ng-container *clrDgHideableColumn="{hidden: false}">
      Data Type
   </ng-container> </clr-dg-column >
   <clr-dg-column> <ng-container *clrDgHideableColumn="{hidden: false}"> <clr-icon shape="bars"></clr-icon> 
    Action
  </ng-container></clr-dg-column>

    <clr-dg-row *clrDgItems="let user of rows" [clrDgItem]="user" >
      <clr-dg-cell style="max-width: 40px;">
        <span style="cursor: pointer;"><clr-icon shape="edit" (click)="goToEdit(user.id)" class="red is-error" style="color:red;"></clr-icon></span>
      </clr-dg-cell>
      <clr-dg-cell><span class="label label-light-blue" style="display: inline;margin-left: 10px; cursor: pointer;" (click)="buildExtension(user.id,user.account_id)">Build</span></clr-dg-cell>
     
      <clr-dg-cell>{{user.field_name}}</clr-dg-cell>
      <clr-dg-cell>{{user.mapping}}</clr-dg-cell>
      <clr-dg-cell> {{user.data_type}}</clr-dg-cell>
      <clr-dg-cell>
        <span style="cursor: pointer;padding: 10px; "><clr-icon shape="trash"  (click)="onDelete(user)" class="red is-error" style="color: red;"></clr-icon></span>
        <clr-signpost>
          <span style="cursor: pointer;" clrSignpostTrigger><clr-icon shape="help" class="success" style="color: rgb(0, 130, 236);"></clr-icon></span>
          <clr-signpost-content [clrPosition]="'left-middle'" *clrIfOpen>
            <h5 style="margin-top: 0">Who Column</h5>
                  <div>Account ID: <code class="clr-code">{{user.accountId}}</code></div>
                  <div>Created At: <code class="clr-code">{{user.createdAt| date}}</code></div>
                  <div>Created By: <code class="clr-code">{{user.createdBy}}</code></div>
                  <div>Updated At: <code class="clr-code">{{user.updatedAt | date}}</code></div>
                  <div>Updated By: <code class="clr-code">{{user.updatedBy}}</code></div>
          </clr-signpost-content>
        </clr-signpost>
      </clr-dg-cell>
      <!-- <clr-dg-action-overflow>
        <button class="action-item" (click)="buildExtension(user.account_id)">Build <clr-icon shape="pop-out" class="is-error"></clr-icon> </button>
        <button class="action-item"  (click)="goToEdit(user.id)">Edit<clr-icon shape="edit" class="is-error"></clr-icon></button>
        <button class="action-item"  (click)="onDelete(user)">Delete<clr-icon shape="trash" class="is-error"></clr-icon></button>
      </clr-dg-action-overflow> -->
      <clr-dg-row-detail *clrIfExpanded >
        <table class="table">
          <tr>
            <td class="td-title">Field Name: </td>
            <td class="td-content">{{user.field_name}}</td>
          </tr>
        </table>
      </clr-dg-row-detail>
    </clr-dg-row>
    <clr-dg-footer>
      <clr-dg-pagination #pagination [clrDgPageSize]="10">
        <clr-dg-page-size [clrPageSizeOptions]="[10,20,50,100]">Users per page</clr-dg-page-size>
        {{pagination.firstItem + 1}} - {{pagination.lastItem + 1}}
        of {{pagination.totalItems}} users
      </clr-dg-pagination>
    </clr-dg-footer>
  </clr-datagrid>
</div>

<clr-modal [(clrModalOpen)]="modaldelete" [clrModalSize]="'lg'" [clrModalStaticBackdrop]="true">

  <div class="modal-body" *ngIf="rowSelected.id">
    <h1 class="delete">Are You Sure Want to delete?</h1>
    <h2 class="heading">{{rowSelected.id}}</h2>
    <div class="modal-footer">
      <button type="button" class="btn btn-outline" (click)="modaldelete = false">Cancel</button>
    <button type="button" (click)="delete(rowSelected.id)" class="btn btn-primary" >Delete</button>
    </div>
  </div>
</clr-modal>
