Add more airlines and fix edit bugs

This commit is contained in:
2026-04-20 13:36:58 +10:00
parent 8d7d8f02d3
commit 5deefcbfb3
22 changed files with 1109 additions and 1530 deletions
@@ -8,12 +8,14 @@ import type { DataTableSortItem } from 'vuetify';
import InlineBadge from "@/Components/FlightsGoneBy/InlineBadge.vue";
import AirportToolTip from "@/Components/FlightsGoneBy/AirportToolTip.vue";
import AircraftToolTip from "@/Components/FlightsGoneBy/AircraftToolTip.vue";
import {FlightStats} from "@/Composables/useFlightStats";
const props = defineProps<{
flights: Flight[]
flightStats: FlightStats
canEdit: boolean
}>()
const headers = [
{ title: '', key: 'airline', sortable: true },
{ title: 'FLIGHT', key: 'flight_number', sortable: true },
@@ -58,13 +60,11 @@ const isSorting = computed(() => sortBy.value.length > 0)
// Split flights into upcoming vs departed, sorted by date within each group
const upcomingFlights = computed(() =>
props.flights
.filter(f => new Date(f.departure_date) >= today)
.sort((a, b) => new Date(a.departure_date).getTime() - new Date(b.departure_date).getTime())
props.flightStats.upcomingFlights.value
)
const departedFlights = computed(() =>
props.flights
props.flightStats.pastFlights.value
.filter(f => new Date(f.departure_date) < today)
.sort((a, b) => new Date(b.departure_date).getTime() - new Date(a.departure_date).getTime())
)
@@ -89,8 +89,13 @@ const groupedItems = computed<GroupedFlight[]>(() => {
})
// When sorting, pass all flights flat; when not sorting, pass grouped (headers will be rendered via #item slot trick)
const allFlights = computed(() => [
...props.flightStats.upcomingFlights.value,
...props.flightStats.pastFlights.value,
])
const tableItems = computed(() =>
isSorting.value ? props.flights : groupedItems.value
isSorting.value ? allFlights.value : groupedItems.value
)
</script>