<?php

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



// Logged user dashboard

/*Route::get('/403', function () {
    return view('errors.403');
})->name('403');*/

//Artisan commands
Route::get('currency-{cur}', 'FrontendController@currency')->name('currency');


// Admin routes
Route::prefix('panel')->group(function() {


    // Dashboard
    Route::get('/', 'Admin\DashboardController@index')->name('admin.dashboard');

    // Admin login/logout
    Route::get('/login', 'Auth\AdminLoginController@showLoginForm')->name('admin.login');
    Route::post('/login', 'Auth\AdminLoginController@login')->name('admin.login.submit');
    Route::get('/logout', 'Auth\AdminLoginController@logout')->name('admin.logout');

    // Password reset routes
    Route::post('/password/email', 'Auth\AdminForgotPasswordController@sendResetLinkEmail')->name('admin.password.email');
    Route::get('/password/reset', 'Auth\AdminForgotPasswordController@showLinkRequestForm')->name('admin.password.request');
    Route::post('/password/reset', 'Auth\AdminResetPasswordController@reset');
    Route::get('/password/reset/{token}', 'Auth\AdminResetPasswordController@showResetForm')->name('admin.password.reset');

    Route::group( ['as' => 'admin.'], function () {

        Route::get('/ajax-{act}','Admin\AjaxController@index')->where(['act' => '[A-Za-z]+'])->name('ajax.act');

        Route::resource('role', 'Admin\RoleController');

        Route::resource('admin', 'Admin\AdminController');

        Route::resource('categorygroup', 'Admin\CategoryGroupController');

        Route::resource('brand', 'Admin\BrandController');

        Route::resource('category', 'Admin\CategoryController');

        Route::resource('page', 'Admin\PageController');

        Route::resource('slide', 'Admin\SlideController');

        Route::resource('position', 'Admin\PositionController');

        Route::resource('attribute', 'Admin\AttributeController');

        Route::resource('product', 'Admin\ProductController');

        Route::resource('carousel', 'Admin\CarouselController');

        Route::resource('ad', 'Admin\AdController');

        Route::get('/config',          'Admin\ConfigController@edit')->name('config.edit');
        Route::put('/config/{config}', 'Admin\ConfigController@update')->name('config.update');

        Route::resource('company', 'Admin\CompanyController');

        Route::resource('invoice', 'Admin\InvoiceController');
        Route::get('/invoice/create/{order?}','Admin\InvoiceController@create')->name('invoice.create');
        Route::get('/invoice/pdf/{invoice}','Admin\InvoiceController@pdf')->name('invoice.pdf');

        Route::get('/order',     'Admin\OrderController@index')->name('order.index');
        Route::get('/neworders', 'Admin\OrderController@neworders')->name('order.new');

        Route::resource('user', 'Admin\UserController');
        Route::get('/newusers', 'Admin\UserController@viewnew')->name('user.viewnew');

    });

});

