import {Component, OnInit} from '@angular/core'; import {FieldType} from '@ngx-formly/material'; import {AllService} from "../../../all.service"; import {ActivatedRoute} from "@angular/router"; import {faCheck} from '@fortawesome/free-solid-svg-icons'; @Component({ selector: 'jhi-step-finalisation-bpa', templateUrl: './step-finalisation-bpa.component.html', styleUrls: ['./step-finalisation-bpa.component.scss'] }) export class StepFinalisationBpaComponent extends FieldType implements OnInit { isForever = false; faCheck = faCheck; constructor(public allService: AllService, private route: ActivatedRoute) { super(); } ngOnInit(): void { const productcollectionid = this.route.snapshot.paramMap.get('productcollectionid') ? this.route.snapshot.paramMap.get('productcollectionid') : ''; this.isForever = productcollectionid === 'foreverC1'; // Tell to Zuko that's the form is completed this.allService.getStepsSubjectAsObserVable().subscribe((data) => { if (data && data.step && data.step.fields && data.step.fields[0].fieldGroup[0].type === 'stepFinalisation') { this.allService['trackingService'].submitForm(); } }); } }