...
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
@inject HttpClientController hc;
|
||||
@inject Fixedvalues fv;
|
||||
<ConfirmDialog @ref="dialog" />
|
||||
<Toasts class="p-3" Messages="messages" Placement="ToastsPlacement.TopRight" />
|
||||
|
||||
<form>
|
||||
@* alert *@
|
||||
@@ -116,7 +117,7 @@ else
|
||||
|
||||
|
||||
@code {
|
||||
[Inject] ToastService ToastService { get; set; } = default!;
|
||||
List<ToastMessage> messages = new List<ToastMessage>();
|
||||
private ConfirmDialog dialog = default!;
|
||||
// alert
|
||||
AlertColor alertColor = AlertColor.Primary;
|
||||
@@ -147,6 +148,14 @@ else
|
||||
}
|
||||
}
|
||||
@functions {
|
||||
private void ShowMessage(ToastType toastType,string msg) => messages.Add(CreateToastMessage(toastType,msg));
|
||||
|
||||
private ToastMessage CreateToastMessage(ToastType toastType,string msg)
|
||||
=> new ToastMessage
|
||||
{
|
||||
Type = toastType,
|
||||
Message = msg,
|
||||
};
|
||||
private void ShowSuccessAlert(string msg)
|
||||
{
|
||||
Hidealert = false;
|
||||
@@ -164,25 +173,25 @@ else
|
||||
//-----------------------
|
||||
private async Task prdisAsync()
|
||||
{
|
||||
if (itemDTO.ID == null)
|
||||
itemDTO.prdis = itemDTO.fee * itemDTO.am;
|
||||
// if (itemDTO.ID == null)
|
||||
itemDTO.prdis = itemDTO.fee * itemDTO.am;
|
||||
}
|
||||
private async Task adisAsync()
|
||||
{
|
||||
if (itemDTO.ID == null)
|
||||
itemDTO.adis = itemDTO.prdis - itemDTO.dis;
|
||||
// if (itemDTO.ID == null)
|
||||
itemDTO.adis = itemDTO.prdis - itemDTO.dis;
|
||||
|
||||
// await AftervamAsync();
|
||||
}
|
||||
private async Task vamAsync()
|
||||
{
|
||||
if (itemDTO.ID == null)
|
||||
itemDTO.vam = itemDTO.vra * itemDTO.adis / 100;
|
||||
// if (itemDTO.ID == null)
|
||||
itemDTO.vam = itemDTO.vra * itemDTO.adis / 100;
|
||||
}
|
||||
private async Task tsstamAsync()
|
||||
{
|
||||
if (itemDTO.ID == null)
|
||||
itemDTO.tsstam = itemDTO.vam + itemDTO.adis;
|
||||
// if (itemDTO.ID == null)
|
||||
itemDTO.tsstam = itemDTO.vam + itemDTO.adis;
|
||||
}
|
||||
private async Task AfterAsync()
|
||||
{
|
||||
@@ -195,7 +204,7 @@ else
|
||||
public async Task OnClickDelete()
|
||||
{
|
||||
|
||||
var rsp = await hc.Delete($"InvoiceItem/DeleteItem/{InvoiceID}/{itemDTO.ID}");
|
||||
var rsp = await hc.Delete($"InvoiceItem/DeleteItem/{itemDTO.ID}");
|
||||
if (rsp.IsSuccessStatusCode)
|
||||
{
|
||||
var request = await rsp.Content.ReadFromJsonAsync<bool>();
|
||||
@@ -243,7 +252,12 @@ else
|
||||
ShowDangerAlert("مبلغ تخفیف درست نیست");
|
||||
return;
|
||||
}
|
||||
var rsp = await hc.Put<InvoiceItemDTO>($"InvoiceItem/UpdateItem/{InvoiceID}", itemDTO);
|
||||
var rsp = await hc.Put<InvoiceItemAction<InvoiceItemDTO>>($"InvoiceItem/UpdateItem"
|
||||
, new InvoiceItemAction<InvoiceItemDTO>
|
||||
{
|
||||
invoiceID=InvoiceID,
|
||||
item = itemDTO
|
||||
});
|
||||
if (rsp.IsSuccessStatusCode)
|
||||
{
|
||||
var request = await rsp.Content.ReadFromJsonAsync<bool>();
|
||||
@@ -287,7 +301,11 @@ else
|
||||
return;
|
||||
}
|
||||
|
||||
var rsp = await hc.Post<InvoiceItemDTO>($"InvoiceItem/AddItem/{InvoiceID}", itemDTO);
|
||||
var rsp = await hc.Post<InvoiceItemAction<InvoiceItemDTO>>($"InvoiceItem/AddItem", new InvoiceItemAction<InvoiceItemDTO>
|
||||
{
|
||||
invoiceID = InvoiceID,
|
||||
item = itemDTO
|
||||
});
|
||||
if (rsp.IsSuccessStatusCode)
|
||||
{
|
||||
var request = await rsp.Content.ReadFromJsonAsync<bool>();
|
||||
@@ -313,7 +331,7 @@ else
|
||||
{
|
||||
var confirmation = await dialog.ShowAsync(
|
||||
title: "عملیات حذف آیتم صورتحساب",
|
||||
message1: $"از حذف آیتم {itemDTO.ID} از صورتحساب {InvoiceID}",
|
||||
message1: $"از حذف کالای {itemDTO.sstt} از صورتحساب {InvoiceID}",
|
||||
message2: "اطمینان دارید?");
|
||||
|
||||
if (confirmation)
|
||||
@@ -322,7 +340,7 @@ else
|
||||
}
|
||||
else
|
||||
{
|
||||
ToastService.Notify(new ToastMessage(ToastType.Secondary, $"عملیات حذف متوقف شد"));
|
||||
ShowMessage(ToastType.Secondary, "عملیات حذف متوقف شد");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
<Modal @ref="modal" />
|
||||
|
||||
<Grid TItem="InvoiceItemDTO"
|
||||
Class="table table-hover table-bordered table-striped"
|
||||
AllowRowClick="true"
|
||||
AllowSorting="true"
|
||||
Class="table table-hover"
|
||||
DataProvider="DataProvider"
|
||||
AllowPaging="true"
|
||||
PageSize="10"
|
||||
@@ -12,35 +14,35 @@
|
||||
<GridColumn TItem="InvoiceItemDTO" HeaderText="شناسه">
|
||||
@context.ID
|
||||
</GridColumn>
|
||||
<GridColumn TItem="InvoiceItemDTO" HeaderText="کد">
|
||||
@* <GridColumn TItem="InvoiceItemDTO" HeaderText="کد">
|
||||
@context.CODID
|
||||
</GridColumn>
|
||||
</GridColumn> *@
|
||||
<GridColumn TItem="InvoiceItemDTO" HeaderText="کالا">
|
||||
@context.sstt
|
||||
</GridColumn>
|
||||
<GridColumn TItem="InvoiceItemDTO" HeaderText="واحد">
|
||||
@context.mu
|
||||
</GridColumn>
|
||||
<GridColumn TItem="InvoiceItemDTO" HeaderText="تعداد/مقدار">
|
||||
@context.am
|
||||
<GridColumn TItem="InvoiceItemDTO" HeaderText="تعداد">
|
||||
@context.am.ToString().Split('٫')[0]
|
||||
</GridColumn>
|
||||
<GridColumn TItem="InvoiceItemDTO" HeaderText="مبلغ واحد">
|
||||
@context.fee
|
||||
@context.fee.ToString("N0")
|
||||
</GridColumn>
|
||||
<GridColumn TItem="InvoiceItemDTO" HeaderText="نرخ مالیات">
|
||||
@context.vra
|
||||
</GridColumn>
|
||||
<GridColumn TItem="InvoiceItemDTO" HeaderText="مبلغ مالیات">
|
||||
@context.vam
|
||||
@context.vam?.ToString("N0")
|
||||
</GridColumn>
|
||||
<GridColumn TItem="InvoiceItemDTO" HeaderText="تخفیف">
|
||||
@context.dis
|
||||
@context.dis?.ToString("N0")
|
||||
</GridColumn>
|
||||
@* <GridColumn TItem="InvoiceItemDTO" HeaderText="مبلغ بعد از تخفیف">
|
||||
@context.adis
|
||||
</GridColumn> *@
|
||||
<GridColumn TItem="InvoiceItemDTO" HeaderText="مبلغ کل">
|
||||
@context.tsstam
|
||||
@context.tsstam?.ToString("N0")
|
||||
</GridColumn>
|
||||
</Grid>
|
||||
|
||||
@@ -88,11 +90,11 @@
|
||||
if (result.Status == ComponentStatus.success)
|
||||
msg="آیتم با موفقیت حذف شد";
|
||||
}
|
||||
|
||||
await OnMultipleOfThree.InvokeAsync(msg);
|
||||
// if (result.Status == ComponentStatus.success)
|
||||
// await LoadCod(1);
|
||||
|
||||
await modal.HideAsync();
|
||||
// await modal.HideAsync();
|
||||
}
|
||||
private IEnumerable<InvoiceItemDTO> GetInvoiceItems()
|
||||
{
|
||||
|
||||
@@ -44,7 +44,17 @@
|
||||
|
||||
if (property.CustomAttributes.Any(w => w.AttributeType.Name == "DisplayAttribute"))
|
||||
{
|
||||
<td>@property.GetValue(item, null)</td>
|
||||
if (property.PropertyType == typeof(Nullable<System.Decimal>) || property.PropertyType == typeof(System.Decimal))
|
||||
{
|
||||
<td>
|
||||
@decimal.Parse(property.GetValue(item, null).ToString()).ToString("N0") ريال
|
||||
</td>
|
||||
}
|
||||
else
|
||||
{
|
||||
<td>@property.GetValue(item, null)</td>
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -122,17 +122,21 @@
|
||||
<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)
|
||||
{
|
||||
@if (InvoiceID == 0 || InvoiceID == null ? false : true)
|
||||
{
|
||||
|
||||
<br /> <hr class="hr" />
|
||||
<div class="row g-3">
|
||||
<Tabs NavStyle="NavStyle.VerticalUnderline">
|
||||
<Tab Title="آیتم ها" IsActive="InvoiceID==0 || InvoiceID==null ? false : true">
|
||||
<Tab Title="آیتم ها" IsActive="true">
|
||||
<Content>
|
||||
<div class="row g-3">
|
||||
<div class="form-group col-md-11">
|
||||
<LGridInvoiceItem InvoiceID="InvoiceID??0" OnMultipleOfThree="EventCallback.Factory.Create<string>(this, CallBack)" InvoiceItems="invoice.items" />
|
||||
@if (InvoiceID.HasValue && invoice.items.Count > 0)
|
||||
{
|
||||
<LGridInvoiceItem InvoiceID="InvoiceID.Value" OnMultipleOfThree="EventCallback.Factory.Create<string>(this, CallBack)" InvoiceItems="invoice.items" />
|
||||
|
||||
}
|
||||
</div>
|
||||
<div class="form-group col-md-1">
|
||||
|
||||
@@ -229,7 +233,7 @@
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
PreloadService.Show(SpinnerColor.Dark);
|
||||
|
||||
Cus = await fv.GetCustomers();
|
||||
Patterns = await fv.GetPatterns();
|
||||
if (InvoiceID != null && InvoiceID > 0)
|
||||
@@ -252,7 +256,7 @@
|
||||
|
||||
Hidealert = true;
|
||||
alertMessage = "";
|
||||
PreloadService.Hide();
|
||||
|
||||
await base.OnParametersSetAsync();
|
||||
}
|
||||
}
|
||||
@@ -273,6 +277,7 @@
|
||||
}
|
||||
private async Task LoadData()
|
||||
{
|
||||
PreloadService.Show(SpinnerColor.Dark);
|
||||
var rsp = await hc.Get($"Invoice/Get/{InvoiceID}");
|
||||
if (rsp.IsSuccessStatusCode)
|
||||
{
|
||||
@@ -280,6 +285,8 @@
|
||||
}
|
||||
else
|
||||
hc._nav.NavigateTo("/Panel");
|
||||
|
||||
PreloadService.Hide();
|
||||
}
|
||||
public async Task CallBack(ActionInResultComponent result)
|
||||
{
|
||||
|
||||
@@ -34,9 +34,9 @@ builder.Services.AddScoped(sp => new UserAuthenticationDTO()
|
||||
}) ;
|
||||
|
||||
|
||||
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("https://localhost:7075/api/") });
|
||||
//builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("https://localhost:7075/api/") });
|
||||
|
||||
//builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("http://localhost:5271/api/") });
|
||||
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("http://localhost:5271/api/") });
|
||||
|
||||
CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("fa-Ir");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user