<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
 error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING);


Route::get('/welcome',  'ReservationsController@cancelFromMail');

Route::auth();

$this->any('register', 'Auth\AuthController@register');

Route::group(['prefix' =>'/api'], function () {

	Route::get('/', [
		'uses' => 'CronController@index'
	]);

	Route::get('/checkReservations24h', [
		'uses' => 'CronController@checkReservations24h'
	]);

	Route::get('/checkSend30min', [
		'uses' => 'CronController@checkSend30min'
	]);

	Route::get('/mail-test', [
		'uses' => 'CronController@mailTest'
	]);

	Route::get('/checkReservationHasPass', [
		'uses' => 'CronController@checkReservationHasPass'
	]);

	Route::get('/sendReminders', [
		'uses' => 'CronController@sendReminders'
	]);

	Route::get('/checkSend', [
		'uses' => 'CronController@checkSend'
	]);

	Route::get('/cancelReservation', [
		'uses' => 'ReservationsController@cancelFromMail'
	]);

	Route::get('/confirmReservation', [
		'uses' => 'ReservationsController@confirmFromMail'
	]);



});

Route::get('/logout', 'UserController@logout');

Route::get('/', 'HomeController@index');
//pusher
Route::get('users/event-user', 'UserController@user');

Route::get('calendar', 'CalendarController@index');

Route::post('calendar', [
	'as' => 'calendar',
	'uses' => 'CalendarController@index'
]);
Route::post('calendarchangeuserboat', 'CalendarController@boat');

//Autocomplete
Route::get('autocomplete/customers', 'AutoCompleteController@customers');
Route::get('autocomplete/reservationsusers', 'AutoCompleteController@reservationsusers');
Route::get('autocomplete/departments', 'AutoCompleteController@departments');
Route::get('autocomplete/designation_items', 'AutoCompleteController@designation_items');
Route::get('autocomplete/document_types', 'AutoCompleteController@document_types');
Route::get('autocomplete/roles', 'AutoCompleteController@roles');

//Route::resource('boats', 'BoatController');
Route::get('boats/deleted', 'BoatController@deletedIndex');
Route::get('boats/deleted/{boat}/restore', 'BoatController@restore');
Route::get('boats', 'BoatController@index');
Route::get('boats/search', 'BoatController@search');
Route::get('boats/create', 'BoatController@create');
Route::post('boats', 'BoatController@store');
Route::get('boats/{boat}', 'BoatController@show');
Route::get('boats/{boat}/edit', 'BoatController@edit');
Route::patch('boats/{boat}', 'BoatController@update');
Route::delete('boats/{boat}', 'BoatController@destroy');


//Route::resource('boats', 'BoatController');
Route::get('ports', 'PortController@index');
Route::get('ports/search', 'PortController@search');
Route::get('ports/create', 'PortController@create');
Route::post('ports', 'PortController@store');
Route::get('ports/{port}', 'Portontroller@show');
Route::get('ports/{port}/edit', 'PortController@edit');
Route::patch('ports/{port}', 'PortController@update');
Route::delete('ports/{port}', 'PortController@destroy');

//Route::resource('incidences', 'IncidencesController');
Route::get('incidences', 'IncidenceController@index');
Route::get('incidences/search', 'IncidenceController@search');
Route::get('incidences/create', 'IncidenceController@create');
Route::post('incidences', 'IncidenceController@store');
Route::get('incidences/markasread/{incidence}', 'IncidenceController@markIncidence');
Route::get('incidences/{incidences}', 'IncidenceController@show');
Route::get('incidences/{incidences}/edit', 'IncidenceController@edit');
Route::patch('incidences/{incidences}', 'IncidenceController@update');
Route::delete('incidences/{incidences}', 'IncidenceController@destroy');

//Route::resource('festives', 'FestiveController');
Route::get('festives', 'FestiveController@index');
Route::get('festives/search', 'FestiveController@search');
Route::get('festives/create', 'FestiveController@create');
Route::post('festives', 'FestiveController@store');
Route::get('festives/{festive}', 'FestiveController@show');
Route::get('festives/{festive}/edit', 'FestiveController@edit');
Route::patch('festives/{festive}', 'FestiveController@update');
Route::delete('festives/{festive}', 'FestiveController@destroy');

