|
1 | 1 | <div class="card mx-8">
|
| 2 | + <p-progressSpinner |
| 3 | + class="flex align-items-center justify-content-center h-screen" |
| 4 | + *ngIf="loading" |
| 5 | + styleClass="w-4rem h-4rem" |
| 6 | + strokeWidth="8" |
| 7 | + fill="var(--surface-ground)" |
| 8 | + animationDuration=".5s" /> |
2 | 9 | <p-toast />
|
3 |
| - <p-toolbar styleClass="mb-2 gap-2"> |
4 |
| - <div class="p-justify-end"> |
5 |
| - <p-button |
6 |
| - icon="pi pi-plus" |
7 |
| - severity="primary" |
8 |
| - [outlined]="true" |
9 |
| - label="New" |
10 |
| - class="mr-2" |
11 |
| - (onClick)="openNewQuestion()" /> |
12 |
| - <p-button |
13 |
| - icon="pi pi-trash" |
14 |
| - severity="danger" |
15 |
| - label="Delete" |
16 |
| - (onClick)="deleteSelectedQuestions()" |
17 |
| - [disabled]="!selectedQuestions || !selectedQuestions.length" /> |
18 |
| - </div> |
19 |
| - </p-toolbar> |
20 |
| - <p-table |
21 |
| - [columns]="cols" |
22 |
| - [value]="questions" |
23 |
| - [(selection)]="selectedQuestions" |
24 |
| - datakey="id" |
25 |
| - [tableStyle]="{ 'min-width': '50rem' }" |
26 |
| - [paginator]="true" |
27 |
| - [rows]="5" |
28 |
| - [rowsPerPageOptions]="[5, 10, 20]" |
29 |
| - styleClass="p-datatable-gridlines-striped"> |
30 |
| - <ng-template pTemplate="caption"> |
31 |
| - <div class="flex"> |
32 |
| - <h3 class="m-0">Manage Questions</h3> |
| 10 | + <ng-container *ngIf="!loading"> |
| 11 | + <p-toolbar styleClass="mb-2 gap-2"> |
| 12 | + <div class="p-justify-end"> |
| 13 | + <p-button |
| 14 | + icon="pi pi-plus" |
| 15 | + severity="primary" |
| 16 | + [outlined]="true" |
| 17 | + label="New" |
| 18 | + class="mr-2" |
| 19 | + (onClick)="openNewQuestion()" /> |
| 20 | + <p-button |
| 21 | + icon="pi pi-trash" |
| 22 | + severity="danger" |
| 23 | + label="Delete" |
| 24 | + (onClick)="deleteSelectedQuestions()" |
| 25 | + [disabled]="!selectedQuestions || !selectedQuestions.length" /> |
33 | 26 | </div>
|
34 |
| - </ng-template> |
35 |
| - <ng-template pTemplate="header" let-columns> |
36 |
| - <tr> |
37 |
| - <th style="width: 4rem"><p-tableHeaderCheckbox /></th> |
38 |
| - <th>Id</th> |
39 |
| - <th>Title</th> |
40 |
| - <th>Description</th> |
41 |
| - <th>Topics</th> |
42 |
| - <th>Difficulty</th> |
43 |
| - <th></th> |
44 |
| - </tr> |
45 |
| - </ng-template> |
46 |
| - <ng-template pTemplate="body" let-question> |
47 |
| - <tr> |
48 |
| - <td> |
49 |
| - <p-tableCheckbox [value]="question" /> |
50 |
| - </td> |
51 |
| - <td>{{ question.id }}</td> |
52 |
| - <td>{{ question.title }}</td> |
53 |
| - <td>{{ question.description }}</td> |
54 |
| - <td>{{ question.topics.join(', ') }}</td> |
55 |
| - <td>{{ question.difficulty }}</td> |
56 |
| - <td> |
57 |
| - <p-button |
58 |
| - label="Edit" |
59 |
| - severity="primary" |
60 |
| - icon="pi pi-file-edit" |
61 |
| - class="mr-2" |
62 |
| - [text]="true" |
63 |
| - (onClick)="editQuestion(question)" /> |
64 |
| - </td> |
65 |
| - </tr> |
66 |
| - </ng-template> |
67 |
| - </p-table> |
68 |
| - |
| 27 | + </p-toolbar> |
| 28 | + <p-table |
| 29 | + [columns]="cols" |
| 30 | + [value]="questions" |
| 31 | + [(selection)]="selectedQuestions" |
| 32 | + datakey="id" |
| 33 | + [tableStyle]="{ 'min-width': '50rem' }" |
| 34 | + [paginator]="true" |
| 35 | + [rows]="5" |
| 36 | + [rowsPerPageOptions]="[5, 10, 20]" |
| 37 | + styleClass="p-datatable-gridlines-striped"> |
| 38 | + <ng-template pTemplate="caption"> |
| 39 | + <div class="flex"> |
| 40 | + <h3 class="m-0">Manage Questions</h3> |
| 41 | + </div> |
| 42 | + </ng-template> |
| 43 | + <ng-template pTemplate="header" let-columns> |
| 44 | + <tr> |
| 45 | + <th style="width: 4rem"><p-tableHeaderCheckbox /></th> |
| 46 | + <th>Id</th> |
| 47 | + <th>Title</th> |
| 48 | + <th>Description</th> |
| 49 | + <th>Topics</th> |
| 50 | + <th>Difficulty</th> |
| 51 | + <th></th> |
| 52 | + </tr> |
| 53 | + </ng-template> |
| 54 | + <ng-template pTemplate="body" let-question> |
| 55 | + <tr> |
| 56 | + <td> |
| 57 | + <p-tableCheckbox [value]="question" /> |
| 58 | + </td> |
| 59 | + <td>{{ question.id }}</td> |
| 60 | + <td>{{ question.title }}</td> |
| 61 | + <td>{{ question.description }}</td> |
| 62 | + <td>{{ question.topics.join(', ') }}</td> |
| 63 | + <td>{{ question.difficulty }}</td> |
| 64 | + <td> |
| 65 | + <p-button |
| 66 | + label="Edit" |
| 67 | + severity="primary" |
| 68 | + icon="pi pi-file-edit" |
| 69 | + class="mr-2" |
| 70 | + [text]="true" |
| 71 | + (onClick)="editQuestion(question)" /> |
| 72 | + </td> |
| 73 | + </tr> |
| 74 | + </ng-template> |
| 75 | + </p-table> |
| 76 | + </ng-container> |
69 | 77 | <p-dialog header="Header" [(visible)]="isDialogVisible" [modal]="true" [style]="{ width: '25rem' }">
|
70 | 78 | <ng-template pTemplate="header">
|
71 | 79 | <div class="inline-flex align-items-center justify-content-center gap-2">
|
|
0 commit comments