Added name field & submission confirmation

This commit is contained in:
neviyn 2019-02-21 15:38:33 +00:00
parent 2676307170
commit 4bcfb84433
2 changed files with 331 additions and 335 deletions

View File

@ -1,29 +1,36 @@
<template> <template>
<b-form-radio-group <div>
buttons <b-form-radio-group
button-variant="outline-info" buttons
size="lg" button-variant="outline-info"
v-model="propModel" size="lg"
required v-model="propModel"
> invalid-feedback="Please select a score."
<b-form-radio button-variant="1" value="1">1</b-form-radio> required
<b-form-radio button-variant="2" value="2">2</b-form-radio> >
<b-form-radio button-variant="3" value="3">3</b-form-radio> <b-form-radio button-variant="1" value="1">1</b-form-radio>
<b-form-radio button-variant="4" value="4">4</b-form-radio> <b-form-radio button-variant="2" value="2">2</b-form-radio>
<b-form-radio button-variant="5" value="5">5</b-form-radio> <b-form-radio button-variant="3" value="3">3</b-form-radio>
</b-form-radio-group> <b-form-radio button-variant="4" value="4">4</b-form-radio>
<b-form-radio button-variant="5" value="5">5</b-form-radio>
</b-form-radio-group>
</div>
</template> </template>
<script> <script>
export default { export default {
props: ["scoreValue"], props: ["scoreValue"],
computed: { computed: {
propModel: { propModel: {
get () { return this.scoreValue }, get() {
set (value) { this.$emit('newselection', value) }, return this.scoreValue;
} },
set(value) {
this.$emit("newselection", value);
}
} }
} }
};
</script> </script>

View File

