2024-05-23 01:16:59 +03:30
|
|
|
|
@using Shared.DTOs
|
2024-05-23 19:59:19 +03:30
|
|
|
|
<Modal @ref="modal" />
|
|
|
|
|
|
2024-05-23 01:16:59 +03:30
|
|
|
|
<Grid TItem="InvoiceItemDTO"
|
2024-05-28 15:03:08 +03:30
|
|
|
|
AllowRowClick="true"
|
|
|
|
|
AllowSorting="true"
|
|
|
|
|
Class="table table-hover"
|
2024-05-23 01:16:59 +03:30
|
|
|
|
DataProvider="DataProvider"
|
|
|
|
|
AllowPaging="true"
|
|
|
|
|
PageSize="10"
|
|
|
|
|
OnRowClick="OnRowClick"
|
|
|
|
|
Responsive="true">
|
|
|
|
|
|
|
|
|
|
<GridColumn TItem="InvoiceItemDTO" HeaderText="شناسه">
|
|
|
|
|
@context.ID
|
|
|
|
|
</GridColumn>
|
2024-05-28 15:03:08 +03:30
|
|
|
|
@* <GridColumn TItem="InvoiceItemDTO" HeaderText="کد">
|
2024-05-23 01:16:59 +03:30
|
|
|
|
@context.CODID
|
2024-05-28 15:03:08 +03:30
|
|
|
|
</GridColumn> *@
|
2024-05-23 01:16:59 +03:30
|
|
|
|
<GridColumn TItem="InvoiceItemDTO" HeaderText="کالا">
|
|
|
|
|
@context.sstt
|
|
|
|
|
</GridColumn>
|
|
|
|
|
<GridColumn TItem="InvoiceItemDTO" HeaderText="واحد">
|
|
|
|
|
@context.mu
|
|
|
|
|
</GridColumn>
|
2024-05-28 15:03:08 +03:30
|
|
|
|
<GridColumn TItem="InvoiceItemDTO" HeaderText="تعداد">
|
|
|
|
|
@context.am.ToString().Split('٫')[0]
|
2024-05-23 01:16:59 +03:30
|
|
|
|
</GridColumn>
|
|
|
|
|
<GridColumn TItem="InvoiceItemDTO" HeaderText="مبلغ واحد">
|
2024-05-28 15:03:08 +03:30
|
|
|
|
@context.fee.ToString("N0")
|
2024-05-23 01:16:59 +03:30
|
|
|
|
</GridColumn>
|
|
|
|
|
<GridColumn TItem="InvoiceItemDTO" HeaderText="نرخ مالیات">
|
|
|
|
|
@context.vra
|
|
|
|
|
</GridColumn>
|
|
|
|
|
<GridColumn TItem="InvoiceItemDTO" HeaderText="مبلغ مالیات">
|
2024-05-28 15:03:08 +03:30
|
|
|
|
@context.vam?.ToString("N0")
|
2024-05-23 01:16:59 +03:30
|
|
|
|
</GridColumn>
|
|
|
|
|
<GridColumn TItem="InvoiceItemDTO" HeaderText="تخفیف">
|
2024-05-28 15:03:08 +03:30
|
|
|
|
@context.dis?.ToString("N0")
|
2024-05-23 01:16:59 +03:30
|
|
|
|
</GridColumn>
|
|
|
|
|
@* <GridColumn TItem="InvoiceItemDTO" HeaderText="مبلغ بعد از تخفیف">
|
|
|
|
|
@context.adis
|
|
|
|
|
</GridColumn> *@
|
|
|
|
|
<GridColumn TItem="InvoiceItemDTO" HeaderText="مبلغ کل">
|
2024-05-28 15:03:08 +03:30
|
|
|
|
@context.tsstam?.ToString("N0")
|
2024-05-23 01:16:59 +03:30
|
|
|
|
</GridColumn>
|
|
|
|
|
</Grid>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@code {
|
2024-05-26 17:25:34 +03:30
|
|
|
|
[Parameter] public int InvoiceID { get; set; }
|
2024-05-23 19:59:19 +03:30
|
|
|
|
[Parameter] public EventCallback<string> OnMultipleOfThree { get; set; }
|
2024-05-23 01:16:59 +03:30
|
|
|
|
[Parameter] public IEnumerable<InvoiceItemDTO> InvoiceItems { get; set; }
|
2024-05-23 19:59:19 +03:30
|
|
|
|
private Modal modal = default!;
|
2024-05-23 01:16:59 +03:30
|
|
|
|
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
|
|
|
|
|
InvoiceItems = GetInvoiceItems(); // call a service or an API to pull the employees
|
|
|
|
|
|
|
|
|
|
return await Task.FromResult(request.ApplyTo(InvoiceItems));
|
|
|
|
|
}
|
|
|
|
|
private async Task OnRowClick(GridRowEventArgs<InvoiceItemDTO> args)
|
|
|
|
|
{
|
2024-05-23 19:59:19 +03:30
|
|
|
|
var parameters = new Dictionary<string, object>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
parameters.Add("itemDTO", args.Item);
|
2024-05-26 17:25:34 +03:30
|
|
|
|
parameters.Add("InvoiceID", InvoiceID);
|
2024-05-23 19:59:19 +03:30
|
|
|
|
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="آیتم با موفقیت حذف شد";
|
|
|
|
|
}
|
2024-05-28 15:03:08 +03:30
|
|
|
|
await OnMultipleOfThree.InvokeAsync(msg);
|
2024-05-23 19:59:19 +03:30
|
|
|
|
// if (result.Status == ComponentStatus.success)
|
|
|
|
|
// await LoadCod(1);
|
|
|
|
|
|
2024-05-28 15:03:08 +03:30
|
|
|
|
// await modal.HideAsync();
|
2024-05-23 01:16:59 +03:30
|
|
|
|
}
|
|
|
|
|
private IEnumerable<InvoiceItemDTO> GetInvoiceItems()
|
|
|
|
|
{
|
|
|
|
|
return new List<InvoiceItemDTO>();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|