Embedded popup for product group add/edit

This commit is contained in:
Kurt Riddlesperger 2020-05-05 17:11:05 -05:00
parent 9b388247da
commit eb9f569080
3 changed files with 13 additions and 4 deletions

View File

@ -13,7 +13,7 @@
Grocy.EditObjectId = result.created_object_id;
Grocy.Components.UserfieldsForm.Save(function()
{
window.location.href = U('/productgroups');
window.parent.postMessage(WindowMessageBag("CloseAllModals"), U("/productgroups"));
});
},
function(xhr)
@ -30,7 +30,7 @@
{
Grocy.Components.UserfieldsForm.Save(function()
{
window.location.href = U('/productgroups');
window.parent.postMessage(WindowMessageBag("CloseAllModals"), U("/productgroups"));
});
},
function(xhr)

View File

@ -55,3 +55,12 @@ $(document).on('click', '.product-group-delete-button', function(e)
}
});
});
$(window).on("message", function(e)
{
var data = e.originalEvent.data;
if (data.Message === "CloseAllModals")
{
window.location.reload();
}
});

View File

@ -20,7 +20,7 @@
<hr>
<div class="row mt-3">
<div class="col-xs-12 col-md-2 col-xl-1">
<a class="btn btn-primary btn-sm responsive-button w-100 mb-3" href="{{ $U('/productgroup/new') }}">
<a class="btn btn-primary btn-sm responsive-button w-100 mb-3 show-as-dialog-link" href="{{ $U('/productgroup/new?embedded') }}">
{{ $__t('Add') }}
</a>
</div>
@ -55,7 +55,7 @@
@foreach($productGroups as $productGroup)
<tr>
<td class="fit-content border-right">
<a class="btn btn-info btn-sm" href="{{ $U('/productgroup/') }}{{ $productGroup->id }}">
<a class="btn btn-info btn-sm show-as-dialog-link" href="{{ $U('/productgroup/') }}{{ $productGroup->id }}?embedded">
<i class="fas fa-edit"></i>
</a>
<a class="btn btn-danger btn-sm product-group-delete-button" href="#" data-group-id="{{ $productGroup->id }}" data-group-name="{{ $productGroup->name }}">