summary amount format change for Humans..
This commit is contained in:
parent
8d7a8b2897
commit
58a03d0498
@ -281,9 +281,10 @@ abstract class Index extends Component
|
|||||||
|
|
||||||
foreach ($totals as $key => $total) {
|
foreach ($totals as $key => $total) {
|
||||||
$items[] = [
|
$items[] = [
|
||||||
'title' => ($key == 'overdue') ? trans('general.overdue') : trans('documents.statuses.' . $key),
|
'title' => ($key == 'overdue') ? trans('general.overdue') : trans('documents.statuses.' . $key),
|
||||||
'href' => route($route, ['search' => 'status:' . $key]),
|
'href' => route($route, ['search' => 'status:' . $key]),
|
||||||
'amount' => money($total, setting('default.currency'), true),
|
'amount' => money($total, setting('default.currency'), true)->formatForHumans(),
|
||||||
|
'tooltip' => money($total, setting('default.currency'), true)->format(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -392,12 +392,14 @@ abstract class Index extends Component
|
|||||||
foreach ($totals as $key => $total) {
|
foreach ($totals as $key => $total) {
|
||||||
$title = ($key == 'overdue') ? trans('general.overdue') : trans('documents.statuses.' . $key);
|
$title = ($key == 'overdue') ? trans('general.overdue') : trans('documents.statuses.' . $key);
|
||||||
$href = route($route, ['search' => 'status:' . $key]);
|
$href = route($route, ['search' => 'status:' . $key]);
|
||||||
$amount = money($total, setting('default.currency'), true);
|
$amount = money($total, setting('default.currency'), true)->formatForHumans();
|
||||||
|
$tooltip = money($total, setting('default.currency'), true)->format();
|
||||||
|
|
||||||
$items[] = [
|
$items[] = [
|
||||||
'title' => $title,
|
'title' => $title,
|
||||||
'href' => $href,
|
'href' => $href,
|
||||||
'amount' => $amount,
|
'amount' => $amount,
|
||||||
|
'tooltip' => $tooltip,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,17 @@ class Reconciliations extends Controller
|
|||||||
{
|
{
|
||||||
$reconciliations = Reconciliation::with('account')->collect();
|
$reconciliations = Reconciliation::with('account')->collect();
|
||||||
|
|
||||||
return $this->response('banking.reconciliations.index', compact('reconciliations'));
|
$reconciled_amount = money($reconciliations->where('reconciled', 1)->sum('closing_balance'), setting('default.currency'), true);
|
||||||
|
$in_progress_amount = money($reconciliations->where('reconciled', 0)->sum('closing_balance'), setting('default.currency'), true);
|
||||||
|
|
||||||
|
$summary_amounts = [
|
||||||
|
'amount_exact' => $reconciled_amount->format(),
|
||||||
|
'amount_for_humans' => $reconciled_amount->formatForHumans(),
|
||||||
|
'in_progress_exact' => $in_progress_amount->format(),
|
||||||
|
'in_progress_for_humans' => $in_progress_amount->formatForHumans(),
|
||||||
|
];
|
||||||
|
|
||||||
|
return $this->response('banking.reconciliations.index', compact('reconciliations', 'summary_amounts'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -56,12 +56,25 @@ class Transactions extends Controller
|
|||||||
|
|
||||||
$totals['profit'] = $totals['income'] - $totals['expense'];
|
$totals['profit'] = $totals['income'] - $totals['expense'];
|
||||||
|
|
||||||
|
$incoming_amount = money($totals['income'], setting('default.currency'), true);
|
||||||
|
$expense_amount = money($totals['expense'], setting('default.currency'), true);
|
||||||
|
$profit_amount = money($totals['profit'], setting('default.currency'), true);
|
||||||
|
|
||||||
|
$summary_amounts = [
|
||||||
|
'incoming_exact' => $incoming_amount->format(),
|
||||||
|
'incoming_for_humans' => $incoming_amount->formatForHumans(),
|
||||||
|
'expense_exact' => $expense_amount->format(),
|
||||||
|
'expense_for_humans' => $expense_amount->formatForHumans(),
|
||||||
|
'profit_exact' => $profit_amount->format(),
|
||||||
|
'profit_for_humans' => $profit_amount->formatForHumans(),
|
||||||
|
];
|
||||||
|
|
||||||
$translations = $this->getTranslationsForConnect('income');
|
$translations = $this->getTranslationsForConnect('income');
|
||||||
|
|
||||||
return $this->response('banking.transactions.index', compact(
|
return $this->response('banking.transactions.index', compact(
|
||||||
'transactions',
|
'transactions',
|
||||||
'translations',
|
'translations',
|
||||||
'totals'
|
'summary_amounts'
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ class Content extends Component
|
|||||||
{
|
{
|
||||||
public $counts;
|
public $counts;
|
||||||
|
|
||||||
public $totals;
|
public $summary_amounts;
|
||||||
|
|
||||||
public $transactions;
|
public $transactions;
|
||||||
|
|
||||||
@ -72,7 +72,20 @@ class Content extends Component
|
|||||||
$totals['paid'] += $item->getAmountConvertedToDefault();
|
$totals['paid'] += $item->getAmountConvertedToDefault();
|
||||||
});
|
});
|
||||||
|
|
||||||
$this->totals = $totals;
|
$open_amount = money($totals['open'], setting('default.currency'), true);
|
||||||
|
$overdue_amount = money($totals['overdue'], setting('default.currency'), true);
|
||||||
|
$paid_amount = money($totals['paid'], setting('default.currency'), true);
|
||||||
|
|
||||||
|
$summary_amounts = [
|
||||||
|
'open_exact' => $open_amount->format(),
|
||||||
|
'open_for_humans' => $open_amount->formatForHumans(),
|
||||||
|
'overdue_exact' => $overdue_amount->format(),
|
||||||
|
'overdue_for_humans' => $overdue_amount->formatForHumans(),
|
||||||
|
'paid_exact' => $paid_amount->format(),
|
||||||
|
'paid_for_humans' => $paid_amount->formatForHumans(),
|
||||||
|
];
|
||||||
|
|
||||||
|
$this->summary_amounts = $summary_amounts;
|
||||||
|
|
||||||
$this->transactions = $this->paginate($this->transactions->sortByDesc('paid_at'));
|
$this->transactions = $this->paginate($this->transactions->sortByDesc('paid_at'));
|
||||||
$this->documents = $this->paginate($this->documents->sortByDesc('issued_at'));
|
$this->documents = $this->paginate($this->documents->sortByDesc('issued_at'));
|
||||||
|
@ -116,15 +116,27 @@
|
|||||||
|
|
||||||
<x-show.summary.right>
|
<x-show.summary.right>
|
||||||
@stack('summary_incoming_start')
|
@stack('summary_incoming_start')
|
||||||
<x-slot name="first" amount="{{ $summary_amounts['incoming_for_humans'] }}" title="{{ trans('accounts.incoming') }}" tooltip="{{ $summary_amounts['incoming_exact'] }}"></x-slot>
|
<x-slot name="first"
|
||||||
|
amount="{{ $summary_amounts['incoming_for_humans'] }}"
|
||||||
|
title="{{ trans('accounts.incoming') }}"
|
||||||
|
tooltip="{{ $summary_amounts['incoming_exact'] }}"
|
||||||
|
></x-slot>
|
||||||
@stack('summary_incoming_end')
|
@stack('summary_incoming_end')
|
||||||
|
|
||||||
@stack('summary_outgoing_start')
|
@stack('summary_outgoing_start')
|
||||||
<x-slot name="second" amount="{{ $summary_amounts['outgoing_for_humans'] }}" title="{{ trans('accounts.outgoing') }}" tooltip="{{ $summary_amounts['outgoing_exact'] }}"></x-slot>
|
<x-slot name="second"
|
||||||
|
amount="{{ $summary_amounts['outgoing_for_humans'] }}"
|
||||||
|
title="{{ trans('accounts.outgoing') }}"
|
||||||
|
tooltip="{{ $summary_amounts['outgoing_exact'] }}"
|
||||||
|
></x-slot>
|
||||||
@stack('summary_outgoing_end')
|
@stack('summary_outgoing_end')
|
||||||
|
|
||||||
@stack('summary_current_start')
|
@stack('summary_current_start')
|
||||||
<x-slot name="third" amount="{{ $summary_amounts['current_for_humans'] }}" title="{{ trans('accounts.current_balance') }}" tooltip="{{ $summary_amounts['current_exact'] }}"></x-slot>
|
<x-slot name="third"
|
||||||
|
amount="{{ $summary_amounts['current_for_humans'] }}"
|
||||||
|
title="{{ trans('accounts.current_balance') }}"
|
||||||
|
tooltip="{{ $summary_amounts['current_exact'] }}"
|
||||||
|
></x-slot>
|
||||||
@stack('summary_current_end')
|
@stack('summary_current_end')
|
||||||
</x-show.summary.right>
|
</x-show.summary.right>
|
||||||
</x-show.summary>
|
</x-show.summary>
|
||||||
|
@ -20,14 +20,16 @@
|
|||||||
<x-index.summary>
|
<x-index.summary>
|
||||||
<x-slot name="first"
|
<x-slot name="first"
|
||||||
href="{{ route('reconciliations.index', ['search' => 'reconciled:1']) }}"
|
href="{{ route('reconciliations.index', ['search' => 'reconciled:1']) }}"
|
||||||
amount="{{ money($reconciliations->where('reconciled', 1)->sum('closing_balance'), setting('default.currency'), true) }}"
|
amount="{{ $summary_amounts['amount_for_humans'] }}"
|
||||||
title="{{ trans('reconciliations.reconciled_amount') }}"
|
title="{{ trans('reconciliations.reconciled_amount') }}"
|
||||||
|
tooltip="{{ $summary_amounts['amount_exact'] }}"
|
||||||
></x-slot>
|
></x-slot>
|
||||||
|
|
||||||
<x-slot name="second"
|
<x-slot name="second"
|
||||||
href="{{ route('reconciliations.index', ['search' => 'reconciled:0']) }}"
|
href="{{ route('reconciliations.index', ['search' => 'reconciled:0']) }}"
|
||||||
amount="{{ money($reconciliations->where('reconciled', 0)->sum('closing_balance'), setting('default.currency'), true) }}"
|
amount="{{ $summary_amounts['in_progress_for_humans'] }}"
|
||||||
title="{{ trans('reconciliations.in_progress') }}"
|
title="{{ trans('reconciliations.in_progress') }}"
|
||||||
|
tooltip="{{ $summary_amounts['in_progress_exact'] }}"
|
||||||
></x-slot>
|
></x-slot>
|
||||||
</x-index.summary>
|
</x-index.summary>
|
||||||
|
|
||||||
|
@ -44,21 +44,24 @@
|
|||||||
<x-index.summary>
|
<x-index.summary>
|
||||||
<x-slot name="first"
|
<x-slot name="first"
|
||||||
href="{{ route('transactions.index', ['search' => 'type:income']) }}"
|
href="{{ route('transactions.index', ['search' => 'type:income']) }}"
|
||||||
amount="{{ money($totals['income'], setting('default.currency'), true) }}"
|
amount="{{ $summary_amounts['incoming_for_humans'] }}"
|
||||||
title="{{ trans_choice('general.incomes', 1) }}"
|
title="{{ trans_choice('general.incomes', 1) }}"
|
||||||
|
tooltip="{{ $summary_amounts['incoming_exact'] }}"
|
||||||
divider="remove"
|
divider="remove"
|
||||||
></x-slot>
|
></x-slot>
|
||||||
|
|
||||||
<x-slot name="second"
|
<x-slot name="second"
|
||||||
href="{{ route('transactions.index', ['search' => 'type:expense']) }}"
|
href="{{ route('transactions.index', ['search' => 'type:expense']) }}"
|
||||||
amount="{{ money($totals['expense'], setting('default.currency'), true) }}"
|
amount="{{ $summary_amounts['expense_for_humans'] }}"
|
||||||
title="{{ trans_choice('general.expenses', 2) }}"
|
title="{{ trans_choice('general.expenses', 2) }}"
|
||||||
|
tooltip="{{ $summary_amounts['expense_exact'] }}"
|
||||||
divider="drag_handle"
|
divider="drag_handle"
|
||||||
></x-slot>
|
></x-slot>
|
||||||
|
|
||||||
<x-slot name="third"
|
<x-slot name="third"
|
||||||
amount="{{ money($totals['profit'], setting('default.currency'), true) }}"
|
amount="{{ $summary_amounts['profit_for_humans'] }}"
|
||||||
title="{{ trans_choice('general.profits', 1) }}"
|
title="{{ trans_choice('general.profits', 1) }}"
|
||||||
|
tooltip="{{ $summary_amounts['profit_exact'] }}"
|
||||||
class="cursor-default"
|
class="cursor-default"
|
||||||
></x-slot>
|
></x-slot>
|
||||||
</x-index.summary>
|
</x-index.summary>
|
||||||
|
@ -30,19 +30,31 @@
|
|||||||
<x-show.summary.right>
|
<x-show.summary.right>
|
||||||
@stack('summary_overdue_start')
|
@stack('summary_overdue_start')
|
||||||
@if (! $hideOverdue)
|
@if (! $hideOverdue)
|
||||||
<x-slot name="first" amount="{{ money($totals['overdue'], setting('default.currency'), true) }}" title="{{ trans('general.overdue') }}"></x-slot>
|
<x-slot name="first"
|
||||||
|
amount="{{ $summary_amounts['overdue_for_humans'] }}"
|
||||||
|
title="{{ trans('general.overdue') }}"
|
||||||
|
tooltip="{{ $summary_amounts['overdue_exact'] }}"
|
||||||
|
></x-slot>
|
||||||
@endif
|
@endif
|
||||||
@stack('summary_overdue_end')
|
@stack('summary_overdue_end')
|
||||||
|
|
||||||
@stack('summary_open_start')
|
@stack('summary_open_start')
|
||||||
@if (! $hideOpen)
|
@if (! $hideOpen)
|
||||||
<x-slot name="second" amount="{{ money($totals['open'], setting('default.currency'), true) }}" title="{{ trans('general.open') }}"></x-slot>
|
<x-slot name="second"
|
||||||
|
amount="{{ $summary_amounts['open_for_humans'] }}"
|
||||||
|
title="{{ trans('general.open') }}"
|
||||||
|
tooltip="{{ $summary_amounts['open_exact'] }}"
|
||||||
|
></x-slot>
|
||||||
@endif
|
@endif
|
||||||
@stack('summary_open_end')
|
@stack('summary_open_end')
|
||||||
|
|
||||||
@stack('summary_paid_start')
|
@stack('summary_paid_start')
|
||||||
@if (! $hidePaid)
|
@if (! $hidePaid)
|
||||||
<x-slot name="third" amount="{{ money($totals['paid'], setting('default.currency'), true) }}" title="{{ trans('general.paid') }}"></x-slot>
|
<x-slot name="third"
|
||||||
|
amount="{{ $summary_amounts['paid_for_humans'] }}"
|
||||||
|
title="{{ trans('general.paid') }}"
|
||||||
|
tooltip="{{ $summary_amounts['paid_exact'] }}"
|
||||||
|
></x-slot>
|
||||||
@endif
|
@endif
|
||||||
@stack('summary_paid_end')
|
@stack('summary_paid_end')
|
||||||
</x-show.summary.right>
|
</x-show.summary.right>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
@foreach ($items as $item)
|
@foreach ($items as $item)
|
||||||
<div @class(['w-1/2 sm:w-1/3 text-center'])>
|
<div @class(['w-1/2 sm:w-1/3 text-center'])>
|
||||||
@if (! empty($item['tooltip']))
|
@if (! empty($item['tooltip']))
|
||||||
<x-tooltip id="tooltip-summary-first" placement="top" message="{!! $first->attributes->get('tooltip') !!}">
|
<x-tooltip id="tooltip-summary-{{ $loop->index }}" placement="top" message="{!! $item['tooltip'] !!}">
|
||||||
<a href="{{ $item['href'] }}" class="group">
|
<a href="{{ $item['href'] }}" class="group">
|
||||||
@php $text_color = (! empty($item['text_color'])) ? $item['text_color'] : 'text-purple group-hover:text-purple-700'; @endphp
|
@php $text_color = (! empty($item['text_color'])) ? $item['text_color'] : 'text-purple group-hover:text-purple-700'; @endphp
|
||||||
<div @class(['relative text-xl sm:text-6xl', $text_color, 'mb-2'])>
|
<div @class(['relative text-xl sm:text-6xl', $text_color, 'mb-2'])>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
@foreach ($items as $item)
|
@foreach ($items as $item)
|
||||||
<div @class(['w-1/2 sm:w-1/3 text-center'])>
|
<div @class(['w-1/2 sm:w-1/3 text-center'])>
|
||||||
@if (! empty($item['tooltip']))
|
@if (! empty($item['tooltip']))
|
||||||
<x-tooltip id="tooltip-summary-first" placement="top" message="{!! $first->attributes->get('tooltip') !!}">
|
<x-tooltip id="tooltip-summary-{{ $loop->index }}" placement="top" message="{!! $item['tooltip'] !!}">
|
||||||
<a href="{{ $item['href'] }}" class="group">
|
<a href="{{ $item['href'] }}" class="group">
|
||||||
@php $text_color = (! empty($item['text_color'])) ? $item['text_color'] : 'text-purple group-hover:text-purple-700'; @endphp
|
@php $text_color = (! empty($item['text_color'])) ? $item['text_color'] : 'text-purple group-hover:text-purple-700'; @endphp
|
||||||
<div @class(['relative text-xl sm:text-6xl', $text_color, 'mb-2'])>
|
<div @class(['relative text-xl sm:text-6xl', $text_color, 'mb-2'])>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user