mirror of
https://github.com/grocy/grocy.git
synced 2025-04-29 09:39:57 +00:00
Show stock userfields on the stock entry edit form
This commit is contained in:
parent
4da546fc80
commit
76d6342156
@ -462,7 +462,8 @@ class StockController extends BaseController
|
||||
'stockEntry' => $this->getDatabase()->stock()->where('id', $args['entryId'])->fetch(),
|
||||
'products' => $this->getDatabase()->products()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
||||
'shoppinglocations' => $this->getDatabase()->shopping_locations()->orderBy('name', 'COLLATE NOCASE'),
|
||||
'locations' => $this->getDatabase()->locations()->orderBy('name', 'COLLATE NOCASE')
|
||||
'locations' => $this->getDatabase()->locations()->orderBy('name', 'COLLATE NOCASE'),
|
||||
'userfields' => $this->getUserfieldsService()->GetFields('stock')
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -41,15 +41,18 @@
|
||||
|
||||
jsonData.open = $("#open").is(":checked");
|
||||
|
||||
Grocy.Api.Put("stock/entry/" + Grocy.EditObjectId, jsonData,
|
||||
Grocy.Api.Put("stock/entry/" + Grocy.EditObjectRowId, jsonData,
|
||||
function(result)
|
||||
{
|
||||
var successMessage = __t('Stock entry successfully updated') + '<br><a class="btn btn-secondary btn-sm mt-2" href="#" onclick="UndoStockBookingEntry(\'' + result.id + '\',\'' + Grocy.EditObjectId + '\')"><i class="fa-solid fa-undo"></i> ' + __t("Undo") + '</a>';
|
||||
Grocy.Components.UserfieldsForm.Save(function()
|
||||
{
|
||||
var successMessage = __t('Stock entry successfully updated') + '<br><a class="btn btn-secondary btn-sm mt-2" href="#" onclick="UndoStockBookingEntry(\'' + result.id + '\',\'' + Grocy.EditObjectRowId + '\')"><i class="fa-solid fa-undo"></i> ' + __t("Undo") + '</a>';
|
||||
|
||||
window.parent.postMessage(WindowMessageBag("StockEntryChanged", Grocy.EditObjectId), Grocy.BaseUrl);
|
||||
window.parent.postMessage(WindowMessageBag("ShowSuccessMessage", successMessage), Grocy.BaseUrl);
|
||||
window.parent.postMessage(WindowMessageBag("Ready"), Grocy.BaseUrl);
|
||||
window.parent.postMessage(WindowMessageBag("CloseAllModals"), Grocy.BaseUrl);
|
||||
window.parent.postMessage(WindowMessageBag("StockEntryChanged", Grocy.EditObjectRowId), Grocy.BaseUrl);
|
||||
window.parent.postMessage(WindowMessageBag("ShowSuccessMessage", successMessage), Grocy.BaseUrl);
|
||||
window.parent.postMessage(WindowMessageBag("Ready"), Grocy.BaseUrl);
|
||||
window.parent.postMessage(WindowMessageBag("CloseAllModals"), Grocy.BaseUrl);
|
||||
});
|
||||
},
|
||||
function(xhr)
|
||||
{
|
||||
@ -118,5 +121,7 @@ $("#amount").on("focus", function(e)
|
||||
{
|
||||
$(this).select();
|
||||
});
|
||||
|
||||
Grocy.Components.UserfieldsForm.Load();
|
||||
$("#amount").focus();
|
||||
Grocy.FrontendHelpers.ValidateForm("stockentry-form");
|
||||
|
@ -5,7 +5,8 @@
|
||||
|
||||
@section('content')
|
||||
<script>
|
||||
Grocy.EditObjectId = {{ $stockEntry->id }};
|
||||
Grocy.EditObjectId = "{{ $stockEntry->stock_id }}";
|
||||
Grocy.EditObjectRowId = {{ $stockEntry->id }};
|
||||
Grocy.EditObjectProductId = {{ $stockEntry->product_id }};
|
||||
</script>
|
||||
|
||||
@ -140,6 +141,11 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@include('components.userfieldsform', array(
|
||||
'userfields' => $userfields,
|
||||
'entity' => 'stock'
|
||||
))
|
||||
|
||||
<button id="save-stockentry-button"
|
||||
class="btn btn-success">{{ $__t('OK') }}</button>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user