//Route::resource('credits', 'FestiveController');
Route::get('credits', 'CreditController@index');
Route::get('credits/search', 'CreditController@search');
Route::get('credits/create', 'CreditController@create');
Route::get('credits/{customer}/listado', 'CreditController@listado');
Route::get('credits/{customer}/assign', 'CreditController@assign');
Route::get('credits/{customer}/dispo', 'CreditController@dispo');
Route::post('credits', 'CreditController@store');
Route::get('credits/{credit}', 'CreditController@show');
Route::get('credits/{credit}/edit', 'CreditController@edit');
Route::patch('credits/{credit}', 'CreditController@update');
Route::delete('credits/{credit}', 'CreditController@destroy');

//Route::resource('global', 'FestiveController');
Route::get('global', 'GlobalPreferenceController@index');
Route::get('global/search', 'GlobalPreferenceController@search');
Route::post('global', 'GlobalPreferenceController@store');
Route::get('global/{global}', 'GlobalPreferenceController@show');
Route::get('global/{global}/edit', 'GlobalPreferenceController@edit');
Route::patch('global/{global}', 'GlobalPreferenceController@update');
Route::delete('global/{global}', 'GlobalPreferenceController@destroy');

//Route::resource('bank-accounts', 'BankAccountController');
Route::get('bank-accounts', 'BankAccountController@index');
Route::get('bank-accounts/search', 'BankAccountController@search');
Route::get('bank-accounts/create', 'BankAccountController@create');
Route::post('bank-accounts', 'BankAccountController@store');
Route::get('bank-accounts/{bank_account}', 'BankAccountController@show');
Route::get('bank-accounts/{bank_account}/edit', 'BankAccountController@edit');
Route::patch('bank-accounts/{bank_account}', 'BankAccountController@update');
Route::delete('bank-accounts/{bank_account}', 'BankAccountController@destroy');

//Route::resource('reservations', 'ReservationsController');
Route::get('reservations', 'ReservationsController@index');
Route::get('reservations/search', 'ReservationsController@search');
Route::get('reservations/create', 'ReservationsController@create');
Route::post('reservations', 'ReservationsController@store'); //HERE CREATE RESERVATION
// Route::post('reservations/searching', ['as' => 'busqueda','uses' => 'ReservationsController@busqueda']);
Route::get('reservations/searching', ['as' => 'busqueda','uses' => 'ReservationsController@busqueda']);
// Route::post('reservations/searching', 'ReservationsController@busqueda');
Route::post('calendar/store', ['as' => 'storecalendar','uses' => 'ReservationsController@store']);
Route::get('reservations/{reservation}', 'ReservationsController@show');
Route::patch('reservations/{reservation}', 'ReservationsController@update'); //HERE UPDATE RESERVATION
Route::post('reservations/{reservation}/save', 'ReservationsController@update');
Route::get('reservations/{reservation}/edit', 'ReservationsController@edit');
Route::get('reservations/{reservation}/checkin', 'ReservationsController@checkin');
Route::get('reservations/{reservation}/checkin/group', 'ReservationsController@checkinGroup');
Route::post('reservations/{reservation}/savecheckin', 'ReservationsController@savecheckin');
//Route::post('reservations/{reservation}/update', 'ReservationsController@update');
Route::get('reservations/{reservation}/checkout', 'ReservationsController@checkout');
Route::get('reservations/{reservation}/checkout/group', 'ReservationsController@checkoutGroup');
Route::post('reservations/{reservation}/savecheckout', 'ReservationsController@savecheckout');
Route::delete('reservations/{reservation}', 'ReservationsController@destroy');
Route::post('changeuserboat', 'ReservationsController@boat');
Route::post('changeuserboattimer', 'ReservationsController@timer');
Route::get('reservationscalendar/', [
	'as' => 'reservations',
	'uses' => 'ReservationsController@calendar'
]);
Route::get('reservations/cancel', 'ReservationsController@cancel');
Route::post('reservations/confirmation', 'ReservationsController@confirmation');
Route::post('reservations/cancelation', 'ReservationsController@cancellation');
Route::post('reservations/cancel/group', 'ReservationsController@cancellationGroup');
Route::post('reservations/confirm/group', 'ReservationsController@confirmationGroup');