// SR Frontend routes
Route::group(['prefix'=>'sr','as'=>'sr.'], function(){

    // Frontend routes
    Route::get('/cartremove-{ind}',    'FrontendController@removefromcart')->name('cart.remove');
    Route::get('/cart',     'FrontendController@cart')->name('cart');
    Route::post('/cart',    'FrontendController@cart')->name('cart.post');
    Route::get('/checkout', 'FrontendController@checkout')->middleware('auth')->name('checkout');
    Route::get('/makeorder', 'FrontendController@makeorder')->middleware('auth')->name('makeorder');

    Route::get('time', 'FrontendController@time')->name('time');;

    //Artisan commands
    Route::get('art-{act}', 'ArtisanController@index')->name('artisan');;

    // Index
    Route::get('/', 'FrontendController@index')->name('index');;
    // Contact
    Route::get('contact', 'ContactController@index')->name('contact');
    Route::post('contact', 'ContactController@store')->name('contact.post');
    // Compare
    Route::get('compare', 'FrontendController@compare')->name('compare');;
    // Compare
    Route::get('search', 'FrontendController@search')->name('search');;
    // Ajax
    Route::post('ajax-{act}','Frontend\AjaxController@index')->where(['act' => '[A-Za-z]+'])->name('ajax.act');
    Route::get('ajax-{act}','Frontend\AjaxController@index')->where(['act' => '[A-Za-z]+'])->name('ajax.get.act');

    // User authh routes
    Auth::routes();
    Route::get('/users/logout', 'Auth\LoginController@userLogout')->name('user.logout');
    Route::get('/user', 'UserController@index')->name('user.account');
    Route::get('/user-whishlist', 'UserController@whishlist')->name('user.whishlist');



    //Auth::routes();
    Route::get('/users/logout', 'Auth\LoginController@userLogout')->name('user.logout');
    Route::get('/user', 'UserController@index')->name('user.account');
    Route::get('/user-whishlist', 'UserController@whishlist')->name('user.whishlist');

    Route::get('/user-data', 'UserController@data')->name('user.data');
    Route::post('/user-data', 'UserController@storedata')->name('user.storedata');
    Route::get('/user-pass', 'UserController@pass')->name('user.pass');
    Route::post('/user-pass', 'UserController@storepass')->name('user.storepass');
    Route::get('/user-email', 'UserController@email')->name('user.email');
    Route::post('/user-email', 'UserController@storeemail')->name('user.storeemail');
    Route::get('/user-addresses', 'UserController@addresses')->name('user.addresses');
    Route::get('/user-address', 'UserController@address')->name('user.address');
    Route::post('/user-address', 'UserController@storeaddress')->name('user.storeaddress');
    Route::get('/user-orders', 'UserController@orders')->name('user.orders');
    Route::get('/user-order-{orderid}', 'UserController@order')->name('user.order');

    Route::get('{slug}', 'FrontendController@router')->name('router');
    Route::get('/{cslug}/{bslug}', 'FrontendController@categoryBrand')->name('catbrand');

});

// SR Frontend routes
Route::group(['as'=>'en.'], function(){

    // Frontend routes
    Route::get('/cartremove-{ind}',    'FrontendController@removefromcart')->name('cart.remove');
    Route::get('/cart',     'FrontendController@cart')->name('cart');
    Route::post('/cart',    'FrontendController@cart')->name('cart.post');
    Route::get('/checkout', 'FrontendController@checkout')->middleware('auth')->name('checkout');
    Route::get('/makeorder', 'FrontendController@makeorder')->middleware('auth')->name('makeorder');

    Route::get('time', 'FrontendController@time')->name('time');;

    //Artisan commands
    Route::get('art-{act}', 'ArtisanController@index')->name('artisan');;

    // Index
    Route::get('/', 'FrontendController@index')->name('index');;
    // Contact
    Route::get('contact', 'ContactController@index')->name('contact');
    Route::post('contact', 'ContactController@store')->name('contact.post');
    // Compare
    Route::get('compare', 'FrontendController@compare')->name('compare');;
    // Compare
    Route::get('search', 'FrontendController@search')->name('search');;
    // Ajax
    Route::post('ajax-{act}','Frontend\AjaxController@index')->where(['act' => '[A-Za-z]+'])->name('ajax.act');
    Route::get('ajax-{act}','Frontend\AjaxController@index')->where(['act' => '[A-Za-z]+'])->name('ajax.get.act');

    // User authh routes
    Auth::routes();
    Route::get('/users/logout', 'Auth\LoginController@userLogout')->name('user.logout');
    Route::get('/user', 'UserController@index')->name('user.account');
    Route::get('/user-whishlist', 'UserController@whishlist')->name('user.whishlist');



    //Auth::routes();
    Route::get('/users/logout', 'Auth\LoginController@userLogout')->name('user.logout');
    Route::get('/user', 'UserController@index')->name('user.account');
    Route::get('/user-whishlist', 'UserController@whishlist')->name('user.whishlist');

    Route::get('/user-data', 'UserController@data')->name('user.data');
    Route::post('/user-data', 'UserController@storedata')->name('user.storedata');
    Route::get('/user-pass', 'UserController@pass')->name('user.pass');
    Route::post('/user-pass', 'UserController@storepass')->name('user.storepass');
    Route::get('/user-email', 'UserController@email')->name('user.email');
    Route::post('/user-email', 'UserController@storeemail')->name('user.storeemail');
    Route::get('/user-addresses', 'UserController@addresses')->name('user.addresses');
    Route::get('/user-address', 'UserController@address')->name('user.address');
    Route::post('/user-address', 'UserController@storeaddress')->name('user.storeaddress');
    Route::get('/user-orders', 'UserController@orders')->name('user.orders');
    Route::get('/user-order-{orderid}', 'UserController@order')->name('user.order');

    Route::get('{slug}', 'FrontendController@router')->name('router');
    Route::get('/{cslug}/{bslug}', 'FrontendController@categoryBrand')->name('catbrand');

});

