mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-28 17:43:47 +00:00
feat: admin bulk actions page with TanStack Table
Full-featured admin page for mass operations on users: - TanStack Table with checkbox selection (select all / individual) - Server-side pagination, search, and filters (status, tariff, promo group) - Columns: user, subscription status, tariff, balance, days left, promo group - Floating glass-effect action bar with 7 bulk operations: extend subscription, deactivate, activate, change tariff, add traffic, add balance, assign promo group - Action modal dialogs with input fields, loading state, result summary - Responsive design for desktop, mobile, and Telegram Mini App - Full i18n support (ru, en) - Dark theme with accent highlights and status color badges
This commit is contained in:
42
src/api/adminBulkActions.ts
Normal file
42
src/api/adminBulkActions.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import apiClient from './client';
|
||||
|
||||
export type BulkActionType =
|
||||
| 'extend'
|
||||
| 'cancel'
|
||||
| 'activate'
|
||||
| 'change_tariff'
|
||||
| 'add_traffic'
|
||||
| 'add_balance'
|
||||
| 'assign_promo_group';
|
||||
|
||||
export interface BulkActionRequest {
|
||||
action: BulkActionType;
|
||||
user_ids: number[];
|
||||
params: BulkActionParams;
|
||||
}
|
||||
|
||||
export interface BulkActionParams {
|
||||
days?: number;
|
||||
tariff_id?: number;
|
||||
traffic_gb?: number;
|
||||
balance_kopeks?: number;
|
||||
promo_group_id?: number | null;
|
||||
}
|
||||
|
||||
export interface BulkActionResult {
|
||||
success: boolean;
|
||||
total: number;
|
||||
success_count: number;
|
||||
error_count: number;
|
||||
errors: Array<{
|
||||
user_id: number;
|
||||
error: string;
|
||||
}>;
|
||||
}
|
||||
|
||||
export const adminBulkActionsApi = {
|
||||
execute: async (data: BulkActionRequest): Promise<BulkActionResult> => {
|
||||
const response = await apiClient.post('/cabinet/admin/bulk/execute', data);
|
||||
return response.data;
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user