Generate ticket, dashboard, excess luggage rate updates

This commit is contained in:
Stephanos A
2026-07-16 08:41:35 +03:00
parent 2d2fcfbda9
commit b2b31f30bb
16 changed files with 585 additions and 315 deletions

View File

@@ -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}`, {}),
};

View File

@@ -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

View File

@@ -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

View File

@@ -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 => {