<?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 Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Route;
use Mcamara\LaravelLocalization\Facades\LaravelLocalization;

//Route::get('language/{id}/{slug?}', 'LanguageController@details');
/**
 * Localization Group
 */

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

    Route::get('/', function () {

//        $payment = new \App\Http\Controllers\Web\MyFatoorah();
//        $response = $payment->checkApiTest();
//        dd($response);
//        //https://demo.MyFatoorah.com/En/KWT/PayInvoice/Checkout?invoiceKey=01072119820641&paymentGatewayId=22
//        $refund = \App\Http\Controllers\Admin\MyFatoorah::refund('1198206', 16.210); // invoiceId => 1198206, paymentId => 0706119820695441567
//        dd($refund);
        return redirect('/admin/login');
    });

    Route::group(['namespace' => 'Web','middleware' => [ 'checkWebSiteEnabled', 'WebsiteVisitorCount'] ], function () {
//        Route::get('/', 'HomeController@index')->name('home');
//        Route::get('/privacy-policy', 'HomeController@privacyPolicy')->name('privacyPolicy');
//        Route::get('/terms-conditions', 'HomeController@termsConditions')->name('termsConditions');
//
//
//        // newsletter and contact us routes
//        Route::get('/contact-us', 'VisitorMessageController@index')->name('contactUs');
//        Route::post('/contact-us', 'VisitorMessageController@store')->name('send_contact_us');
//        Route::get('about-us', 'AboutUsController@index')->name('aboutUs');
//        Route::post('/newsletter', 'NewsletterController@store')->name('newsletter');
//
//
//        Route::get('/login/', 'LoginController@login')->name('userProvider.login');
//        Route::post('/login', 'LoginController@doLogin')->name('userProvider.doLogin');
//
//        Route::get('/register', 'UserController@register')->name('user.register');
//        Route::post('/register', 'UserController@doRegister')->name('user.doRegister');
//        Route::get('/getState', 'UserController@getState')->name('user.getState');
//
//        Route::get('/provider/register', 'ProviderController@register')->name('provider.register');
//        Route::post('/provider/register', 'ProviderController@doRegister')->name('provider.doRegister');
//        Route::get('/getCityAndSector', 'ProviderController@getCityAndSector')->name('provider.getCityAndSector');
//
//
//        Route::get('/forget-password', 'ResetPasswordController@forgetPasswordForm')->name('user.forgetPassword');
//        Route::post('/send-forget-password-code', 'ResetPasswordController@sendForgetPasswordCode')->name('user.sendForgetPasswordCode');
//        Route::get('/type-forget-password-code', 'ResetPasswordController@typeForgetPasswordCode')->name('user.typeForgetPasswordCode');
//        Route::post('/code-verification', 'ResetPasswordController@codeVerification')->name('user.codeVerification');
//        Route::get('/new-password', 'ResetPasswordController@newPasswordForm')->name('user.newPasswordForm');
//        Route::post('/resetPassword', 'ResetPasswordController@resetPassword')->name('user.resetPassword');
//
//        Route::get('/hotel', 'HotelController@index')->name('hotel.index');
//        Route::get('/hotel/{hotel}', 'HotelController@show')->name('hotel.show');
//        Route::get('/hotel-offer', 'HotelController@offerHall')->name('hotel.offerHall');
//        Route::get('/reservation-details/{hotel}', 'ReservationController@reservationDetails')->name('reservation.reservationDetails');
//


//        Route::group(['middleware' => 'RedirectToPreviousLink'], function () {
//            Route::group(['middleware' => 'UserAuth'], function (){
//
//                Route::post('/storeDeviceToken', 'LoginController@storeDeviceToken')->name('userProvider.storeDeviceToken');
//
//
//                Route::any('/logout', 'LoginController@logout')->name('userProvider.logout');
//                Route::get('/user/profile', 'UserController@index')->name('user.profile');
//                Route::post('/userUpdateProfile/{user}', 'UserController@updateProfile')->name('user.updateProfile');
//                Route::get('/userReservationSearch', 'UserController@reservationSearch')->name('user.reservationSearch');
//                Route::get('/reservation/{reservation}', 'ReservationController@reservationDetails')->name('reservation.reservationDetails');
////                Route::get('/delete-reservation/{reservation}', 'ReservationController@cancelReservation')->name('reservation.cancelReservation');
//                Route::post('/reservation-invitation/{reservationId}', 'ReservationController@invitation')->name('reservation.invitation');
//
//                Route::get('/provider/profile', 'ProviderController@index')->name('provider.profile');
//                Route::post('/providerUpdateProfile/{user}', 'ProviderController@updateProfile')->name('provider.updateProfile');
//                Route::get('/providerWalletSearch', 'ProviderController@walletSearch')->name('provider.walletSearch');
//                Route::post('/providerReservationSearch', 'ProviderController@reservationSearch')->name('provider.reservationSearch');
//                Route::get('/provider/delete-hotel/{hotel_id}', 'ProviderController@deleteHall')->name('provider.deleteHall');
//                Route::get('/provider/edit-hotel/{hotel}', 'ProviderController@editHall')->name('provider.editHall');
//                Route::post('/provider/addEditHall/{hotel?}', 'ProviderController@AddEditHall')->name('provider.AddEditHall');
//
//
//                Route::get('/reservationStatusOperation{reservation}', 'ReservationController@reservationStatusOperation')->name('reservation.reservationStatusOperation');
//
//                Route::post('hotel-evaluate', 'UserController@hotelEvaluate')->name('hotelEvaluate');
//
//                // ######################################################
//                Route::get('/user/markAsRead', 'UserController@markAsRead')->name('user.markAsRead');
//                Route::get('user/refreshNotification', 'UserController@refreshNotification')->name('user.refreshNotification');
//                Route::get('/hotel-reservation/{hotel}', 'ReservationController@reservationPage')->name('reservation.hotelReservation');
//                Route::post('/reservation/{hotel}', 'ReservationController@addReservation')->name('reservation.addReservation');
//                Route::get('reservation-pay-now/{reservation}', 'ReservationController@payNow')->name('reservation.payNow');
//                Route::get('reservation-send-request/{reservation}', 'ReservationController@sendReservationRequest')->name('reservation.sendReservationRequest');
//
//                Route::post('reservation-finishPay/{reservation}', 'MyFatoorah@pay')->name('reservation.finishPay');
//                Route::get('callback', 'MyFatoorah@callback')->name('callback');
//
//            });
//        });

    });


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

    /**
     * Authentication routes , and Authentication user routs
     */
