diff --git a/src/app/contact/contact.component.html b/src/app/contact/contact.component.html index 42d0218..f988ea4 100644 --- a/src/app/contact/contact.component.html +++ b/src/app/contact/contact.component.html @@ -6,10 +6,11 @@
-
+

Contact us and create your community profile

-
+ +
@@ -60,20 +61,26 @@
* Required fields
-
- +
+
OpenAIRE gives you the virtual environment and services designed for your community to:
-
    +
    • Create and Manage your community
    • Access, share and link together all your research
    • Monitor and report your community's progress
+ +
+ Our team will response to your submission soon.
+ You will be redirected to OpenAIRE Connect home page +
+
diff --git a/src/app/contact/contact.component.ts b/src/app/contact/contact.component.ts index 7b9724a..822ab2c 100644 --- a/src/app/contact/contact.component.ts +++ b/src/app/contact/contact.component.ts @@ -1,5 +1,5 @@ import {Component, OnInit, Input, ElementRef, ViewChild} from '@angular/core'; -import {FormGroup, FormBuilder, Validators} from '@angular/forms'; +import {FormGroup} from '@angular/forms'; import {ActivatedRoute, Router} from '@angular/router'; import {EmailService} from "../openaireLibrary/utils/email/email.service"; import {Email} from "../openaireLibrary/utils/email/email"; @@ -19,15 +19,13 @@ export class ContactComponent implements OnInit { public showLoading = true; public errorMessage = ''; - - public successfulSaveMessage = ''; - public isSubmitted = false; public email: Email; public note = ''; public properties: EnvProperties = null; public contactForm: ContactForm = new ContactForm(); + @ViewChild('AlertModal') modal; @ViewChild('name') name; @ViewChild('surname') surname; @ViewChild('sender') sender; @@ -61,26 +59,50 @@ export class ContactComponent implements OnInit { public send() { this.isSubmitted = true; if(!this.name.invalid && !this.surname.invalid && !this.sender.invalid && - !this.affiliation.invalid && !this.message.invalid && this.contactForm.recaptcha) { + !this.affiliation.invalid && !this.message.invalid && this.contactForm.recaptcha != '') { this.sendMail(this.properties.admins); } + else { + this.errorMessage = 'Please fill all the required fields!' + } } public reset() { this.contactForm = new ContactForm(); this.recaptcha.reset(); + this.isSubmitted = false; + this.errorMessage = ''; } private sendMail(admins: any) { this._emailService.contact(this.properties.adminToolsAPIURL + '/contact', Composer.composeEmailForNewCommunity(this.contactForm, admins), this.contactForm.recaptcha).subscribe( res => { - console.log(res) + if(res != null) { + this.modalOpen(); + this.reset(); + } + else { + this.handleError('Token has expired. Please complete the reCaptcha challenge again! ', null); + this.recaptcha.reset(); + } }, - error => console.log(error) + error => { + this.handleError('Email sent failed! Please try again.', error); + this.recaptcha.reset(); + } ); } + public modalOpen() { + this.modal.okButton = true; + this.modal.alertTitle = 'Your request has been successfully submitted'; + this.modal.alertMessage = false; + this.modal.cancelButton = false; + this.modal.okButtonLeft = false; + this.modal.okButtonText = 'Ok'; + this.modal.open(); + } public handleRecaptcha(captchaResponse: string) { this.contactForm.recaptcha = captchaResponse; @@ -94,4 +116,21 @@ export class ContactComponent implements OnInit { this.showLoading = false; } + getProductionPrefix():string{ + return (this.properties.environment == "beta")?"beta.":"" + } + + isProduction():boolean{ + return this.properties.environment!="development"; + + } + + public goToHome(data: any) { + if(this.isProduction()) { + window.location.hostname = 'https://'+ this.getProductionPrefix() + 'connect.openaire.eu'; + } else { + this._router.navigate(['/']); + } + } + } diff --git a/src/app/contact/contact.module.ts b/src/app/contact/contact.module.ts index 58415bc..3822235 100644 --- a/src/app/contact/contact.module.ts +++ b/src/app/contact/contact.module.ts @@ -7,12 +7,13 @@ import {ContactComponent} from './contact.component'; import {ContactRoutingModule} from "./contact-routing.module"; import {EmailService} from "../openaireLibrary/utils/email/email.service"; import {RecaptchaModule} from "ng-recaptcha"; +import {AlertModalModule} from "../openaireLibrary/utils/modal/alertModal.module"; @NgModule({ imports: [ ContactRoutingModule, CommonModule, FormsModule, RouterModule, - RecaptchaModule.forRoot() + AlertModalModule, RecaptchaModule.forRoot() ], declarations: [ ContactComponent diff --git a/src/app/searchPages/communities/searchCommunities.component.ts b/src/app/searchPages/communities/searchCommunities.component.ts index 7874a86..7de1f5d 100644 --- a/src/app/searchPages/communities/searchCommunities.component.ts +++ b/src/app/searchPages/communities/searchCommunities.component.ts @@ -215,14 +215,19 @@ export class SearchCommunitiesComponent { private checkFilters(params: Map) { let typeResults: SearchResult[] = []; let statusResults: SearchResult[] = []; + let roleResults: SearchResult[] = []; let types: string[] = []; let statuses: string[] = []; + let roles: string[] = []; if(params.get('type') != undefined) { types = (StringUtils.URIDecode(params.get('type'))).split(/,(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,-1); } if(params.get('status') != undefined) { statuses = (StringUtils.URIDecode(params.get('status'))).split(/,(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,-1); } + if(params.get('role') != undefined) { + roles = (StringUtils.URIDecode(params.get('role'))).split(/,(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,-1); + } for(let i = 0; i < this.results.length; i++) { if (types.length == 0) { typeResults.push(this.results[i]); @@ -235,8 +240,6 @@ export class SearchCommunitiesComponent { } } } - this.resetFilterNumbers('status'); - this.updateFilterNumbers(typeResults, 'status'); for(let i = 0; i < this.results.length; i++) { if( statuses.length == 0) { statusResults.push(this.results[i]); @@ -261,10 +264,37 @@ export class SearchCommunitiesComponent { } } } + for(let i = 0; i < this.results.length; i++) { + if (roles.length == 0) { + roleResults.push(this.results[i]); + } else { + for (let role of roles) { + if(role.replace(/["']/g, "") == 'manager') { + if (this.results[i].isManager) { + roleResults.push(this.results[i]); + break; + } + } + } + } + } + this.resetFilterNumbers('status'); + this.updateFilterNumbers(typeResults.filter(value => { + return roleResults.includes(value); + }), 'status'); this.resetFilterNumbers('type'); - this.updateFilterNumbers(statusResults, 'type'); + this.updateFilterNumbers(statusResults.filter(value => { + return roleResults.includes(value); + }), 'type'); + this.resetFilterNumbers('role'); + this.updateFilterNumbers(statusResults.filter(value => { + return typeResults.includes(value); + }), 'role'); this.results = statusResults.filter(value => { return typeResults.includes(value); + }) + this.results = this.results.filter(value => { + return roleResults.includes(value); }); } @@ -308,8 +338,10 @@ export class SearchCommunitiesComponent { } else { this.filters[i].values[1].number++; } + } + if (this.filters[i].filterId == 'role') { if (results[k].isManager) { - this.filters[i].values[2].number++; + this.filters[i].values[0].number++; } } break; @@ -382,8 +414,12 @@ export class SearchCommunitiesComponent { if(Session.isLoggedIn()) { filter_names[1] = "Status"; filter_ids[1] = "status"; - value_names[1] = [ "Subscribed", "Non-subscribed", "Managing" ]; - value_original_ids[1] = ["subscribed", "nonsubscribed", "managing"]; + value_names[1] = [ "Subscribed", "Non-subscribed"]; + value_original_ids[1] = ["subscribed", "nonsubscribed"]; + filter_names[2] = "Role"; + filter_ids[2] = "role"; + value_names[2] = [ "Manager" ]; + value_original_ids[2] = ["manager"]; } let filters: Filter[] = []; for(let i =0 ; i < filter_names.length; i++){ diff --git a/src/assets/env-properties.json b/src/assets/env-properties.json index f98330a..22fb49b 100644 --- a/src/assets/env-properties.json +++ b/src/assets/env-properties.json @@ -52,7 +52,7 @@ "cacheUrl" :"http://scoobydoo.di.uoa.gr:3000/get?url=", - "adminToolsAPIURL" :"http://scoobydoo.di.uoa.gr:8080/uoa-admin-tools", + "adminToolsAPIURL" :"http://mpagasas.di.uoa.gr:8080/uoa-admin-tools", "adminToolsCommunity" :"openaire", "datasourcesAPI": "https://beta.services.openaire.eu/openaire/ds/search/",