Skip to content

Commit

Permalink
Merge pull request #858 from daveroverts/852-keep-previous-ctot-and-e…
Browse files Browse the repository at this point in the history
…ta-when-editing-an-existing-booking

852 keep previous ctot and eta when editing an existing booking
  • Loading branch information
daveroverts authored Jun 6, 2024
2 parents 7af41d1 + d4e55c9 commit b08b040
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions app/Http/Controllers/Booking/BookingAdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,17 @@ public function update(UpdateBooking $request, Booking $booking): RedirectRespon
'Y-m-d H:i',
$booking->event->startEvent->toDateString() . ' ' . $request->ctot
);
} else {
$flightAttributes['ctot'] = null;
}

if ($request->eta) {
$flightAttributes['eta'] = Carbon::createFromFormat(
'Y-m-d H:i',
$booking->event->startEvent->toDateString() . ' ' . $request->eta
);
} else {
$flightAttributes['eta'] = null;
}

$flight->fill($flightAttributes);
Expand Down
5 changes: 3 additions & 2 deletions resources/views/booking/admin/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,14 @@
<x-form-input name="acType" :label="__('Aircraft code')" minlength="3" maxlength="4" />

@bind($flight)

<x-form-group inline>
<x-form-input name="ctot" type="time" :label="'<i class=\'fa fa-clock\'></i> ' . __('CTOT')">
<x-form-input name="ctot" :bind="false" value="{{ $flight->ctot?->format('H:i') }}" type="time" :label="'<i class=\'fa fa-clock\'></i> ' . __('CTOT')">
@slot('append')
z
@endslot
</x-form-input>
<x-form-input name="eta" type="time" :label="'<i class=\'fa fa-clock\'></i> ' . __('ETA')">
<x-form-input name="eta" :bind="false" value="{{ $flight->eta?->format('H:i') }}" type="time" :label="'<i class=\'fa fa-clock\'></i> ' . __('ETA')">
@slot('append')
z
@endslot
Expand Down

0 comments on commit b08b040

Please sign in to comment.