From 9df464c869e88756f67f63b8ff18be96a0d0d6af Mon Sep 17 00:00:00 2001 From: jackie / Andrea Ida Malkah Klaura <jackie@diebin.at> Date: Fri, 9 Aug 2019 12:16:02 +0200 Subject: [PATCH] FEAT: add conflicMode --- src/components/EmissionManager.vue | 44 ++++++++++++++++--- src/components/EmissionManagerModalCreate.vue | 11 ++--- 2 files changed, 42 insertions(+), 13 deletions(-) diff --git a/src/components/EmissionManager.vue b/src/components/EmissionManager.vue index 155b5b6b..5c94c329 100644 --- a/src/components/EmissionManager.vue +++ b/src/components/EmissionManager.vue @@ -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 = [] diff --git a/src/components/EmissionManagerModalCreate.vue b/src/components/EmissionManagerModalCreate.vue index 115581e9..d2012c38 100644 --- a/src/components/EmissionManagerModalCreate.vue +++ b/src/components/EmissionManagerModalCreate.vue @@ -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 = { -- GitLab