improved #970
This commit is contained in:
parent
7db5dd2c5c
commit
c6e93736bc
@ -28,7 +28,7 @@ class Transactions extends Controller
|
|||||||
$request_type = !request()->has('type') ? ['income', 'expense'] : request('type');
|
$request_type = !request()->has('type') ? ['income', 'expense'] : request('type');
|
||||||
$categories = Category::enabled()->type($request_type)->orderBy('name')->pluck('name', 'id');
|
$categories = Category::enabled()->type($request_type)->orderBy('name')->pluck('name', 'id');
|
||||||
|
|
||||||
$transactions = Transaction::with(['account', 'category', 'contact', 'bill:id', 'invoice.id'])->collect(['paid_at'=> 'desc']);
|
$transactions = Transaction::with(['account', 'category', 'contact'])->collect(['paid_at'=> 'desc']);
|
||||||
|
|
||||||
return view('banking.transactions.index', compact('transactions', 'accounts', 'types', 'categories'));
|
return view('banking.transactions.index', compact('transactions', 'accounts', 'types', 'categories'));
|
||||||
}
|
}
|
||||||
|
@ -46,21 +46,15 @@
|
|||||||
<td class="col-xs-4 col-sm-3 col-md-2">{{ trans_choice('general.' . Str::plural($item->type), 1) }}</td>
|
<td class="col-xs-4 col-sm-3 col-md-2">{{ trans_choice('general.' . Str::plural($item->type), 1) }}</td>
|
||||||
<td class="col-sm-2 col-md-2 hidden-sm">{{ $item->category->name }}</td>
|
<td class="col-sm-2 col-md-2 hidden-sm">{{ $item->category->name }}</td>
|
||||||
<td class="col-md-2 hidden-md">{{ $item->description }}</td>
|
<td class="col-md-2 hidden-md">{{ $item->description }}</td>
|
||||||
@if(!is_null(data_get($item, 'bill.id')))
|
|
||||||
<td class="col-xs-4 col-sm-2 col-md-2 text-right">
|
<td class="col-xs-4 col-sm-2 col-md-2 text-right">
|
||||||
<a href="{{ route('bills.show', $item->bill->id) }}">
|
@php
|
||||||
|
$id = !empty($item->document_id) ? $item->document_id : $item->id;
|
||||||
|
$route = ($item->type == 'income') ? (!empty($item->document_id) ? 'invoices.show' : 'revenues.edit') : (!empty($item->document_id) ? 'bills.show' : 'payments.edit');
|
||||||
|
@endphp
|
||||||
|
<a href="{{ route($route, $id) }}" class="text-success">
|
||||||
@money($item->amount, $item->currency_code, true)
|
@money($item->amount, $item->currency_code, true)
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
@elseif(!is_null(data_get($item, 'invoice.id')))
|
|
||||||
<td class="col-xs-4 col-sm-2 col-md-2 text-right">
|
|
||||||
<a href="{{ route('invoices.show', $item->invoice->id) }}">
|
|
||||||
@money($item->amount, $item->currency_code, true)
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
@else
|
|
||||||
<td class="col-xs-4 col-sm-2 col-md-2 text-right">@money($item->amount, $item->currency_code, true)</td>
|
|
||||||
@endif
|
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
</tbody>
|
</tbody>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user