<?php

use Illuminate\Support\Facades\Route;

Route::prefix('sprava')
    ->middleware('web')
    ->namespace('Seka\Portal\Modul\Terminy\Http\Controllers')
    ->name('modul.terminy.')
    ->group(function () {
        Route::prefix('terminy')
            ->namespace('Backend')
            ->middleware(['auth', 'permission:terminy'])
            ->name('backend.')
            ->group(function () {
                Route::get('/', 'TerminyController@index')
                    ->name('index');

                Route::prefix('udalosti')
                    ->namespace('Udalosti')
                    ->name('udalosti.')
                    ->group(function () {
                        Route::get('/', 'UdalostiController@index')
                            ->name('index');
                        Route::get('nova', 'UdalostiController@create')
                            ->name('udalost.create');

                        Route::prefix('{mtUdalostId}')
                            ->name('udalost.')
                            ->group(function () {
                                Route::get('upravit', 'UdalostiController@edit')
                                    ->name('edit');

                            Route::prefix('registracie')
                                ->name('registracie.')
                                ->group(function () {
                                    Route::get('/', 'RegistracieUdalostiController@index')
                                        ->name('index');
                                    Route::get('/export', 'RegistracieUdalostiController@export')
                                        ->name('export');
                                    Route::delete('{mtRegistraciaId}', 'RegistracieUdalostiController@delete')
                                        ->name('delete');
                                });

                            Route::prefix('moznosti')
                                ->name('moznosti.')
                                ->group(function () {
                                    Route::get('/', 'MoznostiUdalostiController@index')
                                        ->name('index');
                                });
                        });
                    });

                Route::prefix('adresar')
                    ->namespace('Adresar')
                    ->name('adresar.')
                    ->group(function () {
                        Route::get('/', 'AdresarController@index')
                            ->name('index');
                        Route::get('nove', 'AdresarController@create')
                            ->name('miesto.create');
                        Route::prefix('{mtMiestoKonaniaId}')
                            ->group(function () {
                                Route::get('upravit', 'AdresarController@edit')
                                    ->name('miesto.edit');
                            });
                    });

                Route::prefix('moznosti')
                    ->namespace('MoznostiUdalosti')
                    ->name('moznostiUdalosti.')
                    ->group(function () {
                        Route::get('/', 'MoznostiUdalostiController@index')
                            ->name('index');
                        Route::get('nove', 'MoznostiUdalostiController@create')
                            ->name('moznost.create');
                        Route::prefix('{mtMoznostUdalostiId}')
                            ->group(function () {
                                Route::get('upravit', 'MoznostiUdalostiController@edit')
                                    ->name('moznost.edit');
                            });
                    });
            });
    });
