Fix some tag related issues.

This commit is contained in:
James Cole
2019-08-11 07:29:05 +02:00
parent f67a9547cc
commit 788bde5562
5 changed files with 18 additions and 7 deletions

2
public/v1/js/app.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -106,7 +106,7 @@ function getBalanceBox() {
// show balance in "sums", show single entry in list. // show balance in "sums", show single entry in list.
for (x in data.sums) { for (x in data.sums) {
$('#box-balance-sums').html(data.sums[x]); $('#box-balance-sums').html(data.sums[x]);
$('#box-balance-list').html(data.incomes[x] + ' / ' + data.expenses[x]); $('#box-balance-list').html(data.incomes[x] + ' + ' + data.expenses[x]);
} }
return; return;
} }
@@ -120,7 +120,7 @@ function getBalanceBox() {
sum = data.sums[x]; sum = data.sums[x];
expense = data.expenses[x]; expense = data.expenses[x];
income = data.incomes[x]; income = data.incomes[x];
string = income + ' / ' + expense + ': ' + sum; string = income + ' + ' + expense + ': ' + sum;
if (data.preferred == x) { if (data.preferred == x) {
$('#box-balance-list').html(current + '<span title="' + string + '">' + string + '</span>' + '<br>'); $('#box-balance-list').html(current + '<span title="' + string + '">' + string + '</span>' + '<br>');
} }
@@ -136,7 +136,7 @@ function getBalanceBox() {
sum = data.sums[x]; sum = data.sums[x];
expense = data.expenses[x]; expense = data.expenses[x];
income = data.incomes[x]; income = data.incomes[x];
string = income + ' / ' + expense + ': ' + sum; string = income + ' + ' + expense + ': ' + sum;
if (data.preferred != x) { if (data.preferred != x) {
$('#box-balance-list').html(current + '<span title="' + string + '">' + string + '</span>' + '<br>'); $('#box-balance-list').html(current + '<span title="' + string + '">' + string + '</span>' + '<br>');
} }

View File

@@ -297,7 +297,7 @@
foreignCurrency = null; foreignCurrency = null;
// loop tags // loop tags
for (let tagKey in row.tags) { for (let tagKey in row.tags) {
if (row.tags.hasOwnProperty(tagKey) && /^0$|^[1-9]\d*$/.test(tagKey) && key <= 4294967294) { if (row.tags.hasOwnProperty(tagKey) && /^0$|^[1-9]\d*$/.test(tagKey) && tagKey <= 4294967294) {
tagList.push(row.tags[tagKey].text); tagList.push(row.tags[tagKey].text);
} }
} }

View File

@@ -155,6 +155,7 @@
></piggy-bank> ></piggy-bank>
--> -->
<tags <tags
:tags="transaction.tags"
v-model="transaction.tags" v-model="transaction.tags"
:error="transaction.errors.tags" :error="transaction.errors.tags"
></tags> ></tags>
@@ -355,6 +356,14 @@
processIncomingGroupRow(transaction) { processIncomingGroupRow(transaction) {
console.log(transaction); console.log(transaction);
this.setTransactionType(transaction.type); this.setTransactionType(transaction.type);
let newTags = [];
for(let key in transaction.tags) {
if (transaction.tags.hasOwnProperty(key) && /^0$|^[1-9]\d*$/.test(key) && key <= 4294967294) {
newTags.push({text: transaction.tags[key], tiClasses: []});
}
}
this.transactions.push({ this.transactions.push({
description: transaction.description, description: transaction.description,
date: transaction.date.substr(0, 10), date: transaction.date.substr(0, 10),
@@ -385,7 +394,8 @@
}, },
}, },
budget: transaction.budget_id, budget: transaction.budget_id,
tags: transaction.tags, tags: newTags,
//tags: 'abc',
custom_fields: { custom_fields: {
interest_date: transaction.interest_date, interest_date: transaction.interest_date,
book_date: transaction.book_date, book_date: transaction.book_date,

View File

@@ -52,9 +52,9 @@
data() { data() {
return { return {
tag: '', tag: '',
tags: [],
autocompleteItems: [], autocompleteItems: [],
debounce: null, debounce: null,
tags: this.value,
}; };
}, },
watch: { watch: {
@@ -70,6 +70,7 @@
return this.error.length > 0; return this.error.length > 0;
}, },
initItems() { initItems() {
console.log('Now in initItems');
if (this.tag.length < 2) { if (this.tag.length < 2) {
return; return;
} }