Cleanup JS

This commit is contained in:
James Cole 2020-10-28 20:16:21 +01:00
parent ca3d836c83
commit 23356b3884
No known key found for this signature in database
GPG Key ID: B5669F9493CDE38D
7 changed files with 28 additions and 27 deletions

View File

@ -160,6 +160,9 @@ class NoBudgetRepository implements NoBudgetRepositoryInterface
/** @noinspection MoreThanThreeArgumentsInspection */
/**
* TODO this method does not include foreign amount transactions. It only sums up "amount".
* TODO this probably also applies to the other "sumExpenses" methods.
*
* @param Carbon $start
* @param Carbon $end
* @param Collection|null $accounts
@ -196,6 +199,7 @@ class NoBudgetRepository implements NoBudgetRepositoryInterface
'currency_decimal_places' => $journal['currency_decimal_places'],
];
$array[$currencyId]['sum'] = bcadd($array[$currencyId]['sum'], app('steam')->negative($journal['amount']));
}
return $array;

View File

@ -78,7 +78,7 @@ export default {
return this.error.length > 0;
},
changeData: function () {
console.log('Triggered amount changeData()');
//console.log('Triggered amount changeData()');
let transactionType = this.transactionType;
// reset of all are empty:
if (!transactionType && !this.source.name && !this.destination.name) {
@ -130,23 +130,23 @@ export default {
},
watch: {
source: function () {
console.log('amount: watch source triggered');
// console.log('amount: watch source triggered');
this.changeData();
},
value: function () {
console.log('amount: value changed');
// console.log('amount: value changed');
},
destination: function () {
console.log('amount: watch destination triggered');
// console.log('amount: watch destination triggered');
this.changeData();
},
transactionType: function () {
console.log('amount: watch transaction type triggered');
// console.log('amount: watch transaction type triggered');
this.changeData();
}
},
mounted() {
console.log('amount: mounted');
// console.log('amount: mounted');
this.changeData();
}
}

View File

@ -61,7 +61,7 @@ export default {
no_bill: String,
},
mounted() {
console.log('bill: mounted');
// console.log('bill: mounted');
this.loadBills();
},
data() {
@ -72,7 +72,7 @@ export default {
},
watch: {
value: function () {
console.log('bill: value changed to ' + this.value);
// console.log('bill: value changed to ' + this.value);
this.selected = this.value;
}
},

View File

@ -71,7 +71,7 @@ export default {
},
watch: {
value: function () {
console.log('budget: value changed to ' + this.value);
// console.log('budget: value changed to ' + this.value);
this.selected = this.value;
}
},

View File

@ -65,6 +65,3 @@ export default {
}
</script>
<style scoped>
</style>

View File

@ -243,11 +243,11 @@ export default {
groupId: Number
},
mounted() {
console.log('EditTransaction: mounted()');
// console.log('EditTransaction: mounted()');
this.getGroup();
},
ready() {
console.log('EditTransaction: ready()');
// console.log('EditTransaction: ready()');
},
methods: {
positiveAmount(amount) {
@ -353,7 +353,7 @@ export default {
// console.log(this.transactions[index].destination_account.allowed_types);
},
getGroup() {
console.log('EditTransaction: getGroup()');
// console.log('EditTransaction: getGroup()');
const page = window.location.href.split('/');
const groupId = page[page.length - 1];
@ -372,7 +372,7 @@ export default {
});
},
processIncomingGroup(data) {
console.log('EditTransaction: processIncomingGroup()');
// console.log('EditTransaction: processIncomingGroup()');
this.group_title = data.attributes.group_title;
let transactions = data.attributes.transactions.reverse();
for (let key in transactions) {
@ -390,7 +390,7 @@ export default {
return null;
},
processIncomingGroupRow(transaction) {
console.log('EditTransaction: processIncomingGroupRow()');
//console.log('EditTransaction: processIncomingGroupRow()');
this.setTransactionType(transaction.type);
let newTags = [];
@ -921,15 +921,15 @@ export default {
}
});
let count = this.transactions.length;
console.log('Transactions length = ' + count);
// console.log('Transactions length = ' + count);
// also set accounts from previous entry, if present.
if (this.transactions.length > 1) {
console.log('Adding split.');
// console.log('Adding split.');
this.transactions[count - 1].source_account = this.transactions[count - 2].source_account;
this.transactions[count - 1].destination_account = this.transactions[count - 2].destination_account;
this.transactions[count - 1].date = this.transactions[count - 2].date;
}
console.log('Transactions length now = ' + this.transactions.length);
// console.log('Transactions length now = ' + this.transactions.length);
if (e) {
e.preventDefault();

View File

@ -128,21 +128,21 @@ export default {
// console.log(destType + ' (dest) is a liability: ' + destIsLiability);
if (tType === 'transfer' || destIsLiability || sourceIsLiability) {
console.log('Source is liability OR dest is liability, OR transfer. Lock list on currency of destination.');
console.log('Length of currencies is ' + this.currencies.length);
console.log(this.currencies);
// console.log('Source is liability OR dest is liability, OR transfer. Lock list on currency of destination.');
// console.log('Length of currencies is ' + this.currencies.length);
// console.log(this.currencies);
this.liability = true;
// lock dropdown list on on currencyID of destination.
for (const key in this.currencies) {
if (this.currencies.hasOwnProperty(key) && /^0$|^[1-9]\d*$/.test(key) && key <= 4294967294) {
console.log('this.currencies[key].id = ' + this.currencies[key].id);
console.log('this.destination.currency_id = ' + this.destination.currency_id);
// console.log('this.currencies[key].id = ' + this.currencies[key].id);
// console.log('this.destination.currency_id = ' + this.destination.currency_id);
if (parseInt(this.currencies[key].id) === parseInt(this.destination.currency_id)) {
this.enabledCurrencies.push(this.currencies[key]);
}
}
}
console.log('Enabled currencies length is now ' + this.enabledCurrencies.length);
// console.log('Enabled currencies length is now ' + this.enabledCurrencies.length);
return;
}
@ -207,7 +207,7 @@ export default {
}
}
}
console.log(this.enabledCurrencies);
// console.log(this.enabledCurrencies);
});
}
}