|
| 1 | +<div class="container"> |
| 2 | + <div class="table-container" style="max-width: 1150px; margin: 100px auto"> |
| 3 | + <p-table |
| 4 | + #dt |
| 5 | + sortField="time" |
| 6 | + [sortOrder]="1" |
| 7 | + [value]="histories" |
| 8 | + datakey="id" |
| 9 | + [tableStyle]="{ 'table-layout': 'auto', width: '100%', 'min-width': '50rem', 'text-align': 'center' }" |
| 10 | + [paginator]="true" |
| 11 | + [rows]="10" |
| 12 | + [rowsPerPageOptions]="[10, 25, 50]" |
| 13 | + [globalFilterFields]="['title', 'difficulty', 'topics', 'collaborator', 'status', 'time']" |
| 14 | + styleClass="p-datatable-gridlines-striped" |
| 15 | + (sortFunction)="customSort($event)" |
| 16 | + [customSort]="true"> |
| 17 | + <ng-template pTemplate="caption"> |
| 18 | + <div class="flex flex-wrap align-items-center justify-content-between"> |
| 19 | + <h3 class="">Matching History</h3> |
| 20 | + <p-iconField iconPosition="left"> |
| 21 | + <p-inputIcon> |
| 22 | + <i class="pi pi-search"></i> |
| 23 | + </p-inputIcon> |
| 24 | + <input |
| 25 | + pInputText |
| 26 | + type="text" |
| 27 | + (input)="dt.filterGlobal($any($event.target).value, 'contains')" |
| 28 | + placeholder="Search keyword" /> |
| 29 | + </p-iconField> |
| 30 | + </div> |
| 31 | + </ng-template> |
| 32 | + <ng-template pTemplate="header" let-columns> |
| 33 | + <tr> |
| 34 | + <th pSortableColumn="title" style="width: 20%">Question<p-sortIcon field="title"></p-sortIcon></th> |
| 35 | + <th pSortableColumn="difficulty" style="width: 15%"> |
| 36 | + Difficulty<p-sortIcon field="difficulty"></p-sortIcon> |
| 37 | + </th> |
| 38 | + <th pSortableColumn="topics" style="width: 24%">Topics<p-sortIcon field="topics"></p-sortIcon></th> |
| 39 | + <th pSortableColumn="collaborator" style="width: 17%"> |
| 40 | + Collaborator<p-sortIcon field="collaborator"></p-sortIcon> |
| 41 | + </th> |
| 42 | + <th pSortableColumn="status" style="width: 12%">Status<p-sortIcon field="status"></p-sortIcon></th> |
| 43 | + <th pSortableColumn="time" style="width: 12%">Time<p-sortIcon field="time"></p-sortIcon></th> |
| 44 | + </tr> |
| 45 | + </ng-template> |
| 46 | + <ng-template pTemplate="body" let-history> |
| 47 | + <tr (click)="onRowSelect(history)"> |
| 48 | + <td>{{ history.title }}</td> |
| 49 | + <td>{{ history.difficulty }}</td> |
| 50 | + <td>{{ history.topics.join(', ') }}</td> |
| 51 | + <td>{{ history.collaborator }}</td> |
| 52 | + <td> |
| 53 | + @if (history.status === 'COMPLETED') { |
| 54 | + <i class="pi pi-check" style="color: green; font-size: large"></i> |
| 55 | + } @else if (history.status === 'FORFEITED') { |
| 56 | + <i class="pi pi-times" style="color: red; font-size: large"></i> |
| 57 | + } @else if (history.status === 'IN_PROGRESS') { |
| 58 | + <i class="pi pi-spin pi-spinner" style="color: white; font-size: large"></i> |
| 59 | + } |
| 60 | + </td> |
| 61 | + <td>{{ history.time | date: 'dd/MM/yyyy hh:mm a' }}</td> |
| 62 | + </tr> |
| 63 | + </ng-template> |
| 64 | + </p-table> |
| 65 | + </div> |
| 66 | + <p-sidebar |
| 67 | + [(visible)]="isPanelVisible" |
| 68 | + position="right" |
| 69 | + [blockScroll]="true" |
| 70 | + styleClass="w-10 md:w-8 lg:w-6" |
| 71 | + transitionOptions="200ms cubic-bezier(0, 0, 0.2, 1)" |
| 72 | + (onHide)="closePanel()"> |
| 73 | + <ng-template pTemplate="header"> |
| 74 | + <h3>{{ panelHistory?.title }}</h3> |
| 75 | + </ng-template> |
| 76 | + <div class="panel-content"> |
| 77 | + <p style="white-space: pre-wrap">{{ panelHistory?.description }}</p> |
| 78 | + <h4>Submitted Solution</h4> |
| 79 | + <div #editor class="editor-content text-lg"></div> |
| 80 | + </div> |
| 81 | + </p-sidebar> |
| 82 | + <p-toast position="bottom-right" [breakpoints]="{ '920px': { width: '90%' } }" /> |
| 83 | +</div> |
0 commit comments