..
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
@using Shared.DTOs
|
||||
@inject HttpClientController hc;
|
||||
@inject Fixedvalues fv;
|
||||
<ConfirmDialog @ref="dialog" />
|
||||
|
||||
<form>
|
||||
@* alert *@
|
||||
<div class="row">
|
||||
@@ -13,10 +15,11 @@
|
||||
</div>
|
||||
<div class="row g-3">
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<div class="form-group col-md-5">
|
||||
<label class="col-sm-4 col-form-label" style="color:red" for="inputcod">کالا</label>
|
||||
<select @bind="itemDTO.CODID" @bind:after="() =>
|
||||
<select @bind="itemDTO.CODID" @bind:after="async () =>
|
||||
{
|
||||
await AfterAsync();
|
||||
if(itemDTO.ID==null)
|
||||
itemDTO.vra=cods.Where(w=>w.ID==itemDTO.CODID).Select(s=>s.Tax).FirstOrDefault();
|
||||
}" class="form-control" aria-label="Default select example" id="inputcod">
|
||||
@@ -49,41 +52,47 @@
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label class="col-sm-4 col-form-label" style="color:red" for="inputFullName">تعداد</label>
|
||||
<InputNumber @bind-Value="itemDTO.am" @bind-Value:after="AfterAsync" type="text" class="form-control" id="inputam" placeholder="تعداد" />
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label style="color:red" class="col-sm-6 col-form-label">مبلغ واحد</label>
|
||||
<InputNumber @bind-Value="itemDTO.fee" @bind-Value:after="AfterAsync" type="text" class="form-control" id="inputfee" placeholder="مبلغ واحد" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row g-3">
|
||||
<div class="form-group col-md-4">
|
||||
<label class="col-sm-6 col-form-label">مبلغ کل</label>
|
||||
<InputNumber @bind-Value="itemDTO.prdis" type="text" class="form-control" id="inputfee" placeholder="مبلغ کل" readonly />
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label class="col-sm-6 col-form-label">مبلغ تخفیف</label>
|
||||
<InputNumber @bind-Value="itemDTO.dis" type="text" @bind-Value:after="AfterAsync" class="form-control" id="inputdis" placeholder="مبلغ تخفیف" />
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label class="col-sm-8 col-form-label">مبلغ بعد تخفیف</label>
|
||||
<InputNumber @bind-Value="itemDTO.adis" type="text" class="form-control" id="inputadis" placeholder="مبلغ تخفیف" readonly />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row g-3">
|
||||
<div class="form-group col-md-4">
|
||||
<label class="col-sm-6 col-form-label">نرخ مالیات</label>
|
||||
<InputNumber @bind-Value="itemDTO.vra" type="text" class="form-control" id="inputvra" placeholder="نرخ مالیات" readonly />
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label class="col-sm-6 col-form-label">مبلغ مالیات</label>
|
||||
<InputNumber @bind-Value="itemDTO.vam" type="text" class="form-control" id="inputvra" placeholder="مبلغ مالیات" readonly />
|
||||
<label class="col-sm-4 col-form-label" style="color:red" for="inputFullName">تعداد</label>
|
||||
<InputNumber @bind-Value="itemDTO.am" @bind-Value:after="AfterAsync" type="text" class="form-control" id="inputam" placeholder="تعداد" />
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row g-3">
|
||||
<div class="form-group col-md-6">
|
||||
<label style="color:red" class="col-sm-6 col-form-label">مبلغ واحد</label>
|
||||
<CurrencyInput TValue="decimal" @bind-Value="@itemDTO.fee" @bind-Value:after="AfterAsync" Locale="fa-Ir" Placeholder="مبلغ واحد" />
|
||||
@* <InputNumber @bind-Value="itemDTO.fee" @bind-Value:after="AfterAsync" type="text" class="form-control" id="inputfee" placeholder="مبلغ واحد" /> *@
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label class="col-sm-6 col-form-label">مبلغ کل</label>
|
||||
<CurrencyInput TValue="decimal?" @bind-Value="itemDTO.prdis" Locale="fa-Ir" Placeholder="مبلغ کل" readonly />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="row g-3">
|
||||
<div class="col-md-6">
|
||||
<label class="col-sm-6 col-form-label">مبلغ تخفیف</label>
|
||||
<CurrencyInput TValue="decimal?" @bind-Value="itemDTO.dis" Locale="fa-Ir" @bind-Value:after="AfterAsync" Placeholder="مبلغ تخفیف" />
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="col-sm-8 col-form-label">مبلغ بعد تخفیف</label>
|
||||
<CurrencyInput TValue="decimal?" @bind-Value="itemDTO.adis" Locale="fa-Ir" Placeholder="مبلغ بعد تخفیف" readonly />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row g-3">
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label class="col-sm-6 col-form-label">مبلغ مالیات</label>
|
||||
<CurrencyInput TValue="decimal?" @bind-Value="itemDTO.vam" Locale="fa-Ir" Placeholder="مبلغ مالیات" readonly />
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label class="col-sm-6 col-form-label">مبلغ نهایی</label>
|
||||
<InputNumber @bind-Value="itemDTO.tsstam" type="text" class="form-control" id="inputvra" placeholder="مبلغ نهایی" readonly />
|
||||
<CurrencyInput TValue="decimal?" @bind-Value="itemDTO.tsstam" Locale="fa-Ir" Placeholder="مبلغ نهایی" readonly />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@@ -100,13 +109,15 @@ else
|
||||
<Button class="mt-3" Color="ButtonColor.Success" @onclick="OnClickUpdate" Type="ButtonType.Button">
|
||||
ثبت تغییرات
|
||||
</Button>
|
||||
<Button class="mt-3" Color="ButtonColor.Danger" @onclick="OnClickDelete" Type="ButtonType.Button">
|
||||
<Button class="mt-3" Color="ButtonColor.Danger" @onclick="ShowConfirmationDeleteAsync" Type="ButtonType.Button">
|
||||
حذف
|
||||
</Button>
|
||||
}
|
||||
|
||||
|
||||
@code {
|
||||
[Inject] ToastService ToastService { get; set; } = default!;
|
||||
private ConfirmDialog dialog = default!;
|
||||
// alert
|
||||
AlertColor alertColor = AlertColor.Primary;
|
||||
IconName alertIconName = IconName.CheckCircleFill;
|
||||
@@ -233,22 +244,22 @@ else
|
||||
return;
|
||||
}
|
||||
var rsp = await hc.Put<InvoiceItemDTO>($"InvoiceItem/UpdateItem/{InvoiceID}", itemDTO);
|
||||
if (rsp.IsSuccessStatusCode)
|
||||
if (rsp.IsSuccessStatusCode)
|
||||
{
|
||||
var request = await rsp.Content.ReadFromJsonAsync<bool>();
|
||||
if (request)
|
||||
{
|
||||
var request = await rsp.Content.ReadFromJsonAsync<bool>();
|
||||
if (request)
|
||||
{
|
||||
result.Status = ComponentStatus.success;
|
||||
result.Action = ComponentAction.update;
|
||||
await OnMultipleOfThree.InvokeAsync(result);
|
||||
}
|
||||
else ShowDangerAlert("خطایی در اجرای عملیات رخ داده");
|
||||
}
|
||||
else
|
||||
{
|
||||
var request = await rsp.Content.ReadFromJsonAsync<List<string>>();
|
||||
ShowDangerAlert(request[0]);
|
||||
result.Status = ComponentStatus.success;
|
||||
result.Action = ComponentAction.update;
|
||||
await OnMultipleOfThree.InvokeAsync(result);
|
||||
}
|
||||
else ShowDangerAlert("خطایی در اجرای عملیات رخ داده");
|
||||
}
|
||||
else
|
||||
{
|
||||
var request = await rsp.Content.ReadFromJsonAsync<List<string>>();
|
||||
ShowDangerAlert(request[0]);
|
||||
}
|
||||
}
|
||||
public async Task OnClickAdd()
|
||||
{
|
||||
@@ -281,19 +292,40 @@ else
|
||||
{
|
||||
var request = await rsp.Content.ReadFromJsonAsync<bool>();
|
||||
|
||||
if (request)
|
||||
{
|
||||
result.Status = ComponentStatus.success;
|
||||
result.Action = ComponentAction.add;
|
||||
await OnMultipleOfThree.InvokeAsync(result);
|
||||
}
|
||||
else ShowDangerAlert("خطایی در اجرای عملیات رخ داده");
|
||||
if (request)
|
||||
{
|
||||
result.Status = ComponentStatus.success;
|
||||
result.Action = ComponentAction.add;
|
||||
await OnMultipleOfThree.InvokeAsync(result);
|
||||
}
|
||||
else ShowDangerAlert("خطایی در اجرای عملیات رخ داده");
|
||||
}
|
||||
else
|
||||
{
|
||||
var request = await rsp.Content.ReadFromJsonAsync<List<string>>();
|
||||
ShowDangerAlert(request[0]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
private async Task ShowConfirmationDeleteAsync()
|
||||
{
|
||||
if (itemDTO.ID != null && itemDTO.ID > 0 && InvoiceID != null && InvoiceID > 0)
|
||||
{
|
||||
var confirmation = await dialog.ShowAsync(
|
||||
title: "عملیات حذف آیتم صورتحساب",
|
||||
message1: $"از حذف آیتم {itemDTO.ID} از صورتحساب {InvoiceID}",
|
||||
message2: "اطمینان دارید?");
|
||||
|
||||
if (confirmation)
|
||||
{
|
||||
await OnClickDelete();
|
||||
}
|
||||
else
|
||||
{
|
||||
ToastService.Notify(new ToastMessage(ToastType.Secondary, $"عملیات حذف متوقف شد"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,8 @@
|
||||
</div>
|
||||
<div class="form-group col-md-2">
|
||||
<label class="col-sm-4 col-form-label" for="inputinvoiceTypeTitle">نوع</label>
|
||||
<select @bind="invoice.invoiceType" class="form-control" aria-label="Default select example" id="inputinvoiceTypeTitle">
|
||||
@if (InvoiceID == 0 || InvoiceID == null ? false : true){
|
||||
<select @bind="invoice.invoiceType" disabled class="form-control" aria-label="Default select example" id="inputinvoiceTypeTitle">
|
||||
@if (!invoice.invoiceType.HasValue)
|
||||
{
|
||||
<option value="0" style="color: #b5b5b5" selected>انتخاب کنید...</option>
|
||||
@@ -53,7 +54,15 @@
|
||||
}
|
||||
|
||||
|
||||
</select>
|
||||
</select>
|
||||
}
|
||||
else
|
||||
{
|
||||
<select @bind="invoice.invoiceType" class="form-control" aria-label="Default select example" disabled id="inputinvoiceTypeTitle">
|
||||
<option value="10" style="color: #b5b5b5" selected>پیشنهاد قیمت</option>
|
||||
|
||||
</select>
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
@@ -121,6 +130,9 @@
|
||||
<InputText style=" text-align: center;" @bind-Value="invoice.InvoiceDate" type="text" class="form-control" id="inputInvoiceDate" placeholder="تاریخ" />
|
||||
</div>
|
||||
</div>
|
||||
@if (InvoiceID == 0 || InvoiceID == null ? false : true)
|
||||
{
|
||||
|
||||
<br /> <hr class="hr" />
|
||||
<div class="row g-3">
|
||||
<Tabs NavStyle="NavStyle.VerticalUnderline">
|
||||
@@ -160,19 +172,21 @@
|
||||
|
||||
</Tabs>
|
||||
</div>
|
||||
|
||||
}
|
||||
<hr class="hr" />
|
||||
<br />
|
||||
<div class="row g-3">
|
||||
<div class="form-group col-md-8">
|
||||
<label class="col-sm-4 col-form-label" for="inputdes">توضیحات</label>
|
||||
<div class="form-group col-md-6">
|
||||
<label class="col-form-label" for="inputdes">توضیحات</label>
|
||||
<InputText @bind-Value="invoice.Des" type="text" class="form-control" id="inputdes" placeholder="توضیحات" />
|
||||
</div>
|
||||
<div class="form-group col-md-2">
|
||||
<label class="col-sm-5 col-form-label" for="inputUdate">آخرین ویرایش</label>
|
||||
<label class="col-form-label" for="inputUdate">آخرین ویرایش</label>
|
||||
<InputText style=" text-align: center;" @bind-Value="invoice.Udate" class="form-control" id="inputUdate" readonly />
|
||||
|
||||
</div>
|
||||
<div class="form-group col-md-2">
|
||||
<div class="form-group col-md-4">
|
||||
<br />
|
||||
@if (invoice.ID == 0)
|
||||
{
|
||||
@@ -411,8 +425,8 @@
|
||||
{
|
||||
CustomerID = invoice.CustomerID,
|
||||
Des = invoice.Des,
|
||||
InvoiceDate = invoice.InvoiceDate,
|
||||
InvoicIssueDate = invoice.InvoicIssueDate,
|
||||
InvoiceDate = invoice.InvoiceDate.Replace("/",""),
|
||||
InvoicIssueDate = invoice.InvoicIssueDate.Replace("/", ""),
|
||||
PatternID = invoice.PatternID,
|
||||
Title = invoice.Title
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user