@ -1,284 +1,316 @@
<template> <template>
<b-container fluid> <b-container fluid>
<b-container v-if="!valid"> <b-container v-if="error !== null">
<p>An error has occurred.</p>
<p>{{ error.status }}</p>
<p>{{ error.data }}</p>
</b-container>
<b-container v-else-if="complete">
<h2>Submission Complete</h2>
<p>Thank you. Your observation data has been submitted.</p>
<p>Your observation summary will shortly appear on the session display.</p>
</b-container>
<b-container v-else-if="!valid">
<p>Getting session data from server</p> <p>Getting session data from server</p>
</b-container> </b-container>
<b-container v-else-if="scenarios.length === 0"> <b-container v-else-if="scenarios.length === 0">
<p>No scenarios defined for this session, please setup a new group session</p> <p>No scenarios defined for this session, please setup a new group session</p>
</b-container> </b-container>
<b-container v-else <b-container v-else fluid>
v-for="(item, index) in scenarios" <b-form @submit="onSubmit" id="submission-form" novalidate>
v-bind:key="index" <b-row align-h="center">
class="border bottom-buffer" <b-col>
fluid <b-form-group label="Participant">
> <b-form-input
<b-row> v-model="participant"
<b-col> type="text"
<b-form-input style="text-align:center;"
v-model="item.title" placeholder="Enter your name (Initial and Surname)"
type="text" required
placeholder="Enter scenario description." ></b-form-input>
readonly </b-form-group>
></b-form-input> </b-col>
</b-col> </b-row>
</b-row> <b-row v-for="(item, index) in scenarios" v-bind:key="index" class="border bottom-buffer">
<b-row> <b-col>
<b-col cols="6" class="border">
<b-row> <b-row>
<b-col> <b-col>
<h5>Monitoring</h5> <b-form-input
<score-selector v-model="item.title"
:score-value="item.monitoring.rating" type="text"
v-on:newselection="item.monitoring.rating = $event;" placeholder="Enter scenario description."
></score-selector> readonly
></b-form-input>
</b-col> </b-col>
</b-row> </b-row>
<b-row> <b-row>
<b-col> <b-col cols="6" class="border">
<b-form-textarea <b-row>
v-model="item.monitoring.strengths" <b-col>
placeholder="Strengths" <h5>Monitoring</h5>
:rows="1" <score-selector
:max-rows="2" :score-value="item.monitoring.rating"
no-resize v-on:newselection="item.monitoring.rating = $event;"
class="strength" ></score-selector>
></b-form-textarea> </b-col>
<b-form-textarea </b-row>
v-model="item.monitoring.improvements" <b-row>
placeholder="AFIs" <b-col>
:rows="1" <b-form-textarea
:max-rows="2" v-model="item.monitoring.strengths"
no-resize placeholder="Strengths"
class="afi" :rows="1"
></b-form-textarea> :max-rows="2"
no-resize
class="strength"
></b-form-textarea>
<b-form-textarea
v-model="item.monitoring.improvements"
placeholder="AFIs"
:rows="1"
:max-rows="2"
no-resize
class="afi"
></b-form-textarea>
</b-col>
</b-row>
</b-col> </b-col>
</b-row> <b-col cols="6" class="border">
</b-col> <b-row>
<b-col cols="6" class="border"> <b-col>
<b-row> <h5>Control Procedural</h5>
<b-col> <score-selector
<h5>Control Procedural</h5> :score-value="item.controlProcedural.rating"
<score-selector v-on:newselection="item.controlProcedural.rating = $event;"
:score-value="item.controlProcedural.rating" ></score-selector>
v-on:newselection="item.controlProcedural.rating = $event;" </b-col>
></score-selector> </b-row>
<b-row>
<b-col>
<b-form-textarea
v-model="item.controlProcedural.strengths"
placeholder="Strengths"
:rows="1"
:max-rows="2"
no-resize
class="strength"
></b-form-textarea>
<b-form-textarea
v-model="item.controlProcedural.improvements"
placeholder="AFIs"
:rows="1"
:max-rows="2"
no-resize
class="afi"
></b-form-textarea>
</b-col>
</b-row>
</b-col> </b-col>
</b-row> </b-row>
<b-row> <b-row>
<b-col> <b-col cols="6" class="border">
<b-form-textarea <b-row>
v-model="item.controlProcedural.strengths" <b-col>
placeholder="Strengths" <h5>Control</h5>
:rows="1" <score-selector
:max-rows="2" :score-value="item.control.rating"
no-resize v-on:newselection="item.control.rating = $event;"
class="strength" ></score-selector>
></b-form-textarea> </b-col>
<b-form-textarea </b-row>
v-model="item.controlProcedural.improvements" <b-row>
placeholder="AFIs" <b-col>
:rows="1" <b-form-textarea
:max-rows="2" v-model="item.control.strengths"
no-resize placeholder="Strengths"
class="afi" :rows="1"
></b-form-textarea> :max-rows="2"
no-resize
class="strength"
></b-form-textarea>
<b-form-textarea
v-model="item.control.improvements"
placeholder="AFIs"
:rows="1"
:max-rows="2"
no-resize
class="afi"
></b-form-textarea>
</b-col>
</b-row>
</b-col> </b-col>
</b-row> <b-col cols="6" class="border">
</b-col> <b-row>
</b-row> <b-col>
<b-row> <h5>Conservatism</h5>
<b-col cols="6" class="border"> <score-selector
<b-row> :score-value="item.conservatism.rating"
<b-col> v-on:newselection="item.conservatism.rating = $event;"
<h5>Control</h5> ></score-selector>
<score-selector </b-col>
:score-value="item.control.rating" </b-row>
v-on:newselection="item.control.rating = $event;" <b-row>
></score-selector> <b-col>
<b-form-textarea
v-model="item.conservatism.strengths"
placeholder="Strengths"
:rows="1"
:max-rows="2"
no-resize
class="strength"
></b-form-textarea>
<b-form-textarea
v-model="item.conservatism.improvements"
placeholder="AFIs"
:rows="1"
:max-rows="2"
no-resize
class="afi"
></b-form-textarea>
</b-col>
</b-row>
</b-col> </b-col>
</b-row> </b-row>
<b-row> <b-row>
<b-col> <b-col cols="6" class="border">
<b-form-textarea <b-row>
v-model="item.control.strengths" <b-col>
placeholder="Strengths" <h5>Teamwork Communications</h5>
:rows="1" <score-selector
:max-rows="2" :score-value="item.teamworkCommunications.rating"
no-resize v-on:newselection="item.teamworkCommunications.rating = $event;"
class="strength" ></score-selector>
></b-form-textarea> </b-col>
<b-form-textarea </b-row>
v-model="item.control.improvements" <b-row>
placeholder="AFIs" <b-col>
:rows="1" <b-form-textarea
:max-rows="2" v-model="item.teamworkCommunications.strengths"
no-resize placeholder="Strengths"
class="afi" :rows="1"
></b-form-textarea> :max-rows="2"
no-resize
class="strength"
></b-form-textarea>
<b-form-textarea
v-model="item.teamworkCommunications.improvements"
placeholder="AFIs"
:rows="1"
:max-rows="2"
no-resize
class="afi"
></b-form-textarea>
</b-col>
</b-row>
</b-col> </b-col>
</b-row> <b-col cols="6" class="border">
</b-col> <b-row>
<b-col cols="6" class="border"> <b-col>
<b-row> <h5>Teamwork Leadership</h5>
<b-col> <score-selector
<h5>Conservatism</h5> :score-value="item.teamworkLeadership.rating"
<score-selector v-on:newselection="item.teamworkLeadership.rating = $event;"
:score-value="item.conservatism.rating" ></score-selector>
v-on:newselection="item.conservatism.rating = $event;" </b-col>
></score-selector> </b-row>
<b-row>
<b-col>
<b-form-textarea
v-model="item.teamworkLeadership.strengths"
placeholder="Strengths"
:rows="1"
:max-rows="2"
no-resize
class="strength"
></b-form-textarea>
<b-form-textarea
v-model="item.teamworkLeadership.improvements"
placeholder="AFIs"
:rows="1"
:max-rows="2"
no-resize
class="afi"
></b-form-textarea>
</b-col>
</b-row>
</b-col> </b-col>
</b-row> </b-row>
<b-row> <b-row>
<b-col> <b-col cols="6" class="border">
<b-form-textarea <b-row>
v-model="item.conservatism.strengths" <b-col>
placeholder="Strengths" <h5>Teamwork Workload</h5>
:rows="1" <score-selector
:max-rows="2" :score-value="item.teamworkWorkload.rating"
no-resize v-on:newselection="item.teamworkWorkload.rating = $event;"
class="strength" ></score-selector>
></b-form-textarea> </b-col>
<b-form-textarea </b-row>
v-model="item.conservatism.improvements" <b-row>
placeholder="AFIs" <b-col>
:rows="1" <b-form-textarea
:max-rows="2" v-model="item.teamworkWorkload.strengths"
no-resize placeholder="Strengths"
class="afi" :rows="1"
></b-form-textarea> :max-rows="2"
no-resize
class="strength"
></b-form-textarea>
<b-form-textarea
v-model="item.teamworkWorkload.improvements"
placeholder="AFIs"
:rows="1"
:max-rows="2"
no-resize
class="afi"
></b-form-textarea>
</b-col>
</b-row>
</b-col>
<b-col cols="6" class="border">
<b-row>
<b-col>
<h5>Knowledge</h5>
<score-selector
:score-value="item.knowledge.rating"
v-on:newselection="item.knowledge.rating = $event;"
></score-selector>
</b-col>
</b-row>
<b-row>
<b-col>
<b-form-textarea
v-model="item.knowledge.strengths"
placeholder="Strengths"
:rows="1"
:max-rows="2"
no-resize
class="strength"
></b-form-textarea>
<b-form-textarea
v-model="item.knowledge.improvements"
placeholder="AFIs"
:rows="1"
:max-rows="2"
no-resize
class="afi"
></b-form-textarea>
</b-col>
</b-row>
</b-col> </b-col>
</b-row> </b-row>
</b-col> </b-col>
</b-row> </b-row>
<b-row> <br>
<b-col cols="6" class="border"> <b-button type="submit" variant="primary" v-on:click="onSubmit()">Submit</b-button>
<b-row> </b-form>
<b-col>
<h5>Teamwork Communications</h5>
<score-selector
:score-value="item.teamworkCommunications.rating"
v-on:newselection="item.teamworkCommunications.rating = $event;"
></score-selector>
</b-col>
</b-row>
<b-row>
<b-col>
<b-form-textarea
v-model="item.teamworkCommunications.strengths"
placeholder="Strengths"
:rows="1"
:max-rows="2"
no-resize
class="strength"
></b-form-textarea>
<b-form-textarea
v-model="item.teamworkCommunications.improvements"
placeholder="AFIs"
:rows="1"
:max-rows="2"
no-resize
class="afi"
></b-form-textarea>
</b-col>
</b-row>
</b-col>
<b-col cols="6" class="border">
<b-row>
<b-col>
<h5>Teamwork Leadership</h5>
<score-selector
:score-value="item.teamworkLeadership.rating"
v-on:newselection="item.teamworkLeadership.rating = $event;"
></score-selector>
</b-col>
</b-row>
<b-row>
<b-col>
<b-form-textarea
v-model="item.teamworkLeadership.strengths"
placeholder="Strengths"
:rows="1"
:max-rows="2"
no-resize
class="strength"
></b-form-textarea>
<b-form-textarea
v-model="item.teamworkLeadership.improvements"
placeholder="AFIs"
:rows="1"
:max-rows="2"
no-resize
class="afi"
></b-form-textarea>
</b-col>
</b-row>
</b-col>
</b-row>
<b-row>
<b-col cols="6" class="border">
<b-row>
<b-col>
<h5>Teamwork Workload</h5>
<score-selector
:score-value="item.teamworkWorkload.rating"
v-on:newselection="item.teamworkWorkload.rating = $event;"
></score-selector>
</b-col>
</b-row>
<b-row>
<b-col>
<b-form-textarea
v-model="item.teamworkWorkload.strengths"
placeholder="Strengths"
:rows="1"
:max-rows="2"
no-resize
class="strength"
></b-form-textarea>
<b-form-textarea
v-model="item.teamworkWorkload.improvements"
placeholder="AFIs"
:rows="1"
:max-rows="2"
no-resize
class="afi"
></b-form-textarea>
</b-col>
</b-row>
</b-col>
<b-col cols="6" class="border">
<b-row>
<b-col>
<h5>Knowledge</h5>
<score-selector
:score-value="item.knowledge.rating"
v-on:newselection="item.knowledge.rating = $event;"
></score-selector>
</b-col>
</b-row>
<b-row>
<b-col>
<b-form-textarea
v-model="item.knowledge.strengths"
placeholder="Strengths"
:rows="1"
:max-rows="2"
no-resize
class="strength"
></b-form-textarea>
<b-form-textarea
v-model="item.knowledge.improvements"
placeholder="AFIs"
:rows="1"
:max-rows="2"
no-resize
class="afi"
></b-form-textarea>
</b-col>
</b-row>
</b-col>
</b-row>
</b-container> </b-container>
<b-modal id="submissionModal" ref="submissionModal" title="Confirm Submission" @ok="handleOk">
<form @submit.stop.prevent="handleSubmit">
<p>Once submitted, data cannot be changed.</p>
<p>Are you sure you wish to submit?</p>
</form>
</b-modal>
</b-container> </b-container>
</template> </template>
<script> <script>
@ -292,10 +324,10 @@ export default {
data: function() { data: function() {
return { return {
scenarios: [], scenarios: [],
totals: [0, 0, 0, 0, 0, 0, 0, 0], participant: null,
warningBound: 2.5, valid: false,
submitPassword: null, complete: false,
valid: false error: null
}; };
}, },
mounted() { mounted() {
@ -303,20 +335,21 @@ export default {
if (this.id != null) { if (this.id != null) {
Vue.axios Vue.axios
.get(`/grpob/valid/${this.id}`) .get(`/grpob/valid/${this.id}`)
.then(function (response) { .then(function(response) {
if(response.data.titles != null) { if (response.data.titles != null) {
response.data.titles.forEach(function(x) { response.data.titles.forEach(function(x) {
self.addAnotherObservation(x); self.addAnotherObservation(x);
}) });
self.valid = true self.valid = true;
}; }
}) })
.catch(function(error) { .catch(function(error) {
if (error.response.status === 404) { if (error.response.status === 404) {
self.$router.push("/dberror"); self.$router.push("/dberror");
return; return;
} }
console.log(error) self.error = error.response;
console.log(error);
}); });
} }
}, },
@ -366,51 +399,6 @@ export default {
} }
}); });
}, },
updateTotals: function() {
var iTotals = [0, 0, 0, 0, 0, 0, 0, 0];
var counts = [0, 0, 0, 0, 0, 0, 0, 0];
this.scenarios.forEach(function(element) {
if (element.monitoring.rating) {
iTotals[0] += parseInt(element.monitoring.rating);
counts[0] += 1;
}
if (element.controlProcedural.rating) {
iTotals[1] += parseInt(element.controlProcedural.rating);
counts[1] += 1;
}
if (element.control.rating) {
iTotals[2] += parseInt(element.control.rating);
counts[2] += 1;
}
if (element.conservatism.rating) {
iTotals[3] += parseInt(element.conservatism.rating);
counts[3] += 1;
}
if (element.teamworkCommunications.rating) {
iTotals[4] += parseInt(element.teamworkCommunications.rating);
counts[4] += 1;
}
if (element.teamworkLeadership.rating) {
iTotals[5] += parseInt(element.teamworkLeadership.rating);
counts[5] += 1;
}
if (element.teamworkWorkload.rating) {
iTotals[6] += parseInt(element.teamworkWorkload.rating);
counts[6] += 1;
}
if (element.knowledge.rating) {
iTotals[7] += parseInt(element.knowledge.rating);
counts[7] += 1;
}
});
for (var i = 0; i < iTotals.length; i++) {
if (counts[i] !== 0) {
Vue.set(this.totals, i, (iTotals[i] / counts[i]).toFixed(1));
} else {
Vue.set(this.totals, i, 0);
}
}
},
onSubmit: function(e) { onSubmit: function(e) {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
@ -428,15 +416,16 @@ export default {
if (form.checkValidity()) { if (form.checkValidity()) {
var self = this; var self = this;
Vue.axios Vue.axios
.post("/observation", { .post("/grpob/submit", {
person: this.whom, person: self.participant,
scenarios: JSON.parse(JSON.stringify(this.scenarios)) scenarios: JSON.parse(JSON.stringify(self.scenarios))
}) })
.then(function(response) { .then(function(response) {
self.$router.push("/complete"); self.complete = true;
console.log(response); console.log(response);
}) })
.catch(function(error) { .catch(function(error) {
self.error = error;
console.log(error); console.log(error);
}); });
} }