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

implements single timeslot deletion for #30

parent ba7fc67f
No related branches found
No related tags found
No related merge requests found
......@@ -72,45 +72,45 @@
</ul>
</div>
<p>What do you want to do?</p>
<div align="center">
<b-button-group>
<b-button
variant="danger"
size="sm"
@click="deleteFullSchedule(schedule.id)"
>
<div v-if="loaded.scheduleTimeslots">
<span v-if="schedule.rrule === 1 && scheduleTimeslots.length === 1">Delete</span>
<div v-if="loaded.scheduleTimeslots">
<p>What do you want to do?</p>
<div align="center">
<b-button-group>
<b-button
variant="danger"
size="sm"
@click="deleteFullSchedule(schedule.id)"
>
<span v-if="scheduleTimeslots.length === 1">Delete</span>
<span v-else-if="schedule.rrule === 1">Delete both</span>
<span v-else>Delete schedule + all timeslots</span>
</div>
<div v-else>
<img
src="../assets/radio.gif"
alt="loading schedule data"
>
</div>
</b-button>
<b-button
v-if="schedule.rrule > 1"
variant="danger"
size="sm"
@click="notYetImplemented()"
>
Delete only this timeslot
</b-button>
<b-button
v-if="schedule.rrule > 1"
variant="danger"
size="sm"
@click="notYetImplemented()"
>
Delete this + all future timeslots
</b-button>
</b-button-group>
</b-button>
<b-button
v-if="schedule.rrule > 1 && scheduleTimeslots.length > 1"
variant="danger"
size="sm"
@click="deleteSingleTimeslot(schedule.id, timeslot.id)"
>
Delete only this timeslot
</b-button>
<b-button
v-if="schedule.rrule > 1 && scheduleTimeslots.length > 1"
variant="danger"
size="sm"
@click="deleteAllFutureTimeslots(schedule.id, timeslot.id)"
>
Delete this + all future timeslots
</b-button>
</b-button-group>
</div>
</div>
<div v-else>
<img
src="../assets/radio.gif"
alt="loading timeslot data"
>
</div>
</div>
<div v-else>
......@@ -161,6 +161,27 @@ export default {
})
},
deleteSingleTimeslot (scheduleId, timeslotId) {
let uri = process.env.VUE_APP_API_STEERING + 'shows/' + this.show.id +
'/schedules/' + scheduleId + '/timeslots/' + timeslotId + '/'
axios.delete(uri, {
withCredentials: true,
headers: { 'Authorization': 'Bearer ' + this.$parent.$parent.user.access_token }
}).then(() => {
this.$refs.modalEmissionManagerEdit.hide()
this.$parent.renderView(null)
}).catch(error => {
this.$log.error(error.response.status + ' ' + error.response.statusText)
this.$log.error(error.response)
alert('Error: could not delete full schedule. See console for details.')
})
},
deleteAllFutureTimeslots (scheduleId, timeslotId) {
this.$log.debug(scheduleId, timeslotId)
this.notYetImplemented()
},
loadSchedule (id) {
this.loaded.schedule = false
let uri = process.env.VUE_APP_API_STEERING + 'shows/' + this.show.id + '/schedules/' + id + '/'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment