Properly sort recipes fulfillment column (closes #113)

This commit is contained in:
Bernd Bestel
2018-11-24 19:59:24 +01:00
parent a3617cffb8
commit 367a3e52de
2 changed files with 7 additions and 0 deletions

View File

@@ -1,6 +1,9 @@
var recipesTables = $('#recipes-table').DataTable({ var recipesTables = $('#recipes-table').DataTable({
'paginate': false, 'paginate': false,
'order': [[0, 'asc']], 'order': [[0, 'asc']],
'columnDefs': [
{ 'orderData': 2, 'targets': 1 }
],
'language': JSON.parse(L('datatables_localization')), 'language': JSON.parse(L('datatables_localization')),
'scrollY': false, 'scrollY': false,
'colReorder': true, 'colReorder': true,

View File

@@ -23,6 +23,7 @@
<tr> <tr>
<th>{{ $L('Name') }}</th> <th>{{ $L('Name') }}</th>
<th>{{ $L('Requirements fulfilled') }}</th> <th>{{ $L('Requirements fulfilled') }}</th>
<th class="d-none">Hidden status for sorting of "Requirements fulfilled" column</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@@ -35,6 +36,9 @@
@if(FindObjectInArrayByPropertyValue($recipesSumFulfillment, 'recipe_id', $recipe->id)->need_fulfilled == 1)<i class="fas fa-check text-success"></i>@elseif(FindObjectInArrayByPropertyValue($recipesSumFulfillment, 'recipe_id', $recipe->id)->need_fulfilled_with_shopping_list == 1)<i class="fas fa-exclamation text-warning"></i>@else<i class="fas fa-times text-danger"></i>@endif @if(FindObjectInArrayByPropertyValue($recipesSumFulfillment, 'recipe_id', $recipe->id)->need_fulfilled == 1)<i class="fas fa-check text-success"></i>@elseif(FindObjectInArrayByPropertyValue($recipesSumFulfillment, 'recipe_id', $recipe->id)->need_fulfilled_with_shopping_list == 1)<i class="fas fa-exclamation text-warning"></i>@else<i class="fas fa-times text-danger"></i>@endif
<span class="timeago-contextual">@if(FindObjectInArrayByPropertyValue($recipesSumFulfillment, 'recipe_id', $recipe->id)->need_fulfilled == 1){{ $L('Enough in stock') }}@elseif(FindObjectInArrayByPropertyValue($recipesSumFulfillment, 'recipe_id', $recipe->id)->need_fulfilled_with_shopping_list == 1){{ $L('Not enough in stock, #1 ingredients missing but already on the shopping list', FindObjectInArrayByPropertyValue($recipesSumFulfillment, 'recipe_id', $recipe->id)->missing_products_count) }}@else{{ $L('Not enough in stock, #1 ingredients missing', FindObjectInArrayByPropertyValue($recipesSumFulfillment, 'recipe_id', $recipe->id)->missing_products_count) }}@endif</span> <span class="timeago-contextual">@if(FindObjectInArrayByPropertyValue($recipesSumFulfillment, 'recipe_id', $recipe->id)->need_fulfilled == 1){{ $L('Enough in stock') }}@elseif(FindObjectInArrayByPropertyValue($recipesSumFulfillment, 'recipe_id', $recipe->id)->need_fulfilled_with_shopping_list == 1){{ $L('Not enough in stock, #1 ingredients missing but already on the shopping list', FindObjectInArrayByPropertyValue($recipesSumFulfillment, 'recipe_id', $recipe->id)->missing_products_count) }}@else{{ $L('Not enough in stock, #1 ingredients missing', FindObjectInArrayByPropertyValue($recipesSumFulfillment, 'recipe_id', $recipe->id)->missing_products_count) }}@endif</span>
</td> </td>
<td class="d-none">
@if(FindObjectInArrayByPropertyValue($recipesSumFulfillment, 'recipe_id', $recipe->id)->need_fulfilled == 1) 1 @elseif(FindObjectInArrayByPropertyValue($recipesSumFulfillment, 'recipe_id', $recipe->id)->need_fulfilled_with_shopping_list == 1) 2 @else 3 @endif
</td>
</tr> </tr>
@endforeach @endforeach
</tbody> </tbody>