@php /* * Use the administrator-selected currency from Payment Settings. */ $displayCurrency = default_currency(); @endphp
@forelse($balanceHistory as $entry) @php $entryType = strtolower( trim( (string) data_get( $entry, 'type', 'unknown' ) ) ); $entrySource = trim( (string) data_get( $entry, 'source', 'unknown' ) ); $entryReference = trim( (string) data_get( $entry, 'reference', __('N/A') ) ); /* * Use an absolute amount because the transaction * type provides the displayed plus/minus sign. */ $entryAmount = abs( (float) data_get( $entry, 'amount', 0 ) ); $balanceAfter = (float) data_get( $entry, 'balance_after', 0 ); $isCredit = $entryType === 'credit'; $typeBadgeClass = match ($entryType) { 'credit' => 'bg-success', 'debit' => 'bg-danger', default => 'bg-secondary', }; $amountTextClass = match ($entryType) { 'credit' => 'text-success', 'debit' => 'text-danger', default => 'text-muted', }; $amountSign = match ($entryType) { 'credit' => '+', 'debit' => '-', default => '', }; /* * Safely parse dates that may be returned as either * Carbon objects or ordinary database strings. */ $createdAt = null; $createdAtValue = data_get( $entry, 'created_at' ); if (filled($createdAtValue)) { try { $createdAt = \Illuminate\Support\Carbon::parse( $createdAtValue ); } catch (\Throwable) { $createdAt = null; } } @endphp {{-- Transaction Type --}} {{-- Transaction Source --}} {{-- Reference --}} {{-- Transaction Amount --}} {{-- Balance After Transaction --}} {{-- Transaction Date --}} @empty @endforelse
{{ __('Type') }} {{ __('Source') }} {{ __('Reference') }} {{ __('Amount') }} {{ __('Balance After') }} {{ __('Date') }}
{{ \Illuminate\Support\Str::headline( $entryType ) }} {{ \Illuminate\Support\Str::headline( $entrySource ) }} {{ \Illuminate\Support\Str::limit( $entryReference, 30 ) }} {{ $amountSign }}{{ money( $entryAmount, $displayCurrency ) }} {{ money( $balanceAfter, $displayCurrency ) }} @if($createdAt)
{{ $createdAt->format( 'M d, Y H:i' ) }}
{{ $createdAt->diffForHumans() }}
@elseif(filled($createdAtValue)) {{ $createdAtValue }} @else {{ __('N/A') }} @endif
{{ __('No balance history found.') }}
@once @push('styles') @endpush @endonce