This commit is contained in:
mmrbnjd
2024-07-22 14:23:29 +03:30
parent d9fd29dbba
commit a914057557
4 changed files with 111 additions and 17 deletions

View File

@@ -6,7 +6,8 @@
@inject HttpClientController hc;
<Preload LoadingText="در حال بارگذاری..." />
<ConfirmDialog @ref="dialog" />
<Toasts AutoHide="true" Delay="6000" class="p-3" Messages="messages" Placement="ToastsPlacement.TopRight" />
<Toasts AutoHide="true" Delay="6000" class="p-3" Messages="messages" Placement="ToastsPlacement.TopRight" />
<Modal @ref="modal" />
@if (FullInvoice)
{
<PageTitle>اطلاعات تکمیلی صورتحساب</PageTitle>
@@ -38,7 +39,7 @@ else
</h4>
}
@if(!FullInvoice)
@if (!FullInvoice)
{
<div class="row">
<div class="col-md-12">
@@ -68,20 +69,49 @@ else
<div class="row">
@foreach (var item in invoice?.header.filds)
{
<div class="mb-3 col-md-6">
<div class="mb-1 col-md-3">
@if (item.ModeID == 1 && item.InputBox != "autofild")
{
<label style="color:red;" class="form-label">@item.fName</label>
if (item.Des != null && !FullInvoice)
{
<div class="row">
<div class="col-md-2">
<Badge style="cursor: pointer;" @onclick="()=>ShowConditions(item.Des,item.fName)" Color="BadgeColor.Primary" IndicatorType="BadgeIndicatorType.RoundedPill">شرایط خاص</Badge>
</div>
<div class="col-md-10">
<label style="color:red;" class="form-label">@item.fName</label>
</div>
</div>
}
else
{
<label style="color:red;" class="form-label">@item.fName</label>
}
}
else
{
<label class="form-label">@item.fName</label>
if (item.Des != null && !FullInvoice)
{
<div class="row">
<div class="col-md-2">
<Badge style="cursor: pointer;" @onclick="()=>ShowConditions(item.Des,item.fName)" Color="BadgeColor.Primary" IndicatorType="BadgeIndicatorType.RoundedPill">شرایط خاص</Badge>
</div>
<div class="col-md-10">
<label class="form-label">@item.fName</label>
</div>
</div>
}
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 style="color: #b5b5b5; " selected>@item.fName...</option>
<option style="color: #b5b5b5; " selected>@item.fName...</option>
@foreach (var itema in item.DefVals)
{
if (itema.ID == item.Value)
@@ -139,14 +169,44 @@ else
<div class="row">
@foreach (var itemB in item.filds)
{
<div class="mb-3 col-md-6">
<div class="mb-1 col-md-3">
@if (itemB.ModeID == 1 && itemB.InputBox != "autofild")
{
<label style="color:red;" class="form-label">@itemB.fName</label>
if (itemB.Des != null && !FullInvoice)
{
<div class="row">
<div class="col-md-2">
<Badge style="cursor: pointer;" @onclick="()=>ShowConditions(itemB.Des,itemB.fName)" Color="BadgeColor.Primary" IndicatorType="BadgeIndicatorType.RoundedPill">شرایط خاص</Badge>
</div>
<div class="col-md-10">
<label style="color:red;" class="form-label">@itemB.fName</label>
</div>
</div>
}
else
{
<label style="color:red;" class="form-label">@itemB.fName</label>
}
}
else
{
<label class="form-label">@itemB.fName</label>
if (itemB.Des != null && !FullInvoice)
{
<div class="row">
<div class="col-md-2">
<Badge style="cursor: pointer;" @onclick="()=>ShowConditions(itemB.Des,itemB.fName)" Color="BadgeColor.Primary" IndicatorType="BadgeIndicatorType.RoundedPill">شرایط خاص</Badge>
</div>
<div class="col-md-10">
<label class="form-label">@itemB.fName</label>
</div>
</div>
}
else
{
<label class="form-label">@itemB.fName</label>
}
}
@if (itemB.InputBox == "fromdb")
{
@@ -201,7 +261,7 @@ else
</div>
@if (invoice!=null)
@if (invoice != null)
{
@* action *@
<div class="row">
@@ -218,7 +278,7 @@ else
{
<button type="submit" @onclick="Send" class="btn btn-primary">آماده سازی و ارسال</button>
}
</div>
</div>
</div>
@@ -229,6 +289,7 @@ else
@code {
private Modal modal = default!;
private ConfirmDialog dialog = default!;
[Parameter] public int? InvoiceID { get; set; }
List<ToastMessage> messages = new List<ToastMessage>();
@@ -271,14 +332,15 @@ else
}
else
{
var rsp = await hc.Post<_TaxPayer.Atemplatefield>($"TaxPayer/PreparationInvoiceBeforeSending", invoice);
if (rsp.IsSuccessStatusCode)
{
var response = await rsp.Content.ReadFromJsonAsync<bool>();
if (response)
{
if(FullInvoice)
ShowMessage(ToastType.Success, "تغییرات با موفقیت انجام شد");
if (FullInvoice)
ShowMessage(ToastType.Success, "تغییرات با موفقیت انجام شد");
if (!FullInvoice)
{
@@ -303,12 +365,12 @@ else
ShowMessage(ToastType.Danger, request[0]);
}
}
}
else
{
if (FullInvoice)
ShowMessage(ToastType.Danger, "خطای در ذخیره سازی اطلاعات رخ داده");
ShowMessage(ToastType.Danger, "خطای در ذخیره سازی اطلاعات رخ داده");
else
ShowMessage(ToastType.Danger, "خطای در آماده سازی اطلاعات رخ داده");
}
@@ -319,7 +381,7 @@ else
ShowMessage(ToastType.Danger, request[0]);
}
}
}
public async Task<bool> CheckAuth()
{
@@ -363,4 +425,13 @@ else
}
}
private async Task ShowConditions(string[]? Conditions, string fild)
{
if (Conditions != null)
{
var parameters = new Dictionary<string, object>();
parameters.Add("Conditions", Conditions);
await modal.ShowAsync<CUSComponent.SpecialConditions>(title: $"شرایط خاص برای فیلد {fild}", parameters: parameters);
}
}
}