feat(commission/payouts): add bulk wallet credit button for pending payouts
Build and Deploy to Kubernetes / build-and-deploy (push) Failing after 6m1s
Build and Deploy to Kubernetes / build-and-deploy (push) Failing after 6m1s
- UserPayouts.razor: add 'واریز به کیف پول' button in toolbar, enabled only when a week is selected; shows loading spinner while processing - UserPayouts.razor.cs: implement BulkCreditWallets — confirms with dialog, calls BulkCreditPayoutsAsync, shows credited count + amount in snackbar - BackOffice.csproj: bump Foursat.CMSMicroservice.Protobuf to 0.0.198 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -138,7 +138,7 @@
|
|||||||
|
|
||||||
<!-- CMS Protobuf NuGet package (used for both local dev and Docker builds) -->
|
<!-- CMS Protobuf NuGet package (used for both local dev and Docker builds) -->
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Foursat.CMSMicroservice.Protobuf" Version="0.0.197" />
|
<PackageReference Include="Foursat.CMSMicroservice.Protobuf" Version="0.0.198" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<!-- ============================================================ -->
|
<!-- ============================================================ -->
|
||||||
|
|||||||
@@ -49,6 +49,21 @@
|
|||||||
StartIcon="@Icons.Material.Filled.Search">
|
StartIcon="@Icons.Material.Filled.Search">
|
||||||
جستجو
|
جستجو
|
||||||
</MudButton>
|
</MudButton>
|
||||||
|
<MudButton Variant="Variant.Filled"
|
||||||
|
Color="Color.Success"
|
||||||
|
StartIcon="@Icons.Material.Filled.AccountBalanceWallet"
|
||||||
|
Disabled="@(!_filterWeekDefinitionId.HasValue || _isCreditingWallets)"
|
||||||
|
OnClick="BulkCreditWallets">
|
||||||
|
@if (_isCreditingWallets)
|
||||||
|
{
|
||||||
|
<MudProgressCircular Size="Size.Small" Indeterminate="true" Class="ms-n1 me-2" />
|
||||||
|
<span>در حال واریز...</span>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<span>واریز به کیف پول</span>
|
||||||
|
}
|
||||||
|
</MudButton>
|
||||||
</MudStack>
|
</MudStack>
|
||||||
</ToolBarContent>
|
</ToolBarContent>
|
||||||
<Columns>
|
<Columns>
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ public partial class UserPayouts
|
|||||||
private long? _filterWeekDefinitionId;
|
private long? _filterWeekDefinitionId;
|
||||||
private int? _filterStatus;
|
private int? _filterStatus;
|
||||||
private long? _filterPackageId;
|
private long? _filterPackageId;
|
||||||
|
private bool _isCreditingWallets;
|
||||||
|
|
||||||
private async Task<GridData<UserCommissionPayoutModel>> ServerReload(GridState<UserCommissionPayoutModel> state)
|
private async Task<GridData<UserCommissionPayoutModel>> ServerReload(GridState<UserCommissionPayoutModel> state)
|
||||||
{
|
{
|
||||||
@@ -147,6 +148,50 @@ public partial class UserPayouts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task BulkCreditWallets()
|
||||||
|
{
|
||||||
|
if (!_filterWeekDefinitionId.HasValue)
|
||||||
|
{
|
||||||
|
Snackbar.Add("لطفاً ابتدا یک هفته انتخاب کنید", Severity.Warning);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var confirmed = await DialogService.ShowMessageBox(
|
||||||
|
"واریز دستهجمعی به کیف پول",
|
||||||
|
$"آیا از واریز کمیسیون همه پرداختهای «در انتظار» هفته انتخابشده به کیف پول کاربران مطمئن هستید؟ این عملیات برگشتپذیر نیست.",
|
||||||
|
yesText: "بله، واریز کن", cancelText: "لغو");
|
||||||
|
|
||||||
|
if (confirmed != true)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_isCreditingWallets = true;
|
||||||
|
StateHasChanged();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = await CommissionContract.BulkCreditPayoutsAsync(new BulkCreditPayoutsRequest
|
||||||
|
{
|
||||||
|
WeekDefinitionId = _filterWeekDefinitionId.Value
|
||||||
|
});
|
||||||
|
|
||||||
|
if (result.CreditedCount == 0)
|
||||||
|
Snackbar.Add("هیچ پرداخت در انتظاری برای این هفته یافت نشد", Severity.Info);
|
||||||
|
else
|
||||||
|
Snackbar.Add(result.Message, Severity.Success);
|
||||||
|
|
||||||
|
await ApplyFilter();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Snackbar.Add($"خطا در واریز: {ex.Message}", Severity.Error);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
_isCreditingWallets = false;
|
||||||
|
StateHasChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private async Task RejectWithdrawal(UserCommissionPayoutModel payout)
|
private async Task RejectWithdrawal(UserCommissionPayoutModel payout)
|
||||||
{
|
{
|
||||||
var reason = await DialogService.ShowMessageBox(
|
var reason = await DialogService.ShowMessageBox(
|
||||||
|
|||||||
Reference in New Issue
Block a user