Started a flight view
This commit is contained in:
@@ -1,61 +1,14 @@
|
||||
<script setup lang="ts">
|
||||
import MainLayout from "@/Layouts/MainLayout.vue";
|
||||
import { Head } from '@inertiajs/vue3';
|
||||
import { Flight } from "@/Types/types";
|
||||
import AirlineLogo from "@/Components/FlightsGoneBy/AirlineLogo.vue";
|
||||
import FlightClassBadge from "@/Components/FlightsGoneBy/FlightClassBadge.vue";
|
||||
|
||||
defineOptions({
|
||||
layout: MainLayout
|
||||
})
|
||||
|
||||
interface Airport {
|
||||
id: number
|
||||
name: string
|
||||
iata_code: string
|
||||
}
|
||||
|
||||
interface Airline {
|
||||
id: number
|
||||
name: string
|
||||
iata_code: string
|
||||
}
|
||||
|
||||
interface Aircraft {
|
||||
id: number
|
||||
model_full_name: string
|
||||
designator: string
|
||||
}
|
||||
|
||||
interface SeatType {
|
||||
id: number
|
||||
name: string
|
||||
}
|
||||
|
||||
interface FlightReason {
|
||||
id: number
|
||||
name: string
|
||||
}
|
||||
|
||||
interface FlightClass {
|
||||
id: number
|
||||
name: string
|
||||
}
|
||||
|
||||
interface Flight {
|
||||
id: number
|
||||
flight_number: string | null
|
||||
departure_date: string
|
||||
arrival_date: string
|
||||
aircraft_registration: string | null
|
||||
seat_number: string | null
|
||||
note: string | null
|
||||
departure_airport: Airport
|
||||
arrival_airport: Airport
|
||||
airline: Airline | null
|
||||
aircraft: Aircraft | null
|
||||
seat_type: SeatType | null
|
||||
flight_reason: FlightReason | null
|
||||
flight_class: FlightClass | null
|
||||
}
|
||||
|
||||
defineProps<{
|
||||
user: {
|
||||
id: number
|
||||
@@ -64,44 +17,289 @@ defineProps<{
|
||||
}
|
||||
flights: Flight[]
|
||||
}>()
|
||||
|
||||
const headers = [
|
||||
{ title: 'FLIGHT', key: 'flight_number', sortable: true },
|
||||
{ title: 'FROM', key: 'departure_airport', sortable: true },
|
||||
{ title: 'TO', key: 'arrival_airport', sortable: true },
|
||||
{ title: 'DATE', key: 'departure_date', sortable: true },
|
||||
{ title: 'AIRLINE', key: 'airline', sortable: true },
|
||||
{ title: 'AIRCRAFT', key: 'aircraft.designator', sortable: true },
|
||||
{ title: 'CLASS', key: 'flight_class', sortable: true },
|
||||
{ title: 'SEAT', key: 'seat_number', sortable: false },
|
||||
]
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Head :title="`${user.name}'s Flights`" />
|
||||
|
||||
<div class="p-6">
|
||||
<h1 class="text-2xl font-bold mb-6">{{ user.name }}'s Flights</h1>
|
||||
<div class="board-wrapper">
|
||||
<div class="board-header">
|
||||
<div class="board-title-group">
|
||||
<span class="board-eyebrow">FLIGHT HISTORY</span>
|
||||
<h1 class="board-title">{{ user.name }}</h1>
|
||||
</div>
|
||||
<div class="board-count">
|
||||
<span class="count-number">{{ flights.length }}</span>
|
||||
<span class="count-label">FLIGHTS</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table class="w-full border-collapse border border-gray-300">
|
||||
<thead>
|
||||
<tr class="bg-gray-100">
|
||||
<th class="border border-gray-300 px-4 py-2 text-left">Flight</th>
|
||||
<th class="border border-gray-300 px-4 py-2 text-left">Departure</th>
|
||||
<th class="border border-gray-300 px-4 py-2 text-left">Arrival</th>
|
||||
<th class="border border-gray-300 px-4 py-2 text-left">Date</th>
|
||||
<th class="border border-gray-300 px-4 py-2 text-left">Airline</th>
|
||||
<th class="border border-gray-300 px-4 py-2 text-left">Aircraft</th>
|
||||
<th class="border border-gray-300 px-4 py-2 text-left">Class</th>
|
||||
<th class="border border-gray-300 px-4 py-2 text-left">Seat</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="flight in flights" :key="flight.id" class="hover:bg-gray-50">
|
||||
<td class="border border-gray-300 px-4 py-2">{{ flight.flight_number ?? '—' }}</td>
|
||||
<td class="border border-gray-300 px-4 py-2">{{ flight.departure_airport.iata_code }}</td>
|
||||
<td class="border border-gray-300 px-4 py-2">{{ flight.arrival_airport.iata_code }}</td>
|
||||
<td class="border border-gray-300 px-4 py-2">{{ flight.departure_date }}</td>
|
||||
<td class="border border-gray-300 px-4 py-2">{{ flight.airline?.name ?? '—' }}</td>
|
||||
<td class="border border-gray-300 px-4 py-2">{{ flight.aircraft?.designator ?? '—' }}</td>
|
||||
<td class="border border-gray-300 px-4 py-2">{{ flight.flight_class?.name ?? '—' }}</td>
|
||||
<td class="border border-gray-300 px-4 py-2">{{ flight.seat_number ?? '—' }}</td>
|
||||
</tr>
|
||||
<tr v-if="flights.length === 0">
|
||||
<td colspan="8" class="border border-gray-300 px-4 py-2 text-center text-gray-500">
|
||||
No flights found.
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<v-data-table
|
||||
:headers="headers"
|
||||
:items="flights"
|
||||
:items-per-page="25"
|
||||
class="departures-table"
|
||||
hover
|
||||
>
|
||||
<!-- Flight number + logo -->
|
||||
<template #item.flight_number="{ item }">
|
||||
<div class="flight-cell">
|
||||
<AirlineLogo size="32" :airline="item.airline" class="airline-logo-img" />
|
||||
<span class="flight-number">{{ item.flight_number ?? '—' }}</span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- Departure -->
|
||||
<template #item.departure_airport="{ item }">
|
||||
<span class="iata">{{ item.departure_airport.iata_code }}</span><br/>
|
||||
<span class="city-name">{{ item.departure_airport.municipality ?? '' }}</span>
|
||||
</template>
|
||||
|
||||
<!-- Arrival -->
|
||||
<template #item.arrival_airport="{ item }">
|
||||
<span class="iata">{{ item.arrival_airport.iata_code }}</span><br/>
|
||||
<span class="city-name">{{ item.arrival_airport.municipality ?? '' }}</span>
|
||||
</template>
|
||||
|
||||
<!-- Date -->
|
||||
<template #item.departure_date="{ item }">
|
||||
<span class="date-cell">{{ item.departure_date }}</span>
|
||||
</template>
|
||||
|
||||
<!-- Airline -->
|
||||
<template #item.airline="{ item }">
|
||||
<span class="airline-name">{{ item.airline?.name ?? '—' }}</span>
|
||||
</template>
|
||||
|
||||
<!-- Aircraft -->
|
||||
<template #item.aircraft="{ item }">
|
||||
<span class="mono-tag">{{ item.aircraft?.designator ?? '—' }}</span>
|
||||
</template>
|
||||
|
||||
<!-- Class -->
|
||||
<template #item.flight_class="{ item }">
|
||||
<FlightClassBadge :flight-class="item.flight_class" />
|
||||
</template>
|
||||
|
||||
<!-- Seat -->
|
||||
<template #item.seat_number="{ item }">
|
||||
<span class="seat-cell">{{ item.seat_number ?? '—' }}</span>
|
||||
</template>
|
||||
|
||||
<!-- Empty state -->
|
||||
<template #no-data>
|
||||
<div class="no-data">
|
||||
<span>NO FLIGHTS ON RECORD</span>
|
||||
</div>
|
||||
</template>
|
||||
</v-data-table>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&family=Barlow:wght@400;500;600&family=Barlow+Condensed:wght@500;700&display=swap');
|
||||
|
||||
/* ── Wrapper ── */
|
||||
.board-wrapper {
|
||||
min-height: 100dvh;
|
||||
background: #0d0f14;
|
||||
padding: 2.5rem 2rem;
|
||||
font-family: 'Barlow', sans-serif;
|
||||
width:100%;
|
||||
}
|
||||
|
||||
/* ── Header ── */
|
||||
.board-header {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 2rem;
|
||||
border-bottom: 1px solid rgba(255,193,7,0.2);
|
||||
padding-bottom: 1.25rem;
|
||||
}
|
||||
|
||||
.board-eyebrow {
|
||||
display: block;
|
||||
font-family: 'Share Tech Mono', monospace;
|
||||
font-size: 0.7rem;
|
||||
letter-spacing: 0.2em;
|
||||
color: #ffc107;
|
||||
margin-bottom: 0.25rem;
|
||||
}
|
||||
|
||||
.board-title {
|
||||
font-family: 'Barlow Condensed', sans-serif;
|
||||
font-size: 2.2rem;
|
||||
font-weight: 700;
|
||||
color: #f0f2f5;
|
||||
letter-spacing: 0.04em;
|
||||
line-height: 1;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.board-count {
|
||||
text-align: right;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.count-number {
|
||||
display: block;
|
||||
font-family: 'Share Tech Mono', monospace;
|
||||
font-size: 2rem;
|
||||
color: #ffc107;
|
||||
}
|
||||
|
||||
.count-label {
|
||||
font-family: 'Share Tech Mono', monospace;
|
||||
font-size: 0.65rem;
|
||||
letter-spacing: 0.18em;
|
||||
color: #556;
|
||||
}
|
||||
|
||||
/* ── Vuetify table overrides ── */
|
||||
.departures-table {
|
||||
background: transparent !important;
|
||||
color: #c8cdd8 !important;
|
||||
font-family: 'Barlow', sans-serif !important;
|
||||
}
|
||||
|
||||
/* Header row */
|
||||
:deep(.v-data-table-header__content) {
|
||||
font-family: 'Share Tech Mono', monospace !important;
|
||||
font-size: 0.68rem !important;
|
||||
letter-spacing: 0.14em !important;
|
||||
color: #ffc107 !important;
|
||||
font-weight: 400 !important;
|
||||
}
|
||||
|
||||
:deep(.v-data-table__th) {
|
||||
background: transparent !important;
|
||||
border-bottom: 1px solid rgba(255,193,7,0.15) !important;
|
||||
padding: 0.75rem 1rem !important;
|
||||
}
|
||||
|
||||
/* Body rows — alternating, no borders */
|
||||
:deep(.v-data-table__tr:nth-child(odd)) {
|
||||
background: rgba(255,255,255,0.025) !important;
|
||||
}
|
||||
|
||||
:deep(.v-data-table__tr:nth-child(even)) {
|
||||
background: transparent !important;
|
||||
}
|
||||
|
||||
:deep(.v-data-table__tr:hover td) {
|
||||
background: rgba(255,193,7,0.05) !important;
|
||||
}
|
||||
|
||||
:deep(.v-data-table__td) {
|
||||
border: none !important;
|
||||
padding: 0.7rem 1rem !important;
|
||||
font-size: 0.88rem !important;
|
||||
color: #c8cdd8 !important;
|
||||
}
|
||||
|
||||
/* Footer / pagination */
|
||||
:deep(.v-data-table-footer) {
|
||||
background: transparent !important;
|
||||
border-top: 1px solid rgba(255,255,255,0.06) !important;
|
||||
color: #556 !important;
|
||||
font-family: 'Share Tech Mono', monospace !important;
|
||||
font-size: 0.75rem !important;
|
||||
}
|
||||
|
||||
:deep(.v-data-table-footer .v-btn) {
|
||||
color: #778 !important;
|
||||
}
|
||||
|
||||
:deep(.v-data-table-footer .v-btn--active) {
|
||||
color: #ffc107 !important;
|
||||
}
|
||||
|
||||
/* Sort icon colour */
|
||||
:deep(.v-data-table-header__sort-icon) {
|
||||
color: #ffc107 !important;
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
/* ── Cell styles ── */
|
||||
.flight-cell {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.airline-logo-img {
|
||||
opacity: 0.85;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.flight-number {
|
||||
font-family: 'Share Tech Mono', monospace;
|
||||
font-size: 0.9rem;
|
||||
color: #e8eaf0;
|
||||
letter-spacing: 0.06em;
|
||||
}
|
||||
|
||||
.iata {
|
||||
display: inline-block;
|
||||
font-family: 'Share Tech Mono', monospace;
|
||||
font-size: 1rem;
|
||||
font-weight: 600;
|
||||
color: #e8eaf0;
|
||||
letter-spacing: 0.08em;
|
||||
margin-right: 0.35rem;
|
||||
}
|
||||
|
||||
.city-name {
|
||||
font-size: 0.75rem;
|
||||
color: #556;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.05em;
|
||||
}
|
||||
|
||||
.date-cell {
|
||||
font-family: 'Share Tech Mono', monospace;
|
||||
font-size: 0.82rem;
|
||||
color: #9aa;
|
||||
letter-spacing: 0.04em;
|
||||
}
|
||||
|
||||
.airline-name {
|
||||
font-size: 0.85rem;
|
||||
color: #b0b8c8;
|
||||
}
|
||||
|
||||
.mono-tag {
|
||||
font-family: 'Share Tech Mono', monospace;
|
||||
font-size: 0.8rem;
|
||||
color: #778899;
|
||||
letter-spacing: 0.06em;
|
||||
}
|
||||
|
||||
.seat-cell {
|
||||
font-family: 'Share Tech Mono', monospace;
|
||||
font-size: 0.85rem;
|
||||
color: #c8cdd8;
|
||||
}
|
||||
|
||||
/* ── Empty state ── */
|
||||
.no-data {
|
||||
padding: 3rem;
|
||||
text-align: center;
|
||||
font-family: 'Share Tech Mono', monospace;
|
||||
font-size: 0.8rem;
|
||||
letter-spacing: 0.2em;
|
||||
color: #445;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user