open-learning-exchange/planet

View on GitHub
src/app/manager-dashboard/manager-fetch.component.html

Summary

Maintainability
Test Coverage
<mat-toolbar>
  <button mat-icon-button (click)="goBack()"><mat-icon>arrow_back</mat-icon></button>
  <span i18n>Courses/Resources Sent</span>
  <span class="toolbar-fill"></span>
</mat-toolbar>
<div class="space-container primary-link-hover">
  <mat-toolbar class="primary-color font-size-1">
    <span class="toolbar-fill"></span>
    <button mat-button [disabled]="!selection.selected.length" (click)="getPushedItem()">
      <mat-icon aria-hidden="true" class="margin-lr-3">cloud_download</mat-icon><span i18n>Get Courses/Resources</span>
    </button>
  </mat-toolbar>

  <div class="view-container view-full-height view-table" *ngIf="!emptyData; else notFoundMessage">
    <mat-table #table [dataSource]="pushedItems" matSort>
      <ng-container matColumnDef="select">
        <mat-header-cell *matHeaderCellDef>
          <mat-checkbox (change)="$event ? masterToggle() : null"
          [checked]="selection.hasValue() && isAllSelected()"
          [indeterminate]="selection.hasValue() && !isAllSelected()">
          </mat-checkbox>
        </mat-header-cell>
        <mat-cell *matCellDef="let row">
          <mat-checkbox
            (click)="$event.stopPropagation()"
            (change)="$event ? selection.toggle(row._id) : null"
            [checked]="selection.isSelected(row._id)">
          </mat-checkbox>
        </mat-cell>
      </ng-container>
      <ng-container matColumnDef="item">
        <mat-header-cell *matHeaderCellDef mat-sort-header="item" i18n>Title</mat-header-cell>
        <mat-cell *matCellDef="let element">
          <ng-container *ngIf="element.db === 'resources'">{{ element.item.doc.title }}<mat-icon class="margin-lr-5" svgIcon="myLibrary"></mat-icon></ng-container>
          <ng-container *ngIf="element.db === 'courses'">{{ element.item.doc.courseTitle }}<mat-icon class="margin-lr-5" svgIcon="myCourses"></mat-icon></ng-container>
        </mat-cell>
      </ng-container>
      <ng-container matColumnDef="date">
        <mat-header-cell *matHeaderCellDef i18n>Date Sent</mat-header-cell>
        <mat-cell *matCellDef="let element">{{ element.time | date}}</mat-cell>
      </ng-container>
      <mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
      <mat-row *matRowDef="let row; columns: displayedColumns;" class="cursor-pointer" [ngClass]="{highlight:selection.isSelected(row._id)}" (click)="selection.toggle(row._id)"></mat-row>
    </mat-table>

    <mat-paginator #paginator
      [pageSize]="50"
      [pageSizeOptions]="[5, 10, 20, 50, 100, 200]"
      (page)="onPaginateChange($event)">
    </mat-paginator>
  </div>
  <ng-template #notFoundMessage>
    <div class="view-container" i18n>No Record Found</div>
  </ng-template>
</div>