#41 inline editing of fuel prices

This commit is contained in:
Nabeel Shahzad
2017-07-05 18:48:32 -05:00
parent d44d374218
commit 10baaab646
10 changed files with 156 additions and 58 deletions

View File

@@ -20,4 +20,4 @@
</div>
</div>
@endsection
@include('admin.airports.script')

View File

@@ -0,0 +1,21 @@
@section('scripts')
<script>
$(document).ready(function() {
$('#airports-table a.inline').editable({
type: 'text',
mode: 'inline',
emptytext: '0',
url: '/admin/airports/fuel',
title: 'Enter price per unit of fuel',
ajaxOptions: {'type': 'put'},
params: function(params) {
return {
id: params.pk,
name: params.name,
value: params.value
}
}
});
});
</script>
@endsection

View File

@@ -1,26 +1,40 @@
<table class="table table-responsive" id="airports-table">
<thead>
<th>ICAO</th>
<th>Name</th>
<th>Location</th>
<th colspan="3">Action</th>
</thead>
<tbody>
@foreach($airports as $airport)
<tr>
<td>{!! $airport->icao !!}</td>
<td>{!! $airport->name !!}</td>
<td>{!! $airport->location !!} ({!! $airport->lat !!}x{!! $airport->lon !!})</td>
<td>
{!! Form::open(['route' => ['admin.airports.destroy', $airport->id], 'method' => 'delete']) !!}
<div class='btn-group'>
<a href="{!! route('admin.airports.show', [$airport->id]) !!}" class='btn btn-default btn-xs'><i class="glyphicon glyphicon-eye-open"></i></a>
<a href="{!! route('admin.airports.edit', [$airport->id]) !!}" class='btn btn-default btn-xs'><i class="glyphicon glyphicon-edit"></i></a>
{!! Form::button('<i class="glyphicon glyphicon-trash"></i>', ['type' => 'submit', 'class' => 'btn btn-danger btn-xs', 'onclick' => "return confirm('Are you sure?')"]) !!}
</div>
{!! Form::close() !!}
</td>
</tr>
@endforeach
</tbody>
</table>
<div id="airports_table_wrapper">
<table class="table table-responsive" id="airports-table">
<thead>
<th>ICAO</th>
<th>Name</th>
<th>Location</th>
<th style="text-align: center;">100LL</th>
<th style="text-align: center;">JetA</th>
<th style="text-align: center;">MOGAS</th>
<th colspan="3">Action</th>
</thead>
<tbody>
@foreach($airports as $airport)
<tr>
<td>{!! $airport->icao !!}</td>
<td>{!! $airport->name !!}</td>
<td>{!! $airport->location !!}</td>
<td style="text-align: center;">
<a class="inline" href="#" data-pk="{!! $airport->id !!}" data-name="fuel_100ll_cost">{!! $airport->fuel_100ll_cost !!}</a>
</td>
<td style="text-align: center;">
<a class="inline" href="#" data-pk="{!! $airport->id !!}" data-name="fuel_jeta_cost">{!! $airport->fuel_jeta_cost !!}</a>
</td>
<td style="text-align: center;">
<a class="inline" href="#" data-pk="{!! $airport->id !!}" data-name="fuel_mogas_cost">{!! $airport->fuel_mogas_cost !!}</a>
</td>
<td>
{!! Form::open(['route' => ['admin.airports.destroy', $airport->id], 'method' => 'delete']) !!}
<div class='btn-group'>
<a href="{!! route('admin.airports.show', [$airport->id]) !!}" class='btn btn-default btn-xs'><i class="glyphicon glyphicon-eye-open"></i></a>
<a href="{!! route('admin.airports.edit', [$airport->id]) !!}" class='btn btn-default btn-xs'><i class="glyphicon glyphicon-edit"></i></a>
{!! Form::button('<i class="glyphicon glyphicon-trash"></i>', ['type' => 'submit', 'class' => 'btn btn-danger btn-xs', 'onclick' => "return confirm('Are you sure?')"]) !!}
</div>
{!! Form::close() !!}
</td>
</tr>
@endforeach
</tbody>
</table>
</div>