Added button to delete an individual entry

This commit is contained in:
neviyn 2020-09-16 16:24:10 +01:00
parent ec9ae15c29
commit 806a47228a

View File

@ -140,7 +140,7 @@
></b-form-input>
</b-col>
<b-col cols="1">
<b-button v-on:click="deleteObservation(index)" variant="danger"
<b-button v-on:click="deleteObservation(index)" variant="outline-danger"
><b>Delete</b></b-button
>
</b-col>
@ -159,6 +159,8 @@
v-on:change="updateTotals()"
class="my-3"
></b-form-select>
<div class="d-flex">
<b-button class="mr-3" variant="outline-danger" size="sm" v-on:click="deleteEntry(index, entryIndex)" v-b-tooltip.hover title="Delete this entry">X</b-button>
<score-selector
:score-value="entry.rating"
v-on:newselection="
@ -166,6 +168,7 @@
updateTotals();
"
></score-selector>
</div>
</b-col>
<b-col cols="8">
<b-form-textarea
@ -331,6 +334,13 @@ export default {
AFIs: "",
});
},
deleteEntry: function(scenarioIndex, entryIndex) {
this.$delete(this.scenarios[scenarioIndex].entries, entryIndex);
if(this.scenarios[scenarioIndex].entries.length === 0) {
this.addAnotherEntry(this.scenarios[scenarioIndex]);
}
this.updateTotals();
},
updateTotals: function() {
var iTotals = [0, 0, 0, 0, 0, 0, 0, 0];
var counts = [0, 0, 0, 0, 0, 0, 0, 0];