...
This commit is contained in:
@@ -171,9 +171,12 @@
|
||||
}
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
|
||||
orderSelectName = "نوع سفارش";
|
||||
Selected = null;
|
||||
values =new int[] { 0,0,0,0};
|
||||
TotalPrice = 0;
|
||||
Promotions = await fv.LoadPromotion();
|
||||
|
||||
orderstype = new List<IdName<int>>();
|
||||
orderstype.AddRange(Promotions.Select(s => new IdName<int>
|
||||
{ ID = s.ID, Title = s.Name }).ToList());
|
||||
|
||||
@@ -185,7 +188,14 @@
|
||||
orderSelectID = ID;
|
||||
orderSelectName = Title;
|
||||
|
||||
|
||||
Selected = Promotions.Where(w => w.ID == ID).First();
|
||||
|
||||
|
||||
if (ID > 0)
|
||||
TotalPrice = Selected.TotalPrice;
|
||||
|
||||
|
||||
}
|
||||
private async Task OnInput()
|
||||
{
|
||||
@@ -214,41 +224,47 @@
|
||||
}
|
||||
public async Task NewOrder()
|
||||
{
|
||||
if (Selected!=null)
|
||||
|
||||
if (Selected != null)
|
||||
{
|
||||
if (Selected.ID < 0 && (values[0] < 0 || values[1] < 0 || values[2] < 0 || values[3] < 0)) return;
|
||||
if (Selected.ID < 0 && values[0] == 0 && values[1] == 0 && values[2] == 0 && values[3] == 0) return;
|
||||
|
||||
//---------
|
||||
var itemFac = Selected.promotionDetails.Where(w => w.PermissionID == 3).FirstOrDefault();
|
||||
if (itemFac != null)
|
||||
itemFac.CreditAmount = values[0];
|
||||
var itemFac = Selected.promotionDetails.Where(w => w.PermissionID == 3).FirstOrDefault();
|
||||
if (itemFac != null)
|
||||
itemFac.CreditAmount = values[0];
|
||||
|
||||
var itemcod = Selected.promotionDetails.Where(w => w.PermissionID == 4).FirstOrDefault();
|
||||
if (itemcod != null)
|
||||
itemcod.CreditAmount = values[1];
|
||||
var itemcod = Selected.promotionDetails.Where(w => w.PermissionID == 4).FirstOrDefault();
|
||||
if (itemcod != null)
|
||||
itemcod.CreditAmount = values[1];
|
||||
|
||||
var itemcus = Selected.promotionDetails.Where(w => w.PermissionID == 5).FirstOrDefault();
|
||||
if (itemcus != null)
|
||||
itemcus.CreditAmount = values[2];
|
||||
var itemcus = Selected.promotionDetails.Where(w => w.PermissionID == 5).FirstOrDefault();
|
||||
if (itemcus != null)
|
||||
itemcus.CreditAmount = values[2];
|
||||
|
||||
var itemtax = Selected.promotionDetails.Where(w => w.PermissionID == 16).FirstOrDefault();
|
||||
if (itemtax != null)
|
||||
itemtax.CreditAmount = values[3];
|
||||
//---------
|
||||
var rsp = await hc.Post<PromotionDto>($"Orders/AddOrder", Selected);
|
||||
if (rsp.IsSuccessStatusCode)
|
||||
{
|
||||
var newidorder = await rsp.Content.ReadFromJsonAsync<OrderDto>();
|
||||
await OnMultipleOfThree.InvokeAsync(newidorder);
|
||||
}
|
||||
else if (rsp.StatusCode==System.Net.HttpStatusCode.NotFound)
|
||||
{
|
||||
ShowDangerAlert("مرجع یافت نشد یافت نشد");
|
||||
}
|
||||
else
|
||||
{
|
||||
var request = await rsp.Content.ReadFromJsonAsync<List<string>>();
|
||||
ShowDangerAlert(request[0]);
|
||||
}
|
||||
var itemtax = Selected.promotionDetails.Where(w => w.PermissionID == 16).FirstOrDefault();
|
||||
if (itemtax != null)
|
||||
itemtax.CreditAmount = values[3];
|
||||
//---------
|
||||
var rsp = await hc.Post<PromotionDto>($"Orders/AddOrder", Selected);
|
||||
if (rsp.IsSuccessStatusCode)
|
||||
{
|
||||
var newidorder = await rsp.Content.ReadFromJsonAsync<OrderDto>();
|
||||
await OnMultipleOfThree.InvokeAsync(newidorder);
|
||||
}
|
||||
else if (rsp.StatusCode == System.Net.HttpStatusCode.NotFound)
|
||||
{
|
||||
ShowDangerAlert("مرجع یافت نشد یافت نشد");
|
||||
}
|
||||
else
|
||||
{
|
||||
var request = await rsp.Content.ReadFromJsonAsync<List<string>>();
|
||||
ShowDangerAlert(request[0]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@
|
||||
<input style="text-align: center;" value="@order.StatusTitle" type="text" class="form-control" id="StatusTitle" placeholder="وضغیت" readonly />
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<label class="col-sm-5 col-form-label">تاریخ ایحاد</label>
|
||||
<label class="col-sm-5 col-form-label">تاریخ ایجاد</label>
|
||||
<InputText style="text-align: center;" @bind-Value="order.DateCreate" type="text" class="form-control" id="DateCreate" placeholder="تاریخ ایجاد" readonly />
|
||||
</div>
|
||||
@if (order.Status != StatusOrder.Create)
|
||||
@@ -45,9 +45,6 @@
|
||||
<GridColumn TItem="OrderItemDto" HeaderText="عنوان">
|
||||
@context.Title
|
||||
</GridColumn>
|
||||
<GridColumn TItem="OrderItemDto" HeaderText="نوع">
|
||||
@context.Type
|
||||
</GridColumn>
|
||||
<GridColumn TItem="OrderItemDto" HeaderText="تعداد">
|
||||
@context.CreditAmount
|
||||
</GridColumn>
|
||||
@@ -91,7 +88,7 @@
|
||||
</div> *@
|
||||
<div class="col-md-3">
|
||||
<label class="col-sm-5 col-form-label">مبلغ نهایی</label>
|
||||
<CurrencyInput style="text-align: center;" TValue="decimal" @bind-Value="order.TTax" Locale="fa-Ir" Placeholder="مبلغ نهایی" readonly />
|
||||
<CurrencyInput style="text-align: center;" TValue="decimal" @bind-Value="order.TPrice" Locale="fa-Ir" Placeholder="مبلغ نهایی" readonly />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -100,7 +97,7 @@
|
||||
@if (order.Status == StatusOrder.Create)
|
||||
{
|
||||
<Button class="mt-3" Color="ButtonColor.Success" @onclick="OnClickPay" Type="ButtonType.Button">
|
||||
پرداخت
|
||||
پرداخت با کیف پول
|
||||
</Button>
|
||||
<Button class="mt-3" Color="ButtonColor.Danger" @onclick="OnClickCancel" Type="ButtonType.Button">
|
||||
ابطال
|
||||
@@ -195,13 +192,14 @@
|
||||
{
|
||||
|
||||
PreloadService.Show(SpinnerColor.Dark);
|
||||
var rsp = await hc.Get($"Orders/CancelOrder/{order.ID}");
|
||||
var rsp = await hc.Delete($"Orders/CancelOrder/{order.ID}");
|
||||
PreloadService.Hide();
|
||||
if (rsp.IsSuccessStatusCode)
|
||||
{
|
||||
if(await rsp.Content.ReadFromJsonAsync<bool>())
|
||||
{
|
||||
order.Status = StatusOrder.Cancel;
|
||||
result = new ActionInResultComponent();
|
||||
result.Status = ComponentStatus.success;
|
||||
result.Action = ComponentAction.delete;
|
||||
await OnMultipleOfThree.InvokeAsync(result);
|
||||
|
Reference in New Issue
Block a user