2017-07-12 06:44:12 +08:00
|
|
|
<div id="flight_fields_wrapper">
|
2020-02-02 02:05:56 +08:00
|
|
|
<h3>custom fields</h3><br/>
|
|
|
|
<table class="table table-responsive" id="flight-fields-table">
|
|
|
|
@if(count($flight->field_values))
|
|
|
|
<thead>
|
|
|
|
<th>Name</th>
|
|
|
|
<th>Value</th>
|
|
|
|
<th></th>
|
|
|
|
</thead>
|
|
|
|
@endif
|
|
|
|
<tbody>
|
|
|
|
@php
|
|
|
|
#
|
|
|
|
# A little nasty having logic like this in a template, but we need
|
|
|
|
# to filter out the field values that have already been shown, since
|
|
|
|
# they were values set because they had a FlightField parent
|
|
|
|
#
|
|
|
|
$shown = [];
|
|
|
|
@endphp
|
|
|
|
@foreach($flight_fields->concat($flight->field_values) as $field)
|
|
|
|
@php
|
|
|
|
if(in_array($field->name, $shown, true)) {
|
|
|
|
continue;
|
|
|
|
}
|
2018-03-24 04:02:26 +08:00
|
|
|
|
2020-02-02 02:05:56 +08:00
|
|
|
$shown[] = $field->name;
|
|
|
|
$val_field = $flight->field_values->where('name', $field->name)->first();
|
|
|
|
@endphp
|
|
|
|
<tr>
|
|
|
|
<td>{{ $field->name }}</td>
|
|
|
|
<td>
|
|
|
|
<a class="inline" href="#" data-pk="{{ $val_field['id'] ?? '' }}" data-name="{{ $field->name }}">
|
|
|
|
{{ $val_field['value'] ?? '' }}
|
|
|
|
</a>
|
|
|
|
</td>
|
|
|
|
<td style="width: 10%; text-align: center;" class="form-inline">
|
|
|
|
{{ Form::open(['url' => '/admin/flights/'.$flight->id.'/fields',
|
|
|
|
'method' => 'delete',
|
|
|
|
'class' => 'pjax_form pjax_flight_fields'
|
|
|
|
]) }}
|
|
|
|
{{ Form::hidden('field_id', $val_field['id'] ?? null) }}
|
|
|
|
<div class='btn-group'>
|
|
|
|
{{ Form::button('<i class="fa fa-times"></i>',
|
|
|
|
['type' => 'submit', 'class' => 'btn btn-sm btn-danger btn-icon',
|
|
|
|
'onclick' => "return confirm('Are you sure?')"]) }}
|
|
|
|
</div>
|
|
|
|
{{ Form::close() }}
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
@endforeach
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
<hr/>
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-12">
|
|
|
|
<div class="text-right">
|
|
|
|
{{ Form::open([
|
|
|
|
'url' => '/admin/flights/'.$flight->id.'/fields',
|
|
|
|
'method' => 'post',
|
|
|
|
'class' => 'pjax_form form-inline pjax_flight_fields'
|
|
|
|
])
|
|
|
|
}}
|
2017-07-12 06:44:12 +08:00
|
|
|
|
2020-02-02 02:05:56 +08:00
|
|
|
{{ Form::label('name', 'Name:') }}
|
|
|
|
{{ Form::text('name', null, ['class' => 'form-control']) }}
|
|
|
|
|
|
|
|
{{ Form::label('value', 'Value:') }}
|
|
|
|
{{ Form::text('value', null, ['class' => 'form-control']) }}
|
|
|
|
|
|
|
|
{{ Form::button('<i class="glyphicon glyphicon-plus"></i> add',
|
|
|
|
['type' => 'submit',
|
|
|
|
'class' => 'btn btn-success btn-s']) }}
|
|
|
|
<p class="text-danger">{{ $errors->first('name') }}</p>
|
|
|
|
<p class="text-danger">{{ $errors->first('value') }}</p>
|
|
|
|
{{ Form::close() }}
|
|
|
|
</div>
|
2017-07-12 06:44:12 +08:00
|
|
|
</div>
|
2020-02-02 02:05:56 +08:00
|
|
|
</div>
|
2017-07-12 06:44:12 +08:00
|
|
|
</div>
|