fixed accounts show page
This commit is contained in:
parent
3b8cdeb5ca
commit
c7731bfd9b
@ -10,9 +10,9 @@ use App\Jobs\Banking\UpdateAccount;
|
|||||||
use App\Models\Banking\Account;
|
use App\Models\Banking\Account;
|
||||||
use App\Models\Banking\Transaction;
|
use App\Models\Banking\Transaction;
|
||||||
use App\Models\Banking\Transfer;
|
use App\Models\Banking\Transfer;
|
||||||
use App\Utilities\Reports as Utility;
|
use App\Utilities\Date;
|
||||||
|
use App\Utilities\Reports;
|
||||||
use App\Models\Setting\Currency;
|
use App\Models\Setting\Currency;
|
||||||
use Date;
|
|
||||||
|
|
||||||
class Accounts extends Controller
|
class Accounts extends Controller
|
||||||
{
|
{
|
||||||
@ -35,11 +35,10 @@ class Accounts extends Controller
|
|||||||
*/
|
*/
|
||||||
public function show(Account $account)
|
public function show(Account $account)
|
||||||
{
|
{
|
||||||
// Handle transactions
|
$transactions = Transaction::with('category', 'contact', 'document')->where('account_id', $account->id)->collect(['paid_at'=> 'desc']);
|
||||||
$transactions = Transaction::with('account', 'category')->where('account_id', $account->id)->collect('paid_at');
|
|
||||||
|
|
||||||
$transfers = Transfer::with('expense_transaction', 'income_transaction')->get()->filter(function ($transfer) use($account) {
|
$transfers = Transfer::with('expense_transaction', 'expense_transaction.account', 'income_transaction', 'income_transaction.account')->get()->filter(function ($transfer) use($account) {
|
||||||
if ($transfer->expense_account->id == $account->id || $transfer->income_account->id == $account->id) {
|
if (($transfer->expense_transaction->account->id == $account->id) || ($transfer->income_transaction->account->id == $account->id)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -248,7 +247,7 @@ class Accounts extends Controller
|
|||||||
'account_id' => $account->id,
|
'account_id' => $account->id,
|
||||||
];
|
];
|
||||||
|
|
||||||
$report = Utility::getClassInstance('App\Reports\IncomeExpenseSummary');
|
$report = Reports::getClassInstance('App\Reports\IncomeExpenseSummary');
|
||||||
|
|
||||||
if (empty($report) || empty($report->model)) {
|
if (empty($report) || empty($report->model)) {
|
||||||
$message = trans('accounts.create_report');
|
$message = trans('accounts.create_report');
|
||||||
|
@ -225,7 +225,7 @@
|
|||||||
<x-table>
|
<x-table>
|
||||||
<x-table.thead>
|
<x-table.thead>
|
||||||
<x-table.tr class="flex items-center px-1">
|
<x-table.tr class="flex items-center px-1">
|
||||||
<x-table.th class="w-4/12 sm:w-3/12">
|
<x-table.th class="w-3/12">
|
||||||
<x-slot name="first">
|
<x-slot name="first">
|
||||||
<x-sortablelink column="paid_at" title="{{ trans('general.date') }}" />
|
<x-sortablelink column="paid_at" title="{{ trans('general.date') }}" />
|
||||||
</x-slot>
|
</x-slot>
|
||||||
@ -243,11 +243,7 @@
|
|||||||
</x-slot>
|
</x-slot>
|
||||||
</x-table.th>
|
</x-table.th>
|
||||||
|
|
||||||
<x-table.th class="w-4/12 sm:w-2/12">
|
<x-table.th class="w-3/12 hidden sm:table-cell">
|
||||||
<x-sortablelink column="account.name" title="{{ trans_choice('general.accounts', 1) }}" />
|
|
||||||
</x-table.th>
|
|
||||||
|
|
||||||
<x-table.th class="w-2/12 hidden sm:table-cell">
|
|
||||||
<x-slot name="first">
|
<x-slot name="first">
|
||||||
<x-sortablelink column="contact.name" title="{{ trans_choice('general.contacts', 1) }}" />
|
<x-sortablelink column="contact.name" title="{{ trans_choice('general.contacts', 1) }}" />
|
||||||
</x-slot>
|
</x-slot>
|
||||||
@ -256,7 +252,7 @@
|
|||||||
</x-slot>
|
</x-slot>
|
||||||
</x-table.th>
|
</x-table.th>
|
||||||
|
|
||||||
<x-table.th class="w-4/12 sm:w-2/12" kind="amount">
|
<x-table.th class="w-3/12" kind="amount">
|
||||||
<x-sortablelink column="amount" title="{{ trans('general.amount') }}" />
|
<x-sortablelink column="amount" title="{{ trans('general.amount') }}" />
|
||||||
</x-table.th>
|
</x-table.th>
|
||||||
</x-table.tr>
|
</x-table.tr>
|
||||||
@ -265,7 +261,7 @@
|
|||||||
<x-table.tbody>
|
<x-table.tbody>
|
||||||
@foreach($transactions as $item)
|
@foreach($transactions as $item)
|
||||||
<x-table.tr href="{{ route('transactions.show', $item->id) }}">
|
<x-table.tr href="{{ route('transactions.show', $item->id) }}">
|
||||||
<x-table.td class="w-4/12 sm:w-3/12">
|
<x-table.td class="w-3/12">
|
||||||
<x-slot name="first" class="font-bold truncate" override="class">
|
<x-slot name="first" class="font-bold truncate" override="class">
|
||||||
<x-date date="{{ $item->paid_at }}" />
|
<x-date date="{{ $item->paid_at }}" />
|
||||||
</x-slot>
|
</x-slot>
|
||||||
@ -283,11 +279,7 @@
|
|||||||
</x-slot>
|
</x-slot>
|
||||||
</x-table.td>
|
</x-table.td>
|
||||||
|
|
||||||
<x-table.td class="w-4/12 sm:w-2/12">
|
<x-table.td class="w-3/12 hidden sm:table-cell">
|
||||||
{{ $item->account->name }}
|
|
||||||
</x-table.td>
|
|
||||||
|
|
||||||
<x-table.td class="w-2/12 hidden sm:table-cell">
|
|
||||||
<x-slot name="first">
|
<x-slot name="first">
|
||||||
{{ $item->contact->name }}
|
{{ $item->contact->name }}
|
||||||
</x-slot>
|
</x-slot>
|
||||||
@ -308,7 +300,7 @@
|
|||||||
</x-slot>
|
</x-slot>
|
||||||
</x-table.td>
|
</x-table.td>
|
||||||
|
|
||||||
<x-table.td class="relative w-4/12 sm:w-2/12" kind="amount">
|
<x-table.td class="w-3/12 relative" kind="amount">
|
||||||
<x-money :amount="$item->amount" :currency="$item->currency_code" convert />
|
<x-money :amount="$item->amount" :currency="$item->currency_code" convert />
|
||||||
</x-table.td>
|
</x-table.td>
|
||||||
|
|
||||||
@ -333,10 +325,6 @@
|
|||||||
<x-table>
|
<x-table>
|
||||||
<x-table.thead>
|
<x-table.thead>
|
||||||
<x-table.tr class="flex items-center px-1">
|
<x-table.tr class="flex items-center px-1">
|
||||||
<x-table.th class="ltr:pr-6 rtl:pl-6 hidden sm:table-cell" override="class">
|
|
||||||
<x-index.bulkaction.all />
|
|
||||||
</x-table.th>
|
|
||||||
|
|
||||||
<x-table.th class="w-3/12 hidden sm:table-cell">
|
<x-table.th class="w-3/12 hidden sm:table-cell">
|
||||||
<x-slot name="first">
|
<x-slot name="first">
|
||||||
<x-sortablelink column="expense_transaction.paid_at" title="{{ trans('general.created_date') }}" />
|
<x-sortablelink column="expense_transaction.paid_at" title="{{ trans('general.created_date') }}" />
|
||||||
@ -346,7 +334,7 @@
|
|||||||
</x-slot>
|
</x-slot>
|
||||||
</x-table.th>
|
</x-table.th>
|
||||||
|
|
||||||
<x-table.th class="w-4/12 sm:w-3/12">
|
<x-table.th class="w-3/12">
|
||||||
<x-slot name="first">
|
<x-slot name="first">
|
||||||
<x-sortablelink column="expense_transaction.name" title="{{ trans('transfers.from_account') }}" />
|
<x-sortablelink column="expense_transaction.name" title="{{ trans('transfers.from_account') }}" />
|
||||||
</x-slot>
|
</x-slot>
|
||||||
@ -355,7 +343,7 @@
|
|||||||
</x-slot>
|
</x-slot>
|
||||||
</x-table.th>
|
</x-table.th>
|
||||||
|
|
||||||
<x-table.th class="w-4/12 sm:w-3/12">
|
<x-table.th class="w-3/12">
|
||||||
<x-slot name="first">
|
<x-slot name="first">
|
||||||
<x-sortablelink column="expense_transaction.rate" title="{{ trans('transfers.from_rate') }}" />
|
<x-sortablelink column="expense_transaction.rate" title="{{ trans('transfers.from_rate') }}" />
|
||||||
</x-slot>
|
</x-slot>
|
||||||
@ -364,7 +352,7 @@
|
|||||||
</x-slot>
|
</x-slot>
|
||||||
</x-table.th>
|
</x-table.th>
|
||||||
|
|
||||||
<x-table.th class="w-4/12 sm:w-3/12" kind="amount">
|
<x-table.th class="w-3/12" kind="amount">
|
||||||
<x-slot name="first">
|
<x-slot name="first">
|
||||||
<x-sortablelink column="expense_transaction.amount" title="{{ trans('transfers.from_amount') }}" />
|
<x-sortablelink column="expense_transaction.amount" title="{{ trans('transfers.from_amount') }}" />
|
||||||
</x-slot>
|
</x-slot>
|
||||||
@ -386,10 +374,6 @@
|
|||||||
@endphp
|
@endphp
|
||||||
|
|
||||||
<x-table.tr href="{{ route('transfers.show', $item->id) }}">
|
<x-table.tr href="{{ route('transfers.show', $item->id) }}">
|
||||||
<x-table.td class="ltr:pr-6 rtl:pl-6 hidden sm:table-cell" override="class">
|
|
||||||
<x-index.bulkaction.single id="{{ $item->id }}" name="{{ $item->expense_transaction->account->name }}" />
|
|
||||||
</x-table.td>
|
|
||||||
|
|
||||||
<x-table.td class="w-3/12 truncate hidden sm:table-cell">
|
<x-table.td class="w-3/12 truncate hidden sm:table-cell">
|
||||||
<x-slot name="first" class="flex items-center font-bold" override="class">
|
<x-slot name="first" class="flex items-center font-bold" override="class">
|
||||||
<x-date date="{{ $item->expense_transaction->paid_at }}" />
|
<x-date date="{{ $item->expense_transaction->paid_at }}" />
|
||||||
@ -403,7 +387,7 @@
|
|||||||
</x-slot>
|
</x-slot>
|
||||||
</x-table.td>
|
</x-table.td>
|
||||||
|
|
||||||
<x-table.td class="w-4/12 sm:w-3/12 truncate">
|
<x-table.td class="w-3/12 truncate">
|
||||||
<x-slot name="first">
|
<x-slot name="first">
|
||||||
{{ $item->expense_transaction->account->name }}
|
{{ $item->expense_transaction->account->name }}
|
||||||
</x-slot>
|
</x-slot>
|
||||||
@ -412,7 +396,7 @@
|
|||||||
</x-slot>
|
</x-slot>
|
||||||
</x-table.td>
|
</x-table.td>
|
||||||
|
|
||||||
<x-table.td class="w-4/12 sm:w-3/12 truncate">
|
<x-table.td class="w-3/12 truncate">
|
||||||
<x-slot name="first">
|
<x-slot name="first">
|
||||||
{{ $item->expense_transaction->currency_rate }}
|
{{ $item->expense_transaction->currency_rate }}
|
||||||
</x-slot>
|
</x-slot>
|
||||||
@ -421,7 +405,7 @@
|
|||||||
</x-slot>
|
</x-slot>
|
||||||
</x-table.td>
|
</x-table.td>
|
||||||
|
|
||||||
<x-table.td class="w-4/12 sm:w-3/12" kind="amount">
|
<x-table.td class="w-3/12" kind="amount">
|
||||||
<x-slot name="first">
|
<x-slot name="first">
|
||||||
<x-money :amount="$item->expense_transaction->amount" :currency="$item->expense_transaction->currency_code" convert />
|
<x-money :amount="$item->expense_transaction->amount" :currency="$item->expense_transaction->currency_code" convert />
|
||||||
</x-slot>
|
</x-slot>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user