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

Route::get('/', function () {
    return view('depot');
});



Route::get('/dokumentacja', function(){
    return view('documents');
});

Route::resource('pdfController', 'pdfController');

Route::get('/straznica', function(){
    return view('depot');
});


Route::get('/pojazdy', function(){
    return view('vehicles');
});

Route::get('/wyjazdy', 'operationsController@create');
Route::get('/wyjazdy/add/', 'operationsController@addForm');
Route::post('/wyjazdy', 'operationsController@store')->name('operationController.store');
Route::post('/wyjazdy/edit/', 'operationsController@update')->name('operationController.update');
Route::get('/wyjazdy/edit/{id}', 'operationsController@editForm');
Route::delete('wyjazdy/{id}', 'operationsController@destroy')->name('operationController.destroy');
Route::post('wyjazdy/pdf/single/', 'operationsController@createSingleOperationPDF')->name('operations.singlePDF');
Route::post('wyjazdy/pdf/all/', 'operationsController@createAllOperationsPDF')->name('operations.allPDF');

Route::get('/register', 'RegistrationController@create');
Route::post('/register', 'RegistrationController@store');



Route::get('/login', 'SessionsController@create');
Route::post('/login', 'SessionsController@store');
Route::get('/logout', 'SessionsController@destroy');


Route::get('/strazacy', 'fireFightersController@create');
Route::get('/strazacy/add', 'fireFightersController@addForm');
Route::post('/strazacy', 'fireFightersController@store');
Route::get('/strazacy/edit/{id}', 'fireFightersController@editForm');
Route::post('/strazacy/edit', 'fireFightersController@update');
Route::post('/strazacy/pdf/single', 'fireFightersController@createSingleFireFighterPDF')->name('fireFighters.pdfSingle');
Route::post('/strazacy/pdf/all', 'fireFightersController@CreateAllFireFightersPDF')->name('fireFighters.pdfAll');
Route::post('strazacy/activate', 'fireFightersController@activate');
Route::post('strazacy/deactivate', 'fireFightersController@deactivate');


Route::get('/strazacy/odznaczenia/{id}', 'DecorationsController@create');
Route::post('/strazacy/odznaczenia/{id}', 'DecorationsController@store');
Route::resource('decorations', 'DecorationsController');
Route::delete('/strazacy/odznaczenia/delete/{id}', 'DecorationsController@destroy')->name('DecorationsController.destroy');

Route::get('/jednostka', 'fireStationController@create');
Route::post('/jednostka', 'fireStationController@store');
Route::get('/jednostka/edit', 'fireStationController@editForm');
Route::post('/jednostka/edit', 'fireStationController@update');
Route::post('/jednostka/pdf/single', 'fireStationController@createSingleUnitPDF')->name('fireStation.singlePDF');

Route::get('/jednostka/getcounties/{id}','DataController@getCounties');
Route::get('/jednostka/getcommunities/{id}','DataController@getCommunities');

Route::get('/pojazdy', 'VehiclesController@create');
Route::get('/pojazdy/add', 'VehiclesController@addForm');
Route::post('/pojazdy', 'VehiclesController@store');
Route::get('/pojazdy/edit/{id}', 'VehiclesController@editForm');
Route::post('/pojazdy/edit', 'VehiclesController@update');
Route::resource('vehicles', 'VehiclesController');
Route::post('pojazdy/activate', 'VehiclesController@activate');
Route::post('pojazdy/deactivate', 'VehiclesController@deactivate');
Route::delete('pojazdy/{id}', 'VehiclesController@destroy')->name('VehiclesController.destroy');
Route::post('/pojazdy/pdf/all', 'VehiclesController@createAllVehiclesPDF')->name('vehicles.pdfALL');
Route::post('/pojazdy/pdf/single', 'VehiclesController@createSingleVehiclePDF')->name('vehicles.pdfSingle');

Route::get('/sprzet', 'EquipmentController@create');
Route::get('/sprzet/add', 'EquipmentController@addForm');
Route::post('/sprzet', 'EquipmentController@store');
Route::get('/sprzet/edit/{id}', 'EquipmentController@editForm');
Route::post('/sprzet/edit', 'EquipmentController@update');
Route::resource('equipment', 'EquipmentController');
Route::delete('sprzet/{id}', 'EquipmentController@destroy')->name('EquipmentController.destroy');
Route::post('/sprzet/pdf/all', 'EquipmentController@createAllEquipmentPDF')->name('equipment.pdfALL');

Route::get('/szkolenia', 'trainingsController@create');
Route::post('/szkolenia', 'trainingsController@store');
Route::post('/szkolenia/rename', 'trainingsController@trainingsRename');
Route::get('/szkolenia/addTrainingsFireFighters/{id}', 'trainingsController@addTrainingsFireFighters');
Route::post('/szkolenia/addTrainingsFireFighters/', 'trainingsController@ajaxRequest');
Route::post('/szkolenia/addTrainingsFireFighters/delete', 'trainingsController@deleteFireFighterTrainings');
Route::delete('szkolenia/{id}', 'trainingsController@destroy')->name('trainingsController.destroy');
Route::post('/szkolenia/pdf/all', 'trainingsController@createAllTrainingsPDF')->name('trainings.pdfALL');
Route::post('/szkolenia/pdf/single', 'trainingsController@createSingleTrainingPDF')->name('trainings.pdfSingle');
Route::resource('trainings', 'trainingsController');

Route::get('/userprofile', 'userProfileController@create');
Route::get('/userprofile/edit', 'userProfileController@editForm');
Route::post('/userprofile/edit', 'userProfileController@update');
Route::get('/userprofile/passwordchange', 'ChangePasswordController@create');
Route::post('/userprofile/passwordchange', 'ChangePasswordController@update');
Route::get('/userprofile/szkolenia', 'userProfileController@userTrainings');
Route::get('/userprofile/odznaczenia', 'userProfileController@userDecorations');


Route::get('register/verify/{confirmationCode}', [
    'as' => 'confirmation_path',
    'uses' => 'RegistrationController@confirm'
]);

//Auth::routes();
//
//Route::get('/home', 'HomeController@index')->name('home');

Route::post('/pdf/sprzet', 'pdfController@createViewEquipment');
Route::get('/pdf/wniosek', 'pdfController@createViewDecoration');
Route::post('/pdf/strazacy', 'pdfController@createViewFireFighters');

Route::get('/forgottenPassword', 'resetPasswordController@create');
Route::post('/forgottenPassword', 'resetPasswordController@reset');
