migration
This commit is contained in:
@@ -56,9 +56,11 @@ export class ParteyTimeslotsComponent implements OnInit {
|
||||
|
||||
ngOnInit(): void {
|
||||
|
||||
this.authService.auth.subscribe((auth: any) => {
|
||||
if (auth.principal && auth.principal.userId) {
|
||||
this.userId = auth.principal.userId;
|
||||
this.authService.auth.subscribe({
|
||||
next: (auth: any) => {
|
||||
if (auth.principal && auth.principal.userId) {
|
||||
this.userId = auth.principal.userId;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -78,29 +80,51 @@ export class ParteyTimeslotsComponent implements OnInit {
|
||||
this.filter.after = moment.utc().format();
|
||||
this.afterFormControl.setValue(new Date());
|
||||
|
||||
this.searchFormControl.valueChanges.pipe(debounceTime(500)).subscribe(value => {
|
||||
this.filter.search = value;
|
||||
this.parteyTimeslotsService.get(this.page.page, this.page.size, this.page.sort, this.page.desc, this.filter).subscribe((data: any) => {
|
||||
this.timeslots = data;
|
||||
}, (error) => { })
|
||||
this.searchFormControl.valueChanges.pipe(debounceTime(500)).subscribe({
|
||||
next: (value) => {
|
||||
this.filter.search = value;
|
||||
this.parteyTimeslotsService.get(this.page.page, this.page.size, this.page.sort, this.page.desc, this.filter).subscribe({
|
||||
next: (data: any) => {
|
||||
this.timeslots = data;
|
||||
},
|
||||
error: (error) => { }
|
||||
})
|
||||
}
|
||||
})
|
||||
this.ownerFormControl.valueChanges.subscribe(value => {
|
||||
this.filter.owner = value;
|
||||
this.parteyTimeslotsService.get(this.page.page, this.page.size, this.page.sort, this.page.desc, this.filter).subscribe((data: any) => {
|
||||
this.timeslots = data;
|
||||
}, (error) => { })
|
||||
|
||||
this.ownerFormControl.valueChanges.subscribe({
|
||||
next: (value) => {
|
||||
this.filter.owner = value;
|
||||
this.parteyTimeslotsService.get(this.page.page, this.page.size, this.page.sort, this.page.desc, this.filter).subscribe({
|
||||
next: (data: any) => {
|
||||
this.timeslots = data;
|
||||
},
|
||||
error: (error) => { }
|
||||
})
|
||||
}
|
||||
})
|
||||
this.typeFormControl.valueChanges.subscribe(value => {
|
||||
this.filter.type = value;
|
||||
this.parteyTimeslotsService.get(this.page.page, this.page.size, this.page.sort, this.page.desc, this.filter).subscribe((data: any) => {
|
||||
this.timeslots = data;
|
||||
}, (error) => { })
|
||||
this.typeFormControl.valueChanges.subscribe({
|
||||
next: (value) => {
|
||||
this.filter.type = value;
|
||||
this.parteyTimeslotsService.get(this.page.page, this.page.size, this.page.sort, this.page.desc, this.filter).subscribe({
|
||||
next: (data: any) => {
|
||||
this.timeslots = data;
|
||||
},
|
||||
error: (error) => { }
|
||||
})
|
||||
}
|
||||
})
|
||||
this.afterFormControl.valueChanges.subscribe((value: Date) => {
|
||||
this.filter.after = value && moment.utc(value).format() || undefined;
|
||||
this.parteyTimeslotsService.get(this.page.page, this.page.size, this.page.sort, this.page.desc, this.filter).subscribe((data: any) => {
|
||||
this.timeslots = data;
|
||||
}, (error) => { })
|
||||
|
||||
this.afterFormControl.valueChanges.subscribe({
|
||||
next: (value: Date) => {
|
||||
this.filter.after = value && moment.utc(value).format() || undefined;
|
||||
this.parteyTimeslotsService.get(this.page.page, this.page.size, this.page.sort, this.page.desc, this.filter).subscribe({
|
||||
next: (data: any) => {
|
||||
this.timeslots = data;
|
||||
},
|
||||
error: (error) => { }
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
this.refresh();
|
||||
@@ -109,21 +133,28 @@ export class ParteyTimeslotsComponent implements OnInit {
|
||||
refresh() {
|
||||
this.timeslotsQuota = 0;
|
||||
|
||||
this.parteyTimeslotsService.quota().subscribe((data: number) => {
|
||||
this.timeslotsQuota = data;
|
||||
this.parteyTimeslotsService.quota().subscribe({
|
||||
next: (data: number) => {
|
||||
this.timeslotsQuota = data;
|
||||
}
|
||||
})
|
||||
|
||||
this.parteyTimeslotsService.get(this.page.page, this.page.size, this.page.sort, this.page.desc, this.filter).subscribe((data: any) => {
|
||||
this.timeslots = data;
|
||||
this.parteyTimeslotsService.get(this.page.page, this.page.size, this.page.sort, this.page.desc, this.filter).subscribe({
|
||||
next: (data: any) => {
|
||||
this.timeslots = data;
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
updatePages(event: PageEvent) {
|
||||
this.page.page = event.pageIndex;
|
||||
this.page.size = event.pageSize;
|
||||
this.parteyTimeslotsService.get(this.page.page, this.page.size, this.page.sort, this.page.desc, this.filter).subscribe((data: any) => {
|
||||
this.timeslots = data;
|
||||
}, (error) => { })
|
||||
this.parteyTimeslotsService.get(this.page.page, this.page.size, this.page.sort, this.page.desc, this.filter).subscribe({
|
||||
next: (data: any) => {
|
||||
this.timeslots = data;
|
||||
},
|
||||
error: (error) => { }
|
||||
})
|
||||
}
|
||||
|
||||
updateSort(sort: Sort) {
|
||||
@@ -134,9 +165,12 @@ export class ParteyTimeslotsComponent implements OnInit {
|
||||
this.page.sort = sort.active;
|
||||
this.page.desc = sort.direction == "desc";
|
||||
}
|
||||
this.parteyTimeslotsService.get(this.page.page, this.page.size, this.page.sort, this.page.desc, this.filter).subscribe((data: any) => {
|
||||
this.timeslots = data;
|
||||
}, (error) => { })
|
||||
this.parteyTimeslotsService.get(this.page.page, this.page.size, this.page.sort, this.page.desc, this.filter).subscribe({
|
||||
next: (data: any) => {
|
||||
this.timeslots = data;
|
||||
},
|
||||
error: (error) => { }
|
||||
})
|
||||
}
|
||||
|
||||
confirmDelete(timeslot) {
|
||||
@@ -147,11 +181,15 @@ export class ParteyTimeslotsComponent implements OnInit {
|
||||
}
|
||||
})
|
||||
|
||||
dialogRef.afterClosed().subscribe(result => {
|
||||
if (result) {
|
||||
this.parteyTimeslotsService.delete(timeslot.id).subscribe((result: any) => {
|
||||
this.refresh();
|
||||
})
|
||||
dialogRef.afterClosed().subscribe({
|
||||
next: (result) => {
|
||||
if (result) {
|
||||
this.parteyTimeslotsService.delete(timeslot.id).subscribe({
|
||||
next: (result: any) => {
|
||||
this.refresh();
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -162,9 +200,11 @@ export class ParteyTimeslotsComponent implements OnInit {
|
||||
minWidth: '400px'
|
||||
});
|
||||
|
||||
dialogRef.afterClosed().subscribe(result => {
|
||||
if (result) {
|
||||
this.refresh();
|
||||
dialogRef.afterClosed().subscribe({
|
||||
next: (result) => {
|
||||
if (result) {
|
||||
this.refresh();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -176,9 +216,11 @@ export class ParteyTimeslotsComponent implements OnInit {
|
||||
minWidth: '400px'
|
||||
});
|
||||
|
||||
dialogRef.afterClosed().subscribe(result => {
|
||||
if (result) {
|
||||
this.refresh();
|
||||
dialogRef.afterClosed().subscribe({
|
||||
next: (result) => {
|
||||
if (result) {
|
||||
this.refresh();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -229,36 +271,42 @@ export class ParteyTimeslotDialog {
|
||||
}
|
||||
|
||||
create(timeslot) {
|
||||
this.parteyTimeslotsService.create(timeslot).subscribe((result: any) => {
|
||||
this.dialogRef.close(timeslot);
|
||||
}, (error) => {
|
||||
if (error.status == 409) {
|
||||
let errors = {};
|
||||
for (let code of error.error) {
|
||||
errors[ code.field ] = errors[ code.field ] || {};
|
||||
errors[ code.field ][ code.code ] = true;
|
||||
}
|
||||
this.parteyTimeslotsService.create(timeslot).subscribe({
|
||||
next: (result: any) => {
|
||||
this.dialogRef.close(timeslot);
|
||||
},
|
||||
error: (error) => {
|
||||
if (error.status == 409) {
|
||||
let errors = {};
|
||||
for (let code of error.error) {
|
||||
errors[ code.field ] = errors[ code.field ] || {};
|
||||
errors[ code.field ][ code.code ] = true;
|
||||
}
|
||||
|
||||
for (let code in errors) {
|
||||
this.form.get(code).setErrors(errors[ code ]);
|
||||
for (let code in errors) {
|
||||
this.form.get(code).setErrors(errors[ code ]);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
save(timeslot) {
|
||||
this.parteyTimeslotsService.update(timeslot).subscribe((result: any) => {
|
||||
this.dialogRef.close(timeslot);
|
||||
}, (error) => {
|
||||
if (error.status == 409) {
|
||||
let errors = {};
|
||||
for (let code of error.error) {
|
||||
errors[ code.field ] = errors[ code.field ] || {};
|
||||
errors[ code.field ][ code.code ] = true;
|
||||
}
|
||||
this.parteyTimeslotsService.update(timeslot).subscribe({
|
||||
next: (result: any) => {
|
||||
this.dialogRef.close(timeslot);
|
||||
},
|
||||
error: (error) => {
|
||||
if (error.status == 409) {
|
||||
let errors = {};
|
||||
for (let code of error.error) {
|
||||
errors[ code.field ] = errors[ code.field ] || {};
|
||||
errors[ code.field ][ code.code ] = true;
|
||||
}
|
||||
|
||||
for (let code in errors) {
|
||||
this.form.get(code).setErrors(errors[ code ]);
|
||||
for (let code in errors) {
|
||||
this.form.get(code).setErrors(errors[ code ]);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user