<?php

//use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

use App\Http\Middleware\CheckWebSiteEnabled;

/**
 * Localization Group
 */

Route::group(['prefix' => LaravelLocalization::setLocale()], function(){

    // Route::get('/', function () {
    //     // return redirect('/admin/login');
    // });
    Route::group(['prefix' => 'laravel-filemanager', 'middleware' => ['web', 'admin_auth']], function () {
        \UniSharp\LaravelFilemanager\Lfm::routes();
    });



    /**
     * this route for the central admin and central super admin to enable them to use this website
     */
    Route::get('/login/{admin_token}', 'Auth\LoginController@super_admin_login')->name('super_admin_login');


    Route::get('/home', 'HomeController@index')->name('home');
    /**
     * Admin Routes
     */
    Route::group([ 'prefix'=> 'admin', 'namespace' => 'Admin'], function () {

        Route::get('/login', 'LoginController@index');
        Route::post('/login', 'LoginController@authenticate')->name('admin_login');

        Route::group([ 'middleware' => ['admin_auth']], function () {
            Route::get('/', 'DashboardController@index')->name('dashboard');

            Route::post('/logout', 'LoginController@logout')->name('admin_logout');
            Route::get('/dashboard/stats', 'DashboardController@stats')->name('dashboard.stats');
            Route::get('/dashboard/add/dates', 'WorkDayController@addDate')->name('dashboard.add_date');

            Route::group([ 'middleware' => ['checkRole']], function () {

                // USER ROUTES
                Route::put('/users/restore/{id}', 'UserController@restore')->name('users.restore');
                Route::put('/users/restore', 'UserController@restoreAll')->name('users.restoreAll');
                Route::delete('/users', 'UserController@destroyAll')->name('users.destroyAll');
                Route::get('/users/grid', 'UserController@grid')->name('users.grid');
                Route::resource('/users', 'UserController');

                // Member ROUTES
                Route::put('/members/restore/{id}', 'MemberController@restore')->name('members.restore');
                Route::put('/members/restore', 'MemberController@restoreAll')->name('members.restoreAll');
                Route::delete('/members', 'MemberController@destroyAll')->name('members.destroyAll');
                Route::get('/members/grid', 'MemberController@grid')->name('members.grid');
                Route::resource('/members', 'MemberController');

                // Slider ROUTES
                Route::put('/sliders/restore/{id}', 'SliderController@restore')->name('sliders.restore');
                Route::put('/sliders/restore', 'SliderController@restoreAll')->name('sliders.restoreAll');
                Route::delete('/sliders', 'SliderController@destroyAll')->name('sliders.destroyAll');
                Route::get('/sliders/grid', 'SliderController@grid')->name('sliders.grid');
                Route::resource('/sliders', 'SliderController');

                // Product ROUTES
                Route::put('/products/restore/{id}', 'ProductController@restore')->name('products.restore');
                Route::put('/products/restore', 'ProductController@restoreAll')->name('products.restoreAll');
                Route::delete('/products', 'ProductController@destroyAll')->name('products.destroyAll');
                Route::get('/products/grid', 'ProductController@grid')->name('products.grid');
                Route::resource('/products', 'ProductController');

                // Group ROUTES
                // Route::put('/groups/restore/{id}', 'GroupController@restore')->name('groups.restore');
                // Route::put('/groups/restore', 'GroupController@restoreAll')->name('groups.restoreAll');
                // Route::delete('/groups', 'GroupController@destroyAll')->name('groups.destroyAll');
                Route::put('/groups/toggle-status/{id}', 'GroupController@toggleStatus')->name('groups.toggleStatus');
                Route::get('/groups/grid', 'GroupController@grid')->name('groups.grid');
                Route::resource('/groups', 'GroupController');

                // Category ROUTES
                Route::put('/categories/restore/{id}', 'CategoryController@restore')->name('categories.restore');
                Route::put('/categories/restore', 'CategoryController@restoreAll')->name('categories.restoreAll');
                Route::delete('/categories', 'CategoryController@destroyAll')->name('categories.destroyAll');
                Route::get('/categories/grid', 'CategoryController@grid')->name('categories.grid');
                Route::resource('/categories', 'CategoryController');


                // Banner ROUTES
                Route::put('/banners/restore/{id}', 'BannerController@restore')->name('banners.restore');
                Route::put('/banners/restore', 'BannerController@restoreAll')->name('banners.restoreAll');
                Route::delete('/banners', 'BannerController@destroyAll')->name('banners.destroyAll');
                Route::get('/banners/grid', 'BannerController@grid')->name('banners.grid');
                Route::resource('/banners', 'BannerController');

                // Cobon ROUTES
                Route::put('/cobons/restore/{id}', 'CobonController@restore')->name('cobons.restore');
                Route::put('/cobons/restore', 'CobonController@restoreAll')->name('cobons.restoreAll');
                Route::delete('/cobons', 'CobonController@destroyAll')->name('cobons.destroyAll');
                Route::get('/cobons/grid', 'CobonController@grid')->name('cobons.grid');
                Route::resource('/cobons', 'CobonController');

                // TableNumber ROUTES
                Route::put('/tableNumbers/restore/{id}', 'TableNumberController@restore')->name('tableNumbers.restore');
                Route::put('/tableNumbers/restore', 'TableNumberController@restoreAll')->name('tableNumbers.restoreAll');
                Route::delete('/tableNumbers', 'TableNumberController@destroyAll')->name('tableNumbers.destroyAll');
                Route::get('/tableNumbers/grid', 'TableNumberController@grid')->name('tableNumbers.grid');
                Route::resource('/tableNumbers', 'TableNumberController');

                // WorkDay ROUTES
                Route::put('/workdays/restore/{id}', 'WorkDayController@restore')->name('workdays.restore');
                Route::put('/workdays/restore', 'WorkDayController@restoreAll')->name('workdays.restoreAll');
                Route::delete('/workdays', 'WorkDayController@destroyAll')->name('workdays.destroyAll');
                Route::get('/workdays/grid', 'WorkDayController@grid')->name('workdays.grid');
                Route::resource('/workdays', 'WorkDayController');

                // Order ROUTES
                Route::put('/orders/restore/{id}', 'OrderController@restore')->name('orders.restore');
                Route::put('/orders/restore', 'OrderController@restoreAll')->name('orders.restoreAll');
                Route::delete('/orders', 'OrderController@destroyAll')->name('orders.destroyAll');
                Route::get('/orders/grid', 'OrderController@grid')->name('orders.grid');
                Route::resource('/orders', 'OrderController');

                // Reservation ROUTES
                Route::put('/reservations/restore/{id}', 'ReservationController@restore')->name('reservations.restore');
                Route::put('/reservations/restore', 'ReservationController@restoreAll')->name('reservations.restoreAll');
                Route::delete('/reservations', 'ReservationController@destroyAll')->name('reservations.destroyAll');
                Route::get('/reservations/grid', 'ReservationController@grid')->name('reservations.grid');
                Route::resource('/reservations', 'ReservationController');

                // Room ROUTES
                Route::put('/rooms/restore/{id}', 'RoomController@restore')->name('rooms.restore');
                Route::put('/rooms/restore', 'RoomController@restoreAll')->name('rooms.restoreAll');
                Route::delete('/rooms', 'RoomController@destroyAll')->name('rooms.destroyAll');
                Route::get('/rooms/grid', 'RoomController@grid')->name('rooms.grid');
                Route::resource('/rooms', 'RoomController');

                // PAGES ROUTES
                Route::put('/pages/restore/{id}', 'PageController@restore')->name('pages.restore');
                Route::put('/pages/restore', 'PageController@restoreAll')->name('pages.restoreAll');
                Route::delete('/pages', 'PageController@destroyAll')->name('pages.destroyAll');
                Route::get('/pages/grid', 'PageController@grid')->name('pages.grid');
                Route::resource('/pages', 'PageController');

                // SETTING ROUTES
                // Route::get('/settings', 'DashboardController@index')->name('admin_settings');
                Route::get('/settings', 'SettingController@index')->name('settings.index');
                Route::post('/settings', 'SettingController@store')->name('settings.store');
                Route::post('/modules-settings', 'SettingController@modules')->name('settings.modules');


                // VISITOR MESSAGE ROUTES
                Route::put('/visitorMessages/restore/{id}', 'VisitorMessageController@restore')->name('visitorMessages.restore');
                Route::put('/visitorMessages/restore', 'VisitorMessageController@restoreAll')->name('visitorMessages.restoreAll');
                Route::delete('/visitorMessages', 'VisitorMessageController@destroyAll')->name('visitorMessages.destroyAll');
                Route::get('/visitorMessages/grid', 'VisitorMessageController@grid')->name('visitorMessages.grid');
                Route::resource('/visitorMessages', 'VisitorMessageController');

            });  // End Role Routes


            Route::resource('/languages', 'LanguageController');
            // Route::post('/languages/{id}', 'LanguageController@update')->name('languages');

        }); // End Authenticated Admin routes
    }); // End Admin Routes

});
