Skip to content

Firefly III: a personal finances manager

Clean up some lists, sync values.

James Cole723aa183746d
diff --git a/app/Support/Steam.php b/app/Support/Steam.php
index a48a6642d2..12f54b1cdc 100644
--- a/app/Support/Steam.php
+++ b/app/Support/Steam.php
@@ -157,14 +157,14 @@ class Steam
// the primary currency balance is combined with a converted virtual_balance:
$converter = new ExchangeRateConverter();
// $return['pc_balance'] = bcadd($pcVirtualBalance, $return['pc_balance']);
- $sumsByCode[$primary->code] = bcadd($pcVirtualBalance, $sumsByCode[$primary->code]);
+ $sumsByCode[$primary->code] = bcadd($pcVirtualBalance, $sumsByCode[$primary->code] ?? '0');
Log::debug(sprintf('Primary virtual balance (%s) makes the primary total %s', $pcVirtualBalance, $sumsByCode[$primary->code]));
}
if (!$convertToPrimary) {
// if not, also increase the balance + primary balance for consistency.
// $return['balance'] = bcadd($return['balance'], $virtualBalance);
- $sumsByCode[$currency->code] = bcadd($virtualBalance, $sumsByCode[$currency->code]);
+ $sumsByCode[$currency->code] = bcadd($virtualBalance, $sumsByCode[$currency->code] ?? '0');
Log::debug(sprintf('Virtual balance (%s) makes the (primary currency) total %s', $virtualBalance, $sumsByCode[$currency->code]));
}
diff --git a/resources/assets/v3/js/pages/shared/dates.js b/resources/assets/v3/js/pages/shared/dates.js
index 222a5d9172..474727be44 100644
--- a/resources/assets/v3/js/pages/shared/dates.js
+++ b/resources/assets/v3/js/pages/shared/dates.js
@@ -21,7 +21,6 @@
import {addMonths, endOfMonth, startOfMonth, startOfYear, subDays, subMonths} from "date-fns";
import format from '../../util/format'
-
export default () => ({
range: {
start: null, end: null
@@ -32,11 +31,7 @@ export default () => ({
}
},
updateDates(e) {
- console.log('updateDates (e.originalTarget._props.value)');
- console.log(e.originalTarget._props.value);
let split = e.originalTarget._props.value.split('/');
- // this.range.start = split[0];
- // this.range.end = split[1];
console.log('Start is now ' + split[0]);
console.log('End is now ' + split[1]);
window.store.set('start', split[0]);
@@ -48,23 +43,24 @@ export default () => ({
start: null, end: null
},
submitForm() {
- console.log('submitForm');
+ console.log('submitForm', format(window.store.get('start'), 'yyyy-MM-dd'), format(window.store.get('end'), 'yyyy-MM-dd'));
// save form and submit for v1.
- document.getElementById('customStart').value = window.store.get('start');
- document.getElementById('customEnd').value = window.store.get('end');
+ document.getElementById('customStart').value = format(window.store.get('start'), 'yyyy-MM-dd');
+ document.getElementById('customEnd').value = format(window.store.get('end'), 'yyyy-MM-dd');
document.getElementById('daterange-form').submit();
},
language: 'en_US',
init() {
- // console.log('init on dates');
+ let end = new Date(window.store.get('end'));
+ let start = new Date(window.store.get('start'));
this.range = {
- start: new Date(window.store.get('start')),
- end: new Date(window.store.get('end'))
+ start: start,
+ end: end
};
this.defaultRange = {
- start: new Date(window.store.get('start')),
- end: new Date(window.store.get('end'))
+ start: start,
+ end: end
};
this.language = window.store.get('language');
this.locale = window.store.get('locale');
@@ -95,7 +91,6 @@ export default () => ({
// set the title:
let element = document.getElementsByClassName('daterange-holder')[0];
- //console.log('element', element);
element.textContent = format(this.range.start) + ' - ' + format(this.range.end);
element.setAttribute('data-start', format(this.range.start, 'yyyy-MM-dd'));
element.setAttribute('data-end', format(this.range.end, 'yyyy-MM-dd'));
@@ -192,13 +187,10 @@ export default () => ({
changeDateRange(e) {
console.log('changeDateRange');
e.preventDefault();
- // console.log('MainApp: changeDateRange');
let target = e.currentTarget;
let start = new Date(target.getAttribute('data-start'));
let end = new Date(target.getAttribute('data-end'));
- // console.log('MainApp: Change date range', start, end);
-
window.store.set('start', start);
window.store.set('end', end);
this.submitForm();
diff --git a/resources/lang/en_US/breadcrumbs.php b/resources/lang/en_US/breadcrumbs.php
index 44cf3d9e99..b068898e10 100644
--- a/resources/lang/en_US/breadcrumbs.php
+++ b/resources/lang/en_US/breadcrumbs.php
@@ -24,6 +24,7 @@ declare(strict_types=1);
return [
'home' => 'Home',
+ 'subscriptions' => 'Subscriptions',
'title_expenses' => 'Expenses',
'title_withdrawal' => 'Expenses',
'title_revenue' => 'Revenue / income',
diff --git a/resources/views/components/lists/subscriptions.blade.php b/resources/views/components/lists/subscriptions.blade.php
index 1fcd7b7c2c..82285a2526 100644
--- a/resources/views/components/lists/subscriptions.blade.php
+++ b/resources/views/components/lists/subscriptions.blade.php
@@ -38,6 +38,24 @@
@if(count($entry['attachments']) > 0)
<span class="bi bi-paperclip"></span>
@endif
+ @if(null !== $entry['end_date'])
+ <br>
+ @if(new \Carbon\Carbon($entry['end_date'])->lte($today))
+ <span
+ class="text-danger">{{ trans('firefly.bill_end_index_line', ['date' => new \Carbon\Carbon($entry['end_date'])->isoFormat($monthAndDayFormat)]) }}</span>
+ @else
+ {{ trans('firefly.bill_end_index_line', ['date' => new \Carbon\Carbon($entry['end_date'])->isoFormat($monthAndDayFormat)]) }}
+ @endif
+ @endif
+ @if($entry['extension_date'])
+ <br>
+ @if(new \Carbon\Carbon($entry['extension_date'])->lte($today))
+ <span
+ class="text-danger">{{ trans('firefly.bill_extension_index_line', ['date' => new \Carbon\Carbon($entry['extension_date'])->isoFormat($monthAndDayFormat)]) }}</span>
+ @else
+ {{ trans('firefly.bill_extension_index_line', ['date' => new \Carbon\Carbon($entry['extension_date'])->isoFormat($monthAndDayFormat)]) }}
+ @endif
+ @endif
</td>
<td class="rules d-xl-table-cell d-none" {{-- hide on LG and smaller --}}>
@@ -147,24 +165,6 @@
@if($entry['skip'] > 0)
{{ __('firefly.skips_over') }} {{ $entry['skip'] }}
@endif
- @if(null !== $entry['end_date'])
- <br>
- @if(new \Carbon\Carbon($entry['end_date'])->lte($today))
- <span
- class="text-danger">{{ trans('firefly.bill_end_index_line', ['date' => new \Carbon\Carbon($entry['end_date'])->isoFormat($monthAndDayFormat)]) }}</span>
- @else
- {{ trans('firefly.bill_end_index_line', ['date' => new \Carbon\Carbon($entry['end_date'])->isoFormat($monthAndDayFormat)]) }}
- @endif
- @endif
- @if($entry['extension_date'])
- <br>
- @if(new \Carbon\Carbon($entry['extension_date'])->lte($today))
- <span
- class="text-danger">{{ trans('firefly.bill_extension_index_line', ['date' => new \Carbon\Carbon($entry['extension_date'])->isoFormat($monthAndDayFormat)]) }}</span>
- @else
- {{ trans('firefly.bill_extension_index_line', ['date' => new \Carbon\Carbon($entry['extension_date'])->isoFormat($monthAndDayFormat)]) }}
- @endif
- @endif
</td>
<td class="text-end">
<div class="dropdown">
diff --git a/resources/views/layout/v3/session.blade.php b/resources/views/layout/v3/session.blade.php
index e315b4eef5..ee99cf448f 100644
--- a/resources/views/layout/v3/session.blade.php
+++ b/resources/views/layout/v3/session.blade.php
@@ -42,6 +42,11 @@
}
document.documentElement.setAttribute('data-bs-theme', resolved);
document.documentElement.style.colorScheme = resolved;
+
+ // bonus: overrule local storage with session data:
+ console.warn('Temporary overrule local storage until everything uses the API.');
+ localStorage.setItem('start', '{{ session()->get('start')->format('c') }}');
+ localStorage.setItem('end', '{{ session()->get('end')->format('c') }}');
})();
</script>
<!--end::Theme Init-->
diff --git a/resources/views/recurring/index.blade.php b/resources/views/recurring/index.blade.php
index 8ef986f21a..0656c7350f 100644
--- a/resources/views/recurring/index.blade.php
+++ b/resources/views/recurring/index.blade.php
@@ -21,11 +21,11 @@
<table class="table table-responsive table-hover sortable">
<thead>
<tr>
- <th data-defaultsign="az">{{ trans('list.title') }}</th>
- <th data-defaultsort="disabled">{{ trans('list.transaction_s') }}</th>
- <th data-defaultsort="disabled">{{ trans('list.repetitions') }}</th>
- <th data-defaultsign="month" data-dateformat="{{ $madMomentJS }}">{{ trans('list.next_due') }}</th>
- <th data-defaultsort="disabled">&nbsp;</th>
+ <th class="w-25" data-defaultsign="az">{{ trans('list.title') }}</th>
+ <th class="w-25" data-defaultsort="disabled">{{ trans('list.transaction_s') }}</th>
+ <th class="w-25" data-defaultsort="disabled">{{ trans('list.repetitions') }}</th>
+ <th class="w-20" data-defaultsign="month" data-dateformat="{{ $madMomentJS }}">{{ trans('list.next_due') }}</th>
+ <th class="w-5" data-defaultsort="disabled">&nbsp;</th>
</tr>
</thead>
<tbody>
diff --git a/resources/views/rules/index.blade.php b/resources/views/rules/index.blade.php
index 5fa47e666b..ec28c71bf9 100644
--- a/resources/views/rules/index.blade.php
+++ b/resources/views/rules/index.blade.php
@@ -59,10 +59,10 @@
<table class="table table-sm table-hover table-striped group-rules">
<thead>
<tr>
- <th class="five">&nbsp;</th>
- <th class="quarter">{{ __('firefly.rule_name') }}</th>
- <th class="quarter d-xs-none">{{ __('firefly.rule_triggers') }}</th>
- <th class="quarter d-xs-none">{{ __('firefly.rule_actions') }}</th>
+ <th class="w-5">&nbsp;</th>
+ <th class="w-25">{{ __('firefly.rule_name') }}</th>
+ <th class="w-25 d-xs-none">{{ __('firefly.rule_triggers') }}</th>
+ <th class="w-25 d-xs-none">{{ __('firefly.rule_actions') }}</th>
<th class="w-20">&nbsp;</th>
</tr>
</thead>
@@ -137,7 +137,7 @@
</ul>
@endif
</td>
- <td>
+ <td class="text-end">
<div class="dropdown">
<button class="btn btn-sm btn-outline-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
{{ __('firefly.actions') }}
diff --git a/resources/views/transactions/edit.blade.php b/resources/views/transactions/edit.blade.php
index bad2f7dc02..e01ae50cfb 100644
--- a/resources/views/transactions/edit.blade.php
+++ b/resources/views/transactions/edit.blade.php
@@ -3,16 +3,13 @@
@vite(['js/pages/transactions/edit.js'])
@endsection
@section('content')
- <div class="app-content">
- <!--begin::Container-->
- <div class="container-fluid" x-data="transactions" id="form">
- <x-transaction.messages />
- <x-transaction.tab-list />
- <div class="tab-content" id="splitTabsContent">
- <template x-for="transaction,index in entries">
- <x-transaction.split />
- </template>
- </div>
+ <div x-data="transactions" id="form">
+ <x-transaction.messages/>
+ <x-transaction.tab-list/>
+ <div class="tab-content" id="splitTabsContent">
+ <template x-for="transaction,index in entries">
+ <x-transaction.split/>
+ </template>
</div>
</div>
diff --git a/routes/breadcrumbs.php b/routes/breadcrumbs.php
index 3fcd0897d8..9a0d2c8242 100644
--- a/routes/breadcrumbs.php
+++ b/routes/breadcrumbs.php
@@ -52,7 +52,7 @@ if (!function_exists('limitStringLength')) {
*/
function limitStringLength(string $string): string
{
- $maxChars = 75;
+ $maxChars = 35;
$length = strlen($string);
if ($length > $maxChars) {
return substr_replace($string, ' ... ', (int)($maxChars / 2), $length - $maxChars);