mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Hide payment method page if none exist for client
This commit is contained in:
parent
a1224f56d1
commit
6a648ad2c9
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
namespace App\Http\ViewComposers;
|
namespace App\Http\ViewComposers;
|
||||||
|
|
||||||
use App\Models\Contact;
|
|
||||||
use DB;
|
use DB;
|
||||||
|
use App\Models\Contact;
|
||||||
use Illuminate\View\View;
|
use Illuminate\View\View;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -37,6 +37,7 @@ class ClientPortalHeaderComposer
|
|||||||
}
|
}
|
||||||
|
|
||||||
$client = $contact->client;
|
$client = $contact->client;
|
||||||
|
$account = $contact->account;
|
||||||
|
|
||||||
$hasDocuments = DB::table('invoices')
|
$hasDocuments = DB::table('invoices')
|
||||||
->where('invoices.client_id', '=', $client->id)
|
->where('invoices.client_id', '=', $client->id)
|
||||||
@ -44,8 +45,18 @@ class ClientPortalHeaderComposer
|
|||||||
->join('documents', 'documents.invoice_id', '=', 'invoices.id')
|
->join('documents', 'documents.invoice_id', '=', 'invoices.id')
|
||||||
->count();
|
->count();
|
||||||
|
|
||||||
|
$hasPaymentMethods = false;
|
||||||
|
if ($account->getTokenGatewayId() && ! $account->enable_client_portal_dashboard) {
|
||||||
|
$hasPaymentMethods = DB::table('payment_methods')
|
||||||
|
->where('contacts.client_id', '=', $client->id)
|
||||||
|
->whereNull('payment_methods.deleted_at')
|
||||||
|
->join('contacts', 'contacts.id', '=', 'payment_methods.contact_id')
|
||||||
|
->count();
|
||||||
|
}
|
||||||
|
|
||||||
$view->with('hasQuotes', $client->publicQuotes->count());
|
$view->with('hasQuotes', $client->publicQuotes->count());
|
||||||
$view->with('hasCredits', $client->creditsWithBalance->count());
|
$view->with('hasCredits', $client->creditsWithBalance->count());
|
||||||
$view->with('hasDocuments', $hasDocuments);
|
$view->with('hasDocuments', $hasDocuments);
|
||||||
|
$view->with('hasPaymentMethods', $hasPaymentMethods);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,7 @@
|
|||||||
{!! link_to('/client/documents', trans('texts.documents') ) !!}
|
{!! link_to('/client/documents', trans('texts.documents') ) !!}
|
||||||
</li>
|
</li>
|
||||||
@endif
|
@endif
|
||||||
@if (isset($account) && $account->getTokenGatewayId() && !$account->enable_client_portal_dashboard)
|
@if (isset($hasPaymentMethods) && $hasPaymentMethods)
|
||||||
<li {!! Request::is('*client/payment_methods') ? 'class="active"' : '' !!}>
|
<li {!! Request::is('*client/payment_methods') ? 'class="active"' : '' !!}>
|
||||||
{!! link_to('/client/payment_methods', trans('texts.payment_methods') ) !!}
|
{!! link_to('/client/payment_methods', trans('texts.payment_methods') ) !!}
|
||||||
</li>
|
</li>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user