Commit 4b7b1aeb authored by Andrea Ida Malkah Klaura's avatar Andrea Ida Malkah Klaura
Browse files

load names of rtrcategories and types id

parent e7ffcd0b
......@@ -106,19 +106,25 @@
<b-col lg="6">
<p>
<b>Show type: <img src="../assets/16x16/emblem-system.png" alt="edit" v-on:click="notYetImplemented" /> :</b>
<!-- TODO: discuss: should this be visible to show owners or only to administrators? -->
<!-- TODO: fetch name for type_id from steering api -->
<b>Type:</b> {{ shows[currentShow].type_id }}
<img src="../assets/16x16/emblem-system.png" alt="edit" v-on:click="notYetImplemented" />
<span v-if="loaded.type">
<span v-if="current.type.length === 0"><small><i>(none set)</i></small></span>
<span v-else>{{ current.type[0].type }}</span>
</span>
<span v-else><img src="../assets/radio.gif" height="24px" alt="loading data" /></span>
</p>
</b-col>
<b-col lg="6">
<p>
<b>Funding category (eg. for RTR) <img src="../assets/16x16/emblem-system.png" alt="edit" v-on:click="notYetImplemented" /> :</b>
<!-- TODO: discuss: should this be visible to show owners or only to administrators? -->
<!-- TODO: fetch name for rtrcategory_id from steering api -->
<b>RTR-Category:</b> {{ shows[currentShow].rtrcategory_id }}
<img src="../assets/16x16/emblem-system.png" alt="edit" v-on:click="notYetImplemented" />
<span v-if="loaded.rtrcategory">
<span v-if="current.rtrcategory.length === 0"><small><i>(none set)</i></small></span>
<span v-else>{{ current.rtrcategory[0].rtrcategory }}</span>
</span>
<span v-else><img src="../assets/radio.gif" height="24px" alt="loading data" /></span>
</p>
</b-col>
......@@ -144,9 +150,9 @@
<b-col lg="6">
<p>
<b>Fallback Pool:</b>
<span v-if="shows[currentShow].fallback_pool === ''"><small><i>(none set)</i></small></span>
<span v-else>{{ shows[currentShow].fallback_pool }}</span>
<b>Fallback List/Pool:</b>
<span v-if="shows[currentShow].fallback_id === ''"><small><i>(none set)</i></small></span>
<span v-else>ID: {{ shows[currentShow].fallback_id }}</span>
<img src="../assets/16x16/emblem-system.png" alt="edit" v-on:click="notYetImplemented" />
</p>
</b-col>
......@@ -276,7 +282,8 @@ export default {
languages: false,
topics: false,
musicfocus: false,
rtrcategory: false
rtrcategory: false,
type: false
},
current: {
categories: [],
......@@ -284,7 +291,8 @@ export default {
languages: [],
topics: [],
musicfocus: [],
rtrcategory: []
rtrcategory: [],
type: []
}
}
},
......@@ -324,6 +332,7 @@ export default {
this.getTopics()
this.getMusicfocus()
this.getRTRCategory()
this.getType()
// now fetch the single timeslots for a given show from PV backend
axios.get(process.env.API_STEERING_SHOWS + this.currentShowID + '/timeslots/').then(response => {
this.timeslots = response.data
......@@ -467,20 +476,35 @@ export default {
getRTRCategory: function () {
this.current.rtrcategory = []
var loadingError = false
if (this.shows[this.currentShow].rtrcategory.length === 0) {
if (typeof this.shows[this.currentShow].rtrcategory !== 'number') {
this.loaded.rtrcategory = true
} else {
for (var i in this.shows[this.currentShow].rtrcategory) {
axios.get(process.env.API_STEERING + 'rtrcategories/' + this.shows[this.currentShow].rtrcategory[i]).then(response => {
console.log(response.data)
this.current.rtrcategory.push(response.data)
}).catch(error => {
loadingError = true
alert('There was an error fetching RTR category from the server: ' + error)
})
}
axios.get(process.env.API_STEERING + 'rtrcategories/' + this.shows[this.currentShow].rtrcategory).then(response => {
this.current.rtrcategory.push(response.data)
}).catch(error => {
loadingError = true
alert('There was an error fetching RTR category from the server: ' + error)
})
}
if (!loadingError) this.loaded.rtrcategory = true
},
getType: function () {
this.current.type = []
var loadingError = false
console.log(this.shows[this.currentShow])
console.log(typeof this.shows[this.currentShow].type)
if (typeof this.shows[this.currentShow].type !== 'number') {
this.loaded.type = true
} else {
axios.get(process.env.API_STEERING + 'types/' + this.shows[this.currentShow].type).then(response => {
console.log(response.data)
this.current.type.push(response.data)
}).catch(error => {
loadingError = true
alert('There was an error fetching show type from the server: ' + error)
})
}
if (!loadingError) this.loaded.categories = true
if (!loadingError) this.loaded.type = true
},
notYetImplemented: function () {
alert('By the mighty witchcraftry of the mother of time!\n\nThis feature is not implemented yet.')
......
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