mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-26 13:36:15 +00:00
First page for currency exchange rates.
This commit is contained in:
@@ -8,14 +8,21 @@
|
||||
"/build/webhooks/create.js": "/build/webhooks/create.js",
|
||||
"/build/webhooks/edit.js": "/build/webhooks/edit.js",
|
||||
"/build/webhooks/show.js": "/build/webhooks/show.js",
|
||||
"/build/exchange-rates/index.js": "/build/exchange-rates/index.js",
|
||||
"/public/v1/js/app.js": "/public/v1/js/app.js",
|
||||
"/public/v1/js/app.js.LICENSE.txt": "/public/v1/js/app.js.LICENSE.txt",
|
||||
"/public/v1/js/app_vue.js": "/public/v1/js/app_vue.js",
|
||||
"/public/v1/js/app_vue.js.LICENSE.txt": "/public/v1/js/app_vue.js.LICENSE.txt",
|
||||
"/public/v1/js/create.js": "/public/v1/js/create.js",
|
||||
"/public/v1/js/create.js.LICENSE.txt": "/public/v1/js/create.js.LICENSE.txt",
|
||||
"/public/v1/js/create_transaction.js": "/public/v1/js/create_transaction.js",
|
||||
"/public/v1/js/create_transaction.js.LICENSE.txt": "/public/v1/js/create_transaction.js.LICENSE.txt",
|
||||
"/public/v1/js/edit.js": "/public/v1/js/edit.js",
|
||||
"/public/v1/js/edit.js.LICENSE.txt": "/public/v1/js/edit.js.LICENSE.txt",
|
||||
"/public/v1/js/edit_transaction.js": "/public/v1/js/edit_transaction.js",
|
||||
"/public/v1/js/edit_transaction.js.LICENSE.txt": "/public/v1/js/edit_transaction.js.LICENSE.txt",
|
||||
"/public/v1/js/exchange-rates/index.js": "/public/v1/js/exchange-rates/index.js",
|
||||
"/public/v1/js/exchange-rates/index.js.LICENSE.txt": "/public/v1/js/exchange-rates/index.js.LICENSE.txt",
|
||||
"/public/v1/js/ff/accounts/create.js": "/public/v1/js/ff/accounts/create.js",
|
||||
"/public/v1/js/ff/accounts/edit-reconciliation.js": "/public/v1/js/ff/accounts/edit-reconciliation.js",
|
||||
"/public/v1/js/ff/accounts/edit.js": "/public/v1/js/ff/accounts/edit.js",
|
||||
@@ -84,6 +91,8 @@
|
||||
"/public/v1/js/ff/transactions/mass/edit-bulk.js": "/public/v1/js/ff/transactions/mass/edit-bulk.js",
|
||||
"/public/v1/js/ff/transactions/mass/edit.js": "/public/v1/js/ff/transactions/mass/edit.js",
|
||||
"/public/v1/js/ff/transactions/show.js": "/public/v1/js/ff/transactions/show.js",
|
||||
"/public/v1/js/index.js": "/public/v1/js/index.js",
|
||||
"/public/v1/js/index.js.LICENSE.txt": "/public/v1/js/index.js.LICENSE.txt",
|
||||
"/public/v1/js/lib/Chart.bundle.min.js": "/public/v1/js/lib/Chart.bundle.min.js",
|
||||
"/public/v1/js/lib/accounting.min.js": "/public/v1/js/lib/accounting.min.js",
|
||||
"/public/v1/js/lib/bootstrap-multiselect.js": "/public/v1/js/lib/bootstrap-multiselect.js",
|
||||
@@ -142,6 +151,8 @@
|
||||
"/public/v1/js/lib/vue.js": "/public/v1/js/lib/vue.js",
|
||||
"/public/v1/js/profile.js": "/public/v1/js/profile.js",
|
||||
"/public/v1/js/profile.js.LICENSE.txt": "/public/v1/js/profile.js.LICENSE.txt",
|
||||
"/public/v1/js/show.js": "/public/v1/js/show.js",
|
||||
"/public/v1/js/show.js.LICENSE.txt": "/public/v1/js/show.js.LICENSE.txt",
|
||||
"/public/v1/js/webhooks/create.js": "/public/v1/js/webhooks/create.js",
|
||||
"/public/v1/js/webhooks/create.js.LICENSE.txt": "/public/v1/js/webhooks/create.js.LICENSE.txt",
|
||||
"/public/v1/js/webhooks/edit.js": "/public/v1/js/webhooks/edit.js",
|
||||
|
||||
97
resources/assets/v1/src/components/exchange-rates/Index.vue
Normal file
97
resources/assets/v1/src/components/exchange-rates/Index.vue
Normal file
@@ -0,0 +1,97 @@
|
||||
<!--
|
||||
- Index.vue
|
||||
- Copyright (c) 2022 james@firefly-iii.org
|
||||
-
|
||||
- This file is part of Firefly III (https://github.com/firefly-iii).
|
||||
-
|
||||
- This program is free software: you can redistribute it and/or modify
|
||||
- it under the terms of the GNU Affero General Public License as
|
||||
- published by the Free Software Foundation, either version 3 of the
|
||||
- License, or (at your option) any later version.
|
||||
-
|
||||
- This program is distributed in the hope that it will be useful,
|
||||
- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
- GNU Affero General Public License for more details.
|
||||
-
|
||||
- You should have received a copy of the GNU Affero General Public License
|
||||
- along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<div class="row">
|
||||
<div class="col-lg-8 col-lg-offset-2 col-md-12 col-sm-12 col-xs-12">
|
||||
<div class="box box-primary">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">{{ $t('firefly.header_exchange_rates') }}</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<p>
|
||||
{{ $t('firefly.exchange_rates_intro') }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-8 col-lg-offset-2 col-md-12 col-sm-12 col-xs-12">
|
||||
<div class="box box-default" v-for="currency in currencies" :key="currency.id">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">{{ currency.name }}</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<ul v-if="currencies.length > 0">
|
||||
<li v-for="sub in currencies" :key="sub.id" v-show="sub.id !== currency.id">
|
||||
<a :href="'exchange-rates/' + currency.code + '/' + sub.code" :title="$t('firefly.exchange_rates_from_to', {from: currency.name, to: sub.name})">{{ $t('firefly.exchange_rates_from_to', {from: currency.name, to: sub.name}) }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "Index",
|
||||
data() {
|
||||
return {
|
||||
currencies: [],
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.getCurrencies();
|
||||
},
|
||||
methods: {
|
||||
getCurrencies: function () {
|
||||
this.currencies = [];
|
||||
this.downloadCurrencies(1);
|
||||
},
|
||||
downloadCurrencies: function (page) {
|
||||
axios.get("./api/v2/currencies?enabled=1&page=" + page).then((response) => {
|
||||
for (let i in response.data.data) {
|
||||
if (response.data.data.hasOwnProperty(i)) {
|
||||
let current = response.data.data[i];
|
||||
let currency = {
|
||||
id: current.id,
|
||||
name: current.attributes.name,
|
||||
code: current.attributes.code,
|
||||
};
|
||||
this.currencies.push(currency);
|
||||
}
|
||||
}
|
||||
|
||||
if (response.data.meta.pagination.current_page < response.data.meta.pagination.total_pages) {
|
||||
this.downloadCurrencies(parseInt(response.data.meta.pagination.current_page) + 1);
|
||||
}
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
39
resources/assets/v1/src/exchange-rates/index.js
Normal file
39
resources/assets/v1/src/exchange-rates/index.js
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* edit_transactions.js
|
||||
* Copyright (c) 2019 james@firefly-iii.org
|
||||
*
|
||||
* This file is part of Firefly III (https://github.com/firefly-iii).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import Index from "../components/exchange-rates/Index";
|
||||
|
||||
/**
|
||||
* First we will load Axios via bootstrap.js
|
||||
* jquery and bootstrap-sass preloaded in app.js
|
||||
* vue, uiv and vuei18n are in app_vue.js
|
||||
*/
|
||||
|
||||
require('../bootstrap');
|
||||
const i18n = require('../i18n');
|
||||
|
||||
let props = {};
|
||||
const app = new Vue({
|
||||
i18n,
|
||||
el: "#exchange_rates_index",
|
||||
render: (createElement) => {
|
||||
return createElement(Index, {props: props})
|
||||
},
|
||||
});
|
||||
1
resources/assets/v1/src/locales/.json
Normal file
1
resources/assets/v1/src/locales/.json
Normal file
@@ -0,0 +1 @@
|
||||
[]
|
||||
@@ -129,7 +129,10 @@
|
||||
"logs": "Logs",
|
||||
"response": "Response",
|
||||
"visit_webhook_url": "Visit webhook URL",
|
||||
"reset_webhook_secret": "Reset webhook secret"
|
||||
"reset_webhook_secret": "Reset webhook secret",
|
||||
"header_exchange_rates": "Exchange rates",
|
||||
"exchange_rates_intro": "Firefly III supports downloading and using exchange rates. Read more about this in <a href=\"https:\/\/docs.firefly-iii.org\/LOL_NOT_FINISHED_YET_TODO\">the documentation<\/a>.",
|
||||
"exchange_rates_from_to": "Between {from} and {to}"
|
||||
},
|
||||
"form": {
|
||||
"url": "URL",
|
||||
|
||||
@@ -46,3 +46,6 @@ mix.js('src/webhooks/index.js', 'build/webhooks').vue({version: 2});
|
||||
mix.js('src/webhooks/create.js', 'build/webhooks').vue({version: 2});
|
||||
mix.js('src/webhooks/edit.js', 'build/webhooks').vue({version: 2});
|
||||
mix.js('src/webhooks/show.js', 'build/webhooks').vue({version: 2}).copy('build','../../../public/v1/js')
|
||||
|
||||
// exchange rates
|
||||
mix.js('src/exchange-rates/index.js', 'build/exchange-rates').vue({version: 2});
|
||||
|
||||
Reference in New Issue
Block a user