user landing page

This commit is contained in:
denisdulici
2020-01-21 11:59:52 +03:00
parent 61a6ea6687
commit 9f00e1a0d6
16 changed files with 99 additions and 38 deletions

View File

@ -112,7 +112,7 @@ class Login extends Controller
'error' => false,
'message' => null,
'data' => null,
'redirect' => redirect()->intended()->getTargetUrl(),
'redirect' => redirect()->intended($user->landing_page)->getTargetUrl(),
];
return response()->json($response);

View File

@ -35,13 +35,33 @@ class Users extends Controller
*/
public function create()
{
$routes = [
'dashboard' => trans_choice('general.dashboards', 1),
'items.index' => trans_choice('general.items', 2),
'invoices.index' => trans_choice('general.invoices', 2),
'revenues.index' => trans_choice('general.revenues', 2),
'customers.index' => trans_choice('general.customers', 2),
'bills.index' => trans_choice('general.bills', 2),
'payments.index' => trans_choice('general.payments', 2),
'vendors.index' => trans_choice('general.vendors', 2),
'accounts.index' => trans_choice('general.accounts', 2),
'transfers.index' => trans_choice('general.transfers', 2),
'transactions.index' => trans_choice('general.transactions', 2),
'reconciliations.index' => trans_choice('general.reconciliations', 2),
'reports.index' => trans_choice('general.reports', 2),
'settings.index' => trans_choice('general.settings', 2),
'categories.index' => trans_choice('general.categories', 2),
'currencies.index' => trans_choice('general.currencies', 2),
'taxes.index' => trans_choice('general.taxes', 2),
];
$roles = Role::all()->reject(function ($r) {
return $r->hasPermission('read-client-portal');
});
$companies = user()->companies()->get()->sortBy('name');
return view('auth.users.create', compact('roles', 'companies'));
return view('auth.users.create', compact('roles', 'companies', 'routes'));
}
/**
@ -81,6 +101,26 @@ class Users extends Controller
*/
public function edit(User $user)
{
$routes = [
'dashboard' => trans_choice('general.dashboards', 1),
'items.index' => trans_choice('general.items', 2),
'invoices.index' => trans_choice('general.invoices', 2),
'revenues.index' => trans_choice('general.revenues', 2),
'customers.index' => trans_choice('general.customers', 2),
'bills.index' => trans_choice('general.bills', 2),
'payments.index' => trans_choice('general.payments', 2),
'vendors.index' => trans_choice('general.vendors', 2),
'accounts.index' => trans_choice('general.accounts', 2),
'transfers.index' => trans_choice('general.transfers', 2),
'transactions.index' => trans_choice('general.transactions', 2),
'reconciliations.index' => trans_choice('general.reconciliations', 2),
'reports.index' => trans_choice('general.reports', 2),
'settings.index' => trans_choice('general.settings', 2),
'categories.index' => trans_choice('general.categories', 2),
'currencies.index' => trans_choice('general.currencies', 2),
'taxes.index' => trans_choice('general.taxes', 2),
];
if ($user->can('read-client-portal')) {
// Show only roles with customer permission
$roles = Role::all()->reject(function ($r) {
@ -95,7 +135,7 @@ class Users extends Controller
$companies = user()->companies()->get()->sortBy('name');
return view('auth.users.edit', compact('user', 'companies', 'roles'));
return view('auth.users.edit', compact('user', 'companies', 'roles', 'routes'));
}
/**

View File

@ -225,6 +225,6 @@ class Companies extends Controller
}
}
return redirect('/');
return redirect()->route('dashboard');
}
}

View File

@ -25,8 +25,8 @@ class Dashboards extends Controller
{
// Add CRUD permission check
$this->middleware('permission:create-common-dashboards')->only(['create', 'store', 'duplicate', 'import']);
$this->middleware('permission:read-common-dashboards')->only(['index', 'edit', 'export']);
$this->middleware('permission:update-common-dashboards')->only(['update', 'enable', 'disable', 'share']);
$this->middleware('permission:read-common-dashboards')->only(['show']);
$this->middleware('permission:update-common-dashboards')->only(['index', 'edit', 'export', 'update', 'enable', 'disable', 'share']);
$this->middleware('permission:delete-common-dashboards')->only('destroy');
}
@ -100,13 +100,13 @@ class Dashboards extends Controller
$response = $this->ajaxDispatch(new CreateDashboard($request));
if ($response['success']) {
$response['redirect'] = route('dashboard');
$response['redirect'] = route('dashboards.index');
$message = trans('messages.success.added', ['type' => trans_choice('general.dashboards', 1)]);
flash($message)->success();
} else {
$response['redirect'] = route('dashboard');
$response['redirect'] = route('dashboards.create');
$message = $response['message'];
@ -209,7 +209,7 @@ class Dashboards extends Controller
{
$response = $this->ajaxDispatch(new DeleteDashboard($dashboard));
$response['redirect'] = route('dashboard');
$response['redirect'] = route('dashboards.index');
if ($response['success']) {
$message = trans('messages.success.deleted', ['type' => $dashboard->name]);