Update payment status and amount fields in user orders
This commit is contained in:
@@ -98,7 +98,7 @@
|
||||
<RowTemplate>
|
||||
<MudTd>@context.Id</MudTd>
|
||||
<MudTd>@context.UserFullName (@context.UserNationalCode)</MudTd>
|
||||
<MudTd>@context.Price.ToString("N0")</MudTd>
|
||||
<MudTd>@context.Amount.ToString("N0")</MudTd>
|
||||
<MudTd>@context.PaymentDate.ToDateTime().ToLocalTime().ToString("yyyy/MM/dd HH:mm")</MudTd>
|
||||
</RowTemplate>
|
||||
</MudTable>
|
||||
@@ -137,10 +137,10 @@
|
||||
if (orderResult != null && orderResult.Models != null)
|
||||
{
|
||||
_totalOrders = orderResult.MetaData?.TotalCount ?? 0;
|
||||
_paidOrders = orderResult.Models.Count(m => m.PaymentStatus);
|
||||
_paidOrders = orderResult.Models.Count(m => m.PaymentStatus==PaymentStatus.Success);
|
||||
_totalPaidAmount = orderResult.Models
|
||||
.Where(m => m.PaymentStatus)
|
||||
.Aggregate(0L, (sum, m) => sum + m.Price);
|
||||
.Where(m => m.PaymentStatus==PaymentStatus.Success)
|
||||
.Aggregate(0L, (sum, m) => sum + m.Amount);
|
||||
|
||||
foreach (var item in orderResult.Models.OrderByDescending(m => m.PaymentDate).Take(5))
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
@using BackOffice.BFF.Products.Protobuf.Protos.Products
|
||||
@using BackOffice.Common.BaseComponents
|
||||
@using Microsoft.AspNetCore.Components.Forms
|
||||
|
||||
<MudDialog>
|
||||
@@ -78,9 +79,14 @@
|
||||
<MudPaper Class="pa-2">
|
||||
<div style="position:relative; cursor:pointer;"
|
||||
@onclick="@(() => OpenPreview(item))">
|
||||
<img src="@item.ImageThumbnailPath"
|
||||
alt="@item.Title"
|
||||
style="width:100%; height:120px; object-fit:cover; border-radius:4px;" />
|
||||
@* <img src="@item.ImageThumbnailPath" *@
|
||||
@* alt="@item.Title" *@
|
||||
@* style="width:100%; height:120px; object-fit:cover; border-radius:4px;" /> *@
|
||||
<Image Src="@item.ImageThumbnailPath"
|
||||
Width="25"
|
||||
Height="25"
|
||||
ObjectPosition="ObjectPosition.Center"
|
||||
ObjectFit="ObjectFit.Fill" />
|
||||
<MudIconButton Icon="@Icons.Material.Filled.DeleteOutline"
|
||||
Color="Color.Error"
|
||||
Size="Size.Small"
|
||||
|
||||
@@ -26,21 +26,24 @@
|
||||
<MudStack Spacing="1">
|
||||
<MudText Typo="Typo.subtitle2">خلاصه سفارش</MudText>
|
||||
<MudDivider />
|
||||
<MudText Typo="Typo.body2">مبلغ: @_model.Price.ToString("N0") تومان</MudText>
|
||||
<MudText Typo="Typo.body2">مبلغ: @_model.Amount.ToString("N0") تومان</MudText>
|
||||
<MudText Typo="Typo.body2">شناسه پرداخت: @_model.TransactionId</MudText>
|
||||
<MudText Typo="Typo.body2">
|
||||
تاریخ پرداخت:
|
||||
@_model.PaymentDate.ToDateTime().ToLocalTime().ToString("yyyy/MM/dd HH:mm")
|
||||
@_model.PaymentDate.ToDateTime().ToLocalTime().MiladiToJalaliWithTime()
|
||||
</MudText>
|
||||
<MudText Typo="Typo.body2">
|
||||
روش پرداخت:
|
||||
@GetPaymentMethodText(_model.PaymentMethod)
|
||||
@GetPaymentMethodText(_model.PaymentMethod.GetHashCode())
|
||||
</MudText>
|
||||
<MudText Typo="Typo.body2">
|
||||
وضعیت پرداخت:
|
||||
@if (_model.PaymentStatus)
|
||||
@if (_model.PaymentStatus==PaymentStatus.Success)
|
||||
{
|
||||
<MudChip T="string" Color="Color.Success" Size="Size.Small">پرداخت شده</MudChip>
|
||||
}else if (_model.PaymentStatus==PaymentStatus.Pending)
|
||||
{
|
||||
<MudChip T="string" Color="Color.Success" Size="Size.Small">در انتظار پرداخت</MudChip>
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -29,7 +29,7 @@ public partial class UserOrderDetailsDialog
|
||||
|
||||
if (_model is not null)
|
||||
{
|
||||
_deliveryStatusValue = _model.DeliveryStatus;
|
||||
_deliveryStatusValue = _model.DeliveryStatus.GetHashCode();
|
||||
_trackingCode = _model.TrackingCode;
|
||||
_deliveryDescription = _model.DeliveryDescription;
|
||||
}
|
||||
|
||||
@@ -6,21 +6,22 @@
|
||||
@using BackOffice.Common.BaseComponents
|
||||
@using DataModel = BackOffice.BFF.UserOrder.Protobuf.Protos.UserOrder.GetAllUserOrderByFilterResponseModel
|
||||
|
||||
<BackOffice.Common.BaseComponents.BasePageComponent @ref="_basePage" OnClearFilterClick="OnFilterCleared" OnSubmitClick="OnFilterSubmit">
|
||||
<BackOffice.Common.BaseComponents.BasePageComponent @ref="_basePage" OnClearFilterClick="OnFilterCleared"
|
||||
OnSubmitClick="OnFilterSubmit">
|
||||
<Filters>
|
||||
<MudNumericField HideSpinButtons="true"
|
||||
T="long?"
|
||||
Clearable="true"
|
||||
Label="قیمت"
|
||||
@bind-Value="@_request.Filter.Price"
|
||||
@bind-Value="@_request.Filter.Amount"
|
||||
Variant="Variant.Outlined"
|
||||
Margin="Margin.Dense" />
|
||||
Margin="Margin.Dense"/>
|
||||
|
||||
<MudDatePicker T="DateTime?"
|
||||
Label="از تاریخ پرداخت"
|
||||
@bind-Date="_paymentDateFrom"
|
||||
Variant="Variant.Outlined"
|
||||
Margin="Margin.Dense" />
|
||||
Margin="Margin.Dense"/>
|
||||
|
||||
<MudSelect T="int?"
|
||||
Clearable="true"
|
||||
@@ -55,13 +56,14 @@
|
||||
</MudSelect>
|
||||
</Filters>
|
||||
<Content>
|
||||
<MudDataGrid T="DataModel" ServerData="@(new Func<GridState<DataModel>, Task<GridData<DataModel>>>(ServerReload))"
|
||||
<MudDataGrid T="DataModel"
|
||||
ServerData="@(new Func<GridState<DataModel>, Task<GridData<DataModel>>>(ServerReload))"
|
||||
Hover="true" @ref="_gridData" Height="72vh">
|
||||
<ColGroup>
|
||||
<col />
|
||||
<col />
|
||||
<col />
|
||||
<col style="width: 58px;" />
|
||||
<col/>
|
||||
<col/>
|
||||
<col/>
|
||||
<col style="width: 58px;"/>
|
||||
</ColGroup>
|
||||
<ToolBarContent>
|
||||
<MudStack Row="true" Justify="Justify.SpaceBetween" AlignItems="AlignItems.Center">
|
||||
@@ -69,22 +71,27 @@
|
||||
</MudStack>
|
||||
</ToolBarContent>
|
||||
<Columns>
|
||||
<PropertyColumn Property="x => x.Id" Title="شناسه" />
|
||||
<PropertyColumn Property="x => x.Price" Title="مبلغ" />
|
||||
<PropertyColumn Property="x => x.UserFullName" Title="نام کاربر" />
|
||||
<PropertyColumn Property="x => x.UserNationalCode" Title="کدملی" />
|
||||
<PropertyColumn Property="x => x.Id" Title="شناسه"/>
|
||||
<PropertyColumn Property="x => x.Amount" Title="مبلغ"/>
|
||||
<PropertyColumn Property="x => x.UserFullName" Title="نام کاربر"/>
|
||||
<PropertyColumn Property="x => x.UserNationalCode" Title="کدملی"/>
|
||||
<TemplateColumn Title="روش پرداخت">
|
||||
<CellTemplate>
|
||||
<MudChip T="string" Size="Size.Small">
|
||||
@GetPaymentMethodText(context.Item.PaymentMethod)
|
||||
@GetPaymentMethodText(context.Item.PaymentMethod.GetHashCode())
|
||||
</MudChip>
|
||||
</CellTemplate>
|
||||
</TemplateColumn>
|
||||
<PropertyColumn Property="x => x.PaymentStatus" Title="وضعیت پرداخت">
|
||||
<CellTemplate>
|
||||
@if (context.Item.PaymentStatus)
|
||||
@if (context.Item.PaymentStatus == PaymentStatus.Success)
|
||||
{
|
||||
<MudChip T="string" Color="Color.Success">پرداخت شده</MudChip>
|
||||
|
||||
}
|
||||
else if (context.Item.PaymentStatus == PaymentStatus.Pending)
|
||||
{
|
||||
<MudChip T="string" Color="Color.Success" Size="Size.Small">در انتظار پرداخت</MudChip>
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -92,7 +99,8 @@
|
||||
}
|
||||
</CellTemplate>
|
||||
</PropertyColumn>
|
||||
<PropertyColumn Property="x => x.TransactionId" Title="شناسه پرداخت" CellStyle="text-wrap: nowrap;" HeaderStyle="text-wrap: nowrap;" />
|
||||
<PropertyColumn Property="x => x.TransactionId" Title="شناسه پرداخت" CellStyle="text-wrap: nowrap;"
|
||||
HeaderStyle="text-wrap: nowrap;"/>
|
||||
<TemplateColumn Title="تاریخ پرداخت" CellStyle="text-wrap: nowrap;" HeaderStyle="text-wrap: nowrap;">
|
||||
<CellTemplate>
|
||||
@(context.Item.PaymentDate.ToDateTime().MiladiToJalaliWithTime())
|
||||
@@ -115,15 +123,15 @@
|
||||
<CellTemplate>
|
||||
<MudChip T="string"
|
||||
Size="Size.Small"
|
||||
Color="@GetDeliveryStatusColor(context.Item.DeliveryStatus)">
|
||||
@GetDeliveryStatusText(context.Item.DeliveryStatus)
|
||||
Color="@GetDeliveryStatusColor(context.Item.DeliveryStatus.GetHashCode())">
|
||||
@GetDeliveryStatusText(context.Item.DeliveryStatus.GetHashCode())
|
||||
</MudChip>
|
||||
</CellTemplate>
|
||||
</TemplateColumn>
|
||||
|
||||
|
||||
|
||||
<TemplateColumn StickyLeft="true" Title="عملیات" CellStyle="text-wrap: nowrap;" HeaderStyle="text-wrap: nowrap;">
|
||||
<TemplateColumn StickyLeft="true" Title="عملیات" CellStyle="text-wrap: nowrap;"
|
||||
HeaderStyle="text-wrap: nowrap;">
|
||||
<CellTemplate>
|
||||
<MudStack Row="true" AlignItems="AlignItems.Center">
|
||||
|
||||
@@ -132,18 +140,22 @@
|
||||
Size="Size.Small"
|
||||
ButtonType="ButtonType.Button"
|
||||
OnClick="@(() => OpenDetails(context.Item))"
|
||||
Style="cursor:pointer;" />
|
||||
Style="cursor:pointer;"/>
|
||||
</MudTooltip>
|
||||
|
||||
<MudTooltip Text="آرشیو">
|
||||
<MudIconButton Icon="@Icons.Material.Filled.DeleteOutline" Size="Size.Small" ButtonType="ButtonType.Button" OnClick="@(() => OnDelete(context.Item))" Style="cursor:pointer;" />
|
||||
<MudIconButton Icon="@Icons.Material.Filled.DeleteOutline" Size="Size.Small"
|
||||
ButtonType="ButtonType.Button" OnClick="@(() => OnDelete(context.Item))"
|
||||
Style="cursor:pointer;"/>
|
||||
</MudTooltip>
|
||||
</MudStack>
|
||||
</CellTemplate>
|
||||
</TemplateColumn>
|
||||
</Columns>
|
||||
<PagerContent>
|
||||
<MudDataGridPager T="DataModel" PageSizeOptions=@(new int[] { 30, 60, 90 }) InfoFormat="سطر {first_item} تا {last_item} از {all_items}" RowsPerPageString="تعداد سطرهای صفحه" />
|
||||
<MudDataGridPager T="DataModel" PageSizeOptions=@(new int[] { 30, 60, 90 })
|
||||
InfoFormat="سطر {first_item} تا {last_item} از {all_items}"
|
||||
RowsPerPageString="تعداد سطرهای صفحه"/>
|
||||
</PagerContent>
|
||||
</MudDataGrid>
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ public partial class UserOrderMainPage
|
||||
|
||||
if (_paymentStatusFilter.HasValue)
|
||||
{
|
||||
_request.Filter.PaymentStatus = _paymentStatusFilter.Value == 1;
|
||||
_request.Filter.PaymentStatus = _paymentStatusFilter;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user