diff --git a/app/Http/Controllers/ClientController.php b/app/Http/Controllers/ClientController.php index 52b2568eb6a0..bdf7bcc7cb39 100644 --- a/app/Http/Controllers/ClientController.php +++ b/app/Http/Controllers/ClientController.php @@ -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, ]; diff --git a/resources/views/clients/show.blade.php b/resources/views/clients/show.blade.php index dc1373276fd7..1b8f2132b9f1 100644 --- a/resources/views/clients/show.blade.php +++ b/resources/views/clients/show.blade.php @@ -235,10 +235,13 @@