Some checks failed
CI/CD Pipeline - Xpeditis PreProd / Backend - Build & Test (push) Failing after 5m51s
CI/CD Pipeline - Xpeditis PreProd / Backend - Docker Build & Push (push) Has been skipped
CI/CD Pipeline - Xpeditis PreProd / Frontend - Build & Test (push) Successful in 10m57s
CI/CD Pipeline - Xpeditis PreProd / Frontend - Docker Build & Push (push) Failing after 12m28s
CI/CD Pipeline - Xpeditis PreProd / Deploy to PreProd Server (push) Has been skipped
CI/CD Pipeline - Xpeditis PreProd / Run Smoke Tests (push) Has been skipped
73 lines
1.5 KiB
TypeScript
73 lines
1.5 KiB
TypeScript
/**
|
|
* Dashboard API Client
|
|
*/
|
|
|
|
import { get } from '../../src/lib/api/client';
|
|
|
|
export interface DashboardKPIs {
|
|
bookingsThisMonth: number;
|
|
totalTEUs: number;
|
|
estimatedRevenue: number;
|
|
pendingConfirmations: number;
|
|
bookingsThisMonthChange: number;
|
|
totalTEUsChange: number;
|
|
estimatedRevenueChange: number;
|
|
pendingConfirmationsChange: number;
|
|
}
|
|
|
|
export interface BookingsChartData {
|
|
labels: string[];
|
|
data: number[];
|
|
}
|
|
|
|
export interface TopTradeLane {
|
|
route: string;
|
|
originPort: string;
|
|
destinationPort: string;
|
|
bookingCount: number;
|
|
totalTEUs: number;
|
|
avgPrice: number;
|
|
}
|
|
|
|
export interface DashboardAlert {
|
|
id: string;
|
|
type: 'delay' | 'confirmation' | 'document' | 'payment' | 'info';
|
|
severity: 'low' | 'medium' | 'high' | 'critical';
|
|
title: string;
|
|
message: string;
|
|
bookingId?: string;
|
|
bookingNumber?: string;
|
|
createdAt: string;
|
|
isRead: boolean;
|
|
}
|
|
|
|
export const dashboardApi = {
|
|
/**
|
|
* Get dashboard KPIs
|
|
*/
|
|
async getKPIs(): Promise<DashboardKPIs> {
|
|
return get<DashboardKPIs>('/api/v1/dashboard/kpis');
|
|
},
|
|
|
|
/**
|
|
* Get bookings chart data
|
|
*/
|
|
async getBookingsChart(): Promise<BookingsChartData> {
|
|
return get<BookingsChartData>('/api/v1/dashboard/bookings-chart');
|
|
},
|
|
|
|
/**
|
|
* Get top trade lanes
|
|
*/
|
|
async getTopTradeLanes(): Promise<TopTradeLane[]> {
|
|
return get<TopTradeLane[]>('/api/v1/dashboard/top-trade-lanes');
|
|
},
|
|
|
|
/**
|
|
* Get dashboard alerts
|
|
*/
|
|
async getAlerts(): Promise<DashboardAlert[]> {
|
|
return get<DashboardAlert[]>('/api/v1/dashboard/alerts');
|
|
},
|
|
};
|