Skip to content

Commit

Permalink
feat: unassigned jobs have different color markers
Browse files Browse the repository at this point in the history
 references #447
  • Loading branch information
blackbirdem committed Jul 25, 2024
1 parent af100e6 commit 1826083
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/fragments/html-marker/HtmlMarker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div>
<div :style="{background: color}" class="custom-html-icon-div">
<img alt="Map marker icon"v-if="markerImg" class="custom-html-icon-img" :src="markerImg">
<div v-else-if="markerNumber" class="custom-html-icon-txt" :class="{'double-digit-text': doubleDigitText, 'triple-digit-text': tripleDigitText, 'four-digit-text': fourDigitText}">{{markerNumber}} </div>
<div v-else-if="markerNumber" class="custom-html-icon-txt" :style="{color: textColor}" :class="{'double-digit-text': doubleDigitText, 'triple-digit-text': tripleDigitText, 'four-digit-text': fourDigitText}">{{markerNumber}} </div>
</div>
</div>
</template>
Expand Down
3 changes: 1 addition & 2 deletions src/fragments/html-marker/html-marker.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
margin-left: 7px;
margin-top: 7px;
height: 21px;
font-weight: 600;
color:white
font-weight: 600
}

.custom-html-icon-txt.double-digit-text {
Expand Down
4 changes: 4 additions & 0 deletions src/fragments/html-marker/html-marker.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ export default {
Type: String,
default: 'white'
},
textColor: {
Type: String,
default: 'white'
},
markerImg: {
type: String,
required: false
Expand Down
2 changes: 1 addition & 1 deletion src/fragments/map-view/map-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ export default {
markers = this.$root.appHooks.run('markersCreated', markers)
return markers
} else if (markersMapViewData.jobs.length || markersMapViewData.vehicles.length) {
return GeoUtils.buildOptimizationMarkers(markersMapViewData.jobs, markersMapViewData.vehicles)
return GeoUtils.buildOptimizationMarkers(markersMapViewData.jobs, markersMapViewData.vehicles, this.localMapViewData.rawData.unassigned)
}
},
/**
Expand Down
11 changes: 8 additions & 3 deletions src/support/geo-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -606,13 +606,18 @@ const geoUtils = {
}
return lng
},
buildOptimizationMarkers(jobs, vehicles) {
const markers = []
buildOptimizationMarkers(jobs, vehicles, unassignedJobs) {
let markers = []
let unassignedJobIds = []
for (const uaj of unassignedJobs) {
unassignedJobIds.push(uaj.id)
}
for (const job of jobs) {
if (job.lng && job.lat) {
// Build the marker
let propsData = {
color: theme.dark,
color: unassignedJobIds.includes(job.id) ? theme.neutral : theme.dark,
textColor: unassignedJobIds.includes(job.id) ? 'black' : 'white',
markerNumber: job.id.toString()
}
const htmlMarkerClass = Vue.extend(HtmlMarker)
Expand Down

0 comments on commit 1826083

Please sign in to comment.