mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-07 07:15:45 +00:00
Build related issues resolution
This commit is contained in:
@@ -58,7 +58,7 @@ 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,
|
||||
},
|
||||
|
||||
@@ -193,7 +193,7 @@ export default function CoachesPage() {
|
||||
columns={columns}
|
||||
data={coaches}
|
||||
actions={actions}
|
||||
isLoading={isLoading}
|
||||
loading={isLoading}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ export default function DashboardPage() {
|
||||
|
||||
const recentBookings = Array.isArray(recentBookingsData)
|
||||
? recentBookingsData
|
||||
: recentBookingsData?.items || recentBookingsData?.data || [];
|
||||
: (recentBookingsData as any)?.items || (recentBookingsData as any)?.data || [];
|
||||
|
||||
const columns = [
|
||||
{ key: 'reference', label: 'Reference', render: (item: any) => item.bookingRef || item.reference },
|
||||
@@ -49,7 +49,7 @@ export default function DashboardPage() {
|
||||
<div className="space-y-6">
|
||||
<div>
|
||||
<h1 className="text-3xl font-bold text-foreground">Dashboard</h1>
|
||||
<p className="text-muted-foreground mt-1">Welcome back! Here's what's happening today.</p>
|
||||
<p className="text-muted-foreground mt-1">Welcome back! Here's what's happening today.</p>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-4">
|
||||
|
||||
@@ -65,7 +65,7 @@ export default function PassengersPage() {
|
||||
},
|
||||
];
|
||||
|
||||
const actions = [
|
||||
const actions: any[] = [
|
||||
// TODO: Create passenger detail page
|
||||
// {
|
||||
// label: 'View Details',
|
||||
|
||||
@@ -136,15 +136,17 @@ export default function RoutesPage() {
|
||||
|
||||
const generateRouteCode = (originId: string, destId: string) => {
|
||||
if (!originId || !destId) return '';
|
||||
const origin = stations?.items?.find((s: any) => s.id === originId);
|
||||
const dest = stations?.items?.find((s: any) => s.id === destId);
|
||||
const stationsList = Array.isArray(stations) ? stations : (stations as any)?.items || [];
|
||||
const origin = stationsList.find((s: any) => s.id === originId);
|
||||
const dest = stationsList.find((s: any) => s.id === destId);
|
||||
return origin && dest ? `${origin.code}-${dest.code}` : '';
|
||||
};
|
||||
|
||||
const generateRouteName = (originId: string, destId: string) => {
|
||||
if (!originId || !destId) return '';
|
||||
const origin = stations?.items?.find((s: any) => s.id === originId);
|
||||
const dest = stations?.items?.find((s: any) => s.id === destId);
|
||||
const stationsList = Array.isArray(stations) ? stations : (stations as any)?.items || [];
|
||||
const origin = stationsList.find((s: any) => s.id === originId);
|
||||
const dest = stationsList.find((s: any) => s.id === destId);
|
||||
return origin && dest ? `${origin.name} - ${dest.name}` : '';
|
||||
};
|
||||
|
||||
@@ -272,7 +274,7 @@ export default function RoutesPage() {
|
||||
disabled={!!editingRoute}
|
||||
>
|
||||
<option value="">Select Origin</option>
|
||||
{stations?.items?.map((station: any) => (
|
||||
{(Array.isArray(stations) ? stations : (stations as any)?.items || []).map((station: any) => (
|
||||
<option key={station.id} value={station.id}>
|
||||
{station.name} ({station.code})
|
||||
</option>
|
||||
@@ -289,7 +291,7 @@ export default function RoutesPage() {
|
||||
disabled={!!editingRoute}
|
||||
>
|
||||
<option value="">Select Destination</option>
|
||||
{stations?.items?.map((station: any) => (
|
||||
{(Array.isArray(stations) ? stations : (stations as any)?.items || []).map((station: any) => (
|
||||
<option key={station.id} value={station.id}>
|
||||
{station.name} ({station.code})
|
||||
</option>
|
||||
@@ -373,8 +375,8 @@ export default function RoutesPage() {
|
||||
<div className="flex-1 font-medium">
|
||||
{originStationId ? (
|
||||
<span>
|
||||
{stations?.items?.find((s: any) => s.id === originStationId)?.name || 'Unknown'}
|
||||
{' '}({stations?.items?.find((s: any) => s.id === originStationId)?.code || 'N/A'})
|
||||
{(Array.isArray(stations) ? stations : (stations as any)?.items || []).find((s: any) => s.id === originStationId)?.name || 'Unknown'}
|
||||
{' '}({(Array.isArray(stations) ? stations : (stations as any)?.items || []).find((s: any) => s.id === originStationId)?.code || 'N/A'})
|
||||
</span>
|
||||
) : (
|
||||
<span className="text-muted-foreground">Select origin station above</span>
|
||||
@@ -399,7 +401,7 @@ export default function RoutesPage() {
|
||||
required
|
||||
>
|
||||
<option value="">Select Station</option>
|
||||
{stations?.items?.filter((s: any) =>
|
||||
{(Array.isArray(stations) ? stations : (stations as any)?.items || []).filter((s: any) =>
|
||||
s.id !== originStationId &&
|
||||
s.id !== destinationStationId &&
|
||||
!stops.some((st, idx) => idx !== index && st.stationId === s.id)
|
||||
@@ -455,8 +457,8 @@ export default function RoutesPage() {
|
||||
<div className="flex-1 font-medium">
|
||||
{destinationStationId ? (
|
||||
<span>
|
||||
{stations?.items?.find((s: any) => s.id === destinationStationId)?.name || 'Unknown'}
|
||||
{' '}({stations?.items?.find((s: any) => s.id === destinationStationId)?.code || 'N/A'})
|
||||
{(Array.isArray(stations) ? stations : (stations as any)?.items || []).find((s: any) => s.id === destinationStationId)?.name || 'Unknown'}
|
||||
{' '}({(Array.isArray(stations) ? stations : (stations as any)?.items || []).find((s: any) => s.id === destinationStationId)?.code || 'N/A'})
|
||||
</span>
|
||||
) : (
|
||||
<span className="text-muted-foreground">Select destination station above</span>
|
||||
|
||||
@@ -125,7 +125,7 @@ export default function SeatClassesPage() {
|
||||
</div>
|
||||
|
||||
<DataTable
|
||||
data={data?.items || data || []}
|
||||
data={(Array.isArray(data) ? data : (data as any)?.items) || []}
|
||||
columns={columns}
|
||||
actions={actions}
|
||||
loading={isLoading}
|
||||
|
||||
Reference in New Issue
Block a user