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

[#43681] Include date alerts in notification settings

Dmitrii95a4f1262beb
diff --git a/frontend/src/app/features/user-preferences/notifications-settings/page/notifications-settings-page.component.html b/frontend/src/app/features/user-preferences/notifications-settings/page/notifications-settings-page.component.html
index 2050296641d..ccb3d666541 100644
--- a/frontend/src/app/features/user-preferences/notifications-settings/page/notifications-settings-page.component.html
+++ b/frontend/src/app/features/user-preferences/notifications-settings/page/notifications-settings-page.component.html
@@ -53,8 +53,81 @@
/>
</spot-selector-field>
- <h5>{{text.dateAlerts.title}}</h5>
- <p>{{text.dateAlerts.description}}</p>
+ <h5>Date alerts</h5>
+ <div class="op-reminder-settings-daily-time--row">
+ <input
+ type="checkbox"
+ [ngModel]="isActive('startDate')"
+ [ngModelOptions]="{standalone: true}"
+ class="op-reminder-settings-daily-time--active"
+ attr.data-qa-selector="op-settings-start-date">
+ <label
+ class="op-reminder-settings-daily-time--label"
+ [textContent]="text.startDate"
+ attr.for="op-reminder-settings-daily-time">
+ </label>
+ <select
+ (ngModelChange)="changeTime($event, 'startDate')"
+ class="op-reminder-settings-daily-time--time form--select -narrow"
+ attr.id="op-reminder-settings-daily-time"
+ required="true">
+ <option
+ *ngFor="let availableTime of availableTimes"
+ [value]="availableTime">
+ {{availableTime}}
+ </option>
+ </select>
+ </div>
+
+ <div class="op-reminder-settings-daily-time--row">
+ <input
+ type="checkbox"
+ [ngModel]="isActive('dueDate')"
+ [ngModelOptions]="{standalone: true}"
+ class="op-reminder-settings-daily-time--active"
+ attr.data-qa-selector="op-settings-start-date">
+ <label
+ class="op-reminder-settings-daily-time--label"
+ [textContent]="text.dueDate"
+ attr.for="op-reminder-settings-daily-time">
+ </label>
+ <select
+ (ngModelChange)="changeTime($event, 'dueDate')"
+ class="op-reminder-settings-daily-time--time form--select -narrow"
+ attr.id="op-reminder-settings-daily-time"
+ required="true">
+ <option
+ *ngFor="let availableTime of availableTimes"
+ [value]="availableTime">
+ {{availableTime}}
+ </option>
+ </select>
+ </div>
+
+ <div class="op-reminder-settings-daily-time--row">
+ <input
+ type="checkbox"
+ [ngModel]="isActive('overdue')"
+ [ngModelOptions]="{standalone: true}"
+ class="op-reminder-settings-daily-time--active"
+ attr.data-qa-selector="op-settings-start-date">
+ <label
+ class="op-reminder-settings-daily-time--label"
+ [textContent]="text.overdue"
+ attr.for="op-reminder-settings-daily-time">
+ </label>
+ <select
+ (ngModelChange)="changeTime($event, 'overdue')"
+ class="op-reminder-settings-daily-time--time form--select -narrow"
+ attr.id="op-reminder-settings-daily-time"
+ required="true">
+ <option
+ *ngFor="let availableTime of availableTimesOverdue"
+ [value]="availableTime">
+ {{availableTime}}
+ </option>
+ </select>
+ </div>
<h5>{{ text.alsoNotifyFor.title }}</h5>
<p>{{ text.alsoNotifyFor.description }}</p>
diff --git a/frontend/src/app/features/user-preferences/notifications-settings/page/notifications-settings-page.component.sass b/frontend/src/app/features/user-preferences/notifications-settings/page/notifications-settings-page.component.sass
new file mode 100644
index 00000000000..5b5928e358d
--- /dev/null
+++ b/frontend/src/app/features/user-preferences/notifications-settings/page/notifications-settings-page.component.sass
@@ -0,0 +1,22 @@
+@import "helpers"
+
+.op-reminder-settings-daily-time
+ &--enable
+ display: flex
+ align-items: center
+ margin-top: 30px
+ margin-bottom: 10px
+
+ &--row
+ line-height: 45px
+ display: flex
+ align-items: center
+
+ &--label
+ flex: 0 0 100px
+ margin-bottom: 0
+ @include text-shortener
+
+ &--time
+ height: 32px
+ width: 150px
diff --git a/frontend/src/app/features/user-preferences/notifications-settings/page/notifications-settings-page.component.ts b/frontend/src/app/features/user-preferences/notifications-settings/page/notifications-settings-page.component.ts
index d27961477fd..a650534ae3c 100644
--- a/frontend/src/app/features/user-preferences/notifications-settings/page/notifications-settings-page.component.ts
+++ b/frontend/src/app/features/user-preferences/notifications-settings/page/notifications-settings-page.component.ts
@@ -44,6 +44,7 @@ interface IFullNotificationSettingsValue extends IToastSettingsValue {
@Component({
selector: myNotificationsPageComponentSelector,
templateUrl: './notifications-settings-page.component.html',
+ styleUrls: ['./notifications-settings-page.component.sass'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class NotificationsSettingsPageComponent extends UntilDestroyedMixin implements OnInit {
@@ -57,9 +58,15 @@ export class NotificationsSettingsPageComponent extends UntilDestroyedMixin impl
workPackageScheduled: new FormControl(false),
workPackagePrioritized: new FormControl(false),
workPackageCommented: new FormControl(false),
+ startDate: new FormControl(null),
+ dueDate: new FormControl(null),
+ overdue: new FormControl(null),
projectSettings: new FormArray([]),
});
+ public availableTimes:string[] = ['PT0S', 'P1D', 'P3D', 'P1W'];
+ public availableTimesOverdue:string[] = ['PT0S', 'P3D', 'P1W'];
+
text = {
notifyImmediately: {
title: this.I18n.t('js.notifications.settings.global.immediately.title'),
@@ -90,6 +97,9 @@ export class NotificationsSettingsPageComponent extends UntilDestroyedMixin impl
},
assignee: this.I18n.t('js.notifications.settings.reasons.assignee'),
responsible: this.I18n.t('js.notifications.settings.reasons.responsible'),
+ startDate: 'Start Date',
+ dueDate: 'Finish Date',
+ overdue: 'When Overdue',
};
constructor(
@@ -127,6 +137,9 @@ export class NotificationsSettingsPageComponent extends UntilDestroyedMixin impl
this.form.get('workPackageScheduled')?.setValue(settings.workPackageScheduled);
this.form.get('workPackagePrioritized')?.setValue(settings.workPackagePrioritized);
this.form.get('workPackageCommented')?.setValue(settings.workPackageCommented);
+ this.form.get('startDate')?.setValue(settings.startDate);
+ this.form.get('dueDate')?.setValue(settings.dueDate);
+ this.form.get('overdue')?.setValue(settings.overdue);
});
this.storeService.query.projectNotifications$
@@ -158,7 +171,17 @@ export class NotificationsSettingsPageComponent extends UntilDestroyedMixin impl
});
}
+ isActive(attributeName:string):boolean {
+ return (this.form.get(attributeName)!.value || '').length > 0;
+ }
+
+ changeTime(newTime:string, attributeName:string):void {
+ // console.log(newTime)
+ this.form.get(attributeName)?.setValue(newTime);
+ }
+
public saveChanges():void {
+ // debugger
const prefs = this.storeService.store.getValue();
const notificationSettings = (this.form.value as IFullNotificationSettingsValue);
const globalNotification = prefs.notifications.find((notification) => !notification._links.project.href) as INotificationSetting;