diff --git a/controllers/StockController.php b/controllers/StockController.php
index 788d7ae4..6a33a803 100644
--- a/controllers/StockController.php
+++ b/controllers/StockController.php
@@ -38,16 +38,16 @@ class StockController extends BaseController
]);
}
- public function Detail(\Slim\Http\Request $request, \Slim\Http\Response $response, array $args)
+ public function Stockentries(\Slim\Http\Request $request, \Slim\Http\Response $response, array $args)
{
$usersService = new UsersService();
$nextXDays = $usersService->GetUserSettings(GROCY_USER_ID)['stock_expring_soon_days'];
- return $this->AppContainer->view->render($response, 'stockdetail', [
+ return $this->AppContainer->view->render($response, 'stockentries', [
'products' => $this->Database->products()->orderBy('name'),
'quantityunits' => $this->Database->quantity_units()->orderBy('name'),
'locations' => $this->Database->locations()->orderBy('name'),
- 'currentStockDetail' => $this->Database->stock()->orderBy('product_id'),
+ 'stockEntries' => $this->Database->stock()->orderBy('product_id'),
'currentStockLocations' => $this->StockService->GetCurrentStockLocations(),
'nextXDays' => $nextXDays,
'userfields' => $this->UserfieldsService->GetFields('products'),
@@ -89,9 +89,9 @@ class StockController extends BaseController
]);
}
- public function StockEdit(\Slim\Http\Request $request, \Slim\Http\Response $response, array $args)
+ public function StockEntryEditForm(\Slim\Http\Request $request, \Slim\Http\Response $response, array $args)
{
- return $this->AppContainer->view->render($response, 'stockedit', [
+ return $this->AppContainer->view->render($response, 'stockentryform', [
'stockEntry' => $this->Database->stock()->where('id', $args['entryId'])->fetch(),
'products' => $this->Database->products()->orderBy('name'),
'locations' => $this->Database->locations()->orderBy('name')
diff --git a/public/viewjs/stockdetail.js b/public/viewjs/stockentries.js
similarity index 94%
rename from public/viewjs/stockdetail.js
rename to public/viewjs/stockentries.js
index 8494758f..98fcd168 100644
--- a/public/viewjs/stockdetail.js
+++ b/public/viewjs/stockentries.js
@@ -1,11 +1,11 @@
-var stockDetailTable = $('#stock-detail-table').DataTable({
+var stockEntriesTable = $('#stockentries-table').DataTable({
'order': [[2, 'asc']],
'columnDefs': [
{ 'orderable': false, 'targets': 0 },
{ 'searchable': false, "targets": 0 }
],
});
-$('#stock-detail-table tbody').removeClass("d-none");
+$('#stockentries-table tbody').removeClass("d-none");
$.fn.dataTable.ext.search.push(function(settings, data, dataIndex)
{
@@ -22,7 +22,7 @@ $.fn.dataTable.ext.search.push(function(settings, data, dataIndex)
Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
{
- stockDetailTable.draw();
+ stockEntriesTable.draw();
});
$(document).on('click', '.stock-consume-button', function(e)
@@ -56,7 +56,7 @@ $(document).on('click', '.stock-consume-button', function(e)
}
Grocy.FrontendHelpers.EndUiBusy();
- RefreshStockDetailRow(stockRowId);
+ RefreshStockEntryRow(stockRowId);
toastr.success(toastMessage);
},
function(xhr)
@@ -97,7 +97,7 @@ $(document).on('click', '.product-open-button', function(e)
button.addClass("disabled");
Grocy.FrontendHelpers.EndUiBusy();
toastr.success(__t('Marked %1$s of %2$s as opened', 1 + " " + productQuName, productName) + '
' + __t("Undo") + '');
- RefreshStockDetailRow(stockRowId);
+ RefreshStockEntryRow(stockRowId);
},
function(xhr)
{
@@ -110,10 +110,10 @@ $(document).on('click', '.product-open-button', function(e)
$(document).on("click", ".stock-name-cell", function(e)
{
Grocy.Components.ProductCard.Refresh($(e.currentTarget).attr("data-stock-id"));
- $("#stockdetail-productcard-modal").modal("show");
+ $("#stockentry-productcard-modal").modal("show");
});
-function RefreshStockDetailRow(stockRowId)
+function RefreshStockEntryRow(stockRowId)
{
Grocy.Api.Get("stock/entry/" + stockRowId,
function(result)
@@ -233,9 +233,9 @@ $(window).on("message", function(e)
{
var data = e.originalEvent.data;
- if (data.Message === "StockDetailChanged")
+ if (data.Message === "StockEntryChanged")
{
- RefreshStockDetailRow(data.Payload);
+ RefreshStockEntryRow(data.Payload);
}
});
@@ -246,7 +246,7 @@ function UndoStockBookingEntry(bookingId, stockRowId)
Grocy.Api.Post('stock/bookings/' + bookingId.toString() + '/undo', { },
function(result)
{
- window.postMessage(WindowMessageBag("StockDetailChanged", stockRowId), Grocy.BaseUrl);
+ window.postMessage(WindowMessageBag("StockEntryChanged", stockRowId), Grocy.BaseUrl);
toastr.success(__t("Booking successfully undone"));
},
function(xhr)
diff --git a/public/viewjs/stockedit.js b/public/viewjs/stockentryform.js
similarity index 75%
rename from public/viewjs/stockedit.js
rename to public/viewjs/stockentryform.js
index e33e5bc8..0492ee31 100644
--- a/public/viewjs/stockedit.js
+++ b/public/viewjs/stockentryform.js
@@ -1,9 +1,9 @@
-$('#save-stockedit-button').on('click', function(e)
+$('#save-stockentry-button').on('click', function(e)
{
e.preventDefault();
- var jsonForm = $('#stockedit-form').serializeJSON();
- Grocy.FrontendHelpers.BeginUiBusy("stockedit-form");
+ var jsonForm = $('#stockentry-form').serializeJSON();
+ Grocy.FrontendHelpers.BeginUiBusy("stockentry-form");
if (!jsonForm.price.toString().isEmpty())
{
@@ -31,61 +31,61 @@
{
var successMessage = __t('Stock entry successfully updated') + '
' + __t("Undo") + '';
- window.parent.postMessage(WindowMessageBag("StockDetailChanged", Grocy.EditObjectId), Grocy.BaseUrl);
+ 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);
},
function(xhr)
{
- Grocy.FrontendHelpers.EndUiBusy("stockedit-form");
+ Grocy.FrontendHelpers.EndUiBusy("stockentry-form");
console.error(xhr);
}
);
});
-Grocy.FrontendHelpers.ValidateForm('stockedit-form');
+Grocy.FrontendHelpers.ValidateForm('stockentry-form');
-$('#stockedit-form input').keyup(function (event)
+$('#stockentry-form input').keyup(function (event)
{
- Grocy.FrontendHelpers.ValidateForm('stockedit-form');
+ Grocy.FrontendHelpers.ValidateForm('stockentry-form');
});
-$('#stockedit-form input').keydown(function(event)
+$('#stockentry-form input').keydown(function(event)
{
if (event.keyCode === 13) //Enter
{
event.preventDefault();
- if (document.getElementById('stockedit-form').checkValidity() === false) //There is at least one validation error
+ if (document.getElementById('stockentry-form').checkValidity() === false) //There is at least one validation error
{
return false;
}
else
{
- $('#save-stockedit-button').click();
+ $('#save-stockentry-button').click();
}
}
});
Grocy.Components.DateTimePicker.GetInputElement().on('change', function(e)
{
- Grocy.FrontendHelpers.ValidateForm('stockedit-form');
+ Grocy.FrontendHelpers.ValidateForm('stockentry-form');
});
Grocy.Components.DateTimePicker.GetInputElement().on('keypress', function(e)
{
- Grocy.FrontendHelpers.ValidateForm('stockedit-form');
+ Grocy.FrontendHelpers.ValidateForm('stockentry-form');
});
Grocy.Components.DateTimePicker2.GetInputElement().on('change', function(e)
{
- Grocy.FrontendHelpers.ValidateForm('stockedit-form');
+ Grocy.FrontendHelpers.ValidateForm('stockentry-form');
});
Grocy.Components.DateTimePicker2.GetInputElement().on('keypress', function(e)
{
- Grocy.FrontendHelpers.ValidateForm('stockedit-form');
+ Grocy.FrontendHelpers.ValidateForm('stockentry-form');
});
Grocy.Api.Get('stock/products/' + Grocy.EditObjectProductId,
@@ -129,4 +129,4 @@ $("#amount").on("focus", function(e)
$(this).select();
});
$("#amount").focus();
-Grocy.FrontendHelpers.ValidateForm("stockedit-form");
+Grocy.FrontendHelpers.ValidateForm("stockentry-form");
diff --git a/routes.php b/routes.php
index 490df37c..9a02f309 100644
--- a/routes.php
+++ b/routes.php
@@ -33,12 +33,12 @@ $app->group('', function()
if (GROCY_FEATURE_FLAG_STOCK)
{
$this->get('/stockoverview', '\Grocy\Controllers\StockController:Overview');
- $this->get('/stockdetail', '\Grocy\Controllers\StockController:Detail');
+ $this->get('/stockentries', '\Grocy\Controllers\StockController:Stockentries');
$this->get('/purchase', '\Grocy\Controllers\StockController:Purchase');
$this->get('/consume', '\Grocy\Controllers\StockController:Consume');
$this->get('/transfer', '\Grocy\Controllers\StockController:Transfer');
$this->get('/inventory', '\Grocy\Controllers\StockController:Inventory');
- $this->get('/stockedit/{entryId}', '\Grocy\Controllers\StockController:StockEdit');
+ $this->get('/stockentry/{entryId}', '\Grocy\Controllers\StockController:StockEntryEditForm');
$this->get('/products', '\Grocy\Controllers\StockController:ProductsList');
$this->get('/product/{productId}', '\Grocy\Controllers\StockController:ProductEditForm');
$this->get('/stocksettings', '\Grocy\Controllers\StockController:StockSettings');
diff --git a/views/stockdetail.blade.php b/views/stockdetail.blade.php
deleted file mode 100644
index cc42ef13..00000000
--- a/views/stockdetail.blade.php
+++ /dev/null
@@ -1,170 +0,0 @@
-@extends('layout.default')
-
-@section('title', $__t('Stock entries'))
-@section('activeNav', 'stockdetail')
-@section('viewJsName', 'stockdetail')
-
-@push('pageScripts')
-
-
-@endpush
-
-@section('content')
-
- | product_id | -{{ $__t('Product') }} | -{{ $__t('Amount') }} | -{{ $__t('Best before date') }} | - @if(GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING){{ $__t('Location') }} | @endif - @if(GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING){{ $__t('Price') }} | @endif -{{ $__t('Purchased date') }} | - - @include('components.userfields_thead', array( - 'userfields' => $userfields - )) -
---|---|---|---|---|---|---|---|
-
-
-
- @if(GROCY_FEATURE_FLAG_STOCK_PRODUCT_OPENED_TRACKING)
-
-
-
- @endif
-
-
-
-
-
-
-
- |
- - {{ $currentStockEntry->product_id }} - | -- {{ FindObjectInArrayByPropertyValue($products, 'id', $currentStockEntry->product_id)->name }} - | -- {{ $currentStockEntry->amount }} {{ $__n($currentStockEntry->amount, FindObjectInArrayByPropertyValue($quantityunits, 'id', FindObjectInArrayByPropertyValue($products, 'id', $currentStockEntry->product_id)->qu_id_stock)->name, FindObjectInArrayByPropertyValue($quantityunits, 'id', FindObjectInArrayByPropertyValue($products, 'id', $currentStockEntry->product_id)->qu_id_stock)->name_plural) }} - @if($currentStockEntry->open == 1){{ $__t('Opened') }}@endif - | -- {{ $currentStockEntry->best_before_date }} - - | - @if(GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING) -- {{ FindObjectInArrayByPropertyValue($locations, 'id', $currentStockEntry->location_id)->name }} - | - @endif - @if(GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING) -- {{ $currentStockEntry->price }} - | - @endif -- {{ $currentStockEntry->purchased_date }} - - | -
+ | product_id | +{{ $__t('Product') }} | +{{ $__t('Amount') }} | +{{ $__t('Best before date') }} | + @if(GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING){{ $__t('Location') }} | @endif + @if(GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING){{ $__t('Price') }} | @endif +{{ $__t('Purchased date') }} | + + @include('components.userfields_thead', array( + 'userfields' => $userfields + )) +
---|---|---|---|---|---|---|---|
+
+
+
+ @if(GROCY_FEATURE_FLAG_STOCK_PRODUCT_OPENED_TRACKING)
+
+
+
+ @endif
+
+
+
+
+
+
+
+ |
+ + {{ $stockEntry->product_id }} + | ++ {{ FindObjectInArrayByPropertyValue($products, 'id', $stockEntry->product_id)->name }} + | ++ {{ $stockEntry->amount }} {{ $__n($stockEntry->amount, FindObjectInArrayByPropertyValue($quantityunits, 'id', FindObjectInArrayByPropertyValue($products, 'id', $stockEntry->product_id)->qu_id_stock)->name, FindObjectInArrayByPropertyValue($quantityunits, 'id', FindObjectInArrayByPropertyValue($products, 'id', $stockEntry->product_id)->qu_id_stock)->name_plural) }} + @if($stockEntry->open == 1){{ $__t('Opened') }}@endif + | ++ {{ $stockEntry->best_before_date }} + + | + @if(GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING) ++ {{ FindObjectInArrayByPropertyValue($locations, 'id', $stockEntry->location_id)->name }} + | + @endif + @if(GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING) ++ {{ $stockEntry->price }} + | + @endif ++ {{ $stockEntry->purchased_date }} + + | +