Compare commits
10
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f63b54733b | ||
|
|
b3047e9571 | ||
|
|
267fd6fd12 | ||
|
|
60a3bce3bf | ||
|
|
39c0ce1b44 | ||
|
|
792cb082fd | ||
|
|
ae77fec0da | ||
|
|
2a5d2d7875 | ||
|
|
dbb3dac7f6 | ||
|
|
731a6aa09a |
@@ -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!",
|
||||||
|
|||||||
@@ -102,6 +102,7 @@ class UserProfileController extends Controller
|
|||||||
$canView = Gate::allows('viewProfileData', $user);
|
$canView = Gate::allows('viewProfileData', $user);
|
||||||
|
|
||||||
$achievements = Achievement::with(['category', 'difficulty'])
|
$achievements = Achievement::with(['category', 'difficulty'])
|
||||||
|
->orderBy('id', 'asc')
|
||||||
->get()
|
->get()
|
||||||
->groupBy(fn(Achievement $a) => $a->category->name)
|
->groupBy(fn(Achievement $a) => $a->category->name)
|
||||||
->map(fn($group) => $group->sortBy('sort_order')->values());
|
->map(fn($group) => $group->sortBy('sort_order')->values());
|
||||||
@@ -171,6 +172,11 @@ class UserProfileController extends Controller
|
|||||||
default => null,
|
default => null,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$majorAlliances = match($achievement->internal_name){
|
||||||
|
'airlines_alliances.all_major_alliances' => Alliance::MAJOR_ALLIANCES,
|
||||||
|
default => [],
|
||||||
|
};
|
||||||
|
|
||||||
$continents = match($achievement->internal_name){
|
$continents = match($achievement->internal_name){
|
||||||
'countries_continents.all_continent_pairs_one_way', 'countries_continents.all_continent_pairs_both_ways' => Continent::all()->toArray(),
|
'countries_continents.all_continent_pairs_one_way', 'countries_continents.all_continent_pairs_both_ways' => Continent::all()->toArray(),
|
||||||
default => [],
|
default => [],
|
||||||
@@ -207,6 +213,7 @@ class UserProfileController extends Controller
|
|||||||
'continents' => $continents,
|
'continents' => $continents,
|
||||||
'aircraft_families' => $aircraftFamilies,
|
'aircraft_families' => $aircraftFamilies,
|
||||||
'achievementCount' => $user->unlockedAchievements()->count(),
|
'achievementCount' => $user->unlockedAchievements()->count(),
|
||||||
|
'majorAlliances' => Alliance::whereIn('internal_name', $majorAlliances)->get(),
|
||||||
'canView' => $canView,
|
'canView' => $canView,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,9 @@ class Alliance extends Model
|
|||||||
'skyteam' => 'airlines_alliances.all_skyteam',
|
'skyteam' => 'airlines_alliances.all_skyteam',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const array MAJOR_ALLIANCES = ['skyteam', 'oneworld', 'star_alliance'];
|
||||||
|
|
||||||
|
|
||||||
public function airlines(): HasMany
|
public function airlines(): HasMany
|
||||||
{
|
{
|
||||||
return $this->hasMany(Airline::class);
|
return $this->hasMany(Airline::class);
|
||||||
|
|||||||
+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) {
|
||||||
|
|||||||
@@ -28,6 +28,12 @@ class AirlinesAndAlliancesChecker extends BaseChecker
|
|||||||
|
|
||||||
$check = fn(string $alliance): int => $flownAllianceAirlines->get($alliance, 0);
|
$check = fn(string $alliance): int => $flownAllianceAirlines->get($alliance, 0);
|
||||||
|
|
||||||
|
$majorAlliancesFlown = collect(Alliance::MAJOR_ALLIANCES)
|
||||||
|
->filter(fn(string $alliance) => $check($alliance) > 0)
|
||||||
|
->count();
|
||||||
|
|
||||||
|
$this->awardProgress($majorAlliancesFlown, 'airlines_alliances.all_major_alliances');
|
||||||
|
|
||||||
$this->awardProgress($check('skyteam'), 'airlines_alliances.all_skyteam');
|
$this->awardProgress($check('skyteam'), 'airlines_alliances.all_skyteam');
|
||||||
$this->awardProgress($check('oneworld'), 'airlines_alliances.all_oneworld');
|
$this->awardProgress($check('oneworld'), 'airlines_alliances.all_oneworld');
|
||||||
$this->awardProgress($check('star_alliance'), 'airlines_alliances.all_star_alliance');
|
$this->awardProgress($check('star_alliance'), 'airlines_alliances.all_star_alliance');
|
||||||
@@ -40,6 +46,8 @@ class AirlinesAndAlliancesChecker extends BaseChecker
|
|||||||
|
|
||||||
$checkGroup = fn(array $group): int => $flownAirlines->intersect($group)->count();
|
$checkGroup = fn(array $group): int => $flownAirlines->intersect($group)->count();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$this->awardProgress($checkGroup(self::ME_3), 'airlines_alliances.me3');
|
$this->awardProgress($checkGroup(self::ME_3), 'airlines_alliances.me3');
|
||||||
$this->awardProgress($checkGroup(self::US_3), 'airlines_alliances.us3');
|
$this->awardProgress($checkGroup(self::US_3), 'airlines_alliances.us3');
|
||||||
$this->awardProgress($checkGroup(self::CN_3), 'airlines_alliances.cn3');
|
$this->awardProgress($checkGroup(self::CN_3), 'airlines_alliances.cn3');
|
||||||
|
|||||||
@@ -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,58 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use App\Models\Achievement;
|
||||||
|
use App\Models\AchievementCategory;
|
||||||
|
use App\Models\AchievementDifficulty;
|
||||||
|
use App\Models\User;
|
||||||
|
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
|
||||||
|
{
|
||||||
|
$moderate = AchievementDifficulty::where('internal_name', 'moderate')->first();
|
||||||
|
$airlines_and_alliances = AchievementCategory::where('internal_name', 'airlines_and_alliances')->first();
|
||||||
|
|
||||||
|
Achievement::create([
|
||||||
|
'name' => 'Allied Forces',
|
||||||
|
'internal_name' => 'airlines_alliances.all_major_alliances',
|
||||||
|
'short_description' => 'Fly The 3 Major Airline Alliances (Skyteam, Star Alliance, Oneworld)',
|
||||||
|
'progressive' => true,
|
||||||
|
'difficulty_description' => 'For most people in most parts of the world this is quite achievable',
|
||||||
|
'threshold' => 3,
|
||||||
|
'achievement_category_id' => $airlines_and_alliances->id,
|
||||||
|
'achievement_difficulty_id' => $moderate->id,
|
||||||
|
'has_page' => true,
|
||||||
|
'sort_order' => 1,
|
||||||
|
'icon' => 'standard_achievement.png',
|
||||||
|
'long_description' => '',
|
||||||
|
]);
|
||||||
|
|
||||||
|
Achievement::where('internal_name', 'airlines_alliances.cn3')->update(['sort_order' => 3]);
|
||||||
|
Achievement::where('internal_name', 'airlines_alliances.us3')->update(['sort_order' => 1]);
|
||||||
|
Achievement::where('internal_name', 'airlines_alliances.me3')->update(['sort_order' => 2]);
|
||||||
|
Achievement::where('internal_name', 'airlines_alliances.all_major_alliances')->update(['sort_order' => 4]);
|
||||||
|
Achievement::where('internal_name', 'airlines_alliances.all_skyteam')->update(['sort_order' => 5]);
|
||||||
|
Achievement::where('internal_name', 'airlines_alliances.all_oneworld')->update(['sort_order' => 6]);
|
||||||
|
Achievement::where('internal_name', 'airlines_alliances.all_star_alliance')->update(['sort_order' => 7]);
|
||||||
|
Achievement::where('internal_name', 'airlines_alliances.all_vanilla_alliance')->update(['sort_order' => 8]);
|
||||||
|
|
||||||
|
|
||||||
|
foreach(User::all() as $user){
|
||||||
|
$user->calculateAchievements();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -1,125 +1,115 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, ref } from 'vue'
|
import { computed } from 'vue'
|
||||||
import { Achievement, Airline, Alliance, Flight, User } from '@/Types/types'
|
import { Achievement, Alliance, Flight, User } from '@/Types/types'
|
||||||
import Panel from '@/Components/FlightsGoneBy/Panels/Panel.vue'
|
import Panel from '@/Components/FlightsGoneBy/Panels/Panel.vue'
|
||||||
import PanelHeader from '@/Components/FlightsGoneBy/Panels/PanelHeader.vue'
|
import PanelHeader from '@/Components/FlightsGoneBy/Panels/PanelHeader.vue'
|
||||||
import PanelSubHeader from '@/Components/FlightsGoneBy/Panels/PanelSubHeader.vue'
|
import PanelSubHeader from '@/Components/FlightsGoneBy/Panels/PanelSubHeader.vue'
|
||||||
import BadgeTable from '@/Components/FlightsGoneBy/GenericBadgeTable.vue'
|
import BadgeTable from '@/Components/FlightsGoneBy/GenericBadgeTable.vue'
|
||||||
import InlineBadge from '@/Components/FlightsGoneBy/InlineBadge.vue'
|
|
||||||
import AirlineLogo from '@/Components/FlightsGoneBy/AirlineLogo.vue'
|
|
||||||
import AllianceLogo from '@/Components/FlightsGoneBy/AllianceLogo.vue'
|
import AllianceLogo from '@/Components/FlightsGoneBy/AllianceLogo.vue'
|
||||||
import FlightBadge from "@/Components/FlightsGoneBy/FlightBadge.vue";
|
import FlightBadge from '@/Components/FlightsGoneBy/FlightBadge.vue'
|
||||||
|
|
||||||
|
defineOptions({ inheritAttrs: false })
|
||||||
interface AirlineEntry {
|
|
||||||
airline: Airline
|
|
||||||
flights: Flight[]
|
|
||||||
}
|
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
achievement: Achievement
|
achievement: Achievement
|
||||||
user: User
|
user: User
|
||||||
followStatus: string
|
followStatus: string
|
||||||
alliance: Alliance
|
majorAlliances: Alliance[]
|
||||||
airlines: Airline[]
|
|
||||||
flights: Flight[]
|
flights: Flight[]
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const flightsByAirline = computed(() => {
|
interface AllianceEntry {
|
||||||
const map = new Map<string, AirlineEntry>()
|
alliance: Alliance
|
||||||
const idToKey = new Map<number, string>()
|
flights: Flight[]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
for (const airline of props.airlines) {
|
const alliances = computed<AllianceEntry[]>(() => {
|
||||||
const key = rowKey(airline)
|
const entries = props.majorAlliances.map(alliance => ({ alliance, flights: [] as Flight[] }))
|
||||||
map.set(key, { airline, flights: [] })
|
const byName = new Map(entries.map(e => [e.alliance.internal_name, e]))
|
||||||
idToKey.set(airline.id, key)
|
|
||||||
for (const alias of airline.merged_from ?? []) {
|
|
||||||
idToKey.set(alias.id, key)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const flight of props.flights) {
|
for (const flight of props.flights) {
|
||||||
const airline = flight.airline
|
const key = flight.airline?.alliance?.internal_name
|
||||||
if (!airline) continue
|
|
||||||
const key = idToKey.get(airline.id)
|
|
||||||
if (!key) continue
|
if (!key) continue
|
||||||
map.get(key)?.flights.push(flight)
|
byName.get(key)?.flights.push(flight)
|
||||||
}
|
}
|
||||||
|
|
||||||
return map
|
return entries
|
||||||
})
|
})
|
||||||
|
|
||||||
function rowKey(airline: Airline): string {
|
const completedCount = computed(
|
||||||
return airline.iata_code ?? airline.internal_name
|
() => alliances.value.filter(a => a.flights.length > 0).length
|
||||||
|
)
|
||||||
|
|
||||||
|
function flightTitle(flight: Flight): string {
|
||||||
|
const name = flight.airline?.name ?? 'Unknown airline'
|
||||||
|
return `${name}: ${flight.departure_airport?.iata_code} → ${flight.arrival_airport?.iata_code}`
|
||||||
}
|
}
|
||||||
|
|
||||||
const rows = computed(() => [...flightsByAirline.value.keys()])
|
|
||||||
|
|
||||||
function entryFor(key: string): AirlineEntry {
|
|
||||||
return flightsByAirline.value.get(key)!
|
|
||||||
}
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<!-- Header -->
|
<!-- Header -->
|
||||||
<Panel>
|
<Panel>
|
||||||
<div class="alliance-header">
|
<div class="alliance-header">
|
||||||
<AllianceLogo :alliance="alliance" size="56" />
|
<div class="logo-row">
|
||||||
|
<AllianceLogo
|
||||||
|
v-for="entry in alliances"
|
||||||
|
:key="entry.alliance.internal_name"
|
||||||
|
:alliance="entry.alliance"
|
||||||
|
size="56"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<PanelHeader centered>{{ alliance.name }}</PanelHeader>
|
<PanelHeader centered>Major Alliances</PanelHeader>
|
||||||
<PanelSubHeader centered>
|
<PanelSubHeader centered>
|
||||||
<slot />
|
{{ completedCount }} / {{ alliances.length }} alliances flown
|
||||||
</PanelSubHeader>
|
</PanelSubHeader>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Panel>
|
</Panel>
|
||||||
|
|
||||||
|
<!-- Per-alliance breakdown -->
|
||||||
<!-- Airlines table -->
|
<Panel v-for="entry in alliances" :key="entry.alliance.internal_name">
|
||||||
<Panel>
|
|
||||||
<div class="table-toolbar">
|
<div class="table-toolbar">
|
||||||
<PanelHeader>Airlines</PanelHeader>
|
<PanelHeader>{{ entry.alliance.name }}</PanelHeader>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<BadgeTable
|
<BadgeTable
|
||||||
:rows="rows"
|
:rows="[entry.alliance.internal_name]"
|
||||||
:rowKey="key => key"
|
:rowKey="key => key"
|
||||||
:hasItems="key => entryFor(key).flights.length > 0"
|
:hasItems="() => entry.flights.length > 0"
|
||||||
labelWidth="14em"
|
labelWidth="14em"
|
||||||
>
|
>
|
||||||
<template #label="{ row: key }">
|
<template #label>
|
||||||
<div class="airline-label" >
|
<div class="airline-label">
|
||||||
<AirlineLogo :airline="entryFor(key).airline" size="24" />
|
<AllianceLogo :alliance="entry.alliance" size="24" />
|
||||||
<span>{{ entryFor(key).airline.name }}</span>
|
<span>{{ entry.alliance.name }}</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #items="{ row: key }">
|
<template #items>
|
||||||
<FlightBadge
|
<FlightBadge
|
||||||
v-for="flight in entryFor(key).flights"
|
v-for="flight in entry.flights"
|
||||||
:key="flight.id"
|
:key="flight.id"
|
||||||
:title="`${flight.departure_airport?.iata_code} → ${flight.arrival_airport?.iata_code}`"
|
:title="flightTitle(flight)"
|
||||||
:flight="flight" />
|
:flight="flight"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
</BadgeTable>
|
</BadgeTable>
|
||||||
</Panel>
|
</Panel>
|
||||||
|
|
||||||
<!-- Slot for alliance-specific panels -->
|
|
||||||
<slot name="extra" />
|
|
||||||
|
|
||||||
<!-- Requirements -->
|
<!-- Requirements -->
|
||||||
<Panel>
|
<Panel>
|
||||||
<PanelHeader centered>Requirements</PanelHeader>
|
<PanelHeader centered>Requirements</PanelHeader>
|
||||||
<p>
|
<p>
|
||||||
To complete this challenge you must fly with every current member airline of
|
To complete this challenge you must fly with at least one member airline from each of
|
||||||
<strong>{{ alliance.name }}</strong>. Alliance membership changes over time, so the
|
the three major alliances. Unlike the individual alliance challenges, you don't need
|
||||||
required airlines reflect the current roster.
|
to fly every airline in an alliance — just one flight per alliance is enough.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Codeshare flights do not count, the operating carrier must be a member of {{alliance.name}}.
|
Codeshare flights do not count, the operating carrier must be a member of the
|
||||||
|
alliance.
|
||||||
</p>
|
</p>
|
||||||
</Panel>
|
</Panel>
|
||||||
</template>
|
</template>
|
||||||
@@ -133,6 +123,10 @@ function entryFor(key: string): AirlineEntry {
|
|||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.logo-row {
|
||||||
|
display: flex;
|
||||||
|
gap: 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
.table-toolbar {
|
.table-toolbar {
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -142,7 +136,6 @@ function entryFor(key: string): AirlineEntry {
|
|||||||
margin-bottom: 0.75rem;
|
margin-bottom: 0.75rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.airline-label {
|
.airline-label {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -150,5 +143,4 @@ function entryFor(key: string): AirlineEntry {
|
|||||||
gap: 0.5rem;
|
gap: 0.5rem;
|
||||||
padding: 0 0.25rem;
|
padding: 0 0.25rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -98,12 +98,12 @@ const showColumn = (column: string) => props.columnsToShow.includes(column)
|
|||||||
|
|
||||||
<td v-if="showColumn('departure_time')" class="v-data-table__td">
|
<td v-if="showColumn('departure_time')" class="v-data-table__td">
|
||||||
<span class="time-cell">
|
<span class="time-cell">
|
||||||
<Mono small>{{ flight.departure_time_display }}</Mono>
|
<Mono small>{{flight.departure_time_display}}</Mono>
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td v-if="showColumn('arrival_time')" class="v-data-table__td arrival-time-cell">
|
<td v-if="showColumn('arrival_time')" class="v-data-table__td arrival-time-cell">
|
||||||
<Mono small>{{ flight.arrival_time_display }}</Mono>
|
<Mono small>{{flight.arrival_time_display}}</Mono>
|
||||||
<DayDifference :value="flight.arrival_day_difference" />
|
<DayDifference :value="flight.arrival_day_difference" />
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
|||||||
@@ -659,7 +659,7 @@ export default defineComponent({
|
|||||||
|
|
||||||
const fitBounds = (): void => {
|
const fitBounds = (): void => {
|
||||||
if (!props.flights.length) return
|
if (!props.flights.length) return
|
||||||
const padding = props.compact ? 25 : 60
|
const padding = props.compact ? 50 : 60
|
||||||
|
|
||||||
const lngs = props.flights.flatMap(f => [f.departure_airport.longitude_deg, f.arrival_airport.longitude_deg])
|
const lngs = props.flights.flatMap(f => [f.departure_airport.longitude_deg, f.arrival_airport.longitude_deg])
|
||||||
const lats = props.flights.flatMap(f => [f.departure_airport.latitude_deg, f.arrival_airport.latitude_deg])
|
const lats = props.flights.flatMap(f => [f.departure_airport.latitude_deg, f.arrival_airport.latitude_deg])
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ const store = useNotificationStore();
|
|||||||
max-width="360"
|
max-width="360"
|
||||||
>
|
>
|
||||||
<v-card-text class="d-flex align-center ga-3">
|
<v-card-text class="d-flex align-center ga-3">
|
||||||
<v-icon icon="mdi-trophy" color="amber" size="32" />
|
<v-icon :icon="notification.is_achievement ? 'mdi-trophy' : 'mdi-bell-ring'" color="amber" size="32" />
|
||||||
<div>
|
<div>
|
||||||
<div class="text-subtitle-2 font-weight-bold">{{ notification.title }}</div>
|
<div class="text-subtitle-2 font-weight-bold">{{ notification.title }}</div>
|
||||||
<div class="text-body-2 text-medium-emphasis">{{ notification.body }}</div>
|
<div class="text-body-2 text-medium-emphasis">{{ notification.body }}</div>
|
||||||
|
|||||||
@@ -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,44 +472,51 @@ 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">
|
<v-text-field
|
||||||
<template #activator="{ props: menuProps }">
|
v-model="departureDateValue"
|
||||||
<v-text-field
|
type="date"
|
||||||
v-bind="menuProps"
|
label="Departure Date"
|
||||||
:model-value="formatDateDisplay(departureDatePart)"
|
prepend-inner-icon="mdi-calendar"
|
||||||
label="Departure Date"
|
:disabled="!lookupComplete"
|
||||||
readonly
|
:error-messages="submitForm.errors.departure_date"
|
||||||
clearable
|
>
|
||||||
prepend-inner-icon="mdi-calendar"
|
<template #append-inner>
|
||||||
:disabled="!lookupComplete"
|
<v-menu v-model="depDateMenu" :close-on-content-click="false">
|
||||||
:error-messages="submitForm.errors.departure_date"
|
<template #activator="{ props: menuProps }">
|
||||||
@click:clear="clearDepartureDate"
|
<v-icon
|
||||||
/>
|
v-bind="menuProps"
|
||||||
|
icon="mdi-calendar-month"
|
||||||
|
style="cursor: pointer"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<v-date-picker
|
||||||
|
v-model="departureDatePart"
|
||||||
|
@update:model-value="depDateMenu = false"
|
||||||
|
/>
|
||||||
|
</v-menu>
|
||||||
</template>
|
</template>
|
||||||
<v-date-picker
|
</v-text-field>
|
||||||
v-model="departureDatePart"
|
|
||||||
@update:model-value="depDateMenu = false"
|
|
||||||
/>
|
|
||||||
</v-menu>
|
|
||||||
</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,46 +531,53 @@ 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">
|
<v-text-field
|
||||||
<template #activator="{ props: menuProps }">
|
v-model="arrivalDateValue"
|
||||||
<v-text-field
|
type="date"
|
||||||
v-bind="menuProps"
|
label="Arrival Date"
|
||||||
:model-value="formatDateDisplay(arrivalDatePart)"
|
prepend-inner-icon="mdi-calendar"
|
||||||
label="Arrival Date"
|
:disabled="!lookupComplete"
|
||||||
readonly
|
:error-messages="submitForm.errors.arrival_date"
|
||||||
clearable
|
>
|
||||||
prepend-inner-icon="mdi-calendar"
|
<template #append-inner>
|
||||||
:disabled="!lookupComplete"
|
<v-menu v-model="arrDateMenu" :close-on-content-click="false">
|
||||||
:error-messages="submitForm.errors.arrival_date"
|
<template #activator="{ props: menuProps }">
|
||||||
@click:clear="clearArrivalDate"
|
<v-icon
|
||||||
/>
|
v-bind="menuProps"
|
||||||
|
icon="mdi-calendar-month"
|
||||||
|
style="cursor: pointer"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<v-date-picker
|
||||||
|
v-model="arrivalDatePart"
|
||||||
|
:min="arrivalMinDate"
|
||||||
|
:max="arrivalMaxDate"
|
||||||
|
@update:model-value="arrDateMenu = false"
|
||||||
|
/>
|
||||||
|
</v-menu>
|
||||||
</template>
|
</template>
|
||||||
<v-date-picker
|
</v-text-field>
|
||||||
v-model="arrivalDatePart"
|
|
||||||
:min="arrivalMinDate"
|
|
||||||
:max="arrivalMaxDate"
|
|
||||||
@update:model-value="arrDateMenu = false"
|
|
||||||
/>
|
|
||||||
</v-menu>
|
|
||||||
</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>
|
||||||
|
|||||||
@@ -0,0 +1,146 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { computed } from 'vue'
|
||||||
|
import { Achievement, Alliance, Flight, User } from '@/Types/types'
|
||||||
|
import Panel from '@/Components/FlightsGoneBy/Panels/Panel.vue'
|
||||||
|
import PanelHeader from '@/Components/FlightsGoneBy/Panels/PanelHeader.vue'
|
||||||
|
import PanelSubHeader from '@/Components/FlightsGoneBy/Panels/PanelSubHeader.vue'
|
||||||
|
import BadgeTable from '@/Components/FlightsGoneBy/GenericBadgeTable.vue'
|
||||||
|
import AllianceLogo from '@/Components/FlightsGoneBy/AllianceLogo.vue'
|
||||||
|
import FlightBadge from '@/Components/FlightsGoneBy/FlightBadge.vue'
|
||||||
|
|
||||||
|
defineOptions({ inheritAttrs: false })
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
achievement: Achievement
|
||||||
|
user: User
|
||||||
|
followStatus: string
|
||||||
|
majorAlliances: Alliance[]
|
||||||
|
flights: Flight[]
|
||||||
|
}>()
|
||||||
|
|
||||||
|
interface AllianceEntry {
|
||||||
|
alliance: Alliance
|
||||||
|
flights: Flight[]
|
||||||
|
}
|
||||||
|
|
||||||
|
const alliances = computed<AllianceEntry[]>(() => {
|
||||||
|
const entries = props.majorAlliances.map(alliance => ({ alliance, flights: [] as Flight[] }))
|
||||||
|
const byName = new Map(entries.map(e => [e.alliance.internal_name, e]))
|
||||||
|
|
||||||
|
for (const flight of props.flights) {
|
||||||
|
const key = flight.airline?.alliance?.internal_name
|
||||||
|
if (!key) continue
|
||||||
|
byName.get(key)?.flights.push(flight)
|
||||||
|
}
|
||||||
|
|
||||||
|
return entries
|
||||||
|
})
|
||||||
|
|
||||||
|
const rows = computed(() => alliances.value.map(e => e.alliance.internal_name))
|
||||||
|
|
||||||
|
function entryFor(key: string): AllianceEntry {
|
||||||
|
return alliances.value.find(e => e.alliance.internal_name === key)!
|
||||||
|
}
|
||||||
|
|
||||||
|
const completedCount = computed(
|
||||||
|
() => alliances.value.filter(a => a.flights.length > 0).length
|
||||||
|
)
|
||||||
|
|
||||||
|
function flightTitle(flight: Flight): string {
|
||||||
|
const name = flight.airline?.name ?? 'Unknown airline'
|
||||||
|
return `${name}: ${flight.departure_airport?.iata_code} → ${flight.arrival_airport?.iata_code}`
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<!-- Header -->
|
||||||
|
<Panel>
|
||||||
|
<div class="alliance-header">
|
||||||
|
<div class="logo-row">
|
||||||
|
<AllianceLogo
|
||||||
|
v-for="entry in alliances"
|
||||||
|
:key="entry.alliance.internal_name"
|
||||||
|
:alliance="entry.alliance"
|
||||||
|
size="56"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</Panel>
|
||||||
|
|
||||||
|
<!-- Alliances table -->
|
||||||
|
<Panel>
|
||||||
|
<div class="table-toolbar">
|
||||||
|
<PanelHeader>Alliances</PanelHeader>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<BadgeTable
|
||||||
|
:rows="rows"
|
||||||
|
:rowKey="key => key"
|
||||||
|
:hasItems="key => entryFor(key).flights.length > 0"
|
||||||
|
labelWidth="14em"
|
||||||
|
>
|
||||||
|
<template #label="{ row: key }">
|
||||||
|
<div class="airline-label">
|
||||||
|
<AllianceLogo :alliance="entryFor(key).alliance" size="24" />
|
||||||
|
<span>{{ entryFor(key).alliance.name }}</span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #items="{ row: key }">
|
||||||
|
<FlightBadge
|
||||||
|
v-for="flight in entryFor(key).flights"
|
||||||
|
:key="flight.id"
|
||||||
|
:title="flightTitle(flight)"
|
||||||
|
:flight="flight"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</BadgeTable>
|
||||||
|
</Panel>
|
||||||
|
|
||||||
|
<!-- Requirements -->
|
||||||
|
<Panel>
|
||||||
|
<PanelHeader centered>Requirements</PanelHeader>
|
||||||
|
<p>
|
||||||
|
To complete this challenge you must fly with at least one member airline from each of
|
||||||
|
the three major alliances. Unlike the individual alliance challenges, you don't need
|
||||||
|
to fly every airline in an alliance — just one flight per alliance is enough.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Codeshare flights do not count, the operating carrier must be a member of the
|
||||||
|
alliance.
|
||||||
|
</p>
|
||||||
|
</Panel>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.alliance-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 1.5rem;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logo-row {
|
||||||
|
display: flex;
|
||||||
|
gap: 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-toolbar {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 1rem;
|
||||||
|
margin-bottom: 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.airline-label {
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.5rem;
|
||||||
|
padding: 0 0.25rem;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -26,6 +26,7 @@ const props = defineProps<{
|
|||||||
airlines: Airline[]
|
airlines: Airline[]
|
||||||
continents: Continent[]
|
continents: Continent[]
|
||||||
aircraft_families: Record<string, string[]>
|
aircraft_families: Record<string, string[]>
|
||||||
|
majorAlliances: Alliance[]
|
||||||
achievementCount: number
|
achievementCount: number
|
||||||
canView: boolean
|
canView: boolean
|
||||||
}>()
|
}>()
|
||||||
@@ -63,7 +64,7 @@ const unlocked = computed(() => {
|
|||||||
|
|
||||||
<VAlert type="info" v-if="loggedInUser?.id !== user.id && loggedInUser">
|
<VAlert type="info" v-if="loggedInUser?.id !== user.id && loggedInUser">
|
||||||
You are viewing {{user.name}}'s progress in this achievement. If you would like to see your progress, please
|
You are viewing {{user.name}}'s progress in this achievement. If you would like to see your progress, please
|
||||||
<Link :href="route('profile.achievement', {user: loggedInUser.name, achievement: achievement.internal_name})"><VBtn variant="flat">click here.</VBtn></Link>
|
<Link :href="route('profile.achievement', {user: loggedInUser.name, achievement: achievement.internal_name})"><u>click here.</u></Link>
|
||||||
</VAlert>
|
</VAlert>
|
||||||
|
|
||||||
|
|
||||||
@@ -116,6 +117,7 @@ const unlocked = computed(() => {
|
|||||||
:alliance="alliance"
|
:alliance="alliance"
|
||||||
:continents="continents"
|
:continents="continents"
|
||||||
:families="aircraft_families"
|
:families="aircraft_families"
|
||||||
|
:major-alliances="majorAlliances"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</ProfileLayout>
|
</ProfileLayout>
|
||||||
|
|||||||
@@ -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
+2
@@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user