1. mailPrefs.component.html: change look & feel of on/off buttons | when off is selected, show 'how often' disabled | move 'save' button on the left of 'reset'.

2. mailPrefs.component.ts: bug fix for community notifications.


git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@53453 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
konstantina.galouni 2018-10-15 09:51:01 +00:00
parent f81e2dc987
commit bd2957074e
2 changed files with 20 additions and 7 deletions

View File

@ -3,7 +3,7 @@
<div class="tm-main uk-width-1-1@s uk-width-1-1@m uk-width-1-1@l uk-row-first">
<div class="uk-container uk-margin-top">
<div class="uk-article-title custom-article-title">
User Email Preferences
User Email Preferences for Claims Notifications
</div>
<div *ngIf="userValidMessage.length > 0 " class = "uk-alert uk-alert-danger " >
@ -21,17 +21,27 @@
<!--[ngClass]="{'has-error':!myForm.controls.notify.valid && myForm.controls.notify.dirty}"-->
<div class="uk-margin">
<div class="uk-form-label">Do you want to receive e-mail notifications?</div>
<div class="uk-form-controls uk-form-controls-text">
<!-- <div class="uk-form-controls uk-form-controls-text">
<label>Yes <input class="uk-radio" type="radio" name="radio2" [checked]="notification.notify" (click)="changeNotify(notification, true)"></label>
<label>No <input class="uk-radio" type="radio" name="radio2" [checked]="!notification.notify" (click)="changeNotify(notification, false)"></label>
</div> -->
<div class="uk-form-controls uk-form-controls-text" data-uk-button-group>
<button *ngIf="notification.notify" class="uk-button uk-button-primary uk-button-small"
data-uk-button>ON</button>
<button *ngIf="!notification.notify" class="uk-button-default uk-button-small"
(click)="changeNotify(notification, true)" data-uk-button>ON</button>
<button *ngIf="!notification.notify" class="uk-button uk-button-danger uk-button-small"
data-uk-button>OFF</button>
<button *ngIf="notification.notify" class="uk-button-default uk-button-small"
(click)="changeNotify(notification, false)" data-uk-button>OFF</button>
</div>
</div>
<!-- [ngClass]="{'has-error':!myForm.controls.frequency.valid && myForm.controls.frequency.dirty}" -->
<div class="uk-margin" *ngIf="notification.notify">
<label class="uk-form-label" for="form-horizontal-select">How often?</label>
<div [class]="notification.notify ? 'uk-margin' : 'uk-margin cursor-not-allowed'">
<div class="uk-form-label" >How often?</div>
<div class="uk-form-controls">
<select class="uk-select" id="form-horizontal-select" class="uk-select" [(ngModel)]="notification.frequency" name="select_frequency">
<select [class]="notification.notify ? 'uk-select' : 'uk-select uk-disabled'" id="form-horizontal-select" class="uk-select" [(ngModel)]="notification.frequency" name="select_frequency">
<option [ngValue]="24" >Daily</option>
<option [ngValue]="48" >Every two days</option>
<option [ngValue]="168">Weekly</option>
@ -41,8 +51,8 @@
</div>
<div class="uk-float-right">
<button type="submit" class="uk-button" (click)="restoreNotification(notifications, i)">Reset</button>
<button type="submit" class="uk-button uk-button-primary" (click)="saveNotification(notifications, i)">Save Changes</button>
<button type="submit" class="uk-button" (click)="restoreNotification(notifications, i)">Reset</button>
</div>
<!-- <span class="uk-margin">
<button class="uk-width-1-1 uk-button uk-button-primary uk-button-small" type="submit" (click)="saveNotification(notifications, i)">Save</button>

View File

@ -77,7 +77,7 @@ export class MailPrefsComponent {
this.status = this.errorCodes.NONE;
} else {
this.initialNotifications = data.data;
this.notifications = this.initialNotifications;
this.notifications = JSON.parse(JSON.stringify( this.initialNotifications ));
this.status = this.errorCodes.DONE;
}
@ -160,7 +160,10 @@ export class MailPrefsComponent {
}
restoreNotification(notifications: any, index: number) {
console.info("Restore Notification");
console.info(this.notifications[index]);
this.notifications[index] = JSON.parse(JSON.stringify( this.initialNotifications[index] ));
console.info(this.initialNotifications[index]);
}
ngOnDestroy() {