Merge branch 'kub-stage' into production
Build and Deploy to Production / build-and-deploy (push) Failing after 20m45s
Build and Deploy to Production / build-and-deploy (push) Failing after 20m45s
This commit is contained in:
+36
-4
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
- **مسیر wrapper سرویسها:** `BackOffice/src/BackOffice/Services/`
|
- **مسیر wrapper سرویسها:** `BackOffice/src/BackOffice/Services/`
|
||||||
- **ثبت gRPC:** `BackOffice/src/BackOffice/Common/Configure/ConfigureService.cs`
|
- **ثبت gRPC:** `BackOffice/src/BackOffice/Common/Configure/ConfigureService.cs`
|
||||||
- **تاریخ:** ۱۴۰۵/۰۳/۱۷
|
- **تاریخ:** ۱۴۰۵/۰۳/۱۷ (بروز: خرداد ۱۴۰۵ — گزارشهای read-only + proto 0.0.201؛ **بروز ۱۴۰۵/۰۳/۱۸ — دفتر تراکنشهای مالی proto 0.0.203**)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -138,13 +138,26 @@
|
|||||||
|
|
||||||
## ۱۰. پرداخت دستی و تراکنشها
|
## ۱۰. پرداخت دستی و تراکنشها
|
||||||
|
|
||||||
|
> **دو گزارش تراکنش — اشتباه نگیرید:**
|
||||||
|
>
|
||||||
|
> | مسیر | جدول DB | کاربرد |
|
||||||
|
> |------|---------|--------|
|
||||||
|
> | `/payment/transactions` | `PaymentTransactions` | ممیزی درگاه (Authority، ZarinPal، کارت) |
|
||||||
|
> | `/payment/ledger-transactions` | `Transactions` | دفتر مالی داخلی (نوع تراکنش، وضعیت، RefId) |
|
||||||
|
|
||||||
| # | سرویس / متد | gRPC Contract | صفحه / کامپوننت | کاربرد |
|
| # | سرویس / متد | gRPC Contract | صفحه / کامپوننت | کاربرد |
|
||||||
|---|-------------|---------------|-----------------|--------|
|
|---|-------------|---------------|-----------------|--------|
|
||||||
| 10.1 | `ManualPaymentContract.GetAllManualPayments` | `ManualPaymentContract` | `/payment/manual-payments` | لیست پرداختهای دستی |
|
| 10.1 | `ManualPaymentContract.GetAllManualPayments` | `ManualPaymentContract` | `/payment/manual-payments` | لیست پرداختهای دستی |
|
||||||
| 10.2 | `ManualPaymentContract.CreateManualPayment` | `ManualPaymentContract` | `ManualPaymentDialog` | ثبت پرداخت دستی (مثلاً Daya) |
|
| 10.2 | `ManualPaymentContract.CreateManualPayment` | `ManualPaymentContract` | `ManualPaymentDialog` | ثبت پرداخت دستی (مثلاً Daya) |
|
||||||
| 10.3 | `ManualPaymentContract.ApproveManualPayment` | `ManualPaymentContract` | ManualPayments, Dialog | تأیید پرداخت |
|
| 10.3 | `ManualPaymentContract.ApproveManualPayment` | `ManualPaymentContract` | ManualPayments, Dialog | تأیید پرداخت |
|
||||||
| 10.4 | `ManualPaymentContract.RejectManualPayment` | `ManualPaymentContract` | ManualPayments, Dialog | رد پرداخت |
|
| 10.4 | `ManualPaymentContract.RejectManualPayment` | `ManualPaymentContract` | ManualPayments, Dialog | رد پرداخت |
|
||||||
| 10.5 | `/payment/transactions` | — | Transactions page | **TODO — هنوز به API وصل نشده** |
|
| 10.5 | `PaymentTransactionContract.GetAllPaymentTransactionByFilter` | `PaymentTransactionContract` | `/payment/transactions` | گزارش read-only تراکنش **درگاه** (`PaymentTransactions`) |
|
||||||
|
| 10.5b | `PaymentTransactionContract.GetPaymentTransactionSummary` | `PaymentTransactionContract` | `/payment/transactions` | کارت خلاصه گزارش درگاه |
|
||||||
|
| 10.6 | `TransactionsContract.GetAllTransactionsByFilter` | `TransactionsContract` | `/payment/ledger-transactions` | گزارش read-only **دفتر مالی** (`Transactions`) |
|
||||||
|
| 10.7 | `TransactionsContract.GetTransactionSummary` | `TransactionsContract` | `/payment/ledger-transactions` | کارت خلاصه دفتر تراکنش |
|
||||||
|
| 10.8 | `UserPackagePurchaseContract.GetAllUserPackagePurchaseByFilter` | `UserPackagePurchaseContract` | `/club/purchases` | گزارش خرید پکیج |
|
||||||
|
| 10.9 | `ClubMembershipCycleContract.GetAllClubMembershipCycleByFilter` | `ClubMembershipCycleContract` | `/club/cycles` | گزارش دوره عضویت |
|
||||||
|
| 10.10 | `ClubMembershipCycleHistoryContract.GetAllClubMembershipCycleHistoryByFilter` | `ClubMembershipCycleHistoryContract` | `/club/history` (زیرتب دوره) | تاریخچه تغییرات دوره |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -206,7 +219,7 @@
|
|||||||
| 15.1 | `ClubMembershipContract.GetAllClubMemberships` | `ClubMembershipContract` | `/club/members`, Index | لیست اعضا |
|
| 15.1 | `ClubMembershipContract.GetAllClubMemberships` | `ClubMembershipContract` | `/club/members`, Index | لیست اعضا |
|
||||||
| 15.2 | `ClubMembershipContract.ActivateClubMembership` | `ClubMembershipContract` | `ActivateClubDialog` | فعالسازی دستی عضویت |
|
| 15.2 | `ClubMembershipContract.ActivateClubMembership` | `ClubMembershipContract` | `ActivateClubDialog` | فعالسازی دستی عضویت |
|
||||||
| 15.3 | `ClubMembershipContract.DeactivateClubMembership` | `ClubMembershipContract` | `DeactivateClubDialog` | غیرفعالسازی |
|
| 15.3 | `ClubMembershipContract.DeactivateClubMembership` | `ClubMembershipContract` | `DeactivateClubDialog` | غیرفعالسازی |
|
||||||
| 15.4 | `ClubMembershipContract.GetClubMembershipHistory` | `ClubMembershipContract` | `MemberDetailsDialog` | تاریخچه عضویت |
|
| 15.4 | `ClubMembershipContract.GetClubMembershipHistory` | `ClubMembershipContract` | `/club/history` (زیرتب عضویت) | گزارش تاریخچه عضویت |
|
||||||
| 15.5 | `ClubMembershipContract.GetClubStatistics` | `ClubMembershipContract` | `/club/statistics` | آمار باشگاه |
|
| 15.5 | `ClubMembershipContract.GetClubStatistics` | `ClubMembershipContract` | `/club/statistics` | آمار باشگاه |
|
||||||
| 15.6 | `ConfigurationContract.GetClubFeatures` | `ConfigurationContract` | `/club/features` | لیست featureهای باشگاه |
|
| 15.6 | `ConfigurationContract.GetClubFeatures` | `ConfigurationContract` | `/club/features` | لیست featureهای باشگاه |
|
||||||
| 15.7 | `ClubMembershipContract.GetUserClubFeatures` | `ClubMembershipContract` | `/club/features` | featureهای یک کاربر |
|
| 15.7 | `ClubMembershipContract.GetUserClubFeatures` | `ClubMembershipContract` | `/club/features` | featureهای یک کاربر |
|
||||||
@@ -316,7 +329,6 @@
|
|||||||
| سرویس / صفحه | وضعیت |
|
| سرویس / صفحه | وضعیت |
|
||||||
|--------------|--------|
|
|--------------|--------|
|
||||||
| `IBlogPostImageService` (`BlogPostImageContract`) | ثبت در DI؛ **هیچ صفحهای inject نمیکند** |
|
| `IBlogPostImageService` (`BlogPostImageContract`) | ثبت در DI؛ **هیچ صفحهای inject نمیکند** |
|
||||||
| `/payment/transactions` | UI آماده؛ **LoadData خالی — API وصل نشده** |
|
|
||||||
| `RolePermissionsDialog` | UI permission؛ **ذخیره در backend TODO** |
|
| `RolePermissionsDialog` | UI permission؛ **ذخیره در backend TODO** |
|
||||||
| `AuthorizationService` | فقط JWT role؛ **Permission API از CMS/BFF TODO** |
|
| `AuthorizationService` | فقط JWT role؛ **Permission API از CMS/BFF TODO** |
|
||||||
| `/system/alerts` | داده mock؛ **AlertContract وجود ندارد** |
|
| `/system/alerts` | داده mock؛ **AlertContract وجود ندارد** |
|
||||||
@@ -349,6 +361,11 @@ flowchart LR
|
|||||||
| `CategoryContract` | Categories |
|
| `CategoryContract` | Categories |
|
||||||
| `UserOrderContract` | Orders |
|
| `UserOrderContract` | Orders |
|
||||||
| `ManualPaymentContract` | Manual payments |
|
| `ManualPaymentContract` | Manual payments |
|
||||||
|
| `PaymentTransactionContract` | Gateway transaction report (`/payment/transactions`) |
|
||||||
|
| `TransactionsContract` | Ledger transaction report (`/payment/ledger-transactions`) |
|
||||||
|
| `UserPackagePurchaseContract` | Club package purchase report |
|
||||||
|
| `ClubMembershipCycleContract` | Club cycle report |
|
||||||
|
| `ClubMembershipCycleHistoryContract` | Club cycle history report |
|
||||||
| `UserWalletContract` | Wallet management |
|
| `UserWalletContract` | Wallet management |
|
||||||
| `UserWalletHistoryContract` | Wallet change log |
|
| `UserWalletHistoryContract` | Wallet change log |
|
||||||
| `UserContractContract` | Signed contracts |
|
| `UserContractContract` | Signed contracts |
|
||||||
@@ -385,3 +402,18 @@ flowchart LR
|
|||||||
| Wallet | My balances | All users wallet + history log |
|
| Wallet | My balances | All users wallet + history log |
|
||||||
|
|
||||||
مرجع مشابه برای فرانت مشتری: [`FrontOffice/docs/CUSTOMER-SERVICES.md`](../FrontOffice/docs/CUSTOMER-SERVICES.md)
|
مرجع مشابه برای فرانت مشتری: [`FrontOffice/docs/CUSTOMER-SERVICES.md`](../FrontOffice/docs/CUSTOMER-SERVICES.md)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## یادداشت deploy (خرداد ۱۴۰۵)
|
||||||
|
|
||||||
|
| گام | جزئیات |
|
||||||
|
|-----|--------|
|
||||||
|
| Proto | `Foursat.CMSMicroservice.Protobuf` **0.0.203** (گزارش دفتر تراکنش) |
|
||||||
|
| CMS | deploy WebApi (شامل `GetTransactionSummary` + فیلتر تاریخ) |
|
||||||
|
| BackOffice | NuGet 0.0.203 یا ProjectReference در monorepo |
|
||||||
|
| FrontOffice | **redeploy لازم نیست** برای گزارش ledger؛ برای شارژ کیف اصلی proto **0.0.202** لازم است |
|
||||||
|
|
||||||
|
گزارشهای read-only (بخش ۱۰ و ۱۵): فقط فیلتر + grid + summary + CSV — بدون CRUD یا detail dialog.
|
||||||
|
|
||||||
|
مستندات فنی کامل: [`totalDoc/technical/TECH-08-SESSION-LOG-202606.md`](../../totalDoc/technical/TECH-08-SESSION-LOG-202606.md) — §10 Ledger transactions
|
||||||
|
|||||||
@@ -138,9 +138,12 @@
|
|||||||
<!-- This enables direct communication with CMS (no BFF needed) -->
|
<!-- This enables direct communication with CMS (no BFF needed) -->
|
||||||
<!-- ============================================================ -->
|
<!-- ============================================================ -->
|
||||||
|
|
||||||
<!-- CMS Protobuf NuGet package (used for both local dev and Docker builds) -->
|
<!-- CMS Protobuf: NuGet in CI/Docker; ProjectReference for local monorepo dev -->
|
||||||
<ItemGroup>
|
<ItemGroup Condition="Exists('../../../CMS/src/CMSMicroservice.Protobuf/CMSMicroservice.Protobuf.csproj')">
|
||||||
<PackageReference Include="Foursat.CMSMicroservice.Protobuf" Version="0.0.200" />
|
<ProjectReference Include="../../../CMS/src/CMSMicroservice.Protobuf/CMSMicroservice.Protobuf.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup Condition="!Exists('../../../CMS/src/CMSMicroservice.Protobuf/CMSMicroservice.Protobuf.csproj')">
|
||||||
|
<PackageReference Include="Foursat.CMSMicroservice.Protobuf" Version="0.0.203" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<!-- ============================================================ -->
|
<!-- ============================================================ -->
|
||||||
|
|||||||
@@ -31,6 +31,11 @@ using CMSMicroservice.Protobuf.Protos.SitePageSettings;
|
|||||||
using CMSMicroservice.Protobuf.Protos.UserContract;
|
using CMSMicroservice.Protobuf.Protos.UserContract;
|
||||||
using CMSMicroservice.Protobuf.Protos.UserWallet;
|
using CMSMicroservice.Protobuf.Protos.UserWallet;
|
||||||
using CMSMicroservice.Protobuf.Protos.UserWalletHistory;
|
using CMSMicroservice.Protobuf.Protos.UserWalletHistory;
|
||||||
|
using CMSMicroservice.Protobuf.Protos.PaymentTransaction;
|
||||||
|
using CMSMicroservice.Protobuf.Protos.Transactions;
|
||||||
|
using CMSMicroservice.Protobuf.Protos.UserPackagePurchase;
|
||||||
|
using CMSMicroservice.Protobuf.Protos.ClubMembershipCycle;
|
||||||
|
using CMSMicroservice.Protobuf.Protos.ClubMembershipCycleHistory;
|
||||||
using BackOffice.Common.Utilities;
|
using BackOffice.Common.Utilities;
|
||||||
using BackOffice.Services.DiscountProduct;
|
using BackOffice.Services.DiscountProduct;
|
||||||
using BackOffice.Services.DiscountCategory;
|
using BackOffice.Services.DiscountCategory;
|
||||||
@@ -169,6 +174,13 @@ public static class ConfigureServices
|
|||||||
services.AddTransient(sp => new UserWalletContract.UserWalletContractClient(sp.GetRequiredService<CallInvoker>()));
|
services.AddTransient(sp => new UserWalletContract.UserWalletContractClient(sp.GetRequiredService<CallInvoker>()));
|
||||||
services.AddTransient(sp => new UserWalletHistoryContract.UserWalletHistoryContractClient(sp.GetRequiredService<CallInvoker>()));
|
services.AddTransient(sp => new UserWalletHistoryContract.UserWalletHistoryContractClient(sp.GetRequiredService<CallInvoker>()));
|
||||||
|
|
||||||
|
// Admin Report Services
|
||||||
|
services.AddTransient(sp => new PaymentTransactionContract.PaymentTransactionContractClient(sp.GetRequiredService<CallInvoker>()));
|
||||||
|
services.AddTransient(sp => new TransactionsContract.TransactionsContractClient(sp.GetRequiredService<CallInvoker>()));
|
||||||
|
services.AddTransient(sp => new UserPackagePurchaseContract.UserPackagePurchaseContractClient(sp.GetRequiredService<CallInvoker>()));
|
||||||
|
services.AddTransient(sp => new ClubMembershipCycleContract.ClubMembershipCycleContractClient(sp.GetRequiredService<CallInvoker>()));
|
||||||
|
services.AddTransient(sp => new ClubMembershipCycleHistoryContract.ClubMembershipCycleHistoryContractClient(sp.GetRequiredService<CallInvoker>()));
|
||||||
|
|
||||||
return services;
|
return services;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,81 @@
|
|||||||
|
namespace BackOffice.Common.Utilities;
|
||||||
|
|
||||||
|
using CMSMicroservice.Protobuf.Protos;
|
||||||
|
using MudBlazor;
|
||||||
|
|
||||||
|
public static class ReportLabels
|
||||||
|
{
|
||||||
|
public static string GetPaymentStatusLabel(bool success) => success ? "موفق" : "در انتظار / ناموفق";
|
||||||
|
|
||||||
|
public static string GetTransactionPaymentStatusLabel(PaymentStatus? status) => status switch
|
||||||
|
{
|
||||||
|
PaymentStatus.Success => "موفق",
|
||||||
|
PaymentStatus.Pending => "در انتظار",
|
||||||
|
PaymentStatus.Reject => "رد شده",
|
||||||
|
_ => "—"
|
||||||
|
};
|
||||||
|
|
||||||
|
public static Color GetTransactionPaymentStatusColor(PaymentStatus? status) => status switch
|
||||||
|
{
|
||||||
|
PaymentStatus.Success => Color.Success,
|
||||||
|
PaymentStatus.Pending => Color.Warning,
|
||||||
|
PaymentStatus.Reject => Color.Error,
|
||||||
|
_ => Color.Default
|
||||||
|
};
|
||||||
|
|
||||||
|
public static string GetTransactionTypeLabel(TransactionType? type) => type switch
|
||||||
|
{
|
||||||
|
TransactionType.Buy => "خرید",
|
||||||
|
TransactionType.DepositIpg => "واریز درگاه",
|
||||||
|
TransactionType.DepositExternal1 => "واریز خارجی",
|
||||||
|
TransactionType.Withdraw => "برداشت",
|
||||||
|
TransactionType.NetworkCommission => "کمیسیون شبکه",
|
||||||
|
TransactionType.ClubActivation => "فعالسازی باشگاه",
|
||||||
|
TransactionType.DiscountWalletCharge => "شارژ کیف تخفیف",
|
||||||
|
TransactionType.DiscountShopPurchase => "خرید فروشگاه تخفیف",
|
||||||
|
TransactionType.MagicWalletDeposit => "واریز کیف جادویی",
|
||||||
|
TransactionType.MagicWalletBonus => "بونوس کیف جادویی",
|
||||||
|
TransactionType.CreditWalletCharge => "شارژ کیف اصلی",
|
||||||
|
_ => type?.ToString() ?? "—"
|
||||||
|
};
|
||||||
|
|
||||||
|
public static string GetPurchaseMethodLabel(int method) => method switch
|
||||||
|
{
|
||||||
|
1 => "وام دایا",
|
||||||
|
2 => "خرید مستقیم",
|
||||||
|
_ => "نامشخص"
|
||||||
|
};
|
||||||
|
|
||||||
|
public static string GetClubMembershipActionLabel(int action) => action switch
|
||||||
|
{
|
||||||
|
0 => "فعالسازی",
|
||||||
|
1 => "غیرفعالسازی",
|
||||||
|
2 => "ویرایش",
|
||||||
|
3 => "اصلاح دستی",
|
||||||
|
_ => action.ToString()
|
||||||
|
};
|
||||||
|
|
||||||
|
public static string GetClubCycleActionLabel(int action) => action switch
|
||||||
|
{
|
||||||
|
0 => "شروع دوره",
|
||||||
|
1 => "ورود به حالت جادویی",
|
||||||
|
2 => "پایان حالت جادویی",
|
||||||
|
3 => "تکمیل دوره",
|
||||||
|
4 => "لغو",
|
||||||
|
5 => "اصلاح دستی",
|
||||||
|
_ => action.ToString()
|
||||||
|
};
|
||||||
|
|
||||||
|
public static string GetMagicStateLabel(int? magicStarted, DateTime? started, DateTime? completed)
|
||||||
|
{
|
||||||
|
if (completed.HasValue) return "جادویی تکمیلشده";
|
||||||
|
if (started.HasValue) return "در حالت جادویی";
|
||||||
|
return "عادی";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string FormatActiveChange(bool oldActive, bool newActive) =>
|
||||||
|
$"{(oldActive ? "فعال" : "غیرفعال")} → {(newActive ? "فعال" : "غیرفعال")}";
|
||||||
|
|
||||||
|
public static string FormatBoolChange(bool oldValue, bool newValue) =>
|
||||||
|
$"{(oldValue ? "بله" : "خیر")} → {(newValue ? "بله" : "خیر")}";
|
||||||
|
}
|
||||||
@@ -1,17 +1,30 @@
|
|||||||
@page "/club"
|
@page "/club"
|
||||||
@page "/club/members"
|
@page "/club/members"
|
||||||
|
@page "/club/purchases"
|
||||||
|
@page "/club/cycles"
|
||||||
|
@page "/club/history"
|
||||||
@page "/club/statistics"
|
@page "/club/statistics"
|
||||||
@attribute [Authorize]
|
@attribute [Authorize]
|
||||||
|
@using BackOffice.Pages.Club.Reports
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<MudText Typo="Typo.h5" Class="mb-3">باشگاه مشتریان</MudText>
|
<MudText Typo="Typo.h5" Class="mb-3">باشگاه مشتریان</MudText>
|
||||||
|
|
||||||
<MudTabs Elevation="0" Rounded="true" Border="true" ApplyEffectsToContainer="true"
|
<MudTabs Elevation="0" Rounded="true" Border="true" ApplyEffectsToContainer="true"
|
||||||
PanelClass="pt-4" @bind-ActivePanelIndex="_activeTab">
|
PanelClass="pt-4" @bind-ActivePanelIndex="_activeTab">
|
||||||
<MudTabPanel Text="اعضای باشگاه" Icon="@Icons.Material.Filled.Groups">
|
<MudTabPanel Text="اعضا" Icon="@Icons.Material.Filled.Groups">
|
||||||
<ClubMembers />
|
<ClubMembers />
|
||||||
</MudTabPanel>
|
</MudTabPanel>
|
||||||
<MudTabPanel Text="آمار باشگاه" Icon="@Icons.Material.Filled.PieChart">
|
<MudTabPanel Text="گزارش خرید پکیج" Icon="@Icons.Material.Filled.ShoppingBag">
|
||||||
|
<ClubPackagePurchasesReport />
|
||||||
|
</MudTabPanel>
|
||||||
|
<MudTabPanel Text="گزارش دورهها" Icon="@Icons.Material.Filled.Loop">
|
||||||
|
<ClubCyclesReport />
|
||||||
|
</MudTabPanel>
|
||||||
|
<MudTabPanel Text="گزارش تاریخچه" Icon="@Icons.Material.Filled.History">
|
||||||
|
<ClubHistoriesReport />
|
||||||
|
</MudTabPanel>
|
||||||
|
<MudTabPanel Text="آمار" Icon="@Icons.Material.Filled.PieChart">
|
||||||
<Statistics />
|
<Statistics />
|
||||||
</MudTabPanel>
|
</MudTabPanel>
|
||||||
</MudTabs>
|
</MudTabs>
|
||||||
@@ -25,7 +38,10 @@
|
|||||||
var uri = Navigation.ToBaseRelativePath(Navigation.Uri).ToLowerInvariant().TrimEnd('/');
|
var uri = Navigation.ToBaseRelativePath(Navigation.Uri).ToLowerInvariant().TrimEnd('/');
|
||||||
_activeTab = uri switch
|
_activeTab = uri switch
|
||||||
{
|
{
|
||||||
"club/statistics" => 1,
|
"club/purchases" => 1,
|
||||||
|
"club/cycles" => 2,
|
||||||
|
"club/history" => 3,
|
||||||
|
"club/statistics" => 4,
|
||||||
_ => 0
|
_ => 0
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,23 +33,11 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><strong>پکیج:</strong></td>
|
<td><strong>پکیج:</strong></td>
|
||||||
<td>@Member.PackageName</td>
|
<td>@(string.IsNullOrEmpty(Member.PackageName) ? "—" : Member.PackageName)</td>
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><strong>کد فعالسازی:</strong></td>
|
|
||||||
<td dir="ltr">@Member.ActivationCode</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><strong>تاریخ فعالسازی:</strong></td>
|
<td><strong>تاریخ فعالسازی:</strong></td>
|
||||||
<td>@Member.ActivatedAt.ToDateTime().ToLocalTime().MiladiToJalaliWithTime()</td>
|
<td>@(Member.ActivatedAt != null ? Member.ActivatedAt.ToDateTime().ToLocalTime().MiladiToJalaliWithTime() : "—")</td>
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><strong>تاریخ انقضا:</strong></td>
|
|
||||||
<td>
|
|
||||||
<MudText Color="@(Member.IsExpired ? Color.Error : Color.Success)">
|
|
||||||
@Member.ExpiresAt.ToDateTime().ToLocalTime().MiladiToJalaliWithTime()
|
|
||||||
</MudText>
|
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><strong>وضعیت:</strong></td>
|
<td><strong>وضعیت:</strong></td>
|
||||||
@@ -61,60 +49,17 @@
|
|||||||
</MudChip>
|
</MudChip>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
|
||||||
<td><strong>منقضی شده:</strong></td>
|
|
||||||
<td>
|
|
||||||
<MudChip T="string"
|
|
||||||
Color="@(Member.IsExpired ? Color.Warning : Color.Default)"
|
|
||||||
Size="Size.Small">
|
|
||||||
@(Member.IsExpired ? "بله" : "خیر")
|
|
||||||
</MudChip>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</MudSimpleTable>
|
|
||||||
</MudPaper>
|
|
||||||
|
|
||||||
<MudPaper Class="pa-3" Elevation="0">
|
|
||||||
<MudText Typo="Typo.h6" Color="Color.Primary">تاریخچه</MudText>
|
|
||||||
<MudDivider Class="my-2" />
|
|
||||||
<MudSimpleTable Dense="true">
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
<tr>
|
||||||
<td><strong>تاریخ ایجاد:</strong></td>
|
<td><strong>تاریخ ایجاد:</strong></td>
|
||||||
<td>@Member.Created.ToDateTime().ToLocalTime().MiladiToJalaliWithTime()</td>
|
<td>@Member.Created.ToDateTime().ToLocalTime().MiladiToJalaliWithTime()</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</MudSimpleTable>
|
</MudSimpleTable>
|
||||||
|
|
||||||
@if (_historyLoading)
|
|
||||||
{
|
|
||||||
<MudProgressLinear Indeterminate="true" Color="Color.Primary" Class="my-2" />
|
|
||||||
}
|
|
||||||
else if (_history.Any())
|
|
||||||
{
|
|
||||||
<MudTable T="ClubMembershipHistoryModel" Items="_history" Dense="true" Hover="true" Class="mt-2">
|
|
||||||
<HeaderContent>
|
|
||||||
<MudTh>عملیات</MudTh>
|
|
||||||
<MudTh>تاریخ</MudTh>
|
|
||||||
<MudTh>دلیل</MudTh>
|
|
||||||
<MudTh>توسط</MudTh>
|
|
||||||
</HeaderContent>
|
|
||||||
<RowTemplate>
|
|
||||||
<MudTd DataLabel="عملیات">
|
|
||||||
<MudChip T="string" Size="Size.Small" Color="Color.Info">@context.Action</MudChip>
|
|
||||||
</MudTd>
|
|
||||||
<MudTd DataLabel="تاریخ">@context.Created.ToDateTime().ToLocalTime().MiladiToJalaliWithTime()</MudTd>
|
|
||||||
<MudTd DataLabel="دلیل">@(string.IsNullOrEmpty(context.Reason) ? "-" : context.Reason)</MudTd>
|
|
||||||
<MudTd DataLabel="توسط">@(string.IsNullOrEmpty(context.PerformedBy) ? "-" : context.PerformedBy)</MudTd>
|
|
||||||
</RowTemplate>
|
|
||||||
</MudTable>
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
<MudText Typo="Typo.caption" Color="Color.Secondary" Class="mt-2">تاریخچهای یافت نشد.</MudText>
|
|
||||||
}
|
|
||||||
</MudPaper>
|
</MudPaper>
|
||||||
|
|
||||||
|
<MudAlert Severity="Severity.Info" Dense="true" Variant="Variant.Text">
|
||||||
|
تاریخچه تغییرات عضویت در تب «گزارش تاریخچه» باشگاه قابل مشاهده است.
|
||||||
|
</MudAlert>
|
||||||
</MudStack>
|
</MudStack>
|
||||||
}
|
}
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
@@ -126,39 +71,5 @@
|
|||||||
@code {
|
@code {
|
||||||
[CascadingParameter] IMudDialogInstance MudDialog { get; set; }
|
[CascadingParameter] IMudDialogInstance MudDialog { get; set; }
|
||||||
[Parameter] public ClubMembershipModel Member { get; set; }
|
[Parameter] public ClubMembershipModel Member { get; set; }
|
||||||
[Inject] public ClubMembershipContract.ClubMembershipContractClient ClubClient { get; set; }
|
|
||||||
|
|
||||||
private List<ClubMembershipHistoryModel> _history = new();
|
|
||||||
private bool _historyLoading;
|
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
|
||||||
{
|
|
||||||
await LoadHistory();
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task LoadHistory()
|
|
||||||
{
|
|
||||||
_historyLoading = true;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var request = new GetClubMembershipHistoryRequest
|
|
||||||
{
|
|
||||||
UserId = Member.UserId,
|
|
||||||
PageIndex = 0,
|
|
||||||
PageSize = 50
|
|
||||||
};
|
|
||||||
var response = await ClubClient.GetClubMembershipHistoryAsync(request);
|
|
||||||
_history = response.Models?.ToList() ?? new();
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
_history = new();
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
_historyLoading = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Close() => MudDialog.Close();
|
private void Close() => MudDialog.Close();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,153 @@
|
|||||||
|
@using BackOffice.Common.BaseComponents
|
||||||
|
@using BackOffice.Pages.AutoComplete
|
||||||
|
@using CMSMicroservice.Protobuf.Protos.ClubMembershipCycle
|
||||||
|
@using Google.Protobuf.WellKnownTypes
|
||||||
|
|
||||||
|
@inject ClubMembershipCycleContract.ClubMembershipCycleContractClient CycleClient
|
||||||
|
|
||||||
|
<MudAlert Severity="Severity.Info" Variant="Variant.Text" Dense="true" Class="mb-3">
|
||||||
|
گزارش دورههای عضویت باشگاه — هر خرید پکیج یک دور جدید ایجاد میکند.
|
||||||
|
</MudAlert>
|
||||||
|
|
||||||
|
<BasePageComponent @ref="_basePage" OnSubmitClick="OnFilterSubmit" OnClearFilterClick="OnFilterCleared">
|
||||||
|
<Filters>
|
||||||
|
<MudItem xs="12" sm="6" md="3">
|
||||||
|
<UserAutoComplete Label="کاربر" @bind-SelectedUserId="_userId" />
|
||||||
|
</MudItem>
|
||||||
|
<MudItem xs="12" sm="6" md="3">
|
||||||
|
<MudSelect T="bool?" Clearable="true" Label="دوره جاری" Variant="Variant.Outlined"
|
||||||
|
Margin="Margin.Dense" @bind-Value="_isCurrent">
|
||||||
|
<MudSelectItem T="bool?" Value="@((bool?)true)">فقط دوره جاری</MudSelectItem>
|
||||||
|
<MudSelectItem T="bool?" Value="@((bool?)false)">دورههای قبلی</MudSelectItem>
|
||||||
|
</MudSelect>
|
||||||
|
</MudItem>
|
||||||
|
<MudItem xs="12" sm="6" md="3">
|
||||||
|
<MudSelect T="int?" Clearable="true" Label="وضعیت جادویی" Variant="Variant.Outlined"
|
||||||
|
Margin="Margin.Dense" @bind-Value="_magicState">
|
||||||
|
<MudSelectItem T="int?" Value="0">عادی</MudSelectItem>
|
||||||
|
<MudSelectItem T="int?" Value="1">در حالت جادویی</MudSelectItem>
|
||||||
|
<MudSelectItem T="int?" Value="2">جادویی تکمیلشده</MudSelectItem>
|
||||||
|
</MudSelect>
|
||||||
|
</MudItem>
|
||||||
|
<MudItem xs="12" sm="6" md="4">
|
||||||
|
<DateRangePicker @bind-From="_fromDate" @bind-To="_toDate" Label="بازه خرید پکیج" />
|
||||||
|
</MudItem>
|
||||||
|
</Filters>
|
||||||
|
<Content>
|
||||||
|
<MudGrid Class="mb-3" Spacing="2">
|
||||||
|
<MudItem xs="4">
|
||||||
|
<MudPaper Class="pa-3" Outlined="true">
|
||||||
|
<MudText Typo="Typo.caption" Color="Color.Secondary">کل دورهها</MudText>
|
||||||
|
<MudText Typo="Typo.h6">@_totalCount.ToString("N0")</MudText>
|
||||||
|
</MudPaper>
|
||||||
|
</MudItem>
|
||||||
|
<MudItem xs="4">
|
||||||
|
<MudPaper Class="pa-3" Outlined="true">
|
||||||
|
<MudText Typo="Typo.caption" Color="Color.Secondary">دوره جاری</MudText>
|
||||||
|
<MudText Typo="Typo.h6">@_currentCount.ToString("N0")</MudText>
|
||||||
|
</MudPaper>
|
||||||
|
</MudItem>
|
||||||
|
<MudItem xs="4">
|
||||||
|
<MudPaper Class="pa-3" Outlined="true">
|
||||||
|
<MudText Typo="Typo.caption" Color="Color.Secondary">جادویی فعال</MudText>
|
||||||
|
<MudText Typo="Typo.h6">@_magicActive.ToString("N0")</MudText>
|
||||||
|
</MudPaper>
|
||||||
|
</MudItem>
|
||||||
|
</MudGrid>
|
||||||
|
|
||||||
|
<MudDataGrid @ref="_grid" T="ClubMembershipCycleModel" ServerData="LoadData" ReadOnly="true"
|
||||||
|
Hover="true" Dense="true" Height="calc(100vh - 420px)">
|
||||||
|
<Columns>
|
||||||
|
<PropertyColumn Property="x => x.Id" Title="شناسه" />
|
||||||
|
<PropertyColumn Property="x => x.UserName" Title="کاربر" />
|
||||||
|
<PropertyColumn Property="x => x.CycleNumber" Title="شماره دور" />
|
||||||
|
<PropertyColumn Property="x => x.PackageName" Title="پکیج" />
|
||||||
|
<TemplateColumn Title="مبلغ (ریال)">
|
||||||
|
<CellTemplate>@context.Item.PackageAmount.ToString("N0")</CellTemplate>
|
||||||
|
</TemplateColumn>
|
||||||
|
<TemplateColumn Title="روش خرید">
|
||||||
|
<CellTemplate>@ReportLabels.GetPurchaseMethodLabel(context.Item.PurchaseMethod)</CellTemplate>
|
||||||
|
</TemplateColumn>
|
||||||
|
<TemplateColumn Title="تاریخ خرید">
|
||||||
|
<CellTemplate>@context.Item.PackagePurchasedAt.ToDateTime().ToLocalTime().MiladiToJalaliWithTime()</CellTemplate>
|
||||||
|
</TemplateColumn>
|
||||||
|
<TemplateColumn Title="وضعیت جادویی">
|
||||||
|
<CellTemplate>
|
||||||
|
@ReportLabels.GetMagicStateLabel(null,
|
||||||
|
context.Item.MagicStartedAt?.ToDateTime(),
|
||||||
|
context.Item.MagicCompletedAt?.ToDateTime())
|
||||||
|
</CellTemplate>
|
||||||
|
</TemplateColumn>
|
||||||
|
<TemplateColumn Title="دوره جاری">
|
||||||
|
<CellTemplate>
|
||||||
|
<MudChip T="string" Size="Size.Small" Color="@(context.Item.IsCurrentCycle ? Color.Success : Color.Default)">
|
||||||
|
@(context.Item.IsCurrentCycle ? "بله" : "خیر")
|
||||||
|
</MudChip>
|
||||||
|
</CellTemplate>
|
||||||
|
</TemplateColumn>
|
||||||
|
</Columns>
|
||||||
|
<NoRecordsContent>
|
||||||
|
<MudAlert Severity="Severity.Info" Dense="true" Variant="Variant.Text" Class="my-4">موردی یافت نشد.</MudAlert>
|
||||||
|
</NoRecordsContent>
|
||||||
|
<PagerContent>
|
||||||
|
<MudDataGridPager T="ClubMembershipCycleModel" PageSizeOptions="@(new int[] { 20, 50, 100 })"
|
||||||
|
InfoFormat="سطر {first_item} تا {last_item} از {all_items}"
|
||||||
|
RowsPerPageString="تعداد در صفحه" />
|
||||||
|
</PagerContent>
|
||||||
|
</MudDataGrid>
|
||||||
|
</Content>
|
||||||
|
</BasePageComponent>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
private BasePageComponent? _basePage;
|
||||||
|
private MudDataGrid<ClubMembershipCycleModel>? _grid;
|
||||||
|
private long? _userId;
|
||||||
|
private bool? _isCurrent;
|
||||||
|
private int? _magicState;
|
||||||
|
private DateTime? _fromDate, _toDate;
|
||||||
|
private long _totalCount, _currentCount, _magicActive;
|
||||||
|
|
||||||
|
private GetAllClubMembershipCycleByFilterFilter BuildFilter() => new()
|
||||||
|
{
|
||||||
|
UserId = _userId > 0 ? _userId : null,
|
||||||
|
IsCurrentCycle = _isCurrent,
|
||||||
|
MagicState = _magicState,
|
||||||
|
PackagePurchasedFrom = _fromDate.HasValue ? Timestamp.FromDateTime(DateTime.SpecifyKind(_fromDate.Value, DateTimeKind.Utc)) : null,
|
||||||
|
PackagePurchasedTo = _toDate.HasValue ? Timestamp.FromDateTime(DateTime.SpecifyKind(_toDate.Value.Date.AddDays(1).AddTicks(-1), DateTimeKind.Utc)) : null
|
||||||
|
};
|
||||||
|
|
||||||
|
private async Task<GridData<ClubMembershipCycleModel>> LoadData(GridState<ClubMembershipCycleModel> state)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var filter = BuildFilter();
|
||||||
|
var summary = await CycleClient.GetClubMembershipCycleSummaryAsync(new GetClubMembershipCycleSummaryRequest { Filter = filter });
|
||||||
|
_totalCount = summary.TotalCount;
|
||||||
|
_currentCount = summary.CurrentCycleCount;
|
||||||
|
_magicActive = summary.MagicActiveCount;
|
||||||
|
|
||||||
|
var result = await CycleClient.GetAllClubMembershipCycleByFilterAsync(new GetAllClubMembershipCycleByFilterRequest
|
||||||
|
{
|
||||||
|
PaginationState = new CMSMicroservice.Protobuf.Protos.PaginationState { PageNumber = state.Page + 1, PageSize = state.PageSize },
|
||||||
|
Filter = filter
|
||||||
|
});
|
||||||
|
return new GridData<ClubMembershipCycleModel>
|
||||||
|
{
|
||||||
|
Items = result?.Models?.ToList() ?? new(),
|
||||||
|
TotalItems = (int)(result?.MetaData?.TotalCount ?? 0)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Snackbar.Add($"خطا: {ex.Message}", Severity.Error);
|
||||||
|
return new GridData<ClubMembershipCycleModel>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task OnFilterSubmit() { if (_grid != null) await _grid.ReloadServerData(); }
|
||||||
|
private async Task OnFilterCleared()
|
||||||
|
{
|
||||||
|
_userId = null; _isCurrent = null; _magicState = null; _fromDate = _toDate = null;
|
||||||
|
if (_grid != null) await _grid.ReloadServerData();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,153 @@
|
|||||||
|
@using BackOffice.Common.BaseComponents
|
||||||
|
@using BackOffice.Pages.AutoComplete
|
||||||
|
@using CMSMicroservice.Protobuf.Protos.ClubMembership
|
||||||
|
@using CMSMicroservice.Protobuf.Protos.ClubMembershipCycleHistory
|
||||||
|
@using Google.Protobuf.WellKnownTypes
|
||||||
|
|
||||||
|
@inject ClubMembershipContract.ClubMembershipContractClient ClubClient
|
||||||
|
@inject ClubMembershipCycleHistoryContract.ClubMembershipCycleHistoryContractClient CycleHistoryClient
|
||||||
|
|
||||||
|
<MudTabs Elevation="0" Rounded="true" Border="true" ApplyEffectsToContainer="true" PanelClass="pt-4">
|
||||||
|
<MudTabPanel Text="تغییرات عضویت" Icon="@Icons.Material.Filled.History">
|
||||||
|
<MudAlert Severity="Severity.Info" Variant="Variant.Text" Dense="true" Class="mb-3">
|
||||||
|
تاریخچه فعال/غیرفعال شدن عضویت باشگاه.
|
||||||
|
</MudAlert>
|
||||||
|
<MudStack Row="true" Spacing="2" Class="mb-3">
|
||||||
|
<UserAutoComplete Label="کاربر" @bind-SelectedUserId="_memUserId" />
|
||||||
|
<MudSelect T="int?" Clearable="true" Label="عملیات" Variant="Variant.Outlined" Margin="Margin.Dense"
|
||||||
|
@bind-Value="_memAction" Style="max-width:200px;">
|
||||||
|
<MudSelectItem T="int?" Value="0">فعالسازی</MudSelectItem>
|
||||||
|
<MudSelectItem T="int?" Value="1">غیرفعالسازی</MudSelectItem>
|
||||||
|
<MudSelectItem T="int?" Value="2">ویرایش</MudSelectItem>
|
||||||
|
<MudSelectItem T="int?" Value="3">اصلاح دستی</MudSelectItem>
|
||||||
|
</MudSelect>
|
||||||
|
<MudButton Variant="Variant.Filled" Color="Color.Primary" OnClick="ReloadMembership">جستجو</MudButton>
|
||||||
|
</MudStack>
|
||||||
|
<MudDataGrid @ref="_memGrid" T="ClubMembershipHistoryModel" ServerData="LoadMembershipHistory" ReadOnly="true"
|
||||||
|
Hover="true" Dense="true" Height="calc(100vh - 400px)">
|
||||||
|
<Columns>
|
||||||
|
<PropertyColumn Property="x => x.Id" Title="شناسه" />
|
||||||
|
<PropertyColumn Property="x => x.UserName" Title="کاربر" />
|
||||||
|
<TemplateColumn Title="وضعیت">
|
||||||
|
<CellTemplate>@ReportLabels.FormatActiveChange(context.Item.OldIsActive, context.Item.NewIsActive)</CellTemplate>
|
||||||
|
</TemplateColumn>
|
||||||
|
<TemplateColumn Title="مشارکت اولیه">
|
||||||
|
<CellTemplate>
|
||||||
|
@(context.Item.OldInitialContribution != null ? context.Item.OldInitialContribution.Value.ToString("N0") : "—")
|
||||||
|
→ @(context.Item.NewInitialContribution != null ? context.Item.NewInitialContribution.Value.ToString("N0") : "—")
|
||||||
|
</CellTemplate>
|
||||||
|
</TemplateColumn>
|
||||||
|
<TemplateColumn Title="عملیات">
|
||||||
|
<CellTemplate>@ReportLabels.GetClubMembershipActionLabel(context.Item.Action)</CellTemplate>
|
||||||
|
</TemplateColumn>
|
||||||
|
<PropertyColumn Property="x => x.PerformedBy" Title="انجامدهنده" />
|
||||||
|
<PropertyColumn Property="x => x.Reason" Title="دلیل" />
|
||||||
|
<TemplateColumn Title="تاریخ">
|
||||||
|
<CellTemplate>@context.Item.CreatedAt.ToDateTime().ToLocalTime().MiladiToJalaliWithTime()</CellTemplate>
|
||||||
|
</TemplateColumn>
|
||||||
|
</Columns>
|
||||||
|
<NoRecordsContent>
|
||||||
|
<MudAlert Severity="Severity.Info" Dense="true" Variant="Variant.Text" Class="my-4">موردی یافت نشد.</MudAlert>
|
||||||
|
</NoRecordsContent>
|
||||||
|
<PagerContent>
|
||||||
|
<MudDataGridPager T="ClubMembershipHistoryModel" PageSizeOptions="@(new int[] { 20, 50, 100 })" />
|
||||||
|
</PagerContent>
|
||||||
|
</MudDataGrid>
|
||||||
|
</MudTabPanel>
|
||||||
|
|
||||||
|
<MudTabPanel Text="تغییرات دوره" Icon="@Icons.Material.Filled.Timeline">
|
||||||
|
<MudAlert Severity="Severity.Warning" Variant="Variant.Text" Dense="true" Class="mb-3">
|
||||||
|
ردیابی تغییرات دوره از زمان deploy فعال شد. رکوردهای قدیمیتر ممکن است خالی باشند.
|
||||||
|
</MudAlert>
|
||||||
|
<MudStack Row="true" Spacing="2" Class="mb-3">
|
||||||
|
<UserAutoComplete Label="کاربر" @bind-SelectedUserId="_cycleUserId" />
|
||||||
|
<MudButton Variant="Variant.Filled" Color="Color.Primary" OnClick="ReloadCycle">جستجو</MudButton>
|
||||||
|
</MudStack>
|
||||||
|
<MudDataGrid @ref="_cycleGrid" T="ClubMembershipCycleHistoryModel" ServerData="LoadCycleHistory" ReadOnly="true"
|
||||||
|
Hover="true" Dense="true" Height="calc(100vh - 400px)">
|
||||||
|
<Columns>
|
||||||
|
<PropertyColumn Property="x => x.Id" Title="شناسه" />
|
||||||
|
<PropertyColumn Property="x => x.UserName" Title="کاربر" />
|
||||||
|
<PropertyColumn Property="x => x.CycleNumber" Title="دور" />
|
||||||
|
<TemplateColumn Title="دوره جاری">
|
||||||
|
<CellTemplate>@ReportLabels.FormatBoolChange(context.Item.OldIsCurrentCycle, context.Item.NewIsCurrentCycle)</CellTemplate>
|
||||||
|
</TemplateColumn>
|
||||||
|
<TemplateColumn Title="عملیات">
|
||||||
|
<CellTemplate>@ReportLabels.GetClubCycleActionLabel(context.Item.Action)</CellTemplate>
|
||||||
|
</TemplateColumn>
|
||||||
|
<PropertyColumn Property="x => x.PerformedBy" Title="انجامدهنده" />
|
||||||
|
<PropertyColumn Property="x => x.Reason" Title="دلیل" />
|
||||||
|
<TemplateColumn Title="تاریخ">
|
||||||
|
<CellTemplate>@context.Item.CreatedAt.ToDateTime().ToLocalTime().MiladiToJalaliWithTime()</CellTemplate>
|
||||||
|
</TemplateColumn>
|
||||||
|
</Columns>
|
||||||
|
<NoRecordsContent>
|
||||||
|
<MudAlert Severity="Severity.Info" Dense="true" Variant="Variant.Text" Class="my-4">موردی یافت نشد.</MudAlert>
|
||||||
|
</NoRecordsContent>
|
||||||
|
<PagerContent>
|
||||||
|
<MudDataGridPager T="ClubMembershipCycleHistoryModel" PageSizeOptions="@(new int[] { 20, 50, 100 })" />
|
||||||
|
</PagerContent>
|
||||||
|
</MudDataGrid>
|
||||||
|
</MudTabPanel>
|
||||||
|
</MudTabs>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
private MudDataGrid<ClubMembershipHistoryModel>? _memGrid;
|
||||||
|
private MudDataGrid<ClubMembershipCycleHistoryModel>? _cycleGrid;
|
||||||
|
private long? _memUserId, _cycleUserId;
|
||||||
|
private int? _memAction;
|
||||||
|
|
||||||
|
private async Task<GridData<ClubMembershipHistoryModel>> LoadMembershipHistory(GridState<ClubMembershipHistoryModel> state)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = await ClubClient.GetClubMembershipHistoryAsync(new GetClubMembershipHistoryRequest
|
||||||
|
{
|
||||||
|
PaginationState = new CMSMicroservice.Protobuf.Protos.PaginationState { PageNumber = state.Page + 1, PageSize = state.PageSize },
|
||||||
|
Filter = new GetClubMembershipHistoryFilter
|
||||||
|
{
|
||||||
|
UserId = _memUserId > 0 ? _memUserId : null,
|
||||||
|
Action = _memAction
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return new GridData<ClubMembershipHistoryModel>
|
||||||
|
{
|
||||||
|
Items = result?.Models?.ToList() ?? new(),
|
||||||
|
TotalItems = (int)(result?.MetaData?.TotalCount ?? 0)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Snackbar.Add($"خطا: {ex.Message}", Severity.Error);
|
||||||
|
return new GridData<ClubMembershipHistoryModel>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<GridData<ClubMembershipCycleHistoryModel>> LoadCycleHistory(GridState<ClubMembershipCycleHistoryModel> state)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = await CycleHistoryClient.GetAllClubMembershipCycleHistoryByFilterAsync(new GetAllClubMembershipCycleHistoryByFilterRequest
|
||||||
|
{
|
||||||
|
PaginationState = new CMSMicroservice.Protobuf.Protos.PaginationState { PageNumber = state.Page + 1, PageSize = state.PageSize },
|
||||||
|
Filter = new GetAllClubMembershipCycleHistoryByFilterFilter
|
||||||
|
{
|
||||||
|
UserId = _cycleUserId > 0 ? _cycleUserId : null
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return new GridData<ClubMembershipCycleHistoryModel>
|
||||||
|
{
|
||||||
|
Items = result?.Models?.ToList() ?? new(),
|
||||||
|
TotalItems = (int)(result?.MetaData?.TotalCount ?? 0)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Snackbar.Add($"خطا: {ex.Message}", Severity.Error);
|
||||||
|
return new GridData<ClubMembershipCycleHistoryModel>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task ReloadMembership() { if (_memGrid != null) await _memGrid.ReloadServerData(); }
|
||||||
|
private async Task ReloadCycle() { if (_cycleGrid != null) await _cycleGrid.ReloadServerData(); }
|
||||||
|
}
|
||||||
@@ -0,0 +1,130 @@
|
|||||||
|
@using BackOffice.Common.BaseComponents
|
||||||
|
@using BackOffice.Pages.AutoComplete
|
||||||
|
@using CMSMicroservice.Protobuf.Protos.UserPackagePurchase
|
||||||
|
@using Google.Protobuf.WellKnownTypes
|
||||||
|
|
||||||
|
@inject UserPackagePurchaseContract.UserPackagePurchaseContractClient PurchaseClient
|
||||||
|
|
||||||
|
<MudAlert Severity="Severity.Info" Variant="Variant.Text" Dense="true" Class="mb-3">
|
||||||
|
گزارش read-only خریدهای پکیج — فقط مشاهده و فیلتر.
|
||||||
|
</MudAlert>
|
||||||
|
|
||||||
|
<BasePageComponent @ref="_basePage" OnSubmitClick="OnFilterSubmit" OnClearFilterClick="OnFilterCleared">
|
||||||
|
<Filters>
|
||||||
|
<MudItem xs="12" sm="6" md="3">
|
||||||
|
<UserAutoComplete Label="کاربر" @bind-SelectedUserId="_userId" />
|
||||||
|
</MudItem>
|
||||||
|
<MudItem xs="12" sm="6" md="3">
|
||||||
|
<MudSelect T="int?" Clearable="true" Label="روش خرید" Variant="Variant.Outlined"
|
||||||
|
Margin="Margin.Dense" @bind-Value="_purchaseMethod">
|
||||||
|
<MudSelectItem T="int?" Value="1">وام دایا</MudSelectItem>
|
||||||
|
<MudSelectItem T="int?" Value="2">خرید مستقیم</MudSelectItem>
|
||||||
|
</MudSelect>
|
||||||
|
</MudItem>
|
||||||
|
<MudItem xs="12" sm="6" md="4">
|
||||||
|
<DateRangePicker @bind-From="_fromDate" @bind-To="_toDate" Label="بازه خرید" />
|
||||||
|
</MudItem>
|
||||||
|
</Filters>
|
||||||
|
<Content>
|
||||||
|
<MudGrid Class="mb-3" Spacing="2">
|
||||||
|
<MudItem xs="6" sm="4">
|
||||||
|
<MudPaper Class="pa-3" Outlined="true">
|
||||||
|
<MudText Typo="Typo.caption" Color="Color.Secondary">تعداد</MudText>
|
||||||
|
<MudText Typo="Typo.h6">@_totalCount.ToString("N0")</MudText>
|
||||||
|
</MudPaper>
|
||||||
|
</MudItem>
|
||||||
|
<MudItem xs="6" sm="4">
|
||||||
|
<MudPaper Class="pa-3" Outlined="true">
|
||||||
|
<MudText Typo="Typo.caption" Color="Color.Secondary">جمع مبلغ (ریال)</MudText>
|
||||||
|
<MudText Typo="Typo.h6">@_totalAmount.ToString("N0")</MudText>
|
||||||
|
</MudPaper>
|
||||||
|
</MudItem>
|
||||||
|
</MudGrid>
|
||||||
|
|
||||||
|
<MudDataGrid @ref="_grid" T="UserPackagePurchaseModel" ServerData="LoadData" ReadOnly="true"
|
||||||
|
Hover="true" Dense="true" Height="calc(100vh - 420px)">
|
||||||
|
<Columns>
|
||||||
|
<PropertyColumn Property="x => x.Id" Title="شناسه" />
|
||||||
|
<TemplateColumn Title="کاربر">
|
||||||
|
<CellTemplate>
|
||||||
|
<MudStack Spacing="0">
|
||||||
|
<MudText Typo="Typo.body2">@context.Item.UserName</MudText>
|
||||||
|
<MudText Typo="Typo.caption" Color="Color.Secondary">@context.Item.UserMobile</MudText>
|
||||||
|
</MudStack>
|
||||||
|
</CellTemplate>
|
||||||
|
</TemplateColumn>
|
||||||
|
<PropertyColumn Property="x => x.PackageName" Title="پکیج" />
|
||||||
|
<TemplateColumn Title="روش خرید">
|
||||||
|
<CellTemplate>@ReportLabels.GetPurchaseMethodLabel(context.Item.PurchaseMethod)</CellTemplate>
|
||||||
|
</TemplateColumn>
|
||||||
|
<TemplateColumn Title="مبلغ (ریال)">
|
||||||
|
<CellTemplate>@context.Item.Amount.ToString("N0")</CellTemplate>
|
||||||
|
</TemplateColumn>
|
||||||
|
<TemplateColumn Title="تاریخ خرید">
|
||||||
|
<CellTemplate>@context.Item.PurchasedAt.ToDateTime().ToLocalTime().MiladiToJalaliWithTime()</CellTemplate>
|
||||||
|
</TemplateColumn>
|
||||||
|
<PropertyColumn Property="x => x.OrderId" Title="OrderId" />
|
||||||
|
<PropertyColumn Property="x => x.TransactionId" Title="TransactionId" />
|
||||||
|
</Columns>
|
||||||
|
<NoRecordsContent>
|
||||||
|
<MudAlert Severity="Severity.Info" Dense="true" Variant="Variant.Text" Class="my-4">موردی یافت نشد.</MudAlert>
|
||||||
|
</NoRecordsContent>
|
||||||
|
<PagerContent>
|
||||||
|
<MudDataGridPager T="UserPackagePurchaseModel" PageSizeOptions="@(new int[] { 20, 50, 100 })"
|
||||||
|
InfoFormat="سطر {first_item} تا {last_item} از {all_items}"
|
||||||
|
RowsPerPageString="تعداد در صفحه" />
|
||||||
|
</PagerContent>
|
||||||
|
</MudDataGrid>
|
||||||
|
</Content>
|
||||||
|
</BasePageComponent>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
private BasePageComponent? _basePage;
|
||||||
|
private MudDataGrid<UserPackagePurchaseModel>? _grid;
|
||||||
|
private long? _userId;
|
||||||
|
private int? _purchaseMethod;
|
||||||
|
private DateTime? _fromDate, _toDate;
|
||||||
|
private long _totalCount, _totalAmount;
|
||||||
|
|
||||||
|
private GetAllUserPackagePurchaseByFilterFilter BuildFilter() => new()
|
||||||
|
{
|
||||||
|
UserId = _userId > 0 ? _userId : null,
|
||||||
|
PurchaseMethod = _purchaseMethod,
|
||||||
|
PurchasedFrom = _fromDate.HasValue ? Timestamp.FromDateTime(DateTime.SpecifyKind(_fromDate.Value, DateTimeKind.Utc)) : null,
|
||||||
|
PurchasedTo = _toDate.HasValue ? Timestamp.FromDateTime(DateTime.SpecifyKind(_toDate.Value.Date.AddDays(1).AddTicks(-1), DateTimeKind.Utc)) : null
|
||||||
|
};
|
||||||
|
|
||||||
|
private async Task<GridData<UserPackagePurchaseModel>> LoadData(GridState<UserPackagePurchaseModel> state)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var filter = BuildFilter();
|
||||||
|
var summary = await PurchaseClient.GetUserPackagePurchaseSummaryAsync(new GetUserPackagePurchaseSummaryRequest { Filter = filter });
|
||||||
|
_totalCount = summary.TotalCount;
|
||||||
|
_totalAmount = summary.TotalAmount;
|
||||||
|
|
||||||
|
var result = await PurchaseClient.GetAllUserPackagePurchaseByFilterAsync(new GetAllUserPackagePurchaseByFilterRequest
|
||||||
|
{
|
||||||
|
PaginationState = new CMSMicroservice.Protobuf.Protos.PaginationState { PageNumber = state.Page + 1, PageSize = state.PageSize },
|
||||||
|
Filter = filter
|
||||||
|
});
|
||||||
|
return new GridData<UserPackagePurchaseModel>
|
||||||
|
{
|
||||||
|
Items = result?.Models?.ToList() ?? new(),
|
||||||
|
TotalItems = (int)(result?.MetaData?.TotalCount ?? 0)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Snackbar.Add($"خطا: {ex.Message}", Severity.Error);
|
||||||
|
return new GridData<UserPackagePurchaseModel>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task OnFilterSubmit() { if (_grid != null) await _grid.ReloadServerData(); }
|
||||||
|
private async Task OnFilterCleared()
|
||||||
|
{
|
||||||
|
_userId = null; _purchaseMethod = null; _fromDate = _toDate = null;
|
||||||
|
if (_grid != null) await _grid.ReloadServerData();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,246 @@
|
|||||||
|
@page "/payment/ledger-transactions"
|
||||||
|
@using BackOffice.Common.BaseComponents
|
||||||
|
@using CMSMicroservice.Protobuf.Protos
|
||||||
|
@using CMSMicroservice.Protobuf.Protos.Transactions
|
||||||
|
@using Google.Protobuf.WellKnownTypes
|
||||||
|
|
||||||
|
@inject TransactionsContract.TransactionsContractClient TransactionsClient
|
||||||
|
|
||||||
|
<BasePageComponent @ref="_basePage" OnSubmitClick="OnFilterSubmit" OnClearFilterClick="OnFilterCleared">
|
||||||
|
<Filters>
|
||||||
|
<MudItem xs="12">
|
||||||
|
<MudAlert Severity="Severity.Info" Variant="Variant.Text" Dense="true">
|
||||||
|
گزارش read-only دفتر تراکنشهای مالی (جدول Transactions). برای جزئیات درگاه پرداخت به «گزارش تراکنش درگاه» مراجعه کنید.
|
||||||
|
</MudAlert>
|
||||||
|
</MudItem>
|
||||||
|
<MudItem xs="12" sm="6" md="3">
|
||||||
|
<MudTextField T="long?" Label="شناسه" Variant="Variant.Outlined" Margin="Margin.Dense" @bind-Value="_id" />
|
||||||
|
</MudItem>
|
||||||
|
<MudItem xs="12" sm="6" md="3">
|
||||||
|
<MudTextField T="string" Label="RefId" Variant="Variant.Outlined" Margin="Margin.Dense" @bind-Value="_refId" />
|
||||||
|
</MudItem>
|
||||||
|
<MudItem xs="12" sm="6" md="3">
|
||||||
|
<MudTextField T="string" Label="توضیحات" Variant="Variant.Outlined" Margin="Margin.Dense" @bind-Value="_description" />
|
||||||
|
</MudItem>
|
||||||
|
<MudItem xs="12" sm="6" md="3">
|
||||||
|
<MudSelect T="PaymentStatus?" Clearable="true" Label="وضعیت پرداخت" Variant="Variant.Outlined"
|
||||||
|
Margin="Margin.Dense" @bind-Value="_paymentStatus">
|
||||||
|
<MudSelectItem T="PaymentStatus?" Value="PaymentStatus.Success">موفق</MudSelectItem>
|
||||||
|
<MudSelectItem T="PaymentStatus?" Value="PaymentStatus.Pending">در انتظار</MudSelectItem>
|
||||||
|
<MudSelectItem T="PaymentStatus?" Value="PaymentStatus.Reject">رد شده</MudSelectItem>
|
||||||
|
</MudSelect>
|
||||||
|
</MudItem>
|
||||||
|
<MudItem xs="12" sm="6" md="3">
|
||||||
|
<MudSelect T="TransactionType?" Clearable="true" Label="نوع تراکنش" Variant="Variant.Outlined"
|
||||||
|
Margin="Margin.Dense" @bind-Value="_type">
|
||||||
|
<MudSelectItem T="TransactionType?" Value="TransactionType.Buy">خرید</MudSelectItem>
|
||||||
|
<MudSelectItem T="TransactionType?" Value="TransactionType.DepositIpg">واریز درگاه</MudSelectItem>
|
||||||
|
<MudSelectItem T="TransactionType?" Value="TransactionType.DepositExternal1">واریز خارجی</MudSelectItem>
|
||||||
|
<MudSelectItem T="TransactionType?" Value="TransactionType.Withdraw">برداشت</MudSelectItem>
|
||||||
|
<MudSelectItem T="TransactionType?" Value="TransactionType.NetworkCommission">کمیسیون شبکه</MudSelectItem>
|
||||||
|
<MudSelectItem T="TransactionType?" Value="TransactionType.ClubActivation">فعالسازی باشگاه</MudSelectItem>
|
||||||
|
<MudSelectItem T="TransactionType?" Value="TransactionType.DiscountWalletCharge">شارژ کیف تخفیف</MudSelectItem>
|
||||||
|
<MudSelectItem T="TransactionType?" Value="TransactionType.DiscountShopPurchase">خرید فروشگاه تخفیف</MudSelectItem>
|
||||||
|
<MudSelectItem T="TransactionType?" Value="TransactionType.MagicWalletDeposit">واریز کیف جادویی</MudSelectItem>
|
||||||
|
<MudSelectItem T="TransactionType?" Value="TransactionType.MagicWalletBonus">بونوس کیف جادویی</MudSelectItem>
|
||||||
|
<MudSelectItem T="TransactionType?" Value="TransactionType.CreditWalletCharge">شارژ کیف اصلی</MudSelectItem>
|
||||||
|
</MudSelect>
|
||||||
|
</MudItem>
|
||||||
|
<MudItem xs="12" sm="6" md="4">
|
||||||
|
<DateRangePicker @bind-From="_createdFrom" @bind-To="_createdTo" Label="بازه ثبت" />
|
||||||
|
</MudItem>
|
||||||
|
</Filters>
|
||||||
|
<Content>
|
||||||
|
<MudGrid Class="mb-3" Spacing="2">
|
||||||
|
<MudItem xs="6" sm="3">
|
||||||
|
<MudPaper Class="pa-3" Outlined="true">
|
||||||
|
<MudText Typo="Typo.caption" Color="Color.Secondary">تعداد</MudText>
|
||||||
|
<MudText Typo="Typo.h6">@_summaryTotalCount.ToString("N0")</MudText>
|
||||||
|
</MudPaper>
|
||||||
|
</MudItem>
|
||||||
|
<MudItem xs="6" sm="3">
|
||||||
|
<MudPaper Class="pa-3" Outlined="true">
|
||||||
|
<MudText Typo="Typo.caption" Color="Color.Secondary">جمع مبلغ (تومان)</MudText>
|
||||||
|
<MudText Typo="Typo.h6">@_summaryTotalAmount.ToString("N0")</MudText>
|
||||||
|
</MudPaper>
|
||||||
|
</MudItem>
|
||||||
|
<MudItem xs="6" sm="2">
|
||||||
|
<MudPaper Class="pa-3" Outlined="true">
|
||||||
|
<MudText Typo="Typo.caption" Color="Color.Secondary">موفق</MudText>
|
||||||
|
<MudText Typo="Typo.h6" Color="Color.Success">@_summarySuccess.ToString("N0")</MudText>
|
||||||
|
</MudPaper>
|
||||||
|
</MudItem>
|
||||||
|
<MudItem xs="6" sm="2">
|
||||||
|
<MudPaper Class="pa-3" Outlined="true">
|
||||||
|
<MudText Typo="Typo.caption" Color="Color.Secondary">در انتظار</MudText>
|
||||||
|
<MudText Typo="Typo.h6" Color="Color.Warning">@_summaryPending.ToString("N0")</MudText>
|
||||||
|
</MudPaper>
|
||||||
|
</MudItem>
|
||||||
|
<MudItem xs="6" sm="2">
|
||||||
|
<MudPaper Class="pa-3" Outlined="true">
|
||||||
|
<MudText Typo="Typo.caption" Color="Color.Secondary">رد شده</MudText>
|
||||||
|
<MudText Typo="Typo.h6" Color="Color.Error">@_summaryReject.ToString("N0")</MudText>
|
||||||
|
</MudPaper>
|
||||||
|
</MudItem>
|
||||||
|
</MudGrid>
|
||||||
|
|
||||||
|
<MudDataGrid @ref="_dataGrid" T="GetAllTransactionsByFilterResponseModel"
|
||||||
|
ServerData="LoadData" ReadOnly="true"
|
||||||
|
Hover="true" Dense="true" Height="calc(100vh - 400px)">
|
||||||
|
<ToolBarContent>
|
||||||
|
<MudText Typo="Typo.subtitle1">دفتر تراکنشهای مالی</MudText>
|
||||||
|
<MudSpacer />
|
||||||
|
<MudButton Variant="Variant.Outlined" Color="Color.Info" Size="Size.Small"
|
||||||
|
StartIcon="@Icons.Material.Filled.FileDownload" OnClick="ExportCsv">CSV</MudButton>
|
||||||
|
</ToolBarContent>
|
||||||
|
<Columns>
|
||||||
|
<PropertyColumn Property="x => x.Id" Title="شناسه" />
|
||||||
|
<TemplateColumn Title="نوع">
|
||||||
|
<CellTemplate>
|
||||||
|
<MudChip T="string" Size="Size.Small" Variant="Variant.Text">
|
||||||
|
@ReportLabels.GetTransactionTypeLabel(context.Item.HasType ? context.Item.Type : null)
|
||||||
|
</MudChip>
|
||||||
|
</CellTemplate>
|
||||||
|
</TemplateColumn>
|
||||||
|
<TemplateColumn Title="مبلغ (تومان)">
|
||||||
|
<CellTemplate>@context.Item.Amount.ToString("N0")</CellTemplate>
|
||||||
|
</TemplateColumn>
|
||||||
|
<PropertyColumn Property="x => x.Description" Title="توضیحات" />
|
||||||
|
<TemplateColumn Title="وضعیت">
|
||||||
|
<CellTemplate>
|
||||||
|
<MudChip T="string" Size="Size.Small" Color="@ReportLabels.GetTransactionPaymentStatusColor(context.Item.HasPaymentStatus ? context.Item.PaymentStatus : null)">
|
||||||
|
@ReportLabels.GetTransactionPaymentStatusLabel(context.Item.HasPaymentStatus ? context.Item.PaymentStatus : null)
|
||||||
|
</MudChip>
|
||||||
|
</CellTemplate>
|
||||||
|
</TemplateColumn>
|
||||||
|
<PropertyColumn Property="x => x.RefId" Title="RefId" />
|
||||||
|
<TemplateColumn Title="تاریخ پرداخت">
|
||||||
|
<CellTemplate>
|
||||||
|
@(context.Item.PaymentDate != null
|
||||||
|
? context.Item.PaymentDate.ToDateTime().ToLocalTime().MiladiToJalaliWithTime()
|
||||||
|
: "—")
|
||||||
|
</CellTemplate>
|
||||||
|
</TemplateColumn>
|
||||||
|
<TemplateColumn Title="تاریخ ثبت">
|
||||||
|
<CellTemplate>@context.Item.Created.ToDateTime().ToLocalTime().MiladiToJalaliWithTime()</CellTemplate>
|
||||||
|
</TemplateColumn>
|
||||||
|
</Columns>
|
||||||
|
<NoRecordsContent>
|
||||||
|
<MudAlert Severity="Severity.Info" Dense="true" Variant="Variant.Text" Class="my-4">
|
||||||
|
با فیلتر فعلی موردی یافت نشد — بازه تاریخ یا فیلترها را تغییر دهید.
|
||||||
|
</MudAlert>
|
||||||
|
</NoRecordsContent>
|
||||||
|
<PagerContent>
|
||||||
|
<MudDataGridPager T="GetAllTransactionsByFilterResponseModel" PageSizeOptions="@(new int[] { 20, 50, 100 })"
|
||||||
|
InfoFormat="سطر {first_item} تا {last_item} از {all_items}"
|
||||||
|
RowsPerPageString="تعداد در صفحه" />
|
||||||
|
</PagerContent>
|
||||||
|
</MudDataGrid>
|
||||||
|
</Content>
|
||||||
|
</BasePageComponent>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
private BasePageComponent? _basePage;
|
||||||
|
private MudDataGrid<GetAllTransactionsByFilterResponseModel>? _dataGrid;
|
||||||
|
private long? _id;
|
||||||
|
private string? _refId, _description;
|
||||||
|
private PaymentStatus? _paymentStatus;
|
||||||
|
private TransactionType? _type;
|
||||||
|
private DateTime? _createdFrom, _createdTo;
|
||||||
|
private long _summaryTotalCount, _summaryTotalAmount, _summarySuccess, _summaryPending, _summaryReject;
|
||||||
|
|
||||||
|
private GetAllTransactionsByFilterFilter BuildFilter()
|
||||||
|
{
|
||||||
|
var filter = new GetAllTransactionsByFilterFilter
|
||||||
|
{
|
||||||
|
Id = _id > 0 ? _id : null,
|
||||||
|
RefId = string.IsNullOrWhiteSpace(_refId) ? null : _refId,
|
||||||
|
Description = string.IsNullOrWhiteSpace(_description) ? null : _description,
|
||||||
|
CreatedFrom = _createdFrom.HasValue ? Timestamp.FromDateTime(DateTime.SpecifyKind(_createdFrom.Value, DateTimeKind.Utc)) : null,
|
||||||
|
CreatedTo = _createdTo.HasValue ? Timestamp.FromDateTime(DateTime.SpecifyKind(_createdTo.Value.Date.AddDays(1).AddTicks(-1), DateTimeKind.Utc)) : null
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_paymentStatus.HasValue)
|
||||||
|
filter.PaymentStatus = _paymentStatus.Value;
|
||||||
|
else
|
||||||
|
filter.ClearPaymentStatusItem();
|
||||||
|
|
||||||
|
if (_type.HasValue)
|
||||||
|
filter.Type = _type.Value;
|
||||||
|
else
|
||||||
|
filter.ClearTypeItem();
|
||||||
|
|
||||||
|
return filter;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task LoadSummary()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var s = await TransactionsClient.GetTransactionSummaryAsync(new GetTransactionSummaryRequest { Filter = BuildFilter() });
|
||||||
|
_summaryTotalCount = s.TotalCount;
|
||||||
|
_summaryTotalAmount = s.TotalAmount;
|
||||||
|
_summarySuccess = s.SuccessCount;
|
||||||
|
_summaryPending = s.PendingCount;
|
||||||
|
_summaryReject = s.RejectCount;
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<GridData<GetAllTransactionsByFilterResponseModel>> LoadData(GridState<GetAllTransactionsByFilterResponseModel> state)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await LoadSummary();
|
||||||
|
var result = await TransactionsClient.GetAllTransactionsByFilterAsync(new GetAllTransactionsByFilterRequest
|
||||||
|
{
|
||||||
|
PaginationState = new PaginationState { PageNumber = state.Page + 1, PageSize = state.PageSize },
|
||||||
|
SortBy = "-Created",
|
||||||
|
Filter = BuildFilter()
|
||||||
|
});
|
||||||
|
return new GridData<GetAllTransactionsByFilterResponseModel>
|
||||||
|
{
|
||||||
|
Items = result?.Models?.ToList() ?? new(),
|
||||||
|
TotalItems = (int)(result?.MetaData?.TotalCount ?? 0)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Snackbar.Add($"خطا: {ex.Message}", Severity.Error);
|
||||||
|
return new GridData<GetAllTransactionsByFilterResponseModel>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task OnFilterSubmit() { if (_dataGrid != null) await _dataGrid.ReloadServerData(); }
|
||||||
|
private async Task OnFilterCleared()
|
||||||
|
{
|
||||||
|
_id = null; _refId = _description = null;
|
||||||
|
_paymentStatus = null; _type = null;
|
||||||
|
_createdFrom = _createdTo = null;
|
||||||
|
if (_dataGrid != null) await _dataGrid.ReloadServerData();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task ExportCsv()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = await TransactionsClient.GetAllTransactionsByFilterAsync(new GetAllTransactionsByFilterRequest
|
||||||
|
{
|
||||||
|
PaginationState = new PaginationState { PageNumber = 1, PageSize = 5000 },
|
||||||
|
SortBy = "-Created",
|
||||||
|
Filter = BuildFilter()
|
||||||
|
});
|
||||||
|
var sb = new System.Text.StringBuilder();
|
||||||
|
sb.AppendLine("Id,Type,Amount,Description,Status,RefId,PaymentDate,Created");
|
||||||
|
foreach (var r in result.Models)
|
||||||
|
{
|
||||||
|
var type = r.HasType ? ReportLabels.GetTransactionTypeLabel(r.Type) : "";
|
||||||
|
var status = r.HasPaymentStatus ? ReportLabels.GetTransactionPaymentStatusLabel(r.PaymentStatus) : "";
|
||||||
|
var paymentDate = r.PaymentDate != null ? r.PaymentDate.ToDateTime().ToString("yyyy-MM-dd HH:mm") : "";
|
||||||
|
sb.AppendLine($"{r.Id},{type},{r.Amount},\"{r.Description}\",{status},{r.RefId},{paymentDate},{r.Created.ToDateTime():yyyy-MM-dd HH:mm}");
|
||||||
|
}
|
||||||
|
await jsRuntime.InvokeVoidAsync("jsSaveAsFile", "ledger-transactions.csv", sb.ToString());
|
||||||
|
}
|
||||||
|
catch (Exception ex) { Snackbar.Add($"خطا در export: {ex.Message}", Severity.Error); }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,78 +1,115 @@
|
|||||||
@page "/payment/transactions"
|
@page "/payment/transactions"
|
||||||
@using BackOffice.Common.BaseComponents
|
@using BackOffice.Common.BaseComponents
|
||||||
|
@using BackOffice.Pages.AutoComplete
|
||||||
|
@using CMSMicroservice.Protobuf.Protos.PaymentTransaction
|
||||||
|
@using Google.Protobuf.WellKnownTypes
|
||||||
|
|
||||||
|
@inject PaymentTransactionContract.PaymentTransactionContractClient PaymentTxClient
|
||||||
|
|
||||||
<BasePageComponent @ref="_basePage" OnSubmitClick="OnFilterSubmit" OnClearFilterClick="OnFilterCleared">
|
<BasePageComponent @ref="_basePage" OnSubmitClick="OnFilterSubmit" OnClearFilterClick="OnFilterCleared">
|
||||||
<Filters>
|
<Filters>
|
||||||
<MudItem xs="12" sm="6" md="4">
|
<MudItem xs="12">
|
||||||
<BackOffice.Common.BaseComponents.DateRangePicker @bind-From="_fromDate" @bind-To="_toDate" Label="بازه تاریخی" />
|
<MudAlert Severity="Severity.Info" Variant="Variant.Text" Dense="true">
|
||||||
|
گزارش read-only تراکنشهای درگاه پرداخت. برای ثبت پرداخت دستی به «پرداختهای دستی» مراجعه کنید.
|
||||||
|
</MudAlert>
|
||||||
</MudItem>
|
</MudItem>
|
||||||
<MudItem xs="12" sm="6" md="4">
|
<MudItem xs="12" sm="6" md="3">
|
||||||
<MudSelect T="int?" Clearable="true" Label="وضعیت پرداخت" Variant="Variant.Outlined"
|
<UserAutoComplete Label="کاربر" @bind-SelectedUserId="_userId" />
|
||||||
Margin="Margin.Dense" @bind-Value="_statusFilter">
|
</MudItem>
|
||||||
<MudSelectItem T="int?" Value="@(0)">در انتظار</MudSelectItem>
|
<MudItem xs="12" sm="6" md="3">
|
||||||
<MudSelectItem T="int?" Value="@(1)">موفق</MudSelectItem>
|
<MudTextField T="string" Label="موبایل" Variant="Variant.Outlined" Margin="Margin.Dense" @bind-Value="_mobile" />
|
||||||
<MudSelectItem T="int?" Value="@(2)">ناموفق</MudSelectItem>
|
</MudItem>
|
||||||
<MudSelectItem T="int?" Value="@(3)">بازگشت وجه</MudSelectItem>
|
<MudItem xs="12" sm="6" md="3">
|
||||||
|
<MudTextField T="string" Label="Authority" Variant="Variant.Outlined" Margin="Margin.Dense" @bind-Value="_authority" />
|
||||||
|
</MudItem>
|
||||||
|
<MudItem xs="12" sm="6" md="3">
|
||||||
|
<MudTextField T="string" Label="RefId" Variant="Variant.Outlined" Margin="Margin.Dense" @bind-Value="_refId" />
|
||||||
|
</MudItem>
|
||||||
|
<MudItem xs="12" sm="6" md="3">
|
||||||
|
<MudTextField T="string" Label="OrderId" Variant="Variant.Outlined" Margin="Margin.Dense" @bind-Value="_orderId" />
|
||||||
|
</MudItem>
|
||||||
|
<MudItem xs="12" sm="6" md="3">
|
||||||
|
<MudTextField T="string" Label="درگاه" Variant="Variant.Outlined" Margin="Margin.Dense" @bind-Value="_gateway" />
|
||||||
|
</MudItem>
|
||||||
|
<MudItem xs="12" sm="6" md="3">
|
||||||
|
<MudSelect T="bool?" Clearable="true" Label="وضعیت پرداخت" Variant="Variant.Outlined"
|
||||||
|
Margin="Margin.Dense" @bind-Value="_paymentStatus">
|
||||||
|
<MudSelectItem T="bool?" Value="@((bool?)true)">موفق</MudSelectItem>
|
||||||
|
<MudSelectItem T="bool?" Value="@((bool?)false)">ناموفق / در انتظار</MudSelectItem>
|
||||||
</MudSelect>
|
</MudSelect>
|
||||||
</MudItem>
|
</MudItem>
|
||||||
<MudItem xs="12" sm="6" md="4">
|
<MudItem xs="12" sm="6" md="4">
|
||||||
<MudSelect T="int?" Clearable="true" Label="نوع تراکنش" Variant="Variant.Outlined"
|
<DateRangePicker @bind-From="_fromDate" @bind-To="_toDate" Label="بازه تاریخ" />
|
||||||
Margin="Margin.Dense" @bind-Value="_typeFilter">
|
|
||||||
<MudSelectItem T="int?" Value="@(0)">نامشخص</MudSelectItem>
|
|
||||||
<MudSelectItem T="int?" Value="@(1)">خرید پکیج</MudSelectItem>
|
|
||||||
<MudSelectItem T="int?" Value="@(2)">پرداخت دستی</MudSelectItem>
|
|
||||||
<MudSelectItem T="int?" Value="@(3)">شارژ کیفپول</MudSelectItem>
|
|
||||||
<MudSelectItem T="int?" Value="@(4)">بازگشت وجه</MudSelectItem>
|
|
||||||
</MudSelect>
|
|
||||||
</MudItem>
|
</MudItem>
|
||||||
</Filters>
|
</Filters>
|
||||||
<Content>
|
<Content>
|
||||||
<MudDataGrid @ref="_dataGrid" T="TransactionModel"
|
<MudGrid Class="mb-3" Spacing="2">
|
||||||
ServerData="LoadData"
|
<MudItem xs="6" sm="3">
|
||||||
Hover="true" Dense="true"
|
<MudPaper Class="pa-3" Outlined="true">
|
||||||
Height="calc(100vh - 240px)">
|
<MudText Typo="Typo.caption" Color="Color.Secondary">تعداد</MudText>
|
||||||
|
<MudText Typo="Typo.h6">@_summaryTotalCount.ToString("N0")</MudText>
|
||||||
|
</MudPaper>
|
||||||
|
</MudItem>
|
||||||
|
<MudItem xs="6" sm="3">
|
||||||
|
<MudPaper Class="pa-3" Outlined="true">
|
||||||
|
<MudText Typo="Typo.caption" Color="Color.Secondary">جمع مبلغ (تومان)</MudText>
|
||||||
|
<MudText Typo="Typo.h6">@_summaryTotalAmount.ToString("N0")</MudText>
|
||||||
|
</MudPaper>
|
||||||
|
</MudItem>
|
||||||
|
<MudItem xs="6" sm="3">
|
||||||
|
<MudPaper Class="pa-3" Outlined="true">
|
||||||
|
<MudText Typo="Typo.caption" Color="Color.Secondary">موفق</MudText>
|
||||||
|
<MudText Typo="Typo.h6" Color="Color.Success">@_summarySuccessful.ToString("N0")</MudText>
|
||||||
|
</MudPaper>
|
||||||
|
</MudItem>
|
||||||
|
<MudItem xs="6" sm="3">
|
||||||
|
<MudPaper Class="pa-3" Outlined="true">
|
||||||
|
<MudText Typo="Typo.caption" Color="Color.Secondary">در انتظار</MudText>
|
||||||
|
<MudText Typo="Typo.h6" Color="Color.Warning">@_summaryPending.ToString("N0")</MudText>
|
||||||
|
</MudPaper>
|
||||||
|
</MudItem>
|
||||||
|
</MudGrid>
|
||||||
|
|
||||||
|
<MudDataGrid @ref="_dataGrid" T="PaymentTransactionModel"
|
||||||
|
ServerData="LoadData" ReadOnly="true"
|
||||||
|
Hover="true" Dense="true" Height="calc(100vh - 380px)">
|
||||||
|
<ToolBarContent>
|
||||||
|
<MudText Typo="Typo.subtitle1">گزارش تراکنش درگاه</MudText>
|
||||||
|
<MudSpacer />
|
||||||
|
<MudButton Variant="Variant.Outlined" Color="Color.Info" Size="Size.Small"
|
||||||
|
StartIcon="@Icons.Material.Filled.FileDownload" OnClick="ExportCsv">CSV</MudButton>
|
||||||
|
</ToolBarContent>
|
||||||
<Columns>
|
<Columns>
|
||||||
<PropertyColumn Property="x => x.Id" Title="شناسه" />
|
<PropertyColumn Property="x => x.Id" Title="شناسه" />
|
||||||
<PropertyColumn Property="x => x.RefId" Title="شماره مرجع" />
|
<PropertyColumn Property="x => x.UserId" Title="کاربر" />
|
||||||
<PropertyColumn Property="x => x.Amount" Title="مبلغ">
|
<PropertyColumn Property="x => x.Mobile" Title="موبایل" />
|
||||||
<CellTemplate>
|
<PropertyColumn Property="x => x.GatewayProvider" Title="درگاه" />
|
||||||
@context.Item.Amount.ToString("N0")
|
<TemplateColumn Title="مبلغ (تومان)">
|
||||||
</CellTemplate>
|
<CellTemplate>@context.Item.Amount.ToString("N0")</CellTemplate>
|
||||||
</PropertyColumn>
|
</TemplateColumn>
|
||||||
|
<PropertyColumn Property="x => x.Authority" Title="Authority" />
|
||||||
|
<PropertyColumn Property="x => x.RefId" Title="RefId" />
|
||||||
|
<PropertyColumn Property="x => x.CardPan" Title="کارت" />
|
||||||
<TemplateColumn Title="وضعیت">
|
<TemplateColumn Title="وضعیت">
|
||||||
<CellTemplate>
|
<CellTemplate>
|
||||||
<MudChip T="string"
|
<MudChip T="string" Size="Size.Small" Color="@(context.Item.PaymentStatus ? Color.Success : Color.Warning)">
|
||||||
Size="Size.Small"
|
@ReportLabels.GetPaymentStatusLabel(context.Item.PaymentStatus)
|
||||||
Color="@GetStatusColor(context.Item.PaymentStatus)">
|
|
||||||
@GetStatusText(context.Item.PaymentStatus)
|
|
||||||
</MudChip>
|
</MudChip>
|
||||||
</CellTemplate>
|
</CellTemplate>
|
||||||
</TemplateColumn>
|
</TemplateColumn>
|
||||||
<TemplateColumn Title="تاریخ پرداخت">
|
<PropertyColumn Property="x => x.VerificationStatusCode" Title="کد Verify" />
|
||||||
<CellTemplate>
|
<PropertyColumn Property="x => x.OrderId" Title="OrderId" />
|
||||||
@context.Item.PaymentDate.ToLocalTime().MiladiToJalaliWithTime()
|
<TemplateColumn Title="تاریخ">
|
||||||
</CellTemplate>
|
<CellTemplate>@context.Item.CreatedAt.ToDateTime().ToLocalTime().MiladiToJalaliWithTime()</CellTemplate>
|
||||||
</TemplateColumn>
|
|
||||||
<TemplateColumn Title="نوع">
|
|
||||||
<CellTemplate>
|
|
||||||
@GetTypeText(context.Item.Type)
|
|
||||||
</CellTemplate>
|
|
||||||
</TemplateColumn>
|
|
||||||
<TemplateColumn Title="عملیات">
|
|
||||||
<CellTemplate>
|
|
||||||
<MudTooltip Text="جزئیات">
|
|
||||||
<MudIconButton Icon="@Icons.Material.Filled.Info"
|
|
||||||
Size="Size.Small"
|
|
||||||
OnClick="@(() => OpenDetails(context.Item))" />
|
|
||||||
</MudTooltip>
|
|
||||||
</CellTemplate>
|
|
||||||
</TemplateColumn>
|
</TemplateColumn>
|
||||||
</Columns>
|
</Columns>
|
||||||
<NoRecordsContent>
|
<NoRecordsContent>
|
||||||
<MudAlert Severity="Severity.Info" Dense="true" Variant="Variant.Text" Class="my-4">موردی یافت نشد.</MudAlert>
|
<MudAlert Severity="Severity.Info" Dense="true" Variant="Variant.Text" Class="my-4">
|
||||||
|
با فیلتر فعلی موردی یافت نشد — بازه تاریخ یا کاربر را تغییر دهید.
|
||||||
|
</MudAlert>
|
||||||
</NoRecordsContent>
|
</NoRecordsContent>
|
||||||
<PagerContent>
|
<PagerContent>
|
||||||
<MudDataGridPager T="TransactionModel" PageSizeOptions="@(new int[] { 20, 50, 100 })"
|
<MudDataGridPager T="PaymentTransactionModel" PageSizeOptions="@(new int[] { 20, 50, 100 })"
|
||||||
InfoFormat="سطر {first_item} تا {last_item} از {all_items}"
|
InfoFormat="سطر {first_item} تا {last_item} از {all_items}"
|
||||||
RowsPerPageString="تعداد در صفحه" />
|
RowsPerPageString="تعداد در صفحه" />
|
||||||
</PagerContent>
|
</PagerContent>
|
||||||
@@ -80,3 +117,87 @@
|
|||||||
</Content>
|
</Content>
|
||||||
</BasePageComponent>
|
</BasePageComponent>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
private BasePageComponent? _basePage;
|
||||||
|
private MudDataGrid<PaymentTransactionModel>? _dataGrid;
|
||||||
|
private long? _userId;
|
||||||
|
private string? _mobile, _authority, _refId, _orderId, _gateway;
|
||||||
|
private bool? _paymentStatus;
|
||||||
|
private DateTime? _fromDate, _toDate;
|
||||||
|
private long _summaryTotalCount, _summaryTotalAmount, _summarySuccessful, _summaryPending;
|
||||||
|
|
||||||
|
private GetAllPaymentTransactionByFilterFilter BuildFilter() => new()
|
||||||
|
{
|
||||||
|
UserId = _userId > 0 ? _userId : null,
|
||||||
|
Mobile = string.IsNullOrWhiteSpace(_mobile) ? null : _mobile,
|
||||||
|
Authority = string.IsNullOrWhiteSpace(_authority) ? null : _authority,
|
||||||
|
RefId = string.IsNullOrWhiteSpace(_refId) ? null : _refId,
|
||||||
|
OrderId = string.IsNullOrWhiteSpace(_orderId) ? null : _orderId,
|
||||||
|
GatewayProvider = string.IsNullOrWhiteSpace(_gateway) ? null : _gateway,
|
||||||
|
PaymentStatus = _paymentStatus,
|
||||||
|
CreatedFrom = _fromDate.HasValue ? Timestamp.FromDateTime(DateTime.SpecifyKind(_fromDate.Value, DateTimeKind.Utc)) : null,
|
||||||
|
CreatedTo = _toDate.HasValue ? Timestamp.FromDateTime(DateTime.SpecifyKind(_toDate.Value.Date.AddDays(1).AddTicks(-1), DateTimeKind.Utc)) : null
|
||||||
|
};
|
||||||
|
|
||||||
|
private async Task LoadSummary()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var s = await PaymentTxClient.GetPaymentTransactionSummaryAsync(new GetPaymentTransactionSummaryRequest { Filter = BuildFilter() });
|
||||||
|
_summaryTotalCount = s.TotalCount;
|
||||||
|
_summaryTotalAmount = s.TotalAmount;
|
||||||
|
_summarySuccessful = s.SuccessfulCount;
|
||||||
|
_summaryPending = s.PendingCount;
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<GridData<PaymentTransactionModel>> LoadData(GridState<PaymentTransactionModel> state)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await LoadSummary();
|
||||||
|
var result = await PaymentTxClient.GetAllPaymentTransactionByFilterAsync(new GetAllPaymentTransactionByFilterRequest
|
||||||
|
{
|
||||||
|
PaginationState = new CMSMicroservice.Protobuf.Protos.PaginationState { PageNumber = state.Page + 1, PageSize = state.PageSize },
|
||||||
|
Filter = BuildFilter()
|
||||||
|
});
|
||||||
|
return new GridData<PaymentTransactionModel>
|
||||||
|
{
|
||||||
|
Items = result?.Models?.ToList() ?? new(),
|
||||||
|
TotalItems = (int)(result?.MetaData?.TotalCount ?? 0)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Snackbar.Add($"خطا: {ex.Message}", Severity.Error);
|
||||||
|
return new GridData<PaymentTransactionModel>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task OnFilterSubmit() { if (_dataGrid != null) await _dataGrid.ReloadServerData(); }
|
||||||
|
private async Task OnFilterCleared()
|
||||||
|
{
|
||||||
|
_userId = null; _mobile = _authority = _refId = _orderId = _gateway = null;
|
||||||
|
_paymentStatus = null; _fromDate = _toDate = null;
|
||||||
|
if (_dataGrid != null) await _dataGrid.ReloadServerData();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task ExportCsv()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = await PaymentTxClient.GetAllPaymentTransactionByFilterAsync(new GetAllPaymentTransactionByFilterRequest
|
||||||
|
{
|
||||||
|
PaginationState = new CMSMicroservice.Protobuf.Protos.PaginationState { PageNumber = 1, PageSize = 5000 },
|
||||||
|
Filter = BuildFilter()
|
||||||
|
});
|
||||||
|
var sb = new System.Text.StringBuilder();
|
||||||
|
sb.AppendLine("Id,UserId,Mobile,Gateway,Amount,Authority,RefId,Status,OrderId,Created");
|
||||||
|
foreach (var r in result.Models)
|
||||||
|
sb.AppendLine($"{r.Id},{r.UserId},{r.Mobile},{r.GatewayProvider},{r.Amount},{r.Authority},{r.RefId},{r.PaymentStatus},{r.OrderId},{r.CreatedAt.ToDateTime():yyyy-MM-dd HH:mm}");
|
||||||
|
await jsRuntime.InvokeVoidAsync("jsSaveAsFile", "payment-transactions.csv", sb.ToString());
|
||||||
|
}
|
||||||
|
catch (Exception ex) { Snackbar.Add($"خطا در export: {ex.Message}", Severity.Error); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,95 +0,0 @@
|
|||||||
using BackOffice.Common.BaseComponents;
|
|
||||||
using MudBlazor;
|
|
||||||
|
|
||||||
namespace BackOffice.Pages.Payment;
|
|
||||||
|
|
||||||
public partial class Transactions
|
|
||||||
{
|
|
||||||
private BasePageComponent? _basePage;
|
|
||||||
private MudDataGrid<TransactionModel>? _dataGrid;
|
|
||||||
|
|
||||||
private DateTime? _fromDate;
|
|
||||||
private DateTime? _toDate;
|
|
||||||
private int? _statusFilter;
|
|
||||||
private int? _typeFilter;
|
|
||||||
|
|
||||||
private async Task<GridData<TransactionModel>> LoadData(GridState<TransactionModel> state)
|
|
||||||
{
|
|
||||||
// TODO: Connect to BackOffice.BFF Transactions when API is ready
|
|
||||||
await Task.CompletedTask;
|
|
||||||
|
|
||||||
return new GridData<TransactionModel>
|
|
||||||
{
|
|
||||||
Items = Array.Empty<TransactionModel>(),
|
|
||||||
TotalItems = 0
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task OnFilterSubmit()
|
|
||||||
{
|
|
||||||
if (_dataGrid != null)
|
|
||||||
await _dataGrid.ReloadServerData();
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task OnFilterCleared()
|
|
||||||
{
|
|
||||||
_fromDate = null;
|
|
||||||
_toDate = null;
|
|
||||||
_statusFilter = null;
|
|
||||||
_typeFilter = null;
|
|
||||||
if (_dataGrid != null)
|
|
||||||
await _dataGrid.ReloadServerData();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OpenDetails(TransactionModel model)
|
|
||||||
{
|
|
||||||
// TODO: Open TransactionDetailsDialog with model
|
|
||||||
}
|
|
||||||
|
|
||||||
private static string GetStatusText(int status)
|
|
||||||
{
|
|
||||||
return status switch
|
|
||||||
{
|
|
||||||
0 => "در انتظار",
|
|
||||||
1 => "موفق",
|
|
||||||
2 => "ناموفق",
|
|
||||||
3 => "بازگشت وجه",
|
|
||||||
_ => "نامشخص"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Color GetStatusColor(int status)
|
|
||||||
{
|
|
||||||
return status switch
|
|
||||||
{
|
|
||||||
0 => Color.Warning,
|
|
||||||
1 => Color.Success,
|
|
||||||
2 => Color.Error,
|
|
||||||
3 => Color.Info,
|
|
||||||
_ => Color.Default
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private static string GetTypeText(int type)
|
|
||||||
{
|
|
||||||
return type switch
|
|
||||||
{
|
|
||||||
1 => "خرید پکیج",
|
|
||||||
2 => "پرداخت دستی",
|
|
||||||
3 => "شارژ کیفپول",
|
|
||||||
4 => "بازگشت وجه",
|
|
||||||
_ => "نامشخص"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private class TransactionModel
|
|
||||||
{
|
|
||||||
public long Id { get; set; }
|
|
||||||
public string? RefId { get; set; }
|
|
||||||
public long Amount { get; set; }
|
|
||||||
public int PaymentStatus { get; set; }
|
|
||||||
public DateTime PaymentDate { get; set; }
|
|
||||||
public int Type { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -96,6 +96,7 @@
|
|||||||
// Payment
|
// Payment
|
||||||
"payment" => "پرداخت",
|
"payment" => "پرداخت",
|
||||||
"transactions" => "تراکنشها",
|
"transactions" => "تراکنشها",
|
||||||
|
"ledger-transactions" => "دفتر تراکنشهای مالی",
|
||||||
"manual-payments" => "پرداخت دستی",
|
"manual-payments" => "پرداخت دستی",
|
||||||
|
|
||||||
// Network
|
// Network
|
||||||
|
|||||||
@@ -75,7 +75,7 @@
|
|||||||
<MudNavLink Match="NavLinkMatch.Prefix"
|
<MudNavLink Match="NavLinkMatch.Prefix"
|
||||||
Href="/club/members"
|
Href="/club/members"
|
||||||
Icon="@Icons.Material.Filled.Groups">
|
Icon="@Icons.Material.Filled.Groups">
|
||||||
اعضا و آمار
|
اعضا و گزارشها
|
||||||
</MudNavLink>
|
</MudNavLink>
|
||||||
<MudNavLink Match="NavLinkMatch.Prefix"
|
<MudNavLink Match="NavLinkMatch.Prefix"
|
||||||
Href="/club/features"
|
Href="/club/features"
|
||||||
@@ -200,6 +200,18 @@
|
|||||||
</MudNavLink>
|
</MudNavLink>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<MudNavLink Match="NavLinkMatch.Prefix"
|
||||||
|
Href="/payment/transactions"
|
||||||
|
Icon="@Icons.Material.Filled.ReceiptLong">
|
||||||
|
گزارش تراکنش درگاه
|
||||||
|
</MudNavLink>
|
||||||
|
|
||||||
|
<MudNavLink Match="NavLinkMatch.Prefix"
|
||||||
|
Href="/payment/ledger-transactions"
|
||||||
|
Icon="@Icons.Material.Filled.AccountBalance">
|
||||||
|
دفتر تراکنشهای مالی
|
||||||
|
</MudNavLink>
|
||||||
|
|
||||||
<MudNavLink Match="NavLinkMatch.Prefix"
|
<MudNavLink Match="NavLinkMatch.Prefix"
|
||||||
Href="/wallets"
|
Href="/wallets"
|
||||||
Icon="@Icons.Material.Filled.AccountBalanceWallet">
|
Icon="@Icons.Material.Filled.AccountBalanceWallet">
|
||||||
|
|||||||
Reference in New Issue
Block a user