Paketmarke autoselect product according to weight

This commit is contained in:
OpenXE 2024-03-19 18:10:43 +00:00
parent 632f1c1a09
commit 56cfc54aa5

View File

@ -239,6 +239,9 @@ SPDX-License-Identifier: LicenseRef-EGPL-3.1
const createshipmentapp = new Vue({ const createshipmentapp = new Vue({
el: '#createshipmentapp', el: '#createshipmentapp',
data: [JSON], data: [JSON],
mounted() {
this.autoselectproduct();
},
computed: { computed: {
total_value() { total_value() {
let sum = 0; let sum = 0;
@ -287,17 +290,20 @@ SPDX-License-Identifier: LicenseRef-EGPL-3.1
}, },
customsRequired: function () { customsRequired: function () {
return this.countries[this.form.country].eu == '0'; 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 () { beforeUpdate: function () {
if (!this.productAvailable(this.products[this.form.product])) { this.autoselectproduct();
for (prod in this.products) {
if (!this.productAvailable(this.products[prod]))
continue;
this.form.product = prod;
break;
}
}
} }
}) })
</script> </script>