mirror of
https://github.com/grocy/grocy.git
synced 2025-08-15 10:14:39 +00:00
Simplified product specific QU display/edit and added more demo QU conversions
This commit is contained in:
@@ -187,7 +187,7 @@ class StockController extends BaseController
|
|||||||
'products' => $this->getDatabase()->products()->where('id != :1 AND parent_product_id IS NULL and active = 1', $product->id)->orderBy('name', 'COLLATE NOCASE'),
|
'products' => $this->getDatabase()->products()->where('id != :1 AND parent_product_id IS NULL and active = 1', $product->id)->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'isSubProductOfOthers' => $this->getDatabase()->products()->where('parent_product_id = :1', $product->id)->count() !== 0,
|
'isSubProductOfOthers' => $this->getDatabase()->products()->where('parent_product_id = :1', $product->id)->count() !== 0,
|
||||||
'mode' => 'edit',
|
'mode' => 'edit',
|
||||||
'quConversions' => $this->getDatabase()->quantity_unit_conversions(),
|
'quConversions' => $this->getDatabase()->quantity_unit_conversions()->where('product_id', $product->id),
|
||||||
'productBarcodeUserfields' => $this->getUserfieldsService()->GetFields('product_barcodes'),
|
'productBarcodeUserfields' => $this->getUserfieldsService()->GetFields('product_barcodes'),
|
||||||
'productBarcodeUserfieldValues' => $this->getUserfieldsService()->GetAllValues('product_barcodes')
|
'productBarcodeUserfieldValues' => $this->getUserfieldsService()->GetAllValues('product_barcodes')
|
||||||
]);
|
]);
|
||||||
|
@@ -380,3 +380,8 @@ msgstr ""
|
|||||||
|
|
||||||
msgid "Ukrainian"
|
msgid "Ukrainian"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Kilogram"
|
||||||
|
msgid_plural "Kilograms"
|
||||||
|
msgstr[0] ""
|
||||||
|
msgstr[1] ""
|
||||||
|
@@ -1217,9 +1217,6 @@ msgstr ""
|
|||||||
msgid "QU conversions"
|
msgid "QU conversions"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgid "Product overrides"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
msgid "Override for product"
|
msgid "Override for product"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@@ -2350,3 +2347,6 @@ msgstr ""
|
|||||||
|
|
||||||
msgid "QU conversions resolved"
|
msgid "QU conversions resolved"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Product specifc QU conversions"
|
||||||
|
msgstr ""
|
||||||
|
@@ -293,16 +293,10 @@ $("#delete-current-product-picture-button").on("click", function(e)
|
|||||||
|
|
||||||
var quConversionsTable = $('#qu-conversions-table-products').DataTable({
|
var quConversionsTable = $('#qu-conversions-table-products').DataTable({
|
||||||
'order': [[1, 'asc']],
|
'order': [[1, 'asc']],
|
||||||
"orderFixed": [[4, 'asc']],
|
|
||||||
'columnDefs': [
|
'columnDefs': [
|
||||||
{ 'orderable': false, 'targets': 0 },
|
{ 'orderable': false, 'targets': 0 },
|
||||||
{ 'searchable': false, "targets": 0 },
|
{ 'searchable': false, "targets": 0 }
|
||||||
{ 'visible': false, 'targets': 4 }
|
].concat($.fn.dataTable.defaults.columnDefs)
|
||||||
].concat($.fn.dataTable.defaults.columnDefs),
|
|
||||||
'rowGroup': {
|
|
||||||
enable: true,
|
|
||||||
dataSrc: 4
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
$('#qu-conversions-table-products tbody').removeClass("d-none");
|
$('#qu-conversions-table-products tbody').removeClass("d-none");
|
||||||
quConversionsTable.columns.adjust().draw();
|
quConversionsTable.columns.adjust().draw();
|
||||||
|
@@ -65,6 +65,8 @@ class DemoDataGeneratorService extends BaseService
|
|||||||
INSERT INTO quantity_units (id, name, name_plural) VALUES (11, '{$this->__n_sql(1, 'Milliliter', 'Milliliters')}', '{$this->__n_sql(2, 'Milliliter', 'Milliliters')}'); --11
|
INSERT INTO quantity_units (id, name, name_plural) VALUES (11, '{$this->__n_sql(1, 'Milliliter', 'Milliliters')}', '{$this->__n_sql(2, 'Milliliter', 'Milliliters')}'); --11
|
||||||
DELETE FROM quantity_units WHERE name = '{$this->__t_sql('Slice')}';
|
DELETE FROM quantity_units WHERE name = '{$this->__t_sql('Slice')}';
|
||||||
INSERT INTO quantity_units (id, name, name_plural) VALUES (12, '{$this->__n_sql(1, 'Slice', 'Slices')}', '{$this->__n_sql(2, 'Slice', 'Slices')}'); --12
|
INSERT INTO quantity_units (id, name, name_plural) VALUES (12, '{$this->__n_sql(1, 'Slice', 'Slices')}', '{$this->__n_sql(2, 'Slice', 'Slices')}'); --12
|
||||||
|
DELETE FROM quantity_units WHERE name = '{$this->__t_sql('Kilogram')}';
|
||||||
|
INSERT INTO quantity_units (id, name, name_plural) VALUES (13, '{$this->__n_sql(1, 'Kilogram', 'Kilograms')}', '{$this->__n_sql(2, 'Kilogram', 'Kilograms')}'); --13
|
||||||
|
|
||||||
INSERT INTO product_groups(name) VALUES ('01 {$this->__t_sql('Sweets')}'); --1
|
INSERT INTO product_groups(name) VALUES ('01 {$this->__t_sql('Sweets')}'); --1
|
||||||
INSERT INTO product_groups(name) VALUES ('02 {$this->__t_sql('Bakery products')}'); --2
|
INSERT INTO product_groups(name) VALUES ('02 {$this->__t_sql('Bakery products')}'); --2
|
||||||
@@ -112,6 +114,8 @@ class DemoDataGeneratorService extends BaseService
|
|||||||
|
|
||||||
INSERT INTO quantity_unit_conversions (from_qu_id, to_qu_id, factor, product_id) VALUES (3, 12, 10, 10);
|
INSERT INTO quantity_unit_conversions (from_qu_id, to_qu_id, factor, product_id) VALUES (3, 12, 10, 10);
|
||||||
INSERT INTO quantity_unit_conversions (from_qu_id, to_qu_id, factor, product_id) VALUES (3, 8, 1000, 22);
|
INSERT INTO quantity_unit_conversions (from_qu_id, to_qu_id, factor, product_id) VALUES (3, 8, 1000, 22);
|
||||||
|
INSERT INTO quantity_unit_conversions (from_qu_id, to_qu_id, factor) VALUES (13, 8, 1000);
|
||||||
|
INSERT INTO quantity_unit_conversions (from_qu_id, to_qu_id, factor) VALUES (9, 11, 1000);
|
||||||
|
|
||||||
INSERT INTO shopping_list (note, amount) VALUES ('{$this->__t_sql('Some good snacks')}', 1);
|
INSERT INTO shopping_list (note, amount) VALUES ('{$this->__t_sql('Some good snacks')}', 1);
|
||||||
INSERT INTO shopping_list (product_id, amount) VALUES (20, 1);
|
INSERT INTO shopping_list (product_id, amount) VALUES (20, 1);
|
||||||
|
@@ -706,7 +706,7 @@
|
|||||||
<div class="col">
|
<div class="col">
|
||||||
<div class="title-related-links">
|
<div class="title-related-links">
|
||||||
<h4>
|
<h4>
|
||||||
{{ $__t('QU conversions') }}
|
{{ $__t('Product specifc QU conversions') }}
|
||||||
</h4>
|
</h4>
|
||||||
<button class="btn btn-outline-dark d-md-none mt-2 float-right order-1 order-md-3"
|
<button class="btn btn-outline-dark d-md-none mt-2 float-right order-1 order-md-3"
|
||||||
type="button"
|
type="button"
|
||||||
@@ -731,9 +731,6 @@
|
|||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h5 id="qu-conversion-headline-info"
|
|
||||||
class="text-muted font-italic"></h5>
|
|
||||||
|
|
||||||
<table id="qu-conversions-table-products"
|
<table id="qu-conversions-table-products"
|
||||||
class="table table-sm table-striped nowrap w-100">
|
class="table table-sm table-striped nowrap w-100">
|
||||||
<thead>
|
<thead>
|
||||||
@@ -747,14 +744,12 @@
|
|||||||
<th class="allow-grouping">{{ $__t('Quantity unit from') }}</th>
|
<th class="allow-grouping">{{ $__t('Quantity unit from') }}</th>
|
||||||
<th class="allow-grouping">{{ $__t('Quantity unit to') }}</th>
|
<th class="allow-grouping">{{ $__t('Quantity unit to') }}</th>
|
||||||
<th>{{ $__t('Factor') }}</th>
|
<th>{{ $__t('Factor') }}</th>
|
||||||
<th class="allow-grouping">{{ $__t('Group')}}</th>
|
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody class="d-none">
|
<tbody class="d-none">
|
||||||
@if($mode == "edit")
|
@if($mode == "edit")
|
||||||
@foreach($quConversions as $quConversion)
|
@foreach($quConversions as $quConversion)
|
||||||
@if($quConversion->product_id == $product->id || $quConversion->product_id == null && ($quConversion->product_id != null || $quConversion->from_qu_id == $product->qu_id_purchase || $quConversion->from_qu_id == $product->qu_id_stock || $quConversion->to_qu_id == $product->qu_id_purchase || $quConversion->to_qu_id == $product->qu_id_stock))
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="fit-content border-right">
|
<td class="fit-content border-right">
|
||||||
<a class="btn btn-sm btn-info show-as-dialog-link @if($quConversion->product_id == null) disabled @endif"
|
<a class="btn btn-sm btn-info show-as-dialog-link @if($quConversion->product_id == null) disabled @endif"
|
||||||
@@ -776,18 +771,10 @@
|
|||||||
<td>
|
<td>
|
||||||
<span class="locale-number locale-number-quantity-amount">{{ $quConversion->factor }}</span>
|
<span class="locale-number locale-number-quantity-amount">{{ $quConversion->factor }}</span>
|
||||||
</td>
|
</td>
|
||||||
<td class="d-none">
|
|
||||||
@if($quConversion->product_id != null)
|
|
||||||
{{ $__t('Product overrides') }}
|
|
||||||
@else
|
|
||||||
{{ $__t('Default conversions') }}
|
|
||||||
@endif
|
|
||||||
</td>
|
|
||||||
<td class="font-italic">
|
<td class="font-italic">
|
||||||
{!! $__t('This means 1 %1$s is the same as %2$s %3$s', FindObjectInArrayByPropertyValue($quantityunits, 'id', $quConversion->from_qu_id)->name, '<span class="locale-number locale-number-quantity-amount">' . $quConversion->factor . '</span>', $__n($quConversion->factor, FindObjectInArrayByPropertyValue($quantityunits, 'id', $quConversion->to_qu_id)->name, FindObjectInArrayByPropertyValue($quantityunits, 'id', $quConversion->to_qu_id)->name_plural, true)) !!}
|
{!! $__t('This means 1 %1$s is the same as %2$s %3$s', FindObjectInArrayByPropertyValue($quantityunits, 'id', $quConversion->from_qu_id)->name, '<span class="locale-number locale-number-quantity-amount">' . $quConversion->factor . '</span>', $__n($quConversion->factor, FindObjectInArrayByPropertyValue($quantityunits, 'id', $quConversion->to_qu_id)->name, FindObjectInArrayByPropertyValue($quantityunits, 'id', $quConversion->to_qu_id)->name_plural, true)) !!}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@endif
|
|
||||||
@endforeach
|
@endforeach
|
||||||
@endif
|
@endif
|
||||||
</tbody>
|
</tbody>
|
||||||
|
Reference in New Issue
Block a user