From e808c7e26bb8e259de8531794292f1e903913f4c Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Tue, 19 Apr 2022 16:07:21 +0300 Subject: [PATCH] Update feedback page and fix a bug with events --- .../dataProvider/dataProvider.component.html | 2 +- landingPages/feedback/feedback.component.html | 81 ++++++++++--------- landingPages/feedback/feedback.component.ts | 32 ++++---- landingPages/feedback/feedback.module.ts | 4 +- .../organization/organization.component.html | 2 +- landingPages/project/project.component.html | 2 +- sharedComponents/bottom.component.ts | 28 +++---- 7 files changed, 79 insertions(+), 72 deletions(-) diff --git a/landingPages/dataProvider/dataProvider.component.html b/landingPages/dataProvider/dataProvider.component.html index fdf6aaac..2313c7ab 100644 --- a/landingPages/dataProvider/dataProvider.component.html +++ b/landingPages/dataProvider/dataProvider.component.html @@ -433,5 +433,5 @@ + [(showForm)]="showFeedback"> diff --git a/landingPages/feedback/feedback.component.html b/landingPages/feedback/feedback.component.html index c9b5a65b..38e3e0bd 100644 --- a/landingPages/feedback/feedback.component.html +++ b/landingPages/feedback/feedback.component.html @@ -1,8 +1,11 @@ -
-
+
+
- Back -

Report issues in...

+ +

Report issues in...

