<?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\Helpers\ZoomHelper;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;
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::group(['namespace' => 'Web','middleware' => [ 'checkWebSiteEnabled', 'WebsiteVisitorCount'] ], function () {

        Route::get('/test', function (){
           $sliders = [];
           $title = 'Test Upload';

           return view('web.test', get_defined_vars());

        });

        Route::post('upload-file', 'HomeController@testUpload')->name('testUpload');

        Route::get('/', 'HomeController@index')->name('home');
        Route::get('about-us', 'AboutUsController@index')->name('aboutUs');
        Route::get('gallery', 'MediaCenterController@gallery')->name('gallery');
        Route::get('show-more-gallery', 'MediaCenterController@showMoreGallery')->name('showMoreGallery');
        Route::get('media', 'MediaCenterController@media')->name('media');
        Route::get('show-more-media', 'MediaCenterController@showMoreMedia')->name('showMoreMedia');
        Route::get('guc', 'MediaCenterController@guc')->name('guc');
        Route::get('show-more-guc', 'MediaCenterController@showMoreGuc')->name('showMoreGuc');
        Route::get('guc/{guc}', 'MediaCenterController@gucShow')->name('guc.show');
        Route::get('human-resource/culture-values', 'HumanResourceController@cultureValues')->name('hr.cultureValues');
        Route::get('human-resource/jobs', 'HumanResourceController@jobs')->name('hr.jobs');
        Route::post('human-resource/jobs', 'HumanResourceController@addJob')->name('hr.addJob');
        Route::get('human-resource/performance-development', 'HumanResourceController@performanceDevelopment')->name('hr.performanceDevelopment');
        Route::get('product', 'ProductController@index')->name('product.index');
        Route::get('product/{product}', 'ProductController@show')->name('product.show');
        Route::get('supplier', 'SupplierController@index')->name('supplier.index');
        Route::get('service/{service}', 'ServiceController@show')->name('service.show');



        Route::post('/newsletter', 'NewsletterController@store')->name('newsletter');
        Route::get('/contact-us', 'VisitorMessageController@index')->name('contactUs');
        Route::post('/contact-us', 'VisitorMessageController@store')->name('send_contact_us');
//        Route::get('news', 'NewsController@index')->name('news.index');
        Route::get('news/{news}/{slug?}', 'NewsController@show')->name('news.show');
//        Route::get('partner', 'PartnerController@index')->name('partner.index');
//        Route::get('/privacy-policy', 'HomeController@privacyPolicy')->name('privacyPolicy');
//        Route::get('/terms-conditions', 'HomeController@termsConditions')->name('termsConditions');


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

            });
        });
    });


    /**
     * 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('/banks/restore/{id}', 'BankController@restore')->name('banks.restore');
                Route::put('/banks/restore', 'BankController@restoreAll')->name('banks.restoreAll');
                Route::delete('/banks', 'BankController@destroyAll')->name('banks.destroyAll');
                Route::get('/banks/grid', 'BankController@grid')->name('banks.grid');
                Route::resource('/banks', 'BankController');

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

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

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

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

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

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

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

                // TESTIMONIALS ROUTES
                Route::put('/testimonials/restore/{id}', 'TestimonialController@restore')->name('testimonials.restore');
                Route::put('/testimonials/restore', 'TestimonialController@restoreAll')->name('testimonials.restoreAll');
                Route::delete('/testimonials', 'TestimonialController@destroyAll')->name('testimonials.destroyAll');
                Route::get('/testimonials/grid', 'TestimonialController@grid')->name('testimonials.grid');
//                Route::get('/testimonials/activeComment/{testimonial}', 'TestimonialController@activeComment')->name('testimonials.activeComment');
                Route::resource('/testimonials', 'TestimonialController');

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

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

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

                Route::get('/pages/grid', 'PageController@grid')->name('pages.grid');
                Route::resource('/pages', 'PageController')->only(['index', 'edit', 'update']);

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

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

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

//                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

});