//	Auth::routes();

    /**
     * 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::group([ 'middleware' => ['checkRole']], function () {

                Route::put('/consultings/restore/{id}', 'ConsultingController@restore')->name('consultings.restore');
                Route::put('/consultings/restore', 'ConsultingController@restoreAll')->name('consultings.restoreAll');
                Route::delete('/consultings', 'ConsultingController@destroyAll')->name('consultings.destroyAll');
                Route::get('/consultings/grid', 'ConsultingController@grid')->name('consultings.grid');
                Route::get('/consultings/activeConsulting/{consulting}', 'ConsultingController@activeConsulting')->name('consultings.activeConsulting');
                Route::resource('/consultings', 'ConsultingController');

//                Route::put('/activeConsultings/restore/{id}', 'ActiveConsultingController@restore')->name('activeConsultings.restore');
//                Route::put('/activeConsultings/restore', 'ActiveConsultingController@restoreAll')->name('activeConsultings.restoreAll');
//                Route::delete('/activeConsultings', 'ActiveConsultingController@destroyAll')->name('activeConsultings.destroyAll');
                Route::get('/activeConsultings/grid', 'ActiveConsultingController@grid')->name('activeConsultings.grid');
                Route::get('/activeConsultings/activeConsulting/{activeConsulting}', 'ActiveConsultingController@activeConsulting')->name('activeConsultings.activeConsulting');
                Route::resource('/activeConsultings', 'ActiveConsultingController')->only(['index', 'edit', 'update']);

//                Route::put('/finishedConsultings/restore/{id}', 'FinishedConsultingController@restore')->name('finishedConsultings.restore');
//                Route::put('/finishedConsultings/restore', 'FinishedConsultingController@restoreAll')->name('finishedConsultings.restoreAll');
//                Route::delete('/finishedConsultings', 'FinishedConsultingController@destroyAll')->name('finishedConsultings.destroyAll');
                Route::get('/finishedConsultings/grid', 'FinishedConsultingController@grid')->name('finishedConsultings.grid');
                Route::resource('/finishedConsultings', 'FinishedConsultingController')->only(['index', 'edit', 'update']);


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

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

                Route::put('/documentationRequests/restore/{id}', 'DocumentationRequestController@restore')->name('documentationRequests.restore');
                Route::put('/documentationRequests/restore', 'DocumentationRequestController@restoreAll')->name('documentationRequests.restoreAll');
                Route::delete('/documentationRequests', 'DocumentationRequestController@destroyAll')->name('documentationRequests.destroyAll');
                Route::get('/documentationRequests/grid', 'DocumentationRequestController@grid')->name('documentationRequests.grid');
                Route::get('/documentationRequests/activeDocumentation/{documentationRequest}', 'DocumentationRequestController@activeConsultings')->name('documentationRequests.activeDocumentation');
                Route::resource('/documentationRequests', 'DocumentationRequestController');

                // HALLS ROUTES
//                Route::put('/hotel_reservations/restore/{id}', 'HotelReservationController@restore')->name('hotel_reservations.restore');
//                Route::put('/hotel_reservations/restore', 'HotelReservationController@restoreAll')->name('hotel_reservations.restoreAll');
//                Route::delete('/hotel_reservations', 'HotelReservationController@destroyAll')->name('hotel_reservations.destroyAll');
//                Route::get('/hotel_reservations/grid', 'HotelReservationController@grid')->name('hotel_reservations.grid');
////                Route::get('/hotel_reservations/activeHall/{hotel}', 'HotelReservationController@activeHall')->name('hotel_reservations.activeHall');
//                Route::resource('/hotel_reservations', 'HotelReservationController')->only(['index', 'edit', 'destroy']);
//                Route::get('/hotel_reservations-reports', 'ReportController@hotelReservationsReport')->name('hotel_reservations.reports');
//                Route::post('/hotel-reservations-status', 'HotelReservationController@changeReservationStatus')->name('hotel_reservations.changeReservationStatus');
//                Route::get('/hotel-reservations-finish', 'HotelReservationController@finishReservations')->name('hotel_reservations.finishReservations');


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

                // 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');


                // COURSE COMMENTS ROUTES
//                Route::put('/evaluates/restore/{id}', 'EvaluateController@restore')->name('evaluates.restore');
//                Route::put('/evaluates/restore', 'EvaluateController@restoreAll')->name('evaluates.restoreAll');
//                Route::delete('/evaluates', 'EvaluateController@destroyAll')->name('evaluates.destroyAll');
//                Route::get('/evaluates/grid', 'EvaluateController@grid')->name('evaluates.grid');
//                Route::get('/evaluates/activeEvaluate/{evaluate}', 'EvaluateController@activeEvaluate')->name('evaluates.activeEvaluate');
//                Route::resource('/evaluates', 'EvaluateController')->only(['index', 'edit', 'destroy']);

                // MEMBERS 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::get('/members/activeMember/{member}', 'MemberController@activeMember')->name('members.activeMember');
                Route::get('/members/getCityAndSector', 'MemberController@getCityAndSector')->name('members.getCityAndSector');
                Route::resource('/members', 'MemberController');


                // USERS NOTIFICATIONS ROUTES
                Route::put('/usersNotifications/restore/{id}', 'UsersNotificationController@restore')->name('usersNotifications.restore');
                Route::put('/usersNotifications/restore', 'UsersNotificationController@restoreAll')->name('usersNotifications.restoreAll');
                Route::delete('/usersNotifications', 'UsersNotificationController@destroyAll')->name('usersNotifications.destroyAll');
                Route::get('/usersNotifications/grid', 'UsersNotificationController@grid')->name('usersNotifications.grid');
                Route::get('/usersNotifications/getUsers', 'UsersNotificationController@getUsers')->name('usersNotifications.getUsers');
//                Route::get('/usersNotifications/getInstructors', 'UsersNotificationController@getInstructors')->name('usersNotifications.getInstructors');
                Route::resource('/usersNotifications', 'UsersNotificationController');

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


//                Route::get('/screens/grid', 'ScreenController@grid')->name('screens.grid');
//                Route::resource('/screens', 'ScreenController')->only(['index','edit', 'update']);
//
//                Route::get('/landings/grid', 'LandingController@grid')->name('landings.grid');
//                Route::resource('/landings', 'LandingController')->only(['index','edit', 'update']);
//
//                // PAGES ROUTES
//                Route::get('/policies/grid', 'PolicyController@grid')->name('policies.grid');
//                Route::resource('/policies', 'PolicyController')->only(['index','edit', 'update']);

//                // ABOUTS ROUTES
//                Route::get('/abouts/grid', 'AboutController@grid')->name('abouts.grid');
//                Route::resource('/abouts', 'AboutController')->only(['index','edit', 'update']);


//                // NEWSLETTER ROUTES
//                Route::put('/newsletters/restore/{id}', 'NewsletterController@restore')->name('newsletters.restore');
//                Route::put('/newsletters/restore', 'NewsletterController@restoreAll')->name('newsletters.restoreAll');
//                Route::delete('/newsletters', 'NewsletterController@destroyAll')->name('newsletters.destroyAll');
//                Route::get('/newsletters/grid', 'NewsletterController@grid')->name('newsletters.grid');
//                Route::get('/newsletters/mailsList', 'NewsletterController@mailsList')->name('newsletters.mailsList');
//                Route::get('/newsletters/mailsListGrid', 'NewsletterController@mailsListGrid')->name('newsletters.mailsListGrid');
//                Route::get('/newsletters/mailsListMore/{id}', 'NewsletterController@mailsListMore')->name('newsletters.mailsListMore');
//                Route::resource('/newsletters', 'NewsletterController');

                // 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');

                // 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');

                // 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');


            });  // End Role Routes


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

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

});
