Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Fix progress bars in views.
James Cole74c6ee035129
diff --git a/composer.json b/composer.jsonindex 2f7dd1870e..05747607b1 100644--- a/composer.json+++ b/composer.json@@ -119,6 +119,7 @@"fruitcake/laravel-debugbar": "^4.0","larastan/larastan": "^3","laravel-json-api/testing": "^3.0",+ "magentron/laravel-blade-lint": "*","mockery/mockery": "1.*","phpstan/extension-installer": "^1.4","phpstan/phpstan": "^2",diff --git a/composer.lock b/composer.lockindex abf6b623a4..871bb601c9 100644--- a/composer.lock+++ b/composer.lock@@ -4,7 +4,7 @@"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies","This file is @generated automatically"],- "content-hash": "7dabe0f05a3cd8e24077085ea9acc7bb",+ "content-hash": "7a1b2b684b07b5dfae58bd42e60398d2","packages": [{"name": "bacon/bacon-qr-code",@@ -11025,6 +11025,78 @@},"time": "2026-03-28T18:06:47+00:00"},+ {+ "name": "magentron/laravel-blade-lint",+ "version": "2.0.3",+ "source": {+ "type": "git",+ "url": "https://github.com/Magentron/laravel-blade-lint.git",+ "reference": "5bec2d1f7536d39b482ac6c087db3207629e8c89"+ },+ "dist": {+ "type": "zip",+ "url": "https://api.github.com/repos/Magentron/laravel-blade-lint/zipball/5bec2d1f7536d39b482ac6c087db3207629e8c89",+ "reference": "5bec2d1f7536d39b482ac6c087db3207629e8c89",+ "shasum": ""+ },+ "require": {+ "laravel/framework": "*"+ },+ "require-dev": {+ "barryvdh/laravel-ide-helper": "*",+ "friendsofphp/php-cs-fixer": "*",+ "mockery/mockery": "*",+ "orchestra/testbench": "*",+ "php": "^8",+ "phpmd/phpmd": "*",+ "phpstan/phpstan": "*",+ "phpunit/phpunit": "*",+ "systemsdk/phpcpd": "^8.0",+ "vimeo/psalm": "*"+ },+ "suggest": {+ "ext-pcntl": "Required for multi-process support",+ "ext-posix": "Required for multi-process support"+ },+ "type": "library",+ "extra": {+ "laravel": {+ "providers": [+ "Magentron\\BladeLint\\Providers\\ServiceProvider"+ ]+ }+ },+ "autoload": {+ "psr-4": {+ "Magentron\\BladeLint\\": "src/Magentron/BladeLint"+ }+ },+ "notification-url": "https://packagist.org/downloads/",+ "license": [+ "GPL-3.0-or-later"+ ],+ "authors": [+ {+ "name": "Jeroen Derks",+ "email": "[email protected]",+ "homepage": "https://www.derks.it/",+ "role": "Developer"+ }+ ],+ "description": "Laravel Blade Lint console command",+ "homepage": "https://github.com/Magentron/laravel-blade-lint",+ "keywords": [+ "blade",+ "console",+ "laravel",+ "lint"+ ],+ "support": {+ "issues": "https://github.com/Magentron/laravel-blade-lint/issues",+ "source": "https://github.com/Magentron/laravel-blade-lint/tree/2.0.3"+ },+ "time": "2018-11-28T14:07:44+00:00"+ },{"name": "mockery/mockery","version": "1.6.12",diff --git a/public/v1/js/ff/budgets/index.js b/public/v1/js/ff/budgets/index.jsindex 63b91fb924..fe2c0aa577 100644--- a/public/v1/js/ff/budgets/index.js+++ b/public/v1/js/ff/budgets/index.js@@ -292,16 +292,18 @@ function drawBudgetedBars() {var budgetedTooMuch = budgeted > available;var pct;if (budgetedTooMuch) {+ console.log('Budgeted too much');// budgeted too much.pct = (available / budgeted) * 100;- bar.find('.progress-bar-danger').css('width', pct + '%');- bar.find('.progress-bar-warning').css('width', (100 - pct) + '%');- bar.find('.progress-bar-info').css('width', 0);+ bar.find('.progress-red').css('width', pct + '%');+ bar.find('.progress-orange').css('width', (100 - pct) + '%');+ bar.find('.progress-blue').css('width', 0);} else {+ console.log('Budgeted not too much');pct = (budgeted / available) * 100;- bar.find('.progress-bar-danger').css('width', 0);- bar.find('.progress-bar-warning').css('width', 0);- bar.find('.progress-bar-info').css('width', pct + '%');+ bar.find('.progress-red').css('width', 0);+ bar.find('.progress-orange').css('width', 0);+ bar.find('.progress-blue').css('width', pct + '%');}//$('#budgetedAmount').html(currencySymbol + ' ' + budgeted.toFixed(2));});@@ -319,12 +321,12 @@ function drawSpentBars() {if (overspent) {// draw overspent barpct = (budgeted / spent) * 100;- bar.find('.progress-bar-warning').css('width', pct + '%');- bar.find('.progress-bar-danger').css('width', (100 - pct) + '%');+ bar.find('.progress-orange').css('width', pct + '%');+ bar.find('.progress-red').css('width', (100 - pct) + '%');} else {// draw normal bar:pct = (spent / budgeted) * 100;- bar.find('.progress-bar-info').css('width', pct + '%');+ bar.find('.progress-blue').css('width', pct + '%');}});}diff --git a/resources/assets/v3/sass/app.scss b/resources/assets/v3/sass/app.scssindex 8b0980a5a0..fa636b7071 100644--- a/resources/assets/v3/sass/app.scss+++ b/resources/assets/v3/sass/app.scss@@ -61,7 +61,6 @@ $success: #64B624;body.waiting * {cursor: progress;}-/* some borders and lines */.top-light-border {border-top:1px #aaa solid;}.top-dark-border {border-top:1px #777 solid;}@@ -89,6 +88,109 @@ td.thirty th.thirty {width:30%;}font-size: 24px;}+/** width for progress bar **/+.w-0 {width:0 !important;}+.w-1 {width:1% !important;}+.w-2 {width:2% !important;}+.w-3 {width:3% !important;}+.w-4 {width:4% !important;}+.w-5 {width:5% !important;}+.w-6 {width:6% !important;}+.w-7 {width:7% !important;}+.w-8 {width:8% !important;}+.w-9 {width:9% !important;}+.w-10 {width:10% !important;}+.w-11 {width:11% !important;}+.w-12 {width:12% !important;}+.w-13 {width:13% !important;}+.w-14 {width:14% !important;}+.w-15 {width:15% !important;}+.w-16 {width:16% !important;}+.w-17 {width:17% !important;}+.w-18 {width:18% !important;}+.w-19 {width:19% !important;}+.w-20 {width:20% !important;}+.w-21 {width:21% !important;}+.w-22 {width:22% !important;}+.w-23 {width:23% !important;}+.w-24 {width:24% !important;}+.w-25 {width:25% !important;}+.w-26 {width:26% !important;}+.w-27 {width:27% !important;}+.w-28 {width:28% !important;}+.w-29 {width:29% !important;}+.w-30 {width:30% !important;}+.w-31 {width:31% !important;}+.w-32 {width:32% !important;}+.w-33 {width:33% !important;}+.w-34 {width:34% !important;}+.w-35 {width:35% !important;}+.w-36 {width:36% !important;}+.w-37 {width:37% !important;}+.w-38 {width:38% !important;}+.w-39 {width:39% !important;}+.w-40 {width:40% !important;}+.w-41 {width:41% !important;}+.w-42 {width:42% !important;}+.w-43 {width:43% !important;}+.w-44 {width:44% !important;}+.w-45 {width:45% !important;}+.w-46 {width:46% !important;}+.w-47 {width:47% !important;}+.w-48 {width:48% !important;}+.w-49 {width:49% !important;}+.w-50 {width:50% !important;}+.w-51 {width:51% !important;}+.w-52 {width:52% !important;}+.w-53 {width:53% !important;}+.w-54 {width:54% !important;}+.w-55 {width:55% !important;}+.w-56 {width:56% !important;}+.w-57 {width:57% !important;}+.w-58 {width:58% !important;}+.w-59 {width:59% !important;}+.w-60 {width:60% !important;}+.w-61 {width:61% !important;}+.w-62 {width:62% !important;}+.w-63 {width:63% !important;}+.w-64 {width:64% !important;}+.w-65 {width:65% !important;}+.w-66 {width:66% !important;}+.w-67 {width:67% !important;}+.w-68 {width:68% !important;}+.w-69 {width:69% !important;}+.w-70 {width:70% !important;}+.w-71 {width:71% !important;}+.w-72 {width:72% !important;}+.w-73 {width:73% !important;}+.w-74 {width:74% !important;}+.w-75 {width:75% !important;}+.w-76 {width:76% !important;}+.w-77 {width:77% !important;}+.w-78 {width:78% !important;}+.w-79 {width:79% !important;}+.w-80 {width:80% !important;}+.w-81 {width:81% !important;}+.w-82 {width:82% !important;}+.w-83 {width:83% !important;}+.w-84 {width:84% !important;}+.w-85 {width:85% !important;}+.w-86 {width:86% !important;}+.w-87 {width:87% !important;}+.w-88 {width:88% !important;}+.w-89 {width:89% !important;}+.w-90 {width:90% !important;}+.w-91 {width:91% !important;}+.w-92 {width:92% !important;}+.w-93 {width:93% !important;}+.w-94 {width:94% !important;}+.w-95 {width:95% !important;}+.w-96 {width:96% !important;}+.w-97 {width:97% !important;}+.w-98 {width:98% !important;}+.w-99 {width:99% !important;}+.w-100 {width:100% !important;}+// @import "admin-lte/dist/css/adminlte.min.css";diff --git a/resources/views/bills/index.blade.php b/resources/views/bills/index.blade.phpindex 29475dcef1..9f195cffb2 100644--- a/resources/views/bills/index.blade.php+++ b/resources/views/bills/index.blade.php@@ -7,17 +7,10 @@<x-empty-page :route="route('subscriptions.create')" type="bills" object-type="default" />@endif@if($total > 0)- <div class="row">- <div class="col-lg-12 col-sm-12 col-md-12">- <div class="card mb-2">- <x-elements.card-header-with-menu :cardTitle="$title" :route="route('subscriptions.create')" :linkTitle="__('firefly.create_new_bill')" />- <div class="card-body p-0">++<x-lists.subscriptions :bills="$bills" :sums="$sums" :totals="$totals" />- </div>- <x-elements.card-footer-with-menu :route="route('subscriptions.create')" :linkTitle="__('firefly.create_new_bill')" />- </div>- </div>- </div>+@endif@endsection@section('scripts')diff --git a/resources/views/budgets/index.blade.php b/resources/views/budgets/index.blade.phpindex 188964d6ca..752b1592c7 100644--- a/resources/views/budgets/index.blade.php+++ b/resources/views/budgets/index.blade.php@@ -129,22 +129,19 @@{{-- 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>-+ <div class="progress-stacked 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 than budgeted. --}}+ <div class="progress progress-red" role="progressbar" data-id="{{ $budget['id'] }}" aria-valuenow="15" aria-valuemin="0" aria-valuemax="100" style="width: 15%">+ <div class="progress-bar bg-danger"></div>+ </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>-+ <div class="progress progress-orange" role="progressbar" data-id="{{ $budget['id'] }}" aria-valuenow="30" aria-valuemin="0" aria-valuemax="100" style="width: 30%">+ <div class="progress-bar bg-warning"></div>+ </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 class="progress progress-blue" role="progressbar" data-id="{{ $budget['id'] }}" aria-label="Segment three" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100" style="width: 20%">+ <div class="progress-bar bg-info"></div>+ </div></div></div></div>@@ -164,12 +161,16 @@{{-- 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 class="progress-stacked spent_bar" data-id="{{ $budget['id'] }}" data-budgeted="{{ $budget['budgeted'] }}" data-spent="{{ $budget['spent'] }}">+ <div class="progress progress-red" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%">+ <div class="progress-bar bg-warning"></div>+ </div>+ <div class="progress progress-orange" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%">+ <div class="progress-bar bg-danger"></div>+ </div>+ <div class="progress progress-blue" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%">+ <div class="progress-bar bg-info"></div>+ </div></div></div></div>diff --git a/resources/views/budgets/show.blade.php b/resources/views/budgets/show.blade.phpindex 7176c7da8b..e2e6f0d3c2 100644--- a/resources/views/budgets/show.blade.php+++ b/resources/views/budgets/show.blade.php@@ -183,24 +183,21 @@// must have -1 here$pct = ($limit->spent != 0 ? ($limit->amount / ($limit->spent*-1))*100 : 0);@endphp-- <div class="progress progress-striped">- <div class="progress-bar progress-bar-warning w-{{ round($pct) }}" role="progressbar" aria-valuenow="{{ round($pct) }}"- aria-valuemin="0"- aria-valuemax="100"></div>- <div class="progress-bar progress-bar-danger w-{{ round(100-$pct) }}" role="progressbar" aria-valuenow="{{ round(100-$pct) }}"- aria-valuemin="0" aria-valuemax="100"></div>+ <div class="progress-stacked">+ <div style="height:21px;" class="progress w-{{ round($pct) }}" role="progressbar" aria-valuenow="{{ round($pct) }}" aria-valuemin="0" aria-valuemax="100">+ <div class="progress-bar bg-warning progress-bar-striped"></div>+ </div>+ <div style="height:21px;" class="progress w-{{ 100- round($pct) }}" role="progressbar" aria-valuenow="{{ 100-round($pct) }}" aria-valuemin="0" aria-valuemax="100">+ <div class="progress-bar bg-danger progress-bar-striped"></div>+ </div></div>@else@php// must have -1 here$pct = ($limit->amount != 0 ? ((($limit->spent*-1) / $limit->amount)*100) : 0);@endphp-- <div class="progress progress-striped">- <div class="progress-bar progress-bar-success w-{{ round($pct) }}" role="progressbar" aria-valuenow="{{ round($pct) }}"- aria-valuemin="0"- aria-valuemax="100"></div>+ <div class="progress" role="progressbar" aria-valuenow="{{ round($pct) }}" aria-valuemin="0" aria-valuemax="100">+ <div class="progress-bar bg-success progress-bar-striped w-{{ round($pct) }}"></div></div>@endif</td>diff --git a/resources/views/components/lists/piggy-banks.blade.php b/resources/views/components/lists/piggy-banks.blade.phpindex ef8beef32e..915a0e5695 100644--- a/resources/views/components/lists/piggy-banks.blade.php+++ b/resources/views/components/lists/piggy-banks.blade.php@@ -59,20 +59,22 @@<td class="piggyBar d-none d-md-table-cell">@if(null !== $piggy['percentage'])- <div class="progress progress mb-0">- <div- @if(100 === $piggy['percentage'])- class="progress-bar progress-bar-success w-{{ round(max(30, $piggy['percentage'])) }}"- @elseif(0 === $piggy['percentage'])- class="progress-bar progress-bar-warning w-{{ round(max(30, $piggy['percentage'])) }}"- @else- class="progress-bar progress-bar-info w-{{ round(max(30, $piggy['percentage'])) }}"- @endif- role="progressbar" aria-valuenow="{{ $piggy['percentage'] }}" aria-valuemin="0" aria-valuemax="100">- {{ $piggy['percentage'] }}%+ <div class="progress"+ style="height: 21px" role="progressbar" aria-valuenow="{{ round(max(30, $piggy['percentage'])) }}" aria-valuemin="0" aria-valuemax="100">+ <div+ @if(100 === $piggy['percentage'])+ class="progress-bar progress-bar-striped bg-success w-{{ round(max(30, $piggy['percentage'])) }}"+ @elseif(0 === $piggy['percentage'])+ class="progress-bar progress-bar-striped bg-warning w-{{ round(max(30, $piggy['percentage'])) }}"+ @else+ class="progress-bar progress-bar-striped bg-info w-{{ round(max(30, $piggy['percentage'])) }}"+ @endif+ ></div></div>- </div>@endif+++</td>diff --git a/resources/views/components/lists/subscriptions.blade.php b/resources/views/components/lists/subscriptions.blade.phpindex 21cf94262b..b72ebf95b1 100644--- a/resources/views/components/lists/subscriptions.blade.php+++ b/resources/views/components/lists/subscriptions.blade.php@@ -1,8 +1,11 @@@foreach($bills as $objectGroupOrder => $objectGroup)-<h5 class="m-3">{{ $objectGroup['object_group_title'] }}</h5>--<table class="table table-hover table-sm table-bordered" id="bill-sortable">- <thead class="table-secondary">+ <div class="row">+ <div class="col-lg-12 col-sm-12 col-md-12">+ <div class="card mb-2">+ <x-elements.card-header-with-menu :cardTitle="$objectGroup['object_group_title']" :route="route('subscriptions.create')" :linkTitle="__('firefly.create_new_bill')" />+ <div class="card-body p-0">+<table class="table table-hover table-sm" id="bill-sortable">+ <thead><tr><th class="hidden-sm hidden-xs"> </th><th class="hidden-sm hidden-xs"> </th>@@ -200,6 +203,11 @@@endif</table>+ </div>+ <x-elements.card-footer-with-menu :route="route('subscriptions.create')" :linkTitle="__('firefly.create_new_bill')" />+ </div>+ </div>+ </div>@endforeach@if(count($totals) > 0)diff --git a/resources/views/json/piggy-banks.blade.php b/resources/views/json/piggy-banks.blade.phpindex 33e44e2fcf..80da11e939 100644--- a/resources/views/json/piggy-banks.blade.php+++ b/resources/views/json/piggy-banks.blade.php@@ -10,22 +10,22 @@<div class="progress-bar progress-bar-striped w-{{ round($entry['percentage']) }}" role="progressbar" aria-valuenow="{{ $entry['percentage'] }}" aria-valuemin="0" aria-valuemax="100">@if($entry['percentage'] > 20)@if($convertToPrimary && 0 !== $avg['pc_amount'])- {!! format_amount_by_symbol($entry['pc_amount'], $entry['primary_currency_symbol'], $entry['primary_currency_decimal_places'], false) }}- ({!! format_amount_by_symbol($entry['amount'], $entry['currency_symbol'], $entry['currency_decimal_places'], false) }})+ {!! format_amount_by_symbol($entry['pc_amount'], $entry['primary_currency_symbol'], $entry['primary_currency_decimal_places'], false) !!}+ ({!! format_amount_by_symbol($entry['amount'], $entry['currency_symbol'], $entry['currency_decimal_places'], false) !!})@endif@if(!$convertToPrimary)- {!! format_amount_by_symbol($entry['amount'], $entry['currency_symbol'], $entry['currency_decimal_places'], false) }}+ {!! format_amount_by_symbol($entry['amount'], $entry['currency_symbol'], $entry['currency_decimal_places'], false) !!}@endif@endif</div>@if($entry['percentage'] <= 20) @if($convertToPrimary && 0 !== $avg['pc_amount'])- {!! format_amount_by_symbol($entry['pc_amount'], $entry['primary_currency_symbol'], $entry['primary_currency_decimal_places'], false) }}- ({!! format_amount_by_symbol($entry['amount'], $entry['currency_symbol'], $entry['currency_decimal_places'], false) }})+ {!! format_amount_by_symbol($entry['pc_amount'], $entry['primary_currency_symbol'], $entry['primary_currency_decimal_places'], false) !!}+ ({!! format_amount_by_symbol($entry['amount'], $entry['currency_symbol'], $entry['currency_decimal_places'], false) !!})@endif@if(!$convertToPrimary)- {!! format_amount_by_symbol($entry['amount'], $entry['currency_symbol'], $entry['currency_decimal_places'], false) }}+ {!! format_amount_by_symbol($entry['amount'], $entry['currency_symbol'], $entry['currency_decimal_places'], false) !!}@endif@endif</div>