Punktonerzy/FrontEnd/src/app/tests/test-details/test-details.component.html

67 lines
2.6 KiB
HTML

<div class="wrapper">
<div class="content">
<div *ngIf="test">
<div class="header">
<button class="button" (click)="back()"><i class="fas fa-arrow-left"></i> Powrót</button>
<span>
<div *ngIf="currentUser">Twój wynik: {{prevMaxResult}}/{{maxPoints}}</div>
<button title="Usuń" *ngIf="currentUser && currentUser.username === test.owner && (!isStarted || isEnded)" class="btn btn-study-cave" (click)="openPopup()"><i class="fas fa-trash-alt"></i></button>
<button title="Edytuj" *ngIf="currentUser && currentUser.username === test.owner" class="btn btn-study-cave" (click)="edit()"><i class="fas fa-edit"></i></button>
<button title="PDF" class="btn btn-study-cave" (click)="get()"><i class="fas fa-file-pdf"></i></button>
</span>
</div>
<div>
<h3>{{test.title}}</h3>
</div>
<div *ngIf="prevAnswerResultBool !== undefined && prevAnswerResultBool" class="alert alert-success">
Poprzednia odpowiedź była poprawna.
</div>
<div *ngIf="prevAnswerResultBool !== undefined && !prevAnswerResultBool" class="alert alert-danger">
Poprzednia odpowiedź była niepoprawna.
</div>
<div *ngIf="!isStarted && (test['permission'] !== 'GROUP' || (test['permission'] === 'GROUP' && !test['attempted']))">
<br /><br />
<button class="button" (click)="start()"> <i class="far fa-play-circle"></i> Rozpocznij test</button>
</div>
<div *ngIf="!isStarted && test['permission']==='GROUP' && test['attempted']">
<br /><br />
<h3>Test już został wcześniej rozwiązany!</h3>
</div>
<div *ngIf="isStarted && !isEnded">
<div class="question-view">
<app-question-view [question]="test.body[currentQuestionIndex]" [questionIndex]="currentQuestionIndex" (emitNextQuestionRequest)="handleEmitNextQuestionRequest($event)"></app-question-view>
</div>
</div>
<h3 *ngIf="isEnded">
Koniec pytań. Twój wynik to {{points}}/{{maxPoints}}.
</h3>
</div>
<div *ngIf="test === undefined">
Błąd. Test nie istnieje lub nie masz do niego dostępu.
</div>
<app-comments [what]="'tests'"></app-comments>
</div>
<p-dialog header="Potwierdź" [(visible)]="display">
Czy chcesz usunąć test?
<p-footer>
<button type="button" pButton icon="pi pi-check" (click)="deleteTest()" label="TAK" class="button" ></button>
<button type="button" pButton icon="pi pi-close" (click)="display=false" label="NIE" class="button" ></button>
</p-footer>
</p-dialog>
</div>