Compare commits
10
Commits
f0306a6dd8
...
1.1.3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a11e8f1428 | ||
|
|
90630489df | ||
|
|
2d55aa8488 | ||
|
|
1f23cbc033 | ||
|
|
e9ad1b45e0 | ||
|
|
64e164887b | ||
|
|
4b8fb1119b | ||
|
|
0230c77a2a | ||
|
|
3a082a57ff | ||
|
|
c016a4aaaf |
@@ -14,6 +14,7 @@ RUN composer install --no-dev --optimize-autoloader
|
|||||||
|
|
||||||
ARG APP_VERSION=Dev
|
ARG APP_VERSION=Dev
|
||||||
ENV VITE_APP_VERSION=$APP_VERSION
|
ENV VITE_APP_VERSION=$APP_VERSION
|
||||||
|
LABEL org.opencontainers.image.version=$APP_VERSION
|
||||||
|
|
||||||
RUN npm install && npm run build && rm -f public/hot
|
RUN npm install && npm run build && rm -f public/hot
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"dev:all": "concurrently -s all \"php artisan serve\" \"php artisan reverb:start\" \"php artisan queue:work\" \"npm run dev\" > /dev/null 2>&1",
|
"dev:all": "concurrently -s all \"php artisan serve\" \"php artisan reverb:start\" \"php artisan queue:work\" \"npm run dev\" > /dev/null 2>&1",
|
||||||
"serve:all": "concurrently -s all \"php artisan serve\" \"php artisan reverb:start\" \"php artisan queue:work\" > /dev/null 2>&1",
|
"serve:all": "concurrently -s all \"php artisan serve\" \"php artisan reverb:start\" \"php artisan queue:work\" > /dev/null 2>&1",
|
||||||
"updateVersion": "cross-var docker build -t dredgy/flights-api:$npm_config_tag -t dredgy/flights-api:latest . && cross-var docker push dredgy/flights-api:$npm_config_tag && docker push dredgy/flights-api:latest"
|
"updateVersion": "cross-var docker build --no-cache --build-arg APP_VERSION=$npm_config_tag -t dredgy/flights-api:$npm_config_tag -t dredgy/flights-api:latest . && cross-var docker push dredgy/flights-api:$npm_config_tag && docker push dredgy/flights-api:latest"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@inertiajs/vue3": "^2.0.0",
|
"@inertiajs/vue3": "^2.0.0",
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ const showColumn = (column: string) => props.columnsToShow.includes(column)
|
|||||||
|
|
||||||
<td v-if="showColumn('class_seat_combined')" class="v-data-table__td class-badges-cell">
|
<td v-if="showColumn('class_seat_combined')" class="v-data-table__td class-badges-cell">
|
||||||
<span class="class-cell">
|
<span class="class-cell">
|
||||||
<CrewTooltip v-if="flight.flight_reason?.name == 'Crew'" :crew-type="flight.crew_type!">
|
<CrewTooltip v-if="flight.flight_reason?.name == 'Crew' && flight.crew_type" :crew-type="flight.crew_type!">
|
||||||
<FlightClassBadge v-if="flight.flight_class?.internal_name === 'crew'" :flight="flight" />
|
<FlightClassBadge v-if="flight.flight_class?.internal_name === 'crew'" :flight="flight" />
|
||||||
<InlineBadge v-else variant="crew">Crew</InlineBadge>
|
<InlineBadge v-else variant="crew">Crew</InlineBadge>
|
||||||
</CrewTooltip>
|
</CrewTooltip>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
withDefaults(defineProps<{
|
withDefaults(defineProps<{
|
||||||
title: string,
|
title?: string,
|
||||||
wide?: boolean,
|
wide?: boolean,
|
||||||
blurb?: string
|
blurb?: string
|
||||||
}>(), { wide: false })
|
}>(), { wide: false })
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ const version = __APP_VERSION__
|
|||||||
<footer class="glass">
|
<footer class="glass">
|
||||||
<span class="footer-copyright">
|
<span class="footer-copyright">
|
||||||
© {{ year }} FlightsGoneBy
|
© {{ year }} FlightsGoneBy
|
||||||
|
|
||||||
<span class="footer-version">v{{ version }}</span>
|
<span class="footer-version">v{{ version }}</span>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ 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} from '@/Types/types'
|
||||||
import { ref, watch, computed } from 'vue'
|
import { ref, watch, computed } from 'vue'
|
||||||
|
import { VTimePicker, VDatePicker } from 'vuetify/components'
|
||||||
|
|
||||||
defineOptions({ layout: MainLayout })
|
defineOptions({ layout: MainLayout })
|
||||||
|
|
||||||
@@ -91,6 +92,20 @@ async function lookupFlight() {
|
|||||||
if (!form.aircraft) form.aircraft = data.aircraft_options[0]
|
if (!form.aircraft) form.aircraft = data.aircraft_options[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Populate scheduled times if the API returned them and the user
|
||||||
|
// hasn't already entered a time themselves. Suppress the +1hr
|
||||||
|
// auto-fill guess while doing this, since we have real data.
|
||||||
|
suppressArrivalAutoFill = true
|
||||||
|
const scheduledDep = normalizeTimeString(data.scheduled_departure_time)
|
||||||
|
if (scheduledDep && !departureTimePart.value) {
|
||||||
|
departureTimePart.value = scheduledDep
|
||||||
|
}
|
||||||
|
const scheduledArr = normalizeTimeString(data.scheduled_arrival_time)
|
||||||
|
if (scheduledArr && !arrivalTimePart.value) {
|
||||||
|
arrivalTimePart.value = scheduledArr
|
||||||
|
}
|
||||||
|
suppressArrivalAutoFill = false
|
||||||
|
|
||||||
lookupKey.value++
|
lookupKey.value++
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
lookupError.value = String(e)
|
lookupError.value = String(e)
|
||||||
@@ -188,19 +203,117 @@ const fromOptionsData = ref<{ value: number; title: string; country_code: st
|
|||||||
const toOptionsData = ref<{ value: number; title: string; country_code: string }[]>(props.flight?.to_options ?? [])
|
const toOptionsData = ref<{ value: number; title: string; country_code: string }[]>(props.flight?.to_options ?? [])
|
||||||
const aircraftOptionsData = ref<{ value: number; title: string }[]>(props.flight?.aircraft_options ?? [])
|
const aircraftOptionsData = ref<{ value: number; title: string }[]>(props.flight?.aircraft_options ?? [])
|
||||||
|
|
||||||
|
// ── Split date/time pickers ───────────────────────────────────────────────────
|
||||||
watch(() => form.departure_date, (newVal) => {
|
// form.departure_date / form.arrival_date stay as the single source of truth
|
||||||
if (!newVal || form.arrival_date) return
|
// (YYYY-MM-DDTHH:mm strings) that the rest of the component and submit() rely
|
||||||
const dep = new Date(newVal)
|
// on. These refs + watchers just give the template two separate pickers while
|
||||||
const arr = new Date(dep.getTime() + 60 * 60 * 1000)
|
// keeping those combined strings in sync — no server-side changes needed.
|
||||||
|
|
||||||
const pad = (n: number) => String(n).padStart(2, '0')
|
const pad = (n: number) => String(n).padStart(2, '0')
|
||||||
form.arrival_date = `${arr.getFullYear()}-${pad(arr.getMonth() + 1)}-${pad(arr.getDate())}T${pad(arr.getHours())}:${pad(arr.getMinutes())}`
|
|
||||||
|
function parseDateTime(dt: string | null | undefined) {
|
||||||
|
if (!dt) return { date: null as Date | null, time: null as string | null }
|
||||||
|
const d = new Date(dt)
|
||||||
|
if (isNaN(d.getTime())) return { date: null as Date | null, time: null as string | null }
|
||||||
|
return {
|
||||||
|
date: new Date(d.getFullYear(), d.getMonth(), d.getDate()),
|
||||||
|
time: `${pad(d.getHours())}:${pad(d.getMinutes())}`,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function combineDateTime(date: Date | null, time: string | null): string {
|
||||||
|
if (!date) return ''
|
||||||
|
const [hh, mm] = (time ?? '00:00').split(':')
|
||||||
|
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 clearDepartureTime() { departureTimePart.value = null }
|
||||||
|
function clearArrivalDate() { arrivalDatePart.value = null }
|
||||||
|
function clearArrivalTime() { arrivalTimePart.value = null }
|
||||||
|
|
||||||
|
// Normalizes whatever shape the API sends a scheduled time in ("14:30",
|
||||||
|
// "14:30:00", or a full datetime string) down to the internal "HH:mm" format.
|
||||||
|
function normalizeTimeString(t: string | null | undefined): string | null {
|
||||||
|
if (!t) return null
|
||||||
|
const match = t.match(/(\d{1,2}):(\d{2})/)
|
||||||
|
if (match) {
|
||||||
|
return `${match[1].padStart(2, '0')}:${match[2]}`
|
||||||
|
}
|
||||||
|
const d = new Date(t)
|
||||||
|
if (!isNaN(d.getTime())) {
|
||||||
|
return `${pad(d.getHours())}:${pad(d.getMinutes())}`
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
const depInit = parseDateTime(form.departure_date)
|
||||||
|
const arrInit = parseDateTime(form.arrival_date)
|
||||||
|
|
||||||
|
const departureDatePart = ref<Date | null>(depInit.date)
|
||||||
|
const departureTimePart = ref<string | null>(depInit.time)
|
||||||
|
const arrivalDatePart = ref<Date | null>(arrInit.date)
|
||||||
|
const arrivalTimePart = ref<string | null>(arrInit.time)
|
||||||
|
|
||||||
|
const depDateMenu = ref(false)
|
||||||
|
const depTimeMenu = ref(false)
|
||||||
|
const arrDateMenu = ref(false)
|
||||||
|
const arrTimeMenu = ref(false)
|
||||||
|
|
||||||
|
// A short guard so programmatic updates (e.g. auto-fill of arrival) don't
|
||||||
|
// fight with the "only auto-fill once" behaviour below.
|
||||||
|
let suppressArrivalAutoFill = false
|
||||||
|
|
||||||
|
// Keep form.departure_date in sync whenever either split piece changes
|
||||||
|
watch([departureDatePart, departureTimePart], () => {
|
||||||
|
form.departure_date = combineDateTime(departureDatePart.value, departureTimePart.value)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Keep form.arrival_date in sync whenever either split piece changes
|
||||||
|
watch([arrivalDatePart, arrivalTimePart], () => {
|
||||||
|
if (suppressArrivalAutoFill) return
|
||||||
|
form.arrival_date = combineDateTime(arrivalDatePart.value, arrivalTimePart.value)
|
||||||
|
})
|
||||||
|
|
||||||
|
// Auto-fill arrival (+1hr) the first time a departure TIME is chosen (and a
|
||||||
|
// departure date is already set) and arrival is still empty. Picking the
|
||||||
|
// departure date alone no longer triggers this — only setting the time does.
|
||||||
|
watch(departureTimePart, (newTime) => {
|
||||||
|
if (suppressArrivalAutoFill) return
|
||||||
|
if (!newTime || !departureDatePart.value || arrivalDatePart.value) return
|
||||||
|
|
||||||
|
const dep = new Date(departureDatePart.value)
|
||||||
|
const [h, m] = newTime.split(':').map(Number)
|
||||||
|
dep.setHours(h, m)
|
||||||
|
const arr = new Date(dep.getTime() + 60 * 60 * 1000)
|
||||||
|
|
||||||
|
suppressArrivalAutoFill = true
|
||||||
|
arrivalDatePart.value = new Date(arr.getFullYear(), arr.getMonth(), arr.getDate())
|
||||||
|
arrivalTimePart.value = `${pad(arr.getHours())}:${pad(arr.getMinutes())}`
|
||||||
|
suppressArrivalAutoFill = false
|
||||||
|
|
||||||
|
form.arrival_date = combineDateTime(arrivalDatePart.value, arrivalTimePart.value)
|
||||||
|
}, { flush: 'sync' })
|
||||||
|
|
||||||
const getArrivalBound = (form: any, offsetDays: number) => {
|
const getArrivalBound = (form: any, offsetDays: number) => {
|
||||||
if (!form.departure_date) return undefined
|
if (!form.departure_date) return undefined
|
||||||
const pad = (n: number) => String(n).padStart(2, '0')
|
|
||||||
const d = new Date(form.departure_date)
|
const d = new Date(form.departure_date)
|
||||||
d.setDate(d.getDate() + offsetDays)
|
d.setDate(d.getDate() + offsetDays)
|
||||||
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}T${pad(d.getHours())}:${pad(d.getMinutes())}`
|
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}T${pad(d.getHours())}:${pad(d.getMinutes())}`
|
||||||
@@ -208,6 +321,9 @@ const getArrivalBound = (form: any, offsetDays: number) => {
|
|||||||
|
|
||||||
const arrivalMin = computed(() => getArrivalBound(form, -2))
|
const arrivalMin = computed(() => getArrivalBound(form, -2))
|
||||||
const arrivalMax = computed(() => getArrivalBound(form, 3))
|
const arrivalMax = computed(() => getArrivalBound(form, 3))
|
||||||
|
|
||||||
|
const arrivalMinDate = computed(() => arrivalMin.value ? new Date(arrivalMin.value) : undefined)
|
||||||
|
const arrivalMaxDate = computed(() => arrivalMax.value ? new Date(arrivalMax.value) : undefined)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -249,27 +365,109 @@ const arrivalMax = computed(() => getArrivalBound(form, 3))
|
|||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
|
|
||||||
<!-- ── Departure + Arrival datetime ──────────────────────── -->
|
<!-- ── Departure date + time ──────────────────────────────── -->
|
||||||
<v-row>
|
<v-row>
|
||||||
<v-col cols="12" md="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-model="form.departure_date"
|
v-bind="menuProps"
|
||||||
label="Departure Date & Time"
|
:model-value="formatDateDisplay(departureDatePart)"
|
||||||
type="datetime-local"
|
label="Departure Date"
|
||||||
|
readonly
|
||||||
|
clearable
|
||||||
|
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>
|
||||||
|
<v-date-picker
|
||||||
|
v-model="departureDatePart"
|
||||||
|
@update:model-value="depDateMenu = false"
|
||||||
|
/>
|
||||||
|
</v-menu>
|
||||||
</v-col>
|
</v-col>
|
||||||
<v-col cols="12" md="6">
|
<v-col cols="12" sm="6">
|
||||||
|
<v-menu v-model="depTimeMenu" :close-on-content-click="false">
|
||||||
|
<template #activator="{ props: menuProps }">
|
||||||
<v-text-field
|
<v-text-field
|
||||||
v-model="form.arrival_date"
|
v-bind="menuProps"
|
||||||
label="Arrival Date & Time"
|
:model-value="formatTimeDisplay(departureTimePart)"
|
||||||
type="datetime-local"
|
label="Departure Time"
|
||||||
|
readonly
|
||||||
|
clearable
|
||||||
|
prepend-inner-icon="mdi-clock-outline"
|
||||||
|
:disabled="!lookupComplete"
|
||||||
|
@click:clear="clearDepartureTime"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<v-card>
|
||||||
|
<v-time-picker
|
||||||
|
v-model="departureTimePart"
|
||||||
|
format="ampm"
|
||||||
|
scrollable
|
||||||
|
/>
|
||||||
|
<v-card-actions>
|
||||||
|
<v-spacer />
|
||||||
|
<v-btn variant="text" @click="depTimeMenu = false">OK</v-btn>
|
||||||
|
</v-card-actions>
|
||||||
|
</v-card>
|
||||||
|
</v-menu>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
|
||||||
|
<!-- ── Arrival date + time ─────────────────────────────────── -->
|
||||||
|
<v-row>
|
||||||
|
<v-col cols="12" sm="6">
|
||||||
|
<v-menu v-model="arrDateMenu" :close-on-content-click="false">
|
||||||
|
<template #activator="{ props: menuProps }">
|
||||||
|
<v-text-field
|
||||||
|
v-bind="menuProps"
|
||||||
|
:model-value="formatDateDisplay(arrivalDatePart)"
|
||||||
|
label="Arrival Date"
|
||||||
|
readonly
|
||||||
|
clearable
|
||||||
|
prepend-inner-icon="mdi-calendar"
|
||||||
:disabled="!lookupComplete"
|
:disabled="!lookupComplete"
|
||||||
:error-messages="submitForm.errors.arrival_date"
|
:error-messages="submitForm.errors.arrival_date"
|
||||||
:min="arrivalMin"
|
@click:clear="clearArrivalDate"
|
||||||
:max="arrivalMax"
|
|
||||||
/>
|
/>
|
||||||
|
</template>
|
||||||
|
<v-date-picker
|
||||||
|
v-model="arrivalDatePart"
|
||||||
|
:min="arrivalMinDate"
|
||||||
|
:max="arrivalMaxDate"
|
||||||
|
@update:model-value="arrDateMenu = false"
|
||||||
|
/>
|
||||||
|
</v-menu>
|
||||||
|
</v-col>
|
||||||
|
<v-col cols="12" sm="6">
|
||||||
|
<v-menu v-model="arrTimeMenu" :close-on-content-click="false">
|
||||||
|
<template #activator="{ props: menuProps }">
|
||||||
|
<v-text-field
|
||||||
|
v-bind="menuProps"
|
||||||
|
:model-value="formatTimeDisplay(arrivalTimePart)"
|
||||||
|
label="Arrival Time"
|
||||||
|
readonly
|
||||||
|
clearable
|
||||||
|
prepend-inner-icon="mdi-clock-outline"
|
||||||
|
:disabled="!lookupComplete"
|
||||||
|
@click:clear="clearArrivalTime"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<v-card>
|
||||||
|
<v-time-picker
|
||||||
|
v-model="arrivalTimePart"
|
||||||
|
format="ampm"
|
||||||
|
scrollable
|
||||||
|
/>
|
||||||
|
<v-card-actions>
|
||||||
|
<v-spacer />
|
||||||
|
<v-btn variant="text" @click="arrTimeMenu = false">OK</v-btn>
|
||||||
|
</v-card-actions>
|
||||||
|
</v-card>
|
||||||
|
</v-menu>
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
|
|
||||||
|
|||||||
Vendored
+1
-1
@@ -303,7 +303,7 @@ export interface Flight {
|
|||||||
airline: Airline | null
|
airline: Airline | null
|
||||||
aircraft: Aircraft | null
|
aircraft: Aircraft | null
|
||||||
seat_type: SeatType | null
|
seat_type: SeatType | null
|
||||||
crew_type: CrewType | null
|
crew_type?: CrewType | null
|
||||||
flight_reason: FlightReason | null
|
flight_reason: FlightReason | null
|
||||||
flight_class: FlightClass | null
|
flight_class: FlightClass | null
|
||||||
duration_display: string
|
duration_display: string
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
<link rel="icon" type="image/x-icon" href="{{ asset('img/favicons/favicon.png') }}">
|
<link rel="icon" type="image/x-icon" href="{{ asset('img/favicons/favicon.png') }}">
|
||||||
<!-- Fonts -->
|
<!-- Fonts -->
|
||||||
|
|
||||||
|
<meta name="description" content="FlightsGoneBy is the ultimate flight diary — log every flight, earn achievements, visualise your travels on an interactive map, and share your stats with friends.">
|
||||||
<link rel="preconnect" href="https://fonts.bunny.net">
|
<link rel="preconnect" href="https://fonts.bunny.net">
|
||||||
<link href="https://fonts.bunny.net/css?family=figtree:400,500,600&display=swap" rel="stylesheet" />
|
<link href="https://fonts.bunny.net/css?family=figtree:400,500,600&display=swap" rel="stylesheet" />
|
||||||
<!-- Apple Touch Icons -->
|
<!-- Apple Touch Icons -->
|
||||||
|
|||||||
Reference in New Issue
Block a user