diff --git a/app/Http/Livewire/DashboardGrid.php b/app/Http/Livewire/DashboardGrid.php new file mode 100644 index 00000000..ece97a26 --- /dev/null +++ b/app/Http/Livewire/DashboardGrid.php @@ -0,0 +1,38 @@ + '$refresh', + 'designerView' => 'designerView', + ]; + + public $designerView = false; + + public function designerView() + { + $this->designerView = ! $this->designerView; + } + + public function updateSort($list) + { + if ($this->designerView) { + foreach ($list as $item) { + Menu::find($item['value'])->update(['sort' => $item['order']]); + } + } + } + + public function render() + { + return view('includes.dashboard-grid'); + } +} diff --git a/app/Providers/LivewireServiceProvider.php b/app/Providers/LivewireServiceProvider.php index 72e0fe58..e9e0b345 100644 --- a/app/Providers/LivewireServiceProvider.php +++ b/app/Providers/LivewireServiceProvider.php @@ -27,6 +27,8 @@ use App\Http\Livewire\Admin\User\ReactivateUserDialog; use App\Http\Livewire\Admin\User\RestoreUserDialog; use App\Http\Livewire\Admin\User\UsersTable; +use App\Http\Livewire\DashboardGrid; +use App\Http\Livewire\Menu\MenuGrid; use Illuminate\Support\ServiceProvider; use Livewire\Livewire; @@ -63,5 +65,10 @@ public function register() Livewire::component('admin.menus.includes.partials.create-menu-button', CreateMenuButton::class); Livewire::component('admin.icons.icon-select', IconSelect::class); + + Livewire::component('includes.dashboard-grid', DashboardGrid::class); + Livewire::component('menu.includes.menu-grid', MenuGrid::class); + + } } diff --git a/resources/views/dashboard.blade.php b/resources/views/dashboard.blade.php index b04363c2..d373ab96 100644 --- a/resources/views/dashboard.blade.php +++ b/resources/views/dashboard.blade.php @@ -9,32 +9,10 @@ - - @forelse($logged_in_user->all_menus->where('name', '!=', 'Dashboard') as $item) - - -
- {!! $item->icon->art !!} -
- - -

- {{ $item->name ?? $item->link }} -

-
-
- @empty - - - - - - {{__('No Items')}} - - - - @endforelse -
+ - +@if($logged_in_user->isAdmin()) + + +@endif diff --git a/resources/views/includes/dashboard-grid.blade.php b/resources/views/includes/dashboard-grid.blade.php new file mode 100644 index 00000000..04f65c09 --- /dev/null +++ b/resources/views/includes/dashboard-grid.blade.php @@ -0,0 +1,36 @@ +
+ + @forelse($logged_in_user->all_menus->where('name', '!=', 'Dashboard')->sortBy('sort') as $item) + + +
+ {!! $item->icon->art !!} +
+ + +

+ {{ $item->name ?? $item->link }} +

+
+ + @if($logged_in_user->isAdmin()) +
+ + +
+ @endif +
+ + + @empty + + + + + + {{__('No Items')}} + + + @endforelse +
+
diff --git a/resources/views/menus/show.blade.php b/resources/views/menus/show.blade.php index 1a183750..bd3c323d 100644 --- a/resources/views/menus/show.blade.php +++ b/resources/views/menus/show.blade.php @@ -15,7 +15,7 @@ @endif - + @if($logged_in_user->isAdmin()) diff --git a/routes/web.php b/routes/web.php index 024b20ea..52b30d09 100644 --- a/routes/web.php +++ b/routes/web.php @@ -10,9 +10,9 @@ Route::view('/', 'welcome')->name('index'); -Route::middleware(['auth', 'verified'])->get('/dashboard', function () { - return view('dashboard'); -})->name('dashboard'); +Route::view('/dashboard', 'dashboard') + ->middleware(['auth', 'verified']) + ->name('dashboard'); /* * Admin Routes @@ -20,14 +20,14 @@ * These routes can only be accessed by users with type `admin` */ Route::group(['prefix' => 'admin', 'as' => 'admin.', 'middleware' => 'admin'], function () { - includeRouteFiles(__DIR__.'/admin/'); + includeRouteFiles(__DIR__ . '/admin/'); }); /* * Menu Routes */ Route::group(['prefix' => 'menus', 'as' => 'menus.', 'middleware' => 'auth'], function () { - includeRouteFiles(__DIR__.'/menus/'); + includeRouteFiles(__DIR__ . '/menus/'); }); /* @@ -35,10 +35,10 @@ */ Route::group([ 'prefix' => config('menus.url_segments.internal_iframe_prefix'), - 'as' => config('menus.url_segments.internal_iframe_prefix').'.', + 'as' => config('menus.url_segments.internal_iframe_prefix') . '.', 'middleware' => 'auth' ], function () { - includeRouteFiles(__DIR__.'/iframes/'); + includeRouteFiles(__DIR__ . '/iframes/'); }); /* @@ -46,26 +46,26 @@ */ Route::group([ 'prefix' => config('menus.url_segments.external_iframe_prefix'), - 'as' => config('menus.url_segments.external_iframe_prefix').'.', + 'as' => config('menus.url_segments.external_iframe_prefix') . '.', 'middleware' => 'auth' ], function () { - includeRouteFiles(__DIR__.'/extras/'); + includeRouteFiles(__DIR__ . '/extras/'); }); if (config('template.cms.cms')) { if (config('template.cms.driver') === 'wink') { Route::middleware(config('wink.middleware_group')) - ->as('wink.') - ->domain(config('wink.domain')) - ->prefix(config('wink.path')) - ->group(function () { - Route::get('huh', function () { + ->as('wink.') + ->domain(config('wink.domain')) + ->prefix(config('wink.path')) + ->group(function () { + Route::get('huh', function () { + }); + Route::get('/login', [WinkBridgeController::class, 'showLoginForm'])->name('auth.login'); + Route::post('/login', [WinkBridgeController::class, 'login'])->name('auth.attempt'); + // Logout Route... + Route::get('/logout', [WinkBridgeController::class, 'logout'])->name('logout'); }); - Route::get('/login', [WinkBridgeController::class, 'showLoginForm'])->name('auth.login'); - Route::post('/login', [WinkBridgeController::class, 'login'])->name('auth.attempt'); - // Logout Route... - Route::get('/logout', [WinkBridgeController::class, 'logout'])->name('logout'); - }); } }