...
This commit is contained in:
63
TaxPayerFull/CUSComponent/OrderItemNew.razor
Normal file
63
TaxPayerFull/CUSComponent/OrderItemNew.razor
Normal file
@@ -0,0 +1,63 @@
|
||||
@using Front.Services
|
||||
@using Shared.DTOs
|
||||
@inject Fixedvalues fv;
|
||||
@inject HttpClientController hc;
|
||||
<Preload LoadingText="در حال بارگذاری..." />
|
||||
|
||||
|
||||
|
||||
<div class="row g-3">
|
||||
<div class="col-md-2">
|
||||
<Dropdown Color="DropdownColor.Secondary">
|
||||
<DropdownToggleButton>نوع سفارش</DropdownToggleButton>
|
||||
<DropdownMenu>
|
||||
@foreach (var i in orderstype)
|
||||
{
|
||||
<DropdownItem @onclick="()=>OnChange(i.ID,i.Title)">@i.Title</DropdownItem>
|
||||
}
|
||||
</DropdownMenu>
|
||||
</Dropdown>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
|
||||
<label>@orderSelectName</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row g-3">
|
||||
<div class="col-md-4">
|
||||
<button type="submit" @onclick="NewOrder" class="btn btn-primary">ثبت</button>
|
||||
</div>
|
||||
</div>
|
||||
@code {
|
||||
string orderSelectName = "";
|
||||
int orderSelectID = 0;
|
||||
[Inject] protected PreloadService PreloadService { get; set; } = default!;
|
||||
[Parameter] public EventCallback<OrderDto> OnMultipleOfThree { get; set; }
|
||||
List<IdName<int>> orderstype = new List<IdName<int>>()
|
||||
{ new IdName<int>() { ID=999,Title="شخصی" },
|
||||
new IdName<int>() { ID=919,Title="qw" }};
|
||||
public List<PromotionDto> Promotions { get; set; } = new();
|
||||
public List<PricingDto> Pricing { get; set; } = new();
|
||||
}
|
||||
@functions {
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
Promotions = await fv.LoadPromotion();
|
||||
Pricing = await fv.LoadPricing();
|
||||
|
||||
orderstype.AddRange(Promotions.Select(s => new IdName<int>
|
||||
{
|
||||
ID = s.ID,
|
||||
Title = s.Name
|
||||
}).ToList());
|
||||
|
||||
await base.OnParametersSetAsync();
|
||||
|
||||
}
|
||||
public async Task OnChange(int ID,string Title)
|
||||
{
|
||||
orderSelectID = ID;
|
||||
orderSelectName = Title;
|
||||
}
|
||||
public async Task NewOrder() { }
|
||||
}
|
@@ -179,9 +179,9 @@
|
||||
private async Task OnClickPay()
|
||||
{
|
||||
// result.Status = ComponentStatus.success;
|
||||
// result.Action = ComponentAction.add;
|
||||
// await OnMultipleOfThree.InvokeAsync(result);
|
||||
|
||||
// result.Action = ComponentAction.add;
|
||||
// await OnMultipleOfThree.InvokeAsync(result);
|
||||
|
||||
|
||||
}
|
||||
private async Task OnClickCancel()
|
||||
@@ -193,15 +193,16 @@
|
||||
|
||||
if (confirmation)
|
||||
{
|
||||
|
||||
PreloadService.Show(SpinnerColor.Dark);
|
||||
var rsp = await hc.Get($"Orders/CancelOrder/{order.ID}");
|
||||
PreloadService.Hide();
|
||||
if (rsp.IsSuccessStatusCode)
|
||||
{
|
||||
if(await rsp.Content.ReadFromJsonAsync<bool>())
|
||||
|
||||
PreloadService.Show(SpinnerColor.Dark);
|
||||
var rsp = await hc.Get($"Orders/CancelOrder/{order.ID}");
|
||||
PreloadService.Hide();
|
||||
if (rsp.IsSuccessStatusCode)
|
||||
{
|
||||
result.Status = ComponentStatus.success;
|
||||
if(await rsp.Content.ReadFromJsonAsync<bool>())
|
||||
{
|
||||
order.Status = StatusOrder.Cancel;
|
||||
result.Status = ComponentStatus.success;
|
||||
result.Action = ComponentAction.delete;
|
||||
await OnMultipleOfThree.InvokeAsync(result);
|
||||
}
|
||||
|
Reference in New Issue
Block a user