feat: add gifts tab to admin user detail page

Display sent and received gift subscriptions with status badges,
extracted GiftCard component, and full i18n support (ru/en/zh/fa).
This commit is contained in:
Fringg
2026-03-11 03:30:13 +03:00
parent 03c9e73a37
commit 695ab42e03
6 changed files with 481 additions and 6 deletions

View File

@@ -351,6 +351,36 @@ export interface SyncToPanelRequest {
update_squads?: boolean;
}
export interface AdminUserGiftItem {
id: number;
token: string;
status: string;
tariff_name: string | null;
period_days: number;
device_limit: number;
amount_kopeks: number;
payment_method: string | null;
gift_recipient_type: string | null;
gift_recipient_value: string | null;
gift_message: string | null;
buyer_user_id: number | null;
buyer_username: string | null;
buyer_full_name: string | null;
receiver_user_id: number | null;
receiver_username: string | null;
receiver_full_name: string | null;
created_at: string | null;
paid_at: string | null;
delivered_at: string | null;
}
export interface AdminUserGiftsResponse {
sent: AdminUserGiftItem[];
received: AdminUserGiftItem[];
sent_total: number;
received_total: number;
}
// ============ API ============
export const adminUsersApi = {
@@ -614,4 +644,10 @@ export const adminUsersApi = {
const response = await apiClient.delete(`/cabinet/admin/users/${userId}/devices`);
return response.data;
},
// Get user gifts
getUserGifts: async (userId: number): Promise<AdminUserGiftsResponse> => {
const response = await apiClient.get(`/cabinet/admin/users/${userId}/gifts`);
return response.data;
},
};