mirror of
https://github.com/grocy/grocy.git
synced 2026-03-27 23:29:25 +01:00
Show the number of items per shopping list in the shopping lists dropdown (closes #2467)
This commit is contained in:
parent
c7abed0d68
commit
40d1a9c3d0
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
### Shopping list
|
||||
|
||||
- xxx
|
||||
- The shopping lists dropdown on the shopping list page now also shows the number of items on the corresponding shopping list
|
||||
|
||||
### Recipes
|
||||
|
||||
|
|
|
|||
|
|
@ -397,7 +397,7 @@ class StockController extends BaseController
|
|||
'products' => $this->getDatabase()->products()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
||||
'quantityunits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
|
||||
'missingProducts' => $this->getStockService()->GetMissingProducts(),
|
||||
'shoppingLists' => $this->getDatabase()->shopping_lists()->orderBy('name', 'COLLATE NOCASE'),
|
||||
'shoppingLists' => $this->getDatabase()->shopping_lists_view()->orderBy('name', 'COLLATE NOCASE'),
|
||||
'selectedShoppingListId' => $listId,
|
||||
'quantityUnitConversionsResolved' => $this->getDatabase()->cache__quantity_unit_conversions_resolved(),
|
||||
'productUserfields' => $this->getUserfieldsService()->GetFields('products'),
|
||||
|
|
|
|||
6
migrations/0235.sql
Normal file
6
migrations/0235.sql
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
CREATE VIEW shopping_lists_view
|
||||
AS
|
||||
SELECT
|
||||
*,
|
||||
(SELECT IFNULL(COUNT(*), 0) FROM shopping_list WHERE shopping_list_id = sl.id) AS item_count
|
||||
FROM shopping_lists sl;
|
||||
|
|
@ -45,7 +45,7 @@
|
|||
<select class="custom-control custom-select custom-select-sm"
|
||||
id="selected-shopping-list">
|
||||
@foreach($shoppingLists as $shoppingList)
|
||||
<option @if($shoppingList->id == $selectedShoppingListId) selected="selected" @endif value="{{ $shoppingList->id }}">{{ $shoppingList->name }}</option>
|
||||
<option @if($shoppingList->id == $selectedShoppingListId) selected="selected" @endif value="{{ $shoppingList->id }}">{{ $shoppingList->name }} ({{ $shoppingList->item_count }})</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user