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();
}
}
}

View File

@@ -1,6 +1,7 @@
@using Front.Services
@using Shared.DTOs
@inject HttpClientController hc;
<ConfirmDialog @ref="dialog" />
<form>
@* alert *@
<div class="row">
@@ -113,7 +114,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)
@@ -135,7 +136,7 @@ else
[Parameter] public RCustomer Cus { get; set; }
public int? ItemSearchCustomertype { get; set; }
[Parameter] public EventCallback<ActionInResultComponent> OnMultipleOfThree { get; set; }
private ConfirmDialog dialog = default!;
public ActionInResultComponent result { get; set; }
protected override async Task OnParametersSetAsync()
{
@@ -267,4 +268,20 @@ else
}
}
private async Task ShowConfirmationDeleteAsync()
{
if (Cus.ID.HasValue && Cus.ID.Value > 0)
{
var confirmation = await dialog.ShowAsync(
title: "عملیات حذف مشتری",
message1: $"از حذف مشتری {Cus.FullName}",
message2: "اطمینان دارید?");
if (confirmation)
await OnClickDelete();
}
}
}

View File

@@ -641,7 +641,12 @@
{
ShowDangerAlert("صورتحساب با این شناسه یافت نشد");
}
else ShowDangerAlert("خطایی در اجرای عملیات رخ داده");
else
{
var request = await rsp.Content.ReadFromJsonAsync<List<string>>();
ShowDangerAlert(request[0]);
}
}