refactoring
This commit is contained in:
@@ -1,9 +1,20 @@
|
||||
<h2 mat-dialog-title>Schlüssel {{key.name}} löschen?</h2>
|
||||
<h2 mat-dialog-title>Schlüssel <u>{{key.name}}</u> löschen?</h2>
|
||||
<mat-dialog-content>
|
||||
<p>Soll der Schlüssel wirklich gelöscht werden?</p>
|
||||
|
||||
<div class="warning-message">
|
||||
<mat-icon color="warn">warning</mat-icon>
|
||||
<p>
|
||||
<b>{{key.name}}</b> wirklich entfernen?
|
||||
</p>
|
||||
<p class="additional-info">
|
||||
<!-- Additional information -->
|
||||
<small>Gelöschte Schlüssel können über das Archiv wiederhergestellt werden.</small>
|
||||
</p>
|
||||
</div>
|
||||
</mat-dialog-content>
|
||||
<mat-dialog-actions>
|
||||
<button mat-button [mat-dialog-close]="false" >Abbrechen</button>
|
||||
<button mat-button [mat-dialog-close]="true" color="warn">Ja, löschen</button>
|
||||
<mat-dialog-actions align="end">
|
||||
<button mat-button [mat-dialog-close]="false">Abbrechen</button>
|
||||
<button mat-raised-button color="warn" [mat-dialog-close]="true">
|
||||
<mat-icon>delete</mat-icon>
|
||||
Entfernen
|
||||
</button>
|
||||
</mat-dialog-actions>
|
||||
@@ -2,11 +2,12 @@ import { Component, inject } from '@angular/core';
|
||||
import { IKey } from '../../../../model/interface/key.interface';
|
||||
import { MatDialogRef, MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
|
||||
@Component({
|
||||
selector: 'app-delete-key',
|
||||
standalone: true,
|
||||
imports: [MatDialogModule, MatButtonModule],
|
||||
imports: [MatDialogModule, MatButtonModule, MatIconModule],
|
||||
templateUrl: './delete-key.component.html',
|
||||
styleUrl: './delete-key.component.scss'
|
||||
})
|
||||
|
||||
@@ -43,8 +43,8 @@
|
||||
</form>
|
||||
</mat-dialog-content>
|
||||
<mat-dialog-actions>
|
||||
<button mat-button (click)="save()" [disabled]="handoverForm.invalid">Speichern</button>
|
||||
<button mat-button mat-dialog-close color="warn" >Schließen</button>
|
||||
<button mat-button (click)="save()" [disabled]="handoverForm.invalid">Speichern</button>
|
||||
</mat-dialog-actions>
|
||||
</mat-tab>
|
||||
|
||||
|
||||
@@ -187,10 +187,17 @@ export class HandoverDialogComponent {
|
||||
createCustomer(name: string): Promise<any> {
|
||||
this.isLoading = true;
|
||||
return new Promise((resolve, reject) => {
|
||||
this.api.createCustomer({ name, system: this.data.cylinder.system}).subscribe({
|
||||
this.api.createCustomer({ name, system: this.data.cylinder[0].system}).subscribe({
|
||||
next: n => {
|
||||
this.isLoading = false;
|
||||
resolve(n);
|
||||
},
|
||||
error: e => {
|
||||
this.isLoading = false;
|
||||
const field = e.error.field;
|
||||
const message = field ? e.error.message : 'Ein Fehler ist aufgetreten. Bitte versuche es später erneut';
|
||||
this.toast.error(message);
|
||||
reject(e);
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user