| 1 | /* |
| 2 | * Copyright (c) 2024 sovity GmbH |
| 3 | * |
| 4 | * This program and the accompanying materials are made available under the |
| 5 | * terms of the Apache License, Version 2.0 which is available at |
| 6 | * https://www.apache.org/licenses/LICENSE-2.0 |
| 7 | * |
| 8 | * SPDX-License-Identifier: Apache-2.0 |
| 9 | * |
| 10 | * Contributors: |
| 11 | * sovity GmbH - initial implementation |
| 12 | */ |
| 13 | import {Component, Inject} from '@angular/core'; |
| 14 | import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog'; |
| 15 | import {ConfirmationDialog} from './confirmation-dialog.model'; |
| 16 | |
| 17 | @Component({ |
| 18 | selector: 'app-confirmation-dialog', |
| 19 | templateUrl: './confirmation-dialog.component.html', |
| 20 | }) |
| 21 | export class ConfirmationDialogComponent { |
| 22 | constructor( |
| 23 | private dialogRef: MatDialogRef<ConfirmationDialogComponent>, |
| 24 | @Inject(MAT_DIALOG_DATA) public confirmationDialog: ConfirmationDialog, |
| 25 | ) { |
| 26 | this.confirmationDialog = { |
| 27 | ...this.confirmationDialog, |
| 28 | actionButtons: [ |
| 29 | ...this.confirmationDialog.actionButtons, |
| 30 | { |
| 31 | label: 'Cancel', |
| 32 | action: 'CANCEL', |
| 33 | }, |
| 34 | ].reverse(), |
| 35 | }; |
| 36 | } |
| 37 | |
| 38 | actionHandler(action: string) { |
| 39 | this.dialogRef.close(action); |
| 40 | } |
| 41 | } |