Simplify new company process

This commit is contained in:
Hillel Coren 2016-12-29 22:24:11 +02:00
parent e313a32c6a
commit 152b8770f5
6 changed files with 19 additions and 7 deletions

View File

@ -141,6 +141,7 @@ class AuthController extends Controller
if (Auth::check()) {
Event::fire(new UserLoggedIn());
/*
$users = false;
// we're linking a new account
if ($request->link_accounts && $userId && Auth::user()->id != $userId) {
@ -150,6 +151,9 @@ class AuthController extends Controller
} else {
$users = $this->accountRepo->loadAccounts(Auth::user()->id);
}
*/
$users = $this->accountRepo->loadAccounts(Auth::user()->id);
Session::put(SESSION_USER_ACCOUNTS, $users);
} elseif ($user) {

View File

@ -356,7 +356,7 @@ class UserController extends BaseController
Session::put(SESSION_USER_ACCOUNTS, $users);
Session::flash('message', trans('texts.unlinked_account'));
return Redirect::to('/dashboard');
return Redirect::to('/manage_companies');
}
public function manageCompanies()

View File

@ -594,6 +594,9 @@ class AccountRepository
$record->save();
return $this->getUserAccounts($record);
/*
$users = $this->getUserAccounts($record);
// Pick the primary user
@ -649,6 +652,7 @@ class AccountRepository
}
return $users;
*/
}
public function unlinkAccount($account) {

View File

@ -2290,6 +2290,7 @@ $LANG = array(
'renew_license' => 'Renew License',
'iphone_app_message' => 'Consider downloading our :link',
'iphone_app' => 'iPhone app',
'logged_in' => 'Logged In',
);

View File

@ -432,7 +432,7 @@
@if (count(session(SESSION_USER_ACCOUNTS)) > 1)
<li>{!! link_to('/manage_companies', trans('texts.manage_companies')) !!}</li>
@elseif (!session(SESSION_USER_ACCOUNTS) || count(session(SESSION_USER_ACCOUNTS)) < 5)
<li>{!! link_to('/login?new_company=true', trans('texts.add_company')) !!}</li>
<li>{!! link_to('/invoice_now?new_company=true&sign_up=true', trans('texts.add_company')) !!}</li>
@endif
@endif
<li>{!! link_to('#', trans('texts.logout'), array('onclick'=>'logout()')) !!}</li>

View File

@ -5,7 +5,7 @@
<center>
@if (!session(SESSION_USER_ACCOUNTS) || count(session(SESSION_USER_ACCOUNTS)) < 5)
{!! Button::success(trans('texts.add_company'))->asLinkTo(url('/login?new_company=true')) !!}
{!! Button::success(trans('texts.add_company'))->asLinkTo(url('/invoice_now?new_company=true&sign_up=true')) !!}
@endif
</center>
@ -31,12 +31,15 @@
<td>
<h3>{{ $account->account_name }}<br/>
<small>{{ $account->user_name }}
@if ($account->user_id == Auth::user()->id)
| {{ trans('texts.current_user')}}
@endif
</small></h3>
</td>
<td>{!! Button::primary(trans('texts.unlink'))->withAttributes(['onclick'=>"return showUnlink({$account->id}, {$account->user_id})"]) !!}</td>
<td>
@if ($account->user_id == Auth::user()->id)
<b>{{ trans('texts.logged_in')}}</b>
@else
{!! Button::primary(trans('texts.unlink'))->withAttributes(['onclick'=>"return showUnlink({$account->id}, {$account->user_id})"]) !!}
@endif
</td>
</tr>
@endforeach
</table>