RED-3179: Hide email notification options

This commit is contained in:
Adina Țeudan 2022-01-13 13:11:34 +02:00
parent fafc7edd43
commit bd3d5c6989
4 changed files with 73 additions and 68 deletions

View File

@ -1,43 +0,0 @@
export const NotificationCategories = {
inAppNotifications: 'inAppNotifications',
emailNotifications: 'emailNotifications',
} as const;
export const NotificationCategoriesValues = Object.values(NotificationCategories);
export const DossierNotificationsTypes = {
dossierOwnerSet: 'DOSSIER_OWNER_SET',
dossierOwnerRemoved: 'DOSSIER_OWNER_REMOVED',
userBecomseDossierMember: 'USER_BECOMES_DOSSIER_MEMBER',
userRemovedAsDossierMember: 'USER_REMOVED_AS_DOSSIER_MEMBER',
userPromotedToApprover: 'USER_PROMOTED_TO_APPROVER',
userDegradedToReviewer: 'USER_DEGRADED_TO_REVIEWER',
dossierOwnerDeleted: 'DOSSIER_OWNER_DELETED',
dossierDeleted: 'DOSSIER_DELETED',
} as const;
export const DossierNotificationsTypesValues = Object.values(DossierNotificationsTypes);
export const DocumentNotificationsTypes = {
assignReviewer: 'ASSIGN_REVIEWER',
assignApprover: 'ASSIGN_APPROVER',
unassignedFromFile: 'UNASSIGNED_FROM_FILE',
// documentUnderReview: 'DOCUMENT_UNDER_REVIEW',
// documentUnderApproval: 'DOCUMENT_UNDER_APPROVAL',
documentApproved: 'DOCUMENT_APPROVED',
} as const;
export const DocumentNotificationsTypesValues = Object.values(DocumentNotificationsTypes);
export const OtherNotificationsTypes = {
downloadReady: 'DOWNLOAD_READY',
} as const;
export const OtherNotificationsTypesValues = Object.values(OtherNotificationsTypes);
export const NotificationGroupsKeys = ['dossier', 'document', 'other'] as const;
export const NotificationGroupsValues = [
DossierNotificationsTypesValues,
DocumentNotificationsTypesValues,
OtherNotificationsTypesValues,
] as const;

View File

@ -7,25 +7,25 @@
}}</mat-slide-toggle>
</div>
<div class="options-content" *ngIf="isCategoryActive(category)">
<div class="radio-container" *ngIf="category === 'emailNotifications'">
<div class="radio-button" *ngFor="let type of emailNotificationScheduleTypes">
<iqser-round-checkbox [active]="getEmailNotificationType() === type" (click)="setEmailNotificationType(type)">
</iqser-round-checkbox>
<span> {{ translations[type.toLocaleLowerCase()] | translate }} </span>
</div>
</div>
<div *ngIf="isCategoryActive(category)" class="options-content">
<!-- <div class="radio-container" *ngIf="category === 'emailNotifications'">-->
<!-- <div class="radio-button" *ngFor="let type of emailNotificationScheduleTypes">-->
<!-- <iqser-round-checkbox [active]="getEmailNotificationType() === type" (click)="setEmailNotificationType(type)">-->
<!-- </iqser-round-checkbox>-->
<!-- <span> {{ translations[type.toLocaleLowerCase()] | translate }} </span>-->
<!-- </div>-->
<!-- </div>-->
<div class="statement" translate="notifications-screen.options-title"></div>
<div class="group" *ngFor="let key of notificationGroupsKeys; let i = index">
<div class="group-title" [translate]="translations[key]"></div>
<div *ngFor="let key of notificationGroupsKeys; let i = index" class="group">
<div [translate]="translations[key]" class="group-title"></div>
<div class="iqser-input-group">
<mat-checkbox
*ngFor="let preference of notificationGroupsValues[i]"
color="primary"
[checked]="isPreferenceChecked(category, preference)"
(change)="addRemovePreference($event.checked, category, preference)"
*ngFor="let preference of notificationGroupsValues[i]"
[checked]="isPreferenceChecked(category, preference)"
color="primary"
>
{{ translations[preference] | translate }}
</mat-checkbox>

