Added an option to filter for only undone items on the shopping list (closes #452)

This commit is contained in:
Bernd Bestel 2020-01-24 22:26:36 +01:00
parent ad54253d72
commit 3cbeea7d95
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300
4 changed files with 21 additions and 1 deletions

View File

@ -20,6 +20,7 @@
### Shopping list improvements/fixes
- Added a compact view to have better shopping list for shopping trips (new button "Compact view" in the header, additionally this is automatically enabled on mobile devices / when screen width is < 768 px)
- It's now possible to filter for only undone (not striked through) items (new option in the "Filter by status" dropdown)
- Fixed that when `FEATURE_FLAG_SHOPPINGLIST_MULTIPLE_LISTS` was set to `false`, the shopping list appeared empty after some actions
### Recipe improvements

View File

@ -1648,3 +1648,6 @@ msgstr ""
msgid "Normal view"
msgstr ""
msgid "Only undone items"
msgstr ""

View File

@ -282,6 +282,20 @@ $(document).on('click', '.order-listitem-button', function(e)
console.error(xhr);
}
);
var statusInfoCell = $("#shoppinglistitem-" + listItemId + "-status-info");
if (done == 1)
{
statusInfoCell.text(statusInfoCell.text().replace("xxUNDONExx", ""));
}
else
{
statusInfoCell.text(statusInfoCell.text() + " xxUNDONExx");
}
shoppingListTable.rows().invalidate().draw(false);
$("#status-filter").trigger("change");
});
function OnListItemRemoved()

View File

@ -83,6 +83,7 @@
<select class="form-control" id="status-filter">
<option class="bg-white" value="all">{{ $__t('All') }}</option>
<option class="bg-info" value="belowminstockamount">{{ $__t('Below min. stock amount') }}</option>
<option class="bg-white" value="xxUNDONExx">{{ $__t('Only undone items') }}</option>
</select>
</div>
</div>
@ -135,8 +136,9 @@
<td class="d-none">
@if(!empty(FindObjectInArrayByPropertyValue($products, 'id', $listItem->product_id)->product_group_id)) {{ FindObjectInArrayByPropertyValue($productGroups, 'id', FindObjectInArrayByPropertyValue($products, 'id', $listItem->product_id)->product_group_id)->name }} @else <span class="font-italic font-weight-light">{{ $__t('Ungrouped') }}</span> @endif
</td>
<td class="d-none">
<td id="shoppinglistitem-{{ $listItem->id }}-status-info" class="d-none">
@if(FindObjectInArrayByPropertyValue($missingProducts, 'id', $listItem->product_id) !== null) belowminstockamount @endif
@if($listItem->done != 1) xxUNDONExx @endif
</td>
@include('components.userfields_tbody', array(