- -
-
-
- Issue #{{i + 1}} - Remove -
-
- - {{field}} - - +
+ +
+
+
+
Issue #{{i + 1}}
+ +
+
+
+
+
+
-
- - - Report issue for another field - -
-
-
-
-
Please leave us your E-mail to notify you about the reporting status.
- -
-
- - -
-
-
- +
+
+
+ Please leave us your E-mail to notify you about the reporting status. +
+
+ + +
+
+ +
+
diff --git a/landingPages/feedback/feedback.component.ts b/landingPages/feedback/feedback.component.ts index 85216ba3..54a40930 100644 --- a/landingPages/feedback/feedback.component.ts +++ b/landingPages/feedback/feedback.component.ts @@ -29,6 +29,7 @@ export class FeedbackComponent implements OnInit, OnChanges { @ViewChild('feedback') feedback: ElementRef; @ViewChild('backModal') backModal: AlertModal; @Input() showForm: boolean = false; + @Output() showFormChange: EventEmitter = new EventEmitter(); @Input() resultLandingInfo: ResultLandingInfo = null; @Input() organizationInfo: OrganizationInfo = null; @Input() projectInfo: ProjectInfo = null; @@ -37,7 +38,6 @@ export class FeedbackComponent implements OnInit, OnChanges { @Input() properties: EnvProperties = null; @Input() entityType: string = null; @Input() fields: string[] = []; - @Output() show: EventEmitter = new EventEmitter(); public sending: boolean = false; public sent: boolean = false; @@ -45,10 +45,12 @@ export class FeedbackComponent implements OnInit, OnChanges { public form: FormGroup; public url: string = null; public recipients: string[] = []; - subscriptions =[]; + subscriptions = []; + constructor(private fb: FormBuilder, private emailService: EmailService) { } + ngOnDestroy() { this.subscriptions.forEach(subscription => { if (subscription instanceof Subscriber) { @@ -56,15 +58,16 @@ export class FeedbackComponent implements OnInit, OnChanges { } }); } + ngOnInit(): void { - if(typeof window !== "undefined") { - this.url = window.location.href; + if (typeof window !== "undefined") { + this.url = window.location.href; } - if(this.resultLandingInfo) { + if (this.resultLandingInfo) { this.title = this.resultLandingInfo.title; - } else if(this.organizationInfo) { + } else if (this.organizationInfo) { this.title = this.organizationInfo.title.name; - } else if(this.dataProviderInfo) { + } else if (this.dataProviderInfo) { this.title = this.dataProviderInfo.title.name; } this.recipients = [this.properties.feedbackmail]; @@ -72,7 +75,8 @@ export class FeedbackComponent implements OnInit, OnChanges { } ngOnChanges(changes: SimpleChanges): void { - if(changes.showForm) { + if (changes.showForm) { + console.log(changes); this.init(); } } @@ -106,7 +110,7 @@ export class FeedbackComponent implements OnInit, OnChanges { } changeShowForm(value: boolean) { - this.show.emit(value); + this.showFormChange.emit(value); HelperFunctions.scroll(); } @@ -127,13 +131,13 @@ export class FeedbackComponent implements OnInit, OnChanges { this.subscriptions.push(this.emailService.contact(this.properties, Composer.composeEmailForFeedback(this.form.value, this.recipients), this.form.get('recaptcha').value).subscribe(sent => { this.error = !sent; - if(sent) { - if(this.form.get('email').value !== '') { + if (sent) { + if (this.form.get('email').value !== '') { this.subscriptions.push(this.emailService.contact(this.properties, Composer.composeEmailForUserAfterFeedback([this.form.get('email').value])).subscribe(sent => { - if(sent) { - //console.log('An email has been sent to user ' + this.form.get('email').value); - } + if (sent) { + //console.log('An email has been sent to user ' + this.form.get('email').value); + } })); } this.init(); diff --git a/landingPages/feedback/feedback.module.ts b/landingPages/feedback/feedback.module.ts index 4e485c2b..23ba3680 100644 --- a/landingPages/feedback/feedback.module.ts +++ b/landingPages/feedback/feedback.module.ts @@ -7,9 +7,11 @@ import {MatSelectModule} from "@angular/material/select"; import {AlertModalModule} from "../../utils/modal/alertModal.module"; import {EmailService} from "../../utils/email/email.service"; import {RecaptchaModule} from "ng-recaptcha"; +import {IconsModule} from "../../utils/icons/icons.module"; +import {InputModule} from "../../sharedComponents/input/input.module"; @NgModule({ - imports: [CommonModule, LandingHeaderModule, ReactiveFormsModule, MatSelectModule, AlertModalModule, RecaptchaModule], + imports: [CommonModule, LandingHeaderModule, ReactiveFormsModule, MatSelectModule, AlertModalModule, RecaptchaModule, IconsModule, InputModule], declarations: [FeedbackComponent], providers: [EmailService], exports: [FeedbackComponent] diff --git a/landingPages/organization/organization.component.html b/landingPages/organization/organization.component.html index 1315c818..ccbf2b02 100644 --- a/landingPages/organization/organization.component.html +++ b/landingPages/organization/organization.component.html @@ -273,7 +273,7 @@
+ [(showForm)]="showFeedback">
+ [(showForm)]="showFeedback">
diff --git a/sharedComponents/bottom.component.ts b/sharedComponents/bottom.component.ts index 8e751c22..d810b9e6 100644 --- a/sharedComponents/bottom.component.ts +++ b/sharedComponents/bottom.component.ts @@ -31,7 +31,7 @@ showPage ={}; @Input() darkBackground:boolean=true; @Input() centered:boolean=false; @Input() shortView: boolean = false; -sectionClass= ""; +sectionClass= "uk-tile-default"; subs: Subscription[] = []; public divContents = null; @@ -47,22 +47,22 @@ constructor(private config: ConfigurationService, private route: ActivatedRoute if(!this.darkBackground){ this.sectionClass= " footer-light-background"; } - this.subs.push(this.route.queryParams.subscribe(params => { - if(this.showMenuItems){ - if( this.properties.adminToolsAPIURL && this.communityId ){ - //this.subs.push(this.config.getCommunityInformation(this.properties, this.communityId ).subscribe(data => { - this.subs.push(this.config.communityInformationState.subscribe(data => { - if(data) { - for (var i = 0; i < data['pages'].length; i++) { - this.showPage[data['pages'][i]["route"]] = data['pages'][i]["isEnabled"]; + this.subs.push(this.route.queryParams.subscribe(params => { + if(this.showMenuItems){ + if( this.properties.adminToolsAPIURL && this.communityId ){ + //this.subs.push(this.config.getCommunityInformation(this.properties, this.communityId ).subscribe(data => { + this.subs.push(this.config.communityInformationState.subscribe(data => { + if(data) { + for (var i = 0; i < data['pages'].length; i++) { + this.showPage[data['pages'][i]["route"]] = data['pages'][i]["isEnabled"]; - } - // console.log(this.showPage) } - })); - } + // console.log(this.showPage) + } + })); } - })); + } + })); } public ngOnDestroy() {