Prettier formatting.
This commit is contained in:
parent
9925a900c6
commit
586fa70104
@ -27,17 +27,18 @@
|
||||
|
||||
<!--suppress CssUnusedSymbol -->
|
||||
<style>
|
||||
#app {
|
||||
font-family: "Avenir", Helvetica, Arial, sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
text-align: center;
|
||||
color: #2c3e50;
|
||||
}
|
||||
.fade-enter-active, .fade-leave-active {
|
||||
transition: opacity .5s;
|
||||
}
|
||||
.fade-enter, .fade-leave-to /* .fade-leave-active below version 2.1.8 */ {
|
||||
opacity: 0;
|
||||
}
|
||||
#app {
|
||||
font-family: "Avenir", Helvetica, Arial, sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
text-align: center;
|
||||
color: #2c3e50;
|
||||
}
|
||||
.fade-enter-active,
|
||||
.fade-leave-active {
|
||||
transition: opacity 0.5s;
|
||||
}
|
||||
.fade-enter, .fade-leave-to /* .fade-leave-active below version 2.1.8 */ {
|
||||
opacity: 0;
|
||||
}
|
||||
</style>
|
||||
|
@ -13,51 +13,51 @@ const DBError = () => import("./views/DatabaseUnavailable.vue");
|
||||
Vue.use(Router);
|
||||
|
||||
export default new Router({
|
||||
routes: [
|
||||
{
|
||||
path: "/",
|
||||
name: "home",
|
||||
component: Home
|
||||
},
|
||||
{
|
||||
path: "/new",
|
||||
name: "startnew",
|
||||
component: StartNew
|
||||
},
|
||||
{
|
||||
path: "/observation",
|
||||
name: "observation",
|
||||
component: Observation
|
||||
},
|
||||
{
|
||||
path: "/stats",
|
||||
name: "stats",
|
||||
component: Stats
|
||||
},
|
||||
{
|
||||
path: "/newsite",
|
||||
name: "newSite",
|
||||
component: NewSite
|
||||
},
|
||||
{
|
||||
path: "/newtutor",
|
||||
name: "newTutor",
|
||||
component: NewTutor
|
||||
},
|
||||
{
|
||||
path: "/observations",
|
||||
name: "observations",
|
||||
component: ViewObservations
|
||||
},
|
||||
{
|
||||
path: "/complete",
|
||||
name: "complete",
|
||||
component: ObservationComplete
|
||||
},
|
||||
{
|
||||
path: "/dberror",
|
||||
name: "dberror",
|
||||
component: DBError
|
||||
}
|
||||
]
|
||||
routes: [
|
||||
{
|
||||
path: "/",
|
||||
name: "home",
|
||||
component: Home
|
||||
},
|
||||
{
|
||||
path: "/new",
|
||||
name: "startnew",
|
||||
component: StartNew
|
||||
},
|
||||
{
|
||||
path: "/observation",
|
||||
name: "observation",
|
||||
component: Observation
|
||||
},
|
||||
{
|
||||
path: "/stats",
|
||||
name: "stats",
|
||||
component: Stats
|
||||
},
|
||||
{
|
||||
path: "/newsite",
|
||||
name: "newSite",
|
||||
component: NewSite
|
||||
},
|
||||
{
|
||||
path: "/newtutor",
|
||||
name: "newTutor",
|
||||
component: NewTutor
|
||||
},
|
||||
{
|
||||
path: "/observations",
|
||||
name: "observations",
|
||||
component: ViewObservations
|
||||
},
|
||||
{
|
||||
path: "/complete",
|
||||
name: "complete",
|
||||
component: ObservationComplete
|
||||
},
|
||||
{
|
||||
path: "/dberror",
|
||||
name: "dberror",
|
||||
component: DBError
|
||||
}
|
||||
]
|
||||
});
|
||||
|
@ -23,13 +23,12 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import 'vue-awesome/icons/database'
|
||||
import 'vue-awesome/icons/ban'
|
||||
export default {
|
||||
name: "DatabaseUnavailable"
|
||||
}
|
||||
import "vue-awesome/icons/database";
|
||||
import "vue-awesome/icons/ban";
|
||||
export default {
|
||||
name: "DatabaseUnavailable"
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
@ -24,11 +24,10 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "Home"
|
||||
}
|
||||
export default {
|
||||
name: "Home"
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
@ -19,67 +19,66 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Vue from "vue";
|
||||
import Vue from "vue";
|
||||
|
||||
export default {
|
||||
name: "newSite",
|
||||
data: function () {
|
||||
return {
|
||||
siteName: null,
|
||||
dismissSecs: 5,
|
||||
dismissCountDown: 0,
|
||||
alertVariant: "info",
|
||||
alertText: "",
|
||||
submissionPassword: ""
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
Vue.axios
|
||||
.get("/site")
|
||||
.then(response => {
|
||||
})
|
||||
.catch(error => {
|
||||
if(error.response.status === 404){
|
||||
this.$router.push("/dberror");
|
||||
return;
|
||||
}
|
||||
this.alertText = error.response.data;
|
||||
this.alertVariant = "danger";
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
countDownChanged: function (dismissCountDown) {
|
||||
this.dismissCountDown = dismissCountDown;
|
||||
},
|
||||
showAlert: function () {
|
||||
this.dismissCountDown = this.dismissSecs;
|
||||
},
|
||||
onSubmit: function (e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
var form = document.getElementById("submission-form");
|
||||
let axiosConfig = {
|
||||
auth: {
|
||||
username: "admin",
|
||||
password: this.submissionPassword
|
||||
}
|
||||
};
|
||||
if (form.checkValidity()) {
|
||||
Vue.axios
|
||||
.post("/site", {'name': this.siteName}, axiosConfig)
|
||||
.then(response => {
|
||||
this.alertVariant = "success";
|
||||
this.alertText = "Successfully added " + response.data.text;
|
||||
this.showAlert();
|
||||
})
|
||||
.catch(error => {
|
||||
this.alertVariant = "danger";
|
||||
this.alertText = "Failed to add Site";
|
||||
this.showAlert();
|
||||
console.log(error);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
export default {
|
||||
name: "newSite",
|
||||
data: function() {
|
||||
return {
|
||||
siteName: null,
|
||||
dismissSecs: 5,
|
||||
dismissCountDown: 0,
|
||||
alertVariant: "info",
|
||||
alertText: "",
|
||||
submissionPassword: ""
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
Vue.axios
|
||||
.get("/site")
|
||||
.then(response => {})
|
||||
.catch(error => {
|
||||
if (error.response.status === 404) {
|
||||
this.$router.push("/dberror");
|
||||
return;
|
||||
}
|
||||
this.alertText = error.response.data;
|
||||
this.alertVariant = "danger";
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
countDownChanged: function(dismissCountDown) {
|
||||
this.dismissCountDown = dismissCountDown;
|
||||
},
|
||||
showAlert: function() {
|
||||
this.dismissCountDown = this.dismissSecs;
|
||||
},
|
||||
onSubmit: function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
var form = document.getElementById("submission-form");
|
||||
let axiosConfig = {
|
||||
auth: {
|
||||
username: "admin",
|
||||
password: this.submissionPassword
|
||||
}
|
||||
};
|
||||
if (form.checkValidity()) {
|
||||
Vue.axios
|
||||
.post("/site", { name: this.siteName }, axiosConfig)
|
||||
.then(response => {
|
||||
this.alertVariant = "success";
|
||||
this.alertText = "Successfully added " + response.data.text;
|
||||
this.showAlert();
|
||||
})
|
||||
.catch(error => {
|
||||
this.alertVariant = "danger";
|
||||
this.alertText = "Failed to add Site";
|
||||
this.showAlert();
|
||||
console.log(error);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
@ -43,10 +43,10 @@ export default {
|
||||
this.siteOptions = response.data;
|
||||
})
|
||||
.catch(error => {
|
||||
if(error.response.status === 404){
|
||||
this.$router.push("/dberror");
|
||||
return;
|
||||
}
|
||||
if (error.response.status === 404) {
|
||||
this.$router.push("/dberror");
|
||||
return;
|
||||
}
|
||||
this.alertText = error.response.data;
|
||||
this.alertVariant = "danger";
|
||||
});
|
||||
@ -70,10 +70,14 @@ export default {
|
||||
};
|
||||
if (form.checkValidity()) {
|
||||
Vue.axios
|
||||
.post("/tutor", {
|
||||
'siteId': this.siteSelection,
|
||||
'name': this.tutorName
|
||||
}, axiosConfig)
|
||||
.post(
|
||||
"/tutor",
|
||||
{
|
||||
siteId: this.siteSelection,
|
||||
name: this.tutorName
|
||||
},
|
||||
axiosConfig
|
||||
)
|
||||
.then(response => {
|
||||
this.alertVariant = "success";
|
||||
this.alertText = "Successfully added " + response.data.text;
|
||||
|
@ -105,204 +105,208 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import "bootstrap/dist/css/bootstrap.css";
|
||||
import "bootstrap-vue/dist/bootstrap-vue.css";
|
||||
import "vue-awesome/icons/tag";
|
||||
import {mapState} from "vuex";
|
||||
import Vue from "vue";
|
||||
import "bootstrap/dist/css/bootstrap.css";
|
||||
import "bootstrap-vue/dist/bootstrap-vue.css";
|
||||
import "vue-awesome/icons/tag";
|
||||
import { mapState } from "vuex";
|
||||
import Vue from "vue";
|
||||
|
||||
export default {
|
||||
name: "observation",
|
||||
data: function () {
|
||||
return {
|
||||
observations: [
|
||||
{
|
||||
type: null,
|
||||
rating: null,
|
||||
strengths: null,
|
||||
improvements: null
|
||||
}
|
||||
],
|
||||
totals: [0, 0, 0, 0, 0],
|
||||
submitPassword: null
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapState(["description", "type", "whom", "site", "tutors"])
|
||||
},
|
||||
methods: {
|
||||
addAnotherObservation: function () {
|
||||
this.observations.push({
|
||||
type: null,
|
||||
rating: null,
|
||||
strengths: null,
|
||||
improvements: null
|
||||
});
|
||||
Vue.nextTick(function () {
|
||||
window.scrollTo(
|
||||
0,
|
||||
document.body.scrollHeight || document.documentElement.scrollHeight
|
||||
);
|
||||
});
|
||||
},
|
||||
deleteObservation: function (index) {
|
||||
this.observations.splice(index, 1);
|
||||
if (this.observations.length === 0) {
|
||||
this.addAnotherObservation();
|
||||
}
|
||||
this.updateTotals();
|
||||
},
|
||||
changeType: function (index, ev) {
|
||||
this.observations[index].type = ev;
|
||||
this.updateTotals();
|
||||
},
|
||||
changeRating: function (index, ev) {
|
||||
this.observations[index].rating = parseInt(ev);
|
||||
this.updateTotals();
|
||||
},
|
||||
updateTotals: function () {
|
||||
var iTotals = [0, 0, 0, 0, 0];
|
||||
var counts = [0, 0, 0, 0, 0];
|
||||
this.observations.forEach(function (element) {
|
||||
if (element.rating > 0) {
|
||||
switch (element.type) {
|
||||
case "MONITORING":
|
||||
iTotals[0] += element.rating;
|
||||
counts[0] += 1;
|
||||
break;
|
||||
case "CONTROL":
|
||||
iTotals[1] += element.rating;
|
||||
counts[1] += 1;
|
||||
break;
|
||||
case "CONSERVATISM":
|
||||
iTotals[2] += element.rating;
|
||||
counts[2] += 1;
|
||||
break;
|
||||
case "TEAMWORK":
|
||||
iTotals[3] += element.rating;
|
||||
counts[3] += 1;
|
||||
break;
|
||||
case "KNOWLEDGE":
|
||||
iTotals[4] += element.rating;
|
||||
counts[4] += 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
for (var i = 0; i < iTotals.length; i++) {
|
||||
if (counts[i] !== 0) {
|
||||
this.totals[i] = (iTotals[i] / counts[i]).toFixed(1);
|
||||
} else {
|
||||
this.totals[i] = 0;
|
||||
}
|
||||
}
|
||||
},
|
||||
onSubmit: function (e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
var form = document.getElementById("submission-form");
|
||||
if (form.checkValidity()) {
|
||||
this.showModal();
|
||||
}
|
||||
form.classList.add("was-validated");
|
||||
},
|
||||
showModal() {
|
||||
this.$refs.submissionModal.show();
|
||||
},
|
||||
clearPassword() {
|
||||
this.submitPassword = null
|
||||
},
|
||||
handleOk(evt) {
|
||||
// Prevent modal from closing
|
||||
evt.preventDefault();
|
||||
if (this.submitPassword !== null) {
|
||||
this.handleSubmit()
|
||||
}
|
||||
},
|
||||
handleSubmit() {
|
||||
var form = document.getElementById("submission-form");
|
||||
if (form.checkValidity()) {
|
||||
let axiosConfig = {
|
||||
auth: {
|
||||
username: "admin",
|
||||
password: this.submitPassword
|
||||
}
|
||||
};
|
||||
var self = this;
|
||||
Vue.axios
|
||||
.post("/observation", {
|
||||
site: this.site,
|
||||
tutors: this.tutors,
|
||||
observed: this.description,
|
||||
whom: this.whom,
|
||||
type: this.type,
|
||||
entries: JSON.parse(JSON.stringify(this.observations))
|
||||
}, axiosConfig)
|
||||
.then(function (response) {
|
||||
self.$router.push("/complete");
|
||||
console.log(response);
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
}
|
||||
this.clearPassword();
|
||||
form.classList.add("was-validated");
|
||||
}
|
||||
export default {
|
||||
name: "observation",
|
||||
data: function() {
|
||||
return {
|
||||
observations: [
|
||||
{
|
||||
type: null,
|
||||
rating: null,
|
||||
strengths: null,
|
||||
improvements: null
|
||||
}
|
||||
],
|
||||
totals: [0, 0, 0, 0, 0],
|
||||
submitPassword: null
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapState(["description", "type", "whom", "site", "tutors"])
|
||||
},
|
||||
methods: {
|
||||
addAnotherObservation: function() {
|
||||
this.observations.push({
|
||||
type: null,
|
||||
rating: null,
|
||||
strengths: null,
|
||||
improvements: null
|
||||
});
|
||||
Vue.nextTick(function() {
|
||||
window.scrollTo(
|
||||
0,
|
||||
document.body.scrollHeight || document.documentElement.scrollHeight
|
||||
);
|
||||
});
|
||||
},
|
||||
deleteObservation: function(index) {
|
||||
this.observations.splice(index, 1);
|
||||
if (this.observations.length === 0) {
|
||||
this.addAnotherObservation();
|
||||
}
|
||||
this.updateTotals();
|
||||
},
|
||||
changeType: function(index, ev) {
|
||||
this.observations[index].type = ev;
|
||||
this.updateTotals();
|
||||
},
|
||||
changeRating: function(index, ev) {
|
||||
this.observations[index].rating = parseInt(ev);
|
||||
this.updateTotals();
|
||||
},
|
||||
updateTotals: function() {
|
||||
var iTotals = [0, 0, 0, 0, 0];
|
||||
var counts = [0, 0, 0, 0, 0];
|
||||
this.observations.forEach(function(element) {
|
||||
if (element.rating > 0) {
|
||||
switch (element.type) {
|
||||
case "MONITORING":
|
||||
iTotals[0] += element.rating;
|
||||
counts[0] += 1;
|
||||
break;
|
||||
case "CONTROL":
|
||||
iTotals[1] += element.rating;
|
||||
counts[1] += 1;
|
||||
break;
|
||||
case "CONSERVATISM":
|
||||
iTotals[2] += element.rating;
|
||||
counts[2] += 1;
|
||||
break;
|
||||
case "TEAMWORK":
|
||||
iTotals[3] += element.rating;
|
||||
counts[3] += 1;
|
||||
break;
|
||||
case "KNOWLEDGE":
|
||||
iTotals[4] += element.rating;
|
||||
counts[4] += 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
for (var i = 0; i < iTotals.length; i++) {
|
||||
if (counts[i] !== 0) {
|
||||
this.totals[i] = (iTotals[i] / counts[i]).toFixed(1);
|
||||
} else {
|
||||
this.totals[i] = 0;
|
||||
}
|
||||
}
|
||||
},
|
||||
onSubmit: function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
var form = document.getElementById("submission-form");
|
||||
if (form.checkValidity()) {
|
||||
this.showModal();
|
||||
}
|
||||
form.classList.add("was-validated");
|
||||
},
|
||||
showModal() {
|
||||
this.$refs.submissionModal.show();
|
||||
},
|
||||
clearPassword() {
|
||||
this.submitPassword = null;
|
||||
},
|
||||
handleOk(evt) {
|
||||
// Prevent modal from closing
|
||||
evt.preventDefault();
|
||||
if (this.submitPassword !== null) {
|
||||
this.handleSubmit();
|
||||
}
|
||||
},
|
||||
handleSubmit() {
|
||||
var form = document.getElementById("submission-form");
|
||||
if (form.checkValidity()) {
|
||||
let axiosConfig = {
|
||||
auth: {
|
||||
username: "admin",
|
||||
password: this.submitPassword
|
||||
}
|
||||
};
|
||||
var self = this;
|
||||
Vue.axios
|
||||
.post(
|
||||
"/observation",
|
||||
{
|
||||
site: this.site,
|
||||
tutors: this.tutors,
|
||||
observed: this.description,
|
||||
whom: this.whom,
|
||||
type: this.type,
|
||||
entries: JSON.parse(JSON.stringify(this.observations))
|
||||
},
|
||||
axiosConfig
|
||||
)
|
||||
.then(function(response) {
|
||||
self.$router.push("/complete");
|
||||
console.log(response);
|
||||
})
|
||||
.catch(function(error) {
|
||||
console.log(error);
|
||||
});
|
||||
}
|
||||
this.clearPassword();
|
||||
form.classList.add("was-validated");
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.top-buffer {
|
||||
margin-top: 10px;
|
||||
}
|
||||
.top-buffer {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.bottom-buffer {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.bottom-buffer {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.image-centered-text {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
font-size: 50px;
|
||||
color: white;
|
||||
text-shadow: -2px 0 black, 0 2px black, 2px 0 black, 0 -2px black;
|
||||
}
|
||||
.image-centered-text {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
font-size: 50px;
|
||||
color: white;
|
||||
text-shadow: -2px 0 black, 0 2px black, 2px 0 black, 0 -2px black;
|
||||
}
|
||||
|
||||
.image-opacity {
|
||||
opacity: 0.5;
|
||||
}
|
||||
.image-opacity {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.centered-image {
|
||||
position: relative;
|
||||
text-align: center;
|
||||
}
|
||||
.centered-image {
|
||||
position: relative;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
width: 160px; /* Set the width of the sidebar */
|
||||
position: fixed; /* Fixed Sidebar (stay in place on scroll) */
|
||||
z-index: 1; /* Stay on top */
|
||||
top: 20%; /* Stay at the top */
|
||||
left: 0;
|
||||
overflow-x: hidden; /* Disable horizontal scroll */
|
||||
padding-top: 20px;
|
||||
}
|
||||
.sidebar {
|
||||
width: 160px; /* Set the width of the sidebar */
|
||||
position: fixed; /* Fixed Sidebar (stay in place on scroll) */
|
||||
z-index: 1; /* Stay on top */
|
||||
top: 20%; /* Stay at the top */
|
||||
left: 0;
|
||||
overflow-x: hidden; /* Disable horizontal scroll */
|
||||
padding-top: 20px;
|
||||
}
|
||||
|
||||
.sidebar-vert-padding {
|
||||
margin-bottom: 25%;
|
||||
}
|
||||
.sidebar-vert-padding {
|
||||
margin-bottom: 25%;
|
||||
}
|
||||
|
||||
@media screen and (max-height: 500px) {
|
||||
.sidebar {
|
||||
top: 0; /* Stay at the top */
|
||||
}
|
||||
}
|
||||
@media screen and (max-height: 500px) {
|
||||
.sidebar {
|
||||
top: 0; /* Stay at the top */
|
||||
}
|
||||
}
|
||||
|
||||
img {
|
||||
height: 80px;
|
||||
object-fit: contain;
|
||||
}
|
||||
img {
|
||||
height: 80px;
|
||||
object-fit: contain;
|
||||
}
|
||||
</style>
|
||||
|
@ -9,15 +9,14 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {mapState} from "vuex";
|
||||
export default {
|
||||
name: "ObservationComplete",
|
||||
computed: {
|
||||
...mapState(["description", "type", "whom", "site", "tutors"])
|
||||
}
|
||||
}
|
||||
import { mapState } from "vuex";
|
||||
export default {
|
||||
name: "ObservationComplete",
|
||||
computed: {
|
||||
...mapState(["description", "type", "whom", "site", "tutors"])
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
@ -80,89 +80,91 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Vue from "vue";
|
||||
import "vue-awesome/icons/spinner";
|
||||
import "vue-awesome/icons/exclamation-circle";
|
||||
import {mapState, mapMutations} from "vuex";
|
||||
import Vue from "vue";
|
||||
import "vue-awesome/icons/spinner";
|
||||
import "vue-awesome/icons/exclamation-circle";
|
||||
import { mapState, mapMutations } from "vuex";
|
||||
|
||||
export default {
|
||||
name: "startnew",
|
||||
data() {
|
||||
return {
|
||||
siteOptions: [],
|
||||
tutorOptions: [],
|
||||
loadingTutors: false,
|
||||
loaded: false,
|
||||
errorMessage: null,
|
||||
errorStatus: null
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.resetStore();
|
||||
Vue.axios
|
||||
.get("/site")
|
||||
.then(response => {
|
||||
this.siteOptions = response.data;
|
||||
this.loaded = true;
|
||||
})
|
||||
.catch(error => {
|
||||
if(error.response.status === 404){
|
||||
this.$router.push("/dberror");
|
||||
return;
|
||||
}
|
||||
this.errorStatus = error.response.status;
|
||||
this.errorMessage = error.response.data;
|
||||
this.$refs.errorModal.show();
|
||||
});
|
||||
},
|
||||
computed: {
|
||||
...mapState(["site", "description", "type", "tutors", "whom"])
|
||||
},
|
||||
watch: {
|
||||
site: function () {
|
||||
this.loadingTutors = true;
|
||||
this.tutorOptions = [];
|
||||
this.tutors = [];
|
||||
this.getTutors();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
...mapMutations([
|
||||
"setSite",
|
||||
"setDescription",
|
||||
"setType",
|
||||
"setTutors",
|
||||
"setWhom",
|
||||
"resetStore"
|
||||
]),
|
||||
getTutors: function () {
|
||||
if (this.site != null) {
|
||||
Vue.axios.get("/site/" + this.site + "/tutors").then(response => {
|
||||
this.tutorOptions = response.data;
|
||||
this.loadingTutors = false;
|
||||
}).catch(error => {
|
||||
if(error.response.status === 404){
|
||||
this.$router.push("/dberror");
|
||||
return;
|
||||
|
||||
}
|
||||
this.errorStatus = error.response.status;
|
||||
this.errorMessage = error.response.data;
|
||||
this.$refs.errorModal.show();
|
||||
});
|
||||
}
|
||||
},
|
||||
onSubmit: function (e) {
|
||||
console.log("submit");
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
var form = document.getElementById("submission-form");
|
||||
if (form.checkValidity() && this.tutors.length > 0) {
|
||||
console.log("valid");
|
||||
this.$router.push("/observation");
|
||||
}
|
||||
form.classList.add("was-validated");
|
||||
}
|
||||
}
|
||||
export default {
|
||||
name: "startnew",
|
||||
data() {
|
||||
return {
|
||||
siteOptions: [],
|
||||
tutorOptions: [],
|
||||
loadingTutors: false,
|
||||
loaded: false,
|
||||
errorMessage: null,
|
||||
errorStatus: null
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.resetStore();
|
||||
Vue.axios
|
||||
.get("/site")
|
||||
.then(response => {
|
||||
this.siteOptions = response.data;
|
||||
this.loaded = true;
|
||||
})
|
||||
.catch(error => {
|
||||
if (error.response.status === 404) {
|
||||
this.$router.push("/dberror");
|
||||
return;
|
||||
}
|
||||
this.errorStatus = error.response.status;
|
||||
this.errorMessage = error.response.data;
|
||||
this.$refs.errorModal.show();
|
||||
});
|
||||
},
|
||||
computed: {
|
||||
...mapState(["site", "description", "type", "tutors", "whom"])
|
||||
},
|
||||
watch: {
|
||||
site: function() {
|
||||
this.loadingTutors = true;
|
||||
this.tutorOptions = [];
|
||||
this.tutors = [];
|
||||
this.getTutors();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
...mapMutations([
|
||||
"setSite",
|
||||
"setDescription",
|
||||
"setType",
|
||||
"setTutors",
|
||||
"setWhom",
|
||||
"resetStore"
|
||||
]),
|
||||
getTutors: function() {
|
||||
if (this.site != null) {
|
||||
Vue.axios
|
||||
.get("/site/" + this.site + "/tutors")
|
||||
.then(response => {
|
||||
this.tutorOptions = response.data;
|
||||
this.loadingTutors = false;
|
||||
})
|
||||
.catch(error => {
|
||||
if (error.response.status === 404) {
|
||||
this.$router.push("/dberror");
|
||||
return;
|
||||
}
|
||||
this.errorStatus = error.response.status;
|
||||
this.errorMessage = error.response.data;
|
||||
this.$refs.errorModal.show();
|
||||
});
|
||||
}
|
||||
},
|
||||
onSubmit: function(e) {
|
||||
console.log("submit");
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
var form = document.getElementById("submission-form");
|
||||
if (form.checkValidity() && this.tutors.length > 0) {
|
||||
console.log("valid");
|
||||
this.$router.push("/observation");
|
||||
}
|
||||
form.classList.add("was-validated");
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user