@using Front.Services
@using Shared.DTOs
@using Shared.DTOs.Serch
@using Shared.Enums
@inject HttpClientController hc;
@context.Date
@context.Title
@context.typeName
@context.Value.ToString("N0") ريال
@code {
[Inject] protected PreloadService PreloadService { get; set; } = default!;
private string GetRowClass(CreditDocumentDto emp)
{
if (emp.type == CreditDocumentType.Decrease)
return "table-danger";
else
return "table-success";
}
private async Task> DocumentDataProvider(GridDataProviderRequest request)
{
PreloadService.Show(SpinnerColor.Dark);
string sortString = "";
SortDirection sortDirection = SortDirection.None;
if (request.Sorting is not null && request.Sorting.Any())
{
// Note: Multi column sorting is not supported at this moment
sortString = request.Sorting.FirstOrDefault()!.SortString;
sortDirection = request.Sorting.FirstOrDefault()!.SortDirection;
}
var itemsearch = new GridDataProviderRequestDto()
{
// CancellationToken = request.CancellationToken,
Filters = request.Filters.Select(s => new Shared.DTOs.Serch.FilterItem
{
Oper = s.Operator.ToString(),
PropertyName = s.PropertyName,
Value = s.Value
}).ToList(),
PageNumber = request.PageNumber,
PageSize = request.PageSize,
//sortString = sortString,
// SortDirection = sortDirection.ToString()
};
var model = new PagingDto(0, 0, new List());
var rsp = await hc.Post($"Orders/GetCreditDocuments", itemsearch);
if (rsp.IsSuccessStatusCode)
{
model = await rsp.Content.ReadFromJsonAsync>();
}
PreloadService.Hide();
return await Task.FromResult(new GridDataProviderResult { Data = model.list, TotalCount = model.RowCount });
// if (request.Sorting is not null && request.Sorting.Any())
// {
// // Note: Multi column sorting is not supported at this moment
// sortString = request.Sorting.FirstOrDefault()!.SortString;
// sortDirection = request.Sorting.FirstOrDefault()!.SortDirection;
// }
// var result = await _customerService.GetCustomersAsync(request.Filters, request.PageNumber, request.PageSize, sortString, sortDirection, request.CancellationToken);
// return await Task.FromResult(new GridDataProviderResult { Data = result.Item1, TotalCount = result.Item2 });
}
}