]>
Commit | Line | Data |
---|---|---|
40360c17 K |
1 | import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core' |
2 | import { FormGroup } from '@angular/forms' | |
5c5bcea2 C |
3 | import { USER_TERMS_VALIDATOR } from '@app/shared/form-validators/user-validators' |
4 | import { FormReactive, FormReactiveService } from '@app/shared/shared-forms' | |
40360c17 K |
5 | |
6 | @Component({ | |
7 | selector: 'my-register-step-terms', | |
8 | templateUrl: './register-step-terms.component.html', | |
6f03f944 | 9 | styleUrls: [ './step.component.scss' ] |
40360c17 K |
10 | }) |
11 | export class RegisterStepTermsComponent extends FormReactive implements OnInit { | |
12 | @Input() hasCodeOfConduct = false | |
1f256e7d | 13 | @Input() minimumAge = 16 |
40360c17 K |
14 | |
15 | @Output() formBuilt = new EventEmitter<FormGroup>() | |
16 | @Output() termsClick = new EventEmitter<void>() | |
17 | @Output() codeOfConductClick = new EventEmitter<void>() | |
18 | ||
19 | constructor ( | |
5c5bcea2 | 20 | protected formReactiveService: FormReactiveService |
40360c17 K |
21 | ) { |
22 | super() | |
23 | } | |
24 | ||
25 | get instanceHost () { | |
26 | return window.location.host | |
27 | } | |
28 | ||
29 | ngOnInit () { | |
30 | this.buildForm({ | |
31 | terms: USER_TERMS_VALIDATOR | |
32 | }) | |
33 | ||
34 | setTimeout(() => this.formBuilt.emit(this.form)) | |
35 | } | |
36 | ||
37 | onTermsClick (event: Event) { | |
38 | event.preventDefault() | |
39 | this.termsClick.emit() | |
40 | } | |
41 | ||
42 | onCodeOfConductClick (event: Event) { | |
43 | event.preventDefault() | |
44 | this.codeOfConductClick.emit() | |
45 | } | |
46 | } |