From 2b7b9f83e4af909806b2233ec04ae0cbff9dbd62 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Mon, 14 May 2018 09:45:35 +0300 Subject: [PATCH] Fix client overview portal link w/iframe --- app/Models/Contact.php | 9 ++++++++- routes/web.php | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/Models/Contact.php b/app/Models/Contact.php index 4a73944549..8f66e56d42 100644 --- a/app/Models/Contact.php +++ b/app/Models/Contact.php @@ -183,6 +183,7 @@ class Contact extends EntityModel implements AuthenticatableContract, CanResetPa } $account = $this->account; + $iframe_url = $account->iframe_url; $url = trim(SITE_URL, '/'); if ($account->hasFeature(FEATURE_CUSTOM_URL)) { @@ -190,7 +191,13 @@ class Contact extends EntityModel implements AuthenticatableContract, CanResetPa $url = $account->present()->clientPortalLink(); } - if ($this->account->subdomain) { + if ($iframe_url) { + if ($account->is_custom_domain) { + $url = $iframe_url; + } else { + return "{$iframe_url}?{$this->contact_key}/client"; + } + } elseif ($this->account->subdomain) { $url = Utils::replaceSubdomain($url, $account->subdomain); } } diff --git a/routes/web.php b/routes/web.php index 969dbc7acc..c0ba027eee 100644 --- a/routes/web.php +++ b/routes/web.php @@ -46,6 +46,7 @@ Route::group(['middleware' => ['lookup:contact', 'auth:client']], function () { Route::get('client/documents/js/{documents}/{filename}', 'ClientPortalController@getDocumentVFSJS'); Route::get('client/documents/{invitation_key}/{documents}/{filename?}', 'ClientPortalController@getDocument'); Route::get('client/documents/{invitation_key}/{filename?}', 'ClientPortalController@getInvoiceDocumentsZip'); + Route::get('client/{contact_key?}', 'ClientPortalController@dashboard'); Route::get('api/client.quotes', ['as' => 'api.client.quotes', 'uses' => 'ClientPortalController@quoteDatatable']); Route::get('api/client.credits', ['as' => 'api.client.credits', 'uses' => 'ClientPortalController@creditDatatable']);