|
@@ -1,5 +1,7 @@
|
|
|
import { Component } from '@angular/core';
|
|
import { Component } from '@angular/core';
|
|
|
|
|
+import { NgForm } from '@angular/forms';
|
|
|
import { Subject } from 'rxjs';
|
|
import { Subject } from 'rxjs';
|
|
|
|
|
+import { DateTime } from 'src/app/datetime';
|
|
|
import { EventsApiService } from 'src/app/events-api.service';
|
|
import { EventsApiService } from 'src/app/events-api.service';
|
|
|
import { EventSearchParams } from 'src/app/events/event-search-params';
|
|
import { EventSearchParams } from 'src/app/events/event-search-params';
|
|
|
import { GroupEvent } from 'src/app/events/group-event';
|
|
import { GroupEvent } from 'src/app/events/group-event';
|
|
@@ -16,6 +18,8 @@ export class EventsPageComponent {
|
|
|
|
|
|
|
|
public showMyEvents: boolean = false;
|
|
public showMyEvents: boolean = false;
|
|
|
public titleFilter: string = '';
|
|
public titleFilter: string = '';
|
|
|
|
|
+ public fromDate: Date = new Date();
|
|
|
|
|
+ public toDate: Date | null = null;
|
|
|
|
|
|
|
|
private searchParams: EventSearchParams = new EventSearchParams();
|
|
private searchParams: EventSearchParams = new EventSearchParams();
|
|
|
|
|
|
|
@@ -25,11 +29,15 @@ export class EventsPageComponent {
|
|
|
this.updateEvents();
|
|
this.updateEvents();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public search(event: SubmitEvent): void {
|
|
|
|
|
- this.searchParams = new EventSearchParams();
|
|
|
|
|
- this.searchParams.owner = this.showMyEvents ? 'me' : undefined;
|
|
|
|
|
- this.searchParams.filter = this.titleFilter ? this.titleFilter : undefined;
|
|
|
|
|
- this.updateEvents();
|
|
|
|
|
|
|
+ public search(form: NgForm, event: SubmitEvent): void {
|
|
|
|
|
+ if (form.valid) {
|
|
|
|
|
+ this.searchParams = new EventSearchParams();
|
|
|
|
|
+ this.searchParams.owner = this.showMyEvents ? 'me' : undefined;
|
|
|
|
|
+ this.searchParams.filter = this.titleFilter ? this.titleFilter : undefined;
|
|
|
|
|
+ this.searchParams.fromDate = this.fromDate;
|
|
|
|
|
+ this.searchParams.toDate = this.toDate ?? undefined;
|
|
|
|
|
+ this.updateEvents();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public loadMore(): void {
|
|
public loadMore(): void {
|