This commit is contained in:
mmrbnjd
2024-05-23 19:59:19 +03:30
parent 12b89ad630
commit 0fc2efd5ca
10 changed files with 413 additions and 64 deletions

View File

@@ -1,4 +1,6 @@
@using Shared.DTOs
<Modal @ref="modal" />
<Grid TItem="InvoiceItemDTO"
Class="table table-hover table-bordered table-striped"
DataProvider="DataProvider"
@@ -44,8 +46,9 @@
@code {
[Inject] ModalService ModalService { get; set; } = default!;
[Parameter] public EventCallback<string> OnMultipleOfThree { get; set; }
[Parameter] public IEnumerable<InvoiceItemDTO> InvoiceItems { get; set; }
private Modal modal = default!;
private async Task<GridDataProviderResult<InvoiceItemDTO>> DataProvider(GridDataProviderRequest<InvoiceItemDTO> request)
{
if (InvoiceItems is null) // pull employees only one time for client-side filtering, sorting, and paging
@@ -55,7 +58,39 @@
}
private async Task OnRowClick(GridRowEventArgs<InvoiceItemDTO> args)
{
await ModalService.ShowAsync(new ModalOption { Type = ModalType.Primary, Title = "Event: Row Click", Message = $"Id: {args.Item.ID}, Name: {args.Item.sstt}" });
var parameters = new Dictionary<string, object>();
parameters.Add("itemDTO", args.Item);
parameters.Add("OnMultipleOfThree", EventCallback.Factory.Create<ActionInResultComponent>(this, CallBack));
await modal.ShowAsync<CUSComponent.InvoiceItem>(title: "ویرایش اطلاعات", parameters: parameters);
}
public async Task CallBack(ActionInResultComponent result)
{
string msg = "";
if (result.Action == ComponentAction.add)
{
if (result.Status == ComponentStatus.success)
msg="آیتم جدید با موفقیت اضافه شد";
}
else if (result.Action == ComponentAction.update)
{
if (result.Status == ComponentStatus.success)
msg="اطلاعات آیتم با موفقیت ویرایش شد";
}
else if (result.Action == ComponentAction.delete)
{
if (result.Status == ComponentStatus.success)
msg="آیتم با موفقیت حذف شد";
}
// if (result.Status == ComponentStatus.success)
// await LoadCod(1);
await modal.HideAsync();
}
private IEnumerable<InvoiceItemDTO> GetInvoiceItems()
{