creditdocuments in front
This commit is contained in:
76
TaxPayerFull/CUSComponent/CreditDocuments.razor
Normal file
76
TaxPayerFull/CUSComponent/CreditDocuments.razor
Normal file
@@ -0,0 +1,76 @@
|
||||
@using Front.Services
|
||||
@using Shared.DTOs
|
||||
@using Shared.DTOs.Serch
|
||||
@inject HttpClientController hc;
|
||||
<Grid TItem="CreditDocumentDto"
|
||||
Class="table table-hover table-bordered table-striped"
|
||||
DataProvider="DocumentDataProvider"
|
||||
AllowFiltering="true"
|
||||
AllowPaging="true"
|
||||
AllowSorting="true"
|
||||
Responsive="true">
|
||||
|
||||
<GridColumn TItem="CreditDocumentDto" HeaderText="تاریخ" PropertyName="Date" SortString="Date" SortKeySelector="item => item.Date" FilterTextboxWidth="50" HeaderTextAlignment="Alignment.Center" TextAlignment="Alignment.Center">
|
||||
@context.Date
|
||||
</GridColumn>
|
||||
<GridColumn TItem="CreditDocumentDto" Sortable="false" Filterable="false" HeaderText="عنوان" PropertyName="Title" FilterTextboxWidth="80">
|
||||
@context.Title
|
||||
</GridColumn>
|
||||
<GridColumn TItem="CreditDocumentDto" HeaderText="حالت" PropertyName="typeName" SortString="typeName" SortKeySelector="item => item.typeName" FilterTextboxWidth="100">
|
||||
@context.typeName
|
||||
</GridColumn>
|
||||
<GridColumn Sortable="false" Filterable="false" TItem="CreditDocumentDto" HeaderText="مقدار" PropertyName="Value" FilterTextboxWidth="120">
|
||||
@context.Value
|
||||
</GridColumn>
|
||||
|
||||
</Grid>
|
||||
|
||||
@code {
|
||||
|
||||
|
||||
private async Task<GridDataProviderResult<CreditDocumentDto>> DocumentDataProvider(GridDataProviderRequest<CreditDocumentDto> request)
|
||||
{
|
||||
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>>();
|
||||
}
|
||||
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 });
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user