mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-09 20:52:56 +01:00
Add expenses tab to client overview
This commit is contained in:
parent
552b72a4bc
commit
06ba3d743c
@ -11,6 +11,7 @@ use App\Models\Account;
|
||||
use App\Models\Client;
|
||||
use App\Models\Credit;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\Expense;
|
||||
use App\Models\Task;
|
||||
use App\Ninja\Datatables\ClientDatatable;
|
||||
use App\Ninja\Repositories\ClientRepository;
|
||||
@ -86,6 +87,7 @@ class ClientController extends BaseController
|
||||
{
|
||||
$client = $request->entity();
|
||||
$user = Auth::user();
|
||||
$account = $user->account;
|
||||
|
||||
$actionLinks = [];
|
||||
if ($user->can('create', ENTITY_INVOICE)) {
|
||||
@ -120,14 +122,16 @@ class ClientController extends BaseController
|
||||
$token = $client->getGatewayToken();
|
||||
|
||||
$data = [
|
||||
'account' => $account,
|
||||
'actionLinks' => $actionLinks,
|
||||
'showBreadcrumbs' => false,
|
||||
'client' => $client,
|
||||
'credit' => $client->getTotalCredit(),
|
||||
'title' => trans('texts.view_client'),
|
||||
'hasRecurringInvoices' => Invoice::scope()->recurring()->withArchived()->whereClientId($client->id)->count() > 0,
|
||||
'hasQuotes' => Invoice::scope()->quotes()->withArchived()->whereClientId($client->id)->count() > 0,
|
||||
'hasTasks' => Task::scope()->withArchived()->whereClientId($client->id)->count() > 0,
|
||||
'hasRecurringInvoices' => $account->isModuleEnabled(ENTITY_RECURRING_INVOICE) && Invoice::scope()->recurring()->withArchived()->whereClientId($client->id)->count() > 0,
|
||||
'hasQuotes' => $account->isModuleEnabled(ENTITY_QUOTE) && Invoice::scope()->quotes()->withArchived()->whereClientId($client->id)->count() > 0,
|
||||
'hasTasks' => $account->isModuleEnabled(ENTITY_TASK) && Task::scope()->withArchived()->whereClientId($client->id)->count() > 0,
|
||||
'hasExpenses' => $account->isModuleEnabled(ENTITY_EXPENSE) && Expense::scope()->withArchived()->whereClientId($client->id)->count() > 0,
|
||||
'gatewayLink' => $token ? $token->gatewayLink() : false,
|
||||
'gatewayName' => $token ? $token->gatewayName() : false,
|
||||
];
|
||||
|
@ -235,10 +235,13 @@
|
||||
|
||||
<ul class="nav nav-tabs nav-justified">
|
||||
{!! Form::tab_link('#activity', trans('texts.activity'), true) !!}
|
||||
@if ($hasTasks && Utils::isPro())
|
||||
@if ($hasTasks)
|
||||
{!! Form::tab_link('#tasks', trans('texts.tasks')) !!}
|
||||
@endif
|
||||
@if ($hasQuotes && Utils::isPro())
|
||||
@if ($hasExpenses)
|
||||
{!! Form::tab_link('#expenses', trans('texts.expenses')) !!}
|
||||
@endif
|
||||
@if ($hasQuotes)
|
||||
{!! Form::tab_link('#quotes', trans('texts.quotes')) !!}
|
||||
@endif
|
||||
@if ($hasRecurringInvoices)
|
||||
@ -246,7 +249,9 @@
|
||||
@endif
|
||||
{!! Form::tab_link('#invoices', trans('texts.invoices')) !!}
|
||||
{!! Form::tab_link('#payments', trans('texts.payments')) !!}
|
||||
{!! Form::tab_link('#credits', trans('texts.credits')) !!}
|
||||
@if ($account->isModuleEnabled(ENTITY_CREDIT))
|
||||
{!! Form::tab_link('#credits', trans('texts.credits')) !!}
|
||||
@endif
|
||||
</ul><br/>
|
||||
|
||||
<div class="tab-content">
|
||||
@ -278,6 +283,15 @@
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if ($hasExpenses)
|
||||
<div class="tab-pane" id="expenses">
|
||||
@include('list', [
|
||||
'entityType' => ENTITY_EXPENSE,
|
||||
'datatable' => new \App\Ninja\Datatables\ExpenseDatatable(true, true),
|
||||
'clientId' => $client->public_id,
|
||||
])
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if (Utils::hasFeature(FEATURE_QUOTES) && $hasQuotes)
|
||||
<div class="tab-pane" id="quotes">
|
||||
@ -315,6 +329,7 @@
|
||||
])
|
||||
</div>
|
||||
|
||||
@if ($account->isModuleEnabled(ENTITY_CREDIT))
|
||||
<div class="tab-pane" id="credits">
|
||||
@include('list', [
|
||||
'entityType' => ENTITY_CREDIT,
|
||||
@ -322,6 +337,7 @@
|
||||
'clientId' => $client->public_id,
|
||||
])
|
||||
</div>
|
||||
@endif
|
||||
|
||||
</div>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user