Skip to content

Commit

Permalink
wip: jobProps
Browse files Browse the repository at this point in the history
  • Loading branch information
blackbirdem committed May 27, 2024
1 parent ad38ad3 commit f7d53d0
Showing 1 changed file with 29 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -382,12 +382,39 @@ export default {
jobProps.skills = skillIds
}
for (const prop of ['service', 'priority', 'delivery', 'pickup', 'time_windows']) {
if (job[prop].length) {
if (job[prop].length && job[prop][0] !== 0) {
jobProps[prop] = job[prop]
}
}
return jobProps
},
parseProps(jobProps) {
let parsedProps = []
for (const j in jobProps) {
let [parsedJobProps] = {id: j.id}
for (const prop of ['service', 'priority', 'delivery', 'pickup', 'time_windows']) {
if (j[prop].length && j[prop][0] !== 0) {
parsedJobProps[prop] = j[prop]
}
}
let propSkills = []
for (const s in j.skills) {
let skillIds = []
for (const skill in this.skills) {
skillIds.push(skill.id)
}
if (skillIds.includes(s)) {
propSkills.push(this.skills[s-1])
} else {
propSkills.push(new Skill('Skill from added ' + this.$t('optimization.job') + ' ' + j.id, s))
}
}
parsedJobProps.skills = propSkills

parsedProps.push(parsedJobProps)
}
return parsedProps
},
/**
* Request and draw a route based on the value of multiples places input
* @returns {Promise}
Expand Down Expand Up @@ -468,7 +495,7 @@ export default {
// object reference because it is a prop
const defaultJobs = this.jobs
const defaultVehicles = this.vehicles
const jobProps = this.$store.getters.appRouteData.options.jobProps
const jobProps = this.parseProps(this.$store.getters.appRouteData.options.jobProps)
const urlVehicles = this.$store.getters.appRouteData.options.vehicles
const places = this.$store.getters.appRouteData.places
let storedJobs = localStorage.getItem('jobs')
Expand Down

0 comments on commit f7d53d0

Please sign in to comment.