This commit is contained in:
mmrbnjd
2024-06-09 17:23:57 +03:30
parent 11663c6e82
commit 82bcfc1ffe
11 changed files with 780 additions and 104 deletions

View File

@@ -2,7 +2,166 @@
@inject HttpClientController hc;
@layout PanelLayout
@page "/TaxPayer"
@page "/TaxPayer/{routed:int}"
@using Front.Services
@code {
@using Shared
@using Shared.DTOs
@using Shared.DTOs.Serch
<Preload LoadingText="در حال بارگذاری..." />
@* search *@
<div class="row">
<h4 class="fw-bold py-3 mb-4">
<span class="text-muted fw-light">سرویس ها /</span> سامانه مودیان
</h4>
<div class="col-md-12">
<div class="card mb-2">
<div class="row">
<div class="col-md-12">
<ul class="list-group fa-padding" style="border: 2px solid #0d6efd">
<li class="list-group-item" data-toggle="modal" data-target="#issue">
<div class="row g-3">
<div class="col-md-1">
<input @bind-value="itemsearch.ID" placeholder="شناسه" style="text-align:center;" class="form-control" type="text">
</div>
<div class="col-md-2">
<input @bind-value="itemsearch.InvoiceID" placeholder="شناسه صورتحساب" style="text-align:center;" class="form-control" type="text">
</div>
<div class="col-md-2">
<select @bind="itemsearch.invoiceType" class="form-control" aria-label="Default select example">
<option value="100" style="color: #b5b5b5" selected>نوع صورتحساب...</option>
@foreach (InvoiceType i in Enum.GetValues(typeof(InvoiceType)))
{
<option value="@Convert.ToInt32(i)">@i.GetEnumDisplayName()</option>
}
</select>
</div>
<div class="col-md-2">
<select @bind="itemsearch.SentStatus" class="form-control" aria-label="Default select example">
<option value="100" style="color: #b5b5b5" selected>وضعیت...</option>
@foreach (SentStatus i in Enum.GetValues(typeof(SentStatus)))
{
<option value="@Convert.ToInt32(i)">@i.GetEnumDisplayName()</option>
}
</select>
</div>
</div>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
@* alert *@
<div class="row">
<Alert hidden="@Hidealert" Color="@alertColor" Dismissable="false">
<Icon Name="@alertIconName" class="me-2"></Icon>
@alertMessage
</Alert>
</div>
@* data *@
@if (request != null)
{
<LTable ModelinComponent="request?.list" OnMultipleOfThree="EventCallback.Factory.Create<int>(this,SentTaxItem)" />
@* pagination *@
<p style="color:red">@request?.RowCount آیتم یافت شد</p>
<nav aria-label="Page navigation">
<ul class="pagination justify-content-center">
@for (int page = 1; page <= request?.PageCount; page++)
{
if (page == PageIndex)
{
<li class="page-item active">
<a class="page-link" href="@hc._nav.GetUriWithQueryParameter("PageIndex",page)">@(page)</a>
</li>
}
else
{
<li class="page-item">
<a class="page-link" href="@hc._nav.GetUriWithQueryParameter("PageIndex",page)">@(page)</a>
</li>
}
}
</ul>
</nav>
}
@code {
[Inject] protected PreloadService PreloadService { get; set; } = default!;
ItemSerchGetSentTax itemsearch = new ItemSerchGetSentTax();
public int? routed { get; set; } = 0;
// alert
AlertColor alertColor = AlertColor.Primary;
IconName alertIconName = IconName.CheckCircleFill;
bool Hidealert = true;
string alertMessage = "";
[Parameter, SupplyParameterFromQuery]
public int? PageIndex { get; set; }
public Shared.DTOs.PagingDto<SentTaxDto>? request { get; set; }
protected override async Task OnParametersSetAsync()
{
if (routed.HasValue && routed > 0)
{
ShowSuccessAlert($"صورتحساب شماره {routed} با موفقیت ارسال شد " +'\n'+
"برای برای 'نمایش وضعیت' آن را تعیین وضعیت کنید");
itemsearch.InvoiceID = routed.Value;
}
if (PageIndex == null) PageIndex = 1;
await Load(PageIndex.Value);
await base.OnParametersSetAsync();
}
}
@functions{
public async Task SentTaxItem(int ID)
{
}
public async Task Load(int pi)
{
itemsearch.PageSize = 10;
itemsearch.PageIndex = pi;
PreloadService.Show(SpinnerColor.Dark);
var rsp = await hc.Post<ItemSerchGetSentTax>("TaxPayer/GetAllSentTax", itemsearch);
if (rsp.IsSuccessStatusCode)
{
request = await rsp.Content.ReadFromJsonAsync<PagingDto<SentTaxDto>>();
}
else if (rsp.StatusCode == System.Net.HttpStatusCode.Forbidden)
{
ShowDangerAlert("شما دسترسی به خواندن اطلاعات صورتحساب را نداربد");
}
else
{
ShowDangerAlert("خطایی در اجرای عملیات رخ داده");
}
PreloadService.Hide();
}
private void ShowSuccessAlert(string msg)
{
Hidealert = false;
alertColor = AlertColor.Success;
alertIconName = IconName.CheckCircleFill;
alertMessage = msg;
}
private void ShowDangerAlert(string msg)
{
Hidealert = false;
alertColor = AlertColor.Danger;
alertIconName = IconName.ExclamationTriangleFill;
alertMessage = msg;
}
}