diff --git a/src/components/ApplyTag.vue b/src/components/ApplyTag.vue
index 5f0769a..aab630f 100644
--- a/src/components/ApplyTag.vue
+++ b/src/components/ApplyTag.vue
@@ -5,9 +5,22 @@
-
+
Successfully used slot body.
-
+
+ {{ transaction.date }} - {{ transaction.transactionTypeDescription }} - {{ transaction.isExpenditure ? "Expenditure" : "Income" }} -> {{ transaction.amount }}
+
+ {{ transaction.description }}
+
+
+
+
+
+
@@ -19,6 +32,7 @@
name: 'app',
props: [
"transaction",
+ "tagsExpenditure",
"isModalVisible"
],
components: {
@@ -26,14 +40,24 @@
},
data () {
return {
+ selectedTag: ""
};
},
methods: {
+ closeModal() {
+ this.$emit('close');
+ },
showModal() {
this.$emit('show');
},
- closeModal() {
+ saveTransaction() {
+ const newTransaction = this.transaction;
+ var newTags = [];
+ newTags.push(this.selectedTag);
+ newTransaction.tags = newTags;
+
this.$emit('close');
+ this.$emit('add', newTransaction);
}
},
};
diff --git a/src/views/Home.vue b/src/views/Home.vue
index 9814715..a37b108 100644
--- a/src/views/Home.vue
+++ b/src/views/Home.vue
@@ -1,6 +1,6 @@
@@ -67,12 +67,12 @@ export default {
this.transactions = this.transactions.filter(transaction => transaction.id !== id);
localStorage.setItem("transactionStorage", JSON.stringify(this.transactions));
},
- addTransaction() {
+ addTransaction(newTransaction) {
// When the confirmation button is clicked, return the value of the dropdown
// Add the transaction
- this.transactions.push(this.newTransaction);
+ this.transactions.push(newTransaction);
this.saveTransactions();
},
checkTransactionExists(newTransaction) {
@@ -89,6 +89,7 @@ export default {
}
},
saveTransactions() {
+ // Save the transactions to localstorage so they persist after closing the session
localStorage.setItem("transactionStorage", JSON.stringify(this.transactions));
},
closeModal() {