Build frontend again, using Yarn.

This commit is contained in:
James Cole 2020-11-12 07:11:15 +01:00
parent 60339c9d1b
commit ce51bb8be6
No known key found for this signature in database
GPG Key ID: B5669F9493CDE38D
8 changed files with 282 additions and 271 deletions

View File

@ -43,9 +43,9 @@ if (token) {
let localeToken = document.head.querySelector('meta[name="locale"]');
if (localeToken) {
window.localeValue = localeToken.content;
localStorage.locale = localeToken.content;
} else {
window.localeValue = 'en_US';
localStorage.locale = 'en_US';
}
// admin stuff

View File

@ -25,6 +25,7 @@
return {
dataSet: null,
newDataSet: null,
locale: localStorage.local,
}
},
methods: {
@ -142,7 +143,7 @@
for (let labelKey in dataSet.labels) {
if (dataSet.labels.hasOwnProperty(labelKey)) {
const unixTimeZero = Date.parse(dataSet.labels[labelKey]);
dataSet.labels[labelKey] = new Intl.DateTimeFormat(window.localeValue).format(unixTimeZero);
dataSet.labels[labelKey] = new Intl.DateTimeFormat(this.locale).format(unixTimeZero);
}
}
return dataSet;

View File

@ -83,7 +83,7 @@
callback: function (tickValue) {
"use strict";
let currencyCode = this.chart.data.datasets[0] ? this.chart.data.datasets[0].currency_code : 'EUR';
return new Intl.NumberFormat(window.localeValue, {style: 'currency', currency: currencyCode}).format(tickValue);
return new Intl.NumberFormat(localStorage.locale, {style: 'currency', currency: currencyCode}).format(tickValue);
},
}
@ -95,7 +95,7 @@
label: function (tooltipItem, data) {
"use strict";
let currencyCode = data.datasets[tooltipItem.datasetIndex] ? data.datasets[tooltipItem.datasetIndex].currency_code : 'EUR';
let nrString = new Intl.NumberFormat(window.localeValue, {
let nrString = new Intl.NumberFormat(localStorage.locale, {
style: 'currency',
currency: currencyCode
}).format(tooltipItem.yLabel);

View File

@ -106,7 +106,7 @@ export default {
// date format
let dateObj = new Date(value);
let options = { year: 'numeric', month: 'long', day: 'numeric' };
let str = new Intl.DateTimeFormat(window.localeValue, options).format(dateObj);
let str = new Intl.DateTimeFormat(localStorage.locale, options).format(dateObj);
//console.log();
//return self.formatLabel(value, 20);
return self.formatLabel(str, 20);
@ -120,7 +120,7 @@ export default {
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(window.localeValue, {style: 'currency', currency: currencyCode}).format(tickValue);
return new Intl.NumberFormat(localStorage.locale, {style: 'currency', currency: currencyCode}).format(tickValue);
},
beginAtZero: true
}
@ -134,7 +134,7 @@ export default {
"use strict";
let currencyCode = data.datasets[tooltipItem.datasetIndex].currency_code ? data.datasets[tooltipItem.datasetIndex].currency_code : 'EUR';
let nrString =
new Intl.NumberFormat(window.localeValue, {style: 'currency', currency: currencyCode}).format(tooltipItem.yLabel)
new Intl.NumberFormat(localStorage.locale, {style: 'currency', currency: currencyCode}).format(tooltipItem.yLabel)
return data.datasets[tooltipItem.datasetIndex].label + ': ' + nrString;
}

View File

@ -30,7 +30,7 @@
<tbody>
<tr v-for="transaction in this.transactions">
<td>
<a :href="'transactions/show/' + transaction.id " :title="transaction.date">
<a :href="'transactions/show/' + transaction.id " :title="new Intl.DateTimeFormat(locale, { year: 'numeric', month: 'long', day: 'numeric' }).format(new Date(transaction.attributes.transactions[0].date))">
<span v-if="transaction.attributes.transactions.length > 1">{{ transaction.attributes.group_title }}</span>
<span v-if="1===transaction.attributes.transactions.length">{{ transaction.attributes.transactions[0].description }}</span>
</a>
@ -38,16 +38,16 @@
<td style="text-align:right;">
<span v-for="tr in transaction.attributes.transactions">
<span v-if="'withdrawal' === tr.type" class="text-danger">
{{ Intl.NumberFormat('en-US', {style: 'currency', currency: tr.currency_code}).format(tr.amount * -1)}}<br>
{{ Intl.NumberFormat(locale, {style: 'currency', currency: tr.currency_code}).format(tr.amount * -1) }}<br>
</span>
<span v-if="'deposit' === tr.type" class="text-success">
{{ Intl.NumberFormat('en-US', {style: 'currency', currency: tr.currency_code}).format(tr.amount)}}<br>
{{ Intl.NumberFormat(locale, {style: 'currency', currency: tr.currency_code}).format(tr.amount) }}<br>
</span>
<span v-if="'transfer' === tr.type && tr.source_id === account_id" class="text-info">
{{ Intl.NumberFormat('en-US', {style: 'currency', currency: tr.currency_code}).format(tr.amount * -1)}}<br>
{{ Intl.NumberFormat(locale, {style: 'currency', currency: tr.currency_code}).format(tr.amount * -1) }}<br>
</span>
<span v-if="'transfer' === tr.type && tr.destination_id === account_id" class="text-info">
{{ Intl.NumberFormat('en-US', {style: 'currency', currency: tr.currency_code}).format(tr.amount)}}<br>
{{ Intl.NumberFormat(locale, {style: 'currency', currency: tr.currency_code}).format(tr.amount) }}<br>
</span>
</span>
</td>
@ -59,6 +59,16 @@
<script>
export default {
name: "TransactionListSmall",
data() {
return {
locale: 'en-US'
}
},
mounted() {
this.locale = localStorage.locale ?? 'en-US';
},
methods: {
},
props: {
transactions: {
type: Array,

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long