From 43f5c8ac3ea488a82d709d848d950ec29659c9b7 Mon Sep 17 00:00:00 2001 From: josh Date: Tue, 7 Apr 2026 21:31:36 +1000 Subject: [PATCH] Started a flight view --- .../Controllers/FlightProfileController.php | 3 +- app/Models/Airline.php | 6 + resources/css/app.css | 2 + .../Components/FlightsGoneBy/AirlineLogo.vue | 113 ++++++++- .../FlightsGoneBy/FlightListTable.vue | 238 ++++++++++++++++++ resources/js/Layouts/MainLayout.vue | 4 +- resources/js/Pages/Dashboard.vue | 2 +- resources/js/Pages/FlightProfile.vue | 205 +-------------- resources/js/Types/types.d.ts | 20 ++ 9 files changed, 384 insertions(+), 209 deletions(-) create mode 100644 resources/js/Components/FlightsGoneBy/FlightListTable.vue diff --git a/app/Http/Controllers/FlightProfileController.php b/app/Http/Controllers/FlightProfileController.php index cfdc5e8..6d1447f 100644 --- a/app/Http/Controllers/FlightProfileController.php +++ b/app/Http/Controllers/FlightProfileController.php @@ -17,12 +17,13 @@ class FlightProfileController extends Controller ->with([ 'departureAirport', 'arrivalAirport', - 'airline', + 'airline.country', 'aircraft', 'seatType', 'flightReason', 'flightClass', ]) + ->orderBy('departure_date') ->get(); return Inertia::render('FlightProfile', [ diff --git a/app/Models/Airline.php b/app/Models/Airline.php index eaefebe..c67dbb0 100644 --- a/app/Models/Airline.php +++ b/app/Models/Airline.php @@ -4,6 +4,7 @@ namespace App\Models; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\BelongsTo; class Airline extends Model { @@ -25,4 +26,9 @@ class Airline extends Model public $timestamps = false; + + public function country(): BelongsTo + { + return $this->belongsTo(Country::class); + } } diff --git a/resources/css/app.css b/resources/css/app.css index 4a9218b..009e84a 100644 --- a/resources/css/app.css +++ b/resources/css/app.css @@ -10,6 +10,8 @@ --accent-soft: #0ea5e9; /* deeper blue */ --accent-glow: rgba(56, 189, 248, 0.15); --border: #1f2937; + --table-heading: #ffc107; + --table-border: rgba(255,193,7,0.2) } diff --git a/resources/js/Components/FlightsGoneBy/AirlineLogo.vue b/resources/js/Components/FlightsGoneBy/AirlineLogo.vue index 6c394aa..75f203a 100644 --- a/resources/js/Components/FlightsGoneBy/AirlineLogo.vue +++ b/resources/js/Components/FlightsGoneBy/AirlineLogo.vue @@ -10,15 +10,57 @@ const props = defineProps<{ const page = usePage().props; const logoUrl = computed(() => `url('${page.logo_api_url}/airlines/logos/tail/id/${props.airline?.id}')`); +const logoStyle = computed(() => ({ + width: size.value, + height: size.value, + backgroundImage: logoUrl.value, + backgroundSize: 'contain', + backgroundRepeat: 'no-repeat', + display: 'inline-block', +})); const size = computed(() => props.size ? props.size + 'px' : '30px'); diff --git a/resources/js/Components/FlightsGoneBy/FlightListTable.vue b/resources/js/Components/FlightsGoneBy/FlightListTable.vue new file mode 100644 index 0000000..8488cb7 --- /dev/null +++ b/resources/js/Components/FlightsGoneBy/FlightListTable.vue @@ -0,0 +1,238 @@ + + + + + diff --git a/resources/js/Layouts/MainLayout.vue b/resources/js/Layouts/MainLayout.vue index 0d6f33e..f22f6f6 100644 --- a/resources/js/Layouts/MainLayout.vue +++ b/resources/js/Layouts/MainLayout.vue @@ -4,8 +4,9 @@ import MainFooter from "@/Components/FlightsGoneBy/MainFooter.vue"; import Radar from "@/Components/FlightsGoneBy/Radar.vue"; import { usePage, router } from "@inertiajs/vue3"; import { ref } from "vue"; +import {SharedProps} from "@/Types/types"; -const page = usePage(); +const page = usePage().props; const transitionKey = ref(0); router.on('success', () => { @@ -45,7 +46,6 @@ footer { main { flex: 1 1 auto; - padding: 1rem; background: transparent; display: flex; flex-direction: column; diff --git a/resources/js/Pages/Dashboard.vue b/resources/js/Pages/Dashboard.vue index ecb619a..c71339f 100644 --- a/resources/js/Pages/Dashboard.vue +++ b/resources/js/Pages/Dashboard.vue @@ -34,7 +34,7 @@ const name = computed(() => page?.props?.auth?.user?.name || 'there'); - + View Profile diff --git a/resources/js/Pages/FlightProfile.vue b/resources/js/Pages/FlightProfile.vue index 9086edb..2a71d31 100644 --- a/resources/js/Pages/FlightProfile.vue +++ b/resources/js/Pages/FlightProfile.vue @@ -4,6 +4,7 @@ import { Head } from '@inertiajs/vue3'; import { Flight } from "@/Types/types"; import AirlineLogo from "@/Components/FlightsGoneBy/AirlineLogo.vue"; import FlightClassBadge from "@/Components/FlightsGoneBy/FlightClassBadge.vue"; +import FlightListTable from "@/Components/FlightsGoneBy/FlightListTable.vue"; defineOptions({ layout: MainLayout @@ -18,16 +19,6 @@ 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 }, -] @@ -167,139 +100,5 @@ const headers = [ 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; -} diff --git a/resources/js/Types/types.d.ts b/resources/js/Types/types.d.ts index cf72dc9..3a5fdd9 100644 --- a/resources/js/Types/types.d.ts +++ b/resources/js/Types/types.d.ts @@ -40,6 +40,23 @@ export interface Airport { timezone: string } +export type Continent = { + id: number + name: string + code: string + internal_name:string +} + +export type Country = { + id: number + code: string + name: string + created_at: string | null + updated_at: string | null + continent_id: number + continent?: Continent +} + export interface Airline { id: number IATA_code: string | null @@ -49,8 +66,11 @@ export interface Airline { active: boolean logo: string | null country_id: number + country?: Country } + + export interface Aircraft { id: number designator: string