Add cancel confirmation popup to wizard process
Added a `DxPopup` to confirm cancellation of the wizard, with "Yes, cancel" and "No" options. Modified the "Cancel" button to trigger the new `OpenCancelConfirm` method. Introduced a private `_cancelConfirmVisible` flag to manage popup visibility. Implemented `OpenCancelConfirm` and `ConfirmCancelAsync` methods to handle popup display and cancellation confirmation. Updated `OnPopupVisibleChangedAsync` and `ResetWizardState` to reset `_cancelConfirmVisible` appropriately.
This commit is contained in:
@@ -399,7 +399,7 @@
|
||||
<div class="sender-create-wizard__footer">
|
||||
<DxButton Text="@L("Cancel", "Abbrechen")"
|
||||
RenderStyle="ButtonRenderStyle.Secondary"
|
||||
Click="CloseAsync"
|
||||
Click="OpenCancelConfirm"
|
||||
Enabled="@(!IsActionLocked)" />
|
||||
|
||||
<DxButton Text="@L("Back", "Zurück")"
|
||||
@@ -425,6 +425,28 @@
|
||||
</FooterContentTemplate>
|
||||
</DxPopup>
|
||||
|
||||
<DxPopup @bind-Visible="_cancelConfirmVisible"
|
||||
HeaderText='@L("SenderWizard_CancelConfirm_Title", "Vorgang abbrechen?")'
|
||||
Width="460px"
|
||||
CloseOnOutsideClick="false"
|
||||
ShowFooter="true"
|
||||
ShowCloseButton="true"
|
||||
CloseOnEscape="true">
|
||||
<BodyContentTemplate>
|
||||
<p>@L("SenderWizard_CancelConfirm_Message", "Sind Sie sicher? Alle Eingaben im Assistenten gehen verloren.")</p>
|
||||
</BodyContentTemplate>
|
||||
<FooterContentTemplate>
|
||||
<div class="sender-create-wizard__footer">
|
||||
<DxButton Text='@L("No", "Nein")'
|
||||
RenderStyle="ButtonRenderStyle.Secondary"
|
||||
Click='() => _cancelConfirmVisible = false' />
|
||||
<DxButton Text='@L("SenderWizard_CancelConfirm_Action", "Ja, abbrechen")'
|
||||
RenderStyle="ButtonRenderStyle.Danger"
|
||||
Click="ConfirmCancelAsync" />
|
||||
</div>
|
||||
</FooterContentTemplate>
|
||||
</DxPopup>
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public bool Visible { get; set; }
|
||||
@@ -443,6 +465,7 @@
|
||||
|
||||
private bool _isVisible;
|
||||
private bool _previousVisible;
|
||||
private bool _cancelConfirmVisible;
|
||||
private int _currentStep;
|
||||
private readonly HashSet<int> _completedSteps = [];
|
||||
|
||||
@@ -760,6 +783,24 @@
|
||||
await CloseCoreAsync();
|
||||
}
|
||||
|
||||
private Task OpenCancelConfirm()
|
||||
{
|
||||
if (IsActionLocked)
|
||||
return Task.CompletedTask;
|
||||
|
||||
_cancelConfirmVisible = true;
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private async Task ConfirmCancelAsync()
|
||||
{
|
||||
if (IsActionLocked)
|
||||
return;
|
||||
|
||||
_cancelConfirmVisible = false;
|
||||
await CloseCoreAsync();
|
||||
}
|
||||
|
||||
private async Task CloseCoreAsync()
|
||||
{
|
||||
ResetWizardState();
|
||||
@@ -843,7 +884,10 @@
|
||||
_isVisible = value;
|
||||
|
||||
if (!value)
|
||||
{
|
||||
_cancelConfirmVisible = false;
|
||||
ResetWizardState();
|
||||
}
|
||||
|
||||
if (VisibleChanged.HasDelegate)
|
||||
await VisibleChanged.InvokeAsync(value);
|
||||
@@ -1138,6 +1182,7 @@
|
||||
|
||||
private void ResetWizardState()
|
||||
{
|
||||
_cancelConfirmVisible = false;
|
||||
_currentStep = 0;
|
||||
_completedSteps.Clear();
|
||||
_validationMessage = null;
|
||||
|
||||
Reference in New Issue
Block a user