diff --git a/ResourceInformationV2/Components/Pages/OrgChart/Edit.razor b/ResourceInformationV2/Components/Pages/OrgChart/Edit.razor index 4dcffb1..8e81c26 100644 --- a/ResourceInformationV2/Components/Pages/OrgChart/Edit.razor +++ b/ResourceInformationV2/Components/Pages/OrgChart/Edit.razor @@ -53,7 +53,7 @@ } -
@child.Title, @child.Subtitle
diff --git a/ResourceInformationV2/Components/Pages/OrgChart/Edit.razor.cs b/ResourceInformationV2/Components/Pages/OrgChart/Edit.razor.cs index b133183..ed10c9e 100644 --- a/ResourceInformationV2/Components/Pages/OrgChart/Edit.razor.cs +++ b/ResourceInformationV2/Components/Pages/OrgChart/Edit.razor.cs @@ -1,4 +1,5 @@ using Microsoft.AspNetCore.Components; +using Microsoft.JSInterop; using ResourceInformationV2.Components.Layout; using ResourceInformationV2.Data.DataHelpers; using ResourceInformationV2.Data.DataModels; @@ -23,6 +24,9 @@ public partial class Edit { [CascadingParameter] public SidebarLayout Layout { get; set; } = default!; + [Inject] + protected IJSRuntime JsRuntime { get; set; } = default!; + [Inject] protected NavigationManager NavigationManager { get; set; } = default!; @@ -56,11 +60,14 @@ protected void AddChild() { RefreshVisibleItems(); } - protected void DeleteChild(Orgchart child) { + protected async Task DeleteChild(Orgchart child) { if (VisibleOrgchartItem.Children is null) { return; } - _ = VisibleOrgchartItem.Children.Remove(child); + var alert = child.Children is not null && child.Children.Count > 0 ? "This will delete this item and all children" : "This will delete this item"; + if (!(await JsRuntime.InvokeAsync