Added a product context menu on /stockjournal (the same as on /stockoverview) (closes #2239)

This commit is contained in:
Bernd Bestel
2023-05-21 18:40:59 +02:00
parent 979c67b44c
commit 04f362b723
5 changed files with 128 additions and 3 deletions

View File

@@ -178,7 +178,6 @@
href="{{ $U('/inventory?embedded&product=' . $stockEntry->product_id ) }}">
<i class="fa-solid fa-list"></i> {{ $__t('Inventory') }}
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item stock-consume-button stock-consume-button-spoiled"
type="button"
href="#"
@@ -192,6 +191,7 @@
{{ $__t('Consume this stock entry 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)
<div class="dropdown-divider"></div>
<a class="dropdown-item"
type="button"
href="{{ $U('/recipes?search=') }}{{ FindObjectInArrayByPropertyValue($products, 'id', $stockEntry->product_id)->name }}">

View File

@@ -171,8 +171,93 @@
title="{{ $__t('Undo transaction') }}">
<i class="fa-solid fa-undo"></i>
</a>
<div class="dropdown d-inline-block">
<button class="btn btn-xs btn-light text-secondary"
type="button"
data-toggle="dropdown">
<i class="fa-solid fa-ellipsis-v"></i>
</button>
<div class="table-inline-menu dropdown-menu dropdown-menu-right">
@if(GROCY_FEATURE_FLAG_SHOPPINGLIST)
<a class="dropdown-item show-as-dialog-link permission-SHOPPINGLIST_ITEMS_ADD"
type="button"
href="{{ $U('/shoppinglistitem/new?embedded&updateexistingproduct&product=' . $stockLogEntry->product_id ) }}">
<span class="dropdown-item-icon"><i class="fa-solid fa-shopping-cart"></i></span> <span class="dropdown-item-text">{{ $__t('Add to shopping list') }}</span>
</a>
<div class="dropdown-divider"></div>
@endif
<a class="dropdown-item show-as-dialog-link permission-STOCK_PURCHASE"
type="button"
href="{{ $U('/purchase?embedded&product=' . $stockLogEntry->product_id ) }}">
<span class="dropdown-item-icon"><i class="fa-solid fa-cart-plus"></i></span> <span class="dropdown-item-text">{{ $__t('Purchase') }}</span>
</a>
<a class="dropdown-item show-as-dialog-link permission-STOCK_CONSUME"
type="button"
href="{{ $U('/consume?embedded&product=' . $stockLogEntry->product_id ) }}">
<span class="dropdown-item-icon"><i class="fa-solid fa-utensils"></i></span> <span class="dropdown-item-text">{{ $__t('Consume') }}</span>
</a>
@if(GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING)
<a class="dropdown-item show-as-dialog-link permission-STOCK_TRANSFER"
type="button"
href="{{ $U('/transfer?embedded&product=' . $stockLogEntry->product_id) }}">
<span class="dropdown-item-icon"><i class="fa-solid fa-exchange-alt"></i></span> <span class="dropdown-item-text">{{ $__t('Transfer') }}</span>
</a>
@endif
<a class="dropdown-item show-as-dialog-link permission-STOCK_INVENTORY"
type="button"
href="{{ $U('/inventory?embedded&product=' . $stockLogEntry->product_id ) }}">
<span class="dropdown-item-icon"><i class="fa-solid fa-list"></i></span> <span class="dropdown-item-text">{{ $__t('Inventory') }}</span>
</a>
@if(GROCY_FEATURE_FLAG_RECIPES)
<div class="dropdown-divider"></div>
<a class="dropdown-item"
type="button"
href="{{ $U('/recipes?search=') }}{{ $stockLogEntry->product_name }}">
<span class="dropdown-item-text">{{ $__t('Search for recipes containing this product') }}</span>
</a>
@endif
<div class="dropdown-divider"></div>
<a class="dropdown-item product-name-cell"
data-product-id="{{ $stockLogEntry->product_id }}"
type="button"
href="#">
<span class="dropdown-item-text">{{ $__t('Product overview') }}</span>
</a>
<a class="dropdown-item show-as-dialog-link"
type="button"
href="{{ $U('/stockentries?embedded&product=') }}{{ $stockLogEntry->product_id }}"
data-product-id="{{ $stockLogEntry->product_id }}">
<span class="dropdown-item-text">{{ $__t('Stock entries') }}</span>
</a>
<a class="dropdown-item show-as-dialog-link"
type="button"
href="{{ $U('/stockjournal/summary?embedded&product_id=') }}{{ $stockLogEntry->product_id }}">
<span class="dropdown-item-text">{{ $__t('Stock journal summary') }}</span>
</a>
<a class="dropdown-item permission-MASTER_DATA_EDIT link-return"
type="button"
data-href="{{ $U('/product/') }}{{ $stockLogEntry->product_id }}">
<span class="dropdown-item-text">{{ $__t('Edit product') }}</span>
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item"
type="button"
href="{{ $U('/product/' . $stockLogEntry->product_id . '/grocycode?download=true') }}">
{!! str_replace('Grocycode', '<span class="ls-n1">Grocycode</span>', $__t('Download %s Grocycode', $__t('Product'))) !!}
</a>
@if(GROCY_FEATURE_FLAG_LABEL_PRINTER)
<a class="dropdown-item product-grocycode-label-print"
data-product-id="{{ $stockLogEntry->product_id }}"
type="button"
href="#">
{!! str_replace('Grocycode', '<span class="ls-n1">Grocycode</span>', $__t('Print %s Grocycode on label printer', $__t('Product'))) !!}
</a>
@endif
</div>
</div>
</td>
<td>
<td class="product-name-cell cursor-link"
data-product-id="{{ $stockLogEntry->product_id }}">
<span class="name-anchor @if($stockLogEntry->undone == 1) text-strike-through @endif">{{ $stockLogEntry->product_name }}</span>
@if($stockLogEntry->undone == 1)
<br>
@@ -215,4 +300,21 @@
</table>
</div>
</div>
<div class="modal fade"
id="stockjournal-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

View File

@@ -271,6 +271,7 @@
<span class="dropdown-item-icon"><i class="fa-solid fa-list"></i></span> <span class="dropdown-item-text">{{ $__t('Inventory') }}</span>
</a>
@if(GROCY_FEATURE_FLAG_RECIPES)
<div class="dropdown-divider"></div>
<a class="dropdown-item"
type="button"
href="{{ $U('/recipes?search=') }}{{ $currentStockEntry->product_name }}">