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

Separate changeset and non-changeset datepickers

Benjamin Bädorff0d86c1cc214
diff --git a/frontend/src/app/features/work-packages/components/filters/filter-date-times-value/filter-date-times-value.component.html b/frontend/src/app/features/work-packages/components/filters/filter-date-times-value/filter-date-times-value.component.html
index d346603bc57..8a55d1e5aa3 100644
--- a/frontend/src/app/features/work-packages/components/filters/filter-date-times-value/filter-date-times-value.component.html
+++ b/frontend/src/app/features/work-packages/components/filters/filter-date-times-value/filter-date-times-value.component.html
@@ -1,27 +1,14 @@
-<!--op-single-date-picker
- (changed)="begin = isoDateParser($event)"
- [value]="isoDateFormatter(begin)"
- [opAutofocus]="shouldFocus"
+<op-multi-date-picker
+ [id]="'values-' + filter.id"
+ [name]="'v[' + filter.id + ']'"
required="true"
- [id]="'values-' + filter.id + '-begin'"
- [name]="'v[' + filter.id + ']-begin'"
- classes="advanced-filters--date-field"
- size="10"
-></op-single-date-picker-->
-<span
- class="advanced-filters--affix"
- [textContent]="text.spacer"
-></span>
+ [(ngModel)]="value"
+ [opAutofocus]="shouldFocus"
-<!--op-single-date-picker
- (changed)="end = isoDateParser($event)"
- [value]="isoDateFormatter(end)"
- [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>
+
<span
class="advanced-filters--tooltip-trigger -multiline"
*ngIf="isTimeZoneDifferent"
diff --git a/frontend/src/app/features/work-packages/components/filters/filter-date-times-value/filter-date-times-value.component.ts b/frontend/src/app/features/work-packages/components/filters/filter-date-times-value/filter-date-times-value.component.ts
index 8131594b6c7..fae8a139444 100644
--- a/frontend/src/app/features/work-packages/components/filters/filter-date-times-value/filter-date-times-value.component.ts
+++ b/frontend/src/app/features/work-packages/components/filters/filter-date-times-value/filter-date-times-value.component.ts
@@ -63,27 +63,28 @@ export class FilterDateTimesValueComponent extends AbstractDateTimeValueControll
spacer: this.I18n.t('js.filter.value_spacer'),
};
- constructor(readonly I18n:I18nService,
- readonly timezoneService:TimezoneService) {
+ constructor(
+ readonly I18n:I18nService,
+ readonly timezoneService:TimezoneService,
+ ) {
super(I18n, timezoneService);
}
- public get begin():HalResource|string {
- return this.filter.values[0];
+ public get value():(HalResource[]|string[]) {
+ return this.filter.values;
}
- public set begin(val) {
- this.filter.values[0] = val || '';
+ public set value(val:(HalResource[]|string[])) {
+ this.filter.values = val;
this.filterChanged.emit(this.filter);
}
- public get end() {
- return this.filter.values[1];
+ public get begin() {
+ return this.filter.values[0];
}
- public set end(val) {
- this.filter.values[1] = val || '';
- this.filterChanged.emit(this.filter);
+ public get end() {
+ return this.filter.values[1];
}
public get lowerBoundary():Moment|null {
diff --git a/frontend/src/app/shared/components/datepicker/helpers/date-modal.helpers.ts b/frontend/src/app/shared/components/datepicker/helpers/date-modal.helpers.ts
index c7b4decee57..4047493de8c 100644
--- a/frontend/src/app/shared/components/datepicker/helpers/date-modal.helpers.ts
+++ b/frontend/src/app/shared/components/datepicker/helpers/date-modal.helpers.ts
@@ -102,7 +102,6 @@ export function onDayCreate(
dayElem:DayElement,
ignoreNonWorkingDays:boolean,
isNonWorkingDay:boolean,
- minimalDate:Date|null|undefined,
isDayDisabled:boolean,
):void {
if (!ignoreNonWorkingDays && isNonWorkingDay) {
diff --git a/frontend/src/app/shared/components/datepicker/multi-date-picker/multi-date-picker.component.html b/frontend/src/app/shared/components/datepicker/multi-date-picker/multi-date-picker.component.html
new file mode 100644
index 00000000000..fd73d92be39
--- /dev/null
+++ b/frontend/src/app/shared/components/datepicker/multi-date-picker/multi-date-picker.component.html
@@ -0,0 +1,129 @@
+<spot-drop-modal
+ [open]="isOpened"
+ (closed)="close()"
+>
+ <button
+ slot="trigger"
+ type="button"
+ class="button"
+ (click)="open()"
+ >{{ datesString }}</button>
+
+ <form
+ slot="body"
+ class="spot-container op-datepicker-modal op-datepicker-modal_wide"
+ data-qa-selector="op-datepicker-modal"
+ tabindex="0"
+ cdkFocusInitial
+ cdkTrapFocus
+ [cdkTrapFocusAutoCapture]="true"
+ (submit)="save($event)"
+ >
+ <spot-selector-field
+ [reverseLabel]="true"
+ [label]="text.ignoreNonWorkingDays.title"
+ >
+ <spot-switch
+ slot="input"
+ name="ignoreNonWorkingDays"
+ [(ngModel)]="ignoreNonWorkingDays"
+ (ngModelChange)="changeNonWorkingDays()"
+ data-qa-selector="op-datepicker-modal--include-non-working-days"
+ ></spot-switch>
+ </spot-selector-field>
+
+ <div class="op-datepicker-modal--dates-container">
+ <spot-form-field
+ [label]="text.startDate"
+ >
+ <spot-text-field
+ slot="input"
+ name="date"
+ class="op-datepicker-modal--date-field"
+ [attr.data-qa-highlighted]="showFieldAsActive('start') || undefined"
+ [ngClass]="{'op-datepicker-modal--date-field_current' : showFieldAsActive('start')}"
+ [ngModel]="dates.start"
+ (ngModelChange)="startDateChanged$.next($event)"
+ [showClearButton]="currentlyActivatedDateField === 'start'"
+ (focusin)="setCurrentActivatedField('start')"
+ ></spot-text-field>
+ <button
+ slot="action"
+ type="button"
+ class="spot-link"
+ (click)="setToday('start')"
+ [textContent]="text.today">
+ </button>
+ </spot-form-field>
+
+ <spot-form-field
+ [label]="text.endDate"
+ >
+ <spot-text-field
+ slot="input"
+ name="date"
+ class="op-datepicker-modal--date-field"
+ [attr.data-qa-highlighted]="showFieldAsActive('end') || undefined"
+ [ngClass]="{'op-datepicker-modal--date-field_current' : showFieldAsActive('end')}"
+ [ngModel]="dates.end"
+ (ngModelChange)="endDateChanged$.next($event)"
+ [showClearButton]="currentlyActivatedDateField === 'end'"
+ (focusin)="setCurrentActivatedField('end')"
+ ></spot-text-field>
+ <button
+ slot="action"
+ type="button"
+ class="spot-link"
+ (click)="setToday('end')"
+ [textContent]="text.today">
+ </button>
+ </spot-form-field>
+ <spot-form-field
+ [label]="text.duration"
+ data-qa-selector="datepicker-duration"
+ >
+ <spot-text-field
+ #durationField
+ slot="input"
+ name="duration"
+ data-qa-selector="op-datepicker-modal--duration-field"
+ class="op-datepicker-modal--date-field"
+ [attr.data-qa-highlighted]=" showFieldAsActive('duration') || undefined"
+ [ngClass]="{'op-datepicker-modal--date-field_current' : showFieldAsActive('duration')}"
+ [ngModel]="durationFocused ? duration : displayedDuration"
+ [showClearButton]="durationFocused"
+ pattern="\d*"
+ inputmode="numeric"
+ (ngModelChange)="durationChanges$.next($event)"
+ [disabled]="!isSchedulable"
+ (focusin)="handleDurationFocusIn()"
+ (focusout)="handleDurationFocusOut()"
+ ></spot-text-field>
+ </spot-form-field>
+ </div>
+
+ <input
+ [id]="id"
+ hidden
+ >
+ <div #flatpickrTarget></div>
+
+ <div class="spot-action-bar">
+ <div class="spot-action-bar--right">
+ <button
+ type="button"
+ (click)="close()"
+ class="button spot-action-bar--action"
+ data-qa-selector="op-datepicker-modal--action"
+ [textContent]="text.cancel"
+ ></button>
+ <button
+ type="submit"
+ class="button -highlight spot-action-bar--action"
+ data-qa-selector="op-datepicker-modal--action"
+ [textContent]="text.save"
+ ></button>
+ </div>
+ </div>
+ </form>
+</spot-drop-modal>
diff --git a/frontend/src/app/shared/components/datepicker/multi-date-picker/multi-date-picker.component.ts b/frontend/src/app/shared/components/datepicker/multi-date-picker/multi-date-picker.component.ts
new file mode 100644
index 00000000000..9220d389011
--- /dev/null
+++ b/frontend/src/app/shared/components/datepicker/multi-date-picker/multi-date-picker.component.ts
@@ -0,0 +1,771 @@
+// -- copyright
+// OpenProject is an open source project management software.
+// Copyright (C) 2012-2022 the OpenProject GmbH
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License version 3.
+//
+// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+// Copyright (C) 2006-2013 Jean-Philippe Lang
+// Copyright (C) 2010-2013 the ChiliProject Team
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+// See COPYRIGHT and LICENSE files for more details.
+//++
+
+import {
+ ChangeDetectionStrategy,
+ ChangeDetectorRef,
+ Component,
+ ElementRef,
+ EventEmitter,
+ forwardRef,
+ HostBinding,
+ Injector,
+ Input,
+ OnInit,
+ Output,
+ ViewChild,
+ ViewEncapsulation,
+} from '@angular/core';
+import { I18nService } from 'core-app/core/i18n/i18n.service';
+import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
+import {
+ areDatesEqual,
+ mappedDate,
+ onDayCreate,
+ parseDate,
+ setDates,
+ validDate,
+} from 'core-app/shared/components/datepicker/helpers/date-modal.helpers';
+import { TimezoneService } from 'core-app/core/datetime/timezone.service';
+import { DatePicker } from '../datepicker';
+import flatpickr from 'flatpickr';
+import { DayElement } from 'flatpickr/dist/types/instance';
+import { ActiveDateChange, DateFields, DateKeys, FieldUpdates } from '../wp-multi-date-form/wp-multi-date-form.component';
+import { merge, Observable, Subject } from 'rxjs';
+import { UntilDestroyedMixin } from 'core-app/shared/helpers/angular/until-destroyed.mixin';
+import { debounceTime, filter, map } from 'rxjs/operators';
+import { DeviceService } from 'core-app/core/browser/device.service';
+import { DateOption } from 'flatpickr/dist/types/options';
+import { WeekdayService } from 'core-app/core/days/weekday.service';
+import { FocusHelperService } from 'core-app/shared/directives/focus/focus-helper';
+
+@Component({
+ selector: 'op-multi-date-picker',
+ templateUrl: './multi-date-picker.component.html',
+ styleUrls: ['../styles/datepicker.modal.sass', '../styles/datepicker_mobile.modal.sass'],
+ changeDetection: ChangeDetectionStrategy.OnPush,
+ encapsulation: ViewEncapsulation.None,
+ providers: [
+ {
+ provide: NG_VALUE_ACCESSOR,
+ useExisting: forwardRef(() => OpMultiDatePickerComponent),
+ multi: true,
+ },
+ ],
+})
+export class OpMultiDatePickerComponent extends UntilDestroyedMixin implements OnInit, ControlValueAccessor {
+ @HostBinding('class.op-datepicker-modal') className = true;
+
+ @HostBinding('class.op-datepicker-modal_wide') classNameWide = true;
+
+ @ViewChild('modalContainer') modalContainer:ElementRef<HTMLElement>;
+
+ @ViewChild('durationField', { read: ElementRef }) durationField:ElementRef<HTMLElement>;
+
+ @Input() fieldName:string = '';
+
+ @Input() value:string[] = [];
+
+ @Output() valueChanged = new EventEmitter();
+
+ @Output() cancel = new EventEmitter();
+
+ @Output() save = new EventEmitter();
+
+ text = {
+ save: this.I18n.t('js.button_save'),
+ cancel: this.I18n.t('js.button_cancel'),
+ startDate: this.I18n.t('js.work_packages.properties.startDate'),
+ endDate: this.I18n.t('js.work_packages.properties.dueDate'),
+ duration: this.I18n.t('js.work_packages.properties.duration'),
+ placeholder: this.I18n.t('js.placeholders.default'),
+ today: this.I18n.t('js.label_today'),
+ days: (count:number):string => this.I18n.t('js.units.day', { count }),
+ };
+
+ get datesString():string {
+ if (this.value?.[0] && this.value?.[1]) {
+ return `${this.value[0]} - ${this.value[1]}`;
+ }
+
+ return this.text.placeholder;
+ }
+
+ ignoreNonWorkingDays = false;
+
+ isOpened = true;
+
+ duration:number|null;
+
+ currentlyActivatedDateField:DateFields;
+
+ htmlId = '';
+
+ dates:{ [key in DateKeys]:string|null } = {
+ start: null,
+ end: null,
+ };
+
+ // Manual changes from the inputs to start and end dates
+ startDateChanged$ = new Subject<string>();
+
+ startDateDebounced$:Observable<ActiveDateChange> = this.debouncedInput(this.startDateChanged$, 'start');
+
+ endDateChanged$ = new Subject<string>();
+
+ endDateDebounced$:Observable<ActiveDateChange> = this.debouncedInput(this.endDateChanged$, 'end');
+
+ // Manual changes to the datepicker, with information which field was active
+ datepickerChanged$ = new Subject<ActiveDateChange>();
+
+ // We want to position the modal as soon as the datepicker gets initialized
+ // But if we destroy and recreate the datepicker (e.g., when toggling switches), keep current position
+ modalPositioned = false;
+
+ // Date updates from the datepicker or a manual change
+ dateUpdates$ = merge(
+ this.startDateDebounced$,
+ this.endDateDebounced$,
+ this.datepickerChanged$,
+ )
+ .pipe(
+ this.untilDestroyed(),
+ filter(() => !!this.datePickerInstance),
+ )
+ .subscribe(([field, update]) => {
+ // When clearing the one date, clear the others as well
+ if (update !== null) {
+ this.handleSingleDateUpdate(field, update);
+ }
+
+ // Clear active field and duration
+ // when the active field was cleared
+ if (update === null && field !== 'duration') {
+ this.clearWithDuration(field);
+ }
+
+ this.onDataChange();
+ this.cdRef.detectChanges();
+ });
+
+ // Duration changes
+ durationChanges$ = new Subject<string>();
+
+ durationDebounced$ = this
+ .durationChanges$
+ .pipe(
+ this.untilDestroyed(),
+ debounceTime(500),
+ map((value) => (value === '' ? null : Math.abs(parseInt(value, 10)))),
+ filter((val) => val === null || !Number.isNaN(val)),
+ filter((val) => val !== this.duration),
+ )
+ .subscribe((value) => this.applyDurationChange(value));
+
+ // Duration is a special field as it changes its value based on its focus state
+ // which is different from the highlight state...
+ durationFocused = false;
+
+ ignoreNonWorkingDaysWritable = true;
+
+ private datePickerInstance:DatePicker;
+
+ private formUpdates$ = new Subject<FieldUpdates>();
+
+ constructor(
+ readonly injector:Injector,
+ readonly cdRef:ChangeDetectorRef,
+ readonly I18n:I18nService,
+ readonly timezoneService:TimezoneService,
+ readonly deviceService:DeviceService,
+ readonly weekdayService:WeekdayService,
+ readonly focusHelper:FocusHelperService,
+ ) {
+ super();
+ }
+
+ ngOnInit(): void {
+ this.htmlId = `wp-datepicker-${this.fieldName as string}`;
+
+ this.setCurrentActivatedField(this.initialActivatedField);
+ }
+
+ open():void {
+ this.isOpened = true;
+ this.initializeDatepicker();
+ }
+
+ close():void {
+ this.isOpened = true;
+ this.datePickerInstance?.destroy();
+ }
+
+ changeNonWorkingDays():void {
+ this.initializeDatepicker();
+
+ // Resent the current start and duration so that the end date is calculated
+ if (!!this.dates.start && !!this.duration) {
+ this.formUpdates$.next({ startDate: this.dates.start, duration: this.durationAsIso8601 });
+ }
+
+ // If only one of the dates is set, sent that
+ // Resent the current start and duration so that the end date is calculated
+ if (!!this.dates.start && !this.dates.end) {
+ this.formUpdates$.next({ startDate: this.dates.start });
+ }
+
+ if (!!this.dates.end && !this.dates.start) {
+ this.formUpdates$.next({ dueDate: this.dates.end });
+ }
+
+ this.cdRef.detectChanges();
+ }
+
+ doSave($event:Event):void {
+ $event.preventDefault();
+ // Apply the changed scheduling mode if any
+ this.changeset.setValue('scheduleManually', this.scheduleManually);
+
+ // Apply include NWD
+ this.changeset.setValue('ignoreNonWorkingDays', this.ignoreNonWorkingDays);
+
+ // Apply the dates if they could be changed
+ if (this.isSchedulable) {
+ this.changeset.setValue('startDate', mappedDate(this.dates.start));
+ this.changeset.setValue('dueDate', mappedDate(this.dates.end));
+ this.changeset.setValue('duration', this.durationAsIso8601);
+ }
+
+ this.save.emit();
+ }
+
+ doCancel():void {
+ this.cancel.emit();
+ }
+
+ updateDate(key:DateKeys, val:string|null):void {
+ if ((val === null || validDate(val)) && this.datePickerInstance) {
+ this.dates[key] = mappedDate(val);
+ const dateValue = parseDate(val || '') || undefined;
+ this.enforceManualChangesToDatepicker(dateValue);
+ this.cdRef.detectChanges();
+ }
+ }
+
+ setCurrentActivatedField(val:DateFields):void {
+ this.currentlyActivatedDateField = val;
+ }
+
+ toggleCurrentActivatedField():void {
+ this.currentlyActivatedDateField = this.currentlyActivatedDateField === 'start' ? 'end' : 'start';
+ }
+
+ isStateOfCurrentActivatedField(val:DateFields):boolean {
+ return this.currentlyActivatedDateField === val;
+ }
+
+ setToday(key:DateKeys):void {
+ this.datepickerChanged$.next([key, new Date()]);
+
+ const nextActive = key === 'start' ? 'end' : 'start';
+ this.setCurrentActivatedField(nextActive);
+ }
+
+ showTodayLink():boolean {
+ return this.isSchedulable;
+ }
+
+ /**
+ * Returns whether the user can alter the dates of the work package.
+ */
+ get isSchedulable():boolean {
+ return this.scheduleManually || !this.dateModalRelations.isParent;
+ }
+
+ showFieldAsActive(field:DateFields):boolean {
+ return this.isStateOfCurrentActivatedField(field) && this.isSchedulable;
+ }
+
+ handleDurationFocusIn():void {
+ this.durationFocused = true;
+ this.setCurrentActivatedField('duration');
+ }
+
+ handleDurationFocusOut():void {
+ setTimeout(() => {
+ this.durationFocused = false;
+ });
+ }
+
+ get displayedDuration():string {
+ if (!this.duration) {
+ return '';
+ }
+
+ return this.text.days(this.duration);
+ }
+
+ private applyDurationChange(newValue:number|null):void {
+ this.duration = newValue;
+ this.cdRef.detectChanges();
+
+ // If we cleared duration or left it empty
+ // reset the value and the due date
+ if (newValue === null) {
+ this.updateDate('end', null);
+ return;
+ }
+
+ if (this.dates.start) {
+ this.formUpdates$.next({
+ startDate: this.dates.start,
+ duration: this.durationAsIso8601,
+ });
+ } else if (this.dates.end) {
+ this.formUpdates$.next({
+ dueDate: this.dates.end,
+ duration: this.durationAsIso8601,
+ });
+ }
+ }
+
+ private get durationAsIso8601():string|null {
+ if (this.duration) {
+ return this.timezoneService.toISODuration(this.duration, 'days');
+ }
+
+ return null;
+ }
+
+ private clearWithDuration(field:DateKeys) {
+ this.duration = null;
+ this.dates[field] = null;
+ this.enforceManualChangesToDatepicker();
+ }
+
+ private initializeDatepicker(minimalDate?:Date|null) {
+ this.datePickerInstance?.destroy();
+ this.datePickerInstance = new DatePicker(
+ this.injector,
+ '#flatpickr-input',
+ [this.dates.start || '', this.dates.end || ''],
+ {
+ mode: 'range',
+ showMonths: this.deviceService.isMobile ? 1 : 2,
+ inline: true,
+ onReady: (_date, _datestr, instance) => {
+ instance.calendarContainer.classList.add('op-datepicker-modal--flatpickr-instance');
+
+ if (!this.modalPositioned) {
+ this.modalPositioned = true;
+ }
+
+ this.ensureHoveredSelection(instance.calendarContainer);
+ },
+ onChange: (dates:Date[], _datestr, instance) => {
+ const activeField = this.currentlyActivatedDateField;
+
+ // When two values are passed from datepicker and we don't have duration set,
+ // just take the range provided by them
+ if (dates.length === 2 && !this.duration) {
+ this.setDatesAndDeriveDuration(dates[0], dates[1]);
+ this.toggleCurrentActivatedField();
+ return;
+ }
+
+ // Update with the same flow as entering a value
+ const { latestSelectedDateObj } = instance as { latestSelectedDateObj:Date };
+ this.datepickerChanged$.next([activeField, latestSelectedDateObj]);
+
+ // The duration field is special in how it handles focus transitions
+ // For start/due we just toggle here
+ if (activeField !== 'duration') {
+ this.toggleCurrentActivatedField();
+ }
+ },
+ onDayCreate: (dObj:Date[], dStr:string, fp:flatpickr.Instance, dayElem:DayElement) => {
+ onDayCreate(
+ dayElem,
+ this.ignoreNonWorkingDays,
+ this.weekdayService.isNonWorkingDay(dayElem.dateObj),
+ this.isDayDisabled(dayElem, minimalDate),
+ );
+ },
+ },
+ null,
+ );
+ }
+
+ private enforceManualChangesToDatepicker(enforceDate?:Date) {
+ let startDate = parseDate(this.dates.start || '');
+ let endDate = parseDate(this.dates.end || '');
+
+ if (startDate && endDate) {
+ // If the start date is manually changed to be after the end date,
+ // we adjust the end date to be at least the same as the newly entered start date.
+ // Same applies if the end date is set manually before the current start date
+ if (startDate > endDate && this.isStateOfCurrentActivatedField('start')) {
+ endDate = startDate;
+ this.dates.end = this.timezoneService.formattedISODate(endDate);
+ } else if (endDate < startDate && this.isStateOfCurrentActivatedField('end')) {
+ startDate = endDate;
+ this.dates.start = this.timezoneService.formattedISODate(startDate);
+ }
+ }
+
+ const dates = [startDate, endDate];
+ setDates(dates, this.datePickerInstance, enforceDate);
+ this.onDataChange();
+ }
+
+ private setDatesAndDeriveDuration(newStart:Date, newEnd:Date) {
+ this.dates.start = this.timezoneService.formattedISODate(newStart);
+ this.dates.end = this.timezoneService.formattedISODate(newEnd);
+
+ // Derive duration
+ this.formUpdates$.next({ startDate: this.dates.start, dueDate: this.dates.end });
+ }
+
+ private handleSingleDateUpdate(activeField:DateFields, selectedDate:Date) {
+ if (activeField === 'duration') {
+ this.durationActiveDateSelected(selectedDate);
+ return;
+ }
+
+ // If both dates are now set, ensure we update it accordingly
+ if (this.dates.start && this.dates.end) {
+ this.replaceDatesWithNewSelection(activeField, selectedDate);
+ return;
+ }
+
+ // Set the current date field
+ this.moveActiveDate(activeField, selectedDate);
+
+ // We may or may not have both fields set now
+ // If we have duration set, we derive the other field
+ if (this.duration) {
+ this.deriveMissingDateFromDuration(activeField);
+ } else if (this.dates.start && this.dates.end) {
+ this.formUpdates$.next({ startDate: this.dates.start, dueDate: this.dates.end });
+ }
+
+ // Set the selected date on the datepicker
+ this.enforceManualChangesToDatepicker(selectedDate);
+ }
+
+ /**
+ * The duration field is active and a date was clicked in the datepicker.
+ *
+ * If the duration field has a value:
+ * - start date is updated, derive end date, set end date active
+ * If the duration field has no value:
+ * - If start date has a value, finish date is set
+ * - Otherwise, start date is set
+ * - Focus is set to the finish date
+ *
+ * @param selectedDate The date selected
+ * @private
+ */
+ private durationActiveDateSelected(selectedDate:Date) {
+ const selectedIsoDate = this.timezoneService.formattedISODate(selectedDate);
+
+ if (!this.duration && this.dates.start) {
+ // When duration is empty and start is set, update finish
+ this.setDaysInOrder(this.dates.start, selectedIsoDate);
+
+ // Focus moves to start date
+ this.setCurrentActivatedField('start');
+ } else {
+ // Otherwise, the start date always gets updated
+ this.setDaysInOrder(selectedIsoDate, this.dates.end);
+
+ // Focus moves to finish date
+ this.setCurrentActivatedField('end');
+ }
+
+ if (this.dates.start && this.duration) {
+ // If duration has value, derive end date from start and duration
+ this.formUpdates$.next({ startDate: this.dates.start, duration: this.durationAsIso8601 });
+ } else if (this.dates.start && this.dates.end) {
+ // If start and due now have values, derive duration again
+ this.formUpdates$.next({ startDate: this.dates.start, dueDate: this.dates.end });
+ }
+ }
+
+ private setDaysInOrder(start:string|null, end:string|null) {
+ const parsedStartDate = start ? parseDate(start) as Date : null;
+ const parsedEndDate = end ? parseDate(end) as Date : null;
+
+ if (parsedStartDate && parsedEndDate && parsedStartDate > parsedEndDate) {
+ this.dates.start = end;
+ this.dates.end = start;
+ } else {
+ this.dates.start = start;
+ this.dates.end = end;
+ }
+ }
+
+ /**
+ * The active field was updated in the datepicker, while the other date was not set
+ *
+ * This means we want to derive the non-active field using the duration, if that is set.
+ *
+ * @param activeField The active field that was changed
+ * @private
+ */
+ private deriveMissingDateFromDuration(activeField:'start'|'end') {
+ if (activeField === 'start' && !!this.dates.start) {
+ this.formUpdates$.next({ startDate: this.dates.start, duration: this.durationAsIso8601 });
+ }
+
+ if (activeField === 'end' && !!this.dates.end) {
+ this.formUpdates$.next({ dueDate: this.dates.end, duration: this.durationAsIso8601 });
+ }
+ }
+
+ /**
+ * Moves the active date to the given selected date.
+ *
+ * This is different from replaceDatesWithNewSelection as duration is prioritized higher in our case.
+ * @param activeField
+ * @param selectedDate
+ * @private
+ */
+ private moveActiveDate(activeField:DateKeys, selectedDate:Date) {
+ const parsedStartDate = this.dates.start ? parseDate(this.dates.start) as Date : null;
+ const parsedEndDate = this.dates.end ? parseDate(this.dates.end) as Date : null;
+
+ // Set the given field
+ this.dates[activeField] = this.timezoneService.formattedISODate(selectedDate);
+
+ // Special handling, moving finish date to before start date
+ if (activeField === 'end' && parsedStartDate && parsedStartDate > selectedDate) {
+ // Reset duration and start date
+ this.duration = null;
+ this.dates.start = null;
+ // Update finish date and mark as active in datepicker
+ this.enforceManualChangesToDatepicker(selectedDate);
+ }
+
+ // Special handling, moving start date to after finish date
+ if (activeField === 'start' && parsedEndDate && parsedEndDate < selectedDate) {
+ // Reset duration and start date
+ this.duration = null;
+ this.dates.end = null;
+ // Update finish date and mark as active in datepicker
+ this.enforceManualChangesToDatepicker(selectedDate);
+ }
+ }
+
+ private replaceDatesWithNewSelection(activeField:DateFields, selectedDate:Date) {
+ /**
+ Overwrite flatpickr default behavior by not starting a new date range everytime but preserving either start or end date.
+ There are three cases to cover.
+ 1. Everything before the current start date will become the new start date (independent of the active field)
+ 2. Everything after the current end date will become the new end date if that is the currently active field.
+ If the active field is the start date, the selected date becomes the new start date and the end date is cleared.
+ 3. Everything in between the current start and end date is dependent on the currently activated field.
+ * */
+
+ const parsedStartDate = parseDate(this.dates.start || '') as Date;
+ const parsedEndDate = parseDate(this.dates.end || '') as Date;
+
+ if (selectedDate < parsedStartDate) {
+ if (activeField === 'start') {
+ // Set start, derive end from duration
+ this.applyNewDates([selectedDate]);
+ } else {
+ // Reset duration and end date
+ this.duration = null;
+ this.applyNewDates(['', selectedDate]);
+ }
+ } else if (selectedDate > parsedEndDate) {
+ if (activeField === 'end') {
+ this.applyNewDates([parsedStartDate, selectedDate]);
+ } else {
+ // Reset duration and end date
+ this.duration = null;
+ this.applyNewDates([selectedDate]);
+ }
+ } else if (areDatesEqual(selectedDate, parsedStartDate) || areDatesEqual(selectedDate, parsedEndDate)) {
+ this.applyNewDates([selectedDate, selectedDate]);
+ } else {
+ const newDates = activeField === 'start' ? [selectedDate, parsedEndDate] : [parsedStartDate, selectedDate];
+ this.applyNewDates(newDates);
+ }
+ }
+
+ private applyNewDates([start, end]:DateOption[]) {
+ this.dates.start = start ? this.timezoneService.formattedISODate(start) : null;
+ this.dates.end = end ? this.timezoneService.formattedISODate(end) : null;
+
+ // Apply the dates to the datepicker
+ setDates([start, end], this.datePickerInstance);
+
+ // We updated either start, end, or both fields
+ // If both are now set, we want to derive duration from them
+ if (this.dates.start && this.dates.end) {
+ this.formUpdates$.next({ startDate: this.dates.start, dueDate: this.dates.end });
+ }
+
+ // If only one is set, derive from duration
+ if (this.dates.start && !this.dates.end && !!this.duration) {
+ this.formUpdates$.next({ startDate: this.dates.start, duration: this.durationAsIso8601 });
+ }
+
+ if (this.dates.end && !this.dates.start && !!this.duration) {
+ this.formUpdates$.next({ dueDate: this.dates.end, duration: this.durationAsIso8601 });
+ }
+ }
+
+ 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':
+ return 'start';
+ case 'dueDate':
+ return 'end';
+ case 'duration':
+ return 'duration';
+ default:
+ return (this.dates.start && !this.dates.end) ? 'end' : 'start';
+ }
+ }
+
+ private isDayDisabled(dayElement:DayElement, minimalDate?:Date|null):boolean {
+ return !this.isSchedulable || (!this.scheduleManually && !!minimalDate && dayElement.dateObj <= minimalDate);
+ }
+
+ /**
+ * Update the datepicker dates and properties from a form response
+ * that includes derived/calculated values.
+ *
+ * @param form
+ * @private
+ */
+ private updateDatesFromForm(form:FormResource):void {
+ const payload = form.payload as { startDate:string, dueDate:string, duration:string, ignoreNonWorkingDays:boolean };
+ this.dates.start = payload.startDate;
+ this.dates.end = payload.dueDate;
+ this.ignoreNonWorkingDays = payload.ignoreNonWorkingDays;
+
+ this.setDurationDaysFromUpstream(payload.duration);
+
+ const parsedStartDate = parseDate(this.dates.start) as Date;
+ this.enforceManualChangesToDatepicker(parsedStartDate);
+ this.cdRef.detectChanges();
+ }
+
+ /**
+ * Updates the duration property and the displayed value
+ * @param value a ISO8601 duration string or null
+ * @private
+ */
+ private setDurationDaysFromUpstream(value:string|null) {
+ const durationDays = value ? this.timezoneService.toDays(value) : null;
+
+ if (!durationDays || durationDays === 0) {
+ this.duration = null;
+ } else {
+ this.duration = durationDays;
+ }
+ }
+
+ private debouncedInput(input$:Subject<string>, key:DateKeys):Observable<ActiveDateChange> {
+ return input$
+ .pipe(
+ this.untilDestroyed(),
+ // Skip values that are already set as the current model
+ filter((value) => value !== this.dates[key]),
+ // Avoid that the manual changes are moved to the datepicker too early.
+ // The debounce is chosen quite large on purpose to catch the following case:
+ // 1. Start date is for example 2022-07-15. The user wants to set the end date to the 19th.
+ // 2. So he/she starts entering the finish date 2022-07-1 .
+ // 3. This is already a valid date. Since it is before the start date,the start date would be changed automatically to the first without the debounce.
+ // 4. The debounce gives the user enough time to type the last number "9" before the changes are converted to the datepicker and the start date would be affected.
+ debounceTime(500),
+ filter((date) => validDate(date)),
+ map((date) => {
+ if (date === '') {
+ return null;
+ }
+
+ return parseDate(date) as Date;
+ }),
+ map((date) => [key, date]),
+ );
+ }
+
+ /**
+ * When hovering selections in the range datepicker, the range usually
+ * stays active no matter where the cursor is.
+ *
+ * We want to hide any hovered selection preview when we leave the datepicker.
+ * @param calendarContainer
+ * @private
+ */
+ private ensureHoveredSelection(calendarContainer:HTMLDivElement) {
+ fromEvent(calendarContainer, 'mouseenter')
+ .pipe(
+ this.untilDestroyed(),
+ )
+ .subscribe(() => calendarContainer.classList.remove('flatpickr-container-suppress-hover'));
+
+ fromEvent(calendarContainer, 'mouseleave')
+ .pipe(
+ this.untilDestroyed(),
+ filter(() => !(!!this.dates.start && !!this.dates.end)),
+ )
+ .subscribe(() => calendarContainer.classList.add('flatpickr-container-suppress-hover'));
+ }
+
+ writeValue(value:string[]|null):void {
+ this.value = value || [];
+ this.dates.start = this.value[0];
+ this.dates.end = this.value[1];
+ }
+
+ onChange = (_:string[]):void => {};
+
+ onTouched = ():void => {};
+
+ registerOnChange(fn:(_:string[]) => void):void {
+ this.onChange = fn;
+ }
+
+ registerOnTouched(fn:() => void):void {
+ this.onTouched = fn;
+ }
+}
diff --git a/frontend/src/app/shared/components/datepicker/single-date-picker/single-date-picker.component.html b/frontend/src/app/shared/components/datepicker/single-date-picker/single-date-picker.component.html
index a3899e2e299..e35bb82be19 100644
--- a/frontend/src/app/shared/components/datepicker/single-date-picker/single-date-picker.component.html
+++ b/frontend/src/app/shared/components/datepicker/single-date-picker/single-date-picker.component.html
@@ -27,22 +27,11 @@
slot="input"
name="ignoreNonWorkingDays"
[(ngModel)]="ignoreNonWorkingDays"
+ (ngModelChange)="changeNonWorkingDays()"
data-qa-selector="op-datepicker-modal--include-non-working-days"
></spot-switch>
</spot-selector-field>
- <!--spot-form-field
- label="Name"
- >
- <spot-text-field
- slot="input"
- name="name"
- class="op-datepicker-modal--date-field"
- [(ngModel)]="entityName"
- [showClearButton]="true"
- ></spot-text-field>
- </spot-form-field-->
-
<spot-form-field
[label]="text.date"
>
@@ -50,8 +39,8 @@
slot="input"
name="date"
class="op-datepicker-modal--date-field"
- [ngModel]="value"
- (ngModelChange)="writeValue($event)"
+ [ngModel]="workingValue"
+ (ngModelChange)="writeWorkingValue($event)"
[showClearButton]="true"
></spot-text-field>
<button
diff --git a/frontend/src/app/shared/components/datepicker/single-date-picker/single-date-picker.component.ts b/frontend/src/app/shared/components/datepicker/single-date-picker/single-date-picker.component.ts
index 1cd60fd3381..224259bfd90 100644
--- a/frontend/src/app/shared/components/datepicker/single-date-picker/single-date-picker.component.ts
+++ b/frontend/src/app/shared/components/datepicker/single-date-picker/single-date-picker.component.ts
@@ -80,6 +80,8 @@ export class OpSingleDatePickerComponent implements ControlValueAccessor {
@ViewChild('flatpickrTarget') flatpickrTarget:ElementRef;
+ public workingValue = '';
+
public workingDate:Date = new Date();
public isOpened = false;
@@ -119,7 +121,8 @@ export class OpSingleDatePickerComponent implements ControlValueAccessor {
save($event:Event) {
$event.preventDefault();
- // Write value to outside first
+ this.valueChange.emit(this.workingValue);
+ this.onChange(this.workingValue);
this.close();
}
@@ -129,6 +132,11 @@ export class OpSingleDatePickerComponent implements ControlValueAccessor {
this.enforceManualChangesToDatepicker(today);
}
+ changeNonWorkingDays():void {
+ this.initializeDatepicker();
+ this.cdRef.detectChanges();
+ }
+
private enforceManualChangesToDatepicker(enforceDate?:Date) {
const date = parseDate(this.workingDate || '');
setDates(date, this.datePickerInstance, enforceDate);
@@ -149,8 +157,10 @@ export class OpSingleDatePickerComponent implements ControlValueAccessor {
},
onChange: (dates:Date[]) => {
if (dates.length > 0) {
- this.writeValue(this.timezoneService.formattedISODate(dates[0]));
+ const dateString = this.timezoneService.formattedISODate(dates[0]);
+ this.writeWorkingValue(dateString);
this.enforceManualChangesToDatepicker(dates[0]);
+ this.onTouched(dateString);
}
this.cdRef.detectChanges();
@@ -158,9 +168,8 @@ export class OpSingleDatePickerComponent implements ControlValueAccessor {
onDayCreate: (dObj:Date[], dStr:string, fp:flatpickr.Instance, dayElem:DayElement) => {
onDayCreate(
dayElem,
- this.ignoreNonWorkingDays,
+ !this.ignoreNonWorkingDays,
this.datePickerInstance?.weekdaysService.isNonWorkingDay(dayElem.dateObj),
- this.minimalDate,
!!this.minimalDate && dayElem.dateObj <= this.minimalDate,
);
},
@@ -169,10 +178,14 @@ export class OpSingleDatePickerComponent implements ControlValueAccessor {
);
}
+ writeWorkingValue(value:string):void {
+ this.workingValue = value;
+ this.workingDate = new Date(value);
+ }
+
writeValue(value:string):void {
+ this.writeWorkingValue(value);
this.value = value;
- this.workingDate = new Date(value);
- this.valueChange.emit(value);
}
onChange = (_:string):void => {};
diff --git a/frontend/src/app/shared/components/datepicker/styles/datepicker.modal.sass b/frontend/src/app/shared/components/datepicker/styles/datepicker.modal.sass
index b7687b44466..2e137d86b4a 100644
--- a/frontend/src/app/shared/components/datepicker/styles/datepicker.modal.sass
+++ b/frontend/src/app/shared/components/datepicker/styles/datepicker.modal.sass
@@ -8,7 +8,7 @@
max-width: 300px
&_wide
- max-width: 500px
+ max-width: 600px
&--toggle-actions-container
display: grid
diff --git a/frontend/src/app/shared/components/datepicker/multi-date-form/multi-date-form.component.html b/frontend/src/app/shared/components/datepicker/wp-multi-date-form/wp-multi-date-form.component.html
similarity index 98%
rename from frontend/src/app/shared/components/datepicker/multi-date-form/multi-date-form.component.html
rename to frontend/src/app/shared/components/datepicker/wp-multi-date-form/wp-multi-date-form.component.html
index 18c6ad23883..f239678dbea 100644
--- a/frontend/src/app/shared/components/datepicker/multi-date-form/multi-date-form.component.html
+++ b/frontend/src/app/shared/components/datepicker/wp-multi-date-form/wp-multi-date-form.component.html
@@ -12,7 +12,7 @@
>
<op-datepicker-banner [scheduleManually]="scheduleManually"></op-datepicker-banner>
- <div class="spot-modal--body spot-container form -vertical">
+ <div class="spot-modal--body spot-container op-datepicker-modal op-datepicker-modal_wide">
<div class="op-datepicker-modal--toggle-actions-container">
<op-datepicker-scheduling-toggle
name="scheduleManually"
diff --git a/frontend/src/app/shared/components/datepicker/multi-date-form/multi-date-form.component.ts b/frontend/src/app/shared/components/datepicker/wp-multi-date-form/wp-multi-date-form.component.ts
similarity index 96%
rename from frontend/src/app/shared/components/datepicker/multi-date-form/multi-date-form.component.ts
rename to frontend/src/app/shared/components/datepicker/wp-multi-date-form/wp-multi-date-form.component.ts
index dc427a3ba3f..e0dc82faee5 100644
--- a/frontend/src/app/shared/components/datepicker/multi-date-form/multi-date-form.component.ts
+++ b/frontend/src/app/shared/components/datepicker/wp-multi-date-form/wp-multi-date-form.component.ts
@@ -84,11 +84,11 @@ import { UntilDestroyedMixin } from 'core-app/shared/helpers/angular/until-destr
export type DateKeys = 'start'|'end';
export type DateFields = DateKeys|'duration';
-type StartUpdate = { startDate:string };
-type EndUpdate = { dueDate:string };
-type DurationUpdate = { duration:string|number|null };
-type DateUpdate = { date:string };
-type ActiveDateChange = [DateFields, null|Date|Date];
+export type StartUpdate = { startDate:string };
+export type EndUpdate = { dueDate:string };
+export type DurationUpdate = { duration:string|number|null };
+export type DateUpdate = { date:string };
+export type ActiveDateChange = [DateFields, null|Date|Date];
export type FieldUpdates =
StartUpdate
@@ -99,8 +99,8 @@ export type FieldUpdates =
|DateUpdate;
@Component({
- selector: 'op-multi-date-form',
- templateUrl: './multi-date-form.component.html',
+ selector: 'op-wp-multi-date-form',
+ templateUrl: './wp-multi-date-form.component.html',
styleUrls: [
'../styles/datepicker.modal.sass',
'../styles/datepicker_mobile.modal.sass',
@@ -112,7 +112,7 @@ export type FieldUpdates =
DateModalRelationsService,
],
})
-export class OpMultiDateFormComponent extends UntilDestroyedMixin implements AfterViewInit, OnInit {
+export class OpWpMultiDateFormComponent extends UntilDestroyedMixin implements AfterViewInit, OnInit {
@HostBinding('class.op-datepicker-modal') className = true;
@HostBinding('class.op-datepicker-modal_wide') classNameWide = true;
@@ -140,8 +140,6 @@ export class OpMultiDateFormComponent extends UntilDestroyedMixin implements Aft
days: (count:number):string => this.I18n.t('js.units.day', { count }),
};
- onDataUpdated = new EventEmitter<string>();
-
scheduleManually = false;
ignoreNonWorkingDays = false;
@@ -237,6 +235,24 @@ export class OpMultiDateFormComponent extends UntilDestroyedMixin implements Aft
readonly focusHelper:FocusHelperService,
) {
super();
+
+ this
+ .formUpdates$
+ .pipe(
+ this.untilDestroyed(),
+ switchMap((fieldsToUpdate:FieldUpdates) => this
+ .apiV3Service
+ .work_packages
+ .withOptionalId(this.changeset.id === 'new' ? null : this.changeset.id)
+ .form
+ .forPayload({
+ ...fieldsToUpdate,
+ lockVersion: this.changeset.value<string>('lockVersion'),
+ ignoreNonWorkingDays: this.ignoreNonWorkingDays,
+ scheduleManually: this.scheduleManually,
+ })),
+ )
+ .subscribe((form) => this.updateDatesFromForm(form));
}
ngOnInit(): void {
@@ -479,7 +495,6 @@ export class OpMultiDateFormComponent extends UntilDestroyedMixin implements Aft
dayElem,
this.ignoreNonWorkingDays,
this.weekdayService.isNonWorkingDay(dayElem.dateObj),
- minimalDate,
this.isDayDisabled(dayElem, minimalDate),
);
},
@@ -715,7 +730,7 @@ export class OpMultiDateFormComponent extends UntilDestroyedMixin implements Aft
const end = this.dates.end || '';
const output = `${start} - ${end}`;
- this.onDataUpdated.emit(output);
+ this.save.emit(output);
}
private get initialActivatedField():DateFields {
diff --git a/frontend/src/app/shared/components/datepicker/single-date-form/single-date-form.component.html b/frontend/src/app/shared/components/datepicker/wp-single-date-form/wp-single-date-form.component.html
similarity index 100%
rename from frontend/src/app/shared/components/datepicker/single-date-form/single-date-form.component.html
rename to frontend/src/app/shared/components/datepicker/wp-single-date-form/wp-single-date-form.component.html
diff --git a/frontend/src/app/shared/components/datepicker/single-date-form/single-date-form.component.ts b/frontend/src/app/shared/components/datepicker/wp-single-date-form/wp-single-date-form.component.ts
similarity index 97%
rename from frontend/src/app/shared/components/datepicker/single-date-form/single-date-form.component.ts
rename to frontend/src/app/shared/components/datepicker/wp-single-date-form/wp-single-date-form.component.ts
index acc3bcd73cf..e1451d2b72d 100644
--- a/frontend/src/app/shared/components/datepicker/single-date-form/single-date-form.component.ts
+++ b/frontend/src/app/shared/components/datepicker/wp-single-date-form/wp-single-date-form.component.ts
@@ -69,8 +69,8 @@ import { UntilDestroyedMixin } from 'core-app/shared/helpers/angular/until-destr
import { WorkPackageChangeset } from 'core-app/features/work-packages/components/wp-edit/work-package-changeset';
@Component({
- selector: 'op-single-date-form',
- templateUrl: './single-date-form.component.html',
+ selector: 'op-wp-single-date-form',
+ templateUrl: './wp-single-date-form.component.html',
styleUrls: [
'../styles/datepicker.modal.sass',
'../styles/datepicker_mobile.modal.sass',
@@ -82,7 +82,7 @@ import { WorkPackageChangeset } from 'core-app/features/work-packages/components
DateModalRelationsService,
],
})
-export class OpSingleDateFormComponent extends UntilDestroyedMixin implements AfterViewInit, OnInit {
+export class OpWpSingleDateFormComponent extends UntilDestroyedMixin implements AfterViewInit, OnInit {
@HostBinding('class.op-datepicker-modal') className = true;
@Input('value') value = '';
@@ -229,7 +229,6 @@ export class OpSingleDateFormComponent extends UntilDestroyedMixin implements Af
dayElem,
this.ignoreNonWorkingDays,
this.datePickerInstance?.weekdaysService.isNonWorkingDay(dayElem.dateObj),
- minimalDate,
this.dateModalScheduling.isDayDisabled(dayElem, minimalDate),
);
},
diff --git a/frontend/src/app/shared/components/fields/edit/field-types/combined-date-edit-field.component.html b/frontend/src/app/shared/components/fields/edit/field-types/combined-date-edit-field.component.html
index 42fef77d354..49dd1a113ee 100644
--- a/frontend/src/app/shared/components/fields/edit/field-types/combined-date-edit-field.component.html
+++ b/frontend/src/app/shared/components/fields/edit/field-types/combined-date-edit-field.component.html
@@ -10,15 +10,15 @@
class="spot-input"
>{{ dates }}</button>
- <op-single-date-form
+ <op-wp-single-date-form
*ngIf="!isMultiDate"
[value]="dates"
[changeset]="change"
(save)="save()"
(cancel)="cancel()"
slot="body"
- ></op-single-date-form>
- <op-multi-date-form
+ ></op-wp-single-date-form>
+ <op-wp-multi-date-form
*ngIf="isMultiDate"
[value]="dates"
[changeset]="change"
@@ -26,5 +26,5 @@
(save)="save()"
(cancel)="cancel()"
slot="body"
- ></op-multi-date-form>
+ ></op-wp-multi-date-form>
</spot-drop-modal>
diff --git a/frontend/src/app/shared/components/fields/edit/field-types/combined-date-edit-field.component.ts b/frontend/src/app/shared/components/fields/edit/field-types/combined-date-edit-field.component.ts
index 01262980d56..72f26d46e2c 100644
--- a/frontend/src/app/shared/components/fields/edit/field-types/combined-date-edit-field.component.ts
+++ b/frontend/src/app/shared/components/fields/edit/field-types/combined-date-edit-field.component.ts
@@ -48,16 +48,6 @@ export class CombinedDateEditFieldComponent extends DatePickerEditFieldComponent
get isMultiDate():boolean {
return !this.change.schema.isMilestone;
-
- /*
- this
- .modal
- ?.onDataUpdated
- .subscribe((dates:string) => {
- this.dates = dates;
- this.cdRef.detectChanges();
- });
- */
}
public onModalClosed():void {
diff --git a/frontend/src/app/shared/shared.module.ts b/frontend/src/app/shared/shared.module.ts
index aaab6e00c3f..f36664a9ba5 100644
--- a/frontend/src/app/shared/shared.module.ts
+++ b/frontend/src/app/shared/shared.module.ts
@@ -69,9 +69,10 @@ import { CopyToClipboardDirective } from './components/copy-to-clipboard/copy-to
import { OpDateTimeComponent } from './components/date/op-date-time.component';
import { ToastComponent } from './components/toaster/toast.component';
-import { OpSingleDateFormComponent } from './components/datepicker/single-date-form/single-date-form.component';
+import { OpWpSingleDateFormComponent } from './components/datepicker/wp-single-date-form/wp-single-date-form.component';
import { OpSingleDatePickerComponent } from './components/datepicker/single-date-picker/single-date-picker.component';
-import { OpMultiDateFormComponent } from 'core-app/shared/components/datepicker/multi-date-form/multi-date-form.component';
+import { OpMultiDatePickerComponent } from './components/datepicker/multi-date-picker/multi-date-picker.component';
+import { OpWpMultiDateFormComponent } from 'core-app/shared/components/datepicker/wp-multi-date-form/wp-multi-date-form.component';
import { OpDatePickerBannerComponent } from './components/datepicker/banner/datepicker-banner.component';
import { OpDatePickerWorkingDaysToggleComponent } from 'core-app/shared/components/datepicker/toggle/datepicker-working-days-toggle.component';
import { OpDatePickerSchedulingToggleComponent } from 'core-app/shared/components/datepicker/scheduling-mode/datepicker-scheduling-toggle.component';
@@ -203,10 +204,11 @@ export function bootstrapModule(injector:Injector):void {
ViewSelectComponent,
// Date pickers
- OpSingleDateFormComponent,
+ OpWpSingleDateFormComponent,
OpSingleDatePickerComponent,
+ OpMultiDatePickerComponent,
OpDatePickerBannerComponent,
- OpMultiDateFormComponent,
+ OpWpMultiDateFormComponent,
OpDatePickerWorkingDaysToggleComponent,
OpDatePickerSchedulingToggleComponent,
],
@@ -265,10 +267,11 @@ export function bootstrapModule(injector:Injector):void {
OpLoadingProjectListComponent,
// Date pickers
- OpSingleDateFormComponent,
+ OpWpSingleDateFormComponent,
OpSingleDatePickerComponent,
+ OpMultiDatePickerComponent,
OpDatePickerBannerComponent,
- OpMultiDateFormComponent,
+ OpWpMultiDateFormComponent,
OpDatePickerWorkingDaysToggleComponent,
OpDatePickerSchedulingToggleComponent,
],