From f5e5854479f679a6f0878142c7837a4c39d624e5 Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 9 Apr 2021 19:35:03 +0200 Subject: [PATCH] Rebuild frontend --- frontend/package.json | 2 +- .../src/components/charts/DataConverter.vue | 16 +-- .../components/charts/DefaultLineOptions.vue | 124 +++++++++++------- .../src/components/dashboard/MainAccount.vue | 53 +++++--- .../components/dashboard/MainAccountChart.vue | 5 +- frontend/src/components/store/modules/root.js | 46 +++---- frontend/src/locales/bg.json | 1 + frontend/src/locales/cs.json | 1 + frontend/src/locales/de.json | 1 + frontend/src/locales/el.json | 1 + frontend/src/locales/en-gb.json | 1 + frontend/src/locales/en.json | 1 + frontend/src/locales/es.json | 27 ++-- frontend/src/locales/fi.json | 1 + frontend/src/locales/fr.json | 1 + frontend/src/locales/hu.json | 1 + frontend/src/locales/it.json | 1 + frontend/src/locales/nb.json | 1 + frontend/src/locales/nl.json | 1 + frontend/src/locales/pl.json | 1 + frontend/src/locales/pt-br.json | 1 + frontend/src/locales/pt.json | 1 + frontend/src/locales/ro.json | 1 + frontend/src/locales/ru.json | 1 + frontend/src/locales/sk.json | 1 + frontend/src/locales/sv.json | 1 + frontend/src/locales/vi.json | 1 + frontend/src/locales/zh-cn.json | 1 + frontend/src/locales/zh-tw.json | 1 + frontend/yarn.lock | 55 ++++---- public/v2/js/accounts/create.js | 2 +- public/v2/js/accounts/delete.js | 2 +- public/v2/js/accounts/index.js | 2 +- public/v2/js/accounts/index.js.map | 2 +- public/v2/js/accounts/show.js | 2 +- public/v2/js/dashboard.js | 2 +- public/v2/js/dashboard.js.map | 2 +- public/v2/js/transactions/create.js | 2 +- public/v2/js/transactions/create.js.map | 2 +- public/v2/js/transactions/edit.js | 2 +- public/v2/js/transactions/edit.js.map | 2 +- public/v2/js/transactions/index.js | 2 +- public/v2/js/transactions/index.js.map | 2 +- public/v2/js/vendor.js | 2 +- public/v2/js/vendor.js.LICENSE.txt | 10 +- public/v2/js/vendor.js.map | 2 +- resources/lang/bg_BG/firefly.php | 1 + resources/lang/cs_CZ/firefly.php | 1 + resources/lang/de_DE/firefly.php | 1 + resources/lang/el_GR/firefly.php | 1 + resources/lang/en_GB/firefly.php | 1 + resources/lang/en_US/firefly.php | 1 + resources/lang/es_ES/firefly.php | 23 ++-- resources/lang/es_ES/form.php | 10 +- resources/lang/es_ES/validation.php | 4 +- resources/lang/fi_FI/firefly.php | 1 + resources/lang/fr_FR/firefly.php | 1 + resources/lang/hu_HU/firefly.php | 1 + resources/lang/id_ID/firefly.php | 1 + resources/lang/it_IT/firefly.php | 1 + resources/lang/nb_NO/firefly.php | 1 + resources/lang/nl_NL/firefly.php | 1 + resources/lang/pl_PL/firefly.php | 1 + resources/lang/pt_BR/firefly.php | 1 + resources/lang/pt_PT/firefly.php | 1 + resources/lang/ro_RO/firefly.php | 1 + resources/lang/ru_RU/firefly.php | 1 + resources/lang/sk_SK/firefly.php | 1 + resources/lang/sv_SE/firefly.php | 1 + resources/lang/tr_TR/firefly.php | 1 + resources/lang/vi_VN/firefly.php | 1 + resources/lang/zh_CN/firefly.php | 1 + resources/lang/zh_TW/firefly.php | 1 + 73 files changed, 268 insertions(+), 183 deletions(-) diff --git a/frontend/package.json b/frontend/package.json index 18c3c97c61..8160756921 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -29,13 +29,13 @@ "admin-lte": "^3.1.0", "bootstrap": "^4.6.0", "bootstrap-vue": "^2.21.2", + "chart.js": "^3.0.2", "icheck-bootstrap": "^3.0.1", "jquery-ui": "^1.12.1", "leaflet": "^1.7.1", "overlayscrollbars": "^1.13.1", "sortablejs": "^1.13.0", "v-calendar": "^2.3.0", - "vue-chartjs": "^3.5.1", "vue-typeahead-bootstrap": "^2.8.0", "vue2-leaflet": "^2.7.0" } diff --git a/frontend/src/components/charts/DataConverter.vue b/frontend/src/components/charts/DataConverter.vue index e867404ad4..c7ccbee79b 100644 --- a/frontend/src/components/charts/DataConverter.vue +++ b/frontend/src/components/charts/DataConverter.vue @@ -32,20 +32,20 @@ export default { convertChart(dataSet) { this.dataSet = dataSet; this.newDataSet = { - count: 0, + //count: 0, labels: [], datasets: [] } this.getLabels(); this.getDataSets(); - this.newDataSet.count = this.newDataSet.datasets.length; + //this.newDataSet.count = this.newDataSet.datasets.length; return this.newDataSet; }, colorizeBarData(dataSet) { this.dataSet = dataSet; this.newDataSet = { - count: 0, + //count: 0, labels: [], datasets: [] }; @@ -79,7 +79,7 @@ export default { //strokePointHighColors.push("rgba(" + colourSet[i][0] + ", " + colourSet[i][1] + ", " + colourSet[i][2] + ", 0.9)"); } this.newDataSet.labels = this.dataSet.labels; - this.newDataSet.count = this.dataSet.count; + //this.newDataSet.count = this.dataSet.count; for (let setKey in this.dataSet.datasets) { if (this.dataSet.datasets.hasOwnProperty(setKey)) { var dataset = this.dataSet.datasets[setKey]; @@ -94,7 +94,7 @@ export default { colorizeLineData(dataSet) { this.dataSet = dataSet; this.newDataSet = { - count: 0, + //count: 0, labels: [], datasets: [] }; @@ -128,10 +128,10 @@ export default { //strokePointHighColors.push("rgba(" + colourSet[i][0] + ", " + colourSet[i][1] + ", " + colourSet[i][2] + ", 0.9)"); } this.newDataSet.labels = this.dataSet.labels; - this.newDataSet.count = this.dataSet.count; + //this.newDataSet.count = this.dataSet.count; for (let setKey in this.dataSet.datasets) { if (this.dataSet.datasets.hasOwnProperty(setKey)) { - var dataset = this.dataSet.datasets[setKey]; + let dataset = this.dataSet.datasets[setKey]; dataset.fill = false; dataset.backgroundColor = dataset.borderColor = fillColors[setKey]; this.newDataSet.datasets.push(dataset); @@ -168,7 +168,7 @@ export default { newSet.type = oldSet.type; newSet.currency_symbol = oldSet.currency_symbol; newSet.currency_code = oldSet.currency_code; - newSet.yAxisID = oldSet.yAxisID; + //newSet.yAxisID = oldSet.yAxisID; newSet.data = []; for (const entryLabel in oldSet.entries) { if (oldSet.entries.hasOwnProperty(entryLabel)) { diff --git a/frontend/src/components/charts/DefaultLineOptions.vue b/frontend/src/components/charts/DefaultLineOptions.vue index 4d0a901719..e82e869b6a 100644 --- a/frontend/src/components/charts/DefaultLineOptions.vue +++ b/frontend/src/components/charts/DefaultLineOptions.vue @@ -79,67 +79,95 @@ export default { return sections; }, getDefaultOptions() { - var self = this; return { - legend: { - display: false, - }, - animation: { - duration: 0, - }, responsive: true, maintainAspectRatio: false, + plugins: { + legend: { + display: false, + }, + }, + animations: false, + elements: { line: { cubicInterpolationMode: 'monotone' } }, scales: { - xAxes: [ - { - gridLines: { - display: false - }, - ticks: { - // break ticks when too long - callback: function (value, index, values) { - // date format - let dateObj = new Date(value); - let options = {year: 'numeric', month: 'long', day: 'numeric'}; - let str = new Intl.DateTimeFormat(localStorage.locale, options).format(dateObj); - //console.log(); - //return self.formatLabel(value, 20); - return self.formatLabel(str, 20); - } + x: { + //type: 'linear' + grid: { + display: false, + }, + ticks: { + callback: function (value, index, values) { + //return this.getLabelForValue(value); + let dateObj = new Date(this.getLabelForValue(value)); + let options = {year: 'numeric', month: 'long', day: 'numeric'}; + let str = new Intl.DateTimeFormat(localStorage.locale, options).format(dateObj); + return str; + // // //console.log(); + // // //return self.formatLabel(value, 20); + // // return self.formatLabel(str, 20); } } - ], - yAxes: [{ - display: true, - ticks: { - callback: function (tickValue) { - "use strict"; - let currencyCode = this.chart.data.datasets[0].currency_code ? this.chart.data.datasets[0].currency_code : 'EUR'; - return new Intl.NumberFormat(localStorage.locale, {style: 'currency', currency: currencyCode}).format(tickValue); - }, - beginAtZero: true - } + }, + y: { + suggestedMin: 0 - }] - }, - tooltips: { - mode: 'index', - callbacks: { - label: function (tooltipItem, data) { - "use strict"; - let currencyCode = data.datasets[tooltipItem.datasetIndex].currency_code ? data.datasets[tooltipItem.datasetIndex].currency_code : 'EUR'; - let nrString = - new Intl.NumberFormat(localStorage.locale, {style: 'currency', currency: currencyCode}).format(tooltipItem.yLabel) - - return data.datasets[tooltipItem.datasetIndex].label + ': ' + nrString; - } + //type: 'linear' } - } + }, + + // scales: { + // xAxes: [ + // { + // gridLines: { + // display: false + // }, + // ticks: { + // // break ticks when too long + // callback: function (value, index, values) { + // return value; + // // date format + // // let dateObj = new Date(value); + // // let options = {year: 'numeric', month: 'long', day: 'numeric'}; + // // let str = new Intl.DateTimeFormat(localStorage.locale, options).format(dateObj); + // // //console.log(); + // // //return self.formatLabel(value, 20); + // // return self.formatLabel(str, 20); + // } + // } + // } + // ], + // yAxes: [{ + // display: true, + // ticks: { + // callback: function (tickValue) { + // "use strict"; + // return tickValue; + // // let currencyCode = this.chart.data.datasets[0].currency_code ? this.chart.data.datasets[0].currency_code : 'EUR'; + // // return new Intl.NumberFormat(localStorage.locale, {style: 'currency', currency: currencyCode}).format(tickValue); + // }, + // beginAtZero: true + // } + // + // }] + // }, + // tooltips: { + // mode: 'index', + // // callbacks: { + // // label: function (tooltipItem, data) { + // // "use strict"; + // // let currencyCode = data.datasets[tooltipItem.datasetIndex].currency_code ? data.datasets[tooltipItem.datasetIndex].currency_code : 'EUR'; + // // let nrString = + // // new Intl.NumberFormat(localStorage.locale, {style: 'currency', currency: currencyCode}).format(tooltipItem.yLabel) + // // + // // return data.datasets[tooltipItem.datasetIndex].label + ': ' + nrString; + // // } + // // } + // } }; } diff --git a/frontend/src/components/dashboard/MainAccount.vue b/frontend/src/components/dashboard/MainAccount.vue index f63b39a6eb..cfa734faa9 100644 --- a/frontend/src/components/dashboard/MainAccount.vue +++ b/frontend/src/components/dashboard/MainAccount.vue @@ -24,8 +24,8 @@

{{ $t('firefly.yourAccounts') }}

-
- +
+
@@ -33,6 +33,9 @@
+
+ {{ $t('firefly.timezone_difference', {local: localTimeZone, system: systemTimeZone}) }} +