From 56cfc54aa5a83206cac19c897dd6210dfb6d5818 Mon Sep 17 00:00:00 2001 From: OpenXE <> Date: Tue, 19 Mar 2024 18:10:43 +0000 Subject: [PATCH] Paketmarke autoselect product according to weight --- .../versandarten/content/createshipment.tpl | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/www/lib/versandarten/content/createshipment.tpl b/www/lib/versandarten/content/createshipment.tpl index 232fa674..e9d9f97d 100644 --- a/www/lib/versandarten/content/createshipment.tpl +++ b/www/lib/versandarten/content/createshipment.tpl @@ -239,6 +239,9 @@ SPDX-License-Identifier: LicenseRef-EGPL-3.1 const createshipmentapp = new Vue({ el: '#createshipmentapp', data: [JSON], + mounted() { + this.autoselectproduct(); + }, computed: { total_value() { let sum = 0; @@ -287,17 +290,20 @@ SPDX-License-Identifier: LicenseRef-EGPL-3.1 }, customsRequired: function () { return this.countries[this.form.country].eu == '0'; + }, + autoselectproduct: function () { + if (!this.productAvailable(this.products[this.form.product])) { + for (prod in this.products) { + if (!this.productAvailable(this.products[prod])) + continue; + this.form.product = prod; + break; + } + } } }, beforeUpdate: function () { - if (!this.productAvailable(this.products[this.form.product])) { - for (prod in this.products) { - if (!this.productAvailable(this.products[prod])) - continue; - this.form.product = prod; - break; - } - } + this.autoselectproduct(); } })