Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Budget overview migrated.
James Cole7443302d5058
diff --git a/public/v1/js/ff/accounts/index.js b/public/v1/js/ff/accounts/index.jsindex 35d9d2df29..23b45dc244 100644--- a/public/v1/js/ff/accounts/index.js+++ b/public/v1/js/ff/accounts/index.js@@ -31,6 +31,7 @@ var fixObjectHelper = function (e, tr) {$(function () {"use strict";+ console.log('Here we are, loaded.');// table may have multiple tbody's.$('#sortable-table').find('tbody').sortable({diff --git a/public/v1/js/ff/budgets/index.js b/public/v1/js/ff/budgets/index.jsindex f597c0c9ce..63b91fb924 100644--- a/public/v1/js/ff/budgets/index.js+++ b/public/v1/js/ff/budgets/index.js@@ -23,6 +23,7 @@*/$(function () {"use strict";+ console.log('Here we are, loaded /budgets.');/*On start, fill the "spent"-bar using the content from the page.*/diff --git a/resources/assets/v3/js/pages/budgets/index.js b/resources/assets/v3/js/pages/budgets/index.jsnew file mode 100644index 0000000000..217ae6c5fb--- /dev/null+++ b/resources/assets/v3/js/pages/budgets/index.js@@ -0,0 +1,61 @@+/*+ * dashboard.js+ * Copyright (c) 2026 [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/>.+ */++// CSS+import '../../boot/bootstrap.js';+import sidebar from '../../pages/shared/sidebar.js';+import dates from '../shared/dates.js';++let index = function () {+ return {+ foo2: 'bar2',+ init() {+ console.log('init op index xxx');+ }+ }+};+++const comps = {+ index,+ sidebar,+ dates+};++function loadPage(comps) {+ console.log('loadPage');+ Object.keys(comps).forEach(comp => {+ let data = comps[comp]();+ Alpine.data(comp, () => data);+ console.log(comp);+ });+ Alpine.start();+}++// wait for load until bootstrapped event is received.+document.addEventListener('firefly-iii-bootstrapped', () => {+ console.log('Loaded through event listener.');+ loadPage(comps);+});+// or is bootstrapped before event is triggered.+if (window.bootstrapped) {+ console.log('Loaded through window variable.');+ loadPage(comps);+}diff --git a/resources/assets/v3/vite.config.js b/resources/assets/v3/vite.config.jsindex 071e166137..da1c7b24de 100644--- a/resources/assets/v3/vite.config.js+++ b/resources/assets/v3/vite.config.js@@ -49,6 +49,9 @@ export default defineConfig(({command, mode, isSsrBuild, isPreview}) => {// accounts'js/pages/accounts/index.js',++ // budgets+ 'js/pages/budgets/index.js',],buildDirectory: '../../../../public/build',// publicDirectory: '../../../public',diff --git a/resources/lang/en_US/firefly.php b/resources/lang/en_US/firefly.phpindex 844dd09460..7e82db265a 100644--- a/resources/lang/en_US/firefly.php+++ b/resources/lang/en_US/firefly.php@@ -1866,6 +1866,7 @@ return ['update_budget_amount_range' => 'Update (expected) available amount between :start and :end','set_budget_limit_title' => 'Set budgeted amount for budget :budget between :start and :end','set_budget_limit' => 'Set budgeted amount',+ 'add_budget_limit_currency'=> 'Set budgeted amount in another currency','budget_period_navigator' => 'Period navigator','info_on_available_amount' => 'What do I have available?','available_amount_indication' => 'Use these amounts to get an indication of what your total budget could be.',diff --git a/resources/views/accounts/index.blade.php b/resources/views/accounts/index.blade.phpindex cee82b074f..4d60fedbcd 100644--- a/resources/views/accounts/index.blade.php+++ b/resources/views/accounts/index.blade.php@@ -24,15 +24,23 @@</div></div><div class="card-body p-0">- <p class="m-2">- <a href="{{ route('accounts.create', $objectType) }}" class="btn btn-success"><span class="bi bi-plus-circle"></span> {{ __('firefly.make_new_' . $objectType . '_account') }}</a>- </p><x-lists.accounts :accounts="$accounts" :objectType="$objectType" /></div>- <div class="card-footer p-0">- <p class="m-2">- <a href="{{ route('accounts.create', $objectType) }}" class="btn btn-success"><span class="bi bi-plus-circle"></span> {{ __('firefly.make_new_' . $objectType . '_account') }}</a>- </p>+ <div class="card-footer">+ <div class="row">+ <div class="col text-end">+ <div class="dropdown">+ <button class="btn btn-sm btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton1" data-bs-toggle="dropdown" aria-expanded="false">+ <span class="bi bi-list"></span>+ </button>+ <ul class="dropdown-menu" aria-labelledby="dropdownMenuButton1">+ <li><a class="dropdown-item" href="{{ route('accounts.create', $objectType) }}"><span+ class="bi bi-plus-circle"></span> {{ __('firefly.make_new_'. $objectType . '_account') }}+ </a></li>+ </ul>+ </div>+ </div>+ </div></div></div>@@ -47,7 +55,7 @@</p>@endif@if($inactivePage)- <p class="m-2""><small class="text-muted">+ <p class="m-2"><small class="text-muted"><em>{{ trans('firefly.all_accounts_inactive') }}<a href="{{ route('accounts.index', $objectType) }}">@@ -61,6 +69,7 @@</div>@endif@if(0 === count($accounts) && 1 === $page)+ TODO TODO TODO TODO{% include 'partials.empty' with {objectType: objectType, type: 'accounts',route: route('accounts.create', [objectType])} %}@if($inactiveCount > 0)diff --git a/resources/views/accounts/index-old.twig b/resources/views/accounts/old-index.twigsimilarity index 100%rename from resources/views/accounts/index-old.twigrename to resources/views/accounts/old-index.twigdiff --git a/resources/views/budgets/index.blade.php b/resources/views/budgets/index.blade.phpnew file mode 100644index 0000000000..049aff53c1--- /dev/null+++ b/resources/views/budgets/index.blade.php@@ -0,0 +1,494 @@+@extends('layout.v3.session')+@section('content')+ <!-- date selector -->+ <div class="row">+ <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">+ <div class="card mb-2">+ <div class="card-header">+ <h3 class="card-title">{{ __('firefly.budget_period_navigator') }}</h3>+ </div>+ <div class="card-body">+ <div class="row" id="periodNavigator">+ <div class="col-lg-2 col-md-4 col-sm-12 col-xs-12">+ <select class="form-control selectPeriod" name="previous">+ <option label="{{ __('firefly.select_date') }}" value="x">{{ __('firefly.select_date') }}</option>+ @foreach($prevLoop as $array)+ <option label="{{ $array['title'] }}" value="{{ $array['label'] }}" data-start="{{ $array['start']->format('Y-m-d') }}"+ data-end="{{ $array['end']->format('Y-m-d') }}">{{ $array['title'] }}</option>+ @endforeach+ </select>+ </div>+ <div class="col-lg-8 col-md-4 col-sm-12 col-xs-12 text-center">+ <div class="btn-group btn-group-lg pt-0">+ <a href="{{ route('budgets.index', [$prevLoop[0]['start']->format('Y-m-d'), $prevLoop[0]['end']->format('Y-m-d')]) }}"+ class="btn btn-secondary" title="{{ $prevLoop[0]['title'] }}">←</a>+ <a title="{{ $start->isoFormat($monthAndDayFormat) }} - {{ $end->isoFormat($monthAndDayFormat) }}"+ href="{{ route('budgets.index', [$start->format('Y-m-d'), $end->format('Y-m-d')]) }}"+ class="btn btn-secondary">{{ $periodTitle }}</a>+ <a href="{{ route('budgets.index', [$nextLoop[0]['start']->format('Y-m-d'), $nextLoop[0]['end']->format('Y-m-d')]) }}"+ class="btn btn-secondary" title="{{ $nextLoop[0]['title'] }}">→</a>+ </div>+ </div>+ <div class="col-lg-2 col-md-4 col-sm-12 col-xs-12 text-end">+ <select class="form-control selectPeriod" name="next">+ <option label="{{ __('firefly.select_date') }}" value="x">{{ __('firefly.select_date') }}</option>+ @foreach($nextLoop as $array)+ <option label="{{ $array['title'] }}" value="{{ $array['label'] }}" data-start="{{ $array['start']->format('Y-m-d') }}"+ data-end="{{ $array['end']->format('Y-m-d') }}">{{ $array['title'] }}</option>+ @endforeach+ </select>+ </div>+ </div>+ </div>+ </div>+ </div>+ </div>+ <!-- available budget configurator. -->+ @if(0 === count($availableBudgets))+ <div class="row">+ <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">+ <div class="card mb-2">+ <div class="card-header">+ <h3 class="card-title">+ {{ trans('firefly.total_available_budget_in_currency', ['currency' => $primaryCurrency->name]) }}+ <br>+ <small>{{ trans('firefly.between_dates_breadcrumb', ['start' => $start->isoFormat($monthAndDayFormat), 'end' => $end->isoFormat($monthAndDayFormat)]) }}</small>+ </h3>+ </div>+ <div class="card-body">+ <div class="row mb-1">+ {{--= info about the amount budgeted --}}+ <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">+ <small>{{ __('firefly.budgeted') }} ({{ __('firefly.see_below') }}):+ <span class="budgeted_amount" data-value="{{ $budgeted }}" data-id="0" data-currency="{{ $primaryCurrency['id'] }}">+ {!! \FireflyIII\Support\Facades\Steam::formatAmountBySymbol($budgeted, $primaryCurrency->symbol, $primaryCurrency->decimal_places) !!}+ </span>+ </small>+ </div>+ {{-- info about the amount spent --}}+ <div class="col-lg-9 col-md-9 col-sm-9 col-xs-9 text-end">+ <small class="available_bar" data-id="0">{{ trans('firefly.available_between', ['start' => $start->isoFormat($monthAndDayFormat), 'end' => $end->isoFormat($monthAndDayFormat)]) }}:+ <span class="available_amount" data-id="0" data-value="0" data-currency="{{ $primaryCurrency['id'] }}" data-value="0">{!! \FireflyIII\Support\Facades\Steam::formatAmountBySymbol(0, $primaryCurrency->symbol, $primaryCurrency->decimal_places, true) !!}</span>+ </small>+ </div>+ </div>+ {{-- info text to show how much is spent (in currency). --}}+ <div class="row spentInfo" data-id="0" data-value="{{ $spent }}">+ <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">+ <small>{{ trans('firefly.spent_between', ['start' => $start->isoFormat($monthAndDayFormat), 'end' => $end->isoFormat($monthAndDayFormat)]) }}:+ {!! \FireflyIII\Support\Facades\Steam::formatAmountBySymbol($spent, $primaryCurrency->symbol, $primaryCurrency->decimal_places) !!} </small>+ </div>+ </div>+ </div>+ </div>+ </div>+ </div>+ @endif++ @php+ $boxSize = count($availableBudgets) > 1 ? 6 : 12;+ @endphp+ @if(count($availableBudgets) > 0)+ <div class="row">+ @foreach($availableBudgets as $budget)+ <div class="col-lg-{{ $boxSize }} col-md-12 col-sm-12 col-xs-12">+ <div class="card mb-2">+ <div class="card-header">+ <h3 class="card-title">+ {{ trans('firefly.total_available_budget_in_currency', ['currency' => $budget['transaction_currency']['name']]) }}+ <br>+ <small>{{ trans('firefly.between_dates_breadcrumb', ['start' => $budget['start_date']->isoFormat($monthAndDayFormat), 'end' => $budget['end_date']->isoFormat($monthAndDayFormat)]) }}</small>+ </h3>+ </div>+ <div class="card-body">+ <div class="row">+ {{-- info about the amount budgeted --}}+ <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">+ <small>{{ __('firefly.budgeted') }}:+ <span class="text-success money-positive budgeted_amount" data-id="{{ $budget['id'] }}" data-currency="{{ $budget['transaction_currency']['id'] }}">+ {!! \FireflyIII\Support\Facades\Steam::formatAmountBySymbol($budget['budgeted'], $budget['transaction_currency']['symbol'], $budget['transaction_currency']['decimal_places'], false) !!}+ @if(null !== $budget['pc_budgeted'])+ ({!! \FireflyIII\Support\Facades\Steam::formatAmountBySymbol($budget['pc_budgeted'], $primaryCurrency->symbol, $primaryCurrency->decimal_places, false) !!})+ @endif+ </span>+ </small>+ </div>+ {{-- info about the amount spent --}}+ <div class="col-lg-9 col-md-9 col-sm-9 col-xs-9 text-end mb-1">+ <small class="available_bar" data-id="{{ $budget['id'] }}">{{ trans('firefly.available_between', ['start' => $budget['start_date']->isoFormat($monthAndDayFormat), 'end' => $budget['end_date']->isoFormat($monthAndDayFormat)]) }}:+ <span class="available_amount" data-id="{{ $budget['id'] }}" data-currency="{{ $budget['transaction_currency']['id'] }}"+ data-value="{{ $budget['amount'] }}">+ {!! \FireflyIII\Support\Facades\Steam::formatAmountBySymbol($budget['amount'], $budget['transaction_currency']['symbol'], $budget['transaction_currency']['decimal_places'], true) !!}+ @if($convertToPrimary && 0 !== $budget->pc_amount)+ ({!! \FireflyIII\Support\Facades\Steam::formatAmountBySymbol($budget->pc_amount, $primaryCurrency->symbol, $primaryCurrency->decimal_places, true) !!})+ @endif+ </span>+ </small>+ </div>+ </div>+ {{-- progress bar to visualise available vs budgeted. --}}+ <div class="row">+ <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">+ <div class="progress budgeted_bar" data-id="{{ $budget['id'] }}" data-budgeted="{{ $budget['budgeted'] }}"+ data-available="{{ $budget['amount'] }}" data-currency="{{ $budget['transaction_currency']['id'] }}">+ {{-- red: the exact amount of the available budget, if more has budgeted. --}}+ <div class="progress-bar progress-bar-danger" data-id="{{ $budget['id'] }}" role="progressbar" aria-valuenow="10"+ aria-valuemin="0"+ aria-valuemax="100"></div>++ {{-- orange: overbudgeted amount --}}+ <div class="progress-bar progress-bar-warning" data-id="{{ $budget['id'] }}" role="progressbar" aria-valuenow="0"+ aria-valuemin="0"+ aria-valuemax="100"></div>++ {{-- budgeted amount if enough or les --}}+ <div class="progress-bar progress-bar-info" data-id="{{ $budget['id'] }}" role="progressbar" aria-valuenow="0"+ aria-valuemin="0"+ aria-valuemax="100"></div>+ </div>+ </div>+ </div>+ {{-- info text to show how much is spent (in currency). --}}+ <div class="row spentInfo" data-id="{{ $budget['id'] }}">+ <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">+ <small>{!! trans('firefly.spent_between_left', [+ 'start' => $budget['start_date']->isoFormat($monthAndDayFormat),+ 'end' => $budget['end_date']->isoFormat($monthAndDayFormat),+ 'spent' => \FireflyIII\Support\Facades\Steam::formatAmountBySymbol($budget['spent'], $budget['transaction_currency']['symbol'], $budget['transaction_currency']['decimal_places']),+ 'left' => \FireflyIII\Support\Facades\Steam::formatAmountBySymbol($budget['budgeted'] + $budget['spent'], $budget['transaction_currency']['symbol'], $budget['transaction_currency']['decimal_places']),+ ]) !!}+ </small>+ </div>+ </div>++ {{-- bar to visualise spending in budget. --}}+ <div class="row">+ <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">+ <div class="progress spent_bar" data-id="{{ $budget['id'] }}" data-budgeted="{{ $budget['budgeted'] }}"+ data-spent="{{ $budget['spent'] }}">+ <div class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="0" aria-valuemin="0"+ aria-valuemax="100"></div>+ <div class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div>+ <div class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div>+ </div>+ </div>+ </div>+ </div>+ </div>+ </div>+ @endforeach+ </div>+ @endif+ @if(0 === count($budgets) && 0 === count($inactive))+ TODO TODO TODO TODO+ {% include 'partials.empty' with {objectType: 'default', type: 'budgets',route: route('budgets.create')} %}+ {# make FF ignore demo for now. #}+ {% set shownDemo = true %}+ @else+ <div class="row">+ <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">+ <div class="card mb-2">+ <div class="card-header">+ <div class="row">+ <div class="col">+ <h3 class="card-title">{{ __('firefly.budgets') }}</h3>+ </div>+ <div class="col text-end">+ <div class="dropdown">+ <button class="btn btn-sm btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton1" data-bs-toggle="dropdown" aria-expanded="false">+ <span class="bi bi-list"></span>+ </button>+ <ul class="dropdown-menu" aria-labelledby="dropdownMenuButton1">+ <li><a class="dropdown-item" href="{{ route('budgets.create') }}"><span+ class="bi bi-plus-circle"></span> {{ __('firefly.createBudget') }}+ </a></li>+ </ul>+ </div>+ </div>+ </div>++ </div>+ <div class="card-body p-0">+ <table class="table table-bordered sortable-table table-striped sortable" id="budgetList">+ <thead>+ <tr>+ <th class="hidden-sm hidden-xs ten"> </th>+ <th>{{ __('firefly.budget') }}</th>+ <th class="quarter">{{ __('firefly.budgeted') }}</th>+ <th class="hidden-sm hidden-xs">{{ __('firefly.spent') }} ({{ strtolower(__('firefly.per_day')) }})</th>+ <th>{{ __('firefly.left') }} ({{ strtolower(__('firefly.per_day')) }})</th>+ </tr>+ </thead>+ <tbody>+ {{-- {# START OF BUDGET ROW #} --}}++ @foreach($budgets as $budget)+ <tr data-id="{{ $budget['id'] }}">+ <td class="hidden-sm hidden-xs">+ <div class="btn-group btn-group-sm">+ <a href="#" class="handle object-handle btn btn-secondary"><span class="bi bi-list"></span></a>+ <a href="{{ route('budgets.edit', $budget['id']) }}" class="btn btn-xs btn-primary"><span class="bi bi-pencil"></span></a>+ <a href="{{ route('budgets.delete', $budget['id']) }}" class="btn btn-xs btn-danger"><span class="bi bi-trash"></span></a>+ </div>+ </td>+ <td>+ @if(0 === count($budget['budgeted']))+ <a href="{{ route('budgets.show', $budget['id']) }}" data-id="{{ $budget['id'] }}">{{ $budget['name'] }}</a>+ @endif+ @if(1 === count($budget['budgeted']))+ @foreach($budget['budgeted'] as $budgetLimit)+ <a href="{{ route('budgets.show.limit', [$budget['id'], $budgetLimit['id']]) }}" data-id="{{ $budget['id'] }}">{{ $budget['name'] }}</a>+ @endforeach+ @endif++ @if(count($budget['budgeted']) > 1)+ @foreach($budget['budgeted'] as $budgetLimit)+ <a href="{{ route('budgets.show.limit', [$budget['id'], $budgetLimit['id']]) }}" data-id="{{ $budget['id'] }}">{{ $budget['name'] }} ({{ $budgetLimit['currency_name'] }})</a><br>+ @endforeach+ @endif+ @if(null !== $budget['auto_budget'])+ @if(1 === $budget['auto_budget']['auto_budget_type'])+ <span class="bi bi-calendar-check" title="{{ __('firefly.auto_budget_reset_icon') }}"></span>+ @endif+ @if(2 === $budget['auto_budget']['auto_budget_type'])+ <span class="bi bi-calendar-plus" title="{{ __('firefly.auto_budget_rollover_icon') }}"></span>+ @endif+ @if(3 === $budget['auto_budget']['auto_budget_type'])+ <span class="bi bi-calendar-plus" title="{{ __('firefly.auto_budget_adjusted_icon') }}"></span>+ @endif+ @endif+ @if(count($budget['attachments']) > 0)+ <span class="bi bi-paperclip"></span>+ @endif+ </td>+ <td>+ @if(0 === count($budget['budgeted']))+ <div class="input-group">+ <input type="hidden" name="balance_currency_id" value="{{ $primaryCurrency['id'] }}"/>+ <span class="input-group-text" id="budgeted_{{ $budget['id'] }}">{{ $primaryCurrency->symbol }}</span>++ @if(!$anonymous)+ <input aria-describedby="budgeted_{{ $budget['id'] }}" class="form-control budget_amount" data-original="0" data-id="{{ $budget['id'] }}" data-currency="{{ $primaryCurrency['id'] }}" data-limit="0" value="0" autocomplete="off" min="0" name="amount" type="number">+ @endif+ @if($anonymous)+ <input disabled readonly aria-describedby="budgeted_{{ $budget['id'] }}" class="form-control" data-original="0" data-id="0" data-currency="{{ $primaryCurrency['id'] }}" data-limit="0" value="0" autocomplete="off" min="0" name="amount" type="number">+ @endif+ @if(count($budget['budgeted']) < count($currencies))+ <button class="btn btn-outline-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false"><em class="bi bi-caret-down"></em></button>+ <ul class="dropdown-menu dropdown-menu-end">+ <li>+ <a href="#" class="dropdown-item create_bl" data-id="{{ $budget['id'] }}">+ <span class="bi bi-plus-circle"></span>+ {{ __('firefly.add_budget_limit_currency') }}+ </a>+ </li>+ </ul>+ @endif+ </div>++ <span class="hidden text-danger budget_warning" data-id="{{ $budget['id'] }}"></span>+ @endif+ @if(count($budget['budgeted'])>0)+ @foreach($budget['budgeted'] as $budgetLimit)+ @if(!$budgetLimit['in_range'])+ <small class="text-muted">+ {{ trans('firefly.budget_limit_not_in_range', ['start' => $budgetLimit['start_date'], 'end' => $budgetLimit['end_date']]) }}+ </small><br>+ @endif+ <div class="input-group mb-1">+ <span class="input-group-text">{{ $budgetLimit['currency_symbol'] }}</span>+ @if(!$anonymous)+ <input class="form-control budget_amount" data-original="{{ $budgetLimit['amount'] }}"+ data-id="{{ $budget['id'] }}" data-limit="{{ $budgetLimit['id'] }}" value="{{ $budgetLimit['amount'] }}"+ autocomplete="off"+ min="0" name="amount" type="number">+ @endif+ @if($anonymous)+ <input disabled readonly class="form-control budget_amount" data-original="0" data-id="0" data-limit="0" value="0" autocomplete="off" min="0" name="amount" type="number">+ @endif+ <button class="btn btn-outline-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false"><em class="bi bi-caret-down"></em></button>+ <ul class="dropdown-menu dropdown-menu-end">+ <li>+ <a class="dropdown-item delete_bl" href="#" data-budget-limit-id="{{ $budgetLimit['id'] }}">+ <em title="{{ __('firefly.remove_budgeted_amount') }}" class="bi bi-trash" aria-hidden="true"></em>+ {{ trans('firefly.remove_budgeted_amount', ['currency' => $budgetLimit['currency_name']]) }}</a>+ </li>+ @if(count($budget['budgeted']) < count($currencies))+ <li>+ <a href="#" class="dropdown-item create_bl" data-id="{{ $budget['id'] }}">+ <span class="bi bi-plus-circle"></span>+ {{ __('firefly.add_budget_limit_currency') }}+ </a>+ </li>+ @endif+ <li>+ <a class="dropdown-item edit_bl" href="#" data-id="{{ $budgetLimit['id'] }}">+ <em title="{{ __('firefly.edit_bl_notes') }}" class="bi bi-pencil" aria-hidden="true"></em>+ {{ trans('firefly.edit_bl_notes') }}</a>+ </li>+ @if('' !== $budgetLimit['notes'])+ <li>+ <a href="#" class="dropdown-item show_bl" data-id="{{ $budgetLimit['id'] }}">+ <em title="{{ __('firefly.view_notes') }}" class="bi bi-chat-dots" aria-hidden="true"></em> {{ __('firefly.view_notes') }}</a>+ </li>+ @endif++ </ul>+ </div>+ <span class="hidden text-danger budget_warning" data-id="{{ $budget['id'] }}" data-budgetLimit="{{ $budgetLimit['id'] }}"></span>+ @endforeach+ @endif+ </td>+ <td class="hidden-sm hidden-xs spent text-end" data-id="{{ $budget['id'] }}">+ {{-- this is spent in budget limits: --}}+ @foreach($budget['budgeted'] as $budgetLimit)+ <span title="{{ __('firefly.spent_this_period') }}">{!! \FireflyIII\Support\Facades\Steam::formatAmountBySymbol($budgetLimit['spent'], $budgetLimit['currency_symbol'], $budgetLimit['currency_decimal_places']) !!}</span>+ @if(0 === $budgetLimit['active_days_passed'])+ <span title="{{ trans('firefly.spent_this_period_per_day', ['days' => 0]) }}">({!! \FireflyIII\Support\Facades\Steam::formatAmountBySymbol($budgetLimit['spent'], $budgetLimit['currency_symbol'], $budgetLimit['currency_decimal_places']) !!})</span>+ @else+ <span title="{{ trans('firefly.spent_this_period_per_day', ['days' => $budgetLimit['active_days_passed']]) }}">({!! \FireflyIII\Support\Facades\Steam::formatAmountBySymbol($budgetLimit['spent'] / $budgetLimit['active_days_passed'], $budgetLimit['currency_symbol'], $budgetLimit['currency_decimal_places']) !!})</span>+ @endif+ <br />+ @endforeach++ {{-- this is spent NOT in budget limits: --}}+ @foreach($budget['spent'] as $spent)+ @if(0 !== bccomp('0', $spent['spent_outside']))+ <span title="{{ __('firefly.spent_in_budget_limit_outside_period') }}">{!! \FireflyIII\Support\Facades\Steam::formatAmountBySymbol($spent['spent_outside'], $spent['currency_symbol'], $spent['currency_decimal_places']) !!}</span>+ @if(0 === $activeDaysPassed)+ <span title="{{ trans('firefly.spent_in_budget_limit_outside_period_per_day', ['days' => 0]) }}">({!! \FireflyIII\Support\Facades\Steam::formatAmountBySymbol($spent['spent_outside'], $spent['currency_symbol'], $spent['currency_decimal_places']) !!})</span>+ @else+ <span title="{{ trans('firefly.spent_in_budget_limit_outside_period_per_day', ['days' => $activeDaysPassed]) }}">({!! \FireflyIII\Support\Facades\Steam::formatAmountBySymbol($spent['spent_outside'] / $activeDaysPassed, $spent['currency_symbol'], $spent['currency_decimal_places']) !!})</span>+ @endif+ <br />+ @endif+ @endforeach++ </td>+ {{-- this cell displays the amount left in the budget, per budget limit. --}}+ <td data-id="{{ $budget['id'] }}" class="text-end left">+ {{-- The amount left can only be shown for actual budget limits. --}}+ @foreach($budget['budgeted'] as $budgetLimit)+ <span data-currency="{{ $budgetLimit['currency_id'] }}" data-limit="{{ $budgetLimit['id'] }}" data-value="{{ $budgetLimit['left'] }}" class="left_span amount_left">+ {{-- the amount left --}}+ <span title="{{ __('firefly.left_in_budget_limit_overview') }}">{!! \FireflyIII\Support\Facades\Steam::formatAmountBySymbol($budgetLimit['left'], $budgetLimit['currency_symbol'], $budgetLimit['currency_decimal_places']) !!}</span>+ {{-- if the budget limit is in the past, this is not interesting. --}}+ {{-- if there is nothing left, this is not interesting. --}}+ @if(!$budgetLimit['in_past'] && -1 === bccomp('0', $budgetLimit['left']))+ @if(0 === $budgetLimit['active_days_left'])+ <span title="{{ trans('firefly.left_in_budget_limit_per_day', ['days' => 0]) }}">({!! \FireflyIII\Support\Facades\Steam::formatAmountBySymbol($budgetLimit['left'], $budgetLimit['currency_symbol'], $budgetLimit['currency_decimal_places']) !!})+ @else+ <span title="{{ trans('firefly.left_in_budget_limit_per_day', ['days' => $budgetLimit['active_days_left']]) }}">({!! \FireflyIII\Support\Facades\Steam::formatAmountBySymbol($budgetLimit['left'] / $budgetLimit['active_days_left'], $budgetLimit['currency_symbol'], $budgetLimit['currency_decimal_places']) !!})</span>+ @endif+ @endif+ {{-- if there is nothing left, just format 0.00 --}}+ @if(!$budgetLimit['in_past'] && -1 !== bccomp('0', $budgetLimit['left']))+ <span title="{{ trans('firefly.nothing_left_in_budget') }}">({!! \FireflyIII\Support\Facades\Steam::formatAmountBySymbol('0', $budgetLimit['currency_symbol'], $budgetLimit['currency_decimal_places']) !!})</span>+ @endif+ </span><br />+ @endforeach+ </td>+ </tr>+ @endforeach+ {{-- END OF BUDGET ROW --}}+ </tbody>+ </table>+ </div>+ <div class="card-footer">+ <div class="col text-end">+ <div class="dropdown">+ <button class="btn btn-sm btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton1" data-bs-toggle="dropdown" aria-expanded="false">+ <span class="bi bi-list"></span>+ </button>+ <ul class="dropdown-menu" aria-labelledby="dropdownMenuButton1">+ <li><a class="dropdown-item" href="{{ route('budgets.create') }}"><span+ class="bi bi-plus-circle"></span> {{ __('firefly.createBudget') }}+ </a></li>+ </ul>+ </div>+ </div>+ </div>+ </div>+ </div>+ </div>+++ <div class="row">+ <div class="col-lg-3 col-md-4 col-sm-12 col-xs-12">+ <div class="card mb-2">+ <div class="card-header with-border">+ <h3 class="card-title">{{ __('firefly.transactionsWithoutBudget') }}</h3>+ </div>+ <div class="card-body">+ <p>+ <a href="{{ route('budgets.no-budget', [$start->format('Y-m-d'), $end->format('Y-m-d')]) }}">+ {{ trans('firefly.transactions_no_budget', ['start' => $start->isoFormat($monthAndDayFormat), 'end' => $end->isoFormat($monthAndDayFormat)]) }}+ </a>+ </p>+ </div>+ </div>+ </div>+ @if($paginator ?? false && $paginator->count() > 0 && count($inactive) > 0)+ <div class="col-lg-3 col-md-4 col-sm-12 col-xs-12">+ <div class="card mb-2" id="createBudgetBox">+ <div class="card-header with-border">+ <h3 class="card-title">{{ __('firefly.createBudget') }}</h3>+ </div>+ <div class="card-body">+ <a href="{{ route('budgets.create') }}" class="btn btn-success pull-right">{{ __('firefly.createBudget') }}</a>+ </div>+ </div>+ </div>+ @endif+ @if(count($inactive) > 0)+ <div class="col-lg-3 col-sm-4 col-md-6">+ <div class="card">+ <div class="card-header with-border">+ <h3 class="card-title">{{ __('firefly.inactiveBudgets') }}</h3>+ </div>+ <div class="card-body">+ @foreach($inactive as $budget)+ @if($loop->index + 1 === count($inactive))+ <a href="{{ route('budgets.show',$budget['id']) }}">{{ $budget['name'] }}</a>+ @else+ <a href="{{ route('budgets.show',$budget['id']) }}">{{ $budget['name'] }}</a>,+ @endif+ @endforeach+ </div>+ </div>+ </div>+ @endif+ </div>+ @endif+++@endsection+@section('styles')+ <link href="v1/css/bootstrap-sortable.css?v={{ $FF_BUILD_TIME }}" type="text/css" rel="stylesheet" media="all" nonce="{{ $JS_NONCE }}">+@endsection++@section('scripts')+ @vite(['js/pages/budgets/index.js'])++ <script src="v1/js/lib/jquery-ui.min.js?v={{ $FF_BUILD_TIME }}" type="text/javascript" nonce="{{ $JS_NONCE }}"></script>+ <script type="text/javascript" nonce="{{ $JS_NONCE }}">++ // index route.+ var budgetIndexUrl = "{{ route('budgets.index',['START','END']) }}";++ // budget limit create form.+ var createBudgetLimitUrl = "{{ route('budget-limits.create', ['REPLACEME', $start->format('Y-m-d'), $end->format('Y-m-d')]) }}";+ var storeBudgetLimitUrl = "{{ route('budget-limits.store') }}";+ var updateBudgetLimitUrl = "{{ route('budget-limits.update', ['REPLACEME']) }}";+ var showBudgetLimitUrl = "{{ route('budget-limits.show', ['REPLACEME']) }}";+ var editBudgetLimitUrl = "{{ route('budget-limits.edit', ['REPLACEME']) }}";+ var deleteBudgetLimitUrl = "{{ route('budget-limits.delete', ['REPLACEME']) }}";+ var totalBudgetedUrl = "{{ route('json.budget.total-budgeted', ['REPLACEME', $start->format('Y-m-d'), $end->format('Y-m-d')]) }}";++ // period thing:+ var periodStart = "{{ $start->format('Y-m-d') }}";+ var periodEnd = "{{ $end->format('Y-m-d') }}";+ </script>+ <script type="text/javascript" src="v1/js/lib/bootstrap-sortable.js?v={{ $FF_BUILD_TIME }}" nonce="{{ $JS_NONCE }}"></script>+ <script type="text/javascript" src="v1/js/ff/budgets/index.js?v={{ $FF_BUILD_TIME }}" nonce="{{ $JS_NONCE }}"></script>+@endsectiondiff --git a/resources/views/budgets/index.twig b/resources/views/budgets/old-index.twigsimilarity index 100%rename from resources/views/budgets/index.twigrename to resources/views/budgets/old-index.twigdiff --git a/resources/views/layout/v3/session.blade.php b/resources/views/layout/v3/session.blade.phpindex 3445b75e9c..dacfa9a065 100644--- a/resources/views/layout/v3/session.blade.php+++ b/resources/views/layout/v3/session.blade.php@@ -17,7 +17,7 @@@if('' !== (string)($pageTitle ?? '')){{ $pageTitle }} »@endif- @if('' !== (string)$subTitle && '' === (string) ($pageTitle ?? ''))+ @if($subTitle ?? false && '' !== (string)$subTitle && '' === (string) ($pageTitle ?? '')){{ $subTitle }} »@endif@if('Firefly III' !== $title)@@ -267,9 +267,11 @@<em class="bi {{ $mainTitleIcon }}"></em>{{ $pageTitle ?? $title ?? '(no title)' }}+ @if($subTitle ?? false)<small class="text-xs text-muted">@if(isset($subTitleIcon))<em class="bi {{ $subTitleIcon }}"></em>@endif{{$subTitle}}</small>+ @endif</h3></div>@@ -302,52 +304,21 @@/>@yield('content')-- <!--begin::Row-->- <!--end::Row-->- <!--begin::Row-->- <!-- /.row (main row) --></div>- <!--end::Container--></div>- <!--end::App Content--></main>- <!--end::App Main-->- <!--begin::Footer--><footer class="app-footer">- <!--begin::To the end--><div class="float-end d-none d-sm-inline"><a href="{{route('debug')}}">v{{ $FF_VERSION }}</a></div>- <!--end::To the end-->- <!--begin::Copyright--><span><a href="https://www.firefly-iii.org/" target="_blank" title="Firefly III">Firefly III</a> © James Cole, <ahref="https://www.gnu.org/licenses/agpl-3.0.html" title="AGPL-3.0-or-later.">AGPL-3.0-or-later</a>.- TODO BETA WARNING- TODO ALPHA WARNING- TODO DEV RELEASE WARNING- {{--- {% if FF_IS_ALPHA %}<small class="text-danger hidden-xs"><br>{{ 'is_alpha_warning'|_ }}</small>{% endif %}- {% if FF_IS_BETA %}<small class="text-warning hidden-xs"><br>{{ 'is_beta_warning'|_ }}</small>{% endif %}-- --}}+ @if($FF_IS_ALPHA)<small class="text-danger hidden-xs"><br>{{ __('firefly.is_alpha_warning') }}</small>@endif+ @if($FF_IS_BETA)<small class="text-warning hidden-xs"><br>{{ __('firefly.is_beta_warning') }}</small>@endif</span>- <!--end::Copyright--></footer>- <!--end::Footer--></div>-<!--end::App Wrapper-->-<!--begin::Script-->-<!--begin::Third Party Plugin(OverlayScrollbars)-->-<!--end::Third Party Plugin(OverlayScrollbars)--><!--begin::Required Plugin(popperjs for Bootstrap 5)-->-<!--end::Required Plugin(popperjs for Bootstrap 5)--><!--begin::Required Plugin(Bootstrap 5)-->-<!--end::Required Plugin(Bootstrap 5)--><!--begin::Required Plugin(AdminLTE)-->-<!--end::Required Plugin(AdminLTE)-->-<!--begin::OverlayScrollbars Configure-->--<!--end::OverlayScrollbars Configure-->-{{-- Moment JS --}}<script src="v1/js/lib/moment.min.js?v={{ $FF_BUILD_TIME }}" type="text/javascript" nonce="{{ $JS_NONCE }}"></script>@@ -363,7 +334,6 @@<script src="v1/js/app.js?v={{ $FF_BUILD_TIME }}" type="text/javascript" nonce="{{ $JS_NONCE }}"></script>{{-- introduction --}}-<!-- intro -->@if(!$shownDemo)<script type="text/javascript" nonce="{{ $JS_NONCE }}">var showTour = true;@@ -389,13 +359,6 @@@yield('scripts')--<!-- start: previous color mode -->---<!-- end: previous color mode -->--<!--begin::Color Mode Toggle (#6010)--><script nonce="{{ $JS_NONCE }}">(() => {'use strict';@@ -408,22 +371,12 @@const prefersDark = () => globalThis.matchMedia('(prefers-color-scheme: dark)').matches;- const getPreferredTheme = () => {- return '{{ $darkMode }}';- // if ('dark' === stored || 'light' === stored) {- // console.log('Later: getPreferredTheme returns ', stored);- // return stored;- // }- // console.log('Later: getPreferredTheme returns ', prefersDark() ? 'dark' : 'light');- // return prefersDark() ? 'dark' : 'light';- };-const setTheme = (theme) => {const resolved = theme === 'browser' ? (prefersDark() ? 'dark' : 'light') : theme;document.documentElement.setAttribute('data-bs-theme', resolved);};- setTheme(getPreferredTheme());+ setTheme('{{ $darkMode }}');const showActiveTheme = (theme) => {// Highlight the active dropdown option@@ -448,11 +401,11 @@globalThis.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => {const stored = '{{ $darkMode }}';- if (!stored || stored === 'browser') setTheme(getPreferredTheme());+ if (!stored || stored === 'browser') setTheme('{{ $darkMode }}');});document.addEventListener('DOMContentLoaded', () => {- showActiveTheme(getPreferredTheme());+ showActiveTheme('{{ $darkMode }}');document.querySelectorAll('[data-bs-theme-value]').forEach((toggle) => {toggle.addEventListener('click', () => {const theme = toggle.getAttribute('data-bs-theme-value');@@ -464,22 +417,6 @@});})();</script>-<!--end::Color Mode Toggle-->--<!-- OPTIONAL SCRIPTS -->--<!-- sortablejs -->--<!-- sortablejs -->--<!-- apexcharts -->--<!-- ChartJS -->--<!-- jsvectormap -->-<!-- jsvectormap -->-<!--end::Script-->-<form id="logout-form" action="{{ route('logout') }}" method="POST" class="hidden"><input type="hidden" name="_token" value="{{ csrf_token() }}"/></form>@@ -582,8 +519,7 @@</div></div><div class="modal-footer">- <button type="button" class="btn btn-secondary"- data-bs-dismiss="modal">{{ __('firefly.close') }}</button>+ <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">{{ __('firefly.close') }}</button><button type="submit" class="btn btn-primary">{{ trans('firefly.submit') }}</button></div></div>@@ -591,6 +527,8 @@</div></div>+<div class="modal fade" id="defaultModal" tabindex="-1" role="dialog">+</div><div class="modal fade" tabindex="-1" role="dialog" id="helpModal"><div class="modal-dialog modal-lg">@@ -607,8 +545,7 @@<small class="pull-left">{!! trans('firefly.reenable_intro_text') !!}</small>- <button type="button" class="btn btn-primary"- data-bs-dismiss="modal">{{ trans('firefly.close') }}</button>+ <button type="button" class="btn btn-primary" data-bs-dismiss="modal">{{ trans('firefly.close') }}</button></div></div></div>diff --git a/resources/views/index-old.twig b/resources/views/old-index.twigsimilarity index 100%rename from resources/views/index-old.twigrename to resources/views/old-index.twig