<title>Business Experience</title>

<div class="container-fluid">
  <div class="row">
    <div class="col-sm-6">
      <app-breadcrumb [title]="'Business Experiences'" [active_item]="'
Business Experiences'">
      </app-breadcrumb>
    </div>
    <div class="col-sm-6 text-right">
      <div ngbDropdown class="btn-group">
        <div class="ml-2">
          <a *ngIf="isWritePermission" title="{{ 'business_experience_tooltip_add_business_experience' |translate}}"
            href="javascript:;" class="btn btn-sm btn-info filterbtn" (click)="modalOpen(basicmodal)">
            <i class="icon-plus"></i>
          </a>
        </div>
      </div>
    </div>
    <div class="col-sm-12">
      <mat-drawer-container class="example-container" autosize>
        <div class="card">
          <ng-container *ngIf="businessExperiences && businessExperiences.length > 0 else NoBusinessExperiences">
            <div class="contentcard table-responsive userlist-table">
              <table mat-table [dataSource]="businessExperiences"
                class=" maintable mat-elevation-z8 table-striped table-vcenter box-shadow-none" aria-label="">
                <ng-container matColumnDef="id">
                  <th mat-header-cell *matHeaderCellDef style="width:75px">#</th>
                  <td mat-cell *matCellDef="let element; let i = index;" style="width:75px">
                    {{(paginate.currentPage - 1) * paginate.pageSize + i + 1}}
                  </td>
                </ng-container>
                <ng-container matColumnDef="name">
                  <th mat-header-cell *matHeaderCellDef>{{'lbl_name'| translate}}</th>
                  <td mat-cell *matCellDef="let element">
                    <div *ngIf="element.name else NoValue">
                      {{element.name}}
                    </div>
                    <ng-template #NoValue>
                      --
                    </ng-template>
                  </td>
                </ng-container>
                <!-- <ng-container matColumnDef="Status">
                  <th mat-header-cell *matHeaderCellDef translate>{{'lbl_status'| translate}}</th>
                  <td mat-cell *matCellDef="let element">
                    <ng-container *ngIf="element.isActive else InActive">
                      <span class="label text-success d-flex">
                        <div class="dot-label bg-success mr-1"></div>
                        <span>{{'lbl_active'| translate}}</span>
                      </span>
                    </ng-container>
                    <ng-template #InActive>
                      <span class="label text-warning d-flex">
                        <div class="dot-label bg-secondary mr-1"></div>
                        <span>{{'lbl_in_active'| translate}}</span>
                      </span>
                    </ng-template>
                  </td>
                </ng-container> -->
                <ng-container matColumnDef="Action">
                  <th mat-header-cell *matHeaderCellDef translate class="text-right"> {{'lbl_action'| translate}}</th>
                  <td mat-cell *matCellDef="let element" class="text-right" style="align-items: center;display: flex;">
                    <div class="media-body text-right icon-state">
                      <label title="{{ 'tooltip_lbl_change_status' |translate}}" class="switch" style="top:7px"
                        *ngIf="isEditPermission">
                        <input type="checkbox" (click)="changeStatus(element)" [(ngModel)]="element.isActive"><span
                          class="switch-state" [ngClass]="element.isActive ? 'bg-success' : 'bg-secondary'"></span>
                      </label>
                    </div>

                    <a *ngIf="isEditPermission"
                      title="{{ 'business_experience_tooltip_edit_business_experience' |translate}}" href="javascript:;"
                      class="btn btn-sm btn-info filterbtn" (click)="editDialog(element,basicmodal)">
                      <i class="icon-pencil"></i>
                    </a>
                  </td>
                </ng-container>
                <tr mat-header-row *matHeaderRowDef="displayColumns; sticky: true"></tr>
                <tr mat-row *matRowDef="let row; columns: displayColumns;" class="student-element-row"
                  style="cursor: pointer;"></tr>

              </table>
            </div>
          </ng-container>

          <ng-template #NoBusinessExperiences>
            <div class="d-flex vertical-center nodata">
            </div>
          </ng-template>

          <div class="card-footer" *ngIf="businessExperiences && businessExperiences.length > 0">
            <ul class="pagination mb-0 float-right">
              <li [ngClass]="{ disabled: paginate.currentPage == 1 }" class="page-item page-prev">
                <a class="page-link" href="javascript:;" tabindex="-1" (click)="setPage(paginate.currentPage - 1)">
                  <span>{{'button_lbl_prev'| translate}}</span>
                </a>
              </li>
              <li *ngFor="let page of paginate.pages" class="page-item active"
                [ngClass]="{ active: paginate.currentPage == page }"><a
                  [ngClass]="{current:paginate.currentPage == page}" class="page-link" href="javascript:;"
                  (click)="setPage(page)">{{page}}</a></li>
              <li [ngClass]="{ disabled: paginate.currentPage === paginate.totalPages}"
                (click)="setPage(paginate.currentPage + 1)" class="page-item page-next">
                <a class="page-link" href="javascript:;"><span>{{'button_lbl_next'| translate}}</span></a>
              </li>
            </ul>
          </div>

        </div>
      </mat-drawer-container>
    </div>
  </div>
</div>

<ng-template #basicmodal let-modal>
  <div>
    <form [formGroup]="businessExperienceform">
      <div class="modal-header">
        <h4 class="modal-title" id="modal-basic-title">{{title}}</h4>
        <button type="button" class="close" aria-label="Close" (click)="modal.dismiss('Cross click')">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body pd-20">

        <div class="form-group">
          <label for="name">{{'lbl_name'| translate}} <span style="color: red;">*</span></label>
          <input class="form-control" type="text" id="name" formControlName="name" required>
          <mat-error
            *ngIf="(businessExperienceform.get('name') && !businessExperienceform.get('name')!.valid && businessExperienceform.get('name')!.touched)">
            {{'message_lbl_name_is_required'| translate}}
          </mat-error>
        </div>

      </div>
      <div class="modal-footer">
        <button class="btn btn-sm btn-info filterbtn" (click)="insertBusinessExperience()">
          {{'button_lbl_save'| translate}}
        </button>
        <button class="btn btn-sm btn-secondary filterbtn" (click)="cancelUser()">
          {{'button_lbl_cancel'| translate}}
        </button>
      </div>
    </form>
  </div>
</ng-template>