mirror of
https://github.com/grocy/grocy.git
synced 2025-04-29 09:39:57 +00:00
Added a "Clear done items" button to the shopping list (closes #1999)
This commit is contained in:
parent
605ceb1b19
commit
6affa01f81
@ -12,7 +12,7 @@
|
||||
|
||||
### Shopping list
|
||||
|
||||
- xxx
|
||||
- Added a new button "Clear done items" (to clear all done items with one click)
|
||||
|
||||
### Recipes
|
||||
|
||||
|
@ -2338,3 +2338,6 @@ msgstr ""
|
||||
|
||||
msgid "Decimal places allowed for prices (display)"
|
||||
msgstr ""
|
||||
|
||||
msgid "Clear done items"
|
||||
msgstr ""
|
||||
|
@ -236,6 +236,20 @@ $(document).on('click', '#clear-shopping-list', function(e)
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on("click", "#clear-done-items", function(e)
|
||||
{
|
||||
Grocy.Api.Post('stock/shoppinglist/clear', { "list_id": $("#selected-shopping-list").val(), "done_only": true },
|
||||
function(result)
|
||||
{
|
||||
window.location.reload();
|
||||
},
|
||||
function(xhr)
|
||||
{
|
||||
console.error(xhr);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
$(document).on('click', '.shopping-list-stock-add-workflow-list-item-button', function(e)
|
||||
{
|
||||
e.preventDefault();
|
||||
|
@ -92,11 +92,18 @@
|
||||
href="{{ $U('/shoppinglistitem/new?embedded&list=' . $selectedShoppingListId) }}">
|
||||
{{ $__t('Add item') }}
|
||||
</a>
|
||||
<a id="clear-shopping-list"
|
||||
class="btn btn-outline-danger btn-sm mb-1 responsive-button @if($listItems->count() == 0) disabled @endif"
|
||||
href="#">
|
||||
{{ $__t('Clear list') }}
|
||||
</a>
|
||||
<div class="btn-group">
|
||||
<a id="clear-shopping-list"
|
||||
class="btn btn-outline-danger btn-sm mb-1 responsive-button @if($listItems->count() == 0) disabled @endif"
|
||||
href="#">
|
||||
{{ $__t('Clear list') }}
|
||||
</a>
|
||||
<a id="clear-done-items"
|
||||
class="btn btn-outline-danger btn-sm mb-1 responsive-button @if($listItems->count() == 0) disabled @endif"
|
||||
href="#">
|
||||
{{ $__t('Clear done items') }}
|
||||
</a>
|
||||
</div>
|
||||
<a id="add-all-items-to-stock-button"
|
||||
class="btn btn-outline-primary btn-sm mb-1 responsive-button @if(!GROCY_FEATURE_FLAG_STOCK) d-none @endif"
|
||||
href="#">
|
||||
|
Loading…
x
Reference in New Issue
Block a user