diff --git a/contact-us/contact-us.component.ts b/contact-us/contact-us.component.ts
index 9b99d7c6..bf5c3eb4 100644
--- a/contact-us/contact-us.component.ts
+++ b/contact-us/contact-us.component.ts
@@ -1,33 +1,49 @@
import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
import {FormGroup} from '@angular/forms';
import {EnvProperties} from "../utils/properties/env-properties";
+import {Option} from "../dashboard/sharedComponents/input/input.component";
+import {Observable} from "rxjs";
+import {map, startWith} from "rxjs/operators";
@Component({
- selector: 'contact-us',
- templateUrl: './contact-us.component.html',
+ selector: 'contact-us',
+ templateUrl: './contact-us.component.html',
})
export class ContactUsComponent implements OnInit {
- @Input()
- public contactForm: FormGroup;
- @Input() formTitle: string;
- @Input() properties: EnvProperties;
- @Output() sendEmitter: EventEmitter
= new EventEmitter();
- @Input() errorMessage;
-
- constructor() {
- }
-
- ngOnInit() {
- }
-
- public send() {
- this.sendEmitter.emit({
- valid: this.contactForm.valid
- });
- }
-
- public handleRecaptcha(captchaResponse: string) {
- this.contactForm.get('recaptcha').setValue(captchaResponse);
- }
+ @Input()
+ public contactForm: FormGroup;
+ @Input() formTitle: string;
+ @Input() properties: EnvProperties;
+ @Output() sendEmitter: EventEmitter = new EventEmitter();
+ @Input() errorMessage;
+ @Input()
+ public organizationTypes: string[];
+ public autoCompleteTypes: Observable;
+
+ constructor() {
+ }
+
+ ngOnInit() {
+ this.autoCompleteTypes = this.contactForm.get('organizationType').valueChanges
+ .pipe(
+ startWith(''),
+ map(value => this._filter(value))
+ );
+ }
+
+ private _filter(value: string): string[] {
+ const filterValue = value.toLowerCase();
+ return this.organizationTypes.filter(option => option.toLowerCase().includes(filterValue));
+ }
+
+ public send() {
+ this.sendEmitter.emit({
+ valid: this.contactForm.valid
+ });
+ }
+
+ public handleRecaptcha(captchaResponse: string) {
+ this.contactForm.get('recaptcha').setValue(captchaResponse);
+ }
}
diff --git a/contact-us/contact-us.module.ts b/contact-us/contact-us.module.ts
index 1573b7f4..e80b8c22 100644
--- a/contact-us/contact-us.module.ts
+++ b/contact-us/contact-us.module.ts
@@ -5,11 +5,12 @@ import {RouterModule} from '@angular/router';
import {ContactUsComponent} from './contact-us.component';
import {RecaptchaModule} from "ng-recaptcha";
import {ReactiveFormsModule} from "@angular/forms";
+import {MatAutocompleteModule} from "@angular/material/autocomplete";
@NgModule({
- imports: [
- CommonModule, RouterModule,
- RecaptchaModule.forRoot(), ReactiveFormsModule],
+ imports: [
+ CommonModule, RouterModule,
+ RecaptchaModule.forRoot(), ReactiveFormsModule, MatAutocompleteModule],
declarations: [
ContactUsComponent
],
diff --git a/utils/email/composer.ts b/utils/email/composer.ts
index 8ae0ed73..68d20862 100644
--- a/utils/email/composer.ts
+++ b/utils/email/composer.ts
@@ -65,7 +65,7 @@ export class Composer {
return email;
}
- public static composeEmailForNewStakeholder(contactForm: any, admins: any): Email {
+ public static composeEmailForMonitor(contactForm: any, admins: any): Email {
let email: Email = new Email();
email.subject = "OpenAIRE Monitor | " + contactForm.subject;
@@ -73,8 +73,8 @@ export class Composer {
+ "Name: " + contactForm.name + "
"
+ "Surname: " + contactForm.surname + "
"
+ "Email: " + contactForm.email + "
"
- + "Affiliation: " + contactForm.affiliation + "
"
- + "Stakeholder Name: " + contactForm.stakeholder + ""
+ + "Job Title: " + contactForm.job + "
"
+ + "Organization: " + contactForm.organization + " (" + contactForm.organizationType + " )"
+ "" + contactForm.message + "
"
+ "