243 lines
9.8 KiB
Plaintext
243 lines
9.8 KiB
Plaintext
@page "/TaxPayerInvoiceItem/{InvoiceID:int}"
|
|
@using Front.Services
|
|
@using Shared.DTOs
|
|
@layout PanelLayout
|
|
@inject HttpClientController hc;
|
|
<Preload LoadingText="در حال بارگذاری..." />
|
|
<ConfirmDialog @ref="dialog" />
|
|
<Toasts AutoHide="true" Delay="6000" class="p-3" Messages="messages" Placement="ToastsPlacement.TopRight" />
|
|
<PageTitle>آماده سازی صورتحساب</PageTitle>
|
|
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<div class="card mb-4">
|
|
<h5 class="card-header">اطلاعات تکمیلی سرآمد صورتحساب</h5>
|
|
<div class="card-body">
|
|
|
|
<form>
|
|
@if (invoice?.header != null)
|
|
{
|
|
|
|
<div class="row">
|
|
@foreach (var item in invoice?.header.filds)
|
|
{
|
|
<div class="mb-3 col-md-6">
|
|
@if (item.ModeID == 1 && item.InputBox != "autofild")
|
|
{
|
|
<label style="color:red;" class="form-label">@item.fName</label>
|
|
}
|
|
else
|
|
{
|
|
<label class="form-label">@item.fName</label>
|
|
}
|
|
@if (item.InputBox == "fromdb")
|
|
{
|
|
|
|
<select @bind="item.Value" class="form-control" aria-label="Default select example">
|
|
<option value="100" style="color: #b5b5b5; " selected>@item.fName...</option>
|
|
@foreach (var itema in item.DefVals)
|
|
{
|
|
if (itema.ID == item.Value)
|
|
{
|
|
<option value="@itema.ID" selected>@itema.Name</option>
|
|
}
|
|
else
|
|
{
|
|
<option value="@itema.ID">@itema.Name</option>
|
|
}
|
|
}
|
|
</select>
|
|
|
|
|
|
}
|
|
else if (item.InputBox == "autofild")
|
|
{
|
|
<input @bind-value="item.Value" style="text-align:center;" class="form-control" type="text" placeholder="@item.fName" disabled />
|
|
|
|
}
|
|
|
|
else
|
|
{
|
|
<input @bind-value="item.Value" style="text-align:center;" class="form-control" type="text" placeholder="@item.fName" />
|
|
|
|
}
|
|
</div>
|
|
}
|
|
|
|
</div>
|
|
|
|
|
|
}
|
|
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<div class="card mb-4">
|
|
<h5 class="card-header">اطلاعات تکمیلی بدنه صورتحساب</h5>
|
|
<div class="card-body">
|
|
@if (invoice?.Bodys != null)
|
|
{
|
|
<Accordion>
|
|
@foreach (var item in invoice?.Bodys)
|
|
{<div class="col-md-12">
|
|
<div class="card mb-4">
|
|
<AccordionItem Title="@item.filds.Where(w=>w.eName=="sstt").Select(s=>s.Value).First()">
|
|
<Content>
|
|
<div class="row">
|
|
@foreach (var itemB in item.filds)
|
|
{
|
|
<div class="mb-3 col-md-6">
|
|
@if (itemB.ModeID == 1 && itemB.InputBox != "autofild")
|
|
{
|
|
<label style="color:red;" class="form-label">@itemB.fName</label>
|
|
}
|
|
else
|
|
{
|
|
<label class="form-label">@itemB.fName</label>
|
|
}
|
|
@if (itemB.InputBox == "fromdb")
|
|
{
|
|
|
|
<select @bind="itemB.Value" class="form-control" aria-label="Default select example">
|
|
<option value="100" style="color: #b5b5b5; " selected>@itemB.fName...</option>
|
|
@foreach (var itema in itemB.DefVals)
|
|
{
|
|
if (itema.ID == itemB.Value)
|
|
{
|
|
<option value="@itema.ID" selected>@itema.Name</option>
|
|
}
|
|
else
|
|
{
|
|
<option value="@itema.ID">@itema.Name</option>
|
|
}
|
|
}
|
|
</select>
|
|
|
|
|
|
}
|
|
else if (itemB.InputBox == "autofild")
|
|
{
|
|
<input @bind-value="itemB.Value" style="text-align:center;" class="form-control" type="text" placeholder="@itemB.fName" disabled />
|
|
|
|
}
|
|
else
|
|
{
|
|
<input @bind-value="itemB.Value" style="text-align:center;" class="form-control" type="text" placeholder="@itemB.fName" />
|
|
|
|
}
|
|
|
|
|
|
</div>
|
|
}
|
|
</div>
|
|
|
|
</Content>
|
|
</AccordionItem>
|
|
</div>
|
|
</div>
|
|
}
|
|
|
|
</Accordion>
|
|
|
|
|
|
|
|
}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
@* action *@
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<div class="mb-2">
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<div class="col-auto">
|
|
<button type="submit" @onclick="Send" class="btn btn-primary">ارسال</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
@code {
|
|
private ConfirmDialog dialog = default!;
|
|
[Parameter] public int? InvoiceID { get; set; }
|
|
List<ToastMessage> messages = new List<ToastMessage>();
|
|
[Inject] protected PreloadService PreloadService { get; set; } = default!;
|
|
public _TaxPayer.Atemplatefield? invoice { get; set; }
|
|
// alert
|
|
AlertColor alertColor = AlertColor.Primary;
|
|
IconName alertIconName = IconName.CheckCircleFill;
|
|
bool Hidealert = true;
|
|
string alertMessage = "";
|
|
|
|
protected override async Task OnParametersSetAsync()
|
|
{
|
|
await LoadData();
|
|
await base.OnParametersSetAsync();
|
|
|
|
}
|
|
|
|
}
|
|
@functions {
|
|
public async Task Send()
|
|
{
|
|
var rsp = await hc.Post<_TaxPayer.Atemplatefield>($"TaxPayer/PreparationInvoiceBeforeSending", invoice);
|
|
if (rsp.IsSuccessStatusCode)
|
|
{
|
|
var response = await rsp.Content.ReadFromJsonAsync<bool>();
|
|
if (response)
|
|
{
|
|
ShowSuccessAlert("آماده سازی با موفقیت انجام شد");
|
|
}
|
|
else
|
|
{
|
|
ShowDangerAlert("خطای در آماده سازی اطلاعات رخ داده");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
var request = await rsp.Content.ReadFromJsonAsync<List<string>>();
|
|
ShowDangerAlert(request[0]);
|
|
}
|
|
}
|
|
|
|
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;
|
|
}
|
|
private async Task LoadData()
|
|
{
|
|
PreloadService.Show(SpinnerColor.Dark);
|
|
var rsp = await hc.Get($"TaxPayer/GetInvoice/{InvoiceID}");
|
|
if (rsp.IsSuccessStatusCode)
|
|
{
|
|
invoice = await rsp.Content.ReadFromJsonAsync<_TaxPayer.Atemplatefield?>();
|
|
}
|
|
else
|
|
{
|
|
var request = await rsp.Content.ReadFromJsonAsync<List<string>>();
|
|
ShowDangerAlert(request[0]);
|
|
}
|
|
PreloadService.Hide();
|
|
}
|
|
}
|