Ui fixes #16

Merged
dredgy merged 9 commits from ui-fixes into main 2026-08-21 22:54:14 +10:00
2 changed files with 29 additions and 12 deletions
Showing only changes of commit a6bf1c09fe - Show all commits
+8 -4
View File
@@ -245,15 +245,19 @@ class FlightController extends Controller
$newFlight = auth()->user()->flights()->create($this->flightPayload($validated)); $newFlight = auth()->user()->flights()->create($this->flightPayload($validated));
UserAction::create([ UserAction::create([
'user_id' => $newFlight->user_id, 'user_id' => $newFlight->user_id,
'type' => $newFlight->departure_date->isFuture() ? 'flight_booked' : 'flight_logged', 'type' => $newFlight->departure_date->isFuture() ? 'flight_booked' : 'flight_logged',
'data' => [ 'data' => [
'flight' => $newFlight->snapshot($newFlight->id), 'flight' => $newFlight->snapshot($newFlight->id),
], ],
]); ]);
if ($request->boolean('add_more')) {
return redirect()->route('flights.add')
->with('success', 'Flight saved. Add another below.');
}
return redirect()->route('profile.departure-board', [Auth::user()->name, $newFlight->id]); return redirect()->route('profile.flight', [Auth::user()->name, $newFlight->id]);
} }
+21 -8
View File
@@ -154,9 +154,9 @@ const submitForm = useForm({
crew_type_id: null as number | null, crew_type_id: null as number | null,
note: '' as string | null, note: '' as string | null,
auto_update: false, auto_update: false,
add_more: false,
}) })
const departureIsFuture = computed(() => { const departureIsFuture = computed(() => {
if (!form.departure_date) return false if (!form.departure_date) return false
return new Date(form.departure_date) > new Date() return new Date(form.departure_date) > new Date()
@@ -168,7 +168,7 @@ watch(departureIsFuture, (isFuture) => {
}, { immediate: true }) }, { immediate: true })
function submit() { function submit(addMore = false) {
submitForm.flight_number = flightNumber.value submitForm.flight_number = flightNumber.value
submitForm.departure_date = form.departure_date submitForm.departure_date = form.departure_date
submitForm.arrival_date = form.arrival_date submitForm.arrival_date = form.arrival_date
@@ -184,6 +184,7 @@ function submit() {
submitForm.crew_type_id = form.crew_type?.id ?? null submitForm.crew_type_id = form.crew_type?.id ?? null
submitForm.note = form.note submitForm.note = form.note
submitForm.auto_update = form.auto_update submitForm.auto_update = form.auto_update
submitForm.add_more = addMore
if (isEdit) { if (isEdit) {
submitForm.put(route('flights.update', { flight: props.flight!.id })) submitForm.put(route('flights.update', { flight: props.flight!.id }))
@@ -897,15 +898,27 @@ function commitArrivalTimeInput() {
<!-- Submit --> <!-- Submit -->
<v-row> <v-row>
<v-col cols="12"> <v-col v-if="!isEdit" cols="12" md="6">
<v-btn <v-btn
block block
size="large" size="large"
:loading="submitForm.processing" variant="outlined"
:loading="submitForm.processing && submitForm.add_more"
:disabled="submitForm.processing" :disabled="submitForm.processing"
@click="submit" @click="submit(true)"
> >
{{ isEdit ? 'Save Changes' : 'Add Flight' }} Save Flight and Add Another
</v-btn>
</v-col>
<v-col cols="12" :md="isEdit ? 12 : 6">
<v-btn
block
size="large"
:loading="submitForm.processing && !submitForm.add_more"
:disabled="submitForm.processing"
@click="submit(false)"
>
{{ isEdit ? 'Save Changes' : 'Save Flight' }}
</v-btn> </v-btn>
</v-col> </v-col>
</v-row> </v-row>
@@ -927,8 +940,8 @@ function commitArrivalTimeInput() {
gap: 10px; gap: 10px;
min-height: 56px; min-height: 56px;
padding: 8px 12px; padding: 8px 12px;
border: 1px solid rgba(255, 255, 255, 0.24); border: 1px none rgba(255, 255, 255, 0.24);
border-radius: 4px; border-bottom-style: solid;
background: transparent; background: transparent;
transition: border-color 0.15s ease; transition: border-color 0.15s ease;
} }