diff --git a/app/Abstracts/Http/Controller.php b/app/Abstracts/Http/Controller.php
index 78fa45f3b..779868b1b 100644
--- a/app/Abstracts/Http/Controller.php
+++ b/app/Abstracts/Http/Controller.php
@@ -58,7 +58,7 @@ abstract class Controller extends BaseController
$controller .= Str::kebab($arr[0]);
// Skip ACL
- $skip = ['common-dashboard', 'portal-dashboard'];
+ $skip = ['portal-dashboard'];
if (in_array($controller, $skip)) {
return;
}
diff --git a/app/BulkActions/Common/Dashboards.php b/app/BulkActions/Common/Dashboards.php
new file mode 100644
index 000000000..472ba7f79
--- /dev/null
+++ b/app/BulkActions/Common/Dashboards.php
@@ -0,0 +1,70 @@
+ [
+ 'name' => 'general.enable',
+ 'message' => 'bulk_actions.message.enable',
+ 'permission' => 'update-common-dashboards',
+ ],
+ 'disable' => [
+ 'name' => 'general.disable',
+ 'message' => 'bulk_actions.message.disable',
+ 'permission' => 'update-common-dashboards',
+ ],
+ 'delete' => [
+ 'name' => 'general.delete',
+ 'message' => 'bulk_actions.message.delete',
+ 'permission' => 'delete-common-dashboards',
+ ],
+ ];
+
+ public function enable($request)
+ {
+ $dashboards = $this->getSelectedRecords($request);
+
+ foreach ($dashboards as $dashboard) {
+ try {
+ $this->dispatch(new UpdateDashboard($dashboard, $request->merge(['enabled' => 1])));
+ } catch (\Exception $e) {
+ flash($e->getMessage())->error();
+ }
+ }
+ }
+
+ public function disable($request)
+ {
+ $dashboards = $this->getSelectedRecords($request);
+
+ foreach ($dashboards as $dashboard) {
+ try {
+ $this->dispatch(new UpdateDashboard($dashboard, $request->merge(['enabled' => 0])));
+ } catch (\Exception $e) {
+ flash($e->getMessage())->error();
+ }
+ }
+ }
+
+ public function destroy($request)
+ {
+ $dashboards = $this->getSelectedRecords($request);
+
+ foreach ($dashboards as $dashboard) {
+ try {
+ $this->dispatch(new DeleteDashboard($dashboard));
+ } catch (\Exception $e) {
+ flash($e->getMessage())->error();
+ }
+ }
+ }
+}
diff --git a/app/Http/Controllers/Common/Dashboard.php b/app/Http/Controllers/Common/Dashboard.php
deleted file mode 100644
index bdf00ac3d..000000000
--- a/app/Http/Controllers/Common/Dashboard.php
+++ /dev/null
@@ -1,117 +0,0 @@
-get('dashboard_id', 0)) {
- $dashboard_id = request()->get('dashboard_id');
-
- session(['dashboard_id' => $dashboard_id]);
- }
-
- $dashboards = Model::where('user_id', user()->id)->enabled()->get();
-
- if (!$dashboard_id) {
- $dashboard_id = $dashboards->pluck('id')->first();
- }
-
- // Dashboard
- $dashboard = Model::find($dashboard_id);
-
- // Widgets
- $widgets = Widget::where('dashboard_id', $dashboard->id)->orderBy('sort', 'asc')->get()->filter(function ($widget) {
- return WidgetUtility::canRead($widget->class);
- });
-
- $financial_start = $this->getFinancialStart()->format('Y-m-d');
-
- return view('common.dashboard.index', compact('dashboards', 'dashboard', 'widgets', 'financial_start'));
- }
-
- /**
- * Store a newly created resource in storage.
- *
- * @param $request
- * @return Response
- */
- public function store(Request $request)
- {
- $request['enabled'] = 1;
- $request['user_id'] = user()->id;
-
- $dashboard = Model::create($request->input());
-
- $response['data'] = $dashboard;
- $response['redirect'] = route('dashboard');
-
- return response()->json($response);
- }
-
- /**
- * Show the form for editing the specified resource.
- *
- * @param Model $dashboard
- *
- * @return Response
- */
- public function edit(Model $dashboard)
- {
- return response()->json($dashboard);
- }
-
- /**
- * Update the specified resource in storage.
- *
- * @param Model $dashboard
- * @param $request
- * @return Response
- */
- public function update(Model $dashboard, Request $request)
- {
- $request['enabled'] = 1;
- $dashboard->update($request->input());
-
- $response['data'] = $dashboard;
- $response['redirect'] = route('dashboard');
-
- return response()->json($response);
- }
-
- /**
- * Remove the specified resource from storage.
- *
- * @param Model $dashboard
- *
- * @return Response
- */
- public function destroy(Model $dashboard)
- {
- $dashboard->delete();
-
- session(['dashboard_id' => user()->dashboards()->pluck('id')->first()]);
-
- $response['redirect'] = route('dashboard');
-
- return response()->json($response);
- }
-}
diff --git a/app/Http/Controllers/Common/Dashboards.php b/app/Http/Controllers/Common/Dashboards.php
new file mode 100644
index 000000000..56c38ea3c
--- /dev/null
+++ b/app/Http/Controllers/Common/Dashboards.php
@@ -0,0 +1,244 @@
+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:delete-common-dashboards')->only('destroy');
+ }
+
+ /**
+ * Display a listing of the resource.
+ *
+ * @return Response
+ */
+ public function index()
+ {
+ $dashboards = user()->dashboards()->collect();
+
+ return view('common.dashboards.index', compact('dashboards'));
+ }
+
+ /**
+ * Show the form for viewing the specified resource.
+ *
+ * @return Response
+ */
+ public function show()
+ {
+ $dashboard_id = session('dashboard_id', 0);
+
+ // Change Dashboard
+ if (request()->get('dashboard_id', 0)) {
+ $dashboard_id = request()->get('dashboard_id');
+
+ session(['dashboard_id' => $dashboard_id]);
+ }
+
+ $dashboards = user()->dashboards()->enabled()->get();
+
+ if (!$dashboard_id) {
+ $dashboard_id = $dashboards->pluck('id')->first();
+ }
+
+ // Dashboard
+ $dashboard = Dashboard::find($dashboard_id);
+
+ // Widgets
+ $widgets = Widget::where('dashboard_id', $dashboard->id)->orderBy('sort', 'asc')->get()->filter(function ($widget) {
+ return Widgets::canRead($widget->class);
+ });
+
+ $financial_start = $this->getFinancialStart()->format('Y-m-d');
+
+ return view('common.dashboards.show', compact('dashboards', 'dashboard', 'widgets', 'financial_start'));
+ }
+
+ /**
+ * Show the form for creating a new resource.
+ *
+ * @return Response
+ */
+ public function create()
+ {
+ $users = Company::find(session('company_id'))->users()->get()->sortBy('name');
+
+ return view('common.dashboards.create', compact('users'));
+ }
+
+ /**
+ * Store a newly created resource in storage.
+ *
+ * @param $request
+ * @return Response
+ */
+ public function store(Request $request)
+ {
+ $response = $this->ajaxDispatch(new CreateDashboard($request));
+
+ if ($response['success']) {
+ $response['redirect'] = route('dashboard');
+
+ $message = trans('messages.success.added', ['type' => trans_choice('general.dashboards', 1)]);
+
+ flash($message)->success();
+ } else {
+ $response['redirect'] = route('dashboard');
+
+ $message = $response['message'];
+
+ flash($message)->error();
+ }
+
+ return response()->json($response);
+ }
+
+ /**
+ * Show the form for editing the specified resource.
+ *
+ * @param Dashboard $dashboard
+ *
+ * @return Response
+ */
+ public function edit(Dashboard $dashboard)
+ {
+ if (!$this->isUserDashboard($dashboard->id)) {
+ return redirect()->route('dashboards.index');
+ }
+
+ $users = Company::find(session('company_id'))->users()->get()->sortBy('name');
+
+ return view('common.dashboards.edit', compact('dashboard', 'users'));
+ }
+
+ /**
+ * Update the specified resource in storage.
+ *
+ * @param Dashboard $dashboard
+ * @param $request
+ * @return Response
+ */
+ public function update(Dashboard $dashboard, Request $request)
+ {
+ $response = $this->ajaxDispatch(new UpdateDashboard($dashboard, $request));
+
+ if ($response['success']) {
+ $response['redirect'] = route('dashboards.index');
+
+ $message = trans('messages.success.updated', ['type' => trans_choice('general.dashboards', 1)]);
+
+ flash($message)->success();
+ } else {
+ $response['redirect'] = route('dashboards.edit', $dashboard->id);
+
+ $message = $response['message'];
+
+ flash($message)->error();
+ }
+
+ return response()->json($response);
+ }
+
+ /**
+ * Enable the specified resource.
+ *
+ * @param Dashboard $dashboard
+ *
+ * @return Response
+ */
+ public function enable(Dashboard $dashboard)
+ {
+ $response = $this->ajaxDispatch(new UpdateDashboard($dashboard, request()->merge(['enabled' => 1])));
+
+ if ($response['success']) {
+ $response['message'] = trans('messages.success.enabled', ['type' => trans_choice('general.dashboards', 1)]);
+ }
+
+ return response()->json($response);
+ }
+
+ /**
+ * Disable the specified resource.
+ *
+ * @param Dashboard $dashboard
+ *
+ * @return Response
+ */
+ public function disable(Dashboard $dashboard)
+ {
+ $response = $this->ajaxDispatch(new UpdateDashboard($dashboard, request()->merge(['enabled' => 0])));
+
+ if ($response['success']) {
+ $response['message'] = trans('messages.success.disabled', ['type' => trans_choice('general.dashboards', 1)]);
+ }
+
+ return response()->json($response);
+ }
+
+ /**
+ * Remove the specified resource from storage.
+ *
+ * @param Dashboard $dashboard
+ *
+ * @return Response
+ */
+ public function destroy(Dashboard $dashboard)
+ {
+ $response = $this->ajaxDispatch(new DeleteDashboard($dashboard));
+
+ $response['redirect'] = route('dashboard');
+
+ if ($response['success']) {
+ $message = trans('messages.success.deleted', ['type' => $dashboard->name]);
+
+ flash($message)->success();
+
+ session(['dashboard_id' => user()->dashboards()->pluck('id')->first()]);
+ } else {
+ $message = $response['message'];
+
+ flash($message)->error();
+ }
+
+ return response()->json($response);
+ }
+
+ /**
+ * Change the active dashboard.
+ *
+ * @param Dashboard $dashboard
+ *
+ * @return Response
+ */
+ public function switch(Dashboard $dashboard)
+ {
+ if ($this->isUserDashboard($dashboard->id)) {
+ session(['dashboard_id' => $dashboard->id]);
+ }
+
+ return redirect()->route('dashboard');
+ }
+}
diff --git a/app/Jobs/Auth/CreateUser.php b/app/Jobs/Auth/CreateUser.php
index 551d1de9e..239d0a8f2 100644
--- a/app/Jobs/Auth/CreateUser.php
+++ b/app/Jobs/Auth/CreateUser.php
@@ -29,10 +29,6 @@ class CreateUser extends Job
{
$user = User::create($this->request->input());
- if ($this->request->has('permissions')) {
- $user->permissions()->attach($this->request->get('permissions'));
- }
-
// Upload picture
if ($this->request->file('picture')) {
$media = $this->getMedia($this->request->file('picture'), 'users');
@@ -40,10 +36,16 @@ class CreateUser extends Job
$user->attachMedia($media, 'picture');
}
- // Attach roles
+ if ($this->request->has('dashboards')) {
+ $user->dashboards()->attach($this->request->get('dashboards'));
+ }
+
+ if ($this->request->has('permissions')) {
+ $user->permissions()->attach($this->request->get('permissions'));
+ }
+
$user->roles()->attach($this->request->get('roles'));
- // Attach companies
$user->companies()->attach($this->request->get('companies'));
Artisan::call('cache:clear');
diff --git a/app/Jobs/Auth/DeleteUser.php b/app/Jobs/Auth/DeleteUser.php
index de0ef9ea5..e060ed585 100644
--- a/app/Jobs/Auth/DeleteUser.php
+++ b/app/Jobs/Auth/DeleteUser.php
@@ -28,8 +28,6 @@ class DeleteUser extends Job
{
$this->authorize();
- $this->deleteRelationships($this->user, ['widgets', 'dashboards']);
-
$this->user->delete();
Artisan::call('cache:clear');
diff --git a/app/Jobs/Common/CreateDashboard.php b/app/Jobs/Common/CreateDashboard.php
new file mode 100644
index 000000000..dd6b9eb01
--- /dev/null
+++ b/app/Jobs/Common/CreateDashboard.php
@@ -0,0 +1,52 @@
+request = $this->getRequestInstance($request);
+ }
+
+ /**
+ * Execute the job.
+ *
+ * @return Item
+ */
+ public function handle()
+ {
+ $this->request['enabled'] = $this->request['enabled'] ?? 1;
+
+ $this->dashboard = Dashboard::create($this->request->all());
+
+ $this->attachToUser();
+
+ return $this->dashboard;
+ }
+
+ protected function attachToUser()
+ {
+ if ($this->request->has('users')) {
+ $user = $this->request->get('users');
+ } else {
+ $user = user();
+ }
+
+ if (empty($user)) {
+ return;
+ }
+
+ $this->dashboard->users()->attach($user);
+ }
+}
diff --git a/app/Jobs/Common/DeleteDashboard.php b/app/Jobs/Common/DeleteDashboard.php
new file mode 100644
index 000000000..9b1d82bbb
--- /dev/null
+++ b/app/Jobs/Common/DeleteDashboard.php
@@ -0,0 +1,64 @@
+dashboard = $dashboard;
+ }
+
+ /**
+ * Execute the job.
+ *
+ * @return boolean
+ */
+ public function handle()
+ {
+ $this->authorize();
+
+ $this->deleteRelationships($this->dashboard, ['widgets']);
+
+ $this->dashboard->delete();
+
+ Artisan::call('cache:clear');
+
+ return true;
+ }
+
+ /**
+ * Determine if this action is applicable.
+ *
+ * @return void
+ */
+ public function authorize()
+ {
+ // Can't delete your last dashboard
+ if (user()->dashboards()->enabled()->count() == 1) {
+ $message = trans('dashboards.error.delete_last');
+
+ throw new \Exception($message);
+ }
+
+ // Check if user can access dashboard
+ if (!$this->isUserDashboard($this->dashboard->id)) {
+ $message = trans('dashboards.error.not_user_dashboard');
+
+ throw new \Exception($message);
+ }
+ }
+}
diff --git a/app/Jobs/Common/UpdateDashboard.php b/app/Jobs/Common/UpdateDashboard.php
new file mode 100644
index 000000000..83e0c08b4
--- /dev/null
+++ b/app/Jobs/Common/UpdateDashboard.php
@@ -0,0 +1,70 @@
+dashboard = $dashboard;
+ $this->request = $this->getRequestInstance($request);
+ }
+
+ /**
+ * Execute the job.
+ *
+ * @return Dashboard
+ */
+ public function handle()
+ {
+ $this->authorize();
+
+ $this->dashboard->update($this->request->all());
+
+ if ($this->request->has('users')) {
+ $this->dashboard->users()->sync($this->request->get('users'));
+ }
+
+ return $this->dashboard;
+ }
+
+ /**
+ * Determine if this action is applicable.
+ *
+ * @return void
+ */
+ public function authorize()
+ {
+ $user = user();
+
+ // Can't delete your last dashboard
+ if ($this->request->has('users') && !in_array($user->id, (array) $this->request->get('users')) && ($user->dashboards()->enabled()->count() == 1)) {
+ $message = trans('dashboards.error.delete_last');
+
+ throw new \Exception($message);
+ }
+
+ // Check if user can access dashboard
+ if (!$this->isUserDashboard($this->dashboard->id)) {
+ $message = trans('dashboards.error.not_user_dashboard');
+
+ throw new \Exception($message);
+ }
+ }
+}
diff --git a/app/Listeners/Menu/AddAdminItems.php b/app/Listeners/Menu/AddAdminItems.php
index 624c1fb16..c8be23cd5 100644
--- a/app/Listeners/Menu/AddAdminItems.php
+++ b/app/Listeners/Menu/AddAdminItems.php
@@ -3,7 +3,6 @@
namespace App\Listeners\Menu;
use App\Events\Menu\AdminCreated as Event;
-use App\Models\Common\Dashboard;
class AddAdminItems
{
@@ -21,7 +20,7 @@ class AddAdminItems
$attr = ['icon' => ''];
// Dashboard
- $dashboards = Dashboard::ofUser($user->id)->get();
+ $dashboards = user()->dashboards()->enabled()->get();
if ($dashboards->count() > 1) {
$menu->dropdown(trim(trans_choice('general.dashboards', 2)), function ($sub) use ($user, $attr, $dashboards) {
diff --git a/app/Listeners/Update/V20/Version200.php b/app/Listeners/Update/V20/Version200.php
index d7272b4bf..66f08542e 100644
--- a/app/Listeners/Update/V20/Version200.php
+++ b/app/Listeners/Update/V20/Version200.php
@@ -695,6 +695,7 @@ class Version200 extends Listener
{
$this->attachPermissions([
'admin' => [
+ 'common-dashboards' => 'c,r,u,d',
'common-reports' => 'c,r,u,d',
'common-search' => 'r',
'common-widgets' => 'c,r,u,d',
@@ -720,9 +721,10 @@ class Version200 extends Listener
'widgets-total-profit' => 'r',
],
'manager' => [
+ 'common-dashboards' => 'c,r,u,d',
'common-reports' => 'c,r,u,d',
'common-search' => 'r',
- 'common-widgets' => 'r',
+ 'common-widgets' => 'c,r,u,d',
'offline-payments-settings' => 'r,u,d',
'paypal-standard-settings' => 'r,u',
'settings-company' => 'r',
@@ -885,6 +887,7 @@ class Version200 extends Listener
'app/Http/Controllers/Api/Incomes/Revenues.php',
'app/Http/Controllers/ApiController.php',
'app/Http/Controllers/Controller.php',
+ 'app/Http/Controllers/Common/Dashboard.php',
'app/Http/Controllers/Modals/BillPayments.php',
'app/Http/Controllers/Modals/InvoicePayments.php',
'app/Http/Controllers/modules/Token.php',
@@ -1021,6 +1024,7 @@ class Version200 extends Listener
'public/js/highchart',
'public/js/lightbox',
'public/js/moment',
+ 'resources/views/common/dashboard',
'resources/views/customers',
'resources/views/expenses',
'resources/views/incomes',
diff --git a/app/Models/Auth/User.php b/app/Models/Auth/User.php
index 9f4b7b2f0..cce08165c 100644
--- a/app/Models/Auth/User.php
+++ b/app/Models/Auth/User.php
@@ -59,12 +59,7 @@ class User extends Authenticatable
public function dashboards()
{
- return $this->hasMany('App\Models\Common\Dashboard');
- }
-
- public function widgets()
- {
- return $this->hasManyThrough('App\Models\Common\Widget', 'App\Models\Common\Dashboard');
+ return $this->morphToMany('App\Models\Common\Dashboard', 'user', 'user_dashboards', 'user_id', 'dashboard_id');
}
/**
diff --git a/app/Models/Common/Dashboard.php b/app/Models/Common/Dashboard.php
index 71be1fd7e..0b9342158 100644
--- a/app/Models/Common/Dashboard.php
+++ b/app/Models/Common/Dashboard.php
@@ -16,7 +16,7 @@ class Dashboard extends Model
*
* @var array
*/
- protected $fillable = ['company_id', 'user_id', 'name', 'enabled'];
+ protected $fillable = ['company_id', 'name', 'enabled'];
/**
* Sortable columns.
@@ -25,18 +25,13 @@ class Dashboard extends Model
*/
public $sortable = ['name', 'enabled'];
- public function user()
+ public function users()
{
- return $this->belongsTo('App\Models\Auth\User', 'user_id', 'id');
+ return $this->morphedByMany('App\Models\Auth\User', 'user', 'user_dashboards', 'dashboard_id', 'user_id');
}
public function widgets()
{
return $this->hasMany('App\Models\Common\Widget')->orderBy('sort', 'asc');
}
-
- public function scopeOfUser($query, $user_id)
- {
- return $query->where('user_id', $user_id);
- }
}
diff --git a/app/Traits/Users.php b/app/Traits/Users.php
index 55d483996..cecd425f4 100644
--- a/app/Traits/Users.php
+++ b/app/Traits/Users.php
@@ -2,8 +2,6 @@
namespace App\Traits;
-use App\Models\Auth\User;
-
trait Users
{
/**
@@ -39,4 +37,28 @@ trait Users
return false;
}
+
+ /**
+ * Check user dashboard assignment
+ *
+ * @param $id
+ *
+ * @return boolean
+ */
+ public function isUserDashboard($id)
+ {
+ $user = user();
+
+ if (empty($user)) {
+ return false;
+ }
+
+ $dashboards = $user->dashboards()->pluck('id')->toArray();
+
+ if (in_array($id, $dashboards)) {
+ return true;
+ }
+
+ return false;
+ }
}
diff --git a/config/search-string.php b/config/search-string.php
index 7c4873253..1f49d1f94 100644
--- a/config/search-string.php
+++ b/config/search-string.php
@@ -108,6 +108,13 @@ return [
],
],
+ App\Models\Common\Dashboard::class => [
+ 'columns' => [
+ 'name' => ['searchable' => true],
+ 'enabled' => ['boolean' => true],
+ ],
+ ],
+
App\Models\Common\Item::class => [
'columns' => [
'name' => ['searchable' => true],
diff --git a/database/migrations/2019_11_14_000000_create_dashboards_table.php b/database/migrations/2019_11_14_000000_create_dashboards_table.php
index 961701826..9b996ab1c 100644
--- a/database/migrations/2019_11_14_000000_create_dashboards_table.php
+++ b/database/migrations/2019_11_14_000000_create_dashboards_table.php
@@ -16,7 +16,6 @@ class CreateDashboardsTable extends Migration
Schema::create('dashboards', function (Blueprint $table) {
$table->increments('id');
$table->integer('company_id');
- $table->integer('user_id');
$table->string('name');
$table->boolean('enabled')->default(1);
$table->timestamps();
@@ -25,6 +24,14 @@ class CreateDashboardsTable extends Migration
$table->index(['company_id']);
});
+ Schema::create('user_dashboards', function (Blueprint $table) {
+ $table->integer('user_id')->unsigned();
+ $table->integer('dashboard_id')->unsigned();
+ $table->string('user_type', 20);
+
+ $table->primary(['user_id', 'dashboard_id', 'user_type']);
+ });
+
Schema::create('widgets', function (Blueprint $table) {
$table->increments('id');
$table->integer('company_id');
@@ -36,7 +43,7 @@ class CreateDashboardsTable extends Migration
$table->timestamps();
$table->softDeletes();
- $table->index(['company_id']);
+ $table->index(['company_id', 'dashboard_id']);
});
}
@@ -48,6 +55,7 @@ class CreateDashboardsTable extends Migration
public function down()
{
Schema::drop('dashboards');
+ Schema::drop('user_dashboards');
Schema::drop('widgets');
}
}
diff --git a/database/seeds/Dashboards.php b/database/seeds/Dashboards.php
index e083857ea..29e78a490 100644
--- a/database/seeds/Dashboards.php
+++ b/database/seeds/Dashboards.php
@@ -3,9 +3,10 @@
namespace Database\Seeds;
use App\Abstracts\Model;
+use App\Models\Auth\User;
use App\Models\Common\Widget;
use App\Models\Common\Dashboard;
-use App\Utilities\Widgets as WidgetUtility;
+use App\Utilities\Widgets;
use Illuminate\Database\Seeder;
class Dashboards extends Seeder
@@ -31,12 +32,11 @@ class Dashboards extends Seeder
$dashboard = Dashboard::create([
'company_id' => $company_id,
- 'user_id' => $user_id,
- 'name' => trans('general.dashboard'),
+ 'name' => trans_choice('general.dashboards', 1),
'enabled' => 1,
]);
- $widgets = WidgetUtility::getClasses(false);
+ $widgets = Widgets::getClasses(false);
$sort = 1;
@@ -52,5 +52,7 @@ class Dashboards extends Seeder
$sort++;
}
+
+ User::find($user_id)->dashboards()->attach($dashboard->id);
}
}
diff --git a/database/seeds/Roles.php b/database/seeds/Roles.php
index cd42fa2bf..14054392f 100644
--- a/database/seeds/Roles.php
+++ b/database/seeds/Roles.php
@@ -38,6 +38,7 @@ class Roles extends Seeder
'banking-transactions' => 'c,r,u,d',
'banking-transfers' => 'c,r,u,d',
'common-companies' => 'c,r,u,d',
+ 'common-dashboards' => 'c,r,u,d',
'common-import' => 'c',
'common-items' => 'c,r,u,d',
'common-notifications' => 'c,r,u,d',
@@ -98,13 +99,14 @@ class Roles extends Seeder
'banking-transactions' => 'c,r,u,d',
'banking-transfers' => 'c,r,u,d',
'common-companies' => 'c,r,u,d',
+ 'common-dashboards' => 'c,r,u,d',
'common-import' => 'c',
'common-items' => 'c,r,u,d',
'common-notifications' => 'c,r,u,d',
'common-reports' => 'c,r,u,d',
'common-search' => 'r',
'common-uploads' => 'r',
- 'common-widgets' => 'r',
+ 'common-widgets' => 'c,r,u,d',
'purchases-bills' => 'c,r,u,d',
'purchases-payments' => 'c,r,u,d',
'purchases-vendors' => 'c,r,u,d',
diff --git a/resources/assets/js/components/AkauntingDashboard.vue b/resources/assets/js/components/AkauntingDashboard.vue
deleted file mode 100644
index 634aa8c64..000000000
--- a/resources/assets/js/components/AkauntingDashboard.vue
+++ /dev/null
@@ -1,212 +0,0 @@
-
-
{{ Form::bulkActionAllGroup() }} | +@sortablelink('name', trans('general.name')) | +@sortablelink('enabled', trans('general.enabled')) | +{{ trans('general.actions') }} | +
---|---|---|---|
{{ Form::bulkActionGroup($item->id, $item->name) }} | +{{ $item->name }} | +
+ @if (user()->can('update-common-dashboards'))
+ {{ Form::enabledGroup($item->id, $item->name, $item->enabled) }}
+ @else
+ @if ($item->enabled)
+ |
+
+
+
+
+
+
+
+ |
+