Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Index for exchange rates.
James Cole0e8fdd76a64d
diff --git a/app/Http/Controllers/ExchangeRates/IndexController.php b/app/Http/Controllers/ExchangeRates/IndexController.phpnew file mode 100644index 0000000000..0fa0180c24--- /dev/null+++ b/app/Http/Controllers/ExchangeRates/IndexController.php@@ -0,0 +1,52 @@+<?php+/*+ * IndexController.php+ * 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/.+ */++declare(strict_types=1);++namespace FireflyIII\Http\Controllers\ExchangeRates;++use FireflyIII\Http\Controllers\Controller;++class IndexController extends Controller+{+ /**+ * AttachmentController constructor.+ */+ public function __construct()+ {+ parent::__construct();++ // translations:+ $this->middleware(+ function ($request, $next) {+ app('view')->share('mainTitleIcon', 'fa-exchange');+ app('view')->share('title', (string) trans('firefly.header_exchange_rates'));+ return $next($request);+ }+ );+ }++ public function index()+ {+ return view('exchange-rates.index');+ }++}diff --git a/app/Repositories/PiggyBank/PiggyBankRepository.php b/app/Repositories/PiggyBank/PiggyBankRepository.phpindex fbbb9d8969..1de3cb857c 100644--- a/app/Repositories/PiggyBank/PiggyBankRepository.php+++ b/app/Repositories/PiggyBank/PiggyBankRepository.php@@ -242,7 +242,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterfacereturn $room;}- // amount is negative and $currentamount is smaller than $amount+ // amount is negative and $currentAmount is smaller than $amountif (-1 === bccomp($amount, '0') && 1 === bccomp($compare, $amount)) {app('log')->debug(sprintf('Max amount to remove is %f', $repetition->current_amount));app('log')->debug(sprintf('Cannot remove %f from piggy bank #%d ("%s")', $amount, $piggyBank->id, $piggyBank->name));diff --git a/resources/lang/en_US/breadcrumbs.php b/resources/lang/en_US/breadcrumbs.phpindex 5a89a6b9b3..9dba742c88 100644--- a/resources/lang/en_US/breadcrumbs.php+++ b/resources/lang/en_US/breadcrumbs.php@@ -89,4 +89,7 @@ return [// notifications'notification_index' => 'Owner notifications',++ // exchange rates+ 'exchange_rates_index' => 'Exchange rates',];diff --git a/resources/lang/en_US/firefly.php b/resources/lang/en_US/firefly.phpindex b435d5e571..fa0cb6b42b 100644--- a/resources/lang/en_US/firefly.php+++ b/resources/lang/en_US/firefly.php@@ -1394,6 +1394,11 @@ return ['slack_url_label' => 'Slack "incoming webhook" URL','discord_url_label' => 'Discord webhook URL',+ // exchange rates+ '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>.',+// Financial administrations'administration_index' => 'Financial administration','administrations_index_menu' => 'Financial administration(s)',diff --git a/resources/views/exchange-rates/index.twig b/resources/views/exchange-rates/index.twignew file mode 100644index 0000000000..6bab169fd7--- /dev/null+++ b/resources/views/exchange-rates/index.twig@@ -0,0 +1,51 @@+{% extends './layout/default' %}++{% block breadcrumbs %}+ {{ Breadcrumbs.render(Route.getCurrentRoute.getName) }}+{% endblock %}++{% block content %}+ <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">{{ 'header_exchange_rates'|_ }}</h3>+ </div>+ <div class="box-body">+ <p>+ {{ '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">+ {% for currency in currencies %}+ <div class="box box-default">+ <div class="box-header with-border">+ <h3 class="box-title">{{ currency.name }}</h3>+ </div>+ <div class="box-body">+ {% if currencies.count > 0 %}+ <ul>+ {% for sub in currencies %}+ {% if sub.id != currency.id %}+ <li>From {{ currency.name }} to {{ sub.name }}</li>+ {% endif %}+ {% endfor %}+ </ul>+ {% endif %}+ </div>+ </div>+ {% endfor %}+ </div>+ </div>++{% endblock %}++{% block styles %}+{% endblock %}++{% block scripts %}+{% endblock %}diff --git a/resources/views/partials/menu-sidebar.twig b/resources/views/partials/menu-sidebar.twigindex f3487f6e8c..c9443ff939 100644--- a/resources/views/partials/menu-sidebar.twig+++ b/resources/views/partials/menu-sidebar.twig@@ -189,7 +189,7 @@</li>{% endif %}- <li class="{{ activeRoutePartial('admin') }} {{ activeRoutePartial('profile') }} {{ activeRoutePartial('preferences') }} {{ activeRoutePartial('currencies') }} treeview"+ <li class="{{ activeRoutePartial('admin') }} {{ activeRoutePartial('profile') }} {{ activeRoutePartial('preferences') }} {{ activeRoutePartial('currencies') }} {{ activeRoutePartial('exchange-rates') }} treeview"id="option-menu"><a href="#"><em class="fa fa-sliders fa-fw"></em>@@ -220,6 +220,12 @@</a></li>{% if hasRole('owner') %}+ <li class="{{ activeRoutePartial('exchange-rates') }}">+ <a class="{{ activeRoutePartial('exchange-rates') }}" href="{{ route('exchange-rates.index') }}">+ <span class="fa fa-angle-right fa-fw"></span>+ <span>{{ 'menu_exchange_rates_index'|_ }}</span>+ </a>+ </li><li class="{{ activeRoutePartial('admin') }}"><a class="{{ activeRoutePartial('admin') }}" href="{{ route('admin.index') }}"><span class="fa fa-angle-right fa-fw"></span>diff --git a/routes/breadcrumbs.php b/routes/breadcrumbs.phpindex dde259dfb7..37d8a7ca4e 100644--- a/routes/breadcrumbs.php+++ b/routes/breadcrumbs.php@@ -753,6 +753,15 @@ Breadcrumbs::for(});+// exchange rates+Breadcrumbs::for(+ 'exchange-rates.index',+ static function (Generator $breadcrumbs): void {+ $breadcrumbs->parent('home');+ $breadcrumbs->push(trans('breadcrumbs.exchange_rates_index'), route('exchange-rates.index'));+ }+);+// PROFILEdiff --git a/routes/web.php b/routes/web.phpindex 7334c316cf..31cfa511c8 100644--- a/routes/web.php+++ b/routes/web.php@@ -360,6 +360,20 @@ Route::group(});+// exchange rates controller+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('create', ['uses' => 'CreateController@create', 'as' => 'create']);+// Route::get('edit/{currency}', ['uses' => 'EditController@edit', 'as' => 'edit']);+// Route::get('delete/{currency}', ['uses' => 'DeleteController@delete', 'as' => 'delete']);+// Route::post('store', ['uses' => 'CreateController@store', 'as' => 'store']);+// Route::post('update/{currency}', ['uses' => 'EditController@update', 'as' => 'update']);+// Route::post('destroy/{currency}', ['uses' => 'DeleteController@destroy', 'as' => 'destroy']);+ }+);+// Chart\Account Controller (default report).Route::group(['middleware' => 'user-full-auth', 'namespace' => 'FireflyIII\Http\Controllers\Chart', 'prefix' => 'chart/account', 'as' => 'chart.account.'],