Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
39c0ce1b44 | ||
|
|
792cb082fd | ||
|
|
ae77fec0da | ||
|
|
dbb3dac7f6 | ||
|
|
731a6aa09a | ||
|
|
dc476fedd6 | ||
|
|
fd3b5b0405 |
@@ -28,7 +28,7 @@ enum FlightNotificationType: string
|
|||||||
{
|
{
|
||||||
return match ($this) {
|
return match ($this) {
|
||||||
self::Booked => "{$user->name} booked a new flight",
|
self::Booked => "{$user->name} booked a new flight",
|
||||||
self::Logged => "{$user->name} logged a new flight",
|
self::Logged => "{$user->name} logged a historic flight",
|
||||||
self::Cancelled => "{$user->name} cancelled a flight",
|
self::Cancelled => "{$user->name} cancelled a flight",
|
||||||
self::Departed => "{$user->name} is taking off!",
|
self::Departed => "{$user->name} is taking off!",
|
||||||
self::Arrived => "{$user->name} has landed!",
|
self::Arrived => "{$user->name} has landed!",
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ class AdminController extends Controller
|
|||||||
function staticAdminData(){
|
function staticAdminData(){
|
||||||
return [
|
return [
|
||||||
'missingLiveryCount' => $this->adminService->getMissingLiveries()->count(),
|
'missingLiveryCount' => $this->adminService->getMissingLiveries()->count(),
|
||||||
|
'missingAirlineCount' => $this->adminService->getMissingAirlines()->count(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,6 +45,16 @@ class AdminController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function reconcileMissingAirlines(){
|
||||||
|
$missingAirlines = $this->adminService->getMissingAirlines()->values();
|
||||||
|
|
||||||
|
return Inertia::render('Admin/MissingAirlines', [
|
||||||
|
'title' => $missingAirlines->count() . ' Missing Airlines',
|
||||||
|
'missingAirlines' => $missingAirlines,
|
||||||
|
...$this->staticAdminData(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
public function ignoreMissingLivery(Request $request)
|
public function ignoreMissingLivery(Request $request)
|
||||||
{
|
{
|
||||||
$validated = $request->validate([
|
$validated = $request->validate([
|
||||||
|
|||||||
+20
-1
@@ -153,7 +153,26 @@ class User extends Authenticatable implements MustVerifyEmail
|
|||||||
->toJson();
|
->toJson();
|
||||||
});
|
});
|
||||||
|
|
||||||
$collection = collect(json_decode($json));
|
$dateFormat = auth()->user()?->resolved_settings['date_format'] ?? 'j M Y';
|
||||||
|
$timeFormat = auth()->user()?->resolved_settings['time_format'] === '24hr' ? 'Hi' : 'g:iA';
|
||||||
|
|
||||||
|
$collection = collect(json_decode($json))
|
||||||
|
->map(function ($flight) use ($dateFormat, $timeFormat) {
|
||||||
|
$departure = Carbon::parse($flight->departure_date)
|
||||||
|
->setTimezone($flight->departure_airport->timezone);
|
||||||
|
|
||||||
|
$arrival = Carbon::parse($flight->arrival_date)
|
||||||
|
->setTimezone($flight->arrival_airport->timezone);
|
||||||
|
|
||||||
|
$flight->departure_date_display = $departure->format($dateFormat);
|
||||||
|
$flight->departure_time_display = $departure->format($timeFormat);
|
||||||
|
|
||||||
|
$flight->arrival_date_display = $arrival->format($dateFormat);
|
||||||
|
$flight->arrival_time_display = $arrival->format($timeFormat);
|
||||||
|
|
||||||
|
return $flight;
|
||||||
|
});
|
||||||
|
|
||||||
$today = now('UTC')->toDateString();
|
$today = now('UTC')->toDateString();
|
||||||
|
|
||||||
return match ($filter) {
|
return match ($filter) {
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ namespace App\Services;
|
|||||||
use App\DTOs\MissingLivery;
|
use App\DTOs\MissingLivery;
|
||||||
use App\Models\IgnoredMissingLivery;
|
use App\Models\IgnoredMissingLivery;
|
||||||
use App\Models\UserFlight;
|
use App\Models\UserFlight;
|
||||||
|
use Illuminate\Support\Enumerable;
|
||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
|
|
||||||
@@ -45,4 +46,36 @@ class AdminService
|
|||||||
->sortBy('airline_name')
|
->sortBy('airline_name')
|
||||||
->values();
|
->values();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getMissingAirlines(): Enumerable|Collection
|
||||||
|
{
|
||||||
|
$flights = UserFlight::whereNotNull('flight_number')
|
||||||
|
->whereNull('airline_id')
|
||||||
|
->with('user:id,name') // adjust to your actual user relation/columns
|
||||||
|
->get(['id', 'flight_number', 'user_id']);
|
||||||
|
|
||||||
|
return $flights
|
||||||
|
->map(function ($flight) {
|
||||||
|
// Extract the 2-character IATA-style prefix (letters and/or digits)
|
||||||
|
preg_match('/^([A-Za-z0-9]{2})\d+/', trim($flight->flight_number), $matches);
|
||||||
|
|
||||||
|
return [
|
||||||
|
'code' => $matches[1] ?? null,
|
||||||
|
'flight_number' => $flight->flight_number,
|
||||||
|
'link' => "/u/{$flight->user->name}/flight/{$flight->id}",
|
||||||
|
];
|
||||||
|
})
|
||||||
|
->filter(fn ($f) => $f['code'] !== null) // drop any that didn't match the pattern
|
||||||
|
->groupBy('code')
|
||||||
|
->map(function ($group, $code) {
|
||||||
|
return [
|
||||||
|
'code' => $code,
|
||||||
|
'flights' => $group->map(fn ($f) => [
|
||||||
|
'flight_number' => $f['flight_number'],
|
||||||
|
'link' => $f['link'],
|
||||||
|
])->values()->all(),
|
||||||
|
];
|
||||||
|
})
|
||||||
|
->values();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,24 +13,13 @@ class SettingsRegistry
|
|||||||
'AI Generated Content' => 'Airline tail logos and liveries are AI generated with human cleanup. If you would rather not see any AI, then our blank aircraft templates are human created.',
|
'AI Generated Content' => 'Airline tail logos and liveries are AI generated with human cleanup. If you would rather not see any AI, then our blank aircraft templates are human created.',
|
||||||
'Account & Privacy' => 'Everything to do with your account.',
|
'Account & Privacy' => 'Everything to do with your account.',
|
||||||
'Notifications' => 'What you want to hear about (or not!)',
|
'Notifications' => 'What you want to hear about (or not!)',
|
||||||
|
'Localization' => 'Units of measurement, date and time preferences.',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function schema(): array
|
public static function schema(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
[
|
|
||||||
'key' => 'distance_unit',
|
|
||||||
'type' => 'select',
|
|
||||||
'label' => 'Distance Units',
|
|
||||||
'category' => 'FlightsGoneBy Settings',
|
|
||||||
'default' => 'km',
|
|
||||||
'options' => [
|
|
||||||
['value' => 'km', 'label' => 'Kilometres (km)'],
|
|
||||||
['value' => 'mi', 'label' => 'Miles (mi)'],
|
|
||||||
['value' => 'nm', 'label' => 'Nautical miles (nm)'],
|
|
||||||
],
|
|
||||||
],
|
|
||||||
[
|
[
|
||||||
'category' => 'Account & Privacy',
|
'category' => 'Account & Privacy',
|
||||||
'key' => 'profile_privacy',
|
'key' => 'profile_privacy',
|
||||||
@@ -42,6 +31,42 @@ class SettingsRegistry
|
|||||||
['value' => 'private', 'label' => 'Private Profile Viewable Only By You and Your Approved Followers'],
|
['value' => 'private', 'label' => 'Private Profile Viewable Only By You and Your Approved Followers'],
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'key' => 'distance_unit',
|
||||||
|
'type' => 'select',
|
||||||
|
'label' => 'Distance Units',
|
||||||
|
'category' => 'Localization',
|
||||||
|
'default' => 'km',
|
||||||
|
'options' => [
|
||||||
|
['value' => 'km', 'label' => 'Kilometres (km)'],
|
||||||
|
['value' => 'mi', 'label' => 'Miles (mi)'],
|
||||||
|
['value' => 'nm', 'label' => 'Nautical miles (nm)'],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'key' => 'time_format',
|
||||||
|
'type' => 'select',
|
||||||
|
'label' => 'Time Format',
|
||||||
|
'category' => 'Localization',
|
||||||
|
'default' => 'ampm',
|
||||||
|
'options' => [
|
||||||
|
['value' => 'ampm', 'label' => 'AM/PM'],
|
||||||
|
['value' => '24hr', 'label' => '24-Hour'],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'key' => 'date_format',
|
||||||
|
'type' => 'select',
|
||||||
|
'label' => 'Date Format',
|
||||||
|
'category' => 'Localization',
|
||||||
|
'default' => 'j M Y',
|
||||||
|
'options' => [
|
||||||
|
['value' => 'j M Y', 'label' => '20 Feb 2015'],
|
||||||
|
['value' => 'Y-m-d', 'label' => '2015-02-20'],
|
||||||
|
['value' => 'd/m/Y', 'label' => '20/02/2015'],
|
||||||
|
['value' => 'm/d/Y', 'label' => '02/20/2015'],
|
||||||
|
],
|
||||||
|
],
|
||||||
[
|
[
|
||||||
'key' => 'default_login_page',
|
'key' => 'default_login_page',
|
||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
|
|||||||
@@ -0,0 +1,91 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { MissingAirline } from "@/Types/types"
|
||||||
|
|
||||||
|
defineProps<{
|
||||||
|
airline: MissingAirline
|
||||||
|
}>()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="missing-airline-card">
|
||||||
|
<div class="card-header">
|
||||||
|
<span class="airline-code">{{ airline.code }}</span>
|
||||||
|
<span class="flight-count">{{ airline.flights.length }} flight{{ airline.flights.length === 1 ? '' : 's' }}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<ul class="flight-list">
|
||||||
|
<li v-for="flight in airline.flights" :key="flight.link" class="flight-item">
|
||||||
|
<a :href="flight.link" class="flight-link" target="_blank" rel="noopener">
|
||||||
|
{{ flight.flight_number }}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.missing-airline-card {
|
||||||
|
background: rgba(255, 255, 255, 0.03);
|
||||||
|
border: 1px solid rgba(255, 255, 255, 0.08);
|
||||||
|
border-radius: 8px;
|
||||||
|
padding: 1rem 1.25rem;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: baseline;
|
||||||
|
justify-content: space-between;
|
||||||
|
border-bottom: 1px solid rgba(255, 255, 255, 0.06);
|
||||||
|
padding-bottom: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.airline-code {
|
||||||
|
font-family: 'Share Tech Mono', monospace;
|
||||||
|
font-size: 1.1rem;
|
||||||
|
letter-spacing: 0.08em;
|
||||||
|
color: #ffc107;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.flight-count {
|
||||||
|
font-family: 'Share Tech Mono', monospace;
|
||||||
|
font-size: 0.68rem;
|
||||||
|
letter-spacing: 0.1em;
|
||||||
|
text-transform: uppercase;
|
||||||
|
color: #778;
|
||||||
|
}
|
||||||
|
|
||||||
|
.flight-list {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 0.5rem;
|
||||||
|
list-style: none;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.flight-item {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.flight-link {
|
||||||
|
font-family: 'Share Tech Mono', monospace;
|
||||||
|
font-size: 0.72rem;
|
||||||
|
letter-spacing: 0.06em;
|
||||||
|
color: #9fb3c8;
|
||||||
|
text-decoration: none;
|
||||||
|
background: rgba(255, 255, 255, 0.04);
|
||||||
|
border: 1px solid rgba(255, 255, 255, 0.06);
|
||||||
|
border-radius: 4px;
|
||||||
|
padding: 0.25rem 0.5rem;
|
||||||
|
transition: color 0.15s ease, border-color 0.15s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.flight-link:hover {
|
||||||
|
color: #ffc107;
|
||||||
|
border-color: rgba(255, 193, 7, 0.4);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,16 +1,16 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import MainLayout from '@/Layouts/MainLayout.vue'
|
import MainLayout from '@/Layouts/MainLayout.vue'
|
||||||
import GlassBox from '@/Components/FlightsGoneBy/GlassBox.vue'
|
import GlassBox from '@/Components/FlightsGoneBy/GlassBox.vue'
|
||||||
import { Head, useForm } from '@inertiajs/vue3'
|
import {Head, useForm, usePage} from '@inertiajs/vue3'
|
||||||
import AirlineSearchBox from '@/Components/FlightsGoneBy/AirlineSearchBox.vue'
|
import AirlineSearchBox from '@/Components/FlightsGoneBy/AirlineSearchBox.vue'
|
||||||
import AircraftSearchBox from '@/Components/FlightsGoneBy/AircraftSearchBox.vue'
|
import AircraftSearchBox from '@/Components/FlightsGoneBy/AircraftSearchBox.vue'
|
||||||
import AirportSearchBox from '@/Components/FlightsGoneBy/AirportSearchBox.vue'
|
import AirportSearchBox from '@/Components/FlightsGoneBy/AirportSearchBox.vue'
|
||||||
import type {SeatType, FlightReason, FlightClass, CrewType} from '@/Types/types'
|
import type {SeatType, FlightReason, FlightClass, CrewType, SharedProps} from '@/Types/types'
|
||||||
import { ref, watch, computed } from 'vue'
|
import { ref, watch, computed } from 'vue'
|
||||||
import { VTimePicker, VDatePicker } from 'vuetify/components'
|
import { VTimePicker, VDatePicker } from 'vuetify/components'
|
||||||
|
|
||||||
defineOptions({ layout: MainLayout })
|
defineOptions({ layout: MainLayout })
|
||||||
|
const page = usePage<SharedProps>().props
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
flight?: {
|
flight?: {
|
||||||
@@ -39,6 +39,11 @@ const props = defineProps<{
|
|||||||
|
|
||||||
const isEdit = !!props.flight
|
const isEdit = !!props.flight
|
||||||
|
|
||||||
|
// ── User format preferences ─────────────────────────────────────────────────
|
||||||
|
const timeFormat = computed(() => page.auth?.user?.resolved_settings?.time_format ?? 'ampm')
|
||||||
|
|
||||||
|
const pad = (n: number) => String(n).padStart(2, '0')
|
||||||
|
|
||||||
// ── Flight number lookup ──────────────────────────────────────────────────────
|
// ── Flight number lookup ──────────────────────────────────────────────────────
|
||||||
|
|
||||||
const flightNumber = ref(props.flight?.flight_number ?? '')
|
const flightNumber = ref(props.flight?.flight_number ?? '')
|
||||||
@@ -209,8 +214,6 @@ const aircraftOptionsData = ref<{ value: number; title: string }[]>(props.flight
|
|||||||
// on. These refs + watchers just give the template two separate pickers while
|
// on. These refs + watchers just give the template two separate pickers while
|
||||||
// keeping those combined strings in sync — no server-side changes needed.
|
// keeping those combined strings in sync — no server-side changes needed.
|
||||||
|
|
||||||
const pad = (n: number) => String(n).padStart(2, '0')
|
|
||||||
|
|
||||||
function parseDateTime(dt: string | null | undefined) {
|
function parseDateTime(dt: string | null | undefined) {
|
||||||
if (!dt) return { date: null as Date | null, time: null as string | null }
|
if (!dt) return { date: null as Date | null, time: null as string | null }
|
||||||
const d = new Date(dt)
|
const d = new Date(dt)
|
||||||
@@ -227,23 +230,6 @@ function combineDateTime(date: Date | null, time: string | null): string {
|
|||||||
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}T${(hh ?? '00').padStart(2, '0')}:${(mm ?? '00').padStart(2, '0')}`
|
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}T${(hh ?? '00').padStart(2, '0')}:${(mm ?? '00').padStart(2, '0')}`
|
||||||
}
|
}
|
||||||
|
|
||||||
const formatDateDisplay = (d: Date | null) =>
|
|
||||||
d ? d.toLocaleDateString(undefined, { year: 'numeric', month: 'short', day: 'numeric' }) : ''
|
|
||||||
|
|
||||||
// Time is stored internally as a 24hr "HH:mm" string (VTimePicker's model
|
|
||||||
// value is always 24hr regardless of the `format` display prop). This just
|
|
||||||
// formats it for display in the read-only text fields.
|
|
||||||
function formatTimeDisplay(t: string | null): string {
|
|
||||||
if (!t) return ''
|
|
||||||
const [hStr, mStr] = t.split(':')
|
|
||||||
let h = parseInt(hStr, 10)
|
|
||||||
if (isNaN(h)) return ''
|
|
||||||
const ampm = h >= 12 ? 'PM' : 'AM'
|
|
||||||
h = h % 12
|
|
||||||
if (h === 0) h = 12
|
|
||||||
return `${h}:${mStr} ${ampm}`
|
|
||||||
}
|
|
||||||
|
|
||||||
function clearDepartureDate() { departureDatePart.value = null }
|
function clearDepartureDate() { departureDatePart.value = null }
|
||||||
function clearDepartureTime() { departureTimePart.value = null }
|
function clearDepartureTime() { departureTimePart.value = null }
|
||||||
function clearArrivalDate() { arrivalDatePart.value = null }
|
function clearArrivalDate() { arrivalDatePart.value = null }
|
||||||
@@ -324,6 +310,124 @@ const arrivalMax = computed(() => getArrivalBound(form, 3))
|
|||||||
|
|
||||||
const arrivalMinDate = computed(() => arrivalMin.value ? new Date(arrivalMin.value) : undefined)
|
const arrivalMinDate = computed(() => arrivalMin.value ? new Date(arrivalMin.value) : undefined)
|
||||||
const arrivalMaxDate = computed(() => arrivalMax.value ? new Date(arrivalMax.value) : undefined)
|
const arrivalMaxDate = computed(() => arrivalMax.value ? new Date(arrivalMax.value) : undefined)
|
||||||
|
|
||||||
|
// ── Native date inputs ───────────────────────────────────────────────────────
|
||||||
|
// departureDatePart / arrivalDatePart stay the source of truth as Date
|
||||||
|
// objects. These computed get/set pairs are what the native <input type=date>
|
||||||
|
// elements bind to — the browser handles locale display, typing, and
|
||||||
|
// validation itself, so no custom format-aware parsing is needed here.
|
||||||
|
// The Vuetify v-date-picker is still available via a separate calendar icon
|
||||||
|
// for users who prefer to pick from a calendar rather than type.
|
||||||
|
|
||||||
|
function toIsoDateString(d: Date | null): string {
|
||||||
|
if (!d) return ''
|
||||||
|
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`
|
||||||
|
}
|
||||||
|
|
||||||
|
function fromIsoDateString(value: string): Date | null {
|
||||||
|
if (!value) return null
|
||||||
|
const [y, m, d] = value.split('-').map(Number)
|
||||||
|
if (!y || !m || !d) return null
|
||||||
|
return new Date(y, m - 1, d)
|
||||||
|
}
|
||||||
|
|
||||||
|
const departureDateValue = computed({
|
||||||
|
get: () => toIsoDateString(departureDatePart.value),
|
||||||
|
set: (value: string) => { departureDatePart.value = fromIsoDateString(value) },
|
||||||
|
})
|
||||||
|
|
||||||
|
const arrivalDateValue = computed({
|
||||||
|
get: () => toIsoDateString(arrivalDatePart.value),
|
||||||
|
set: (value: string) => { arrivalDatePart.value = fromIsoDateString(value) },
|
||||||
|
})
|
||||||
|
|
||||||
|
// ── Editable, format-aware time text fields ────────────────────────────────
|
||||||
|
// departureTimePart / arrivalTimePart stay the source of truth as internal
|
||||||
|
// "HH:mm" (24hr) strings. These input refs are what the text-fields actually
|
||||||
|
// bind to, so the user can type freely; parsing only commits on blur/enter.
|
||||||
|
|
||||||
|
function formatTimeForFormat(t: string | null, format: string): string {
|
||||||
|
if (!t) return ''
|
||||||
|
const [hStr, mStr] = t.split(':')
|
||||||
|
let h = parseInt(hStr, 10)
|
||||||
|
if (isNaN(h)) return ''
|
||||||
|
|
||||||
|
if (format === '24hr') {
|
||||||
|
return `${pad(h)}:${mStr}`
|
||||||
|
}
|
||||||
|
|
||||||
|
const ampm = h >= 12 ? 'PM' : 'AM'
|
||||||
|
let h12 = h % 12
|
||||||
|
if (h12 === 0) h12 = 12
|
||||||
|
return `${h12}:${mStr} ${ampm}`
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseTimeInput(input: string): string | null {
|
||||||
|
const trimmed = input.trim()
|
||||||
|
if (!trimmed) return null
|
||||||
|
|
||||||
|
// ampm form: "2:30 PM", "2:30PM", "2 PM", "2PM"
|
||||||
|
let match = trimmed.match(/^(\d{1,2}):?(\d{2})?\s*([AaPp][Mm])$/)
|
||||||
|
if (match) {
|
||||||
|
let h = parseInt(match[1], 10)
|
||||||
|
const m = match[2] ? parseInt(match[2], 10) : 0
|
||||||
|
const ampm = match[3].toUpperCase()
|
||||||
|
if (h >= 1 && h <= 12 && m >= 0 && m <= 59) {
|
||||||
|
if (ampm === 'PM' && h !== 12) h += 12
|
||||||
|
if (ampm === 'AM' && h === 12) h = 0
|
||||||
|
return `${pad(h)}:${pad(m)}`
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
// 24hr form: "14:30" or "1430"
|
||||||
|
match = trimmed.match(/^(\d{1,2}):?(\d{2})$/)
|
||||||
|
if (match) {
|
||||||
|
const h = parseInt(match[1], 10)
|
||||||
|
const m = parseInt(match[2], 10)
|
||||||
|
if (h >= 0 && h <= 23 && m >= 0 && m <= 59) {
|
||||||
|
return `${pad(h)}:${pad(m)}`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
const departureTimeInput = ref(formatTimeForFormat(departureTimePart.value, timeFormat.value))
|
||||||
|
const arrivalTimeInput = ref(formatTimeForFormat(arrivalTimePart.value, timeFormat.value))
|
||||||
|
|
||||||
|
watch([departureTimePart, timeFormat], () => {
|
||||||
|
departureTimeInput.value = formatTimeForFormat(departureTimePart.value, timeFormat.value)
|
||||||
|
})
|
||||||
|
watch([arrivalTimePart, timeFormat], () => {
|
||||||
|
arrivalTimeInput.value = formatTimeForFormat(arrivalTimePart.value, timeFormat.value)
|
||||||
|
})
|
||||||
|
|
||||||
|
function commitDepartureTimeInput() {
|
||||||
|
if (!departureTimeInput.value.trim()) {
|
||||||
|
departureTimePart.value = null
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const parsed = parseTimeInput(departureTimeInput.value)
|
||||||
|
if (parsed !== null) {
|
||||||
|
departureTimePart.value = parsed
|
||||||
|
} else {
|
||||||
|
departureTimeInput.value = formatTimeForFormat(departureTimePart.value, timeFormat.value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function commitArrivalTimeInput() {
|
||||||
|
if (!arrivalTimeInput.value.trim()) {
|
||||||
|
arrivalTimePart.value = null
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const parsed = parseTimeInput(arrivalTimeInput.value)
|
||||||
|
if (parsed !== null) {
|
||||||
|
arrivalTimePart.value = parsed
|
||||||
|
} else {
|
||||||
|
arrivalTimeInput.value = formatTimeForFormat(arrivalTimePart.value, timeFormat.value)
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -368,18 +472,21 @@ const arrivalMaxDate = computed(() => arrivalMax.value ? new Date(arrivalMax.val
|
|||||||
<!-- ── Departure date + time ──────────────────────────────── -->
|
<!-- ── Departure date + time ──────────────────────────────── -->
|
||||||
<v-row>
|
<v-row>
|
||||||
<v-col cols="12" sm="6">
|
<v-col cols="12" sm="6">
|
||||||
<v-menu v-model="depDateMenu" :close-on-content-click="false">
|
|
||||||
<template #activator="{ props: menuProps }">
|
|
||||||
<v-text-field
|
<v-text-field
|
||||||
v-bind="menuProps"
|
v-model="departureDateValue"
|
||||||
:model-value="formatDateDisplay(departureDatePart)"
|
type="date"
|
||||||
label="Departure Date"
|
label="Departure Date"
|
||||||
readonly
|
|
||||||
clearable
|
|
||||||
prepend-inner-icon="mdi-calendar"
|
prepend-inner-icon="mdi-calendar"
|
||||||
:disabled="!lookupComplete"
|
:disabled="!lookupComplete"
|
||||||
:error-messages="submitForm.errors.departure_date"
|
:error-messages="submitForm.errors.departure_date"
|
||||||
@click:clear="clearDepartureDate"
|
>
|
||||||
|
<template #append-inner>
|
||||||
|
<v-menu v-model="depDateMenu" :close-on-content-click="false">
|
||||||
|
<template #activator="{ props: menuProps }">
|
||||||
|
<v-icon
|
||||||
|
v-bind="menuProps"
|
||||||
|
icon="mdi-calendar-month"
|
||||||
|
style="cursor: pointer"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<v-date-picker
|
<v-date-picker
|
||||||
@@ -387,25 +494,29 @@ const arrivalMaxDate = computed(() => arrivalMax.value ? new Date(arrivalMax.val
|
|||||||
@update:model-value="depDateMenu = false"
|
@update:model-value="depDateMenu = false"
|
||||||
/>
|
/>
|
||||||
</v-menu>
|
</v-menu>
|
||||||
|
</template>
|
||||||
|
</v-text-field>
|
||||||
</v-col>
|
</v-col>
|
||||||
<v-col cols="12" sm="6">
|
<v-col cols="12" sm="6">
|
||||||
<v-menu v-model="depTimeMenu" :close-on-content-click="false">
|
<v-menu v-model="depTimeMenu" :close-on-content-click="false">
|
||||||
<template #activator="{ props: menuProps }">
|
<template #activator="{ props: menuProps }">
|
||||||
<v-text-field
|
<v-text-field
|
||||||
v-bind="menuProps"
|
v-bind="menuProps"
|
||||||
:model-value="formatTimeDisplay(departureTimePart)"
|
v-model="departureTimeInput"
|
||||||
label="Departure Time"
|
label="Departure Time"
|
||||||
readonly
|
|
||||||
clearable
|
clearable
|
||||||
prepend-inner-icon="mdi-clock-outline"
|
prepend-inner-icon="mdi-clock-outline"
|
||||||
|
:placeholder="timeFormat === '24hr' ? 'e.g. 1430' : 'e.g. 2:30 PM'"
|
||||||
:disabled="!lookupComplete"
|
:disabled="!lookupComplete"
|
||||||
@click:clear="clearDepartureTime"
|
@click:clear="clearDepartureTime"
|
||||||
|
@blur="commitDepartureTimeInput"
|
||||||
|
@keydown.enter="commitDepartureTimeInput"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<v-card>
|
<v-card>
|
||||||
<v-time-picker
|
<v-time-picker
|
||||||
v-model="departureTimePart"
|
v-model="departureTimePart"
|
||||||
format="ampm"
|
:format="timeFormat"
|
||||||
scrollable
|
scrollable
|
||||||
/>
|
/>
|
||||||
<v-card-actions>
|
<v-card-actions>
|
||||||
@@ -420,18 +531,21 @@ const arrivalMaxDate = computed(() => arrivalMax.value ? new Date(arrivalMax.val
|
|||||||
<!-- ── Arrival date + time ─────────────────────────────────── -->
|
<!-- ── Arrival date + time ─────────────────────────────────── -->
|
||||||
<v-row>
|
<v-row>
|
||||||
<v-col cols="12" sm="6">
|
<v-col cols="12" sm="6">
|
||||||
<v-menu v-model="arrDateMenu" :close-on-content-click="false">
|
|
||||||
<template #activator="{ props: menuProps }">
|
|
||||||
<v-text-field
|
<v-text-field
|
||||||
v-bind="menuProps"
|
v-model="arrivalDateValue"
|
||||||
:model-value="formatDateDisplay(arrivalDatePart)"
|
type="date"
|
||||||
label="Arrival Date"
|
label="Arrival Date"
|
||||||
readonly
|
|
||||||
clearable
|
|
||||||
prepend-inner-icon="mdi-calendar"
|
prepend-inner-icon="mdi-calendar"
|
||||||
:disabled="!lookupComplete"
|
:disabled="!lookupComplete"
|
||||||
:error-messages="submitForm.errors.arrival_date"
|
:error-messages="submitForm.errors.arrival_date"
|
||||||
@click:clear="clearArrivalDate"
|
>
|
||||||
|
<template #append-inner>
|
||||||
|
<v-menu v-model="arrDateMenu" :close-on-content-click="false">
|
||||||
|
<template #activator="{ props: menuProps }">
|
||||||
|
<v-icon
|
||||||
|
v-bind="menuProps"
|
||||||
|
icon="mdi-calendar-month"
|
||||||
|
style="cursor: pointer"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<v-date-picker
|
<v-date-picker
|
||||||
@@ -441,25 +555,29 @@ const arrivalMaxDate = computed(() => arrivalMax.value ? new Date(arrivalMax.val
|
|||||||
@update:model-value="arrDateMenu = false"
|
@update:model-value="arrDateMenu = false"
|
||||||
/>
|
/>
|
||||||
</v-menu>
|
</v-menu>
|
||||||
|
</template>
|
||||||
|
</v-text-field>
|
||||||
</v-col>
|
</v-col>
|
||||||
<v-col cols="12" sm="6">
|
<v-col cols="12" sm="6">
|
||||||
<v-menu v-model="arrTimeMenu" :close-on-content-click="false">
|
<v-menu v-model="arrTimeMenu" :close-on-content-click="false">
|
||||||
<template #activator="{ props: menuProps }">
|
<template #activator="{ props: menuProps }">
|
||||||
<v-text-field
|
<v-text-field
|
||||||
v-bind="menuProps"
|
v-bind="menuProps"
|
||||||
:model-value="formatTimeDisplay(arrivalTimePart)"
|
v-model="arrivalTimeInput"
|
||||||
label="Arrival Time"
|
label="Arrival Time"
|
||||||
readonly
|
|
||||||
clearable
|
clearable
|
||||||
prepend-inner-icon="mdi-clock-outline"
|
prepend-inner-icon="mdi-clock-outline"
|
||||||
|
:placeholder="timeFormat === '24hr' ? 'e.g. 1430' : 'e.g. 2:30 PM'"
|
||||||
:disabled="!lookupComplete"
|
:disabled="!lookupComplete"
|
||||||
@click:clear="clearArrivalTime"
|
@click:clear="clearArrivalTime"
|
||||||
|
@blur="commitArrivalTimeInput"
|
||||||
|
@keydown.enter="commitArrivalTimeInput"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<v-card>
|
<v-card>
|
||||||
<v-time-picker
|
<v-time-picker
|
||||||
v-model="arrivalTimePart"
|
v-model="arrivalTimePart"
|
||||||
format="ampm"
|
:format="timeFormat"
|
||||||
scrollable
|
scrollable
|
||||||
/>
|
/>
|
||||||
<v-card-actions>
|
<v-card-actions>
|
||||||
@@ -650,4 +768,8 @@ const arrivalMaxDate = computed(() => arrivalMax.value ? new Date(arrivalMax.val
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
:deep(input[type="date"]::-webkit-calendar-picker-indicator) {
|
||||||
|
display: none;
|
||||||
|
-webkit-appearance: none;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import {Head} from "@inertiajs/vue3";
|
|||||||
defineProps<{
|
defineProps<{
|
||||||
title: string;
|
title: string;
|
||||||
missingLiveryCount: number;
|
missingLiveryCount: number;
|
||||||
|
missingAirlineCount: number;
|
||||||
|
|
||||||
}>()
|
}>()
|
||||||
</script>
|
</script>
|
||||||
@@ -15,7 +16,7 @@ defineProps<{
|
|||||||
<MainLayout>
|
<MainLayout>
|
||||||
<Head :title="title" />
|
<Head :title="title" />
|
||||||
<div class="admin-container">
|
<div class="admin-container">
|
||||||
<AdminSidebar :missingLiveryCount="missingLiveryCount" />
|
<AdminSidebar :missingAirlineCount="missingAirlineCount" :missingLiveryCount="missingLiveryCount" />
|
||||||
<div class="admin-content">
|
<div class="admin-content">
|
||||||
<GlassBox class="admin-page" :title="title">
|
<GlassBox class="admin-page" :title="title">
|
||||||
<slot />
|
<slot />
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import {Link} from "@inertiajs/vue3";
|
|||||||
import {number} from "echarts";
|
import {number} from "echarts";
|
||||||
defineProps<{
|
defineProps<{
|
||||||
missingLiveryCount: number;
|
missingLiveryCount: number;
|
||||||
|
missingAirlineCount: number;
|
||||||
}>()
|
}>()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -18,6 +19,11 @@ defineProps<{
|
|||||||
Reconcile Missing Liveries
|
Reconcile Missing Liveries
|
||||||
<v-chip size="x-small" color="error" class="ml-1">{{ missingLiveryCount }}</v-chip>
|
<v-chip size="x-small" color="error" class="ml-1">{{ missingLiveryCount }}</v-chip>
|
||||||
</Link>
|
</Link>
|
||||||
|
<Link :href="route('admin.reconcile-missing-airlines')" class="sidebar-link">
|
||||||
|
<v-icon icon="mdi-airplane-takeoff" size="18" />
|
||||||
|
Reconcile Missing Airlines
|
||||||
|
<v-chip size="x-small" color="error" class="ml-1">{{ missingAirlineCount }}</v-chip>
|
||||||
|
</Link>
|
||||||
</aside>
|
</aside>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,72 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import GlassBox from "@/Components/FlightsGoneBy/GlassBox.vue";
|
||||||
|
import { Head } from "@inertiajs/vue3";
|
||||||
|
import { MissingAirline } from "@/Types/types";
|
||||||
|
import MissingAirlineCard from "@/Components/Admin/MissingAirlineCard.vue";
|
||||||
|
import AdminLayout from "@/Pages/Admin/AdminLayout.vue";
|
||||||
|
import Panel from "@/Components/FlightsGoneBy/Panels/Panel.vue";
|
||||||
|
|
||||||
|
defineOptions({ layout: AdminLayout });
|
||||||
|
|
||||||
|
defineProps<{
|
||||||
|
missingAirlines: MissingAirline[]
|
||||||
|
}>()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<Head title="Missing Airlines" />
|
||||||
|
|
||||||
|
<Panel>
|
||||||
|
<template #header>
|
||||||
|
<h1 class="panel-title">Missing Airlines</h1>
|
||||||
|
<span class="panel-subtitle">
|
||||||
|
{{ missingAirlines.length }} unmatched code{{ missingAirlines.length === 1 ? '' : 's' }}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<div v-if="missingAirlines.length === 0" class="empty-state">
|
||||||
|
No missing airlines 🎉
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-else class="missing-airlines-grid">
|
||||||
|
<MissingAirlineCard
|
||||||
|
v-for="airline in missingAirlines"
|
||||||
|
:key="airline.code"
|
||||||
|
:airline="airline"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</Panel>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.panel-title {
|
||||||
|
font-family: 'Share Tech Mono', monospace;
|
||||||
|
font-size: 1.25rem;
|
||||||
|
letter-spacing: 0.06em;
|
||||||
|
text-transform: uppercase;
|
||||||
|
color: #e6e9ef;
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel-subtitle {
|
||||||
|
font-family: 'Share Tech Mono', monospace;
|
||||||
|
font-size: 0.7rem;
|
||||||
|
letter-spacing: 0.1em;
|
||||||
|
text-transform: uppercase;
|
||||||
|
color: #778;
|
||||||
|
}
|
||||||
|
|
||||||
|
.missing-airlines-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
|
||||||
|
gap: 1rem;
|
||||||
|
margin-top: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-state {
|
||||||
|
font-family: 'Share Tech Mono', monospace;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
color: #778;
|
||||||
|
padding: 2rem 0;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -191,7 +191,6 @@ watch(() => form.flight_reason, (val) => console.log('flight_reason changed:', v
|
|||||||
<v-select v-model="form.seat_type" label="Seat Type" :items="flight.seat_types" :error-messages="submitForm.errors.seat_type_id" />
|
<v-select v-model="form.seat_type" label="Seat Type" :items="flight.seat_types" :error-messages="submitForm.errors.seat_type_id" />
|
||||||
</v-col>
|
</v-col>
|
||||||
<v-col cols="12" md="6">
|
<v-col cols="12" md="6">
|
||||||
{{console.log(form.flight_reason)}}
|
|
||||||
<v-select v-model="form.flight_reason" label="Reason" :items="flight.flight_reasons" :error-messages="submitForm.errors.flight_reason_id" />
|
<v-select v-model="form.flight_reason" label="Reason" :items="flight.flight_reasons" :error-messages="submitForm.errors.flight_reason_id" />
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
|
|||||||
Vendored
+10
@@ -30,6 +30,8 @@ export interface UserSettings {
|
|||||||
show_map_legend: boolean
|
show_map_legend: boolean
|
||||||
hide_impossible_achievements: boolean
|
hide_impossible_achievements: boolean
|
||||||
hide_map_filters: boolean
|
hide_map_filters: boolean
|
||||||
|
time_format: "ampm" | "24hr"
|
||||||
|
date_format: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -326,6 +328,14 @@ export interface MissingLivery {
|
|||||||
clipboard_text: string;
|
clipboard_text: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface MissingAirline{
|
||||||
|
code: string;
|
||||||
|
flights: {
|
||||||
|
flight_number: string;
|
||||||
|
link: string;
|
||||||
|
}[]
|
||||||
|
}
|
||||||
|
|
||||||
declare module '@inertiajs/vue3' {
|
declare module '@inertiajs/vue3' {
|
||||||
interface PageProps extends SharedProps {}
|
interface PageProps extends SharedProps {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,8 @@ use Inertia\Inertia;
|
|||||||
Route::get('/', [AdminController::class, 'dashboard'])->name('dashboard');
|
Route::get('/', [AdminController::class, 'dashboard'])->name('dashboard');
|
||||||
Route::get('/missing-liveries', [AdminController::class, 'reconcileMissingLiveries'])->name('reconcile-missing-liveries')->middleware('permission:reconcile_missing_liveries');
|
Route::get('/missing-liveries', [AdminController::class, 'reconcileMissingLiveries'])->name('reconcile-missing-liveries')->middleware('permission:reconcile_missing_liveries');
|
||||||
Route::post('/ignore-missing-livery', [AdminController::class, 'ignoreMissingLivery'])->name('ignore-missing-livery');
|
Route::post('/ignore-missing-livery', [AdminController::class, 'ignoreMissingLivery'])->name('ignore-missing-livery');
|
||||||
|
|
||||||
|
Route::get('/missing-airlines', [AdminController::class, 'reconcileMissingAirlines'])->name('reconcile-missing-airlines')->middleware('permission:reconcile_missing_liveries');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user