Update payment status and amount fields in user orders

This commit is contained in:
masoodafar-web
2025-11-28 04:04:33 +03:30
parent de8d1158a8
commit 1bce6f3198
6 changed files with 61 additions and 40 deletions
@@ -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())
@@ -103,10 +111,10 @@
<MudTooltip Text="@context.Item.UserAddressText">
<MudText Typo="Typo.body2">
@(string.IsNullOrWhiteSpace(context.Item.UserAddressText)
? "-"
: (context.Item.UserAddressText.Length > 30
? context.Item.UserAddressText.Substring(0, 30) + "..."
: context.Item.UserAddressText))
? "-"
: (context.Item.UserAddressText.Length > 30
? context.Item.UserAddressText.Substring(0, 30) + "..."
: context.Item.UserAddressText))
</MudText>
</MudTooltip>
</CellTemplate>
@@ -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>