<?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('/', function () {
    return view('welcome');
});

Auth::routes();

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

Route::get('/counties', 'CountyController@index')->name('index')->middleware('verify.role');
Route::post('/county/save', 'CountyController@save')->name('save')->middleware('verify.role');
Route::post('/counties/search', 'CountyController@search')->name('search')->middleware('verify.role');
Route::get('/county/edit/{id}', 'CountyController@edit')->name('edit')->middleware('verify.role');
Route::post('/county/del', 'CountyController@del')->name('del')->middleware('verify.role');

Route::get('/categories', 'CategoryController@index')->name('index')->middleware('verify.role');
Route::post('/category/save', 'CategoryController@save')->name('save')->middleware('verify.role');
Route::post('/categories/search', 'CategoryController@search')->name('search')->middleware('verify.role');
Route::get('/category/edit/{id}', 'CategoryController@edit')->name('edit')->middleware('verify.role');
Route::post('/category/del', 'CategoryController@del')->name('del')->middleware('verify.role');

Route::get('/subcategories', 'SubCategoryController@index')->name('index')->middleware('verify.role');
Route::post('/subcategory/save', 'SubCategoryController@save')->name('save')->middleware('verify.role');
Route::post('/subcategories/search', 'SubCategoryController@search')->name('search')->middleware('verify.role');
Route::get('/subcategory/edit/{id}', 'SubCategoryController@edit')->name('edit')->middleware('verify.role');
Route::post('/subcategory/del', 'SubCategoryController@del')->name('del')->middleware('verify.role');

Route::get('/constituencies', 'ConstituencyController@index')->name('index')->middleware('verify.role');
Route::post('/constituency/save', 'ConstituencyController@save')->name('save')->middleware('verify.role');
Route::post('/constituencies/search', 'ConstituencyController@search')->name('search')->middleware('verify.role');
Route::get('/constituency/edit/{id}', 'ConstituencyController@edit')->name('edit')->middleware('verify.role');
Route::post('/constituency/del', 'ConstituencyController@del')->name('del')->middleware('verify.role');

Route::get('/countyassemblies', 'CountyAssemblyController@index')->name('index')->middleware('verify.role');
Route::post('/countyassembly/save', 'CountyAssemblyController@save')->name('save')->middleware('verify.role');
Route::post('/countyassemblies/search', 'CountyAssemblyController@search')->name('search')->middleware('verify.role');
Route::get('/countyassembly/edit/{id}', 'CountyAssemblyController@edit')->name('edit')->middleware('verify.role');
Route::post('/countyassembly/del', 'CountyAssemblyController@del')->name('del')->middleware('verify.role');


Route::get('/institutions', 'InstitutionController@index')->name('index')->middleware('verify.role');
Route::post('/institution/save', 'InstitutionController@save')->name('save')->middleware('verify.role');
Route::post('/institutions/search', 'InstitutionController@search')->name('search')->middleware('verify.role');
Route::get('/institution/edit/{id}', 'InstitutionController@edit')->name('edit')->middleware('verify.role');
Route::post('/institution/del', 'InstitutionController@del')->name('del')->middleware('verify.role');

Route::get('/financialyears', 'FinancialYearController@index')->name('index')->middleware('verify.role');
Route::post('/financialyear/save', 'FinancialYearController@save')->name('save')->middleware('verify.role');
Route::post('/financialyears/search', 'FinancialYearController@search')->name('search')->middleware('verify.role');
Route::get('/financialyear/edit/{id}', 'FinancialYearController@edit')->name('edit')->middleware('verify.role');
Route::post('/financialyear/del', 'FinancialYearController@del')->name('del')->middleware('verify.role');

Route::get('/users', 'UserController@index')->name('index')->middleware('verify.role');
Route::post('/user/save', 'UserController@save')->name('save')->middleware('verify.role');
Route::post('/users/search', 'UserController@search')->name('search')->middleware('verify.role');
Route::get('/user/edit/{id}', 'UserController@edit')->name('edit')->middleware('verify.role');
Route::post('/user/del', 'UserController@del')->name('del')->middleware('verify.role');