// Route::post('reservations/getCredits', 'ReservationsController@getCredits');

//Route::resource('documents', 'DocumentController');
Route::get('documents', 'DocumentController@index');
Route::get('documents/search', 'DocumentController@search');
Route::get('documents/create', 'DocumentController@create');
Route::post('documents', 'DocumentController@store');
Route::get('documents/{document}', 'DocumentController@show');
Route::get('documents/{document}/edit', 'DocumentController@edit');
Route::patch('documents/{document}', 'DocumentController@update');
Route::delete('documents/{document}', 'DocumentController@destroy');

//Route::resource('downloads', 'DownloadController');
Route::get('downloads', 'DownloadController@index');
Route::get('downloads/search', 'DownloadController@search');
Route::get('downloads/create', 'DownloadController@create');
Route::post('downloads', 'DownloadController@store');
Route::get('downloads/{download}', 'DownloadController@show');
Route::get('downloads/{download}/edit', 'DownloadController@edit');
Route::patch('downloads/{download}', 'DownloadController@update');
Route::delete('downloads/{download}', 'DownloadController@destroy');

//Route::resource('document-types', 'DocumentTypeController');
Route::get('document-types', 'DocumentTypeController@index');
Route::get('document-types/search', 'DocumentTypeController@search');
Route::get('document-types/create', 'DocumentTypeController@create');
Route::post('document-types', 'DocumentTypeController@store');
Route::get('document-types/{document_type}', 'DocumentTypeController@show');
Route::get('document-types/{document_type}/edit', 'DocumentTypeController@edit');
Route::patch('document-types/{document_type}', 'DocumentTypeController@update');
Route::delete('document-types/{document_type}', 'DocumentTypeController@destroy');

//Route::resource('events', 'EventController');
Route::get('events', 'EventController@index');
Route::get('events/search', 'EventController@search');
Route::get('events/create', 'EventController@create');
Route::post('events', 'EventController@store');
Route::get('events/{event}', 'EventController@show');
Route::get('events/{event}/edit', 'EventController@edit');
Route::patch('events/{event}', 'EventController@update');
Route::delete('events/{event}', 'EventController@destroy');

//Route::resource('blocks', 'BlockController');
Route::get('blocks/{boat}/listado', 'BlockController@index');
Route::get('blocks/{boat}/create', 'BlockController@create');
Route::post('blocks', 'BlockController@store');
Route::delete('blocks/{block}/', 'BlockController@destroy');

//Route::resource('notices', 'NoticeController');
Route::get('notices', 'NoticeController@index');
Route::get('notices/search', 'NoticeController@search');
Route::get('notices/create', 'NoticeController@create');
Route::post('notices', 'NoticeController@store');
Route::get('notices/{notice}', 'NoticeController@show');
Route::get('notices/{notice}/edit', 'NoticeController@edit');
Route::patch('notices/{notice}', 'NoticeController@update');
Route::delete('notices/{notice}', 'NoticeController@destroy');

//Route::resource('links', 'LinkController');
Route::get('links', 'LinkController@index');
Route::get('links/search', 'LinkController@search');
Route::get('links/create', 'LinkController@create');
Route::post('links', 'LinkController@store');
Route::get('links/{link}', 'LinkController@show');
Route::get('links/{link}/edit', 'LinkController@edit');
Route::patch('links/{link}', 'LinkController@update');
Route::delete('links/{link}', 'LinkController@destroy');

//Route::resource('answers', 'AnswerController');
Route::get('answers', 'AnswerController@index');
Route::get('answers/search', 'AnswerController@search');
Route::get('answers/create', 'AnswerController@create');
Route::post('answers', 'AnswerController@store');
Route::get('answers/{answer_id}', 'AnswerController@show');
Route::get('answers/{answer_id}/edit', 'AnswerController@edit');
Route::patch('answers/{link}', 'AnswerController@update');
Route::delete('answers/{answer}', 'AnswerController@destroy');
Route::get('answers/{question_id}/create', 'AnswerController@create');


