Feat: Display tags in config and add colors to tag

This commit is contained in:
2018-12-04 18:37:28 +01:00
parent 877c269ee4
commit bf788d2e9e
7 changed files with 107 additions and 31 deletions

View File

@@ -4,7 +4,6 @@ export function appendTag (row, keywords, field = 'Libellé') {
// if row.libellé contains one of words and not invert it gets tagged
// if row.libellé contains no words and invert it gets tagged
// according to keywords [{name: string, words: [], invert: bool}]
// row['tags'] =
row.tags = keywords.filter(k => {
return strContains(row[field], k.words, k.invert)
})
@@ -17,17 +16,17 @@ function strContains (string, words, invert) {
}
if (invert) {
return words.every(v => {
return string.indexOf(v) < 0
return string.toLowerCase().indexOf(v.toLowerCase()) < 0
})
} else {
return words.some(v => {
return string.indexOf(v) >= 0
return string.toLowerCase().indexOf(v.toLowerCase()) >= 0
})
}
}
export function formatDate (row, field = 'Date') {
row[field] = moment(row[field], 'DD/MM/YYYY', true)
row[field] = moment(row[field], 'DD/MM/YYYY', true)
}
export function total (row, field = 'Montant') {