/*// Frontend routes
Route::get('/cartremove-{ind}',    'FrontendController@removefromcart')->name('cart.remove');
Route::get('/cart',     'FrontendController@cart')->name('cart');
Route::post('/cart',    'FrontendController@cart')->name('cart.post');
Route::get('/checkout', 'FrontendController@checkout')->middleware('auth')->name('checkout');
Route::get('/makeorder', 'FrontendController@makeorder')->middleware('auth')->name('makeorder');

Route::get('time', 'FrontendController@time')->name('time');;

//Artisan commands
Route::get('art-{act}', 'ArtisanController@index')->name('artisan');;

// Index
Route::get('/', 'FrontendController@index')->name('index');;
// Contact
Route::get('contact', 'ContactController@index')->name('contact');
Route::post('contact', 'ContactController@store')->name('contact.post');
// Compare
Route::get('compare', 'FrontendController@compare')->name('compare');;
// Compare
Route::get('search', 'FrontendController@search')->name('search');;
// Ajax
Route::post('ajax-{act}','Frontend\AjaxController@index')->where(['act' => '[A-Za-z]+'])->name('ajax.act');
Route::get('ajax-{act}','Frontend\AjaxController@index')->where(['act' => '[A-Za-z]+'])->name('ajax.get.act');

// User authh routes
Auth::routes();
Route::get('/users/logout', 'Auth\LoginController@userLogout')->name('user.logout');
Route::get('/user', 'UserController@index')->name('user.account');
Route::get('/user-whishlist', 'UserController@whishlist')->name('user.whishlist');



//Auth::routes();
Route::get('/users/logout', 'Auth\LoginController@userLogout')->name('user.logout');
Route::get('/user', 'UserController@index')->name('user.account');
Route::get('/user-whishlist', 'UserController@whishlist')->name('user.whishlist');

Route::get('/user-data', 'UserController@data')->name('user.data');
Route::post('/user-data', 'UserController@storedata')->name('user.storedata');
Route::get('/user-pass', 'UserController@pass')->name('user.pass');
Route::post('/user-pass', 'UserController@storepass')->name('user.storepass');
Route::get('/user-email', 'UserController@email')->name('user.email');
Route::post('/user-email', 'UserController@storeemail')->name('user.storeemail');
Route::get('/user-addresses', 'UserController@addresses')->name('user.addresses');
Route::get('/user-address', 'UserController@address')->name('user.address');
Route::post('/user-address', 'UserController@storeaddress')->name('user.storeaddress');
Route::get('/user-orders', 'UserController@orders')->name('user.orders');
Route::get('/user-order-{orderid}', 'UserController@order')->name('user.order');


Route::get('cart',     'FrontendController@cart')->name('cart');
Route::post('/cart',    'FrontendController@cart')->name('cart.post');
Route::get('/checkout', 'FrontendController@checkout')->middleware('auth')->name('checkout');
Route::get('/makeorder', 'FrontendController@makeorder')->middleware('auth')->name('makeorder');

Route::get('{slug}', 'FrontendController@router')->name('router');
Route::get('/{cslug}/{bslug}', 'FrontendController@categoryBrand')->name('catbrand');*/