redeemed filter

This commit is contained in:
_Bastler
2021-05-07 14:41:12 +02:00
parent 908a54506c
commit 348a59820a
4 changed files with 77 additions and 13 deletions
+20 -6
View File
@@ -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) => {})
}