diff --git a/public/js/pages/WarehouseShippingNote/WarehouseShippingNoteModal.js b/public/js/pages/WarehouseShippingNote/WarehouseShippingNoteModal.js
index f96ab9554..1517abf74 100644
--- a/public/js/pages/WarehouseShippingNote/WarehouseShippingNoteModal.js
+++ b/public/js/pages/WarehouseShippingNote/WarehouseShippingNoteModal.js
@@ -21,6 +21,7 @@ Vue.component('warehouse-shipping-note-modal', {
textElements: [],
hoursEntries: [],
},
+ hoursLoading: false,
geoAddr: '',
positionsConfig: {
customOrdering: 'article',
@@ -112,6 +113,7 @@ Vue.component('warehouse-shipping-note-modal', {
Stunden
@@ -145,6 +147,7 @@ Vue.component('warehouse-shipping-note-modal', {
this.shippingNote.deliveryAddressPLZ = address["postcode"];
this.shippingNote.deliveryAddressCity = address["village"] ?? address.city ?? address["town"];
+ this.updateKilometer().then();
}
},
methods: {
@@ -166,15 +169,19 @@ Vue.component('warehouse-shipping-note-modal', {
},
async updateCarId(userId) {
if (!userId) return this.$refs.hoursManager.updateField('carId', null);
+ this.hoursLoading = true;
const {data} = await axios.get(window.TT_CONFIG["BASE_PATH"] + '/WarehouseShippingNote/timerecordingCarForUser?userId=' + userId);
if (data.status === 'USER_NO_CAR') this.$refs.hoursManager.updateField('carId', null);
else this.$refs.hoursManager.updateField('carId', data.id);
+ this.hoursLoading = false;
},
async updateKilometer(carId) {
if (!carId) return this.$refs.hoursManager.updateField('kilometerCount', null);
+ this.hoursLoading = true;
const delAddr = this.shippingNote.deliveryAddressLine + ' ' + this.shippingNote.deliveryAddressPLZ + ' ' + this.shippingNote.deliveryAddressCity;
const {data} = await axios.get(window.TT_CONFIG["BASE_PATH"] + '/WarehouseShippingNote/getDistance?from=Xinon%20GmbH&to=' + delAddr);
this.$refs.hoursManager.updateField('kilometerCount', data.distance);
+ this.hoursLoading = false;
}
}
})
diff --git a/public/plugins/vue/tt-components/css/tt-table.css b/public/plugins/vue/tt-components/css/tt-table.css
index e52c028a5..5cd8b44b9 100644
--- a/public/plugins/vue/tt-components/css/tt-table.css
+++ b/public/plugins/vue/tt-components/css/tt-table.css
@@ -345,4 +345,24 @@ td {
.tt-table-header {
vertical-align: top !important;
text-align: center;
-}
\ No newline at end of file
+}
+
+/* tt-button */
+.spinner {
+ display: inline-block;
+ width: 11px;
+ height: 11px;
+ border: 2px solid rgba(255, 255, 255, 0.3);
+ border-radius: 50%;
+ border-top-color: #fff;
+ animation: spin 1s ease-in-out infinite;
+}
+
+@keyframes spin {
+ to { transform: rotate(360deg); }
+}
+
+.btn-loading {
+ cursor: not-allowed;
+ opacity: 0.7;
+}
diff --git a/public/plugins/vue/tt-components/tt-button.js b/public/plugins/vue/tt-components/tt-button.js
index 65e7f0f2a..472ae9cb7 100644
--- a/public/plugins/vue/tt-components/tt-button.js
+++ b/public/plugins/vue/tt-components/tt-button.js
@@ -1,42 +1,63 @@
// noinspection JSCheckFunctionSignatures
Vue.component('tt-button', {
//language=Vue
- template: `
-
- `, props: {
- sm: {type: Boolean, default: false},
- icon: {type: String, required: false},
- text: {type: String, required: false},
- href: {type: String, required: false},
+ template: `
+
+ `,
+ props: {
+ sm: {type: Boolean, default: false},
+ icon: {type: String, required: false},
+ text: {type: String, required: false},
+ href: {type: String, required: false},
additionalClass: {type: String, required: false},
- // TODO: maybe instead of browser confirmation add a custom beautiful confirmation dialog
- confirmText: {type: String, required: false},
- }, computed: {
+ confirmText: {type: String, required: false},
+ loading: {type: Boolean, default: false},
+ },
+ computed: {
buttonClasses() {
const classes = {
'btn-sm': this.sm,
+ 'btn-loading': this.loading
}
- if (!this.additionalClass) return classes
-
- for (const className of this.additionalClass.split(' ')) {
- classes[className] = true
+ if (this.additionalClass) {
+ this.additionalClass.split(' ').forEach(className => {
+ classes[className] = true
+ })
}
return classes
}
+ },
+ methods: {
+ handleClick(event) {
+ if (this.loading) return event.preventDefault();
+ if (typeof this.confirmText === 'string' && !confirm(this.confirmText)) return event.preventDefault();
+
+ this.$emit('click', event)
+ }
}
-})
\ No newline at end of file
+})
diff --git a/public/plugins/vue/tt-components/tt-position-manager.js b/public/plugins/vue/tt-components/tt-position-manager.js
index 7fddfa35f..b663403a3 100644
--- a/public/plugins/vue/tt-components/tt-position-manager.js
+++ b/public/plugins/vue/tt-components/tt-position-manager.js
@@ -35,6 +35,7 @@ Vue.component('tt-positions-manager',
value: {type: [Array, String], required: false},
config: {type: Object, required: true},
groupMode: {type: Boolean, default: false},
+ submitLoading: {type: Boolean, default: false}
},
data() {
return {
@@ -98,7 +99,10 @@ Vue.component('tt-positions-manager',
-