mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-28 17:43:47 +00:00
feat: add purchases list with pagination to landing stats page
Add card-based purchase list below charts with: - Status filter dropdown (all/pending/paid/delivered/etc) - Paginated card list with contact, gift recipient, tariff, price - Status badges, responsive mobile/desktop layout - Translations for ru/en
This commit is contained in:
@@ -305,6 +305,41 @@ export interface LandingStatsResponse {
|
||||
tariff_stats: LandingTariffStat[];
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// Admin purchase list types
|
||||
// ============================================================
|
||||
|
||||
export type PurchaseItemStatus =
|
||||
| 'pending'
|
||||
| 'paid'
|
||||
| 'delivered'
|
||||
| 'pending_activation'
|
||||
| 'failed'
|
||||
| 'expired';
|
||||
|
||||
export interface LandingPurchaseItem {
|
||||
id: number;
|
||||
token: string;
|
||||
contact_type: 'email' | 'telegram';
|
||||
contact_value: string;
|
||||
is_gift: boolean;
|
||||
gift_recipient_type: 'email' | 'telegram' | null;
|
||||
gift_recipient_value: string | null;
|
||||
tariff_name: string;
|
||||
period_days: number;
|
||||
amount_kopeks: number;
|
||||
currency: string;
|
||||
payment_method: string;
|
||||
status: PurchaseItemStatus;
|
||||
created_at: string;
|
||||
paid_at: string | null;
|
||||
}
|
||||
|
||||
export interface LandingPurchaseListResponse {
|
||||
items: LandingPurchaseItem[];
|
||||
total: number;
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// Admin API
|
||||
// ============================================================
|
||||
@@ -348,4 +383,16 @@ export const adminLandingsApi = {
|
||||
const response = await apiClient.get(`/cabinet/admin/landings/${id}/stats`);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
getPurchases: async (
|
||||
id: number,
|
||||
offset: number,
|
||||
limit: number,
|
||||
status?: PurchaseItemStatus,
|
||||
): Promise<LandingPurchaseListResponse> => {
|
||||
const params: Record<string, string | number> = { offset, limit };
|
||||
if (status) params.status = status;
|
||||
const response = await apiClient.get(`/cabinet/admin/landings/${id}/purchases`, { params });
|
||||
return response.data;
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user