Route::get('/userroles', 'UserRoleController@index')->name('index')->middleware('verify.role');
Route::post('/userrole/save', 'UserRoleController@save')->name('save')->middleware('verify.role');
Route::post('/userroles/search', 'UserRoleController@search')->name('search')->middleware('verify.role');
Route::get('/userrole/edit/{id}', 'UserRoleController@edit')->name('edit')->middleware('verify.role');
Route::post('/userrole/del', 'UserRoleController@del')->name('del')->middleware('verify.role');

Route::get('/questionnaireparts', 'QuestionnairePartController@index')->name('index')->middleware('verify.role');
Route::post('/questionnairepart/save', 'QuestionnairePartController@save')->name('save')->middleware('verify.role');
Route::post('/questionnaireparts/search', 'QuestionnairePartController@search')->name('search')->middleware('verify.role');
Route::get('/questionnairepart/edit/{id}', 'QuestionnairePartController@edit')->name('edit')->middleware('verify.role');
Route::post('/questionnairepart/del', 'QuestionnairePartController@del')->name('del')->middleware('verify.role');

Route::get('/questionnairesections', 'QuestionnaireSectionController@index')->name('index')->middleware('verify.role');
Route::post('/questionnairesection/save', 'QuestionnaireSectionController@save')->name('save')->middleware('verify.role');
Route::post('/questionnairesections/search', 'QuestionnaireSectionController@search')->name('search')->middleware('verify.role');
Route::get('/questionnairesection/edit/{id}', 'QuestionnaireSectionController@edit')->name('edit')->middleware('verify.role');
Route::post('/questionnairesection/del', 'QuestionnaireSectionController@del')->name('del')->middleware('verify.role');

Route::get('/circulars', 'SrcCircularController@index')->name('index')->middleware('verify.role');
Route::post('/circular/save', 'SrcCircularController@save')->name('save')->middleware('verify.role');
Route::post('/circulars/search', 'SrcCircularController@search')->name('search')->middleware('verify.role');
Route::get('/circular/edit/{id}', 'SrcCircularController@edit')->name('edit')->middleware('verify.role');
Route::post('/circular/del', 'SrcCircularController@del')->name('del')->middleware('verify.role');

Route::get('/questionnaire', 'QuestionnaireController@index')->name('index')->middleware('verify.role');
Route::post('/questionnaire/save', 'QuestionnaireController@save')->name('save')->middleware('verify.role');
Route::post('/questionnaire/search', 'QuestionnaireController@search')->name('search')->middleware('verify.role');
Route::get('/questionnaire/edit/{id}', 'QuestionnaireController@edit')->name('edit')->middleware('verify.role');
Route::post('/questionnaire/del', 'QuestionnaireController@del')->name('del')->middleware('verify.role');
Route::get('/questionnaire/view/{id}', 'QuestionnaireController@view')->name('view')->middleware('verify.role');
Route::get('/questionnaire/preview', 'QuestionnaireController@preview')->name('preview')->middleware('verify.role');
Route::post('/questionnaire/years', 'QuestionnaireController@financialYears')->name('years')->middleware('verify.role');

Route::post('/subquestionnaire/save', 'SubQuestionnaireController@save')->name('save')->middleware('verify.role');
Route::post('/subquestionnaire/save_sub', 'SubQuestionnaireController@save_sub')->name('save_sub')->middleware('verify.role');
Route::get('/subquestionnaire/edit/{id}', 'SubQuestionnaireController@edit')->name('edit')->middleware('verify.role');
Route::post('/subquestionnaire/del', 'SubQuestionnaireController@del')->name('del')->middleware('verify.role');
Route::get('/subquestionnaire/view/{id}', 'SubQuestionnaireController@view')->name('view')->middleware('verify.role');

Route::get('/stakeholders', 'StakeholdersController@index')->name('index')->middleware('user.role');
Route::get('/stakeholders/questionnaire', 'StakeholdersController@questionnaire')->name('questionnaire')->middleware('user.role');
Route::post('/stakeholders/questionnaire/save', 'StakeholdersController@save')->name('save')->middleware('user.role');
Route::get('/stakeholders/questionnaire/review', 'StakeholdersController@review')->name('review')->middleware('user.role');

Route::get('/dashboard', 'ReportsController@index')->name('index')->middleware('verify.role');

Route::get('/access/denied', 'HomeController@accessDenied')->name('accessDenied');