Fix flight field bugs

This commit is contained in:
Nabeel Shahzad
2018-03-23 15:02:26 -05:00
parent f8f5a71564
commit eb64f268d3
5 changed files with 41 additions and 18 deletions

View File

@@ -100,7 +100,7 @@
</body>
<script defer src="https://use.fontawesome.com/releases/v5.0.6/js/all.js"></script>
<script src="https://cdn.jsdelivr.net/npm/pjax@0.2.5/pjax.js"></script>
{{--<script src="https://cdn.jsdelivr.net/npm/pjax@0.2.5/pjax.js"></script>--}}
<script src="{{ public_asset('/assets/admin/js/vendor.js') }}"></script>
<script src="{{ public_asset('/assets/system/js/phpvms.js') }}"></script>

View File

@@ -9,8 +9,21 @@
</thead>
@endif
<tbody>
@foreach($flight_fields as $field)
@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;
}
$shown[] = $field->name;
$val_field = $flight->field_values->where('name', $field->name)->first();
@endphp
<tr>

View File

@@ -63,12 +63,16 @@ $(document).ready(function () {
setEditable();
setFieldsEditable();
/*const pjax = new Pjax({
elements: 'form[action]',
selectors: ['.pjax_subfleet_form'],
switches: {
'#subfleet_flight_wrapper': Pjax.switches.replaceNode
}
/*new Pjax({
elements: 'form[action].pjax_subfleet_form',
selectors: ['div#subfleet_flight_wrapper'],
history: false,
});
new Pjax({
elements: 'form[action].pjax_flight_fields',
selectors: ['div#flight_fields_wrapper'],
history: false
});*/
$(document).on('submit', 'form.pjax_flight_fields', function (event) {