@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('partner_id')) @else @endif
{{ __('app.table_no') }} {{ __('app.date') }} {{ __('transaction.description') }} {{ __('transaction.amount') }} {{ __('app.action') }}
{{ 1 + $key }} {{ link_to_route('transactions.index', $transaction->date_only, [ 'date' => $transaction->date_only, 'month' => $month, 'year' => $year, 'category_id' => request('category_id'), ]) }} @if ($transaction->loan) @php $loanRoute = route('loans.show', $transaction->loan); @endphp {!! optional($transaction->loan)->type_label !!} @endif @if ($transaction->partner) @php $partnerRoute = route('partners.show', [ $transaction->partner_id, 'start_date' => $startDate, 'end_date' => $year.'-'.$month.'-'.date('t'), ]); @endphp {!! optional($transaction->partner)->name_label !!} @endif @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->description }} {{ $transaction->amount_string }} @can('update', $transaction) {!! link_to_route( 'transactions.index', __('app.edit'), ['action' => 'edit', 'id' => $transaction->id] + request(['month', 'year', 'query', 'category_id']), ['id' => 'edit-transaction-'.$transaction->id] ) !!} @endcan
{{ __('transaction.not_found') }}
 
{{ __('transaction.income_total') }} {{ format_number($incomeTotal) }}  
{{ __('transaction.spending_total') }} {{ format_number($spendingTotal) }}  
{{ __('transaction.difference') }} {{ number_format($incomeTotal - $spendingTotal, 2) }}  
 
{{ __('transaction.start_balance') }} @php $balance = 0; @endphp @if ($transactions->last()) {{ format_number($balance = balance(Carbon\Carbon::parse($transactions->last()->date)->subDay()->format('Y-m-d'))) }} @else 0 @endif  
{{ __('transaction.income_total') }} {{ format_number($incomeTotal) }}  
{{ __('transaction.spending_total') }} {{ format_number($spendingTotal) }}  
{{ __('transaction.end_balance') }} @if ($transactions->first()) {{ format_number($balance + $incomeTotal - $spendingTotal) }} @else 0 @endif  
@elsedesktop
@foreach ($transactions->groupBy('date') as $groupedTransactions) @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
@if(Request::has('action')) @include('transactions.forms') @endif
@endsection @section('styles') {{ Html::style(url('css/plugins/jquery.datetimepicker.css')) }} @endsection @push('scripts') {{ Html::script(url('js/plugins/jquery.datetimepicker.js')) }} @endpush