Merge branch 'WarehouseShippingNote/fix-hour-entry' into 'master'

Updated Shipping Note

See merge request fronk/thetool!1129
This commit is contained in:
Luca Haid
2025-03-21 08:02:25 +00:00
2 changed files with 7 additions and 3 deletions
@@ -120,6 +120,7 @@ Vue.component('warehouse-shipping-note-modal', {
:submit-loading="hoursLoading" :submit-loading="hoursLoading"
@updateField-userId="updateCarId" @updateField-userId="updateCarId"
@updateField-carId="updateKilometer" @updateField-carId="updateKilometer"
@updateField-externalCar="updateKilometer"
:config="hoursConfig" v-model="shippingNote.hoursEntries" sm row/> :config="hoursConfig" v-model="shippingNote.hoursEntries" sm row/>
<hr> <hr>
@@ -194,7 +195,8 @@ Vue.component('warehouse-shipping-note-modal', {
this.hoursLoading = false; this.hoursLoading = false;
}, },
async updateKilometer(carId) { async updateKilometer(carId) {
if (!carId) return this.$refs.hoursManager.updateField('kilometerCount', null); console.log(carId);
if (!carId || carId === '0') return this.$refs.hoursManager.updateField('kilometerCount', null);
this.hoursLoading = true; this.hoursLoading = true;
const delAddr = this.shippingNote.deliveryAddressLine + ' ' + this.shippingNote.deliveryAddressPLZ + ' ' + this.shippingNote.deliveryAddressCity; 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); const {data} = await axios.get(window.TT_CONFIG["BASE_PATH"] + '/WarehouseShippingNote/getDistance?from=Xinon%20GmbH&to=' + delAddr);
@@ -171,7 +171,7 @@ Vue.component('tt-positions-manager',
}, },
checkEmitDisplayValueAutocomplete() { checkEmitDisplayValueAutocomplete() {
for (const [key, field] of Object.entries(this.config.fields)) { for (const [key, field] of Object.entries(this.config.fields)) {
if (field.type === 'autocomplete' && field.emitDisplayValue && (isNaN(this.formData[key]) || !this.formData[key]) && this.$refs['autocomplete-' + key][0]) { if (typeof field.showCondition === 'function' && field.showCondition(this.formData) === true && field.type === 'autocomplete' && field.emitDisplayValue && (isNaN(this.formData[key]) || !this.formData[key]) && this.$refs['autocomplete-' + key][0]) {
this.$set(this.formData, key + '_text', this.$refs['autocomplete-' + key][0].displayValue); this.$set(this.formData, key + '_text', this.$refs['autocomplete-' + key][0].displayValue);
this.$delete(this.formData, key); this.$delete(this.formData, key);
} }
@@ -207,7 +207,9 @@ Vue.component('tt-positions-manager',
resetForm() { resetForm() {
this.formData = {}; this.formData = {};
for (const [key, field] of Object.entries(this.config.fields)) { for (const [key, field] of Object.entries(this.config.fields)) {
if (field.type === 'autocomplete' && field.emitDisplayValue && this.$refs['autocomplete-' + key][0]) { if (
typeof field.showCondition === 'function' && field.showCondition(this.formData) === true &&
field.type === 'autocomplete' && field.emitDisplayValue && this.$refs['autocomplete-' + key][0]) {
this.$refs['autocomplete-' + key][0].displayValue = ''; this.$refs['autocomplete-' + key][0].displayValue = '';
} }
if (field.inputType === 'date') { if (field.inputType === 'date') {