Skip to content
Snippets Groups Projects
dars-view.component.html 6.21 KiB
Newer Older
<mat-sidenav-container id="dars-container" *ngIf="!mobileView.matches">
  <mat-sidenav id="dars-report-container" mode="over" position="end" [opened]="(visibleAuditStatus$ | async) != 'NotLoaded'">
    <div class="audit-wrapper">
      <div class="audit-header-buttons">
        <button id="audit-close" mat-button aria-label="Return to DARS audit list" color="primary" (click)="closeAudit()">
          <mat-icon>chevron_left</mat-icon>
          Return to audit list
        </button>
        <button id="audit-open-window" mat-button color="primary" (click)="openNewTab()">
          Open in new tab
          <mat-icon>launch</mat-icon>
        </button>
      </div>
      <ng-container [ngSwitch]="visibleAuditStatus$ | async">
        <ng-container *ngSwitchCase="'Loaded'">
          <cse-dars-audit [audit]="audit$ | async"></cse-dars-audit>
        </ng-container>
        <ng-container *ngSwitchCase="'Loading'">
          <mat-card class="loading-wrapper">
            <mat-progress-bar class="card-top-spinner" mode="indeterminate"></mat-progress-bar>
            <img class="bucky-image" src="../../../assets/img/bucky-happy.svg" alt="Happy Bucky Badger">
            <p>Loading your degree Audit</p>
          </mat-card>
        </ng-container>
      </ng-container>
    </div>
  </mat-sidenav>
  <!-- Main DARS Content -->
  <div id="dars-main">
    <cse-alert-container
      [alerts]="alerts$ | async"
      (dismiss)="onDismissAlert($event)">
    </cse-alert-container>
    
    <!-- METADATA LOADING -->
    <mat-card class="dars-view-loading" *ngIf="(metadataStatus$ | async) === 'Loading'">
      <mat-progress-bar class="card-top-spinner" mode="indeterminate"></mat-progress-bar>
      <h2>Loading your DARS audits</h2>
      <p>Hang tight</p>
    </mat-card>
    <!-- END METADATA LOADING -->
    <!-- METADATA ERROR -->
    <mat-card class="dars-view-error" *ngIf="(metadataStatus$ | async) === 'Error'">
      <img class="bucky-image" src="../../../assets/img/bucky-dead.svg" alt="Error Bucky Badger">
      <h2>Error loading DARS audits</h2>
      <p>Try again in a bit</p>
    </mat-card>
    <!-- END METADATA ERROR -->
    <!-- METADATA LOADED -->
    <div *ngIf="(metadataStatus$ | async) === 'Loaded'">
        <h2 id="dars-view-title" class="mat-h1">Completed Audit Requests</h2>
    
        <div class="dars-audit-group" >
          <cse-dars-metadata-table
            [metadata]="programMetadata$"
            [title]="'Degree Audit'"
            [tagline]="'See the progress towards your current program of study and degree plans.'"
            [button]="'Run new degree audit'"
            (buttonClick)="openDegreeAuditDialog()"
            (openAudit)="openAudit($event)">
          </cse-dars-metadata-table>
        </div>
    
        <div class="dars-audit-group">
          <cse-dars-metadata-table
            [metadata]="whatIfMetadata$"
            [title]="'&lsquo;What if&rsquo; Audit'"
            [tagline]="'See the progress towards a new program of study and degree plans.'"
            [button]="'Run new &lsquo;what if&rsquo; audit'"
            (buttonClick)="openWhatIfAuditDialog()"
            (openAudit)="openAudit($event)">
          </cse-dars-metadata-table>
        </div>
    <!-- END METADATA LOADED -->
</mat-sidenav-container>

<div *ngIf="mobileView.matches">
  <mat-card class="mat-card-mobile">
      <mat-card-header>
        <mat-card-title>Degree Audit (DARS)</mat-card-title>
      </mat-card-header>
      <mat-card-content>
          <mat-tab-group>
              <mat-tab label="Degree Audit">
                  <div class="run-audit-mobile">
                      <p>See the progress towards your current program of study.</p>
                      <button mat-raised-button
                        aria-label="Run new degree audit"
                        [disabled]="(metadataStatus$ | async) != 'Loaded'"
                        color="primary"
                        (click)="openDegreeAuditDialog()">
                        Run new degree audit
                      </button>
                  </div>
                <mat-divider></mat-divider>
                <h3>Completed Audits</h3>
                <div class="dars-audit-group" [ngSwitch]="metadataStatus$ | async">
                    <ng-container *ngSwitchCase="'Error'">
                      <h2 style="color:red">error loading metadata</h2>
                    </ng-container>
                    <ng-container *ngSwitchCase="'Loading'">
                      <mat-spinner></mat-spinner>
                    </ng-container>
                    <ng-container *ngSwitchCase="'Loaded'">
                      <cse-metadata-mobile-view
                        [metadata]="programMetadata$ | async">
                      </cse-metadata-mobile-view>
                    </ng-container>
                  </div>
              </mat-tab>
              <mat-tab label="What-if">
                <div class="run-audit-mobile">
                    <p>See the progress towards a new or current program of study and degree plans.</p>
                    <button
                    mat-raised-button
                    aria-label="Run new degree audit"
                    [disabled]="(metadataStatus$ | async) != 'Loaded'"
                    color="primary"
                    (click)="openDegreeAuditDialog()">
                    Run new &lsquo;what if&rsquo; audit
                    </button>
                </div>
                <mat-divider></mat-divider>
                <h3>Completed Audits</h3>
                <div class="dars-audit-group" [ngSwitch]="metadataStatus$ | async">
                    <ng-container *ngSwitchCase="'Error'">
                      <h2 style="color:red">error loading metadata</h2>
                    </ng-container>
                    <ng-container *ngSwitchCase="'Loading'">
                      <mat-spinner></mat-spinner>
                    </ng-container>
                    <ng-container *ngSwitchCase="'Loaded'">
                        <cse-metadata-mobile-view
                        [metadata]="programMetadata$ | async">
                      </cse-metadata-mobile-view>
                    </ng-container>
                  </div>
              </mat-tab>
          </mat-tab-group>
      </mat-card-content>
  </mat-card>
</div>