diff --git a/src/fragments/forms/map-form/components/optimization/components/edit-dialog/edit-dialog.js b/src/fragments/forms/map-form/components/optimization/components/edit-dialog/edit-dialog.js index 814e674a3..5555efd9c 100644 --- a/src/fragments/forms/map-form/components/optimization/components/edit-dialog/edit-dialog.js +++ b/src/fragments/forms/map-form/components/optimization/components/edit-dialog/edit-dialog.js @@ -164,10 +164,6 @@ export default { methods: { vehicleColors, vehicleIcon, - isEnabled (action) { - const disabled = this.disabledActions - return !disabled.includes(action) - }, // close editJobs dialog closeEditModal () { this.isEditOpen = false @@ -212,7 +208,8 @@ export default { for (const s of this.editSkills) { editSkillIds.push(s.id) } - for (const id of newSkillIds.sort((a,b) => a-b)) { + newSkillIds.sort((a,b) => a-b) + for (const id of newSkillIds) { if (!editSkillIds.includes(id)) { this.editSkills.push(new Skill(' Skill from imported ' + this.content.item + ' ' + id, id)) } diff --git a/src/fragments/forms/map-form/components/optimization/components/optimization-details/optimization-details.js b/src/fragments/forms/map-form/components/optimization/components/optimization-details/optimization-details.js index ce897f123..df4ce410f 100644 --- a/src/fragments/forms/map-form/components/optimization/components/optimization-details/optimization-details.js +++ b/src/fragments/forms/map-form/components/optimization/components/optimization-details/optimization-details.js @@ -42,7 +42,7 @@ export default { } const routes = [] for (const key in this.localMapViewData.routes) { - const route = Object.assign({}, this.localMapViewData.routes[key]) + const route = {...this.localMapViewData.routes[key]} if (!route.summary) { route.summary = geoUtils.getHumanizedTimeAndDistance({distance: route.distance, duration:route.duration, unit: 'm'}, this.$t('global.units')) this.parseSteps(route.steps) diff --git a/src/fragments/forms/map-form/components/optimization/components/optimization-import/optimization-import.js b/src/fragments/forms/map-form/components/optimization/components/optimization-import/optimization-import.js index b9862b131..fbd7bb21c 100644 --- a/src/fragments/forms/map-form/components/optimization/components/optimization-import/optimization-import.js +++ b/src/fragments/forms/map-form/components/optimization/components/optimization-import/optimization-import.js @@ -100,7 +100,7 @@ export default { parsedInfos = this.parseCsvFile(fileContent) } else if (type.indexOf('json') > -1 || type.indexOf('geojson') > -1) { const parsedJson = JSON.parse(fileContent) - if (parsedJson && parsedJson.features) { + if (parsedJson?.features) { parsedInfos = this.parseGeojsonFile(parsedJson) } else { parsedInfos= this.parseJsonFile(parsedJson) diff --git a/src/models/job.js b/src/models/job.js index 466124101..d0091d699 100644 --- a/src/models/job.js +++ b/src/models/job.js @@ -185,7 +185,7 @@ class Job extends Place { } } - if (props.skills && props.skills.length) { + if (props.skills?.length) { let skillIds = [] for (const skill of props.skills) { skillIds.push(skill.id) diff --git a/src/support/app-modes/strategies/optimization-mode.js b/src/support/app-modes/strategies/optimization-mode.js index b8f308375..ddd8255b1 100644 --- a/src/support/app-modes/strategies/optimization-mode.js +++ b/src/support/app-modes/strategies/optimization-mode.js @@ -25,14 +25,14 @@ class OptimizationMode { /** * Build an optimization route * @param {*} appRouteData - * @returns {Object} route like {name: 'MapDirections', params: {...} } + * @param options + * @returns {Object} route like {name: 'MapDirections', params: {...}} */ getRoute = (appRouteData, options = null) => { options = options || appRouteData.options const params = RouteUtils.buildRouteParams(appRouteData, options) // Build and return the route object - const route = { name: 'MapOptimization', params: params } - return route + return {name: 'MapOptimization', params: params} } /** @@ -50,7 +50,7 @@ class OptimizationMode { // In the 'directions' mode, the options parameter may contain an options object // that is expected to be used as the ORS API request options (avoid_polygons, avoid_features etc.) // So, as they are stringified on the url, we try to parse them back to an object - if (appRouteData.options && appRouteData.options.options) { + if (appRouteData.options?.options) { appRouteData.options.options = Utils.tryParseJson(appRouteData.options.options) || appRouteData.options.options }