feat : complete ordering , add version 0.17.18.25

release
Amir Hossein Khademi 2024-02-26 18:16:29 +03:30
parent 4ae2dcfb39
commit 25ade7ce1c
12 changed files with 366 additions and 295 deletions

View File

@ -6,9 +6,6 @@
@inject IUserUtility UserUtility
@inject IDialogService DialogService
<head>
<link rel="stylesheet" href="css/bootstrap/bootstrap.min.css" />
</head>
<MudDialog class="mx-auto">
<DialogContent>

View File

@ -34,10 +34,10 @@
<MudItem sm="9">
<MudField Variant="Variant.Outlined" Label="آدرس">@ViewModel.PageDto.OrderDelivery.Address</MudField>
<MudField Variant="Variant.Outlined" Label="آدرس">@ViewModel.PageDto?.OrderDelivery?.Address</MudField>
</MudItem>
<MudItem sm="3">
<MudField Variant="Variant.Outlined" Label="روش ارسال">@ViewModel.PageDto.OrderDelivery.ShippingMethod</MudField>
<MudField Variant="Variant.Outlined" Label="روش ارسال">@ViewModel.PageDto?.OrderDelivery?.ShippingMethod</MudField>
</MudItem>
</MudGrid>
@ -180,18 +180,18 @@
<BaseButtonUi class="w-64 h-12 rounded-md" IsProcessing="@ViewModel.IsProcessing"
Icon="@Icons.Material.Outlined.AirportShuttle"
Variant="Variant.Filled" Color="Color.Success"
Content="ثبت ارسال سفارش" OnClickCallback="ViewModel.SubmitEditAsync" />
Content="@ViewModel.ConfirmOrderButtonText" OnClickCallback="ViewModel.SubmitConfirmAsync" />
<BaseButtonUi class="w-52 h-12 rounded-md" IsProcessing="@ViewModel.IsProcessing"
Icon="@Icons.Material.Outlined.RemoveCircle"
Variant="Variant.Outlined" Color="Color.Error"
Content="لغو سفارش" OnClickCallback="ViewModel.SubmitEditAsync" />
Content="لغو سفارش" />
<MudSpacer />
<BaseButtonUi class="w-52 h-12 rounded-md my-auto" IsProcessing="@ViewModel.IsProcessing"
Icon="@Icons.Material.Outlined.Print"
Size="Size.Small"
Variant="Variant.Outlined" Color="Color.Info"
Content="چاپــ فاکتور" OnClickCallback="ViewModel.SubmitEditAsync" />
Content="چاپــ فاکتور" />
<MudButton Variant="Variant.Outlined" Size="Size.Medium" Color="Color.Error" OnClick="ViewModel.Cancel">بستن</MudButton>
</MudStack>
</DialogActions>

View File

@ -36,6 +36,8 @@ public class OrderActionDialogBoxViewModel : BaseViewModel<OrderLDto>
public void Cancel() => _mudDialog.Cancel();
public string ConfirmOrderButtonText { get; set; } = string.Empty;
public bool IsEditing = false;
@ -54,6 +56,23 @@ public class OrderActionDialogBoxViewModel : BaseViewModel<OrderLDto>
var order = await _restWrapper.OrderRestApi.ReadOne(PageDto.Id, token);
PageDto = order;
switch (PageDto.OrderStatus)
{
case OrderStatus.Submitted:
ConfirmOrderButtonText = "ثبت پرداختی سفارش";
break;
case OrderStatus.Paid:
ConfirmOrderButtonText = "ثبت سفارش";
break;
case OrderStatus.Processing:
ConfirmOrderButtonText = "ثبت ارسال سفارش";
break;
case OrderStatus.Delivered:
ConfirmOrderButtonText = "ثبت انجام سفارش";
break;
default:
throw new ArgumentOutOfRangeException();
}
}
catch (ApiException ex)
{
@ -74,11 +93,51 @@ public class OrderActionDialogBoxViewModel : BaseViewModel<OrderLDto>
};
}
public async Task SubmitEditAsync()
public async Task SubmitConfirmAsync()
{
var options = new DialogOptions { CloseOnEscapeKey = true };
var parameters = new DialogParameters<QuestionDialog>();
parameters.Add(x => x.ContentText, "آیا از حذف دسته بندی اطمینان دارید ?");
var dialogReference = await _dialogService.ShowAsync<QuestionDialog>("حذف شرح حال", parameters, options);
var result = await dialogReference.Result;
if (!result.Canceled)
{
try
{
var token = await _userUtility.GetBearerTokenAsync();
if (token == null)
throw new Exception("Token is null");
IsProcessing = true;
OrderStatus nextOrderStatus = OrderStatus.Canceled;
switch (PageDto.OrderStatus)
{
case OrderStatus.OrderBag:
return;
break;
case OrderStatus.Submitted:
nextOrderStatus = OrderStatus.Paid;
break;
case OrderStatus.Paid:
nextOrderStatus = OrderStatus.Processing;
break;
case OrderStatus.Processing:
nextOrderStatus = OrderStatus.Delivered;
break;
case OrderStatus.Delivered:
nextOrderStatus = OrderStatus.Done;
break;
case OrderStatus.Done:
return;
break;
case OrderStatus.Canceled:
return;
break;
default:
throw new ArgumentOutOfRangeException();
}
await _restWrapper.OrderRestApi.ConfirmOrderStepAsync(PageDto.Id, nextOrderStatus, token);
_snackbar.Add($"ویرایش سفارش {PageDto.FactorCode} با موفقیت انجام شد", Severity.Success);
_mudDialog.Close();
}
@ -99,4 +158,6 @@ public class OrderActionDialogBoxViewModel : BaseViewModel<OrderLDto>
IsProcessing = false;
}
}
}
}

