Commit 4f0646e3 authored by jackie / Andrea Ida Malkah Klaura's avatar jackie / Andrea Ida Malkah Klaura
Browse files

FEAT: makes show switch timeslot clicked

parent 3d27674c
...@@ -2,7 +2,25 @@ ...@@ -2,7 +2,25 @@
<b-container> <b-container>
<b-row v-if="loaded.shows"> <b-row v-if="loaded.shows">
<b-col> <b-col>
<h3>{{ shows[currentShow].name }}</h3> <b-alert
:show="showChangedAlert.countdown"
@dismiss-count-down="showChangedAlertCountdown"
>
Selected new show: <b>{{ shows[currentShow].name }}</b>
<b-progress
variant="info"
animated
:max="showChangedAlert.seconds"
:value="showChangedAlert.countdown"
height="3px"
/>
</b-alert>
<b-alert
:show="!showChangedAlert.countdown"
variant="light"
>
Currently selected show: <b>{{ shows[currentShow].name }}</b>
</b-alert>
</b-col> </b-col>
<b-col align="right"> <b-col align="right">
<b-dropdown <b-dropdown
...@@ -112,6 +130,11 @@ export default { ...@@ -112,6 +130,11 @@ export default {
timeslots: [], timeslots: [],
calendarSlots: [], calendarSlots: [],
showChangedAlert: {
countdown: 0,
seconds: 3
},
// flags for loading data // flags for loading data
loaded: { loaded: {
shows: false, shows: false,
...@@ -168,6 +191,11 @@ export default { ...@@ -168,6 +191,11 @@ export default {
switchShow (index) { switchShow (index) {
this.currentShow = index this.currentShow = index
this.loadCalendarSlots() this.loadCalendarSlots()
this.showChangedAlert.countdown = this.showChangedAlert.seconds
},
showChangedAlertCountdown(countdown) {
this.showChangedAlert.countdown = countdown
}, },
getShowTitleById (id) { getShowTitleById (id) {
...@@ -179,6 +207,16 @@ export default { ...@@ -179,6 +207,16 @@ export default {
} }
}, },
getShowIndexById (id) {
let i = this.shows.findIndex(show => show.id === id)
if (i >= 0) {
return i
} else {
this.$log.error('No show found for id ' + id)
return 0
}
},
// this handler will be called whenever the user clicks on one of the // this handler will be called whenever the user clicks on one of the
// displayed timeslots // displayed timeslots
eventSelected (event) { eventSelected (event) {
...@@ -198,8 +236,11 @@ export default { ...@@ -198,8 +236,11 @@ export default {
// currently selected show. // currently selected show.
else { else {
let timeslot = this.timeslots.find(slot => slot.id === event.id) let timeslot = this.timeslots.find(slot => slot.id === event.id)
if (timeslot.show !== this.shows[this.currentShow].id) { return } if (timeslot.show !== this.shows[this.currentShow].id) {
this.$refs.appModalEmissionManagerEdit.open(timeslot, this.shows[this.currentShow]) this.switchShow(this.getShowIndexById(timeslot.show))
} else {
this.$refs.appModalEmissionManagerEdit.open(timeslot, this.shows[this.currentShow])
}
} }
}, },
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment