Updated Home to using store.
This commit is contained in:
parent
15c5e6d39c
commit
eb0c5abc7b
@ -3,69 +3,69 @@
|
||||
<h1>Training Observations</h1>
|
||||
<b-row align-h="center">
|
||||
<b-col>
|
||||
<b-form-group label="Site">
|
||||
<b-form-select :value="site" @input="setSite" :options="siteOptions"></b-form-select>
|
||||
</b-form-group>
|
||||
<b-form-group label="Site">
|
||||
<b-form-select :value="site" @input="setSite" :options="siteOptions"></b-form-select>
|
||||
</b-form-group>
|
||||
</b-col>
|
||||
</b-row>
|
||||
<b-row align-h="center">
|
||||
<b-col>
|
||||
<b-form-group label="Description">
|
||||
<b-form-input :value="description" @input="setDescription" type="text"></b-form-input>
|
||||
</b-form-group>
|
||||
<b-form-group label="Description">
|
||||
<b-form-input :value="description" @input="setDescription" type="text"></b-form-input>
|
||||
</b-form-group>
|
||||
</b-col>
|
||||
</b-row>
|
||||
<b-row align-h="center">
|
||||
<b-col>
|
||||
<b-form-group label="Type">
|
||||
<b-form-select :value="type" @input="setType">
|
||||
<option :value=null>Select a training type</option>
|
||||
<option value="INITIAL">INITIAL</option>
|
||||
<option value="CONTINUING">CONTINUING</option>
|
||||
</b-form-select>
|
||||
</b-form-group>
|
||||
<b-form-group label="Type">
|
||||
<b-form-select :value="type" @input="setType">
|
||||
<option :value=null>Select a training type</option>
|
||||
<option value="INITIAL">INITIAL</option>
|
||||
<option value="CONTINUING">CONTINUING</option>
|
||||
</b-form-select>
|
||||
</b-form-group>
|
||||
</b-col>
|
||||
</b-row>
|
||||
<b-row align-h="center">
|
||||
<b-col>
|
||||
<b-form-group label="Tutor(s)">
|
||||
<p v-if="site == null">Select a site first.</p>
|
||||
<v-icon name="spinner" spin v-if="loadingTutors"/>
|
||||
<b-form-checkbox-group :value="tutors" @input="setTutors" :options="tutorOptions"></b-form-checkbox-group>
|
||||
</b-form-group>
|
||||
<b-form-group label="Tutor(s)">
|
||||
<p v-if="site == null">Select a site first.</p>
|
||||
<v-icon name="spinner" spin v-if="loadingTutors" />
|
||||
<b-form-checkbox-group :value="tutors" @input="setTutors" :options="tutorOptions"></b-form-checkbox-group>
|
||||
</b-form-group>
|
||||
</b-col>
|
||||
</b-row>
|
||||
<b-row align-h="center">
|
||||
<b-col>
|
||||
<b-button>Start</b-button>
|
||||
<b-button>Start</b-button>
|
||||
</b-col>
|
||||
</b-row>
|
||||
</b-container>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Vue from 'vue'
|
||||
import 'vue-awesome/icons/spinner';
|
||||
import { mapState, mapMutations } from 'vuex'
|
||||
import Vue from "vue";
|
||||
import "vue-awesome/icons/spinner";
|
||||
import { mapState, mapMutations } from "vuex";
|
||||
export default {
|
||||
name: "home",
|
||||
data () {
|
||||
data() {
|
||||
return {
|
||||
siteOptions: [],
|
||||
tutorOptions: [],
|
||||
loadingTutors: false
|
||||
}
|
||||
};
|
||||
},
|
||||
mounted () {
|
||||
Vue.axios.get("/api/site/all").then((response) => {
|
||||
mounted() {
|
||||
Vue.axios.get("/api/site/all").then(response => {
|
||||
this.siteOptions = response.data;
|
||||
})
|
||||
});
|
||||
},
|
||||
computed: {
|
||||
...mapState(["site", "description", "type", "tutors"])
|
||||
},
|
||||
watch: {
|
||||
site: function () {
|
||||
site: function() {
|
||||
this.loadingTutors = true;
|
||||
this.tutorOptions = [];
|
||||
this.tutors = [];
|
||||
@ -74,12 +74,12 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
...mapMutations(["setSite", "setDescription", "setType", "setTutors"]),
|
||||
getTutors: function () {
|
||||
if(this.site != null){
|
||||
Vue.axios.get("/api/tutor/site/" + this.site).then((response) => {
|
||||
getTutors: function() {
|
||||
if (this.site != null) {
|
||||
Vue.axios.get("/api/tutor/site/" + this.site).then(response => {
|
||||
this.tutorOptions = response.data;
|
||||
this.loadingTutors = false;
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user