redeemed filter
This commit is contained in:
parent
908a54506c
commit
348a59820a
@ -4,6 +4,27 @@
|
||||
<mat-form-field>
|
||||
<input matInput [formControl]="searchFormControl" placeholder="{{'invites.search' | i18n}}">
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="fill">
|
||||
<mat-label>{{'invites.redeemed.filter' | i18n}}</mat-label>
|
||||
<mat-select [formControl]="redeemedFormControl">
|
||||
<mat-option>{{'invites.redeemed.filter.none' | i18n}}</mat-option>
|
||||
<mat-option value="true">
|
||||
<mat-icon>how_to_reg</mat-icon>{{'invites.redeemed.filter.true' | i18n}}
|
||||
</mat-option>
|
||||
<mat-option value="false">
|
||||
<mat-icon>person_remove</mat-icon>{{'invites.redeemed.filter.false' | i18n}}
|
||||
</mat-option>
|
||||
<mat-select-trigger [ngSwitch]="redeemedFormControl.value">
|
||||
<span *ngSwitchCase="'true'">
|
||||
<mat-icon inline="true">how_to_reg</mat-icon>{{'invites.redeemed.filter.true' | i18n}}
|
||||
</span>
|
||||
<span *ngSwitchCase="'false'">
|
||||
<mat-icon inline="true">person_remove</mat-icon>{{'invites.redeemed.filter.false' | i18n}}
|
||||
</span>
|
||||
<span *ngSwitchDefault>{{'invites.redeemed.filter.none' | i18n}}</span>
|
||||
</mat-select-trigger>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<table mat-table matSort [dataSource]="invites.content">
|
||||
|
||||
<ng-container matColumnDef="starts">
|
||||
@ -71,12 +92,41 @@
|
||||
<mat-form-field>
|
||||
<input matInput [formControl]="searchOthersFormControl" placeholder="{{'invites.search' | i18n}}">
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="fill">
|
||||
<mat-label>{{'invites.redeemed.filter' | i18n}}</mat-label>
|
||||
<mat-select [formControl]="redeemedOthersFormControl">
|
||||
<mat-option>{{'invites.redeemed.filter.none' | i18n}}</mat-option>
|
||||
<mat-option value="true">
|
||||
<mat-icon>how_to_reg</mat-icon>{{'invites.redeemed.filter.true' | i18n}}
|
||||
</mat-option>
|
||||
<mat-option value="false">
|
||||
<mat-icon>person_remove</mat-icon>{{'invites.redeemed.filter.false' | i18n}}
|
||||
</mat-option>
|
||||
<mat-select-trigger [ngSwitch]="redeemedOthersFormControl.value">
|
||||
<span *ngSwitchCase="'true'">
|
||||
<mat-icon inline="true">how_to_reg</mat-icon>{{'invites.redeemed.filter.true' | i18n}}
|
||||
</span>
|
||||
<span *ngSwitchCase="'false'">
|
||||
<mat-icon inline="true">person_remove</mat-icon>{{'invites.redeemed.filter.false' | i18n}}
|
||||
</span>
|
||||
<span *ngSwitchDefault>{{'invites.redeemed.filter.none' | i18n}}</span>
|
||||
</mat-select-trigger>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<table mat-table matSort [dataSource]="others.content">
|
||||
<ng-container matColumnDef="note">
|
||||
<th mat-header-cell *matHeaderCellDef> {{'invite.note' | i18n}} </th>
|
||||
<td mat-cell *matCellDef="let invite"> <span *ngIf="invite.note">{{ invite.note}}</span> <i *ngIf="!invite.note">{{ 'invite.noNote' | i18n}}</i> </td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="redeemed">
|
||||
<th mat-header-cell *matHeaderCellDef> {{'invite.redeemed' | i18n}} </th>
|
||||
<td mat-cell *matCellDef="let invite">
|
||||
<mat-icon *ngIf="invite.redeemed">how_to_reg</mat-icon>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<tr mat-header-row *matHeaderRowDef="otherColumns"></tr>
|
||||
<tr mat-row *matRowDef="let myRowData; columns: otherColumns"></tr>
|
||||
</table>
|
||||
|
@ -1,3 +1,3 @@
|
||||
mat-form-field {
|
||||
display: block;
|
||||
.mat-form-field+.mat-form-field {
|
||||
margin-left: 8px;
|
||||
}
|
@ -26,10 +26,12 @@ export class InvitesComponent implements OnInit {
|
||||
datetimeformat: string;
|
||||
pageSizeOptions: number[] = [5, 10, 25, 50];
|
||||
searchFormControl = new FormControl();
|
||||
redeemedFormControl = new FormControl();
|
||||
searchOthersFormControl = new FormControl();
|
||||
redeemedOthersFormControl = new FormControl();
|
||||
|
||||
inviteColumns = ["starts", "expires", "link", "note", "message", "redeemed"];
|
||||
otherColumns = ["note"];
|
||||
otherColumns = ["note", "redeemed"];
|
||||
|
||||
constructor(
|
||||
private authService: AuthService,
|
||||
@ -43,13 +45,25 @@ export class InvitesComponent implements OnInit {
|
||||
async ngOnInit() {
|
||||
this.datetimeformat = this.i18n.get('format.datetime', []);
|
||||
this.quota = this.route.snapshot.paramMap.get('quota');
|
||||
|
||||
this.searchFormControl.valueChanges.pipe(debounceTime(500)).subscribe(value => {
|
||||
this.inviteService.getPages(this.quota, 0, this.invites.size, value).subscribe((data: any) => {
|
||||
this.inviteService.getPages(this.quota, 0, this.invites.size, value, this.redeemedFormControl.value).subscribe((data: any) => {
|
||||
this.invites = data;
|
||||
}, (error) => {})
|
||||
})
|
||||
this.redeemedFormControl.valueChanges.subscribe(value => {
|
||||
this.inviteService.getPages(this.quota, 0, this.invites.size, this.searchFormControl.value ? this.searchFormControl.value : "", value).subscribe((data: any) => {
|
||||
this.invites = data;
|
||||
}, (error) => {})
|
||||
})
|
||||
|
||||
this.searchOthersFormControl.valueChanges.pipe(debounceTime(500)).subscribe(value => {
|
||||
this.inviteService.getOthersPages(this.quota, 0, this.others.size, value).subscribe((data: any) => {
|
||||
this.inviteService.getOthersPages(this.quota, 0, this.others.size, value, this.redeemedOthersFormControl.value).subscribe((data: any) => {
|
||||
this.others = data;
|
||||
}, (error) => {})
|
||||
})
|
||||
this.redeemedOthersFormControl.valueChanges.subscribe(value => {
|
||||
this.inviteService.getOthersPages(this.quota, 0, this.others.size, this.searchOthersFormControl.value ? this.searchOthersFormControl.value : "", value).subscribe((data: any) => {
|
||||
this.others = data;
|
||||
}, (error) => {})
|
||||
})
|
||||
@ -73,7 +87,7 @@ export class InvitesComponent implements OnInit {
|
||||
this.invites = data;
|
||||
})
|
||||
} else {
|
||||
this.inviteService.getPages(this.quota, this.invites.number || 0, this.invites.size || 10, this.searchFormControl.value ? this.searchFormControl.value : "").subscribe((data: any) => {
|
||||
this.inviteService.getPages(this.quota, this.invites.number || 0, this.invites.size || 10, this.searchFormControl.value ? this.searchFormControl.value : "", this.redeemedFormControl.value).subscribe((data: any) => {
|
||||
this.invites = data;
|
||||
}, (error) => {})
|
||||
}
|
||||
@ -84,7 +98,7 @@ export class InvitesComponent implements OnInit {
|
||||
}
|
||||
|
||||
updatePages(event: PageEvent) {
|
||||
this.inviteService.getPages(this.quota, event.pageIndex, event.pageSize, this.searchFormControl.value ? this.searchFormControl.value : "").subscribe((data: any) => {
|
||||
this.inviteService.getPages(this.quota, event.pageIndex, event.pageSize, this.searchFormControl.value ? this.searchFormControl.value : "", this.redeemedFormControl.value).subscribe((data: any) => {
|
||||
this.invites = data;
|
||||
}, (error) => {})
|
||||
}
|
||||
@ -109,7 +123,7 @@ export class InvitesComponent implements OnInit {
|
||||
}
|
||||
|
||||
updateOthers(event: PageEvent) {
|
||||
this.inviteService.getOthersPages(this.quota, event.pageIndex, event.pageSize, this.searchOthersFormControl.value ? this.searchOthersFormControl.value : "").subscribe((data: any) => {
|
||||
this.inviteService.getOthersPages(this.quota, event.pageIndex, event.pageSize, this.searchOthersFormControl.value ? this.searchOthersFormControl.value : "", this.redeemedOthersFormControl.value).subscribe((data: any) => {
|
||||
this.others = data;
|
||||
}, (error) => {})
|
||||
}
|
||||
|
@ -15,16 +15,16 @@ export class InviteService {
|
||||
return this.http.get(environment.apiUrl + "/invites" + (quota ? "?quota=" + quota : ""));
|
||||
}
|
||||
|
||||
getPages(quota: string, page: number, size: number, search: string) {
|
||||
return this.http.get(environment.apiUrl + "/invites" + (quota ? "?quota=" + quota + "&" : "?") + "page=" + page + "&size=" + size + "&search=" + search);
|
||||
getPages(quota: string, page: number, size: number, search: string, redeemed: string) {
|
||||
return this.http.get(environment.apiUrl + "/invites" + (quota ? "?quota=" + quota + "&" : "?") + "page=" + page + "&size=" + size + "&search=" + search + (redeemed ? "&redeemed=" + redeemed : ""));
|
||||
}
|
||||
|
||||
getOthers(quota: string) {
|
||||
return this.http.get(environment.apiUrl + "/invites/" + quota + "/others");
|
||||
}
|
||||
|
||||
getOthersPages(quota: string, page: number, size: number, search: string) {
|
||||
return this.http.get(environment.apiUrl + "/invites/" + quota + "/others?page=" + page + "&size=" + size + "&search=" + search);
|
||||
getOthersPages(quota: string, page: number, size: number, search: string, redeemed: string) {
|
||||
return this.http.get(environment.apiUrl + "/invites/" + quota + "/others?page=" + page + "&size=" + size + "&search=" + search + (redeemed ? "&redeemed=" + redeemed : ""));
|
||||
}
|
||||
|
||||
create(quota: string, invite: any) {
|
||||
|
Loading…
Reference in New Issue
Block a user