Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Have working date filters

Benjamin Bädorf0d4e3a1e2c1f
diff --git a/frontend/src/app/features/work-packages/components/filters/filter-dates-value/filter-dates-value.component.html b/frontend/src/app/features/work-packages/components/filters/filter-dates-value/filter-dates-value.component.html
index 837e80aa591..4608e45b2b3 100644
--- a/frontend/src/app/features/work-packages/components/filters/filter-dates-value/filter-dates-value.component.html
+++ b/frontend/src/app/features/work-packages/components/filters/filter-dates-value/filter-dates-value.component.html
@@ -1,25 +1,9 @@
-<!--op-single-date-picker
- (changed)="begin = parser($event)"
- [value]="formatter(begin)"
- [opAutofocus]="shouldFocus"
- required="true"
- [id]="'values-' + filter.id + '-begin'"
- [name]="'v[' + filter.id + ']-begin'"
- classes="advanced-filters--date-field"
- size="10"
-></op-single-date-picker-->
+<op-multi-date-picker
+ [id]="'values-' + filter.id"
+ [name]="'v[' + filter.id + ']'"
-<span
- class="advanced-filters--affix"
- [textContent]="text.spacer"
-></span>
+ [(ngModel)]="value"
+ [opAutofocus]="shouldFocus"
-<!--op-single-date-picker
- (changed)="end = parser($event)"
- [value]="formatter(end)"
- required="true"
- [id]="'values-' + filter.id + '-end'"
- [name]="'v[' + filter.id + ']-end'"
classes="advanced-filters--date-field"
- size="10"
-></op-single-date-picker-->
+></op-multi-date-picker>
diff --git a/frontend/src/app/features/work-packages/components/filters/filter-dates-value/filter-dates-value.component.ts b/frontend/src/app/features/work-packages/components/filters/filter-dates-value/filter-dates-value.component.ts
index db184409f2a..4161ff59516 100644
--- a/frontend/src/app/features/work-packages/components/filters/filter-dates-value/filter-dates-value.component.ts
+++ b/frontend/src/app/features/work-packages/components/filters/filter-dates-value/filter-dates-value.component.ts
@@ -62,22 +62,21 @@ export class FilterDatesValueComponent extends UntilDestroyedMixin {
super();
}
- public get begin():any {
- return this.filter.values[0];
+ public get value():(HalResource[]|string[]) {
+ return this.filter.values;
}
- public set begin(val:any) {
- this.filter.values[0] = val || '';
+ public set value(val:(HalResource[]|string[])) {
+ this.filter.values = val;
this.filterChanged.emit(this.filter);
}
- public get end():HalResource|string {
- return this.filter.values[1];
+ public get begin():any {
+ return this.filter.values[0];
}
- public set end(val) {
- this.filter.values[1] = val || '';
- this.filterChanged.emit(this.filter);
+ public get end():HalResource|string {
+ return this.filter.values[1];
}
public parser(data:any) {
diff --git a/frontend/src/app/shared/components/datepicker/wp-multi-date-form/wp-multi-date-form.component.ts b/frontend/src/app/shared/components/datepicker/wp-multi-date-form/wp-multi-date-form.component.ts
index d4fbcfda753..50ac504e5e9 100644
--- a/frontend/src/app/shared/components/datepicker/wp-multi-date-form/wp-multi-date-form.component.ts
+++ b/frontend/src/app/shared/components/datepicker/wp-multi-date-form/wp-multi-date-form.component.ts
@@ -193,7 +193,6 @@ export class OpWpMultiDateFormComponent extends UntilDestroyedMixin implements A
this.clearWithDuration(field);
}
- this.onDataChange();
this.cdRef.detectChanges();
});
@@ -236,8 +235,6 @@ export class OpWpMultiDateFormComponent extends UntilDestroyedMixin implements A
) {
super();
- console.log('constructor');
-
this
.formUpdates$
.pipe(
@@ -258,8 +255,6 @@ export class OpWpMultiDateFormComponent extends UntilDestroyedMixin implements A
}
ngOnInit(): void {
- console.log('ngOnInit');
-
this.htmlId = `wp-datepicker-${this.fieldName as string}`;
this.dateModalScheduling.setChangeset(this.changeset as WorkPackageChangeset);
@@ -286,13 +281,11 @@ export class OpWpMultiDateFormComponent extends UntilDestroyedMixin implements A
}
ngAfterViewInit():void {
- console.log('ngAfterViewInit');
this
.dateModalRelations
.getMinimalDateFromPreceeding()
.subscribe((date) => {
this.initializeDatepicker(date);
- this.onDataChange();
});
// Autofocus duration if that's what activated us
@@ -527,7 +520,6 @@ export class OpWpMultiDateFormComponent extends UntilDestroyedMixin implements A
const dates = [startDate, endDate];
setDates(dates, this.datePickerInstance, enforceDate);
- this.onDataChange();
}
private setDatesAndDeriveDuration(newStart:Date, newEnd:Date) {
@@ -730,14 +722,6 @@ export class OpWpMultiDateFormComponent extends UntilDestroyedMixin implements A
}
}
- private onDataChange() {
- const start = this.dates.start || '';
- const end = this.dates.end || '';
-
- const output = `${start} - ${end}`;
- this.save.emit(output);
- }
-
private get initialActivatedField():DateFields {
switch (this.fieldName) {
case 'startDate':
diff --git a/frontend/src/app/shared/components/fields/edit/field-types/date-picker-edit-field.component.ts b/frontend/src/app/shared/components/fields/edit/field-types/date-picker-edit-field.component.ts
index cfd525030cc..09ac159deba 100644
--- a/frontend/src/app/shared/components/fields/edit/field-types/date-picker-edit-field.component.ts
+++ b/frontend/src/app/shared/components/fields/edit/field-types/date-picker-edit-field.component.ts
@@ -70,31 +70,6 @@ export abstract class DatePickerEditFieldComponent extends EditFieldComponent im
public showDatePickerModal():void {
console.log('show datepicker modal');
- /*
- const component = this.change.schema.isMilestone ? SingleDateModalComponent : MultiDateModalComponent;
- this.opModalService.show<SingleDateModalComponent|MultiDateModalComponent>(
- component,
- this.injector,
- { changeset: this.change, fieldName: this.name },
- !this.deviceService.isMobile,
- ).subscribe((modal) => {
- this.modal = modal;
-
- setTimeout(() => {
- const modalElement = jQuery(modal.elementRef.nativeElement).find('.op-datepicker-modal');
- const field = jQuery(this.elementRef.nativeElement);
- modal.reposition(modalElement, field);
- });
-
- (modal as OpModalComponent)
- .closingEvent
- .pipe(take(1))
- .subscribe(() => {
- this.modal = null;
- this.onModalClosed();
- });
- });
- */
}
protected onModalClosed():void {