add better validation to forms

This commit is contained in:
Jan-Marlon Leibl 2024-12-03 09:20:59 +01:00
commit 6e5eadd3a2
8 changed files with 86 additions and 18 deletions

View file

@ -57,7 +57,7 @@
<mat-icon class="text-red-500">delete</mat-icon>
</button>
</div>
<button type="button" mat-stroked-button (click)="addTag()" class="mt-2">Add Tag</button>
<button type="button" mat-button (click)="addTag()" class="mt-2">Add Tag</button>
</div>
</div>
<div class="flex justify-between">
@ -65,8 +65,19 @@
<button type="submit" mat-flat-button (click)="submit()">Submit</button>
<button type="button" mat-stroked-button routerLink="/">Cancel</button>
</div>
<button mat-icon-button aria-label="Delete hotel" *ngIf="hotel" (click)="delete(hotel.id)">
<mat-icon class="text-red-500">delete</mat-icon>
<button mat-stroked-button color="warn" aria-label="Delete hotel" *ngIf="hotel" (click)="showDeleteConfirmation = true">
Remove
</button>
<div *ngIf="showDeleteConfirmation" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50">
<div class="bg-white p-6 rounded-lg shadow-lg max-w-sm w-full">
<h2 class="text-xl font-bold mb-4">Confirm Deletion</h2>
<p class="mb-6">Are you sure you want to delete this hotel?</p>
<div class="flex justify-end space-x-2">
<button mat-stroked-button (click)="showDeleteConfirmation = false">Cancel</button>
<button mat-flat-button color="warn" (click)="delete(hotel.id)">Delete</button>
</div>
</div>
</div>
</div>
</form>