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

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

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

    Route::group(['namespace' => 'Web', 'middleware' => ['checkWebSiteEnabled', 'WebsiteVisitorCount']], function () {
        //Home
        /*Route::get('my-test', function () {
            dd(getAmountDetails(87));
        });*/
        // Route::get('/test-phone/{phone}', 'HomeController@testPhone');
        // Route::get('/test', 'HomeController@test');
        Route::get('/cron', 'CronController@cron');
        Route::get('saveOrderTest/{id}','OrderController@saveOrderTest');
        // Route::get('testPayment','HomeController@testPayment');
        // Route::get('/cron3', 'CronController@cron');
        // Route::get('/senderName', 'HomeController@senderName');
        Route::get('/', 'HomeController@index')->name('web.home');
        Route::get('/aboutus', 'PageController@aboutus')->name('web.aboutus');
        Route::get('/terms', 'PageController@terms')->name('web.terms');
        Route::get('/contactus', 'PageController@contactus')->name('web.contactus');
        Route::post('/contactus', 'PageController@contact')->name('web.contactus.action');

        Route::resource('/product', 'MenuController')->only('index','show');
        Route::get('/menu', 'MenuController@menu')->name('web.menu');
        Route::resource('/room', 'RoomController')->only('index','show');
        Route::group(['middleware' => ['GuestAuth']], function () {
            Route::get('/login', 'AuthController@login')->name('web.login');
            Route::post('/login', 'AuthController@check')->name('web.login.check');
            Route::get('/code', 'AuthController@code')->name('web.code');
            Route::post('/code', 'AuthController@codeCheck')->name('web.code.check');
        });
        Route::group(['middleware' => ['AuthLogin']], function () {
            Route::get('/logout', 'AuthController@logout')->name('web.logout');
            Route::get('/profile', 'AuthController@profile')->name('web.profile');
            Route::get('/order/{id}', 'AuthController@orderDetails')->name('web.order.show');
            Route::group(['prefix' => 'reservation'], function () {
                Route::get('/', 'ReservationController@reservation')->name('web.reservation');
                Route::get('/continue', 'ReservationController@continue')->name('web.reservation.continue');
                Route::post('/pay', 'ReservationController@pay')->name('web.reservation.pay');
                Route::get('/status', 'ReservationController@paymentStatus')->name('web.reservation.status');

                // Route::get('calculate','ReservationController@calculate')->name('web.reservation.calculate');
                //Ajax
                Route::get('/time', 'ReservationController@timeReservation')->name('web.time.reservation');
                Route::get('/bill', 'ReservationController@bill')->name('web.reservation.bill');
            });

            Route::resource('cart', 'CartController')->except('show','create','edit');
            Route::get('cart/calculate','CartController@calculate')->name('cart.calculate');
            Route::get('cartCount','CartController@cartCount')->name('cartCount');

            Route::group(['prefix' => 'order'], function () {
                Route::post('/', 'OrderController@order')->name('web.order');
            });
                Route::get('statusPayment/order', 'OrderController@paymentStatus')->name('web.order.status');

        });

    });
});
