From 79e216c3bfd02bb2b7a95816140d1a0f6bf93abe Mon Sep 17 00:00:00 2001 From: mateuswetah Date: Tue, 9 Apr 2024 10:56:23 -0300 Subject: [PATCH] Fixes event and error handling of geocoordinate metadata. --- .../geocoordinate/TainacanGeoCoordinate.vue | 8 ++++---- src/views/admin/js/item-metadata-mixin.js | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/views/admin/components/metadata-types/geocoordinate/TainacanGeoCoordinate.vue b/src/views/admin/components/metadata-types/geocoordinate/TainacanGeoCoordinate.vue index ec2fe320f..be78ab8f9 100644 --- a/src/views/admin/components/metadata-types/geocoordinate/TainacanGeoCoordinate.vue +++ b/src/views/admin/components/metadata-types/geocoordinate/TainacanGeoCoordinate.vue @@ -213,8 +213,8 @@ this.$emitter.off('itemEditionFormResize', () => this.handleWindowResize(mapComponentRef)); }, methods: { - onUpdateFromLatitudeInput: _.debounce( function($event) { - let newLatitude = $event.target.value; + onUpdateFromLatitudeInput: _.debounce( function(value) { + let newLatitude = value; if ( !isNaN(newLatitude) ) { this.latitude = newLatitude; this.onUpdateFromLatitudeAndLongitude(); @@ -232,8 +232,8 @@ } } }, 250), - onUpdateFromLongitudeInput: _.debounce( function($event) { - let newLongitude = $event.target.value; + onUpdateFromLongitudeInput: _.debounce( function(value) { + let newLongitude = value; if ( !isNaN(newLongitude) ) { this.longitude = newLongitude; diff --git a/src/views/admin/js/item-metadata-mixin.js b/src/views/admin/js/item-metadata-mixin.js index d79ef6ec8..7e2fd20b8 100644 --- a/src/views/admin/js/item-metadata-mixin.js +++ b/src/views/admin/js/item-metadata-mixin.js @@ -22,7 +22,7 @@ export const itemMetadataMixin = { if (this.errors.length > 0 && this.errors[0].errors && this.errors[0].errors.length) { for (let error of this.errors) - this.$emitter.on('updateErrorMessageOf#' + (error.metadatum_id + (error.parent_meta_id ? '-' + error.parent_meta_id : '')), error); + this.$emitter.emit('updateErrorMessageOf#' + (error.metadatum_id + (error.parent_meta_id ? '-' + error.parent_meta_id : '')), error); } }, deep: true @@ -61,13 +61,13 @@ export const itemMetadataMixin = { this.$emitter.emit('updateErrorMessageOf#' + (parentMetaId ? metadatumId + '-' + parentMetaId : metadatumId), this.errors[index]); }) .catch(({ error_message, error, item_metadata }) => { - this.isUpdatingValues = false;; + this.isUpdatingValues = false; let index = this.errors.findIndex( errorItem => errorItem.metadatum_id == metadatumId && (parentMetaId ? errorItem.parent_meta_id == parentMetaId : true )); let messages = []; for (let index in error) messages.push(error[index]); - + if ( index >= 0) { Object.assign( this.errors, { [index]: { metadatum_id: metadatumId, parent_meta_id: parentMetaId, errors: messages } }); this.$emitter.emit('updateErrorMessageOf#' + (parentMetaId ? metadatumId + '-' + parentMetaId : metadatumId), this.errors[index]);