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