This commit is contained in:
mmrbnjd
2024-06-27 00:20:36 +03:30
parent 478456c03f
commit 94fdefa12c
8 changed files with 138 additions and 57 deletions

View File

@@ -1,66 +1,97 @@
@using Shared.DTOs;
@using Front.Services
@using Shared.DTOs.Serch
@inject HttpClientController hc;
<div class="mb-3 row">
<div class="col-md-10">
<InputText @bind-Value="@Value" onclick="" style="text-align:center;" class="form-control" placeholder="دنبال چی ؟" id="html5-password-input3" />
</div> <div class="col-md-2">
<button onclick="" type="submit" class="btn btn-primary">ارسال</button>
</div>
</div>
<div class="row">
<div class="col-md-12">
<Grid TItem="stuffDto" class="table table-hover table-bordered table-striped" DataProvider="DataProvider" AllowFiltering="true" Responsive="true" AllowPaging="true" PageSize="5">
<GridColumn TItem="stuffDto" HeaderText="شناسه" PropertyName="Id">
<Grid TItem="stuffDto" class="table table-hover table-bordered table-striped" DataProvider="DataProvider" AllowFiltering="true" Responsive="true" AllowPaging="true" PageSize="10">
<GridColumn Sortable="false" FilterOperator="FilterOperator.Contains" TItem="stuffDto" HeaderText="شناسه" PropertyName="ID">
@context.ID
</GridColumn>
<GridColumn TItem="stuffDto" HeaderText="نوع شناسه کالا" PropertyName="Type" StringComparison="StringComparison.Ordinal">
<GridColumn Sortable="false" FilterOperator="FilterOperator.Contains" TItem="stuffDto" HeaderText="شرح شناسه کالا" PropertyName="DescriptionOfID">
@context.DescriptionOfID
</GridColumn>
<GridColumn Sortable="false" Filterable="false" TItem="stuffDto" HeaderText="نوع شناسه کالا" PropertyName="Type">
@context.Type
</GridColumn>
<GridColumn TItem="stuffDto" HeaderText="مشمول یا معاف" PropertyName="TaxableOrFree">
<GridColumn Sortable="false" Filterable="false" TItem="stuffDto" HeaderText="وضعیت" PropertyName="TaxableOrFree">
@context.TaxableOrFree
</GridColumn>
<GridColumn TItem="stuffDto" HeaderText="نرخ ارزش افزوده" PropertyName="Vat">
<GridColumn Sortable="false" Filterable="false" TItem="stuffDto" HeaderText="نرخ" PropertyName="Vat">
@context.Vat
</GridColumn>
@* <GridColumn TItem="stuffDto" HeaderText="نرخ ارزش افزوده مبادی گمرکی" PropertyName="VatCustomPurposes">
@context.VatCustomPurposes
</GridColumn> *@
<GridColumn TItem="stuffDto" HeaderText="شرح شناسه کالا" PropertyName="DescriptionOfID">
@context.DescriptionOfID
</GridColumn>
</Grid>
</div>
</div>
<div class="row">
<div class="col-md-12">
<a href="https://stuffid.tax.gov.ir/" target="_blank" rel="noopener noreferrer">جستجوی پیشرفته</a>
</div>
</div>
@code {
private IEnumerable<stuffDto> stuffDtos;
public string Value { get; set; }
protected override void OnInitialized()
{
stuffDtos = new List<stuffDto>();
// private IEnumerable<stuffDto> stuffDtos;
// public string Value { get; set; }
// protected override void OnInitialized()
// {
// stuffDtos = new List<stuffDto>();
}
// }
}
@functions {
public async Task Search()
{
if (!string.IsNullOrEmpty(Value))
{
var rsp = await hc.Get($"stuff/Getstuff/{Value}");
if (rsp.IsSuccessStatusCode)
{
stuffDtos = await rsp.Content.ReadFromJsonAsync<List<stuffDto>>();
}
}
}
// public async Task Search()
// {
// if (!string.IsNullOrEmpty(Value))
// {
// var rsp = await hc.Get($"stuff/Getstuff/{Value}");
// if (rsp.IsSuccessStatusCode)
// {
// stuffDtos = await rsp.Content.ReadFromJsonAsync<List<stuffDto>>();
// }
// }
// }
private async Task<GridDataProviderResult<stuffDto>> DataProvider(GridDataProviderRequest<stuffDto> request)
{
return await Task.FromResult(request.ApplyTo(stuffDtos));
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 stuffDtos = new PagingDto<stuffDto>(0, 0, new List<stuffDto>());
var rsp = await hc.Post<GridDataProviderRequestDto>($"stuff/Getstuff", itemsearch);
if (rsp.IsSuccessStatusCode)
{
stuffDtos = await rsp.Content.ReadFromJsonAsync<PagingDto<stuffDto>>();
}
// var result = await _customerService.GetCustomersAsync(request.Filters, request.PageNumber, request.PageSize, sortString, sortDirection, request.CancellationToken);
return await Task.FromResult(new GridDataProviderResult<stuffDto> { Data = stuffDtos.list, TotalCount = stuffDtos.RowCount });
}
}

View File

@@ -57,23 +57,27 @@
@* action *@
<div class="row">
<div class="col-md-12">
<div class="mb-2">
<div class="row">
<div class="col-md-10">
<ul class="list-group fa-padding" >
<li class="list-group-item" data-toggle="modal" data-target="#issue">
<div class="row g-3">
<div class="col-auto">
<button type="submit" @onclick="()=>CodItem(0)" class="btn btn-primary">جدید</button>
</div>
</div>
<div class="col-md-2">
<div class="col-auto">
<Button Color="ButtonColor.Info" @onclick="Showstuff" Type="ButtonType.Button">
دریافت شناسه کالا
</Button>
</div>
</div>
</div>
</div>
</li>
</ul>
</div>
</div>
@@ -222,7 +226,6 @@
{
var parameters = new Dictionary<string, object>();
modal.Size = ModalSize.ExtraLarge;
await modal.ShowAsync<Front.CUSComponent.Taxstuff>(title: "دریافت شناسه کالا", parameters: parameters);

View File

@@ -67,9 +67,7 @@
</div>
</li>
</ul>
</div>
</div>

View File

@@ -34,9 +34,9 @@ builder.Services.AddScoped(sp => new UserAuthenticationDTO()
}) ;
//builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("https://localhost:7075/api/") });
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("https://localhost:7075/api/") });
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("http://localhost:5271/api/") });
//builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("http://localhost:5271/api/") });
CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("fa-Ir");