Added a location filter to the stock entries page

This commit is contained in:
Bernd Bestel 2022-04-03 19:28:59 +02:00
parent 5c6f84a68e
commit e69e7a9a9a
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300
5 changed files with 38 additions and 3 deletions

View File

@ -34,6 +34,7 @@
- New product option "Disable own stock" (defaults to disabled)
- When enabled, the corresponding product can't have own stock, means it will not be selectable on purchase (useful for parent products which are just used as a summary/total view of the child products)
- The location content sheet can now optionally list also out of stock products (at the products default location, new checkbox "Show only in-stock products " at the top of the page, defaults to enabled)
- Added a location filter to the stock entries page
- Added the product grocycode as a (hidden by default) column to the products list (master data)
- Fixed that consuming via the consume page was not possible when `FEATURE_FLAG_STOCK_LOCATION_TRACKING` was disabled

View File

@ -29,10 +29,24 @@ $.fn.dataTable.ext.search.push(function(settings, data, dataIndex)
$("#clear-filter-button").on("click", function()
{
$("#location-filter").val("all");
$("#location-filter").trigger("change");
Grocy.Components.ProductPicker.Clear();
stockEntriesTable.draw();
});
$("#location-filter").on("change", function()
{
var value = $(this).val();
var text = $("#location-filter option:selected").text();
if (value === "all")
{
text = "";
}
stockEntriesTable.column(stockEntriesTable.colReorder.transpose(5)).search(text).draw();
});
Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
{
stockEntriesTable.draw();

View File

@ -14,8 +14,9 @@
@php if(empty($hint)) { $hint = ''; } @endphp
@php if(empty($nextInputSelector)) { $nextInputSelector = ''; } @endphp
@php if(empty($validationMessage)) { $validationMessage = 'You have to select a product'; } @endphp
@php if(empty($additionalGroupCssClasses)) { $additionalGroupCssClasses = ''; } @endphp
<div class="form-group"
<div class="form-group {{ $additionalGroupCssClasses }}"
data-next-input-selector="{{ $nextInputSelector }}"
data-disallow-add-product-workflows="{{ BoolToString($disallowAddProductWorkflows) }}"
data-disallow-all-product-workflows="{{ BoolToString($disallowAllProductWorkflows) }}"

View File

@ -35,10 +35,27 @@
@include('components.productpicker', array(
'products' => $products,
'disallowAllProductWorkflows' => true,
'isRequired' => false
'isRequired' => false,
'additionalGroupCssClasses' => 'mb-0'
))
</div>
<div class="col">
@if(GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING)
<div class="col-12 col-md-6 col-xl-3 mt-auto">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-filter"></i>&nbsp;{{ $__t('Location') }}</span>
</div>
<select class="custom-control custom-select"
id="location-filter">
<option value="all">{{ $__t('All') }}</option>
@foreach($locations as $location)
<option value="{{ $location->id }}">{{ $location->name }}</option>
@endforeach
</select>
</div>
</div>
@endif
<div class="col mt-auto">
<div class="float-right mt-3">
<a id="clear-filter-button"
class="btn btn-sm btn-outline-info"

View File

@ -73,6 +73,7 @@
</select>
</div>
</div>
@if(GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING)
<div class="col-12 col-md-6 col-xl-3">
<div class="input-group">
<div class="input-group-prepend">
@ -87,6 +88,7 @@
</select>
</div>
</div>
@endif
<div class="col-12 col-md-6 col-xl-2 mt-1">
<div class="input-group">
<div class="input-group-prepend">