mirror of
https://github.com/grocy/grocy.git
synced 2025-04-29 09:39:57 +00:00
Show productcard as a popup on stockoverview page instead of only the product picture (closes #93)
This commit is contained in:
parent
b3da837ede
commit
57a0864465
@ -81,12 +81,6 @@ input::-webkit-inner-spin-button {
|
|||||||
-webkit-appearance: none;
|
-webkit-appearance: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.centered-dialog .modal-title,
|
|
||||||
.centered-dialog .modal-body {
|
|
||||||
margin-left: auto;
|
|
||||||
margin-right: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Navigation style customizations */
|
/* Navigation style customizations */
|
||||||
#mainNav {
|
#mainNav {
|
||||||
background-color: #e5e5e5 !important;
|
background-color: #e5e5e5 !important;
|
||||||
|
@ -154,41 +154,8 @@ $(document).on('click', '.product-consume-button', function(e)
|
|||||||
|
|
||||||
$(document).on("click", ".product-name-cell", function(e)
|
$(document).on("click", ".product-name-cell", function(e)
|
||||||
{
|
{
|
||||||
var productHasPicture = BoolVal($(e.currentTarget).attr("data-product-has-picture"));
|
Grocy.Components.ProductCard.Refresh($(e.currentTarget).attr("data-product-id"));
|
||||||
|
$("#stockoverview-productcard-modal").modal("show");
|
||||||
if (productHasPicture)
|
|
||||||
{
|
|
||||||
var pictureUrl = $(e.currentTarget).attr("data-picture-url");
|
|
||||||
var productName = $(e.currentTarget).attr("data-product-name");
|
|
||||||
var productId = $(e.currentTarget).attr("data-product-id");
|
|
||||||
|
|
||||||
bootbox.dialog({
|
|
||||||
title: L("Image of product #1", productName),
|
|
||||||
message: "<img src='" + pictureUrl + "' class='img-fluid img-thumbnail'>",
|
|
||||||
backdrop: false,
|
|
||||||
onEscape: true,
|
|
||||||
closeButton: false,
|
|
||||||
className: 'centered-dialog',
|
|
||||||
buttons: {
|
|
||||||
editproduct: {
|
|
||||||
label: '<i class="fas fa-edit"></i> ' + L('Edit product'),
|
|
||||||
className: 'btn-info responsive-button',
|
|
||||||
callback: function ()
|
|
||||||
{
|
|
||||||
window.location.href = U('/product/' + productId + '?returnto=' + encodeURIComponent(window.location.pathname) + '#product-picture');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
close: {
|
|
||||||
label: L('Close'),
|
|
||||||
className: 'btn-default responsive-button',
|
|
||||||
callback: function()
|
|
||||||
{
|
|
||||||
bootbox.hideAll();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function RefreshStatistics()
|
function RefreshStatistics()
|
||||||
|
@ -93,12 +93,8 @@
|
|||||||
<i class="fas fa-utensils"></i> {{ $L('All') }}
|
<i class="fas fa-utensils"></i> {{ $L('All') }}
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td class="product-name-cell"
|
<td class="product-name-cell" data-product-id="{{ $currentStockEntry->product_id }}">
|
||||||
data-picture-url="{{ $U('/api/file/productpictures?file_name=' . FindObjectInArrayByPropertyValue($products, 'id', $currentStockEntry->product_id)->picture_file_name) }}"
|
{{ FindObjectInArrayByPropertyValue($products, 'id', $currentStockEntry->product_id)->name }} <i class="fas fa-info text-muted"></i>
|
||||||
data-product-id="{{ $currentStockEntry->product_id }}"
|
|
||||||
data-product-name="{{ FindObjectInArrayByPropertyValue($products, 'id', $currentStockEntry->product_id)->name }}"
|
|
||||||
data-product-has-picture="{{ BoolToString(!empty(FindObjectInArrayByPropertyValue($products, 'id', $currentStockEntry->product_id)->picture_file_name)) }}">
|
|
||||||
{{ FindObjectInArrayByPropertyValue($products, 'id', $currentStockEntry->product_id)->name }}@if(!empty(FindObjectInArrayByPropertyValue($products, 'id', $currentStockEntry->product_id)->picture_file_name)) <i class="fas fa-image text-muted"></i>@endif
|
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<span id="product-{{ $currentStockEntry->product_id }}-amount">{{ $currentStockEntry->amount }}</span> {{ Pluralize($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 id="product-{{ $currentStockEntry->product_id }}-amount">{{ $currentStockEntry->amount }}</span> {{ Pluralize($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) }}
|
||||||
@ -123,4 +119,17 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="modal fade" id="stockoverview-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">{{ $L('Close') }}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@stop
|
@stop
|
||||||
|
Loading…
x
Reference in New Issue
Block a user