Expand page for currency exchange rates.

This commit is contained in:
James Cole
2024-12-21 21:31:28 +01:00
parent 1daffedde0
commit 117a376fc3
11 changed files with 108 additions and 3 deletions

View File

@@ -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'));
}
}

View File

@@ -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",

View File

@@ -0,0 +1,33 @@
<!--
- Rates.vue
- Copyright (c) 2024 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/.
-->
<script setup>
</script>
<template>
<div>
</div>
</template>
<style scoped>
</style>

View 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_rates",
render: (createElement) => {
return createElement(Index, {props: props})
},
});

View File

@@ -49,3 +49,4 @@ mix.js('src/webhooks/show.js', 'build/webhooks').vue({version: 2}).copy('build',
// exchange rates
mix.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});

View File

@@ -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)',
];

View File

@@ -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',

View File

@@ -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 %}

View File

@@ -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 %}

View File

@@ -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]));
}
);
// PROFILE

View File

@@ -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']);