diff --git a/bower.json b/bower.json index 8eeeb40a..b7bf4bbb 100644 --- a/bower.json +++ b/bower.json @@ -15,6 +15,7 @@ "datatables.net-responsive": "2.1.1", "datatables.net-responsive-bs": "2.1.1", "jquery-timeago": "1.5.4", - "toastr": "2.1.3" + "toastr": "2.1.3", + "tagmanager": "3.0.2" } } diff --git a/views/layout.php b/views/layout.php index 6dc5f675..429e77b0 100644 --- a/views/layout.php +++ b/views/layout.php @@ -18,6 +18,7 @@ + @@ -122,6 +123,7 @@ + diff --git a/views/productform.js b/views/productform.js index 172129c7..ed4ebf53 100644 --- a/views/productform.js +++ b/views/productform.js @@ -32,21 +32,37 @@ $(function() { + $('#barcode-taginput').tagsManager({ + 'hiddenTagListName': 'barcode', + 'tagsContainer': '#barcode-taginput-container' + }); + + if (Grocy.EditMode === 'edit') + { + Grocy.FetchJson('/api/get-object/products/' + Grocy.EditObjectId, + function (product) + { + if (product.barcode.length > 0) + { + product.barcode.split(',').forEach(function(item) + { + $('#barcode-taginput').tagsManager('pushTag', item); + }); + } + }, + function(xhr) + { + console.error(xhr); + } + ); + } + $('#qu_factor_purchase_to_stock').trigger('change'); $('#name').focus(); $('#product-form').validator(); $('#product-form').validator('validate'); }); -$('#barcode').keydown(function(event) -{ - if (event.keyCode === 13) //Enter - { - event.preventDefault(); - return false; - } -}); - $('.input-group-qu').on('change', function(e) { var factor = $('#qu_factor_purchase_to_stock').val(); diff --git a/views/productform.php b/views/productform.php index 45550b79..7235cdcd 100644 --- a/views/productform.php +++ b/views/productform.php @@ -13,19 +13,15 @@
-
- -
- -
- -
-
-
+
+ + +
+