<?php

/* AUTH */
Auth::routes();

/* HOMEPAGE */
Route::get('home', 'HomeController@index');
Route::get('/', 'HomeController@index');

/* NAVIGATION BAR ----------------------------------------------------------------------------------------------------*/
Route::get('filtering', 'FilteringController@index');                                               // SHOW FILTERING INDEX
Route::get('more_info', 'MoreInfoController@index');                                                // SHOW MORE INFO INDEX

/* GENERAL ADMINISTRATION NAVIGATION BAR -----------------------------------------------------------------------------*/
Route::get('change_password','ChangePasswordController@index')->middleware('auth');                 // SHOW CHANGE PASSWORD INDEX
Route::get('change_email','ChangeEmailController@index')->middleware('auth');                       // SHOW CHANGE EMAIL INDEX
Route::get('delete_account','DeleteAccountController@index')->middleware('auth');                   // SHOW DELETE ACCOUNT INDEX

Route::post('/change_password', ['uses' => 'ChangePasswordController@changeUserPassword', 'as' => 'changeUserPassword'])->middleware('auth');
Route::post('/change_email', ['uses' => 'ChangeEmailController@changeUserEmail', 'as' => 'changeUserEmail'])->middleware('auth');
Route::post('/delete_account', ['uses' => 'DeleteAccountController@deleteAccount', 'as' => 'deleteAccount'])->middleware('auth');
/* ACCOMMODATION ADMINISTRATION NAVIGATION BAR -----------------------------------------------------------------------*/

Route::get('edit_acco','AccoAdministrationController@showEditAcco')->middleware('auth');            // SHOW FORM FOR ACCO EDITATION
Route::get('edit_rooms','AccoAdministrationController@showEditRooms')->middleware('auth');          // SHOW ALL ROOMS IN ACCO

/* RESERVATIONS */
Route::get('/reservations_list', 'ReservationController@showReservationList')->middleware('auth');  // SHOW LIST OF RESERVATIONS
Route::post('/delete_reservation/{reservation_id}',['uses'=> 'ReservationController@deleteReservation', 'as' => 'deleteReservation'])->middleware('auth');      // DELETE RESERVATION
Route::post('/confirm_reservation/{reservation_id}',['uses'=> 'ReservationController@confirmReservation', 'as' => 'confirmReservation'])->middleware('auth');   // CONFIRM RESERVATION

/* RESERVATIONS */
Route::get('create_reservation/{room}', 'ReservationController@showCreateReservation');
Route::post('create_reservation/creating', ['uses' => 'ReservationController@createReservation', 'as' => 'createReservation']);
Route::post('create_reservation', ['uses' => 'ReservationController@chooseRoom', 'as' => 'chooseRoom']);
Route::get('edit_reservation/{reservation_id}','ReservationController@showEditReservation')->middleware('auth');
Route::post('reservations_list', ['uses' => 'ReservationController@editReservation', 'as' => 'editReservation'])->middleware('auth');

/* CREATE ACCOMMODATION */
Route::get('/new_acco', 'NewAccoController@index')->middleware('auth');                                                             // SHOW NEW ACCOMMODATION FORM INDEX
Route::post('/edit_rooms', ['uses' => 'NewAccoController@storeAccommodation', 'as' => 'storeAccommodation'])->middleware('auth');   // CREATE NEW ACCOMMODATION

/* ACCOMMODATION DETAIL */
Route::get('detail/{accommodation}', 'DetailController@index');

/* REVIEWS */
Route::get('reviews_list/{accommodation}', 'ReviewsController@index');
Route::get('create_review/{accomodation}', ['uses' => 'ReviewsController@showCreateReview', 'as' => 'showCreateReview']);
Route::post('reviews_list/{accommodation}', ['uses' => 'ReviewsController@createReview', 'as' => 'createReview']);
Route::delete('reviews_list/{accommodation_id}',['uses'=>'ReviewsController@deleteReview','as'=>'deleteReview']);

/* CREATE A NEW ROOM */
Route::get('/new_room', 'NewRoomController@index')->middleware('auth')->middleware('auth');                         // SHOW NEW ROOM FORM INDEX
Route::post('/home', ['uses' => 'NewRoomController@storeRoom', 'as' => 'storeRoom'])->middleware('auth');           // CREATE NEW ROOM

/* ACCOMMODATION EDIT */
Route::post('/edit_acco', ['uses' => 'AccoAdministrationController@editAcco', 'as' => 'editAcco'])->middleware('auth');
Route::post('/edit_room', ['uses' => 'AccoAdministrationController@editRoom', 'as' => 'editRoom'])->middleware('auth');
Route::post('/edit_room/{room_id}',['uses' => 'AccoAdministrationController@showEditRoom', 'as' => 'showEditRoom'])->middleware('auth');        // SHOW EDIT FORM OF ROOM
Route::post('/edits_room',['uses' => 'AccoAdministrationController@deleteRoom', 'as' => 'deleteRoom'])->middleware('auth');                     // ACTION DElETE ROOM
Route::get('acco_admin_list','AccoAdminsController@showList')->middleware('auth');
Route::get('add_acco_admin', ['uses' => 'AccoAdminsController@showAddAccoAdmin', 'as' => 'showAddAccoAdmin'])->middleware('auth');
Route::post('add_acco_admin', ['uses' => 'AccoAdminsController@addAccoAdmin', 'as' => 'addAccoAdmin'])->middleware('auth');
Route::post('acco_admin_list', ['uses' => 'AccoAdminsController@deleteAccoAdmin', 'as' => 'deleteAccoAdmin'])->middleware('auth');
Route::get('customers_list','CustomersController@showCustomers')->middleware('auth');

/* FILTERING */
Route::post('/filtering', ['uses' => 'FilteringController@getResults', 'as' => 'getResults']);

/* ADMIN PART - ----- ------------------------------------------------------------------------------------------------*/
Route::get('/acco_list', 'AdminController@showAccommodations')->middleware('auth');
Route::post('/permissionOK/{accommodation_id}', ['uses' => 'AdminController@permissionOK', 'as' => 'permissionOK'])->middleware('auth');
Route::post('/permissionKO/{accommodation_id}', ['uses' => 'AdminController@permissionKO', 'as' => 'permissionKO'])->middleware('auth');
Route::post('/delete_user/{user_id}',['uses'=> 'AdminController@deleteUser', 'as' => 'deleteUser']);

