@extends('layouts.app') @section('title', __('transaction.list')) @section('content')
@include('transactions.partials.stats')
@include('transactions.partials.index_filters')
@desktop
@forelse ($transactions as $key => $transaction) @php $groups = $transactions->where('date_only', $transaction->date_only); $firstGroup = $groups->first(); $groupCount = $groups->count(); @endphp @if ($firstGroup->id == $transaction->id) @endif @empty @endforelse @if (request('category_id') || request('book_id')) @else @endif
{{ __('app.table_no') }} {{ __('app.date') }} {{ __('transaction.description') }} {{ __('transaction.amount') }} {{ __('app.action') }}
{{ 1 + $key }} {{ $transaction->day_name }}, {{ link_to_route('transactions.index', $transaction->date_only.'-'.$transaction->month_name, [ 'date' => $transaction->date_only, 'month' => $month, 'year' => $year, 'category_id' => request('category_id'), ]) }} @if ($transaction->files_count) {{ $transaction->files_count }} @endif @if ($transaction->partner) @php $partnerRoute = route('partners.show', [ $transaction->partner_id, 'start_date' => $startDate, 'end_date' => $year.'-'.$month.'-'.date('t'), ]); @endphp {{ $transaction->partner->name }} @endif {{ $transaction->bankAccount->name }} @if ($transaction->category) @php $categoryRoute = route('categories.show', [ $transaction->category_id, 'start_date' => $startDate, 'end_date' => $year.'-'.$month.'-'.date('t'), ]); @endphp {!! optional($transaction->category)->name_label !!} @endif
{!! $transaction->date_alert !!} {!! nl2br(htmlentities($transaction->description)) !!}
{{ $transaction->amount_string }} @can('update', $transaction) @can('manage-transactions', auth()->activeBook()) {!! link_to_route( 'transactions.edit', __('app.edit'), [$transaction->id, 'reference_page' => 'transactions'] + request(['month', 'year', 'query', 'category_id', 'bank_account_id']), ['id' => 'edit-transaction-'.$transaction->id] ) !!} | @endcan @endcan {{ link_to_route('transactions.show', __('app.detail'), $transaction) }} @can('create', new App\Transaction) | {{ link_to_route( 'transactions.create', __('app.duplicate'), [ 'action' => $transaction->in_out ? 'add-income' : 'add-spending', 'original_transaction_id' => $transaction->id, 'reference_page' => 'transactions', ] + request(['month', 'year', 'query', 'category_id', 'bank_account_id']), ['id' => 'duplicate-transaction-'.$transaction->id] ) }} @endcan
{{ __('transaction.not_found') }}
 
{{ __('transaction.income_total') }} {{ format_number($incomeTotal) }}  
{{ __('transaction.spending_total') }} {{ format_number($spendingTotal) }}  
{{ __('transaction.difference') }} {{ format_number($incomeTotal - $spendingTotal) }}  
 
{{ __('transaction.start_balance') }} {{ format_number($balance = auth()->activeBook()->getBalance(Carbon\Carbon::parse($startDate)->subDay()->format('Y-m-d'))) }}  
{{ __('transaction.income_total') }} {{ format_number($incomeTotal) }}  
{{ __('transaction.spending_total') }} {{ format_number($spendingTotal) }}  
{{ __('transaction.end_balance') }} {{ format_number($balance + $incomeTotal - $spendingTotal) }}  
@elsedesktop
@foreach ($transactions->groupBy('date') as $groupedTransactions)
{{ $groupedTransactions->first()->day_name }}
@foreach ($groupedTransactions as $date => $transaction) @include('transactions.partials.single_transaction_mobile', ['transaction' => $transaction, 'month' => $month, 'year' => $year]) @endforeach
@endforeach @include('transactions.partials.transaction_summary_mobile', ['transactions' => $transactions])
@enddesktop
@endsection