Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Expand page for currency exchange rates.
James Cole117a376fc3d6
diff --git a/app/Http/Controllers/ExchangeRates/IndexController.php b/app/Http/Controllers/ExchangeRates/IndexController.phpindex 0fa0180c24..bea8bf4a2d 100644--- a/app/Http/Controllers/ExchangeRates/IndexController.php+++ b/app/Http/Controllers/ExchangeRates/IndexController.php@@ -24,6 +24,9 @@ declare(strict_types=1);namespace FireflyIII\Http\Controllers\ExchangeRates;use FireflyIII\Http\Controllers\Controller;+use FireflyIII\Models\TransactionCurrency;+use Illuminate\View\Factory;+use Illuminate\View\View;class IndexController extends Controller{@@ -44,9 +47,14 @@ class IndexController extends Controller);}- public function index()+ public function index(): View{return view('exchange-rates.index');}+ public function rates(TransactionCurrency $from, TransactionCurrency $to): View+ {+ return view('exchange-rates.rates', compact('from', 'to'));+ }+}diff --git a/resources/assets/v1/mix-manifest.json b/resources/assets/v1/mix-manifest.jsonindex 563436036e..56b2171215 100644--- a/resources/assets/v1/mix-manifest.json+++ b/resources/assets/v1/mix-manifest.json@@ -9,6 +9,7 @@"/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",+ "/build/exchange-rates/rates.js": "/build/exchange-rates/rates.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",@@ -23,6 +24,7 @@"/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/exchange-rates/rates.js": "/public/v1/js/exchange-rates/rates.js","/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",diff --git a/resources/assets/v1/src/components/exchange-rates/Rates.vue b/resources/assets/v1/src/components/exchange-rates/Rates.vuenew file mode 100644index 0000000000..e3f65d9419--- /dev/null+++ b/resources/assets/v1/src/components/exchange-rates/Rates.vue@@ -0,0 +1,33 @@+<!--+ - Rates.vue+ - Copyright (c) 2024 [email protected].+ -+ - 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/.+ -->++<script setup>++</script>++<template>+<div>++</div>+</template>++<style scoped>++</style>diff --git a/resources/assets/v1/src/exchange-rates/rates.js b/resources/assets/v1/src/exchange-rates/rates.jsnew file mode 100644index 0000000000..1711ca5997--- /dev/null+++ b/resources/assets/v1/src/exchange-rates/rates.js@@ -0,0 +1,39 @@+/*+ * edit_transactions.js+ * Copyright (c) 2019 [email protected]+ *+ * 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_rates",+ render: (createElement) => {+ return createElement(Index, {props: props})+ },+});diff --git a/resources/assets/v1/webpack.mix.js b/resources/assets/v1/webpack.mix.jsindex ae305aa76d..04ce6319dc 100644--- a/resources/assets/v1/webpack.mix.js+++ b/resources/assets/v1/webpack.mix.js@@ -49,3 +49,4 @@ mix.js('src/webhooks/show.js', 'build/webhooks').vue({version: 2}).copy('build',// exchange ratesmix.js('src/exchange-rates/index.js', 'build/exchange-rates').vue({version: 2});+mix.js('src/exchange-rates/rates.js', 'build/exchange-rates').vue({version: 2});diff --git a/resources/lang/en_US/breadcrumbs.php b/resources/lang/en_US/breadcrumbs.phpindex 9dba742c88..be09962d9a 100644--- a/resources/lang/en_US/breadcrumbs.php+++ b/resources/lang/en_US/breadcrumbs.php@@ -92,4 +92,6 @@ return [// exchange rates'exchange_rates_index' => 'Exchange rates',+ 'exchange_rates_rates' => 'Exchange rates between :from and :to (and the other way around)',+];diff --git a/resources/lang/en_US/firefly.php b/resources/lang/en_US/firefly.phpindex 616b6124d1..bd0d71ebca 100644--- a/resources/lang/en_US/firefly.php+++ b/resources/lang/en_US/firefly.php@@ -1398,7 +1398,7 @@ return ['menu_exchange_rates_index' => 'Exchange rates','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}',+ 'exchange_rates_from_to' => 'Between {from} and {to} (and the other way around)',// Financial administrations'administration_index' => 'Financial administration',diff --git a/resources/views/exchange-rates/rates.twig b/resources/views/exchange-rates/rates.twignew file mode 100644index 0000000000..7be137ebfb--- /dev/null+++ b/resources/views/exchange-rates/rates.twig@@ -0,0 +1,12 @@+{% set VUE_SCRIPT_NAME = 'exchange-rates/rates' %}+{% extends './layout/default' %}+{% block breadcrumbs %}+ {{ Breadcrumbs.render(Route.getCurrentRoute.getName, from, to) }}+{% endblock %}++{% block content %}+ <div id="exchange_rates_rate"></div>+{% endblock %}+{% block scripts %}++{% endblock %}diff --git a/resources/views/webhooks/index.twig b/resources/views/webhooks/index.twigindex 09a66a2002..ec3ee10e96 100644--- a/resources/views/webhooks/index.twig+++ b/resources/views/webhooks/index.twig@@ -1,7 +1,7 @@{% set VUE_SCRIPT_NAME = 'webhooks/index' %}{% extends './layout/default' %}{% block breadcrumbs %}- {{ Breadcrumbs.render(Route.getCurrentRoute.getName, objectType) }}+ {{ Breadcrumbs.render(Route.getCurrentRoute.getName) }}{% endblock %}{% block content %}diff --git a/routes/breadcrumbs.php b/routes/breadcrumbs.phpindex 37d8a7ca4e..6d3c3b8bee 100644--- a/routes/breadcrumbs.php+++ b/routes/breadcrumbs.php@@ -762,6 +762,13 @@ Breadcrumbs::for(});+Breadcrumbs::for(+ 'exchange-rates.rates',+ static function (Generator $breadcrumbs, TransactionCurrency $from, TransactionCurrency $to): void {+ $breadcrumbs->parent('exchange-rates.index');+ $breadcrumbs->push(trans('breadcrumbs.exchange_rates_rates', ['from' => $from->name, 'to' => $to->name]), route('exchange-rates.rates', [$from->code, $to->code]));+ }+);// PROFILEdiff --git a/routes/web.php b/routes/web.phpindex 31cfa511c8..c581fd4f03 100644--- a/routes/web.php+++ b/routes/web.php@@ -365,6 +365,7 @@ Route::group(['middleware' => 'user-full-auth', 'namespace' => 'FireflyIII\Http\Controllers\ExchangeRates', 'prefix' => 'exchange-rates', 'as' => 'exchange-rates.'],static function (): void {Route::get('', ['uses' => 'IndexController@index', 'as' => 'index']);+ Route::get('{fromCurrencyCode}/{toCurrencyCode}', ['uses' => 'IndexController@rates', 'as' => 'rates']);// Route::get('create', ['uses' => 'CreateController@create', 'as' => 'create']);// Route::get('edit/{currency}', ['uses' => 'EditController@edit', 'as' => 'edit']);// Route::get('delete/{currency}', ['uses' => 'DeleteController@delete', 'as' => 'delete']);