Build issues resolution

This commit is contained in:
Stephanos A
2026-06-02 22:35:07 +03:00
parent aa41cc54a3
commit 4a71708d96
20 changed files with 125 additions and 51 deletions

View File

@@ -53,13 +53,17 @@ export default function AgentsPage() {
const actions = [
{
label: 'View Shifts',
onClick: (agent: any) => window.location.href = `/agents/${agent.id}/shifts`,
onClick: (agent: any) => {
window.location.href = `/agents/${agent.id}/shifts`;
},
variant: 'secondary' as const,
icon: Clock,
},
{
label: 'View Commissions',
onClick: (agent: any) => window.location.href = `/agents/${agent.id}/commissions`,
onClick: (agent: any) => {
window.location.href = `/agents/${agent.id}/commissions`;
},
variant: 'secondary' as const,
icon: DollarSign,
},

View File

@@ -58,7 +58,9 @@ export default function AuditLogsPage() {
const actions = [
{
label: 'View Details',
onClick: (log: any) => window.location.href = `/audit/${log.id}`,
onClick: (log: any) => {
window.location.href = `/audit/${log.id}`;
},
variant: 'secondary' as const,
icon: Eye,
},

View File

@@ -193,7 +193,7 @@ export default function CoachesPage() {
columns={columns}
data={coaches}
actions={actions}
isLoading={isLoading}
loading={isLoading}
/>
</div>

View File

@@ -56,7 +56,7 @@ export default function LoyaltyPage() {
</div>
<DataTable
data={data?.items || data || []}
data={Array.isArray(data) ? data : (data?.items || [])}
columns={columns}
loading={isLoading}
emptyMessage="No loyalty program found"

View File

@@ -65,7 +65,7 @@ export default function PassengersPage() {
},
];
const actions = [
const actions: any[] = [
// TODO: Create passenger detail page
// {
// label: 'View Details',

View File

@@ -26,6 +26,8 @@ export default function PaymentsPage() {
{ key: 'createdAt', label: 'Created', render: (payment: any) => formatDateTime(payment.createdAt) },
];
const actions: any[] = [];
return (
<div className="space-y-6">
<div className="flex items-center justify-between">
@@ -57,8 +59,9 @@ export default function PaymentsPage() {
</div>
<DataTable
data={data?.items || data || []}
data={(data as any)?.items || (Array.isArray(data) ? data : [])}
columns={columns}
actions={actions}
loading={isLoading}
emptyMessage="No payments found"
/>

View File

@@ -239,7 +239,7 @@ export default function RoutesPage() {
</div>
<DataTable
data={routes?.items || routes || []}
data={(routes as any)?.items || (Array.isArray(routes) ? routes : [])}
columns={routeColumns}
actions={routeActions}
loading={routesLoading}

View File

@@ -264,7 +264,7 @@ export default function SchedulesPage() {
</div>
<DataTable
data={data?.items || data || []}
data={(data as any)?.items || (Array.isArray(data) ? data : [])}
columns={columns}
actions={actions}
loading={isLoading}

View File

@@ -125,7 +125,7 @@ export default function SeatClassesPage() {
</div>
<DataTable
data={data?.items || data || []}
data={(data as any)?.items || (Array.isArray(data) ? data : [])}
columns={columns}
actions={actions}
loading={isLoading}

View File

@@ -6,7 +6,7 @@ export const bookingsApi = {
getAll: async (params?: any) => {
const cleanParams = Object.fromEntries(
Object.entries(params || {}).filter(([_, value]) => value !== '' && value !== undefined && value !== null)
);
) as Record<string, string>;
const query = new URLSearchParams(cleanParams).toString();
const response = await apiClient.get<any>(`/bookings${query ? `?${query}` : ''}`);
if (response?.data) {
@@ -24,7 +24,7 @@ export const passengersApi = {
getAll: async (params?: any) => {
const cleanParams = Object.fromEntries(
Object.entries(params || {}).filter(([_, value]) => value !== '' && value !== undefined && value !== null)
);
) as Record<string, string>;
const query = new URLSearchParams(cleanParams).toString();
const response = await apiClient.get<any>(`/passengers${query ? `?${query}` : ''}`);
if (response?.data) {
@@ -40,7 +40,7 @@ export const stationsApi = {
getAll: async (params?: any) => {
const cleanParams = Object.fromEntries(
Object.entries(params || {}).filter(([_, value]) => value !== '' && value !== undefined && value !== null)
);
) as Record<string, string>;
const query = new URLSearchParams(cleanParams).toString();
const response = await apiClient.get<any>(`/stations${query ? `?${query}` : ''}`);
// Handle wrapped response: { success, data: [...], timestamp }
@@ -60,7 +60,7 @@ export const fleetApi = {
getTrains: async (params?: any) => {
const cleanParams = Object.fromEntries(
Object.entries(params || {}).filter(([_, value]) => value !== '' && value !== undefined && value !== null)
);
) as Record<string, string>;
const query = new URLSearchParams(cleanParams).toString();
const response = await apiClient.get<any>(`/fleet/trains${query ? `?${query}` : ''}`);
if (response?.data) {
@@ -71,7 +71,7 @@ export const fleetApi = {
getCoaches: async (params?: any) => {
const cleanParams = Object.fromEntries(
Object.entries(params || {}).filter(([_, value]) => value !== '' && value !== undefined && value !== null)
);
) as Record<string, string>;
const query = new URLSearchParams(cleanParams).toString();
const response = await apiClient.get<any>(`/fleet/coaches${query ? `?${query}` : ''}`);
if (response?.data) {
@@ -90,7 +90,7 @@ export const fleetApi = {
// Schedules API
export const schedulesApi = {
getAll: async (params?: any) => {
const query = new URLSearchParams(params).toString();
const query = new URLSearchParams(params as Record<string, string>).toString();
const response = await apiClient.get<any>(`/schedules${query ? `?${query}` : ''}`);
if (response?.data) {
return Array.isArray(response.data) ? { items: response.data } : response;
@@ -125,7 +125,7 @@ export const seatsApi = {
// Payments API
export const paymentsApi = {
getAll: async (params?: any) => {
const query = new URLSearchParams(params).toString();
const query = new URLSearchParams(params as Record<string, string>).toString();
const response = await apiClient.get<any>(`/payments${query ? `?${query}` : ''}`);
if (response?.data) {
return Array.isArray(response.data) ? { items: response.data } : response;
@@ -140,7 +140,7 @@ export const paymentsApi = {
// Tickets API
export const ticketsApi = {
getAll: async (params?: any) => {
const query = new URLSearchParams(params).toString();
const query = new URLSearchParams(params as Record<string, string>).toString();
const response = await apiClient.get<any>(`/tickets${query ? `?${query}` : ''}`);
if (response?.data) {
return Array.isArray(response.data) ? { items: response.data } : response;
@@ -155,7 +155,7 @@ export const ticketsApi = {
// Agents API
export const agentsApi = {
getAll: async (params?: any) => {
const query = new URLSearchParams(params).toString();
const query = new URLSearchParams(params as Record<string, string>).toString();
const response = await apiClient.get<any>(`/agents${query ? `?${query}` : ''}`);
if (response?.data) {
return Array.isArray(response.data) ? { items: response.data } : response;
@@ -174,7 +174,7 @@ export const agentsApi = {
// Loyalty API
export const loyaltyApi = {
getAccounts: async (params?: any) => {
const query = new URLSearchParams(params).toString();
const query = new URLSearchParams(params as Record<string, string>).toString();
const response = await apiClient.get<any>(`/loyalty/accounts${query ? `?${query}` : ''}`);
if (response?.data) {
return Array.isArray(response.data) ? { items: response.data } : response;
@@ -190,7 +190,7 @@ export const loyaltyApi = {
// Wallet API
export const walletApi = {
getAccounts: async (params?: any) => {
const query = new URLSearchParams(params).toString();
const query = new URLSearchParams(params as Record<string, string>).toString();
const response = await apiClient.get<any>(`/wallet/accounts${query ? `?${query}` : ''}`);
if (response?.data) {
return Array.isArray(response.data) ? { items: response.data } : response;
@@ -205,7 +205,7 @@ export const walletApi = {
// Promotions API
export const promotionsApi = {
getAll: async (params?: any) => {
const query = new URLSearchParams(params).toString();
const query = new URLSearchParams(params as Record<string, string>).toString();
const response = await apiClient.get<any>(`/promos${query ? `?${query}` : ''}`);
if (response?.data) {
return Array.isArray(response.data) ? { items: response.data } : response;
@@ -221,7 +221,7 @@ export const promotionsApi = {
// Support API
export const supportApi = {
getConversations: async (params?: any) => {
const query = new URLSearchParams(params).toString();
const query = new URLSearchParams(params as Record<string, string>).toString();
const response = await apiClient.get<any>(`/support/conversations${query ? `?${query}` : ''}`);
if (response?.data) {
return Array.isArray(response.data) ? { items: response.data } : response;
@@ -242,7 +242,7 @@ export const notificationsApi = {
updateTemplate: (id: string, data: any) => apiClient.patch<any>(`/notifications/templates/${id}`, data),
send: (data: any) => apiClient.post<any>('/notifications/send', data),
getHistory: async (params?: any) => {
const query = new URLSearchParams(params).toString();
const query = new URLSearchParams(params as Record<string, string>).toString();
const response = await apiClient.get<any>(`/notifications/history${query ? `?${query}` : ''}`);
if (response?.data) {
return Array.isArray(response.data) ? { items: response.data } : response;
@@ -254,7 +254,7 @@ export const notificationsApi = {
// Fraud API
export const fraudApi = {
getAlerts: async (params?: any) => {
const query = new URLSearchParams(params).toString();
const query = new URLSearchParams(params as Record<string, string>).toString();
const response = await apiClient.get<any>(`/fraud/alerts${query ? `?${query}` : ''}`);
if (response?.data) {
return Array.isArray(response.data) ? { items: response.data } : response;
@@ -270,7 +270,7 @@ export const fraudApi = {
// Verifayda API
export const verifaydaApi = {
getVerifications: async (params?: any) => {
const query = new URLSearchParams(params).toString();
const query = new URLSearchParams(params as Record<string, string>).toString();
const response = await apiClient.get<any>(`/passengers/verifications${query ? `?${query}` : ''}`);
if (response?.data) {
return Array.isArray(response.data) ? { items: response.data } : response;
@@ -284,7 +284,7 @@ export const verifaydaApi = {
// Audit API
export const auditApi = {
getLogs: async (params?: any) => {
const query = new URLSearchParams(params).toString();
const query = new URLSearchParams(params as Record<string, string>).toString();
const response = await apiClient.get<any>(`/audit/logs${query ? `?${query}` : ''}`);
if (response?.data) {
return Array.isArray(response.data) ? { items: response.data } : response;
@@ -316,7 +316,7 @@ export const foodApi = {
getCategories: () => apiClient.get<any[]>('/food/categories'),
getMenuItems: (scheduleId: string) => apiClient.get<any[]>(`/food/menu/${scheduleId}`),
getOrders: async (params?: any) => {
const query = new URLSearchParams(params).toString();
const query = new URLSearchParams(params as Record<string, string>).toString();
const response = await apiClient.get<any>(`/food/orders${query ? `?${query}` : ''}`);
if (response?.data) {
return Array.isArray(response.data) ? { items: response.data } : response;
@@ -330,7 +330,7 @@ export const foodApi = {
// Reports API
export const reportsApi = {
getOperationalReports: async (params?: any) => {
const query = new URLSearchParams(params).toString();
const query = new URLSearchParams(params as Record<string, string>).toString();
const response = await apiClient.get<any>(`/reports/operational${query ? `?${query}` : ''}`);
if (response?.data) {
return Array.isArray(response.data) ? { items: response.data } : response;