...
This commit is contained in:
@@ -21,8 +21,7 @@
|
||||
<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();
|
||||
itemDTO.vra=await GetVra(itemDTO.CODID);
|
||||
}" class="form-control" aria-label="Default select example" id="inputcod">
|
||||
@if (itemDTO.CODID > 0)
|
||||
{
|
||||
@@ -54,7 +53,7 @@
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label class="col-sm-6 col-form-label">نرخ مالیات</label>
|
||||
<InputNumber @bind-Value="itemDTO.vra" type="text" class="form-control" id="inputvra" placeholder="نرخ مالیات" readonly />
|
||||
<InputNumber @bind-Value="itemDTO.vra" type="text" class="form-control" id="inputvra" placeholder="نرخ مالیات" />
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label class="col-sm-4 col-form-label" style="color:red" for="inputFullName">تعداد</label>
|
||||
@@ -98,24 +97,24 @@
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div class="row g-3">
|
||||
<div class="row g-3">
|
||||
<div class="col-md-10">
|
||||
@if (itemDTO.ID == null)
|
||||
{
|
||||
<Button Disabled="SpinnerVisible" class="mt-3" Color="ButtonColor.Success" @onclick="OnClickAdd" Type="ButtonType.Button">
|
||||
جدید
|
||||
</Button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<Button Disabled="SpinnerVisible" class="mt-3" Color="ButtonColor.Success" @onclick="OnClickUpdate" Type="ButtonType.Button">
|
||||
ثبت تغییرات
|
||||
</Button>
|
||||
<Button Disabled="SpinnerVisible" class="mt-3" Color="ButtonColor.Danger" @onclick="ShowConfirmationDeleteAsync" Type="ButtonType.Button">
|
||||
حذف
|
||||
</Button>
|
||||
}
|
||||
</div>
|
||||
@if (itemDTO.ID == null)
|
||||
{
|
||||
<Button Disabled="SpinnerVisible" class="mt-3" Color="ButtonColor.Success" @onclick="OnClickAdd" Type="ButtonType.Button">
|
||||
جدید
|
||||
</Button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<Button Disabled="SpinnerVisible" class="mt-3" Color="ButtonColor.Success" @onclick="OnClickUpdate" Type="ButtonType.Button">
|
||||
ثبت تغییرات
|
||||
</Button>
|
||||
<Button Disabled="SpinnerVisible" class="mt-3" Color="ButtonColor.Danger" @onclick="ShowConfirmationDeleteAsync" Type="ButtonType.Button">
|
||||
حذف
|
||||
</Button>
|
||||
}
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<Spinner Visible="SpinnerVisible" Color="SpinnerColor.Primary" />
|
||||
</div>
|
||||
@@ -146,7 +145,8 @@ else
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
SpinnerVisible = false;
|
||||
|
||||
if (!itemDTO.ID.HasValue)
|
||||
itemDTO.vra = 0;
|
||||
result = new ActionInResultComponent()
|
||||
{
|
||||
Status = ComponentStatus.fild
|
||||
@@ -157,9 +157,9 @@ else
|
||||
}
|
||||
}
|
||||
@functions {
|
||||
private void ShowMessage(ToastType toastType,string msg) => messages.Add(CreateToastMessage(toastType,msg));
|
||||
private void ShowMessage(ToastType toastType, string msg) => messages.Add(CreateToastMessage(toastType, msg));
|
||||
|
||||
private ToastMessage CreateToastMessage(ToastType toastType,string msg)
|
||||
private ToastMessage CreateToastMessage(ToastType toastType, string msg)
|
||||
=> new ToastMessage
|
||||
{
|
||||
Type = toastType,
|
||||
@@ -172,6 +172,16 @@ else
|
||||
alertIconName = IconName.CheckCircleFill;
|
||||
alertMessage = msg;
|
||||
}
|
||||
private async Task<decimal> GetVra(int CODID)
|
||||
{
|
||||
var rsp = await hc.Get($"COD/GetVra/{CODID}");
|
||||
if (rsp.IsSuccessStatusCode)
|
||||
{
|
||||
return await rsp.Content.ReadFromJsonAsync<decimal>();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
private void ShowDangerAlert(string msg)
|
||||
{
|
||||
Hidealert = false;
|
||||
@@ -266,10 +276,10 @@ else
|
||||
}
|
||||
var rsp = await hc.Put<InvoiceItemAction<InvoiceItemDTO>>($"InvoiceItem/UpdateItem"
|
||||
, new InvoiceItemAction<InvoiceItemDTO>
|
||||
{
|
||||
invoiceID=InvoiceID,
|
||||
{
|
||||
invoiceID = InvoiceID,
|
||||
item = itemDTO
|
||||
});
|
||||
});
|
||||
if (rsp.IsSuccessStatusCode)
|
||||
{
|
||||
var request = await rsp.Content.ReadFromJsonAsync<bool>();
|
||||
|
Reference in New Issue
Block a user