View File

@ -4,8 +4,12 @@ import { notificationsTranslations } from '../../../translations/notifications-t
import { NotificationPreferencesService } from '../../../services/notification-preferences.service';
import { LoadingService, Toaster } from '@iqser/common-ui';
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
import { NotificationCategoriesValues, NotificationGroupsKeys, NotificationGroupsValues } from '../constants';
import { EmailNotificationScheduleTypesValues } from '@red/domain';
import {
EmailNotificationScheduleTypesValues,
NotificationCategoriesValues,
NotificationGroupsKeys,
NotificationGroupsValues,
} from '@red/domain';
@Component({
selector: 'redaction-notifications-screen',
@ -33,16 +37,6 @@ export class NotificationsScreenComponent implements OnInit {
await this._initializeForm();
}
private _getForm(): FormGroup {
return this._formBuilder.group({
inAppNotificationsEnabled: [undefined],
emailNotificationsEnabled: [undefined],
emailNotificationType: [undefined],
emailNotifications: [undefined],
inAppNotifications: [undefined],
});
}
isCategoryActive(category: string) {
return this.formGroup.get(`${category}Enabled`).value;
}
@ -80,6 +74,16 @@ export class NotificationsScreenComponent implements OnInit {
this._loadingService.stop();
}
private _getForm(): FormGroup {
return this._formBuilder.group({
inAppNotificationsEnabled: [undefined],
emailNotificationsEnabled: [undefined],
emailNotificationType: [undefined],
emailNotifications: [undefined],
inAppNotifications: [undefined],
});
}
private async _initializeForm() {
this._loadingService.start();

View File

@ -6,3 +6,47 @@ export const EmailNotificationScheduleTypes = {
export type EmailNotificationScheduleType = keyof typeof EmailNotificationScheduleTypes;
export const EmailNotificationScheduleTypesValues = Object.values(EmailNotificationScheduleTypes);
export const NotificationCategories = {
inAppNotifications: 'inAppNotifications',
// emailNotifications: 'emailNotifications',
} as const;
export const NotificationCategoriesValues = Object.values(NotificationCategories);
export const DossierNotificationsTypes = {
dossierOwnerSet: 'DOSSIER_OWNER_SET',
dossierOwnerRemoved: 'DOSSIER_OWNER_REMOVED',
userBecomseDossierMember: 'USER_BECOMES_DOSSIER_MEMBER',
userRemovedAsDossierMember: 'USER_REMOVED_AS_DOSSIER_MEMBER',
userPromotedToApprover: 'USER_PROMOTED_TO_APPROVER',
userDegradedToReviewer: 'USER_DEGRADED_TO_REVIEWER',
dossierOwnerDeleted: 'DOSSIER_OWNER_DELETED',
dossierDeleted: 'DOSSIER_DELETED',
} as const;
export const DossierNotificationsTypesValues = Object.values(DossierNotificationsTypes);
export const DocumentNotificationsTypes = {
assignReviewer: 'ASSIGN_REVIEWER',
assignApprover: 'ASSIGN_APPROVER',
unassignedFromFile: 'UNASSIGNED_FROM_FILE',
// documentUnderReview: 'DOCUMENT_UNDER_REVIEW',
// documentUnderApproval: 'DOCUMENT_UNDER_APPROVAL',
documentApproved: 'DOCUMENT_APPROVED',
} as const;
export const DocumentNotificationsTypesValues = Object.values(DocumentNotificationsTypes);
export const OtherNotificationsTypes = {
downloadReady: 'DOWNLOAD_READY',
} as const;
export const OtherNotificationsTypesValues = Object.values(OtherNotificationsTypes);
export const NotificationGroupsKeys = ['dossier', 'document', 'other'] as const;
export const NotificationGroupsValues = [
DossierNotificationsTypesValues,
DocumentNotificationsTypesValues,
OtherNotificationsTypesValues,
] as const;