open-learning-exchange/planet

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

Summary

Maintainability
Test Coverage
<mat-toolbar>
  <button class="btnBack" mat-icon-button routerLink="/">
    <mat-icon>arrow_back</mat-icon>
  </button>
  <span i18n>Manager Settings</span>
</mat-toolbar>
<div class="space-container">
  <ng-container *ngIf="planetType !== 'community'">
    <a routerLink="requests" i18n mat-raised-button *planetAuthorizedRoles="'manager'">{ planetType, select, nation {Manage Communities} center {Manage Nations} }</a>
  </ng-container>
  <a *ngIf="planetType !== 'community' || isHub" [routerLink]="['reports', isHub ? { 'hubId': planetConfiguration._id } : {}]" i18n mat-raised-button>Reports</a>
  <a [routerLink]="['reports', 'myplanet', isHub ? { 'hubId': planetConfiguration._id } : {}]" i18n mat-raised-button>myPlanet Reports</a>
  <ng-container *planetAuthorizedRoles="'manager'">
    <a [routerLink]="['surveys']" mat-raised-button i18n>Surveys</a>
    <button *ngIf="planetType !== center && showResendConfiguration"
      (click)="resendConfig()" i18n mat-raised-button>Resend Registration Request</button>
    <button *ngIf="devMode"
      (click)="openDeleteCommunityDialog()" i18n mat-raised-button>Delete Community</button>
    <a routerLink="/feedback" i18n mat-raised-button>Feedback</a>
    <a routerLink="configuration" i18n mat-raised-button>Configuration</a>
    <a routerLink="fetch" mat-raised-button *ngIf="fetchItemCount > 0"><span i18n>Fetch Items</span>{{ ' (' + fetchItemCount + ')' }}</a>
    <ng-container *ngIf="requestStatus === 'accepted'">
      <a routerLink="sync" i18n mat-raised-button>Manage Sync</a>
      <a routerLink="/upgrade" *ngIf="versionLocal !== versionParent" i18n mat-raised-button>Upgrade</a>
      <a routerLink="/upgrade/myplanet" *ngIf="versionLocal === versionParent && versionLocalApk !== versionLatestApk" i18n mat-raised-button>Upgrade myPlanet</a>
    </ng-container>
  </ng-container>
  <a routerLink="/manager/users" i18n mat-raised-button>Members</a>
  <a routerLink="certifications" i18n mat-raised-button *planetBeta>Certifications</a>
  <ng-container *planetAuthorizedRoles="'manager'">
    <div *ngIf="pendingPushCount > 0">
      <p>
        <span i18n>There {pendingPushCount, plural, =0 {are} =1 {is} other {are}}</span>
        {{ ' ' + pendingPushCount + ' ' }}
        <span i18n>{planetType, select,
          nation {{pendingPushCount, plural, =0 {communities} =1 {community} other {communities}}}
          center {{pendingPushCount, plural, =0 {nations} =1 {nation} other {nations}}}
        } with pending courses and/or resources for download.</span>
        <a [routerLink]="['reports/pending']" mat-raised-button i18n>View</a>
      </p>
    </div>
    <div class="view-container send-view" *ngIf="planetType !== 'community'">
      <h3 i18n>Send On Accept</h3><br />
      <button i18n mat-raised-button (click)="sendOnAccept('resources')">Resources</button>
      <button i18n mat-raised-button (click)="sendOnAccept('courses')">Courses</button>
    </div>
    <div class="view-container list-view" *ngIf="planetType !== 'center'">
      <h3 i18n *ngIf="showParentList">{{ planetType === 'community' ? 'Nation' : 'Center' }} List</h3><br />
      <div class="card-container">
        <mat-card class="version-card">
          <mat-card-title i18n>Planet Version</mat-card-title>
          <mat-card-content>
            <p><b i18n>{planetType, select, community {Nation} nation {Center}}:</b> {{versionParent || 'N/A'}}</p>
            <p><b i18n>Local:</b> {{versionLocal}}</p>
          </mat-card-content>
        </mat-card>
        <mat-card class="version-card">
          <mat-card-title i18n>myPlanet Version</mat-card-title>
          <mat-card-content>
            <p><b i18n>Latest:</b> {{versionLatestApk || 'N/A'}}</p>
            <p><b i18n>Local:</b> {{versionLocalApk || 'N/A'}}</p>
          </mat-card-content>
        </mat-card>
      </div>
      <ng-container [ngSwitch]="requestStatus">
        <ng-container *ngSwitchCase="'accepted'">
          <span><b i18n> List all from the {planetType, select, community {Nation} nation {Center}}</b><br><br>
          <a routerLink="resources" i18n mat-raised-button>List Resources</a>
          <a routerLink="courses" i18n mat-raised-button>List Courses</a></span>
        </ng-container>
        <p *ngSwitchCase="'loading'" i18n>Checking request status...</p>
        <p *ngSwitchCase="'deleted'" i18n>Your request has been rejected by { planetType, select, community {nation} nation {center}}. You can retry or contact { planetType, select, community {nation} nation {center}} planet.</p>
        <p *ngSwitchDefault i18n>Your request has not been accepted by { planetType, select, community {nation} nation {center}}</p>
      </ng-container>
    </div>
    <div *ngIf="pin"><span i18n>Your tablet pin number is:</span> <b class="pinClass">{{ ' ' + pin + ' ' }}</b>
      <button mat-raised-button i18n (click)="resetPin()">Reset Pin</button>
    </div>
  </ng-container>
  <div>
    <p>
      <span i18n>Activity on</span>
      <b>{{ '  Planet  ' + planetConfiguration.name + ' ' }}</b>
      <a class="margin-lr-8" [routerLink]="['reports', 'detail']" i18n mat-raised-button>Report Detail</a>
    </p>
    <p>
      <span i18n>Chat streaming</span>
      <mat-slide-toggle [(ngModel)]="streaming" (ngModelChange)="toggleStreaming()"></mat-slide-toggle>
      <button mat-icon-button style="margin-left: 1rem;" (mouseenter)="toggleOverlay()" (mouseleave)="toggleOverlay()" cdkOverlayOrigin #trigger="cdkOverlayOrigin">
        <mat-icon>info_outline</mat-icon>
      </button>
      <ng-template cdkConnectedOverlay [cdkConnectedOverlayOrigin]="trigger" [cdkConnectedOverlayOpen]="overlayOpen">
        <span class="overlay-text" i18n>Quicker line by line chat responses, could be costlier</span>
      </ng-template>
    </p>
  </div>
  <mat-grid-list cols="4" rowHeight="2rem">
    <mat-grid-tile i18n>Last Upgrade</mat-grid-tile><mat-grid-tile i18n>Last Sync</mat-grid-tile>
    <mat-grid-tile i18n>Resource Views Last 30 Days</mat-grid-tile><mat-grid-tile i18n>Total Ratings Last 30 Days</mat-grid-tile>
    <mat-grid-tile>{{activityLogs?.lastUpgrade?.max.time | date: 'medium'}}</mat-grid-tile>
    <mat-grid-tile>{{activityLogs?.lastSync?.max.time | date: 'medium'}}</mat-grid-tile>
    <mat-grid-tile>{{activityLogs?.resourceVisits}}</mat-grid-tile>
    <mat-grid-tile>{{activityLogs?.ratings}}</mat-grid-tile>
  </mat-grid-list>
</div>