Skip to content
Snippets Groups Projects
Commit 9df464c8 authored by jackie / Andrea Ida Malkah Klaura's avatar jackie / Andrea Ida Malkah Klaura
Browse files

FEAT: add conflicMode

parent 6753fbe5
No related branches found
No related tags found
No related merge requests found
......@@ -30,6 +30,22 @@
<hr>
<b-alert
variant="danger"
:show="conflictMode"
>
<b-row>
<b-col cols="12">
<div align="center">
<h4>Conflict Resolution</h4>
</div>
</b-col>
<b-col>
... coming soon ...
</b-col>
</b-row>
</b-alert>
<full-calendar
ref="calendar"
editable="false"
......@@ -68,6 +84,16 @@ export default {
timeslots: [],
calendarSlots: [],
// flags for loading data
loaded: {
shows: false,
timeslots: false,
calendarSlots: false,
},
// this flag signifies if we are in conflict resolution mode
conflictMode: false,
// this is the whole configuration for our schedule calendar, including
// simple event handlers that do not need the whole components scope
calendarConfig: {
......@@ -92,11 +118,6 @@ export default {
element.attr('title', event.title);
},
},
loaded: {
shows: false,
timeslots: false,
calendarSlots: false,
},
}
},
......@@ -155,10 +176,21 @@ export default {
start = view.start.format()
end = view.end.format()
}
this.loadTimeslots(start, end)
// if we are in conflict resolution mode we do not load all timeslots
// but only the conflicting ones
if (this.conflictMode) {
this.loadConflictSlots(start, end)
} else {
this.loadTimeslots(start, end)
}
}
},
resolve (data) {
this.$log.debug('resolve', data)
this.conflictMode = true
},
loadCalendarSlots () {
this.loaded.calendarSlots = false
this.calendarSlots = []
......
......@@ -70,7 +70,8 @@ export default {
this.submit()
// otherwise we have to resolve the conflict first.
} else {
this.resolve(response.data)
this.$parent.resolve(response.data)
this.$refs.modalEmissionManagerCreate.hide()
}
}).catch(error => {
this.$log.error(error.response.status + ' ' + error.response.statusText)
......@@ -92,10 +93,10 @@ export default {
// TODO: check for complex schedules with resolved conflicts
if (response.data.projected === undefined) {
this.$parent.renderView(null)
this.$refs.modalEmissionManagerCreate.hide()
} else {
this.resolve(response.data)
this.$parent.resolve(response.data)
}
this.$refs.modalEmissionManagerCreate.hide()
}).catch(error => {
this.$log.error(error.response.status + ' ' + error.response.statusText)
this.$log.error(error.response)
......@@ -104,10 +105,6 @@ export default {
})
},
resolve (data) {
this.$log.debug('resolve', data)
},
// initialise a new schedule and open the modal
open (start, end) {
this.newSchedule = {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment