ask for confirmation before returning or deleting items

This commit is contained in:
j3d1 2023-12-28 22:58:12 +01:00
parent c2e73afb35
commit a458d4f850

View file

@ -53,13 +53,13 @@
<h6 class="card-subtitle text-secondary">uid: {{ item.uid }} box: {{ item.box }}</h6> <h6 class="card-subtitle text-secondary">uid: {{ item.uid }} box: {{ item.box }}</h6>
<div class="row mx-auto mt-2"> <div class="row mx-auto mt-2">
<div class="btn-group"> <div class="btn-group">
<button class="btn btn-outline-success" @click.stop="markItemReturned(item)" title="returned"> <button class="btn btn-outline-success" @click.stop="confirm('return Item?') && markItemReturned(item)" title="returned">
<font-awesome-icon icon="check"/> <font-awesome-icon icon="check"/>
</button> </button>
<button class="btn btn-outline-secondary" @click.stop="openEditingModalWith(item)" title="edit"> <button class="btn btn-outline-secondary" @click.stop="openEditingModalWith(item)" title="edit">
<font-awesome-icon icon="edit"/> <font-awesome-icon icon="edit"/>
</button> </button>
<button class="btn btn-outline-danger" @click.stop="deleteItem(item)" title="delete"> <button class="btn btn-outline-danger" @click.stop="confirm('delete Item?') && deleteItem(item)" title="delete">
<font-awesome-icon icon="trash"/> <font-awesome-icon icon="trash"/>
</button> </button>
</div> </div>
@ -103,6 +103,9 @@ export default {
saveEditingItem() { // Saves the edited copy of the item. saveEditingItem() { // Saves the edited copy of the item.
this.$store.dispatch('updateItem', this.editingItem); this.$store.dispatch('updateItem', this.editingItem);
this.closeEditingModal(); this.closeEditingModal();
},
confirm(message) {
return window.confirm(message);
} }
} }
}; };