diff --git a/packages/common/src/lib/confirm-dialog/confirm-dialog.component.html b/packages/common/src/lib/confirm-dialog/confirm-dialog.component.html
index abdfa9d646..0b945b8332 100644
--- a/packages/common/src/lib/confirm-dialog/confirm-dialog.component.html
+++ b/packages/common/src/lib/confirm-dialog/confirm-dialog.component.html
@@ -1,12 +1,14 @@
- {{ 'igo.common.confirmDialog.title' | translate }}
+ {{ titleKey | translate }}
-{{ confirmMessage }}
+
+ {{ confirmMessage | translate }}
+
-
diff --git a/packages/common/src/lib/confirm-dialog/confirm-dialog.component.ts b/packages/common/src/lib/confirm-dialog/confirm-dialog.component.ts
index 4b5321aaae..709d1f00d2 100644
--- a/packages/common/src/lib/confirm-dialog/confirm-dialog.component.ts
+++ b/packages/common/src/lib/confirm-dialog/confirm-dialog.component.ts
@@ -8,6 +8,9 @@ import { MatDialogRef } from '@angular/material/dialog';
})
export class ConfirmDialogComponent {
public confirmMessage: string;
+ public titleKey: string = 'igo.common.confirmDialog.title';
+ public proccessKey: string = 'igo.common.confirmDialog.confirmBtn';
+ public cancelKey: string = 'igo.common.confirmDialog.cancelBtn';
constructor(public dialogRef: MatDialogRef) {}
}
diff --git a/packages/common/src/lib/confirm-dialog/confirm-dialog.interface.ts b/packages/common/src/lib/confirm-dialog/confirm-dialog.interface.ts
new file mode 100644
index 0000000000..781bd1bfc3
--- /dev/null
+++ b/packages/common/src/lib/confirm-dialog/confirm-dialog.interface.ts
@@ -0,0 +1,4 @@
+export interface ConfirmDialogOptions {
+ title?: string;
+ modeYesNo?: boolean;
+}
diff --git a/packages/common/src/lib/confirm-dialog/confirm-dialog.service.ts b/packages/common/src/lib/confirm-dialog/confirm-dialog.service.ts
index 1e44644971..e2276eff30 100644
--- a/packages/common/src/lib/confirm-dialog/confirm-dialog.service.ts
+++ b/packages/common/src/lib/confirm-dialog/confirm-dialog.service.ts
@@ -1,26 +1,33 @@
import { Injectable } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
-import { LanguageService } from '@igo2/core';
-
import { Observable } from 'rxjs';
import { ConfirmDialogComponent } from './confirm-dialog.component';
+import { ConfirmDialogOptions } from './confirm-dialog.interface';
@Injectable()
export class ConfirmDialogService {
- constructor(
- private dialog: MatDialog,
- private languageService: LanguageService
- ) {}
+ constructor(private dialog: MatDialog) {}
- public open(message: string): Observable {
+ public open(
+ message: string,
+ options?: ConfirmDialogOptions
+ ): Observable {
+ const _options: ConfirmDialogOptions = {
+ title: 'igo.common.confirmDialog.title',
+ modeYesNo: false,
+ ...options
+ };
const dialogRef = this.dialog.open(ConfirmDialogComponent, {
disableClose: false
});
- dialogRef.componentInstance.confirmMessage =
- this.languageService.translate.instant(message);
-
+ dialogRef.componentInstance.confirmMessage = message;
+ dialogRef.componentInstance.titleKey = _options.title;
+ if (_options.modeYesNo) {
+ dialogRef.componentInstance.proccessKey = 'igo.common.confirmDialog.yes';
+ dialogRef.componentInstance.cancelKey = 'igo.common.confirmDialog.no';
+ }
return dialogRef.afterClosed();
}
}
diff --git a/packages/common/src/lib/confirm-dialog/index.ts b/packages/common/src/lib/confirm-dialog/index.ts
index cdf988051c..2cddef43ca 100644
--- a/packages/common/src/lib/confirm-dialog/index.ts
+++ b/packages/common/src/lib/confirm-dialog/index.ts
@@ -1,2 +1,3 @@
export * from './confirm-dialog.component';
+export * from './confirm-dialog.interface';
export * from './confirm-dialog.service';
diff --git a/packages/common/src/lib/form-dialog/form-dialog.component.html b/packages/common/src/lib/form-dialog/form-dialog.component.html
new file mode 100644
index 0000000000..8b8585b968
--- /dev/null
+++ b/packages/common/src/lib/form-dialog/form-dialog.component.html
@@ -0,0 +1,35 @@
+{{ data.title | translate }}
+
+
+
+
+
+
+
+
+
+ {{ data.cancelButtonText | translate }}
+
+
+ {{ data.processButtonText | translate }}
+
+
+
+
+
+
+
diff --git a/packages/common/src/lib/form-dialog/form-dialog.component.scss b/packages/common/src/lib/form-dialog/form-dialog.component.scss
new file mode 100644
index 0000000000..722c17df9f
--- /dev/null
+++ b/packages/common/src/lib/form-dialog/form-dialog.component.scss
@@ -0,0 +1,15 @@
+:host {
+ div[mat-dialog-actions] {
+ margin: 10px 0 0 0;
+ }
+ .form-dialog-container {
+ width: 100%;
+ padding: 10px;
+
+ igo-form-field,
+ igo-form-group {
+ display: block;
+ height: auto;
+ }
+ }
+}
diff --git a/packages/common/src/lib/form-dialog/form-dialog.component.ts b/packages/common/src/lib/form-dialog/form-dialog.component.ts
new file mode 100644
index 0000000000..c6dacb518a
--- /dev/null
+++ b/packages/common/src/lib/form-dialog/form-dialog.component.ts
@@ -0,0 +1,81 @@
+import { Component, Inject } from '@angular/core';
+import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
+
+import { LanguageService } from '@igo2/core';
+
+import { BehaviorSubject } from 'rxjs';
+
+import {
+ Form,
+ FormField,
+ FormFieldGroup,
+ FormFieldInputs
+} from '../form/shared/form.interfaces';
+import { FormService } from '../form/shared/form.service';
+import { FormDialogData } from './form-dialog.interface';
+
+@Component({
+ selector: 'igo-form-dialog',
+ templateUrl: './form-dialog.component.html',
+ styleUrls: ['./form-dialog.component.scss']
+})
+export class FormDialogComponent {
+ form$ = new BehaviorSubject