Commit 3888ff92 authored by Andrea Ida Malkah Klaura's avatar Andrea Ida Malkah Klaura
Browse files

FIX: now saving show predecessor due to pv/#25 fix

parent 81033f44
......@@ -131,9 +131,9 @@
<b-col lg="6">
<p>
<!-- TODO: discuss: should this be visible to show owners or only to administrators? -->
<!-- TODO: fetch name for predecessor_id from steering api -->
<!-- TODO: fetch name for predecessor from steering api -->
<b-badge variant="light">Predecessor:</b-badge>
<span v-if="shows[currentShow].predecessor_id === null"><small><i>This show has no predecessor show.</i></small></span>
<span v-if="shows[currentShow].predecessor === null"><small><i>This show has no predecessor show.</i></small></span>
<span v-else>{{ predecessorName }}</span>
<img src="../assets/16x16/emblem-system.png" alt="edit" v-on:click="$refs.appModalShow.showPredecessor()" />
</p>
......@@ -309,7 +309,7 @@ export default {
computed: {
predecessorName: function () {
for (var i in this.shows) {
if (this.shows[i].id === this.shows[this.currentShow].predecessor_id) {
if (this.shows[i].id === this.shows[this.currentShow].predecessor) {
return this.shows[i].name
}
}
......
......@@ -396,21 +396,18 @@ export default {
}
},
savePredecessor (event) {
if (this.id !== this.show.predecessor_id) {
if (this.id !== this.show.predecessor) {
event.preventDefault()
this.backupid = this.show.predecessor_id
this.show.predecessor_id = this.id
console.log(this.show.predecessor_id)
this.backupid = this.show.predecessor
this.show.predecessor = this.id
console.log(this.show.predecessor)
axios.put(process.env.API_STEERING_SHOWS + this.show.id + '/', this.show, {
withCredentials: true,
headers: { 'Authorization': 'Bearer ' + this.$parent.$parent.user.access_token }
}).then(response => {
// this.$parent.shows[this.$parent.currentShow].predecessor_id = this.show.predecessor_id
console.log('saved ' + this.show.predecessor_id)
console.log(response)
this.$refs.modalShowPredecessor.hide()
}).catch(error => {
this.show.predecessor_id = this.backupid
this.show.predecessor = this.backupid
console.log('Error:')
console.log(error)
alert('Error: could not save the new show information')
......@@ -555,7 +552,7 @@ export default {
this.$refs.modalShowCBAid.show()
},
showPredecessor () {
this.id = this.show.predecessor_id
this.id = this.show.predecessor
this.$refs.modalShowPredecessor.show()
},
showType () {
......
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