Skip to content
Snippets Groups Projects
term-container.component.html 7.57 KiB
Newer Older
Paulina Nogal's avatar
Paulina Nogal committed
<ng-template #enrolled id="enrolled-courses">
  <div class="course-list-wrapper">
    <div class="course-list">
      <div class="course-list-inner" attr.aria-label="List of courses in {{ termCode | getTermDescription }} term">
        <ng-container *ngIf="enrolledCourses.length === 0">
pnogal's avatar
pnogal committed
          <p *ngIf="(term$ | async).termCode.isPast()" aria-label="No courses taken" class="no-courses">
            No courses taken
          </p>
pnogal's avatar
pnogal committed
          <p *ngIf="(term$ | async).termCode.isActive()" aria-label="Not enrolled in any courses" class="no-courses">
            Not enrolled in any courses
          </p>
        </ng-container>
        <cse-course-item
          role="button"
          aria-labelledby="enrolled-courses"
          *ngFor="let course of enrolledCourses"
          type="course"
          [disabled]="true"
          [course]="course"
          [era]="(term$ | async).termCode.era">
        </cse-course-item>
      </div>
    </div>
Paulina Nogal's avatar
Paulina Nogal committed
<ng-template #planned id="planned-courses">
  <div class="course-list-wrapper">
    <div
      class="course-list"
      cdkDropList
      id="term-{{ termCode }}"
      [cdkDropListData]="(term$ | async).termCode"
      [cdkDropListConnectedTo]="dropZoneIds$ | async"
      (cdkDropListDropped)="drop($event)"
      (cdkDropListEntered)="dragEnter($event)"
      (cdkDropListExited)="dragExit($event)">
      <div class="course-list-inner term-body" attr.aria-label="List of courses in {{ termCode | getTermDescription }} term">
        <ng-container
          *ngIf="plannedCourses.length === 0 && !hasItemDraggedOver">
          <p *ngIf="(term$ | async).termCode.isActive()" class="no-courses">
          <p *ngIf="(term$ | async).termCode.isFuture()" class="no-courses">
            No courses planned
          </p>
          <p *ngIf="(term$ | async).termCode.isPast()" class="no-courses">
            No courses planned
          </p>
        </ng-container>
        <span class="assistive-text">{{ assistiveText }}</span>
        <div
          cdkDrag
          [cdkDragData]="course"
          [cdkDragDisabled]="mobileView.matches"
          (cdkDragStarted)="startDrag($event)"
          class="course-wrapper"
          *ngFor="let course of plannedCourses">
          <cse-course-item
            role="button"
            aria-labelledby="planned-courses"
            type="course"
            [course]="course"
            [era]="(term$ | async).termCode.era">
          </cse-course-item>
      </div>
    </div>

    <!-- Add course -->
    <div class="add-new-wrapper" *ngIf="(term$ | async).termCode.isPast() == false">
      <button
        mat-raised-button
Paulina Nogal's avatar
Paulina Nogal committed
        attr.aria-label="Add course to {{ termCode | getTermDescription }}"
        class="add-course-button"
        (click)="openCourseSearch()">
        + Add Course
      </button>
<mat-card
  class="term-container"
  [ngClass]="{ 'no-scrolling': mobileView.matches }"
  role="region"
pnogal's avatar
pnogal committed
  cdkFocusInitial>
Isaac Evavold's avatar
Isaac Evavold committed
  <div class="term-inner">
pnogal's avatar
pnogal committed
    <div
      fxLayout="row"
      class="term-header"
pnogal's avatar
pnogal committed
      fxLayoutAlign="space-between center"
      attr.aria-label="{{ termCode | getTermDescription }} term">
      <h3 class="term-description">{{ termCode | getTermDescription }}</h3>
pnogal's avatar
pnogal committed

jvanboxtel@wisc.edu's avatar
jvanboxtel@wisc.edu committed
      <div fxLayout="row" fxLayoutAlign="space-between center">
        <p class="text-right semi-bold credits">
pnogal's avatar
pnogal committed
          <ng-container *ngIf="visibleCredits === 'planned'">
            <span attr.aria-label="{{ plannedCredits }} credits">{{ plannedCredits }} Cr</span>
          </ng-container>
          <ng-container *ngIf="visibleCredits === 'enrolled'">
            <span attr.aria-label="{{ enrolledCredits }} credits">{{ enrolledCredits }} Cr</span>
          </ng-container>
Isaac Evavold's avatar
Isaac Evavold committed
        <ng-container *ngIf="(note$ | async) as note; else newNote">
pnogal's avatar
pnogal committed
          <button
            mat-icon-button
            attr.aria-label="Edit note for {{ termCode | getTermDescription }}"
pnogal's avatar
pnogal committed
            [disabled]="note.isLoaded === false"
            (click)="openNotesDialog(note)">
