diff --git a/app/View/Components/EmptyPage.php b/app/View/Components/EmptyPage.php new file mode 100644 index 0000000000..b15141f90d --- /dev/null +++ b/app/View/Components/EmptyPage.php @@ -0,0 +1,31 @@ +route = $route; + $this->objectType = $objectType; + $this->type= $type; + } + + /** + * Get the view / contents that represent the component. + */ + public function render(): View|Closure|string + { + return view('components.empty-page'); + } +} diff --git a/app/View/Components/Lists/Periods.php b/app/View/Components/Lists/Periods.php new file mode 100644 index 0000000000..6f3d7ee3b5 --- /dev/null +++ b/app/View/Components/Lists/Periods.php @@ -0,0 +1,28 @@ +periods =$periods; + } + + /** + * Get the view / contents that represent the component. + */ + public function render(): View|Closure|string + { + return view('components.lists.periods'); + } +} diff --git a/resources/views/bills/index.blade.php b/resources/views/bills/index.blade.php index 8d50e96b14..707bf94182 100644 --- a/resources/views/bills/index.blade.php +++ b/resources/views/bills/index.blade.php @@ -1,8 +1,10 @@ @extends('layout.v3.session') @section('content') @if(0 === $total) - TODO TODO TODO - {% include 'partials.empty' with {objectType: 'default', type: 'bills',route: route('subscriptions.create')} %} + @php + $shownDemo = true + @endphp + @endif @if($total > 0)
diff --git a/resources/views/budgets/index.blade.php b/resources/views/budgets/index.blade.php index 049aff53c1..89913f10f4 100644 --- a/resources/views/budgets/index.blade.php +++ b/resources/views/budgets/index.blade.php @@ -180,10 +180,10 @@
@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 %} + @php + $shownDemo = true + @endphp + @else
diff --git a/resources/views/components/empty-page.blade.php b/resources/views/components/empty-page.blade.php new file mode 100644 index 0000000000..2051464cc2 --- /dev/null +++ b/resources/views/components/empty-page.blade.php @@ -0,0 +1,26 @@ +
+
+
+
+

{{ __('firefly.no_' . ($type ?? '') . '_title_' . ($objectType ?? 'default')) }}

+
+ +
+

+ {{ __('firefly.no_' . ($type ?? '').'_intro_'.($objectType ?? 'default')) }} +

+

+ {{ __('firefly.no_'.($type ?? '').'_imperative_'.($objectType ?? 'default')) }} + +

+

+ {{ __('firefly.no_'.($type ?? '').'_create_'.($objectType ?? 'default')) }} +