//Route::resource('questions', 'QuestionController');
Route::get('questions', 'QuestionController@index');
Route::get('questions/search', 'QuestionController@search');
Route::get('questions/create', 'QuestionController@create');
Route::post('questions', 'QuestionController@store');
Route::get('questions/{id}', 'QuestionController@show');
Route::get('questions/{question}/edit', 'QuestionController@edit');
Route::post('questions/answers', 'AnswerController@index');
Route::get('questions/{question_id}/answers', 'AnswerController@index');
Route::patch('questions/{link}', 'QuestionController@update');
Route::delete('questions/{question}', 'QuestionController@destroy');



//Route::resource('inspection', 'InspectionController');
Route::get('inspection', 'InspectionController@index');
Route::get('inspection/search', 'InspectionController@search');
Route::get('inspection/create', 'InspectionController@create');
Route::post('inspection', 'InspectionController@store');
Route::get('inspection/{link}', 'InspectionController@show');
Route::get('inspection/{link}/edit', 'InspectionController@edit');
Route::patch('inspection/{link}', 'InspectionController@update');
Route::delete('inspection/{link}', 'InspectionController@destroy');


//Route::resource('roles', 'RoleController');
Route::get('roles', 'RoleController@index');
Route::get('roles/search', 'RoleController@search');
Route::get('roles/create', 'RoleController@create');
Route::post('roles', 'RoleController@store');
Route::get('roles/{role}', 'RoleController@show');
Route::get('roles/{role}/edit', 'RoleController@edit');
Route::patch('roles/{role}', 'RoleController@update');
Route::delete('roles/{role}', 'RoleController@destroy');

//Route::resource('users', 'UserController');
Route::get('users', 'UserController@index');
Route::get('users/search', 'UserController@search');
Route::get('users/create', 'UserController@create');
Route::post('users', 'UserController@store');
Route::get('users/{user}', 'UserController@show');
Route::get('users/{user}/edit', 'UserController@edit');
Route::patch('users/{user}', 'UserController@update');
Route::delete('users/{user}', 'UserController@destroy');

//Route::resource('companies', 'CustomerController');
Route::get('companies', 'CustomerController@index');
Route::get('companies/create', 'CustomerController@create');
Route::post('companies', 'CustomerController@store');
Route::get('companies/{customer}', 'CustomerController@show');
Route::get('companies/{customer}/edit', 'CustomerController@edit');
Route::patch('companies/{customer}', 'CustomerController@update');
Route::delete('companies/{customer}', 'CustomerController@destroy');

//Route::resource('customers', 'PotentialCustomerController');
Route::get('customers', 'PotentialCustomerController@index');
Route::get('customers/search', 'PotentialCustomerController@search');
Route::get('customers/create', 'PotentialCustomerController@create');
Route::post('customers', 'PotentialCustomerController@store');
Route::get('customers/{user}', 'PotentialCustomerController@show');
Route::get('customers/{user}/edit', 'PotentialCustomerController@edit');
Route::get('customers/{user}/assign', 'PotentialCustomerController@assign');
Route::patch('customers/{customer}', 'PotentialCustomerController@update');
Route::delete('customers/{customer}', 'PotentialCustomerController@destroy');

//Route::resource('credituser', 'CreditUserController');
Route::get('users/{user}/credit', 'CreditUserController@index');
Route::get('credituser/create', 'CreditUserController@create');
Route::get('credituser/{credituser}/edit', 'CreditUserController@edit');
Route::patch('credituser/{credituser}', 'CreditUserController@update');
Route::delete('credituser/{credituser}', 'CreditUserController@destroy');

Route::post('users/{user}/credits', 'CreditRegisterController@store');

//Route::resource('creditregister', 'CreditRegisterController');
Route::get('creditregister/index', 'CreditRegisterController@index');

Route::get('users/{user}/boats/create', 'BoatController@create');
Route::post('users/{user}/boats', 'BoatController@store');

Route::get('users/{user}/documents/create', 'DocumentController@create');
Route::post('users/{user}/documents', 'DocumentController@store');
Route::get('companies/{customer}/bank-account/create', 'BankAccountController@create');
Route::post('companies/{customer}/bank-account', 'BankAccountController@store');
Route::get('companies/{customer}/bank-account/{bank_account}/edit', 'BankAccountController@edit');
Route::patch('companies/{customer}/bank-account/{bank_account}', 'BankAccountController@update');
