Added creation/modification confirmation

This commit is contained in:
2025-01-16 16:22:25 +01:00
parent d8596aa5e1
commit 3dde278955
2 changed files with 7 additions and 2 deletions

View File

@@ -256,9 +256,14 @@
} }
StateHasChanged(); StateHasChanged();
return _validationErrors var valid = _validationErrors
.Select(err => err.Value.Count) .Select(err => err.Value.Count)
.All(c => c == 0); .All(c => c == 0);
if (!valid) return false;
var dialog = await Dialogs.ShowConfirmationAsync($"Do you really want to {(_currentlyEditing ? "edit" : "create")} this entry?");
var result = await dialog.Result;
return !result.Cancelled;
} }
private enum InputType { private enum InputType {

View File

@@ -2,7 +2,7 @@
namespace HopFrame.Web.Models; namespace HopFrame.Web.Models;
public class RelationPickerDialogData(TableConfig sourceTable, object? current) { public sealed class RelationPickerDialogData(TableConfig sourceTable, object? current) {
public object? Object { get; set; } = current; public object? Object { get; set; } = current;
public TableConfig SourceTable { get; init; } = sourceTable; public TableConfig SourceTable { get; init; } = sourceTable;
} }