Fix aircraft active/inactive states
This commit is contained in:
parent
8931f4e271
commit
3748ab77d2
@ -55,8 +55,11 @@ class AircraftController extends BaseController
|
||||
*/
|
||||
public function store(CreateAircraftRequest $request)
|
||||
{
|
||||
$input = $request->all();
|
||||
$aircraft = $this->aircraftRepository->create($input);
|
||||
$attrs = $request->all();
|
||||
|
||||
$attrs['active'] = get_truth_state($attrs['active']);
|
||||
|
||||
$aircraft = $this->aircraftRepository->create($attrs);
|
||||
|
||||
Flash::success('Aircraft saved successfully.');
|
||||
return redirect(route('admin.aircraft.edit', ['id' => $aircraft->id]));
|
||||
@ -110,7 +113,10 @@ class AircraftController extends BaseController
|
||||
return redirect(route('admin.aircraft.index'));
|
||||
}
|
||||
|
||||
$this->aircraftRepository->update($request->all(), $id);
|
||||
$attrs = $request->all();
|
||||
$attrs['active'] = get_truth_state($attrs['active']);
|
||||
|
||||
$this->aircraftRepository->update($attrs, $id);
|
||||
|
||||
Flash::success('Aircraft updated successfully.');
|
||||
return redirect(route('admin.aircraft.index'));
|
||||
|
@ -38,8 +38,8 @@
|
||||
{!! Form::label('active', 'Active:') !!}
|
||||
<br />
|
||||
<label class="checkbox-inline">
|
||||
{!! Form::hidden('active', 0, false) !!}
|
||||
{!! Form::checkbox('active', 1, null) !!}
|
||||
{!! Form::hidden('active', 0) !!}
|
||||
{!! Form::checkbox('active') !!}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -27,7 +27,7 @@
|
||||
{!! Utils::minutesToTimeString($ac->flight_hours) !!}
|
||||
</td>
|
||||
<td style="text-align: center;">
|
||||
@if($ac->active === GenericState::ACTIVE)
|
||||
@if($ac->active == GenericState::ACTIVE)
|
||||
<span class="label label-success">{!! GenericState::label($ac->active); !!}</span>
|
||||
@else
|
||||
<span class="label label-default">Inactive</span>
|
||||
|
Loading…
Reference in New Issue
Block a user