View File

@ -1,16 +1,10 @@
@using NetinaShop.Common.Models.Exception
@using NetinaShop.Domain.CommandQueries.Commands
@using Radzen.Blazor
@inject ISnackbar Snackbar
@inject ISnackbar Snackbar
@inject IRestWrapper RestWrapper
@inject IUserUtility UserUtility
<head>
<link rel="stylesheet" href="css/bootstrap/bootstrap.min.css" />
</head>
<MudDialog class="mx-auto" DisableSidePadding="true">
<DialogContent>
<MudStack>
<MudStack class="mx-5 overflow-x-hidden overflow-y-hidden">
<MudDivider class="-mt-3" />
<MudStack Spacing="0">
@ -49,7 +43,7 @@
</MudAutocomplete>
</MudItem>
<MudItem sm="12" lg="12" md="12">
<MudContainer class="max-h-[20rem] lg:max-h-[25rem] overflow-y-scroll">
<MudContainer class="max-h-[20rem] lg:max-h-[25rem] overflow-y-scroll overflow-x-hidden">
<MudStack class="mt-4 mb-2" Spacing="0">
<MudText Typo="Typo.h6">توضیحات تکمیلی</MudText>

View File

@ -3,8 +3,8 @@
public static class Address
{
#if DEBUG
//public static string BaseAddress = "http://localhost:32770/api";
public static string BaseAddress = "https://api.vesmook.com/api";
public static string BaseAddress = "http://localhost:32770/api";
//public static string BaseAddress = "https://api.vesmook.com/api";
#else
public static string BaseAddress = "https://api.vesmook.com/api";
#endif

View File

@ -19,7 +19,7 @@ public static class MainTheme
},
PaletteDark = new PaletteDark()
{
Primary = "#001A46",
Primary = "#E59F2E",
Secondary = "#E59F2E",
}
};

View File

@ -5,8 +5,8 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<ServiceWorkerAssetsManifest>service-worker-assets.js</ServiceWorkerAssetsManifest>
<AssemblyVersion>0.17.16.23</AssemblyVersion>
<FileVersion>0.17.16.23</FileVersion>
<AssemblyVersion>0.17.18.25</AssemblyVersion>
<FileVersion>0.17.18.25</FileVersion>
<AssemblyName>$(MSBuildProjectName)</AssemblyName>
</PropertyGroup>

View File

@ -7,4 +7,7 @@ public interface IOrderRestApi
[Get("/{id}")]
Task<OrderLDto> ReadOne(Guid id, [Header("Authorization")] string authorization);
[Post("/{id}/confirm")]
Task<bool> ConfirmOrderStepAsync(Guid id,[Query] OrderStatus nextOrderStatus , [Header("Authorization")] string authorization);
}

View File

@ -1,5 +1,5 @@
{
"version": "0.17.16.23",
"version": "0.17.18.25",
"versionNumber": 0.101623,
"versionName": "چرتکه",
"description": "",

View File

@ -1076,6 +1076,10 @@ input:checked + .toggle-bg {
margin-left: 1rem;
margin-right: 1rem;
}
.mx-5 {
margin-left: 1.25rem;
margin-right: 1.25rem;
}
.mx-auto {
margin-left: auto;
margin-right: auto;
@ -1437,6 +1441,9 @@ input:checked + .toggle-bg {
.overflow-x-hidden {
overflow-x: hidden;
}
.overflow-y-hidden {
overflow-y: hidden;
}
.overflow-x-scroll {
overflow-x: scroll;
}

View File

@ -1155,6 +1155,11 @@ input:checked + .toggle-bg {
margin-right: 1rem;
}
.mx-5 {
margin-left: 1.25rem;
margin-right: 1.25rem;
}
.mx-auto {
margin-left: auto;
margin-right: auto;
@ -1628,6 +1633,10 @@ input:checked + .toggle-bg {
overflow-x: hidden;
}
.overflow-y-hidden {
overflow-y: hidden;
}
.overflow-x-scroll {
overflow-x: scroll;
}