Ui fixes #16
@@ -252,8 +252,12 @@ class FlightController extends Controller
|
||||
],
|
||||
]);
|
||||
|
||||
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]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -154,9 +154,9 @@ const submitForm = useForm({
|
||||
crew_type_id: null as number | null,
|
||||
note: '' as string | null,
|
||||
auto_update: false,
|
||||
add_more: false,
|
||||
})
|
||||
|
||||
|
||||
const departureIsFuture = computed(() => {
|
||||
if (!form.departure_date) return false
|
||||
return new Date(form.departure_date) > new Date()
|
||||
@@ -168,7 +168,7 @@ watch(departureIsFuture, (isFuture) => {
|
||||
}, { immediate: true })
|
||||
|
||||
|
||||
function submit() {
|
||||
function submit(addMore = false) {
|
||||
submitForm.flight_number = flightNumber.value
|
||||
submitForm.departure_date = form.departure_date
|
||||
submitForm.arrival_date = form.arrival_date
|
||||
@@ -184,6 +184,7 @@ function submit() {
|
||||
submitForm.crew_type_id = form.crew_type?.id ?? null
|
||||
submitForm.note = form.note
|
||||
submitForm.auto_update = form.auto_update
|
||||
submitForm.add_more = addMore
|
||||
|
||||
if (isEdit) {
|
||||
submitForm.put(route('flights.update', { flight: props.flight!.id }))
|
||||
@@ -897,15 +898,27 @@ function commitArrivalTimeInput() {
|
||||
|
||||
<!-- ── Submit ─────────────────────────────────────────────── -->
|
||||
<v-row>
|
||||
<v-col cols="12">
|
||||
<v-col v-if="!isEdit" cols="12" md="6">
|
||||
<v-btn
|
||||
block
|
||||
size="large"
|
||||
:loading="submitForm.processing"
|
||||
variant="outlined"
|
||||
:loading="submitForm.processing && submitForm.add_more"
|
||||
: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-col>
|
||||
</v-row>
|
||||
@@ -927,8 +940,8 @@ function commitArrivalTimeInput() {
|
||||
gap: 10px;
|
||||
min-height: 56px;
|
||||
padding: 8px 12px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.24);
|
||||
border-radius: 4px;
|
||||
border: 1px none rgba(255, 255, 255, 0.24);
|
||||
border-bottom-style: solid;
|
||||
background: transparent;
|
||||
transition: border-color 0.15s ease;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user