Started a flight view

This commit is contained in:
2026-04-07 18:11:12 +10:00
parent 2ad8c65b86
commit 79469c02cf
6 changed files with 600 additions and 84 deletions
@@ -0,0 +1,113 @@
<?php
use App\Models\Airline;
use App\Models\Airport;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Airport::where('iata_code', 'LZR')->update(['municipality' => 'Lizard Island']);
Airport::where('iata_code', 'SYD')->update(['municipality' => 'Sydney']);
Airport::where('iata_code', 'ISB')->update(['municipality' => 'Islamabad']);
Airport::where('iata_code', 'KUL')->update(['municipality' => 'Kuala Lumpur']);
Airport::where('iata_code', 'USM')->update(['municipality' => 'Ko Samui']);
Airport::where('iata_code', 'CDG')->update(['municipality' => 'Paris']);
Airport::where('iata_code', 'ORY')->update(['municipality' => 'Paris']);
Airport::where('iata_code', 'FRA')->update(['municipality' => 'Frankfurt']);
Airport::where('iata_code', 'EZE')->update(['municipality' => 'Buenos Aires']);
Airport::where('iata_code', 'PVG')->update(['municipality' => 'Shanghai']);
Airport::where('iata_code', 'MRU')->update(['municipality' => 'Mauritius']);
Airport::where('iata_code', 'HNL')->update(['municipality' => 'Honolulu']);
Airport::where('iata_code', 'NCL')->update(['municipality' => 'Newcastle upon Tyne']);
Airport::where('iata_code', 'KRK')->update(['municipality' => 'Krakow']);
Airport::where('iata_code', 'OTP')->update(['municipality' => 'Bucharest']);
Airport::where('iata_code', 'CAN')->update(['municipality' => 'Guangzhou']);
Airport::where('iata_code', 'XIY')->update(['municipality' => "Xi'an"]);
Airport::where('iata_code', 'ROR')->update(['municipality' => "Koror"]);
Airport::where('iata_code', 'WUH')->update(['municipality' => "Wuhan"]);
Airport::where('iata_code', 'CCS')->update(['municipality' => "Caracas"]);
Airport::where('iata_code', 'TFU')->update(['municipality' => "Chengdu"]);
Airport::where('iata_code', 'CTU')->update(['municipality' => "Chengdu"]);
Airport::where('iata_code', 'DMM')->update(['municipality' => "Dammam"]);
Airport::where('iata_code', 'VCE')->update(['municipality' => "Venice"]);
Airport::where('iata_code', 'MXP')->update(['municipality' => "Milan"]);
Airport::where('iata_code', 'DPS')->update(['municipality' => "Denpasar"]);
Airport::where('iata_code', 'CAY')->update(['municipality' => "Cayenne"]);
Airport::where('iata_code', 'LPA')->update(['municipality' => "Gran Canaria"]);
Airline::where('internal_name', 'thy-turkish-airlines')->update(['name' => 'Turkish Airlines']);
Airline::where('internal_name', 'air-china')->update(['name' => 'Air China']);
Airline::where('internal_name', 'jetstar-airways-pty')->update(['name' => 'Jetstar']);
Airline::where('internal_name', 'easyjet')->update(['name' => 'Easyjet']);
Airline::where('internal_name', 'china-west-air')->update(['name' => 'China West Air']);
Airline::where('internal_name', 'aeroenlaces-nacionales-s-a-de-c-v')->update(['name' => 'Viva']);
Airline::where('internal_name', 'aircompany-somon-air')->update(['name' => 'Somon Air']);
Airline::where('internal_name', 'hinterland-aviation-pty')->update(['name' => 'Hinterland Aviation']);
Airline::where('internal_name', 'mango-airlines-soc-trading-as-mango')->update(['name' => 'Mango']);
Airline::where('internal_name', 'air-manas-dba-air-manas-air')->update(['name' => 'Air Manas']);
Airline::where('internal_name', 'airasia-x-berhad-dba-airasia-x')->update(['name' => 'Air Asia X']);
Airline::where('internal_name', 'mesa-airlines')->update(['name' => 'Mesa Airlines']);
Airport::where('iata_code', 'MCT')->update(['municipality' => "Muscat"]);
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Airport::where('iata_code', 'LZR')->update(['municipality' => '']);
Airport::where('iata_code', 'SYD')->update(['municipality' => 'Sydney (Mascot)']);
Airport::where('iata_code', 'ISB')->update(['municipality' => 'Attock']);
Airport::where('iata_code', 'KUL')->update(['municipality' => 'Sepang']);
Airport::where('iata_code', 'USM')->update(['municipality' => 'Na Thon (Ko Samui Island)']);
Airport::where('iata_code', 'CDG')->update(['municipality' => "Paris (Roissy-en-France, Val-d'Oise)"]);
Airport::where('iata_code', 'ORY')->update(['municipality' => "Paris (Orly, Val-de-Marne)"]);
Airport::where('iata_code', 'FRA')->update(['municipality' => 'Frankfurt am Main']);
Airport::where('iata_code', 'EZE')->update(['municipality' => 'Buenos Aires (Ezeiza)']);
Airport::where('iata_code', 'PVG')->update(['municipality' => 'Shanghai (Pudong)']);
Airport::where('iata_code', 'MRU')->update(['municipality' => 'Plaine Magnien']);
Airport::where('iata_code', 'HNL')->update(['municipality' => 'Honolulu, Oahu']);
Airport::where('iata_code', 'NCL')->update(['municipality' => 'Newcastle upon Tyne, Tyne and Wear']);
Airport::where('iata_code', 'KRK')->update(['municipality' => 'Balice']);
Airport::where('iata_code', 'OTP')->update(['municipality' => 'Otopeni']);
Airport::where('iata_code', 'CAN')->update(['municipality' => 'Guangzhou (Huadu)']);
Airport::where('iata_code', 'XIY')->update(['municipality' => "Xianyang (Weicheng)"]);
Airport::where('iata_code', 'ROR')->update(['municipality' => "Babelthuap Island"]);
Airport::where('iata_code', 'WUH')->update(['municipality' => "Wuhan (Huangpi)"]);
Airport::where('iata_code', 'CCS')->update(['municipality' => "Maiquetía"]);
Airport::where('iata_code', 'TFU')->update(['municipality' => "Chengdu (Jianyang)"]);
Airport::where('iata_code', 'CTU')->update(['municipality' => "Chengdu (Shuangliu)"]);
Airport::where('iata_code', 'DMM')->update(['municipality' => "Ad Dammam"]);
Airport::where('iata_code', 'VCE')->update(['municipality' => "Venezia (VE)"]);
Airport::where('iata_code', 'MXP')->update(['municipality' => "Ferno (VA)"]);
Airport::where('iata_code', 'DPS')->update(['municipality' => "Kuta, Badung"]);
Airport::where('iata_code', 'CAY')->update(['municipality' => "Matoury"]);
Airport::where('iata_code', 'LPA')->update(['municipality' => "Gran Canaria Island"]);
Airport::where('iata_code', 'MCT')->update(['municipality' => "Muscat/Seeb"]);
Airline::where('internal_name', 'thy-turkish-airlines')->update(['name' => ' THY - Turkish Airlines']);
Airline::where('internal_name', 'air-china')->update(['name' => 'Air China Limited']);
Airline::where('internal_name', 'jetstar-airways-pty')->update(['name' => 'Jetstar Airways Pty Limited']);
Airline::where('internal_name', 'easyjet')->update(['name' => 'Easyjet Airline Company Limited']);
Airline::where('internal_name', 'china-west-air')->update(['name' => 'China West Air Co. Ltd.']);
Airline::where('internal_name', 'aeroenlaces-nacionales-s-a-de-c-v')->update(['name' => 'Aeroenlaces Nacionales S.A. De C.V.']);
Airline::where('internal_name', 'aircompany-somon-air')->update(['name' => 'Aircompany Somon Air LLC']);
Airline::where('internal_name', 'hinterland-aviation-pty')->update(['name' => 'Hinterland Aviation Pty Ltd']);
Airline::where('internal_name', 'mango-airlines-soc-trading-as-mango')->update(['name' => 'Mango Airlines (SOC) Ltd trading as MANGO']);
Airline::where('internal_name', 'air-manas-dba-air-manas-air')->update(['name' => 'Air Manas dba Air Manas ltd. Air Company']);
Airline::where('internal_name', 'airasia-x-berhad-dba-airasia-x')->update(['name' => 'Airasia X Berhad dba Airasia X']);
Airline::where('internal_name', 'mesa-airlines')->update(['name' => 'Mesa Airlines, Inc']);
}
};
@@ -0,0 +1,29 @@
<script setup lang="ts">
import {Airline, SharedProps} from "@/Types/types";
import {computed} from "vue";
import {usePage} from "@inertiajs/vue3";
const props = defineProps<{
airline: Airline | null;
size?: number | string;
}>();
const page = usePage<SharedProps>().props;
const logoUrl = computed(() => `url('${page.logo_api_url}/airlines/logos/tail/id/${props.airline?.id}')`);
const size = computed(() => props.size ? props.size + 'px' : '30px');
</script>
<template>
<span></span>
</template>
<style scoped>
span{
width: v-bind(size);
height: v-bind(size);
background-image: v-bind(logoUrl);
background-size: contain;
background-repeat: no-repeat;
display: inline-block;
}
</style>
@@ -0,0 +1,103 @@
<script setup lang="ts">
import {FlightClass} from "@/Types/types";
defineProps<{
flightClass: FlightClass | null
}>();
</script>
<template>
<span
class="class-badge"
:class="{
'class-first': flightClass?.name?.toLowerCase().includes('first'),
'class-business': flightClass?.name?.toLowerCase().includes('business'),
'class-premium': flightClass?.name?.toLowerCase().includes('premium'),
'class-economy': flightClass?.name?.toLowerCase().includes('economy') && !flightClass?.name?.toLowerCase().includes('premium'),
'class-private': flightClass?.name?.toLowerCase().includes('private'),
'class-unspecified': flightClass?.name?.toLowerCase().includes('unspecified'),
}"
>
{{ flightClass?.name ?? '—' }}
</span>
</template>
<style scoped>
.class-badge {
display: inline-block;
font-family: 'Share Tech Mono', monospace;
font-size: 0.68rem;
letter-spacing: 0.1em;
padding: 0.18rem 0.55rem;
border-radius: 2px;
text-transform: uppercase;
}
.class-first {
background: rgba(255, 193, 7, 0.15);
color: #ffc107;
border: 1px solid rgba(255, 193, 7, 0.3);
}
.class-business {
background: rgba(100, 180, 255, 0.1);
color: #64b4ff;
border: 1px solid rgba(100, 180, 255, 0.25);
}
.class-premium {
background: rgb(75, 32, 137, 0.1);
color: #c49dff;
border: 1px solid rgba(180, 130, 255, 0.25);
}
.class-economy {
background: rgba(255, 255, 255, 0.05);
color: #778;
border: 1px solid rgba(255, 255, 255, 0.1);
}
.class-unspecified {
display: none;
background: transparent;
color: #778;
border: 1px solid rgba(255, 255, 255, 0.1);
}
.class-private {
background: linear-gradient(
135deg,
rgba(255, 160, 0, 0.2) 0%,
rgba(255, 220, 80, 0.3) 45%,
rgba(255, 160, 0, 0.15) 100%
);
color: #ffc107;
border: 1px solid rgba(255, 193, 7, 0.4);
text-shadow: 0 0 8px rgba(255, 193, 7, 0.6);
position: relative;
overflow: hidden;
}
.class-private::after {
content: '';
position: absolute;
inset: 0;
background: linear-gradient(
105deg,
transparent 40%,
rgba(255, 220, 100, 0.45) 50%,
transparent 60%
);
background-size: 200% 100%;
animation: shimmer 2.8s ease-in-out infinite;
}
@keyframes shimmer {
0% {
background-position: 200% center;
}
100% {
background-position: -200% center;
}
}
</style>
+1 -1
View File
@@ -29,7 +29,7 @@ const name = computed(() => page?.props?.auth?.user?.name || 'there');
</v-btn>
</v-col>
<v-col cols="12" md="6">
<v-btn size="large" block :href="route('import.fr24')" prepend-icon="mdi-import">
<v-btn size="large" block @click="router.visit(route('import.fr24'))" prepend-icon="mdi-import">
Import from FR24
</v-btn>
</v-col>
+281 -83
View File
@@ -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>
+73
View File
@@ -23,6 +23,79 @@ export type SharedProps = import('@inertiajs/core').PageProps & {
logo_api_url: string
}
export interface Airport {
id: number
name: string
latitude_deg: number
longitude_deg: number
elevation_ft: number | null
region_id: number
municipality: string | null
icao_code: string | null
iata_code: string | null
local_code: string | null
type: string
created_at: string | null
updated_at: string | null
timezone: string
}
export interface Airline {
id: number
IATA_code: string | null
ICAO_code: string | null
name: string | null
internal_name: string | null
active: boolean
logo: string | null
country_id: number
}
export interface Aircraft {
id: number
designator: string
manufacturer_code: string
model_full_name: string
aircraft_description: string
engine_type: string
engine_count: number
wtc: string
created_at: string | null
updated_at: string | null
}
export interface SeatType {
id: number
name: string
}
export interface FlightReason {
id: number
name: string
}
export interface FlightClass {
id: number
name: string
}
export 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
}
declare module '@inertiajs/vue3' {
interface PageProps extends SharedProps {}
}