2024-07-30 17:36:35 +03:30
|
|
|
@using Front.Services
|
|
|
|
@using Shared.DTOs
|
|
|
|
@using Shared.DTOs.Serch
|
2024-07-30 18:06:11 +03:30
|
|
|
@using Shared.Enums
|
2024-07-30 17:36:35 +03:30
|
|
|
@inject HttpClientController hc;
|
2024-07-30 18:06:11 +03:30
|
|
|
<Preload LoadingText="در حال بارگذاری..." />
|
2024-07-30 17:36:35 +03:30
|
|
|
<Grid TItem="CreditDocumentDto"
|
|
|
|
Class="table table-hover table-bordered table-striped"
|
|
|
|
DataProvider="DocumentDataProvider"
|
|
|
|
AllowFiltering="true"
|
|
|
|
AllowPaging="true"
|
2024-07-30 18:06:11 +03:30
|
|
|
RowClass="GetRowClass"
|
|
|
|
Responsive="true"
|
|
|
|
PageSize="10">
|
2024-07-30 17:36:35 +03:30
|
|
|
|
2024-07-30 18:06:11 +03:30
|
|
|
<GridColumn TItem="CreditDocumentDto" HeaderText="تاریخ" PropertyName="Date" Sortable="false" Filterable="false" HeaderTextAlignment="Alignment.Center" TextAlignment="Alignment.Center">
|
2024-07-30 17:36:35 +03:30
|
|
|
@context.Date
|
|
|
|
</GridColumn>
|
2024-07-30 18:06:11 +03:30
|
|
|
<GridColumn TItem="CreditDocumentDto" HeaderText="عنوان" PropertyName="Title" Sortable="false" Filterable="false">
|
2024-07-30 17:36:35 +03:30
|
|
|
@context.Title
|
|
|
|
</GridColumn>
|
2024-07-30 18:06:11 +03:30
|
|
|
<GridColumn TItem="CreditDocumentDto" HeaderText="حالت" PropertyName="typeName" Sortable="false" Filterable="false">
|
2024-07-30 17:36:35 +03:30
|
|
|
@context.typeName
|
|
|
|
</GridColumn>
|
2024-07-30 18:06:11 +03:30
|
|
|
<GridColumn TItem="CreditDocumentDto" HeaderText="مقدار" PropertyName="Value" Sortable="false" Filterable="false">
|
|
|
|
@context.Value.ToString("N0") ريال
|
2024-07-30 17:36:35 +03:30
|
|
|
</GridColumn>
|
|
|
|
|
|
|
|
</Grid>
|
|
|
|
|
|
|
|
@code {
|
2024-07-30 18:06:11 +03:30
|
|
|
[Inject] protected PreloadService PreloadService { get; set; } = default!;
|
2024-07-30 17:36:35 +03:30
|
|
|
|
2024-07-30 18:06:11 +03:30
|
|
|
private string GetRowClass(CreditDocumentDto emp)
|
|
|
|
{
|
|
|
|
if (emp.type == CreditDocumentType.Decrease)
|
|
|
|
return "table-danger";
|
|
|
|
else
|
|
|
|
return "table-success";
|
|
|
|
}
|
2024-07-30 17:36:35 +03:30
|
|
|
|
|
|
|
private async Task<GridDataProviderResult<CreditDocumentDto>> DocumentDataProvider(GridDataProviderRequest<CreditDocumentDto> request)
|
|
|
|
{
|
2024-07-30 18:06:11 +03:30
|
|
|
PreloadService.Show(SpinnerColor.Dark);
|
2024-07-30 17:36:35 +03:30
|
|
|
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<CreditDocumentDto>(0, 0, new List<CreditDocumentDto>());
|
|
|
|
var rsp = await hc.Post<GridDataProviderRequestDto>($"Orders/GetCreditDocuments", itemsearch);
|
|
|
|
if (rsp.IsSuccessStatusCode)
|
|
|
|
{
|
|
|
|
model = await rsp.Content.ReadFromJsonAsync<PagingDto<CreditDocumentDto>>();
|
|
|
|
}
|
2024-07-30 18:06:11 +03:30
|
|
|
PreloadService.Hide();
|
|
|
|
|
2024-07-30 17:36:35 +03:30
|
|
|
return await Task.FromResult(new GridDataProviderResult<CreditDocumentDto> { 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<Customer2> { Data = result.Item1, TotalCount = result.Item2 });
|
|
|
|
}
|
|
|
|
}
|