This commit is contained in:
mmrbnjd
2024-07-25 19:15:05 +03:30
parent 630d535962
commit e840978cc1
3 changed files with 44 additions and 5 deletions

View File

@@ -2,6 +2,7 @@
@using Shared.DTOs
@inject HttpClientController hc;
<Modal @ref="modal" />
<ConfirmDialog @ref="dialog" />
<form>
@* alert *@
<div class="row">
@@ -95,7 +96,7 @@ else
<Button class="mt-3" Color="ButtonColor.Success" @onclick="OnClickUpdate" Type="ButtonType.Button">
ثبت تغییرات
</Button>
<Button class="mt-3" Color="ButtonColor.Danger" @onclick="OnClickDelete" Type="ButtonType.Button">
<Button class="mt-3" Color="ButtonColor.Danger" @onclick="ShowConfirmationDeleteAsync" Type="ButtonType.Button">
حذف
</Button>
@if (_UsedInTheInvoice)
@@ -109,6 +110,7 @@ else
@code {
private ConfirmDialog dialog = default!;
private Modal modal = default!;
// alert
AlertColor alertColor = AlertColor.Primary;
@@ -244,6 +246,21 @@ else
}
else ShowDangerAlert("فیلدهای قرمز باید مقدار دهی شوند");
}
private async Task ShowConfirmationDeleteAsync()
{
if (Cod.ID.HasValue && Cod.ID.Value > 0)
{
var confirmation = await dialog.ShowAsync(
title: "عملیات حذف کالا",
message1: $"از حذف کالای {Cod.Title}",
message2: "اطمینان دارید?");
if (confirmation)
await OnClickDelete();
}
}
}