+
+ +
+
+
+ diff --git a/resources/views/components/lists/groups-large.blade.php b/resources/views/components/lists/groups-large.blade.php index d8cbddd593..bb3babe260 100644 --- a/resources/views/components/lists/groups-large.blade.php +++ b/resources/views/components/lists/groups-large.blade.php @@ -1,7 +1,7 @@ - @if($showCategory || $showBudget) + @if($showCategory || ($showBudget ?? false)) @else @@ -42,7 +42,7 @@ @if($showCategory) @endif - @if($showBudget) + @if($showBudget ?? false) @endif @@ -85,7 +85,7 @@ @endforeach - @if($showCategory || $showBudget) + @if($showCategory || $showBudget ?? false) @else @@ -274,157 +274,146 @@ @endif @endif - {% if (fireflyiiiconfig('use_running_balance', true)) %} + @if(\FireflyIII\Support\Facades\AppConfiguration::get('use_running_balance', true)) - {% endif %} + @endif - {% if showCategory %} + @if($showCategory) - {% endif %} - {% if showBudget %} + @endif + @if($showBudget) - {% endif %} + @endif - {% if group.count == 1 %} + @if(1 === count($group)) - {% endif %} - {% if group.count != 1 %} + @endif + @if(1 !== count($group)) - {% endif %} + @endif - {% endfor %} + @endforeach @endforeach @@ -435,26 +424,26 @@ - {% if showCategory or showBudget %} - - {% else %} - - {% endif %} + @if($showCategory || $showBudget) + + @else + + @endif
{{ $groups->links('pagination.bootstrap-4') }}{{ $groups->links('pagination.bootstrap-4') }}{{ trans('list.category') }}{{ trans('list.budget') }}     - {# RUNNING BALANCE #} - {% if (null == transaction.balance_dirty or false == transaction.balance_dirty) and null != transaction.destination_balance_after and null != transaction.source_balance_after %} - {% if $transaction['transaction_type_type'] == 'Deposit' %} - {% if $transaction['source_account_id'] == $account?->id %} - {{ formatAmountBySymbol(transaction.source_balance_after, $transaction['currency_symbol'], $transaction['currency_decimal_places']) }} - {% else %} - {% if $transaction['source_account_type'] == 'Revenue account' %} - {{ formatAmountBySymbol(transaction.destination_balance_after, $transaction['currency_symbol'], $transaction['currency_decimal_places']) }} - {% else %} - {{ formatAmountBySymbol(transaction.destination_balance_after, $transaction['foreign_currency_symbol'], $transaction['foreign_currency_decimal_places']) }} - {% endif %} - {# if this is a deposit from revenue account, use the destination account currency? For #12043 and #12169 #} - {# otherwise, keep at source account #} - {# changed from normal currency_symbol to foreign_currency_symbol for #12043 #} - - {% endif %} - - {% elseif $transaction['transaction_type_type'] == 'Withdrawal' %} - {# withdrawal into a liability #} - {% if 'Loan' == transaction.destination_account_type or 'Mortgage' == transaction.destination_account_type or 'Debt' == transaction.destination_account_type %} - {% if currency.id == transaction.currency_id %} - {% if $account?->id == $transaction['source_account_id'] %} - {{ formatAmountBySymbol(transaction.source_balance_after, $transaction['currency_symbol'], $transaction['currency_decimal_places']) }} - {% elseif $account?->id == transaction.destination_account_id %} - {{ formatAmountBySymbol(transaction.destination_balance_after, $transaction['currency_symbol'], $transaction['currency_decimal_places']) }} - {% else %} - - - {% endif %} - {% endif %} - {% if currency.id == transaction.foreign_currency_id and null != transaction.destination_balance_after and null != transaction.destination_balance_after %} - {{ formatAmountBySymbol(transaction.destination_balance_after, $transaction['foreign_currency_symbol'] ?? $transaction['currency_symbol'], $transaction['foreign_currency_decimal_places'] ?? $transaction['currency_decimal_places']) }} - {% endif %} - {# withdrawal into an expense account #} - {% else %} - {% if $account?->id == $transaction['source_account_id'] %} - {{ formatAmountBySymbol(transaction.source_balance_after, $transaction['currency_symbol'], $transaction['currency_decimal_places']) }} - {% elseif $account?->id == transaction.destination_account_id %} - {{ formatAmountBySymbol(transaction.destination_balance_after, $transaction['currency_symbol'], $transaction['currency_decimal_places']) }} - {% else %} - - - {% endif %} - {% endif %} - {% elseif $transaction['transaction_type_type'] == 'Opening balance' %} - {% if $account?->id == $transaction['source_account_id'] %} - {{ formatAmountBySymbol(transaction.source_balance_after, $transaction['currency_symbol'], $transaction['currency_decimal_places']) }} - {% elseif $account?->id == transaction.destination_account_id %} - {{ formatAmountBySymbol(transaction.destination_balance_after, $transaction['currency_symbol'], $transaction['currency_decimal_places']) }} - {% else %} - - - {% endif %} - {% elseif $transaction['transaction_type_type'] == 'Transfer' %} - {% if $account?->id == $transaction['source_account_id'] %} - {{ formatAmountBySymbol(transaction.source_balance_after, $transaction['currency_symbol'], $transaction['currency_decimal_places']) }} - {% else %} - {% if null == transaction.foreign_currency_id %} - {{ formatAmountBySymbol(transaction.destination_balance_after, $transaction['currency_symbol'], $transaction['currency_decimal_places']) }} - {% endif %} - {% if null != transaction.foreign_currency_id %} - {{ formatAmountBySymbol(transaction.destination_balance_after, $transaction['foreign_currency_symbol'], $transaction['foreign_currency_decimal_places']) }} - {% endif %} - {% endif %} - {% else %} + {{-- RUNNING BALANCE --}} + @if((null === $transaction['balance_dirty'] || false === $transaction['balance_dirty']) && null !== $transaction['destination_balance_after'] && null !== $transaction['source_balance_after']) + @if('Deposit' === $transaction['transaction_type_type']) + @if($transaction['source_account_id'] == $account?->id) + {{ formatAmountBySymbol($transaction['source_balance_after'], $transaction['currency_symbol'], $transaction['currency_decimal_places']) }} + @else + @if('Revenue account' === $transaction['source_account_type']) + {{ formatAmountBySymbol($transaction['destination_balance_after'], $transaction['currency_symbol'], $transaction['currency_decimal_places']) }} + @else + {{ formatAmountBySymbol($transaction['destination_balance_after'], $transaction['foreign_currency_symbol'], $transaction['foreign_currency_decimal_places']) }} + @endif + {{-- if this is a deposit from revenue account, use the destination account currency? For #12043 and #12169. Otherwise, keep at source account -}} + {{-- changed from normal currency_symbol to foreign_currency_symbol for #12043 --}} + @endif + @elseif('Withdrawal' === $transaction['transaction_type_type']) + {{-- withdrawal into a liability --}} + @if(in_array($transaction['destination_account_type'], ['Mortgage','Debt','Loan'], true)) + @if($currency['id'] === $transaction['currency_id']) + @if($account?->id === $transaction['source_account_id']) + {{ formatAmountBySymbol($transaction['source_balance_after'], $transaction['currency_symbol'], $transaction['currency_decimal_places']) }} + @elseif($account?->id === $transaction['destination_account_id']) + {{ formatAmountBySymbol($transaction['destination_balance_after'], $transaction['currency_symbol'], $transaction['currency_decimal_places']) }} + @else + - + @endif + @endif + @if($currency['id'] === $transaction['foreign_currency_id'] && null !== $transaction['destination_balance_after'] && null !== $transaction['destination_balance_after']) + {{ formatAmountBySymbol($transaction['destination_balance_after'], $transaction['foreign_currency_symbol'] ?? $transaction['currency_symbol'], $transaction['foreign_currency_decimal_places'] ?? $transaction['currency_decimal_places']) }} + @endif + {{-- withdrawal into an expense account --}} + @else + @if($account?->id === $transaction['source_account_id']) + {{ formatAmountBySymbol($transaction['source_balance_after'], $transaction['currency_symbol'], $transaction['currency_decimal_places']) }} + @elseif($account?->id === $transaction['destination_account_id']) + {{ formatAmountBySymbol($transaction['destination_balance_after'], $transaction['currency_symbol'], $transaction['currency_decimal_places']) }} + @else + - + @endif + @endif + @elseif('Opening balance' === $transaction['transaction_type_type']) + @if($account?->id == $transaction['source_account_id']) + {{ formatAmountBySymbol($transaction['source_balance_after'], $transaction['currency_symbol'], $transaction['currency_decimal_places']) }} + @elseif($account?->id == $transaction['destination_account_id']) + {{ formatAmountBySymbol($transaction['destination_balance_after'], $transaction['currency_symbol'], $transaction['currency_decimal_places']) }} + @else + - + @endif + @elseif('Transfer' === $transaction['transaction_type_type']) + @if($account?->id == $transaction['source_account_id']) + {{ formatAmountBySymbol($transaction['source_balance_after'], $transaction['currency_symbol'], $transaction['currency_decimal_places']) }} + @else + @if(null === $transaction['foreign_currency_id']) + {{ formatAmountBySymbol($transaction['destination_balance_after'], $transaction['currency_symbol'], $transaction['currency_decimal_places']) }} + @endif + @if(null !== $transaction['foreign_currency_id']) + {{ formatAmountBySymbol($transaction['destination_balance_after'], $transaction['foreign_currency_symbol'], $transaction['foreign_currency_decimal_places']) }} + @endif + @endif + @else   - {% endif %} - {% endif %} + @endif + @endif - {{ transaction.date.isoFormat(monthAndDayFormat) }} + {{ $transaction['date']->isoFormat($monthAndDayFormat) }} - {% if 'Cash account' == $transaction['source_account_type'] %} - ({{ 'cash'|_ }}) - {% else %} - {{ transaction.source_account_name }} - {% endif %} + @if('Cash account' === $transaction['source_account_type']) + ({{ __('firefly.cash') }}) + @else + {{ $transaction['source_account_name'] }} + @endif - {% if 'Cash account' == transaction.destination_account_type %} - ({{ 'cash'|_ }}) - {% else %} - {{ transaction.destination_account_name }} - {% endif %} + @if('Cash account' == $transaction['destination_account_type']) + ({{ __('firefly.cash') }}) + @else + {{ $transaction['destination_account_name'] }} + @endif - {% if transaction.category_id %} - {{ transaction.category_name }} - {% endif %} + @if(null !== $transaction['category_id']) + {{ $transaction['category_name'] }} + @endif - {% if transaction.budget_id %} - {{ transaction.budget_name }} - {% endif %} + @if(null !== $transaction['budget_id']) + {{ $transaction['budget_name'] }} + @endif
+ {{ __('firefly.actions') }}
  - {% if $transaction['transaction_type_type'] != 'Reconciliation' and $transaction['transaction_type_type'] != 'Opening balance' and $transaction['transaction_type_type'] != 'Liability credit' %} + @if($transaction['transaction_type_type'] !== 'Reconciliation' and $transaction['transaction_type_type'] !== 'Opening balance' and $transaction['transaction_type_type'] !== 'Liability credit')
- - {% endif %} + data-value="{{ $transaction['transaction_journal_id'] }}"/> + @endif
{{ $groups->links('pagination.bootstrap-4')|raw }}{{ $groups->links('pagination.bootstrap-4')|raw }}{{ $groups->links('pagination.bootstrap-4') }}{{ $groups->links('pagination.bootstrap-4') }}
diff --git a/resources/views/components/lists/periods.blade.php b/resources/views/components/lists/periods.blade.php new file mode 100644 index 0000000000..1a20e0e954 --- /dev/null +++ b/resources/views/components/lists/periods.blade.php @@ -0,0 +1,95 @@ +@foreach($periods as $period) +
+ +
+ + @if($period['total_transactions'] > 0) + + + + + @endif + @foreach($period['spent'] as $entry) + @if(($entry['amount'] ?? 0) !== 0) + + + + + @endif + @endforeach + + @foreach($period['earned'] ?? [] as $entry) + @if($entry['amount'] !== 0) + + + + + @endif + @endforeach + + @foreach($period['transferred'] ?? [] as $entry) + @if($entry['amount'] !== 0) + + + + + @endif + @endforeach + + @foreach($period['transferred_away'] ?? [] as $entry) + @if($entry['amount'] !== 0) + + + + + @endif + @endforeach + + @foreach($period['transferred_in'] ?? [] as $entry) + @if($entry['amount'] !== 0) + + + + + @endif + @endforeach +
{{ __('firefly.transactions') }}{{ $period['total_transactions'] }}
{{ __('firefly.spent') }} + + {{ formatAmountBySymbol($entry['amount'], $entry['currency_symbol'], $entry['currency_decimal_places']) }} + +
{{ __('firefly.earned') }} + + @if($entry['amount'] < 0) + {{ formatAmountBySymbol($entry['amount']*-1, $entry['currency_symbol'], $entry['currency_decimal_places']) }} + @else + {{ formatAmountBySymbol($entry['amount'], $entry['currency_symbol'], $entry['currency_decimal_places']) }} + @endif + +
{{ __('firefly.transferred') }} + + {{ formatAmountBySymbol($entry['amount']*-1, $entry['currency_symbol'], $entry['currency_decimal_places']) }} + +
{{ __('firefly.transferred_away') }} + + @if($entry['amount'] < 0) + {{ formatAmountBySymbol($entry['amount'], $entry['currency_symbol'], $entry['currency_decimal_places']) }} + @else + {{ formatAmountBySymbol($entry['amount']*-1, $entry['currency_symbol'], $entry['currency_decimal_places']) }} + @endif + +
{{ __('firefly.transferred_in') }} + + @if($entry['amount'] < 0) + {{ formatAmountBySymbol($entry['amount']*-1, $entry['currency_symbol'], $entry['currency_decimal_places']) }} + @else + {{ formatAmountBySymbol($entry['amount'], $entry['currency_symbol'], $entry['currency_decimal_places']) }} + @endif + +
+
+
+ +@endforeach diff --git a/resources/views/piggy-banks/index.blade.php b/resources/views/piggy-banks/index.blade.php index c420e925be..4251205ba4 100644 --- a/resources/views/piggy-banks/index.blade.php +++ b/resources/views/piggy-banks/index.blade.php @@ -1,8 +1,7 @@ @extends('layout.v3.session') @section('content') @if(0 === count($piggyBanks)) - TODO TODO TODO TODO - {% include 'partials.empty' with {objectType: 'default', type: 'piggies',route: route('piggy-banks.create')} %} + @endif @if(count($piggyBanks) > 0)
diff --git a/resources/views/transactions/index.blade.php b/resources/views/transactions/index.blade.php index 1e20e2a61c..d111ad77c4 100644 --- a/resources/views/transactions/index.blade.php +++ b/resources/views/transactions/index.blade.php @@ -94,7 +94,7 @@ {{-- boxes with info --}} @if(count($periods) > 0)
- {% include 'list.periods' %} +
@endif