2017-04-03 18:49:50 +02:00

49 lines
2.4 KiB
HTML

<div *ngIf="!this.lessons" class="cssload-container">
<div class="cssload-tube-tunnel"></div>
</div>
<div *ngIf="this.lessons" fxLayout="row" fxLayoutAlign="center center">
<div class="div-inner-main" [style.xs]="{'width': '100%'}">
<div *ngIf="!addingLesson" fxLayout="row" fxLayoutAlign="center center">
<div fxFlex="80%">MY LESSONS</div>
<md-icon fxFlex="20%" fxLayoutAlign="end center" *ngIf="authenticationService.isTeacher()" (click)="addingLesson = true"
[title]="'Add lesson'">add_circle_outline</md-icon>
</div>
<div *ngIf="addingLesson">
<div>NEW LESSON</div>
<form #newLessonForm (ngSubmit)="newLesson(); newLessonForm.reset()" [class.filtered]="sumbitNewLesson">
<md-input-container>
<input mdInput placeholder="Title" [(ngModel)]="lessonTitle" name="lessonTitle" id="lessonTitle" type="text" autocomplete="off"
required>
</md-input-container>
<div class="block-btn">
<button md-button type="submit" [disabled]="sumbitNewLesson">Send</button>
<button md-button (click)="addingLesson = false; newLessonForm.reset()" [disabled]="sumbitNewLesson">Cancel</button>
</div>
</form>
</div>
<md-card *ngFor="let lesson of lessons">
<div fxLayout="row" fxLayoutAlign="center center" fxLayoutGap="10px">
<span fxFlex="70%" class="title">{{lesson.title}}</span>
<span fxFlex="70%" *ngIf="this.authenticationService.isStudent()" class="teacher">{{lesson.teacher.nickName}}</span>
<md-icon fxFlex="15%" *ngIf="this.authenticationService.isTeacher()" (click)="goToLessonDetails(lesson)" [title]="'Modify lesson'">mode_edit</md-icon>
<md-icon fxFlex="15%" (click)="goToLesson(lesson)" [title]="'Go to lesson!'">play_circle_filled</md-icon>
</div>
</md-card>
<div *ngIf="lessons.length === 0 && authenticationService.isStudent() && !addingLesson">
<app-error-message [errorTitle]="'You do not have any lessons'" [errorContent]="'Your teacher must invite you'" [customClass]="'warning'"
[closable]="false"></app-error-message>
</div>
<div *ngIf="lessons.length === 0 && authenticationService.isTeacher() && !addingLesson">
<app-error-message [errorTitle]="'You do not have any lessons'" [errorContent]="'You can add one by clicking on the icon above'"
[customClass]="'warning'" [closable]="false"></app-error-message>
</div>
</div>
</div>