From 028d21f8b9daec2384fe71200b4882fc8932ef0f Mon Sep 17 00:00:00 2001 From: Code Date: Mon, 28 Sep 2026 12:22:35 +0100 Subject: [PATCH] Fix #556: Add a boarding-pass view --- .../src/components/BoardingPassView.tsx | 150 ++++++++++++++++++ 1 file changed, 150 insertions(+) create mode 100644 packages/client/src/components/BoardingPassView.tsx diff --git a/packages/client/src/components/BoardingPassView.tsx b/packages/client/src/components/BoardingPassView.tsx new file mode 100644 index 00000000..71d90d53 --- /dev/null +++ b/packages/client/src/components/BoardingPassView.tsx @@ -0,0 +1,150 @@ +import React from 'react'; +import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; +import { Badge } from '@/components/ui/badge'; +import { Separator } from '@/components/ui/separator'; +import { Button } from '@/components/ui/button'; +import { Plane, Download, Wallet, Printer } from 'lucide-react'; +import { apiClient, CheckInRecord } from '@/lib/api'; + +interface BoardingPassViewProps { + bookingId: string; + checkIn: CheckInRecord; + fromAirport?: string; + toAirport?: string; + flightNumber?: string; + airlineCode?: string; + passengerName?: string; + departureTime?: string; + gate?: string; + terminal?: string; +} + +export function BoardingPassView({ + bookingId, + checkIn, + fromAirport, + toAirport, + flightNumber, + airlineCode, + passengerName, + departureTime, + gate, + terminal, +}: BoardingPassViewProps) { + const pdfUrl = apiClient.getBoardingPassPdfUrl(bookingId); + + const handlePrint = () => { + window.print(); + }; + + return ( +
+
+ +
+ + + +
+
+ + + Traqora Boarding Pass + +

+ Flight {airlineCode}{flightNumber} +

+
+ + {checkIn.status ? checkIn.status.replace(/_/g, ' ') : 'Checked In'} + +
+
+ + +
+
+ Passenger +

{passengerName || 'Valued Passenger'}

+
+
+ Route +
+ {fromAirport || 'ORIGIN'} + + {toAirport || 'DEST'} +
+
+
+ Departure +

+ {departureTime ? new Date(departureTime).toLocaleString() : 'As Scheduled'} +

+
+
+ + + +
+
+ Seat +

{checkIn.seatNumber || 'Not assigned'}

+
+
+ Gate +

{gate || 'TBD'}

+
+
+ Terminal +

{terminal || 'TBD'}

+
+
+ Boarding Code +

+ {checkIn.boardingPassCode} +

+
+
+ +
+
+ Please arrive at the boarding gate at least 45 minutes prior to departure. +
+ {checkIn.status === 'checked_in' && ( +
+ + + + +
+ )} +
+
+
+
+ ); +}