mirror of
https://github.com/grocy/grocy.git
synced 2025-04-29 17:45:39 +00:00
Remove items from shopping list without reloading the whole page
This commit is contained in:
parent
324487d395
commit
b7f0b06684
@ -23,10 +23,15 @@ $("#search").on("keyup", function()
|
|||||||
|
|
||||||
$(document).on('click', '.shoppinglist-delete-button', function (e)
|
$(document).on('click', '.shoppinglist-delete-button', function (e)
|
||||||
{
|
{
|
||||||
Grocy.Api.Get('delete-object/shopping_list/' + $(e.currentTarget).attr('data-shoppinglist-id'),
|
var shoppingListItemId = $(e.currentTarget).attr('data-shoppinglist-id');
|
||||||
|
|
||||||
|
Grocy.Api.Get('delete-object/shopping_list/' + shoppingListItemId,
|
||||||
function(result)
|
function(result)
|
||||||
{
|
{
|
||||||
window.location.href = U('/shoppinglist');
|
$('#shoppinglistitem-' + shoppingListItemId + '-row').fadeOut(500, function()
|
||||||
|
{
|
||||||
|
$(this).remove();
|
||||||
|
});
|
||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@foreach($listItems as $listItem)
|
@foreach($listItems as $listItem)
|
||||||
<tr class="@if(FindObjectInArrayByPropertyValue($missingProducts, 'id', $listItem->product_id) !== null) table-info @endif">
|
<tr id="shoppinglistitem-{{ $listItem->id }}-row" class="@if(FindObjectInArrayByPropertyValue($missingProducts, 'id', $listItem->product_id) !== null) table-info @endif">
|
||||||
<td class="fit-content">
|
<td class="fit-content">
|
||||||
<a class="btn btn-sm btn-info" href="{{ $U('/shoppinglistitem/') }}{{ $listItem->id }}">
|
<a class="btn btn-sm btn-info" href="{{ $U('/shoppinglistitem/') }}{{ $listItem->id }}">
|
||||||
<i class="fas fa-edit"></i>
|
<i class="fas fa-edit"></i>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user