Skip to content
Snippets Groups Projects
Commit d535d766 authored by Oskar Langås Eidem's avatar Oskar Langås Eidem
Browse files

queue form working

parent 8f364c5c
Branches
No related tags found
No related merge requests found
Pipeline #171512 failed
......@@ -12,7 +12,7 @@
</div>
<!-- queueForm her -->
<QueueForm :exercise="exercise" v-if="this.queueForm"/>
<QueueForm @queueSubmit="openQueueForm" :exercise="exercise" :subject="subject" v-if="this.queueForm"/>
</template>
......@@ -23,7 +23,7 @@ import QueueForm from './QueueForm.vue'
export default {
components: {QueueForm},
props: ['exercise'],
props: ['exercise', 'subject'],
data() {
return {
......@@ -35,6 +35,7 @@ export default {
openQueueForm() {
this.queueForm = !this.queueForm
}
}
}
......
<template>
<div class="exercises">
<div v-for="exercise in exercises" :key="exercise.assignment_number">
<Exercise :exercise="exercise"/>
<Exercise :exercise="exercise" :subject="subject"/>
</div>
</div>
......@@ -15,7 +15,7 @@ import Exercise from './Exercise.vue'
export default {
components: {Exercise},
props: ['exercises']
props: ['exercises', 'subject']
}
......
......@@ -10,9 +10,9 @@
<option value="D-119">D-119</option>
</select>
<div v-if="$store.state.location != 'Hjemme'">
<div >
<select v-model="table">
<option value="1">1</option>
<option value="1" default>1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
......@@ -24,13 +24,13 @@
<div class="checkbox">
<input type="checkbox" v-model="godkjenning">
<input type="checkbox" v-model="hjelp">
<input type="checkbox" @click="checkBox('Godkjenning')">
<input type="checkbox" @click="checkBox('Hjelp')">
</div>
<div class="submit">
<button type="button" @click="$store.commit('submitQueue')">Queue</button> <!-- lag metode i store for å handle submit -->
<button type="button" @click="submitQueue">Queue</button>
</div>
</form>
......@@ -39,30 +39,40 @@
</template>
<script>
import SubjectService from '../service/SubjectService.js'
export default {
props: ['exercise'],
props: ['exercise', 'subject'],
computed: {
location: {
get() {
return this.$store.state.location;
},
set(newLocation) {
this.$store.commit('setCurrentLocation', newLocation)
data() {
return {
location: '',
table: '',
type: '',
}
},
table: {
get() {
return this.$store.state.table;
},
set(newTable) {
this.$store.commit('setTable', newTable)
methods: {
submitQueue() {
if(this.type == '') {
// display some error message
}
SubjectService.postNewSubjectQueuePosition(this.subject, this.exercise.assignment_number, this.type, this.$store.state.token).
then(ans => {
console.log('post request answer: ', ans)
this.$emit('queueSubmit')
}).catch(err => console.log(err))
},
checkBox(type) {
this.type = type
}
}
}
</script>
......
......@@ -10,7 +10,7 @@
<div class="exercises">
<Exercises :exercises="exercises"/>
<Exercises :exercises="exercises" :subject="subject"/>
</div>
</div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment