2023-01-10 01:25:03 +01:00
|
|
|
import {Component, EventEmitter, Input, Output, ViewChild} from '@angular/core';
|
2019-12-03 13:50:39 +01:00
|
|
|
import {FormGroup} from '@angular/forms';
|
|
|
|
import {EnvProperties} from "../utils/properties/env-properties";
|
2022-02-24 17:42:05 +01:00
|
|
|
import {properties} from "../../../environments/environment";
|
2023-01-10 01:25:03 +01:00
|
|
|
import {RecaptchaComponent} from "ng-recaptcha";
|
2019-12-03 13:50:39 +01:00
|
|
|
|
|
|
|
@Component({
|
2020-06-23 22:50:46 +02:00
|
|
|
selector: 'contact-us',
|
2022-01-12 13:12:30 +01:00
|
|
|
templateUrl: './contact-us.component.html'
|
2019-12-03 13:50:39 +01:00
|
|
|
})
|
|
|
|
|
2021-04-08 17:23:41 +02:00
|
|
|
export class ContactUsComponent {
|
2022-02-24 17:42:05 +01:00
|
|
|
@Input() public contactForm: FormGroup;
|
|
|
|
@Input() public formTitle: string;
|
|
|
|
@Input() public organizationTypes: string[];
|
|
|
|
@Input() public buttonClass: string;
|
|
|
|
@Input() public sendButton: string = "Send";
|
|
|
|
@Input() public smallForm: boolean = false;
|
2022-03-01 20:09:14 +01:00
|
|
|
@Input() public scrollspy: boolean = false;
|
2022-02-24 17:42:05 +01:00
|
|
|
@Input() public sending: boolean = false;
|
2020-06-23 22:50:46 +02:00
|
|
|
@Output() sendEmitter: EventEmitter<any> = new EventEmitter<any>();
|
2023-01-10 01:25:03 +01:00
|
|
|
@ViewChild('captchaElem') captchaElem: RecaptchaComponent;
|
|
|
|
|
2022-02-24 17:42:05 +01:00
|
|
|
public properties: EnvProperties = properties;
|
2020-06-23 22:50:46 +02:00
|
|
|
|
|
|
|
public send() {
|
|
|
|
this.sendEmitter.emit({
|
|
|
|
valid: this.contactForm.valid
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
public handleRecaptcha(captchaResponse: string) {
|
|
|
|
this.contactForm.get('recaptcha').setValue(captchaResponse);
|
|
|
|
}
|
2023-01-10 01:25:03 +01:00
|
|
|
|
|
|
|
public resetRecaptcha() {
|
|
|
|
this.captchaElem.reset();
|
|
|
|
}
|
2019-12-03 13:50:39 +01:00
|
|
|
}
|