newUI #1

Merged
neviyn merged 7 commits from newUI into master 2020-09-18 09:49:05 +01:00
Showing only changes of commit ec9ae15c29 - Show all commits

View File

@ -145,22 +145,31 @@
>
</b-col>
</b-row>
<b-row>
<b-col cols="6" class="border">
<b-row cols="2">
<div
v-for="(entry, entryIndex) in item.entries"
v-bind:key="entryIndex"
>
<b-col class="border">
<b-row>
<b-col cols="4">
<h5>Monitoring</h5>
<b-form-select
v-model="entry.type"
:options="entryTypeOptions"
v-on:change="updateTotals()"
class="my-3"
></b-form-select>
<score-selector
:score-value="item.monitoringRating"
:score-value="entry.rating"
v-on:newselection="
item.monitoringRating = $event;
entry.rating = $event;
updateTotals();
"
></score-selector>
</b-col>
<b-col cols="8">
<b-form-textarea
v-model="item.monitoringStrengths"
v-model="entry.strengths"
placeholder="Strengths"
:rows="1"
:max-rows="2"
@ -168,7 +177,7 @@
class="strength"
></b-form-textarea>
<b-form-textarea
v-model="item.monitoringImprovements"
v-model="entry.AFIs"
placeholder="AFIs"
:rows="1"
:max-rows="2"
@ -178,235 +187,15 @@
</b-col>
</b-row>
</b-col>
<b-col cols="6" class="border">
<b-row>
<b-col cols="4">
<h5>Control Procedural</h5>
<score-selector
:score-value="item.controlProceduralRating"
v-on:newselection="
item.controlProceduralRating = $event;
updateTotals();
"
></score-selector>
</b-col>
<b-col cols="8">
<b-form-textarea
v-model="item.controlProceduralStrengths"
placeholder="Strengths"
:rows="1"
:max-rows="2"
no-resize
class="strength"
></b-form-textarea>
<b-form-textarea
v-model="item.controlProceduralImprovements"
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 cols="4">
<h5>Control</h5>
<score-selector
:score-value="item.controlRating"
v-on:newselection="
item.controlRating = $event;
updateTotals();
"
></score-selector>
</b-col>
<b-col cols="8">
<b-form-textarea
v-model="item.controlStrengths"
placeholder="Strengths"
:rows="1"
:max-rows="2"
no-resize
class="strength"
></b-form-textarea>
<b-form-textarea
v-model="item.controlImprovements"
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 cols="4">
<h5>Conservatism</h5>
<score-selector
:score-value="item.conservatismRating"
v-on:newselection="
item.conservatismRating = $event;
updateTotals();
"
></score-selector>
</b-col>
<b-col cols="8">
<b-form-textarea
v-model="item.conservatismStrengths"
placeholder="Strengths"
:rows="1"
:max-rows="2"
no-resize
class="strength"
></b-form-textarea>
<b-form-textarea
v-model="item.conservatismImprovements"
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 cols="4">
<h5>Teamwork Communications</h5>
<score-selector
:score-value="item.teamworkCommunicationsRating"
v-on:newselection="
item.teamworkCommunicationsRating = $event;
updateTotals();
"
></score-selector>
</b-col>
<b-col cols="8">
<b-form-textarea
v-model="item.teamworkCommunicationsStrengths"
placeholder="Strengths"
:rows="1"
:max-rows="2"
no-resize
class="strength"
></b-form-textarea>
<b-form-textarea
v-model="item.teamworkCommunicationsImprovements"
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 cols="4">
<h5>Teamwork Leadership</h5>
<score-selector
:score-value="item.teamworkLeadershipRating"
v-on:newselection="
item.teamworkLeadershipRating = $event;
updateTotals();
"
></score-selector>
</b-col>
<b-col cols="8">
<b-form-textarea
v-model="item.teamworkLeadershipStrengths"
placeholder="Strengths"
:rows="1"
:max-rows="2"
no-resize
class="strength"
></b-form-textarea>
<b-form-textarea
v-model="item.teamworkLeadershipImprovements"
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 cols="4">
<h5>Teamwork Workload</h5>
<score-selector
:score-value="item.teamworkWorkloadRating"
v-on:newselection="
item.teamworkWorkloadRating = $event;
updateTotals();
"
></score-selector>
</b-col>
<b-col cols="8">
<b-form-textarea
v-model="item.teamworkWorkloadStrengths"
placeholder="Strengths"
:rows="1"
:max-rows="2"
no-resize
class="strength"
></b-form-textarea>
<b-form-textarea
v-model="item.teamworkWorkloadImprovements"
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 cols="4">
<h5>Knowledge</h5>
<score-selector
:score-value="item.knowledgeRating"
v-on:newselection="
item.knowledgeRating = $event;
updateTotals();
"
></score-selector>
</b-col>
<b-col cols="8">
<b-form-textarea
v-model="item.knowledgeStrengths"
placeholder="Strengths"
:rows="1"
:max-rows="2"
no-resize
class="strength"
></b-form-textarea>
<b-form-textarea
v-model="item.knowledgeImprovements"
placeholder="AFIs"
:rows="1"
:max-rows="2"
no-resize
class="afi"
></b-form-textarea>
</b-col>
</b-row>
</div>
<b-col cols="6" align-self="center">
<b-button
v-on:click="addAnotherEntry(item)"
size="lg"
style="font-size: 200%"
class="py-4 my-4"
>&nbsp;&nbsp;&nbsp;+&nbsp;&nbsp;&nbsp;</b-button
>
</b-col>
</b-row>
</b-container>
@ -479,68 +268,46 @@ export default {
scenarios: [
{
title: "",
monitoringRating: null,
monitoringStrengths: "",
monitoringImprovements: "",
controlProceduralRating: null,
controlProceduralStrengths: "",
controlProceduralImprovements: "",
controlRating: null,
controlStrengths: "",
controlImprovements: "",
conservatismRating: null,
conservatismStrengths: "",
conservatismImprovements: "",
teamworkCommunicationsRating: null,
teamworkCommunicationsStrengths: "",
teamworkCommunicationsImprovements: "",
teamworkLeadershipRating: null,
teamworkLeadershipStrengths: "",
teamworkLeadershipImprovements: "",
teamworkWorkloadRating: null,
teamworkWorkloadStrengths: "",
teamworkWorkloadImprovements: "",
knowledgeRating: null,
knowledgeStrengths: "",
knowledgeImprovements: ""
}
entries: [
{
type: null,
rating: 0,
strengths: "",
AFIs: "",
},
],
},
],
totals: [0, 0, 0, 0, 0, 0, 0, 0],
warningBound: 2.5,
submitPassword: null
submitPassword: null,
entryTypeOptions: [
{ value: "monitoring", text: "Monitoring" },
{ value: "controlProcedural", text: "Control Procedural" },
{ value: "control", text: "Control" },
{ value: "conservatism", text: "Conservatism" },
{ value: "teamworkCommunications", text: "Teamwork Communications" },
{ value: "teamworkLeadership", text: "Teamwork Leadership" },
{ value: "teamworkWorkload", text: "Teamwork Workload" },
{ value: "knowledge", text: "Knowledge" },
],
};
},
computed: {
...mapState(["type", "whom", "site", "tutors"])
...mapState(["type", "whom", "site", "tutors"]),
},
methods: {
addAnotherObservation: function() {
this.scenarios.push({
title: "",
monitoringRating: null,
monitoringStrengths: "",
monitoringImprovements: "",
controlProceduralRating: null,
controlProceduralStrengths: "",
controlProceduralImprovements: "",
controlRating: null,
controlStrengths: "",
controlImprovements: "",
conservatismRating: null,
conservatismStrengths: "",
conservatismImprovements: "",
teamworkCommunicationsRating: null,
teamworkCommunicationsStrengths: "",
teamworkCommunicationsImprovements: "",
teamworkLeadershipRating: null,
teamworkLeadershipStrengths: "",
teamworkLeadershipImprovements: "",
teamworkWorkloadRating: null,
teamworkWorkloadStrengths: "",
teamworkWorkloadImprovements: "",
knowledgeRating: null,
knowledgeStrengths: "",
knowledgeImprovements: ""
entries: [
{
type: null,
rating: 0,
strengths: "",
AFIs: "",
},
],
});
Vue.nextTick(function() {
window.scrollTo(
@ -556,43 +323,35 @@ export default {
}
this.updateTotals();
},
addAnotherEntry: function(scenario) {
scenario.entries.push({
type: null,
rating: 0,
strengths: "",
AFIs: "",
});
},
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.monitoringRating) {
iTotals[0] += parseInt(element.monitoringRating);
counts[0] += 1;
}
if (element.controlProceduralRating) {
iTotals[1] += parseInt(element.controlProceduralRating);
counts[1] += 1;
}
if (element.controlRating) {
iTotals[2] += parseInt(element.controlRating);
counts[2] += 1;
}
if (element.conservatismRating) {
iTotals[3] += parseInt(element.conservatismRating);
counts[3] += 1;
}
if (element.teamworkCommunicationsRating) {
iTotals[4] += parseInt(element.teamworkCommunicationsRating);
counts[4] += 1;
}
if (element.teamworkLeadershipRating) {
iTotals[5] += parseInt(element.teamworkLeadershipRating);
counts[5] += 1;
}
if (element.teamworkWorkloadRating) {
iTotals[6] += parseInt(element.teamworkWorkloadRating);
counts[6] += 1;
}
if (element.knowledgeRating) {
iTotals[7] += parseInt(element.knowledgeRating);
counts[7] += 1;
var indices = {
monitoring: 0,
controlProcedural: 1,
control: 2,
conservatism: 3,
teamworkCommunications: 4,
teamworkLeadership: 5,
teamworkWorkload: 6,
knowledge: 7,
};
this.scenarios.forEach(function(scenario) {
scenario.entries.forEach(function(entry) {
if (entry.type !== null && entry.rating > 0) {
iTotals[indices[entry.type]] += parseInt(entry.rating);
counts[indices[entry.type]] += 1;
}
});
});
for (var i = 0; i < iTotals.length; i++) {
if (counts[i] !== 0) {
Vue.set(this.totals, i, (iTotals[i] / counts[i]).toFixed(1));
@ -629,10 +388,150 @@ export default {
let axiosConfig = {
auth: {
username: "admin",
password: this.submitPassword
}
password: this.submitPassword,
},
};
var self = this;
var transformedScenarioData = [];
this.scenarios.forEach(function(scenario) {
var monitoring = scenario.entries.filter(
(entry) => entry.type === "monitoring"
);
var controlProcedural = scenario.entries.filter(
(entry) => entry.type === "controlProcedural"
);
var control = scenario.entries.filter(
(entry) => entry.type === "control"
);
var conservatism = scenario.entries.filter(
(entry) => entry.type === "conservatism"
);
var teamworkCommunications = scenario.entries.filter(
(entry) => entry.type === "teamworkCommunications"
);
var teamworkLeadership = scenario.entries.filter(
(entry) => entry.type === "teamworkLeadership"
);
var teamworkWorkload = scenario.entries.filter(
(entry) => entry.type === "teamworkWorkload"
);
var knowledge = scenario.entries.filter(
(entry) => entry.type === "knowledge"
);
transformedScenarioData.push({
title: scenario.title,
monitoringRating:
monitoring.length > 0
? monitoring.length > 1
? monitoring.reduce(
(a, b) => parseInt(a.rating) + parseInt(b.rating)
) / monitoring.length
: monitoring[0].rating
: 0,
monitoringStrengths: monitoring
.map((entry) => entry.strengths)
.join("; "),
monitoringImprovements: monitoring
.map((entry) => entry.AFIs)
.join("; "),
controlProceduralRating:
controlProcedural.length > 0
? controlProcedural.length > 1
? controlProcedural.reduce(
(a, b) => parseInt(a.rating) + parseInt(b.rating)
) / controlProcedural.length
: controlProcedural[0].rating
: 0,
controlProceduralStrengths: controlProcedural
.map((entry) => entry.strengths)
.join("; "),
controlProceduralImprovements: controlProcedural
.map((entry) => entry.AFIs)
.join("; "),
controlRating:
control.length > 0
? control.length > 1
? control.reduce(
(a, b) => parseInt(a.rating) + parseInt(b.rating)
) / control.length
: control[0].rating
: 0,
controlStrengths: control
.map((entry) => entry.strengths)
.join("; "),
controlImprovements: control.map((entry) => entry.AFIs).join("; "),
conservatismRating:
conservatism.length > 0
? conservatism.length > 1
? conservatism.reduce(
(a, b) => parseInt(a.rating) + parseInt(b.rating)
) / conservatism.length
: conservatism[0].rating
: 0,
conservatismStrengths: conservatism
.map((entry) => entry.strengths)
.join(";"),
conservatismImprovements: conservatism
.map((entry) => entry.strengths)
.join(";"),
teamworkCommunicationsRating:
teamworkCommunications.length > 0
? teamworkCommunications.length > 1
? teamworkCommunications.reduce(
(a, b) => parseInt(a.rating) + parseInt(b.rating)
) / teamworkCommunications.length
: teamworkCommunications[0].rating
: 0,
teamworkCommunicationsStrengths: teamworkCommunications
.map((entry) => entry.strengths)
.join(";"),
teamworkCommunicationsImprovements: teamworkCommunications
.map((entry) => entry.AFIs)
.join(";"),
teamworkLeadershipRating:
teamworkLeadership.length > 0
? teamworkLeadership.length > 1
? teamworkLeadership.reduce(
(a, b) => parseInt(a.rating) + parseInt(b.rating)
) / teamworkLeadership.length
: teamworkLeadership[0].rating
: 0,
teamworkLeadershipStrengths: teamworkLeadership
.map((entry) => entry.strengths)
.join(";"),
teamworkLeadershipImprovements: teamworkLeadership
.map((entry) => entry.AFIs)
.join(";"),
teamworkWorkloadRating:
teamworkWorkload.length > 0
? teamworkWorkload.length > 1
? teamworkWorkload.reduce(
(a, b) => parseInt(a.rating) + parseInt(b.rating)
) / teamworkWorkload.length
: teamworkWorkload[0].rating
: 0,
teamworkWorkloadStrengths: teamworkWorkload
.map((entry) => entry.strengths)
.join(";"),
teamworkWorkloadImprovements: teamworkWorkload
.map((entry) => entry.AFIs)
.join(";"),
knowledgeRating:
knowledge.length > 0
? knowledge.length > 1
? knowledge.reduce(
(a, b) => parseInt(a.rating) + parseInt(b.rating)
) / knowledge.length
: knowledge[0].rating
: 0,
knowledgeStrengths: knowledge
.map((entry) => entry.strengths)
.join(";"),
knowledgeImprovements: knowledge
.map((entry) => entry.AFIs)
.join(";"),
});
});
Vue.axios
.post(
"/observation",
@ -641,8 +540,8 @@ export default {
tutors: this.tutors,
person: this.whom,
type: this.type,
observed: this.scenarios.map(x => x.title).join(", "),
scenarios: JSON.parse(JSON.stringify(this.scenarios))
observed: this.scenarios.map((x) => x.title).join("; "),
scenarios: JSON.parse(JSON.stringify(transformedScenarioData)),
},
axiosConfig
)
@ -654,8 +553,8 @@ export default {
}
this.clearPassword();
form.classList.add("was-validated");
}
}
},
},
};
</script>