import {Component, OnInit, ViewEncapsulation} from '@angular/core'; import {FieldType} from '@ngx-formly/material'; import {AllService} from '../../../all.service'; import {ActivatedRoute, Router} from '@angular/router'; import {FormGroup} from '@angular/forms'; import {FormlyField, FormlyFieldConfig} from '@ngx-formly/core'; @Component({ selector: 'jhi-step-resiliation', templateUrl: './step-resiliation.component.html', styleUrls: ['./step-resiliation.component.scss'], encapsulation: ViewEncapsulation.None }) export class StepResiliationComponent extends FieldType implements OnInit { form = new FormGroup({}); fields: FormlyFieldConfig[] = [ { fieldGroup: [ { key: 'insured_resiliation_wanted', type: 'radioCustom', templateOptions: { label: '
' + '' + '(Envoi du courrier de résiliation en recommandé à votre banque, accompagnement, relances auprès de votre banque … Bénéficiez de notre expertise offerte !)
', required: true, autocomplete: false, options: [ { value: 'T', label: 'Oui' }, { value: 'F', label: 'Non' } ], change: (field) => { this.custom(field); console.log(this.model); } } } ] } ]; showModalResiliation = false; contractId = ''; constructor(public allService: AllService, private route: ActivatedRoute, private router: Router ) { super(); } ngOnInit(): void { super.ngOnInit(); this.contractId = this.route.snapshot.paramMap.get('contractid'); } nextStep() { this.allService.currentStepCustomError = false; this.allService.stepsSubject.next('next'); } custom(field: any): void { console.log('methode custom', field.formControl.value); if (field.formControl.value !== 'T') { this.showModalResiliation = true; } } gotToLoan(): void { this.router.navigate([`/loan/${this.contractId}`]); } }