diff --git a/js/grocy.js b/js/grocy.js index 7e5ad39a..8f2e9daf 100644 --- a/js/grocy.js +++ b/js/grocy.js @@ -31,6 +31,7 @@ class GrocyClass this.DatabaseChangedTime = null; this.IdleTime = 0; this.BaseUrl = config.BaseUrl; + this.CurrentUrlRelative = config.CurrentUrlRelative; this.Currency = config.Currency; this.FeatureFlags = config.FeatureFlags; this.QuantityUnits = config.QuantityUnits; @@ -325,6 +326,7 @@ class GrocyClass { let scopeId = uuid.v4() var grocyProxy = new GrocyProxy(this, "#" + scopeId, data.config, link); + var proxy = new Proxy(grocyProxy, { get: function(target, prop, receiver) { @@ -360,7 +362,7 @@ class GrocyClass }, }); - bootbox.dialog({ + var dialog = bootbox.dialog({ message: '
' + data.template + '
', size: 'large', backdrop: true, @@ -371,28 +373,41 @@ class GrocyClass className: 'btn-secondary responsive-button', callback: function() { - bootbox.hideAll(); + dialog.modal("hide"); } } }, - onShow: () => + onShow: (e) => { - // dialog div is alive, init view. - // this occurs before the view is shown. - grocyProxy.Initialize(proxy); - self.LoadView(data.viewJsName, "#" + scopeId, proxy); + if ($(e.target).find("#" + scopeId).length) + { + // dialog div is alive, init view. + // this occurs before the view is shown. + grocyProxy.Initialize(proxy); + self.LoadView(data.viewJsName, "#" + scopeId, proxy); + } + }, - onShown: () => + onShown: (e) => { - grocyProxy.FrontendHelpers.OnShown(); + if ($(e.target).find("#" + scopeId).length) + { + grocyProxy.FrontendHelpers.OnShown(); + } }, - onHide: () => + onHide: (e) => { - grocyProxy.Unload(); + if ($(e.target).find("#" + scopeId).length) + { + grocyProxy.Unload(); + } }, - onHidden: () => + onHidden: (e) => { - self.FrontendHelpers.EndUiBusy(); + if ($(e.target).find("#" + scopeId).length) + { + self.FrontendHelpers.EndUiBusy(); + } } }); }, diff --git a/js/lib/proxy.js b/js/lib/proxy.js index d97a7e52..901d3578 100644 --- a/js/lib/proxy.js +++ b/js/lib/proxy.js @@ -92,7 +92,7 @@ class GrocyProxy { // add-then-init to resolve circular dependencies this.initComponents.push(componentName + scopeName); - var component = new components[componentName](this.proxy, scope); + var component = new components[componentName](this.proxy, scopeName); this.Components[componentName + scopeName] = component; return component; } diff --git a/js/viewjs/equipmentform.js b/js/viewjs/equipmentform.js index 93d3f823..42f063ef 100644 --- a/js/viewjs/equipmentform.js +++ b/js/viewjs/equipmentform.js @@ -153,7 +153,9 @@ function equipmentformView(Grocy, scope = null) $scope("#instruction-manual-label").addClass("d-none"); $scope("#instruction-manual-label-none").removeClass("d-none"); }); + ResizeResponsiveEmbeds(); + $scope("embed").attr("src", $scope("embed").data("src")); userfields.Load(); $scope('#name').focus(); diff --git a/js/viewjs/purchase.js b/js/viewjs/purchase.js index 44af1bc8..7e313c54 100644 --- a/js/viewjs/purchase.js +++ b/js/viewjs/purchase.js @@ -364,7 +364,7 @@ function purchaseView(Grocy, scope = null) Grocy.Api.Get('objects/product_barcodes?query[]=barcode=' + elem.getAttribute("barcode"), function(barcodeResult) { - if (barcodeResult != null) + if (barcodeResult != null && barcodeResult !== undefined) { var barcode = barcodeResult[0]; $scope("#purchase-form").attr("data-used-barcode", barcode.id); diff --git a/js/viewjs/stockentries.js b/js/viewjs/stockentries.js index 17114224..1127ae9a 100644 --- a/js/viewjs/stockentries.js +++ b/js/viewjs/stockentries.js @@ -311,6 +311,11 @@ $scope("#productcard-modal").modal("show"); }); + top.on("click", "#kill-productcard-modal", function(e) + { + $scope("#productcard-modal").modal("hide"); + }); + } diff --git a/views/batteriesjournal.blade.php b/views/batteriesjournal.blade.php index 4a82b63e..2898980a 100644 --- a/views/batteriesjournal.blade.php +++ b/views/batteriesjournal.blade.php @@ -4,12 +4,17 @@ @section('activeNav', 'batteriesjournal') @section('viewJsName', 'batteriesjournal') +@php +$collapsed_none = $embedded ? '' : 'd-md-none'; +$collapsed_flex = $embedded ? '' : 'd-md-flex'; +@endphp + @section('content')

@yield('title')

- + id="kill-productcard-modal">{{ $__t('Close') }}
diff --git a/views/taskform.blade.php b/views/taskform.blade.php index 5c484639..992c54e8 100644 --- a/views/taskform.blade.php +++ b/views/taskform.blade.php @@ -15,6 +15,10 @@ EditObjectId: {{ $task->id }}, @endif @endsection +@php +$classes = $embedded ? '' : 'col-lg-6'; +@endphp + @section('content')
@@ -25,7 +29,7 @@ EditObjectId: {{ $task->id }},
-
+