mirror of
https://github.com/grocy/grocy.git
synced 2025-04-29 01:32:38 +00:00
Rename /stockedit and /stockdetail to match the "naming conventions" (references #421)
This commit is contained in:
parent
40730328b8
commit
4c1c971f6d
@ -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')
|
||||
|
@ -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) + '<br><a class="btn btn-secondary btn-sm mt-2" href="#" onclick="UndoStockBookingEntry(' + bookingResponse.id + ',' + stockRowId + ')"><i class="fas fa-undo"></i> ' + __t("Undo") + '</a>');
|
||||
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)
|
@ -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') + '<br><a class="btn btn-secondary btn-sm mt-2" href="#" onclick="UndoStockBookingEntry(\'' + result.id + '\',\'' + Grocy.EditObjectId + '\')"><i class="fas fa-undo"></i> ' + __t("Undo") + '</a>';
|
||||
|
||||
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");
|
@ -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');
|
||||
|
@ -1,170 +0,0 @@
|
||||
@extends('layout.default')
|
||||
|
||||
@section('title', $__t('Stock entries'))
|
||||
@section('activeNav', 'stockdetail')
|
||||
@section('viewJsName', 'stockdetail')
|
||||
|
||||
@push('pageScripts')
|
||||
<script src="{{ $U('/node_modules/jquery-ui-dist/jquery-ui.min.js?v=', true) }}{{ $version }}"></script>
|
||||
<script src="{{ $U('/viewjs/purchase.js?v=', true) }}{{ $version }}"></script>
|
||||
@endpush
|
||||
|
||||
@section('content')
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<h1>@yield('title')</h1>
|
||||
</div>
|
||||
<div class="col">
|
||||
@include('components.productpicker', array(
|
||||
'products' => $products,
|
||||
'disallowAllProductWorkflows' => true
|
||||
))
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<table id="stock-detail-table" class="table table-sm table-striped dt-responsive">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="border-right"></th>
|
||||
<th class="d-none">product_id</th> <!-- This must be in the first column for searching -->
|
||||
<th>{{ $__t('Product') }}</th>
|
||||
<th>{{ $__t('Amount') }}</th>
|
||||
<th>{{ $__t('Best before date') }}</th>
|
||||
@if(GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING)<th>{{ $__t('Location') }}</th>@endif
|
||||
@if(GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING)<th>{{ $__t('Price') }}</th>@endif
|
||||
<th>{{ $__t('Purchased date') }}</th>
|
||||
|
||||
@include('components.userfields_thead', array(
|
||||
'userfields' => $userfields
|
||||
))
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="d-none">
|
||||
@foreach($currentStockDetail as $currentStockEntry)
|
||||
<tr id="stock-{{ $currentStockEntry->id }}-row" class="@if(GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING && $currentStockEntry->best_before_date < date('Y-m-d 23:59:59', strtotime('-1 days')) && $currentStockEntry->amount > 0) table-danger @elseif(GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING && $currentStockEntry->best_before_date < date('Y-m-d 23:59:59', strtotime("+$nextXDays days")) && $currentStockEntry->amount > 0) table-warning @endif">
|
||||
<td class="fit-content border-right">
|
||||
<a class="btn btn-success btn-sm stock-consume-button" href="#" data-toggle="tooltip" data-placement="left" title="{{ $__t('Consume %1$s of %2$s', '1 ' . FindObjectInArrayByPropertyValue($quantityunits, 'id', FindObjectInArrayByPropertyValue($products, 'id', $currentStockEntry->product_id)->qu_id_stock)->name, FindObjectInArrayByPropertyValue($products, 'id', $currentStockEntry->product_id)->name) }}"
|
||||
data-product-id="{{ $currentStockEntry->product_id }}"
|
||||
data-stock-id="{{ $currentStockEntry->stock_id }}"
|
||||
data-stockrow-id="{{ $currentStockEntry->id }}"
|
||||
data-location-id="{{ $currentStockEntry->location_id }}"
|
||||
data-product-name="{{ FindObjectInArrayByPropertyValue($products, 'id', $currentStockEntry->product_id)->name }}"
|
||||
data-product-qu-name="{{ FindObjectInArrayByPropertyValue($quantityunits, 'id', FindObjectInArrayByPropertyValue($products, 'id', $currentStockEntry->product_id)->qu_id_stock)->name }}"
|
||||
data-consume-amount="{{ $currentStockEntry->amount }}">
|
||||
<i class="fas fa-utensils"></i>
|
||||
</a>
|
||||
@if(GROCY_FEATURE_FLAG_STOCK_PRODUCT_OPENED_TRACKING)
|
||||
<a class="btn btn-success btn-sm product-open-button @if($currentStockEntry->open == 1) disabled @endif" href="#" data-toggle="tooltip" data-placement="left" title="{{ $__t('Mark %1$s of %2$s as open', '1 ' . FindObjectInArrayByPropertyValue($quantityunits, 'id', FindObjectInArrayByPropertyValue($products, 'id', $currentStockEntry->product_id)->qu_id_stock)->name, FindObjectInArrayByPropertyValue($products, 'id', $currentStockEntry->product_id)->name) }}"
|
||||
data-product-id="{{ $currentStockEntry->product_id }}"
|
||||
data-product-name="{{ FindObjectInArrayByPropertyValue($products, 'id', $currentStockEntry->product_id)->name }}"
|
||||
data-product-qu-name="{{ FindObjectInArrayByPropertyValue($quantityunits, 'id', FindObjectInArrayByPropertyValue($products, 'id', $currentStockEntry->product_id)->qu_id_stock)->name }}"
|
||||
data-stock-id="{{ $currentStockEntry->stock_id }}"
|
||||
data-stockrow-id="{{ $currentStockEntry->id }}">
|
||||
<i class="fas fa-box-open"></i>
|
||||
</a>
|
||||
@endif
|
||||
<a class="btn btn-info btn-sm show-as-dialog-link" href="{{ $U('/stockedit/' . $currentStockEntry->id . '?embedded') }}" data-toggle="tooltip" data-placement="left" title="{{ $__t('Edit stock entry') }}">
|
||||
<i class="fas fa-edit"></i>
|
||||
</a>
|
||||
<div class="dropdown d-inline-block">
|
||||
<button class="btn btn-sm btn-light text-secondary" type="button" data-toggle="dropdown">
|
||||
<i class="fas fa-ellipsis-v"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item show-as-dialog-link" type="button" href="{{ $U('/shoppinglistitem/new?embedded&updateexistingproduct&product=' . $currentStockEntry->product_id ) }}">
|
||||
<i class="fas fa-shopping-cart"></i> {{ $__t('Add to shopping list') }}
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item show-as-dialog-link" type="button" href="{{ $U('/purchase?embedded&product=' . $currentStockEntry->product_id ) }}">
|
||||
<i class="fas fa-shopping-cart"></i> {{ $__t('Purchase') }}
|
||||
</a>
|
||||
<a class="dropdown-item show-as-dialog-link" type="button" href="{{ $U('/consume?embedded&product=' . $currentStockEntry->product_id . '&locationId=' . $currentStockEntry->location_id . '&stockId=' . $currentStockEntry->stock_id) }}">
|
||||
<i class="fas fa-utensils"></i> {{ $__t('Consume') }}
|
||||
</a>
|
||||
@if(GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING)
|
||||
<a class="dropdown-item show-as-dialog-link" type="button" href="{{ $U('/transfer?embedded&product=' . $currentStockEntry->product_id . '&locationId=' . $currentStockEntry->location_id . '&stockId=' . $currentStockEntry->stock_id) }}">
|
||||
<i class="fas fa-exchange-alt"></i> {{ $__t('Transfer') }}
|
||||
</a>
|
||||
@endif
|
||||
<a class="dropdown-item show-as-dialog-link" type="button" href="{{ $U('/inventory?embedded&product=' . $currentStockEntry->product_id ) }}">
|
||||
<i class="fas fa-list"></i> {{ $__t('Inventory') }}
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item product-name-cell" data-product-id="{{ $currentStockEntry->product_id }}" type="button" href="#">
|
||||
<i class="fas fa-info"></i> {{ $__t('Show product details') }}
|
||||
</a>
|
||||
<a class="dropdown-item" type="button" href="{{ $U('/stockjournal?product=') }}{{ $currentStockEntry->product_id }}">
|
||||
<i class="fas fa-file-alt"></i> {{ $__t('Stock journal for this product') }}
|
||||
</a>
|
||||
<a class="dropdown-item" type="button" href="{{ $U('/product/') }}{{ $currentStockEntry->product_id . '?returnto=%2Fstockdetail' }}">
|
||||
<i class="fas fa-edit"></i> {{ $__t('Edit product') }}
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item stock-consume-button stock-consume-button-spoiled @if($currentStockEntry->amount < 1) disabled @endif" type="button" href="#"
|
||||
data-product-id="{{ $currentStockEntry->product_id }}"
|
||||
data-product-name="{{ FindObjectInArrayByPropertyValue($products, 'id', $currentStockEntry->product_id)->name }}"
|
||||
data-product-qu-name="{{ FindObjectInArrayByPropertyValue($quantityunits, 'id', FindObjectInArrayByPropertyValue($products, 'id', $currentStockEntry->product_id)->qu_id_stock)->name }}"
|
||||
data-stock-id="{{ $currentStockEntry->stock_id }}"
|
||||
data-stockrow-id="{{ $currentStockEntry->id }}"
|
||||
data-location-id="{{ $currentStockEntry->location_id }}"
|
||||
data-consume-amount="1">
|
||||
<i class="fas fa-utensils"></i> {{ $__t('Consume %1$s of %2$s as spoiled', '1 ' . FindObjectInArrayByPropertyValue($quantityunits, 'id', FindObjectInArrayByPropertyValue($products, 'id', $currentStockEntry->product_id)->qu_id_stock)->name, FindObjectInArrayByPropertyValue($products, 'id', $currentStockEntry->product_id)->name) }}
|
||||
</a>
|
||||
@if(GROCY_FEATURE_FLAG_RECIPES)
|
||||
<a class="dropdown-item" type="button" href="{{ $U('/recipes?search=') }}{{ FindObjectInArrayByPropertyValue($products, 'id', $currentStockEntry->product_id)->name }}">
|
||||
<i class="fas fa-cocktail"></i> {{ $__t('Search for recipes containing this product') }}
|
||||
</a>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td class="d-none" data-product-id="{{ $currentStockEntry->product_id }}">
|
||||
{{ $currentStockEntry->product_id }}
|
||||
</td>
|
||||
<td class="product-name-cell cursor-link" data-product-id="{{ $currentStockEntry->product_id }}">
|
||||
{{ FindObjectInArrayByPropertyValue($products, 'id', $currentStockEntry->product_id)->name }}
|
||||
</td>
|
||||
<td>
|
||||
<span id="stock-{{ $currentStockEntry->id }}-amount" class="locale-number locale-number-quantity-amount">{{ $currentStockEntry->amount }}</span> <span id="product-{{ $currentStockEntry->product_id }}-qu-name">{{ $__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) }}</span>
|
||||
<span id="stock-{{ $currentStockEntry->id }}-opened-amount" class="small font-italic">@if($currentStockEntry->open == 1){{ $__t('Opened') }}@endif</span>
|
||||
</td>
|
||||
<td>
|
||||
<span id="stock-{{ $currentStockEntry->id }}-best-before-date">{{ $currentStockEntry->best_before_date }}</span>
|
||||
<time id="stock-{{ $currentStockEntry->id }}-best-before-date-timeago" class="timeago timeago-contextual" datetime="{{ $currentStockEntry->best_before_date }} 23:59:59"></time>
|
||||
</td>
|
||||
@if(GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING)
|
||||
<td id="stock-{{ $currentStockEntry->id }}-location" data-location-id="{{ $currentStockEntry->location_id }}">
|
||||
{{ FindObjectInArrayByPropertyValue($locations, 'id', $currentStockEntry->location_id)->name }}
|
||||
</td>
|
||||
@endif
|
||||
@if(GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING)
|
||||
<td id="stock-{{ $currentStockEntry->id }}-price" class="locale-number locale-number-currency" data-price-id="{{ $currentStockEntry->price }}">
|
||||
{{ $currentStockEntry->price }}
|
||||
</td>
|
||||
@endif
|
||||
<td>
|
||||
<span id="stock-{{ $currentStockEntry->id }}-purchased-date">{{ $currentStockEntry->purchased_date }}</span>
|
||||
<time id="stock-{{ $currentStockEntry->id }}-purchased-date-timeago" class="timeago timeago-contextual" datetime="{{ $currentStockEntry->purchased_date }} 23:59:59"></time>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="productcard-modal" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content text-center">
|
||||
<div class="modal-body">
|
||||
@include('components.productcard')
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">{{ $__t('Close') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@stop
|
169
views/stockentries.blade.php
Normal file
169
views/stockentries.blade.php
Normal file
@ -0,0 +1,169 @@
|
||||
@extends('layout.default')
|
||||
|
||||
@section('title', $__t('Stock entries'))
|
||||
@section('viewJsName', 'stockentries')
|
||||
|
||||
@push('pageScripts')
|
||||
<script src="{{ $U('/node_modules/jquery-ui-dist/jquery-ui.min.js?v=', true) }}{{ $version }}"></script>
|
||||
<script src="{{ $U('/viewjs/purchase.js?v=', true) }}{{ $version }}"></script>
|
||||
@endpush
|
||||
|
||||
@section('content')
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<h1>@yield('title')</h1>
|
||||
</div>
|
||||
<div class="col">
|
||||
@include('components.productpicker', array(
|
||||
'products' => $products,
|
||||
'disallowAllProductWorkflows' => true
|
||||
))
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<table id="stockentries-table" class="table table-sm table-striped dt-responsive">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="border-right"></th>
|
||||
<th class="d-none">product_id</th> <!-- This must be in the first column for searching -->
|
||||
<th>{{ $__t('Product') }}</th>
|
||||
<th>{{ $__t('Amount') }}</th>
|
||||
<th>{{ $__t('Best before date') }}</th>
|
||||
@if(GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING)<th>{{ $__t('Location') }}</th>@endif
|
||||
@if(GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING)<th>{{ $__t('Price') }}</th>@endif
|
||||
<th>{{ $__t('Purchased date') }}</th>
|
||||
|
||||
@include('components.userfields_thead', array(
|
||||
'userfields' => $userfields
|
||||
))
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="d-none">
|
||||
@foreach($stockEntries as $stockEntry)
|
||||
<tr id="stock-{{ $stockEntry->id }}-row" class="@if(GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING && $stockEntry->best_before_date < date('Y-m-d 23:59:59', strtotime('-1 days')) && $stockEntry->amount > 0) table-danger @elseif(GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING && $stockEntry->best_before_date < date('Y-m-d 23:59:59', strtotime("+$nextXDays days")) && $stockEntry->amount > 0) table-warning @endif">
|
||||
<td class="fit-content border-right">
|
||||
<a class="btn btn-success btn-sm stock-consume-button" href="#" data-toggle="tooltip" data-placement="left" title="{{ $__t('Consume %1$s of %2$s', '1 ' . FindObjectInArrayByPropertyValue($quantityunits, 'id', FindObjectInArrayByPropertyValue($products, 'id', $stockEntry->product_id)->qu_id_stock)->name, FindObjectInArrayByPropertyValue($products, 'id', $stockEntry->product_id)->name) }}"
|
||||
data-product-id="{{ $stockEntry->product_id }}"
|
||||
data-stock-id="{{ $stockEntry->stock_id }}"
|
||||
data-stockrow-id="{{ $stockEntry->id }}"
|
||||
data-location-id="{{ $stockEntry->location_id }}"
|
||||
data-product-name="{{ FindObjectInArrayByPropertyValue($products, 'id', $stockEntry->product_id)->name }}"
|
||||
data-product-qu-name="{{ FindObjectInArrayByPropertyValue($quantityunits, 'id', FindObjectInArrayByPropertyValue($products, 'id', $stockEntry->product_id)->qu_id_stock)->name }}"
|
||||
data-consume-amount="{{ $stockEntry->amount }}">
|
||||
<i class="fas fa-utensils"></i>
|
||||
</a>
|
||||
@if(GROCY_FEATURE_FLAG_STOCK_PRODUCT_OPENED_TRACKING)
|
||||
<a class="btn btn-success btn-sm product-open-button @if($stockEntry->open == 1) disabled @endif" href="#" data-toggle="tooltip" data-placement="left" title="{{ $__t('Mark %1$s of %2$s as open', '1 ' . FindObjectInArrayByPropertyValue($quantityunits, 'id', FindObjectInArrayByPropertyValue($products, 'id', $stockEntry->product_id)->qu_id_stock)->name, FindObjectInArrayByPropertyValue($products, 'id', $stockEntry->product_id)->name) }}"
|
||||
data-product-id="{{ $stockEntry->product_id }}"
|
||||
data-product-name="{{ FindObjectInArrayByPropertyValue($products, 'id', $stockEntry->product_id)->name }}"
|
||||
data-product-qu-name="{{ FindObjectInArrayByPropertyValue($quantityunits, 'id', FindObjectInArrayByPropertyValue($products, 'id', $stockEntry->product_id)->qu_id_stock)->name }}"
|
||||
data-stock-id="{{ $stockEntry->stock_id }}"
|
||||
data-stockrow-id="{{ $stockEntry->id }}">
|
||||
<i class="fas fa-box-open"></i>
|
||||
</a>
|
||||
@endif
|
||||
<a class="btn btn-info btn-sm show-as-dialog-link" href="{{ $U('/stockentry/' . $stockEntry->id . '?embedded') }}" data-toggle="tooltip" data-placement="left" title="{{ $__t('Edit stock entry') }}">
|
||||
<i class="fas fa-edit"></i>
|
||||
</a>
|
||||
<div class="dropdown d-inline-block">
|
||||
<button class="btn btn-sm btn-light text-secondary" type="button" data-toggle="dropdown">
|
||||
<i class="fas fa-ellipsis-v"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item show-as-dialog-link" type="button" href="{{ $U('/shoppinglistitem/new?embedded&updateexistingproduct&product=' . $stockEntry->product_id ) }}">
|
||||
<i class="fas fa-shopping-cart"></i> {{ $__t('Add to shopping list') }}
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item show-as-dialog-link" type="button" href="{{ $U('/purchase?embedded&product=' . $stockEntry->product_id ) }}">
|
||||
<i class="fas fa-shopping-cart"></i> {{ $__t('Purchase') }}
|
||||
</a>
|
||||
<a class="dropdown-item show-as-dialog-link" type="button" href="{{ $U('/consume?embedded&product=' . $stockEntry->product_id . '&locationId=' . $stockEntry->location_id . '&stockId=' . $stockEntry->stock_id) }}">
|
||||
<i class="fas fa-utensils"></i> {{ $__t('Consume') }}
|
||||
</a>
|
||||
@if(GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING)
|
||||
<a class="dropdown-item show-as-dialog-link" type="button" href="{{ $U('/transfer?embedded&product=' . $stockEntry->product_id . '&locationId=' . $stockEntry->location_id . '&stockId=' . $stockEntry->stock_id) }}">
|
||||
<i class="fas fa-exchange-alt"></i> {{ $__t('Transfer') }}
|
||||
</a>
|
||||
@endif
|
||||
<a class="dropdown-item show-as-dialog-link" type="button" href="{{ $U('/inventory?embedded&product=' . $stockEntry->product_id ) }}">
|
||||
<i class="fas fa-list"></i> {{ $__t('Inventory') }}
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item product-name-cell" data-product-id="{{ $stockEntry->product_id }}" type="button" href="#">
|
||||
<i class="fas fa-info"></i> {{ $__t('Show product details') }}
|
||||
</a>
|
||||
<a class="dropdown-item" type="button" href="{{ $U('/stockjournal?product=') }}{{ $stockEntry->product_id }}">
|
||||
<i class="fas fa-file-alt"></i> {{ $__t('Stock journal for this product') }}
|
||||
</a>
|
||||
<a class="dropdown-item" type="button" href="{{ $U('/product/') }}{{ $stockEntry->product_id . '?returnto=/stockentries' }}">
|
||||
<i class="fas fa-edit"></i> {{ $__t('Edit product') }}
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item stock-consume-button stock-consume-button-spoiled @if($stockEntry->amount < 1) disabled @endif" type="button" href="#"
|
||||
data-product-id="{{ $stockEntry->product_id }}"
|
||||
data-product-name="{{ FindObjectInArrayByPropertyValue($products, 'id', $stockEntry->product_id)->name }}"
|
||||
data-product-qu-name="{{ FindObjectInArrayByPropertyValue($quantityunits, 'id', FindObjectInArrayByPropertyValue($products, 'id', $stockEntry->product_id)->qu_id_stock)->name }}"
|
||||
data-stock-id="{{ $stockEntry->stock_id }}"
|
||||
data-stockrow-id="{{ $stockEntry->id }}"
|
||||
data-location-id="{{ $stockEntry->location_id }}"
|
||||
data-consume-amount="1">
|
||||
<i class="fas fa-utensils"></i> {{ $__t('Consume %1$s of %2$s as spoiled', '1 ' . FindObjectInArrayByPropertyValue($quantityunits, 'id', FindObjectInArrayByPropertyValue($products, 'id', $stockEntry->product_id)->qu_id_stock)->name, FindObjectInArrayByPropertyValue($products, 'id', $stockEntry->product_id)->name) }}
|
||||
</a>
|
||||
@if(GROCY_FEATURE_FLAG_RECIPES)
|
||||
<a class="dropdown-item" type="button" href="{{ $U('/recipes?search=') }}{{ FindObjectInArrayByPropertyValue($products, 'id', $stockEntry->product_id)->name }}">
|
||||
<i class="fas fa-cocktail"></i> {{ $__t('Search for recipes containing this product') }}
|
||||
</a>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td class="d-none" data-product-id="{{ $stockEntry->product_id }}">
|
||||
{{ $stockEntry->product_id }}
|
||||
</td>
|
||||
<td class="product-name-cell cursor-link" data-product-id="{{ $stockEntry->product_id }}">
|
||||
{{ FindObjectInArrayByPropertyValue($products, 'id', $stockEntry->product_id)->name }}
|
||||
</td>
|
||||
<td>
|
||||
<span id="stock-{{ $stockEntry->id }}-amount" class="locale-number locale-number-quantity-amount">{{ $stockEntry->amount }}</span> <span id="product-{{ $stockEntry->product_id }}-qu-name">{{ $__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) }}</span>
|
||||
<span id="stock-{{ $stockEntry->id }}-opened-amount" class="small font-italic">@if($stockEntry->open == 1){{ $__t('Opened') }}@endif</span>
|
||||
</td>
|
||||
<td>
|
||||
<span id="stock-{{ $stockEntry->id }}-best-before-date">{{ $stockEntry->best_before_date }}</span>
|
||||
<time id="stock-{{ $stockEntry->id }}-best-before-date-timeago" class="timeago timeago-contextual" datetime="{{ $stockEntry->best_before_date }} 23:59:59"></time>
|
||||
</td>
|
||||
@if(GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING)
|
||||
<td id="stock-{{ $stockEntry->id }}-location" data-location-id="{{ $stockEntry->location_id }}">
|
||||
{{ FindObjectInArrayByPropertyValue($locations, 'id', $stockEntry->location_id)->name }}
|
||||
</td>
|
||||
@endif
|
||||
@if(GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING)
|
||||
<td id="stock-{{ $stockEntry->id }}-price" class="locale-number locale-number-currency" data-price-id="{{ $stockEntry->price }}">
|
||||
{{ $stockEntry->price }}
|
||||
</td>
|
||||
@endif
|
||||
<td>
|
||||
<span id="stock-{{ $stockEntry->id }}-purchased-date">{{ $stockEntry->purchased_date }}</span>
|
||||
<time id="stock-{{ $stockEntry->id }}-purchased-date-timeago" class="timeago timeago-contextual" datetime="{{ $stockEntry->purchased_date }} 23:59:59"></time>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="productcard-modal" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content text-center">
|
||||
<div class="modal-body">
|
||||
@include('components.productcard')
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">{{ $__t('Close') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@stop
|
@ -1,8 +1,7 @@
|
||||
@extends('layout.default')
|
||||
|
||||
@section('title', $__t('Edit stock entry'))
|
||||
@section('activeNav', 'stockedit')
|
||||
@section('viewJsName', 'stockedit')
|
||||
@section('viewJsName', 'stockentryform')
|
||||
|
||||
@section('content')
|
||||
<script>
|
||||
@ -14,7 +13,7 @@
|
||||
<div class="col-xs-12 col-md-6 col-xl-4 pb-3">
|
||||
<h1>@yield('title')</h1>
|
||||
|
||||
<form id="stockedit-form" novalidate>
|
||||
<form id="stockentry-form" novalidate>
|
||||
@php
|
||||
$product = FindObjectInArrayByPropertyValue($products, 'id', $stockEntry->product_id);
|
||||
@endphp
|
||||
@ -52,7 +51,6 @@
|
||||
'hintId' => 'amount_qu_unit',
|
||||
'invalidFeedback' => $__t('The amount cannot be lower than %s', '0'),
|
||||
'additionalAttributes' => 'data-not-equal="-1"',
|
||||
'additionalHtmlElements' => '<div id="stockedit-change-info" class="form-text text-muted small d-none"></div>',
|
||||
'additionalHtmlContextHelp' => '<div id="tare-weight-handling-info" class="text-small text-info font-italic d-none">' . $__t('Tare weight handling enabled - please weigh the whole container, the amount to be posted will be automatically calculcated') . '</div>'
|
||||
))
|
||||
|
||||
@ -89,7 +87,7 @@
|
||||
'limitEndToNow' => false,
|
||||
'limitStartToNow' => false,
|
||||
'invalidFeedback' => $__t('A purchased date is required'),
|
||||
'nextInputSelector' => '#save-stockedit-button',
|
||||
'nextInputSelector' => '#save-stockentry-button',
|
||||
'additionalGroupCssClasses' => 'date-only-datetimepicker'
|
||||
))
|
||||
|
||||
@ -99,7 +97,7 @@
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<button id="save-stockedit-button" class="btn btn-success">{{ $__t('OK') }}</button>
|
||||
<button id="save-stockentry-button" class="btn btn-success">{{ $__t('OK') }}</button>
|
||||
|
||||
</form>
|
||||
</div>
|
@ -17,7 +17,7 @@
|
||||
<a class="btn btn-outline-dark responsive-button" href="{{ $U('/stockjournal') }}">
|
||||
<i class="fas fa-file-alt"></i> {{ $__t('Journal') }}
|
||||
</a>
|
||||
<a class="btn btn-outline-dark responsive-button" href="{{ $U('/stockdetail') }}">
|
||||
<a class="btn btn-outline-dark responsive-button" href="{{ $U('/stockentries') }}">
|
||||
<i class="fas fa-boxes"></i> {{ $__t('Stock entries') }}
|
||||
</a>
|
||||
@if(GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING)
|
||||
@ -144,7 +144,7 @@
|
||||
<a class="dropdown-item product-name-cell" data-product-id="{{ $currentStockEntry->product_id }}" type="button" href="#">
|
||||
<i class="fas fa-info"></i> {{ $__t('Show product details') }}
|
||||
</a>
|
||||
<a class="dropdown-item" type="button" href="{{ $U('/stockdetail?product=') }}{{ $currentStockEntry->product_id }}"
|
||||
<a class="dropdown-item" type="button" href="{{ $U('/stockentries?product=') }}{{ $currentStockEntry->product_id }}"
|
||||
data-product-id="{{ $currentStockEntry->product_id }}">
|
||||
<i class="fas fa-boxes"></i> {{ $__t('Show stock entries') }}
|
||||
</a>
|
||||
|
Loading…
x
Reference in New Issue
Block a user