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 */ /** @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 $start
* @param Carbon $end * @param Carbon $end
* @param Collection|null $accounts * @param Collection|null $accounts
@ -196,6 +199,7 @@ class NoBudgetRepository implements NoBudgetRepositoryInterface
'currency_decimal_places' => $journal['currency_decimal_places'], 'currency_decimal_places' => $journal['currency_decimal_places'],
]; ];
$array[$currencyId]['sum'] = bcadd($array[$currencyId]['sum'], app('steam')->negative($journal['amount'])); $array[$currencyId]['sum'] = bcadd($array[$currencyId]['sum'], app('steam')->negative($journal['amount']));
} }
return $array; return $array;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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