Add giftcard fields, improve errors
This commit is contained in:
@@ -1,20 +1,23 @@
|
||||
<div class="flex column fill">
|
||||
@if (entries && entries.error) {
|
||||
<div class="flex column fill">
|
||||
<mat-card class="accent box">
|
||||
<mat-card-header>
|
||||
<mat-card-title>{{ 'management.error.' + entries.error.status | i18n}}</mat-card-title>
|
||||
<mat-card-subtitle>{{'management.error' | i18n}}</mat-card-subtitle>
|
||||
</mat-card-header>
|
||||
<mat-card-content>
|
||||
<p>
|
||||
{{ 'management.error.' + entries.error.status + '.text' | i18n}}
|
||||
</p>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
@if (entries && entries.error) {<div class="container">
|
||||
<div class="flex column fill center middle">
|
||||
<mat-card class="accent error box">
|
||||
<mat-card-header>
|
||||
<mat-card-title>{{ 'management.error.' + entries.error.status | i18n}}</mat-card-title>
|
||||
<mat-card-subtitle>{{'management.error' | i18n}}</mat-card-subtitle>
|
||||
</mat-card-header>
|
||||
<mat-card-content>
|
||||
<p>
|
||||
{{ 'management.error.' + entries.error.status + '.text' | i18n}}
|
||||
</p>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
|
||||
@if (entries && !entries.error) {
|
||||
<div class="flex wrap filter-container">
|
||||
<a mat-icon-button (click)="filterOpen=!filterOpen" title="{{'turnovers.filter' | i18n}}"
|
||||
[color]="filterOpen ? 'primary': 'accent'">
|
||||
@@ -51,10 +54,12 @@
|
||||
</form>
|
||||
}
|
||||
<span class="spacer"></span>
|
||||
<a class="margin" mat-icon-button (click)="export()" title="{{'turnovers.export' | i18n}}" color="primary" [disabled]="!entries.total">
|
||||
<a class="margin" mat-icon-button (click)="export()" title="{{'turnovers.export' | i18n}}" color="primary"
|
||||
[disabled]="!entries.total">
|
||||
<mat-icon>file_download</mat-icon>
|
||||
</a>
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (entries && entries.total == 0) {
|
||||
<mat-list>
|
||||
@@ -109,6 +114,22 @@
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="giftcardPrice">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header>
|
||||
<span class="spacer"></span>
|
||||
<span>{{'turnover.giftcard.priceUsage' | i18n}}</span>
|
||||
</th>
|
||||
<td mat-cell *matCellDef="let entry">
|
||||
<div class="flex">
|
||||
<span class="spacer"></span>
|
||||
<span>{{entry[3] | number: '1.2-2'}}</span>
|
||||
@if (entry[3]) {
|
||||
<span> {{'turnover.price.suffix' | i18n}}</span>
|
||||
}
|
||||
</div>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="menu">
|
||||
<th mat-header-cell *matHeaderCellDef></th>
|
||||
<td mat-cell *matCellDef="let entry">
|
||||
@@ -127,8 +148,8 @@
|
||||
<ng-container matColumnDef="expanded">
|
||||
<td mat-cell *matCellDef="let entry" [attr.colspan]="columns.length">
|
||||
@if (expanded && entries.total && entries.filter && entries.filter.username == entry[0]) {
|
||||
<ui-turnovers #uiTurnovers class="flex column fill" [turnovers]="turnovers" (page)="applyTurnoverPage($event)"
|
||||
[enableSort]="false"></ui-turnovers>
|
||||
<ui-turnovers #uiTurnovers class="flex column fill" [turnovers]="turnovers"
|
||||
(page)="applyTurnoverPage($event)" [enableSort]="false"></ui-turnovers>
|
||||
}
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
@@ -22,7 +22,7 @@ export class PageManagement implements OnInit {
|
||||
descending: boolean = false;
|
||||
filterOpen: boolean = true;
|
||||
|
||||
columns: string[] = ['username', 'price', 'timeInvestment', 'menu'];
|
||||
columns: string[] = ['username', 'price', 'timeInvestment', 'giftcardPrice', 'menu'];
|
||||
expanded: boolean = false;
|
||||
|
||||
users: Observable<any>;
|
||||
@@ -198,10 +198,10 @@ export class PageManagement implements OnInit {
|
||||
|
||||
export() {
|
||||
if (this.entries.total) {
|
||||
let rows = [[this.i18n.get('user.username'), this.i18n.get('turnover.price'), this.i18n.get('turnover.timeInvestment')]];
|
||||
let rows = [[this.i18n.get('user.username'), this.i18n.get('turnover.price'), this.i18n.get('turnover.timeInvestment'), this.i18n.get('turnover.giftcard.priceUsage')]];
|
||||
|
||||
this.entries.results.forEach(result => {
|
||||
rows[rows.length] = [result[0], result[1], [result[2]]]
|
||||
rows[rows.length] = [result[0], result[1], result[2], result[3]]
|
||||
});
|
||||
|
||||
if (this.uiTurnovers) {
|
||||
|
||||
Reference in New Issue
Block a user