mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-29 18:20:01 +00:00
Index for exchange rates.
This commit is contained in:
52
app/Http/Controllers/ExchangeRates/IndexController.php
Normal file
52
app/Http/Controllers/ExchangeRates/IndexController.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/*
|
||||
* IndexController.php
|
||||
* 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/.
|
||||
*/
|
||||
|
||||
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');
|
||||
}
|
||||
|
||||
}
|
@@ -242,7 +242,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
|
||||
return $room;
|
||||
}
|
||||
|
||||
// amount is negative and $currentamount is smaller than $amount
|
||||
// amount is negative and $currentAmount is smaller than $amount
|
||||
if (-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));
|
||||
|
@@ -89,4 +89,7 @@ return [
|
||||
|
||||
// notifications
|
||||
'notification_index' => 'Owner notifications',
|
||||
|
||||
// exchange rates
|
||||
'exchange_rates_index' => 'Exchange rates',
|
||||
];
|
||||
|
@@ -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)',
|
||||
|
51
resources/views/exchange-rates/index.twig
Normal file
51
resources/views/exchange-rates/index.twig
Normal file
@@ -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 %}
|
@@ -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>
|
||||
|
@@ -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'));
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
|
||||
// PROFILE
|
||||
|
@@ -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.'],
|
||||
|
Reference in New Issue
Block a user