mirror of
https://github.com/grocy/grocy.git
synced 2026-10-17 13:19:19 +02:00
Update shopping list total value when removing an item (fixes #2944)
This commit is contained in:
parent
4732f4a186
commit
7687b12cdd
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
- Fixed that the shopping list setting (top right corner settings menu) "Round up quantity amounts to the nearest whole number" wasn't applied to shopping list item amounts where a quantity unit conversion was involved
|
||||
- Fixed that printing the shopping list with "Group by product group" enabled created duplicated product group headlines in some cases
|
||||
- Fixed that the total value at the top of the shopping list page wasn't updated after removing a shopping list item
|
||||
|
||||
### Recipes
|
||||
|
||||
|
|
|
|||
|
|
@ -5907,7 +5907,8 @@
|
|||
"recipes_pos_resolved",
|
||||
"battery_charge_cycles",
|
||||
"product_barcodes_view",
|
||||
"permission_hierarchy"
|
||||
"permission_hierarchy",
|
||||
"uihelper_shopping_list"
|
||||
]
|
||||
},
|
||||
"ExposedEntityNoListing": {
|
||||
|
|
@ -5930,7 +5931,8 @@
|
|||
"recipes_pos_resolved",
|
||||
"battery_charge_cycles",
|
||||
"product_barcodes_view",
|
||||
"permission_hierarchy"
|
||||
"permission_hierarchy",
|
||||
"uihelper_shopping_list"
|
||||
]
|
||||
},
|
||||
"ExposedEntityNoDelete": {
|
||||
|
|
@ -5946,7 +5948,8 @@
|
|||
"recipes_pos_resolved",
|
||||
"battery_charge_cycles",
|
||||
"product_barcodes_view",
|
||||
"permission_hierarchy"
|
||||
"permission_hierarchy",
|
||||
"uihelper_shopping_list"
|
||||
]
|
||||
},
|
||||
"ExposedEntityEditRequiresAdmin": {
|
||||
|
|
|
|||
|
|
@ -371,6 +371,18 @@ function OnListItemRemoved()
|
|||
{
|
||||
$("#add-all-items-to-stock-button").addClass("disabled");
|
||||
}
|
||||
|
||||
Grocy.Api.Get("objects/uihelper_shopping_list?" + "?query[]=shopping_list_id=" + $("#selected-shopping-list").val(),
|
||||
function (items)
|
||||
{
|
||||
$("#total-value").text(items.reduce((x, { last_price_total }) => x + last_price_total, 0));
|
||||
RefreshLocaleNumberDisplay();
|
||||
},
|
||||
function (xhr)
|
||||
{
|
||||
console.error(xhr);
|
||||
}
|
||||
);
|
||||
}
|
||||
OnListItemRemoved();
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,8 @@
|
|||
</h2>
|
||||
@if(GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING)
|
||||
<h2 class="mb-0 mr-auto order-3 order-md-1 width-xs-sm-100">
|
||||
<span class="text-muted small">{!! $__t('%s total value', '<span class="locale-number locale-number-currency">' . SumArrayValue($listItems, 'last_price_total') . '</span>') !!}</span>
|
||||
<span class="text-muted small">{!! $__t('%s total value', '<span id="total-value"
|
||||
class="locale-number locale-number-currency"></span>') !!}</span>
|
||||
</h2>
|
||||
@endif
|
||||
<div class="float-right @if($embedded) pr-5 @endif">
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user