mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-25 15:18:32 -06:00
80 lines
1.5 KiB
Plaintext
80 lines
1.5 KiB
Plaintext
@namespace Management.Web.Shared.Components
|
|
|
|
@code {
|
|
[Parameter]
|
|
public Action? OnConfirm { get; init; }
|
|
[Parameter]
|
|
public Action? OnDeny { get; init; }
|
|
[Parameter]
|
|
public Func<Task>? OnConfirmAsync { get; init; }
|
|
[Parameter]
|
|
public Func<Task>? OnDenyAsync { get; init; }
|
|
[Parameter]
|
|
[EditorRequired]
|
|
public string Label { get; set; } = "";
|
|
[Parameter]
|
|
[EditorRequired]
|
|
public string Class { get; set; } = "";
|
|
|
|
private Modal? modal { get; set; } = null;
|
|
|
|
private bool doingAsyncThings { get; set; } = false;
|
|
|
|
private async Task HandleDeny()
|
|
{
|
|
if(OnDeny != null)
|
|
OnDeny();
|
|
if(OnDenyAsync != null)
|
|
{
|
|
doingAsyncThings = true;
|
|
await OnDenyAsync();
|
|
doingAsyncThings = false;
|
|
}
|
|
modal?.Hide();
|
|
}
|
|
private async Task HandleConfirm()
|
|
{
|
|
if(OnConfirm != null)
|
|
OnConfirm();
|
|
if(OnConfirmAsync != null)
|
|
{
|
|
doingAsyncThings = true;
|
|
await OnConfirmAsync();
|
|
doingAsyncThings = false;
|
|
}
|
|
modal?.Hide();
|
|
}
|
|
}
|
|
|
|
<button
|
|
class="btn btn-danger"
|
|
@onclick="() => modal?.Show()"
|
|
>
|
|
@Label
|
|
</button>
|
|
|
|
<Modal @ref="modal">
|
|
<Title>Are you sure you want to @Label?</Title>
|
|
<Body>
|
|
<div class="text-center">
|
|
<button
|
|
class="btn btn-secondary"
|
|
@onclick="HandleDeny"
|
|
>
|
|
no
|
|
</button>
|
|
<button
|
|
class="btn btn-primary"
|
|
@onclick="HandleConfirm"
|
|
>
|
|
yes
|
|
</button>
|
|
</div>
|
|
</Body>
|
|
<Footer>
|
|
@if(doingAsyncThings)
|
|
{
|
|
<Spinnner />
|
|
}
|
|
</Footer>
|
|
</Modal> |