Isaac Evavold's avatar
Isaac Evavold committed
            <mat-icon
Isaac Evavold's avatar
Isaac Evavold committed
              color="primary"
              matTooltip="Edit note"
              matTooltipPosition="above">
Isaac Evavold's avatar
Isaac Evavold committed
              insert_drive_file
            </mat-icon>
Isaac Evavold's avatar
Isaac Evavold committed
          </button>
        </ng-container>
        <ng-template #newNote>
          <button
            mat-icon-button
            (click)="openNotesDialog()"
            attr.aria-label="Add note to {{ termCode | getTermDescription }}">
Isaac Evavold's avatar
Isaac Evavold committed
            <mat-icon
Isaac Evavold's avatar
Isaac Evavold committed
              color="primary"
              matTooltip="Add note"
              matTooltipPosition="above">
pnogal's avatar
pnogal committed
              note_add
            </mat-icon>
pnogal's avatar
pnogal committed
          </button>
        </ng-template>
Isaac Evavold's avatar
Isaac Evavold committed
      </div>
    </div>
Paulina Nogal's avatar
Paulina Nogal committed
    <p class="credit-overload-warning" *ngIf="((visibleCredits === 'planned') && (tooManyCredits$ | async)) || ((visibleCredits === 'enrolled') && (enrolledCredits > maxAllowedCredits))">
Isaac Evavold's avatar
Isaac Evavold committed
    <!-- Render term note (if it exists) -->
    <ng-container *ngIf="(note$ | async) as note">
      <ng-container *ngIf="note.isLoaded; else noteIsLoading">
        <div class="note-item" (click)="openNotesDialog(note)">
          <p class="semi-bold">Note</p>
          <p class="note-excerpt">{{ note.text }}</p>
        </div>
      </ng-container>
      <ng-template #noteIsLoading>
        <div class="note-item note-item-loading">
          <p class="semi-bold">Note</p>
          <p class="note-excerpt">{{ note.text }}</p>
          <mat-progress-spinner
            mode="indeterminate"
            diameter="24">
          </mat-progress-spinner>
Isaac Evavold's avatar
Isaac Evavold committed
        </div>
      </ng-template>
    </ng-container>
      <!-- If this term is an active term -->
  <ng-container *ngIf="(term$ | async).termCode.isActive()">
    <mat-tab-group (selectedTabChange)="changeVisibleCredits($event)" [selectedIndex]="(enrolledCourses.length > 0) ? 0 : 1">
pnogal's avatar
pnogal committed
      <mat-tab [label]="'In Progress (' + enrolledCourses.length + ')'" [aria-label]="'In Progress courses (' + enrolledCourses.length + ')'">
        <ng-container cdkFocusinitial *ngTemplateOutlet="enrolled"></ng-container>
      </mat-tab>
pnogal's avatar
pnogal committed
      <mat-tab [label]="(isPrimaryPlan) ? 'Cart (' + plannedCourses.length + ')' : 'Planned (' + plannedCourses.length + ')'" [aria-label]="(isPrimaryPlan) ? 'Cart courses (' + plannedCourses.length + ')' : 'Planned courses (' + plannedCourses.length + ')'">
        <ng-container cdkFocusinitial *ngTemplateOutlet="planned"></ng-container>
      </mat-tab>
Scott Berg's avatar
Scott Berg committed
    </mat-tab-group>
pnogal's avatar
pnogal committed

  <!-- If this term is a past term -->
  <ng-container *ngIf="(term$ | async).termCode.isPast()">
    <mat-tab-group (selectedTabChange)="changeVisibleCredits($event)" [selectedIndex]="0">
pnogal's avatar
pnogal committed
      <mat-tab [label]="'Completed (' + enrolledCourses.length + ')'" [aria-label]="'Completed courses (' + enrolledCourses.length + ')'">
        <ng-container cdkFocusinitial *ngTemplateOutlet="enrolled"></ng-container>
      </mat-tab>
pnogal's avatar
pnogal committed
        <mat-tab [label]="(isPrimaryPlan) ? 'Cart (' + plannedCourses.length + ')' : 'Planned (' + plannedCourses.length + ')'" [aria-label]="(isPrimaryPlan) ? 'Cart courses (' + plannedCourses.length + ')' : 'Planned courses (' + plannedCourses.length + ')'">
          <ng-container cdkFocusinitial *ngTemplateOutlet="planned"></ng-container>
        </mat-tab>
    </mat-tab-group>
pnogal's avatar
pnogal committed

  <!-- If this term is a future term -->
  <ng-container *ngIf="(term$ | async).termCode.isFuture()">
    <ng-container cdkFocusinitial *ngTemplateOutlet="planned"></ng-container>
Isaac Evavold's avatar
Isaac Evavold committed
</mat-card>