mirror of
https://github.com/grocy/grocy.git
synced 2026-04-05 12:26:15 +02:00
Fix some implementation errors
This commit is contained in:
parent
bda2a742ae
commit
6b5440cf7a
|
|
@ -10,7 +10,7 @@ class BasePicker
|
|||
this.$ = scopeSelector != null ? $(scopeSelector).find : $;
|
||||
|
||||
this.picker = null;
|
||||
this.input_element;
|
||||
this.input_element = null;
|
||||
|
||||
this.basename = basename;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ class barcodescanner
|
|||
|
||||
setTimeout(function()
|
||||
{
|
||||
this.$scope(".barcodescanner-input:visible").each(function()
|
||||
self.$(".barcodescanner-input:visible").each(function()
|
||||
{
|
||||
if ($(this).hasAttr("disabled"))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -41,9 +41,11 @@ class numberpicker
|
|||
|
||||
var observer = new MutationObserver((mutations) => self.handleObservedChange(mutations));
|
||||
|
||||
this.$(".numberpicker").each(() => observer.observe(this, {
|
||||
attributes: true
|
||||
}));
|
||||
var elements = this.$(".numberpicker");
|
||||
for (let element of elements)
|
||||
{
|
||||
observer.observe(element, { attributes: true });
|
||||
}
|
||||
|
||||
this.$(".numberpicker").attr("data-initialised", "true"); // Dummy change to trigger MutationObserver above once
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ class productpicker extends BasePicker
|
|||
this.Grocy.Use('barcodescanner');
|
||||
|
||||
this.picker = this.$('#product_id');
|
||||
this.inputElement = this.$('#product_id_text_input');
|
||||
this.input_element = this.$('#product_id_text_input');
|
||||
|
||||
var self = this;
|
||||
|
||||
|
|
@ -142,14 +142,14 @@ class productpicker extends BasePicker
|
|||
|
||||
Disable()
|
||||
{
|
||||
this.inputElement.attr("disabled", "");
|
||||
this.input_element.attr("disabled", "");
|
||||
this.$("#barcodescanner-start-button").attr("disabled", "");
|
||||
this.$("#barcodescanner-start-button").addClass("disabled");
|
||||
}
|
||||
|
||||
Enable()
|
||||
{
|
||||
this.inputElement.removeAttr("disabled");
|
||||
this.input_element.removeAttr("disabled");
|
||||
this.$("#barcodescanner-start-button").removeAttr("disabled");
|
||||
this.$("#barcodescanner-start-button").removeClass("disabled");
|
||||
}
|
||||
|
|
@ -330,16 +330,16 @@ class productpicker extends BasePicker
|
|||
}
|
||||
|
||||
// Don't know why the blur event does not fire immediately ... this works...
|
||||
this.inputElement
|
||||
this.input_element
|
||||
.focusout()
|
||||
.focus()
|
||||
.blur();
|
||||
|
||||
this.inputElement.val(barcode);
|
||||
this.input_element.val(barcode);
|
||||
|
||||
setTimeout(function()
|
||||
{
|
||||
self.inputElement
|
||||
self.input_element
|
||||
.focusout()
|
||||
.focus()
|
||||
.blur();
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ class shoppinglocationpicker extends BasePicker
|
|||
this.picker = this.$(this.basename);
|
||||
this.input_element = this.$(this.basename + '_text_input');
|
||||
|
||||
this.initCombobox('.recipe-combobox');
|
||||
this.initCombobox('.shopping-location-combobox');
|
||||
this.prefill();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ class userpicker extends BasePicker
|
|||
this.picker = this.$(this.basename);
|
||||
this.input_element = this.$(this.basename + '_text_input');
|
||||
|
||||
this.initCombobox('.recipe-combobox');
|
||||
this.initCombobox('.user-combobox');
|
||||
this.prefill();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -221,14 +221,14 @@ class GrocyClass
|
|||
let scopeName = scope || "";
|
||||
// initialize Components only once per scope
|
||||
if (this.initComponents.find(elem => elem == componentName + scopeName))
|
||||
return this.components[componentName + scopeName];
|
||||
return this.Components[componentName + scopeName];
|
||||
|
||||
if (Object.prototype.hasOwnProperty.call(components, componentName))
|
||||
{
|
||||
// add-then-init to resolve circular dependencies
|
||||
this.initComponents.push(componentName);
|
||||
var component = components[componentName](this, scope);
|
||||
this.components[componentName + scopeName] = component;
|
||||
var component = new components[componentName](this, scope);
|
||||
this.Components[componentName + scopeName] = component;
|
||||
return component;
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -85,14 +85,14 @@ class GrocyProxy
|
|||
let scopeName = scope || "";
|
||||
// initialize Components only once per scope
|
||||
if (this.initComponents.find(elem => elem == componentName + scopeName))
|
||||
return this.components[componentName + scopeName];
|
||||
return this.Components[componentName + scopeName];
|
||||
|
||||
if (Object.prototype.hasOwnProperty.call(components, componentName))
|
||||
{
|
||||
// add-then-init to resolve circular dependencies
|
||||
this.initComponents.push(componentName);
|
||||
var component = components[componentName](this, scope);
|
||||
this.components[componentName + scopeName] = component;
|
||||
var component = new components[componentName](this, scope);
|
||||
this.Components[componentName + scopeName] = component;
|
||||
return component;
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -8,8 +8,6 @@
|
|||
$scope = $(scope).find;
|
||||
}
|
||||
|
||||
Grocy.Use("userpicker");
|
||||
|
||||
var tasksTable = $scope('#tasks-table').DataTable({
|
||||
'order': [[2, 'asc']],
|
||||
'columnDefs': [
|
||||
|
|
|
|||
|
|
@ -659,7 +659,7 @@
|
|||
<script>
|
||||
let viewjsname = null;
|
||||
@hasSection('viewJsName')
|
||||
viejsname = "@yield('viewJsName')";
|
||||
viewjsname = "@yield('viewJsName')";
|
||||
@endif
|
||||
GrocyClass.createSingleton(GrocyConfig, viewjsname);
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -585,6 +585,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
@if($mode == 'edit')
|
||||
<div class="row mt-2">
|
||||
<div class="col clearfix">
|
||||
<div class="title-related-links">
|
||||
|
|
@ -612,6 +613,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="row @if(GROCY_FEATURE_FLAG_STOCK) mt-5 @endif">
|
||||
<div class="col">
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user