1 import { Location } from '@angular/common';
2 import { Component, EventEmitter, Input, Output, ViewChild } from '@angular/core';
3 import { UntypedFormGroup, NgForm } from '@angular/forms';
5 import { ActionLabelsI18n } from '~/app/shared/constants/app.constants';
6 import { ModalService } from '~/app/shared/services/modal.service';
7 import { SubmitButtonComponent } from '../submit-button/submit-button.component';
10 selector: 'cd-form-button-panel',
11 templateUrl: './form-button-panel.component.html',
12 styleUrls: ['./form-button-panel.component.scss']
14 export class FormButtonPanelComponent {
15 @ViewChild(SubmitButtonComponent)
16 submitButton: SubmitButtonComponent;
19 submitActionEvent = new EventEmitter();
21 backActionEvent = new EventEmitter();
24 form: UntypedFormGroup | NgForm;
34 submitText: string = this.actionLabels.CREATE;
36 cancelText: string = this.actionLabels.CANCEL;
41 private location: Location,
42 private actionLabels: ActionLabelsI18n,
43 private modalService: ModalService
47 this.submitActionEvent.emit();
51 if (this.backActionEvent.observers.length === 0) {
52 if (this.modalService.hasOpenModals()) {
53 this.modalService.dismissAll();
58 this.backActionEvent.emit();