[develop]: Add note in personal-info form. Send email on first save of personal info

This commit is contained in:
Konstantinos Triantafyllou 2024-04-30 17:10:29 +03:00
parent afe4f2ef0e
commit 3db55600ae
4 changed files with 36 additions and 10 deletions

@ -1 +1 @@
Subproject commit 267944103f6f06ced39bb37e4c70d1834b742601
Subproject commit b41357c4b84b986277b839ff041ae215d380f90f

View File

@ -6,6 +6,10 @@ import {User} from "../openaireLibrary/login/utils/helper.class";
import {PersonalInfo, PersonalService} from "../services/personal.service";
import {NotificationHandler} from "../openaireLibrary/utils/notification-handler";
import {NavigationEnd, Router} from "@angular/router";
import {EmailService} from "../openaireLibrary/utils/email/email.service";
import {Email} from "../openaireLibrary/utils/email/email";
import {properties} from "../../environments/environment";
import {Composer} from "../openaireLibrary/utils/email/composer";
@Component({
selector: `personal-form`,
@ -35,6 +39,9 @@ import {NavigationEnd, Router} from "@angular/router";
<div class="uk-width-1-2@m uk-width-1-1" input [formInput]="form.get('position')"
[placeholder]="'Position'"></div>
</div>
<div class="uk-margin-top uk-text-small uk-text-italic">
Please note that by submitting your information in this form, you agree to be added to the Graph client mailing list. This will ensure you stay updated with relevant news. If you wish to opt-out, you can do so at any time by contacting the list admins at <a href="mailto:gbikas@openaire.eu">gbikas@openaire.eu</a> and <a href="mailto:stefania.amodeo@openaire.eu">stefania.amodeo@openaire.eu</a>.
</div>
<div class="uk-flex uk-flex-right@l uk-flex-center uk-margin-medium-top">
<a class="uk-button uk-button-default uk-margin-small-right" routerLink="/">Cancel</a>
<button class="uk-button uk-button-primary" [disabled]="form.pristine || form.invalid || form.disabled"
@ -59,6 +66,7 @@ export class PersonalInfoComponent implements OnInit, OnDestroy {
constructor(private fb: FormBuilder,
private personalService: PersonalService,
private userManagementService: UserManagementService,
private emailService: EmailService,
private router: Router) {
this.subscriptions.push(this.router.events.subscribe(event => {
if(event instanceof NavigationEnd) {
@ -113,6 +121,7 @@ export class PersonalInfoComponent implements OnInit, OnDestroy {
save() {
this.loading = true;
this.subscriptions.push(this.personalService.savePersonalInfo(this.form.getRawValue()).subscribe(info => {
let callback = (info: PersonalInfo) => {
this.info = info;
NotificationHandler.rise('Your personal info has been saved successfully.');
this.initForm();
@ -121,6 +130,12 @@ export class PersonalInfoComponent implements OnInit, OnDestroy {
if (this.redirect) {
this.router.navigate([this.redirect]);
}
}
if(!this.info) {
this.sendEmail(callback, info);
} else {
callback(info);
}
}, error => {
console.error(error);
NotificationHandler.rise('An error has occurred. Please try again later.', 'danger');
@ -136,4 +151,15 @@ export class PersonalInfoComponent implements OnInit, OnDestroy {
}
})
}
sendEmail(callback: (info: PersonalInfo) => void, info: PersonalInfo) {
let email = Composer.composeEmailForDevelopPersonalInfo(this.user);
this.emailService.sendEmail(properties, email).subscribe( (res) => {
callback(info);
this.loading = false;
}, error => {
NotificationHandler.rise('An error has occurred. Please try again later!', 'danger');
this.loading = false;
})
}
}

@ -1 +1 @@
Subproject commit 4d41ba373dfb2dfd09ada4061bb1450dadb96993
Subproject commit e48bf941bcdc567a3d09826b5686e70d43fafd46

@ -1 +1 @@
Subproject commit 860bd52a5f4becb94f5c3bf2bee9ae5944513b7a
Subproject commit fe10d2e9195fdebf3d906f28abbb072f3617c4ee