Update and build.

This commit is contained in:
James Cole
2021-07-03 12:32:02 +02:00
parent 3d81315769
commit 739d01efe4
44 changed files with 459 additions and 300 deletions

View File

@@ -69,22 +69,22 @@
</template>
<template #cell(amount_due)="data">
<span class="text-success" v-if="parseFloat(data.item.amount_due) > 0">
{{ Intl.NumberFormat('en-US', {style: 'currency', currency: data.item.currency_code}).format(data.item.amount_due) }}
{{ Intl.NumberFormat(locale, {style: 'currency', currency: data.item.currency_code}).format(data.item.amount_due) }}
</span>
<span class="text-danger" v-if="parseFloat(data.item.amount_due) < 0">
{{ Intl.NumberFormat('en-US', {style: 'currency', currency: data.item.currency_code}).format(data.item.amount_due) }}
{{ Intl.NumberFormat(locale, {style: 'currency', currency: data.item.currency_code}).format(data.item.amount_due) }}
</span>
<span class="text-muted" v-if="parseFloat(data.item.amount_due) === 0.0">
{{ Intl.NumberFormat('en-US', {style: 'currency', currency: data.item.currency_code}).format(data.item.amount_due) }}
{{ Intl.NumberFormat(locale, {style: 'currency', currency: data.item.currency_code}).format(data.item.amount_due) }}
</span>
</template>
<template #cell(current_balance)="data">
<span class="text-success" v-if="parseFloat(data.item.current_balance) > 0">
{{
Intl.NumberFormat('en-US', {
Intl.NumberFormat(locale, {
style: 'currency', currency:
data.item.currency_code
}).format(data.item.current_balance)
@@ -92,7 +92,7 @@
</span>
<span class="text-danger" v-if="parseFloat(data.item.current_balance) < 0">
{{
Intl.NumberFormat('en-US', {
Intl.NumberFormat(locale, {
style: 'currency', currency:
data.item.currency_code
}).format(data.item.current_balance)
@@ -101,7 +101,7 @@
<span class="text-muted" v-if="0 === parseFloat(data.item.current_balance)">
{{
Intl.NumberFormat('en-US', {
Intl.NumberFormat(locale, {
style: 'currency', currency:
data.item.currency_code
}).format(data.item.current_balance)
@@ -112,17 +112,17 @@
</span>
<span v-if="'asset' === type && 'loading' !== data.item.balance_diff">
(<span class="text-success" v-if="parseFloat(data.item.balance_diff) > 0">{{
Intl.NumberFormat('en-US', {
Intl.NumberFormat(locale, {
style: 'currency', currency:
data.item.currency_code
}).format(data.item.balance_diff)
}}</span><span class="text-muted" v-if="0===parseFloat(data.item.balance_diff)">{{
Intl.NumberFormat('en-US', {
Intl.NumberFormat(locale, {
style: 'currency', currency:
data.item.currency_code
}).format(data.item.balance_diff)
}}</span><span class="text-danger" v-if="parseFloat(data.item.balance_diff) < 0">{{
Intl.NumberFormat('en-US', {
Intl.NumberFormat(locale, {
style: 'currency', currency:
data.item.currency_code
}).format(data.item.balance_diff)
@@ -210,7 +210,8 @@ export default {
chosenClass: 'is-selected',
onEnd: null
},
sortable: null
sortable: null,
locale: 'en-US'
}
},
watch: {
@@ -249,6 +250,7 @@ export default {
}
},
created() {
this.locale = localStorage.locale ?? 'en-US';
let pathName = window.location.pathname;
let parts = pathName.split('/');
this.type = parts[parts.length - 1];

View File

@@ -24,14 +24,14 @@
<div class="col">
<div class="card">
<div class="card-body">
Treemap categories?
Treemap categories
</div>
</div>
</div>
<div class="col">
<div class="card">
<div class="card-body">
Treemap accounts?
Treemap accounts
</div>
</div>
</div>
@@ -82,15 +82,15 @@
</template>
<template #cell(amount)="data">
<span class="text-success" v-if="'deposit' === data.item.type">
{{ Intl.NumberFormat('en-US', {style: 'currency', currency: data.item.currency_code}).format(data.item.amount) }}
{{ Intl.NumberFormat(locale, {style: 'currency', currency: data.item.currency_code}).format(data.item.amount) }}
</span>
<span class="text-danger" v-else-if="'withdrawal' === data.item.type">
{{ Intl.NumberFormat('en-US', {style: 'currency', currency: data.item.currency_code}).format(-data.item.amount) }}
{{ Intl.NumberFormat(locale, {style: 'currency', currency: data.item.currency_code}).format(-data.item.amount) }}
</span>
<span class="text-muted" v-else-if="'transfer' === data.item.type">
{{ Intl.NumberFormat('en-US', {style: 'currency', currency: data.item.currency_code}).format(data.item.amount) }}
{{ Intl.NumberFormat(locale, {style: 'currency', currency: data.item.currency_code}).format(data.item.amount) }}
</span>
</template>
<template #cell(date)="data">
@@ -154,13 +154,13 @@
</div>
</div>
<div class="row">
<div class="col-xl-2 col-lg-4 col-sm-6 col-xs-12">
<div class="col-xl-2 col-lg-4 col-sm-6 col-xs-12" v-for="range in ranges">
<div class="card">
<div class="card-header">
<h3 class="card-title">I am title</h3>
<h3 class="card-title">{{ formatDate(range.start, 'yyyy-LL') }}</h3>
</div>
<div class="card-body">
Box previous periods
<a :href="'./transactions/' + type + '/' + formatDate(range.start,'yyyy-LL-dd') + '/' + formatDate(range.end, 'yyyy-LL-dd')">Transactions</a>
</div>
</div>
</div>
@@ -172,6 +172,9 @@
import {mapGetters, mapMutations} from "vuex";
import format from "date-fns/format";
import sub from "date-fns/sub";
import startOfMonth from "date-fns/startOfMonth";
import endOfMonth from "date-fns/endOfMonth";
import {configureAxios} from "../../shared/forageStore";
export default {
@@ -196,7 +199,11 @@ export default {
chosenClass: 'is-selected',
onEnd: null
},
sortable: null
sortable: null,
locale: 'en-US',
ranges: [],
urlStart: null,
urlEnd: null,
}
},
watch: {
@@ -224,11 +231,16 @@ export default {
}
},
created() {
this.locale = localStorage.locale ?? 'en-US';
let pathName = window.location.pathname;
let parts = pathName.split('/');
this.type = parts[parts.length - 1];
this.perPage = this.listPageSize ?? 51;
// console.log('Per page: ' + this.perPage);
if (5 === parts.length) {
this.urlStart = new Date(parts[3]);
this.urlEnd = new Date(parts[4]);
this.type = parts[parts.length - 3];
}
let params = new URLSearchParams(window.location.search);
this.currentPage = params.get('page') ? parseInt(params.get('page')) : 1;
@@ -262,8 +274,8 @@ export default {
{key: 'description', label: this.$t('list.description'), sortable: true},
{key: 'amount', label: this.$t('list.amount'), sortable: true},
{key: 'date', label: this.$t('list.date'), sortable: true},
{key: 'source_name', label: this.$t('list.source_account'), sortable: true},
{key: 'destination_name', label: this.$t('list.destination_account'), sortable: true},
{key: 'source_account', label: this.$t('list.source_account'), sortable: true},
{key: 'destination_account', label: this.$t('list.destination_account'), sortable: true},
{key: 'category_name', label: this.$t('list.category'), sortable: true},
{key: 'menu', label: ' ', sortable: false},
];
@@ -283,13 +295,39 @@ export default {
this.transactions = [];
this.transactionRows = [];
this.downloadTransactionList(1);
this.calculateDateRanges();
}
},
calculateDateRanges: function () {
let yearAgo = sub(this.start, {years: 1});
let currentDate = this.start;
while (currentDate > yearAgo) {
// start + end of month:
let st = startOfMonth(currentDate);
let en = endOfMonth(currentDate);
this.ranges.push({start: st, end: en});
currentDate = sub(currentDate, {months: 1});
//console.log(currentDate);
}
},
formatDate: function (date, frm) {
return format(date, frm);
},
downloadTransactionList: function (page) {
// console.log('downloadTransactionList(' + page + ')');
configureAxios().then(async (api) => {
let startStr = format(this.start, 'y-MM-dd');
let endStr = format(this.end, 'y-MM-dd');
console.log(this.urlEnd);
console.log(this.urlStart);
if(null !== this.urlEnd && null !== this.urlStart) {
startStr = format(this.urlStart, 'y-MM-dd');
endStr = format(this.urlEnd, 'y-MM-dd');
}
api.get('./api/v1/transactions?type=' + this.type + '&page=' + page + "&start=" + startStr + "&end=" + endStr + '&cache=' + this.cacheKey)
.then(response => {

View File

@@ -138,8 +138,8 @@
"account_type_mortgage": "Mutuo",
"save_transactions_by_moving_js": "Nessuna transazione|Salva questa transazione spostandola in un altro conto.|Salva queste transazioni spostandole in un altro conto.",
"none_in_select_list": "(nessuna)",
"transaction_expand_split": "Expand split",
"transaction_collapse_split": "Collapse split"
"transaction_expand_split": "Espandi suddivisione",
"transaction_collapse_split": "Comprimi suddivisione"
},
"list": {
"piggy_bank": "Salvadanaio",

View File

@@ -138,8 +138,8 @@
"account_type_mortgage": "Hipoteca",
"save_transactions_by_moving_js": "Nenhuma transa\u00e7\u00e3o| Guarde esta transa\u00e7\u00e3o movendo-a para outra conta| Guarde estas transa\u00e7\u00f5es movendo-as para outra conta.",
"none_in_select_list": "(nenhum)",
"transaction_expand_split": "Expand split",
"transaction_collapse_split": "Collapse split"
"transaction_expand_split": "Expandir divis\u00e3o",
"transaction_collapse_split": "Ocultar divis\u00e3o"
},
"list": {
"piggy_bank": "Mealheiro",

View File

@@ -997,7 +997,12 @@
"@types/estree" "*"
"@types/json-schema" "*"
"@types/estree@*", "@types/estree@^0.0.48":
"@types/estree@*":
version "0.0.49"
resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.49.tgz#3facb98ebcd4114a4ecef74e0de2175b56fd4464"
integrity sha512-K1AFuMe8a+pXmfHTtnwBvqoEylNKVeaiKYkjmcEAdytMQVJ/i9Fu7sc13GxgXdO49gkE7Hy8SyJonUZUn+eVaw==
"@types/estree@^0.0.48":
version "0.0.48"
resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.48.tgz#18dc8091b285df90db2f25aa7d906cfc394b7f74"
integrity sha512-LfZwXoGUDo0C3me81HXgkBg5CTQYb6xzEl+fNmbO4JdRiSKQ8A0GD1OBBvKAIsbCUgoyAty7m99GqqMQe784ew==
@@ -1064,9 +1069,9 @@
integrity sha512-1z8k4wzFnNjVK/tlxvrWuK5WMt6mydWWP7+zvH5eFep4oj+UkrfiJTRtjCeBXNpwaA/FYqqtb4/QS4ianFpIRA==
"@types/node@*":
version "15.12.5"
resolved "https://registry.yarnpkg.com/@types/node/-/node-15.12.5.tgz#9a78318a45d75c9523d2396131bd3cca54b2d185"
integrity sha512-se3yX7UHv5Bscf8f1ERKvQOD6sTyycH3hdaoozvaLxgUiY5lIGEeH37AD0G0Qi9kPqihPn0HOfd2yaIEN9VwEg==
version "16.0.0"
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.0.0.tgz#067a6c49dc7a5c2412a505628e26902ae967bf6f"
integrity sha512-TmCW5HoZ2o2/z2EYi109jLqIaPIi9y/lc2LmDCWzuCi35bcaQ+OtUh6nwBiFK7SOu25FAU5+YKdqFZUwtqGSdg==
"@types/parse-json@^4.0.0":
version "4.0.0"
@@ -1079,9 +1084,9 @@
integrity sha512-wWKOClTTiizcZhXnPY4wikVAwmdYHp8q6DmC+EJUzAMsycb7HB32Kh9RN4+0gExjmPmZSAQjgURXIGATPegAvA==
"@types/svgo@^1":
version "1.3.5"
resolved "https://registry.yarnpkg.com/@types/svgo/-/svgo-1.3.5.tgz#18a0166fbcdfbfc7f17d0491da2ea07ee397d3f9"
integrity sha512-y9Pw8IK50OqFRDpdI9Is29KlWiENVW9FDvlTmGHelvTfR2brYFJbsClvulZfeq6YKacFrDsG9a39w0kJZdHLaw==
version "1.3.6"
resolved "https://registry.yarnpkg.com/@types/svgo/-/svgo-1.3.6.tgz#9db00a7ddf9b26ad2feb6b834bef1818677845e1"
integrity sha512-AZU7vQcy/4WFEuwnwsNsJnFwupIpbllH1++LXScN6uxT1Z4zPzdrWG97w4/I7eFKFTvfy/bHFStWjdBAg2Vjug==
"@vue/component-compiler-utils@^3.1.0":
version "3.2.2"
@@ -1274,7 +1279,7 @@ acorn@^7.0.0:
resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa"
integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==
acorn@^8.2.1:
acorn@^8.4.1:
version "8.4.1"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.4.1.tgz#56c36251fc7cabc7096adc18f05afe814321a28c"
integrity sha512-asabaBSkEKosYKMITunzX177CXxQ4Q8BSSzMTKD+FefUhipQC70gfW5SiUDhYQ3vk8G+81HqQk7Fv9OXwwn9KA==
@@ -2923,9 +2928,9 @@ ekko-lightbox@^5.3.0:
integrity sha512-mbacwySuVD3Ad6F2hTkjSTvJt59bcVv2l/TmBerp4xZnLak8tPtA4AScUn4DL42c1ksTiAO6sGhJZ52P/1Qgew==
electron-to-chromium@^1.3.723:
version "1.3.762"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.762.tgz#3fa4e3bcbda539b50e3aa23041627063a5cffe61"
integrity sha512-LehWjRpfPcK8F1Lf/NZoAwWLWnjJVo0SZeQ9j/tvnBWYcT99qDqgo4raAfS2oTKZjPrR/jxruh85DGgDUmywEA==
version "1.3.766"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.766.tgz#2fd14a4e54f77665872f4e23fcf4968e83638220"
integrity sha512-u2quJ862q9reRKh/je3GXis3w38+RoXH1J9N3XjtsS6NzmUAosNsyZgUVFZPN/ZlJ3v6T0rTyZR3q/J5c6Sy5w==
elliptic@^6.5.3:
version "6.5.4"
@@ -5115,9 +5120,9 @@ postcss-load-config@^3.0.1:
yaml "^1.10.2"
postcss-loader@^6.1.0:
version "6.1.0"
resolved "https://registry.yarnpkg.com/postcss-loader/-/postcss-loader-6.1.0.tgz#13c800a00b3c7d434a1319a73d85e2df0714cdde"
integrity sha512-yA/cXBfACkthZNA2hQxOnaReVfQ6uLmvbEDQzNafpbK40URZJvP/28dL1DG174Gvz3ptkkHbbwDBCh+gXR94CA==
version "6.1.1"
resolved "https://registry.yarnpkg.com/postcss-loader/-/postcss-loader-6.1.1.tgz#58dd0a3accd9bc87cc52eff75244db578d11301a"
integrity sha512-lBmJMvRh1D40dqpWKr9Rpygwxn8M74U9uaCSeYGNKLGInbk9mXBt1ultHf2dH9Ghk6Ue4UXlXWwGMH9QdUJ5ug==
dependencies:
cosmiconfig "^7.0.0"
klona "^2.0.4"
@@ -6665,16 +6670,16 @@ webpack-sources@^2.3.0:
source-map "^0.6.1"
webpack@^5.38.1, webpack@^5.40.0:
version "5.41.1"
resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.41.1.tgz#23fa1d82c95c222d3fc3163806b9a833fe52b253"
integrity sha512-AJZIIsqJ/MVTmegEq9Tlw5mk5EHdGiJbDdz9qP15vmUH+oxI1FdWcL0E9EO8K/zKaRPWqEs7G/OPxq1P61u5Ug==
version "5.42.0"
resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.42.0.tgz#39aadbce84ad2cebf86cc5f88a2c53db65cbddfb"
integrity sha512-Ln8HL0F831t1x/yPB/qZEUVmZM4w9BnHZ1EQD/sAUHv8m22hthoPniWTXEzFMh/Sf84mhrahut22TX5KxWGuyQ==
dependencies:
"@types/eslint-scope" "^3.7.0"
"@types/estree" "^0.0.48"
"@webassemblyjs/ast" "1.11.0"
"@webassemblyjs/wasm-edit" "1.11.0"
"@webassemblyjs/wasm-parser" "1.11.0"
acorn "^8.2.1"
acorn "^8.4.1"
browserslist "^4.14.5"
chrome-trace-event "^1.0.2"
enhanced-resolve "^5.8.0"