mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-07 22:25:42 +00:00
Generate ticket, dashboard, excess luggage rate updates
This commit is contained in:
@@ -31,4 +31,7 @@ export const bookingsApi = {
|
||||
|
||||
forceConfirm: (bookingId: string, data: { paymentReference?: string; paymentMethod?: string; notes?: string }) =>
|
||||
apiClient.post(`/payments/${bookingId}/force-confirm`, data),
|
||||
|
||||
smartAssign: (bookingId: string) =>
|
||||
apiClient.post(`/tickets/smart-assign/${bookingId}`, {}),
|
||||
};
|
||||
|
||||
@@ -2,6 +2,21 @@ import { apiClient } from '@/lib/api-client';
|
||||
import { DashboardStats, RevenueData } from '@/types';
|
||||
|
||||
export const dashboardApi = {
|
||||
getBackofficeStats: async () => {
|
||||
const response = await apiClient.get<{
|
||||
totalBookings: number;
|
||||
totalNormalBookings: number;
|
||||
totalPackageBookings: number;
|
||||
totalTickets: number;
|
||||
totalNormalTickets: number;
|
||||
totalPackageTickets: number;
|
||||
totalPassengers: number;
|
||||
revenueByCurrency: { currency: string; totalMinor: number }[];
|
||||
packageRevenueByCurrency: { currency: string; totalMinor: number }[];
|
||||
}>('/dashboard/backoffice-stats');
|
||||
return response;
|
||||
},
|
||||
|
||||
getStats: async () => {
|
||||
try {
|
||||
// Fetch bookings and passengers data in parallel
|
||||
|
||||
@@ -46,6 +46,8 @@ export const bookingsApi = {
|
||||
checkUsage: (id: string) => apiClient.get<any>(`/bookings/${id}/usage`),
|
||||
forceConfirm: (bookingId: string, data: { paymentReference?: string; paymentMethod?: string; notes?: string }) =>
|
||||
apiClient.post<any>(`/payments/${bookingId}/force-confirm`, data),
|
||||
smartAssign: (bookingId: string) =>
|
||||
apiClient.post<any>(`/tickets/smart-assign/${bookingId}`, {}),
|
||||
};
|
||||
|
||||
// Passengers API
|
||||
|
||||
@@ -4,8 +4,9 @@ export const formatCurrency = (amount: number, currency: string = 'ETB'): string
|
||||
return new Intl.NumberFormat('en-US', {
|
||||
style: 'currency',
|
||||
currency,
|
||||
currencyDisplay: 'code',
|
||||
minimumFractionDigits: 2,
|
||||
}).format(amount / 100);
|
||||
}).format(amount / 100).replace(/^([A-Z]{3})/, '$1 ').trim();
|
||||
};
|
||||
|
||||
export const formatDate = (date?: string | Date | null, formatStr: string = 'MMM dd, yyyy'): string => {
|
||||
|
||||
Reference in New Issue
Block a user