
<ol class="breadcrumb breadcrumb-arrow font-trirong">
  <li><a href="javascript://" [routerLink]="['/cns-portal/dashboard/order']"> <clr-icon shape="home"></clr-icon></a></li>
  <li><a href="javascript://"> <clr-icon shape="flag"></clr-icon> SureConnect</a></li>
</ol>
<br>


<div class="dg-wrapper">
  <div class="clr-row">
    <div class="clr-col-8">
      <h3>All SureConnect </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" [(clrDgSelected)]="selected" >
    <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]="'Name'"> <ng-container *clrDgHideableColumn="{hidden: false}">
       Name
    </ng-container></clr-dg-column>
    <clr-dg-column [clrDgField]="'description'"> <ng-container *clrDgHideableColumn="{hidden: false}">
      Description
    </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 alldata" [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 id="word">{{user.connection_name}}</clr-dg-cell>
      <clr-dg-cell id="word">{{user.description}}</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" *ngIf="medit == 'true'" (click)="goToEdit(user.id)">Edit <clr-icon shape="edit" class="is-error"></clr-icon></button>
        <button class="action-item" *ngIf="mdelete == 'true'" (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">Name: </td>
            <td class="td-content">{{user.Name}}</td>
          </tr>
          <tr>
            <td class="td-title"> Description:</td>
            <td class="td-content">{{user.description}}</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]">data per page</clr-dg-page-size>
        {{pagination.firstItem + 1}} - {{pagination.lastItem + 1}}
        of {{pagination.totalItems}} data
      </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="submit" (click)="delete(rowSelected.id)" class="btn btn-primary" >Delete</button>
    </div>
  </div>
</clr-modal>


