<?php

use Illuminate\Support\Facades\Route;
use App\Http\Controllers\dashboard\Analytics;
use App\Http\Controllers\layouts\WithoutMenu;
use App\Http\Controllers\layouts\WithoutNavbar;
use App\Http\Controllers\layouts\Fluid;
use App\Http\Controllers\layouts\Container;
use App\Http\Controllers\layouts\Blank;
use App\Http\Controllers\pages\AccountSettingsAccount;
use App\Http\Controllers\pages\AccountSettingsNotifications;
use App\Http\Controllers\pages\AccountSettingsConnections;
use App\Http\Controllers\pages\MiscError;
use App\Http\Controllers\pages\MiscUnderMaintenance;
use App\Http\Controllers\authentications\LoginBasic;
use App\Http\Controllers\authentications\RegisterBasic;
use App\Http\Controllers\authentications\ForgotPasswordBasic;
use App\Http\Controllers\cards\CardBasic;
use App\Http\Controllers\user_interface\Accordion;
use App\Http\Controllers\user_interface\Alerts;
use App\Http\Controllers\user_interface\Badges;
use App\Http\Controllers\user_interface\Buttons;
use App\Http\Controllers\user_interface\Carousel;
use App\Http\Controllers\user_interface\Collapse;
use App\Http\Controllers\user_interface\Dropdowns;
use App\Http\Controllers\user_interface\Footer;
use App\Http\Controllers\user_interface\ListGroups;
use App\Http\Controllers\user_interface\Modals;
use App\Http\Controllers\user_interface\Navbar;
use App\Http\Controllers\user_interface\Offcanvas;
use App\Http\Controllers\user_interface\PaginationBreadcrumbs;
use App\Http\Controllers\user_interface\Progress;
use App\Http\Controllers\user_interface\Spinners;
use App\Http\Controllers\user_interface\TabsPills;
use App\Http\Controllers\user_interface\Toasts;
use App\Http\Controllers\user_interface\TooltipsPopovers;
use App\Http\Controllers\user_interface\Typography;
use App\Http\Controllers\extended_ui\PerfectScrollbar;
use App\Http\Controllers\extended_ui\TextDivider;
use App\Http\Controllers\icons\Boxicons;
use App\Http\Controllers\form_elements\BasicInput;
use App\Http\Controllers\form_elements\InputGroups;
use App\Http\Controllers\form_layouts\VerticalForm;
use App\Http\Controllers\form_layouts\HorizontalForm;
use App\Http\Controllers\tables\Basic as TablesBasic;
use App\Http\Controllers\users\UserController;
use App\Http\Controllers\users\PermissionController;
use App\Http\Controllers\users\RoleController;
use App\Http\Controllers\subcounty\SubCountyController;
use App\Http\Controllers\ward\WardController;
use App\Http\Controllers\zone\ZoneController;
use App\Http\Controllers\revenuelocation\RevenueLocationController;
use App\Http\Controllers\department\DepartmentController;
use App\Http\Controllers\category\CategoryController;
use App\Http\Controllers\revenuestreams\RevenueStreamsController;
use App\Http\Controllers\financebills\FinanceBillsController;
use App\Http\Controllers\activitylogs\ActivityLogsController;
use App\Http\Controllers\suggestedamendments\SuggestedAmendmentsController;
use App\Http\Controllers\dashboard\DashboardController;
use App\Http\Controllers\proposals\ProposalsController;
use App\Http\Controllers\suggestedproposalamendments\SuggestedProposalAmendmentsController;

Route::get("/", function(){
   return redirect('/admin/financebills');
});

Livewire::setUpdateRoute(function ($handle) {
return Route::post('/kcofbms/public/livewire/update', $handle);
});
	
	Route::group(['prefix'=>'admin'], function() {
	
	//Route::group(['middleware' => ['auth','role:super-admin'], 'prefix'=>'super-admin'], function() {
		
	Route::get('dashboard', [DashboardController::class, 'index'])->name('admin.dashboard');
	Route::get('subcounties', [SubCountyController::class, 'index'])->name('admin.subcounties');
	Route::get('wards', [WardController::class, 'index'])->name('admin.wards');
	Route::get('revenuelocations', [RevenueLocationController::class, 'index'])->name('admin.revenuelocations');
	Route::get('zones', [ZoneController::class, 'index'])->name('admin.zones');
	Route::get('departments', [DepartmentController::class, 'index'])->name('admin.departments');
	Route::get('revenuecategories', [CategoryController::class, 'index'])->name('admin.revenuecategories');
	Route::get('revenuestreams', [RevenueStreamsController::class, 'index'])->name('admin.revenuestreams');
	Route::get('financebills', [FinanceBillsController::class, 'index'])->name('admin.financebills');
	Route::get('financebills/{financebillid}/suggestedamendments', [SuggestedAmendmentsController::class, 'index'])->name('admin.financebills.suggestedamendments');
	Route::get('financebills/{financebillid}/proposals', [ProposalsController::class, 'index'])->name('admin.financebills.proposals');
	Route::get('activitylog', [ActivityLogsController::class, 'index'])->name('admin.activitylogs');
	Route::get('proposals/{proposalid}/suggestedamendments', [SuggestedProposalAmendmentsController::class, 'index'])->name('admin.proposals.suggestedamendments');
	
	
    Route::post('permissions/updatepermission', [PermissionController::class, 'updatepermission'])->name('permissions.updatepermission');
	Route::resource('permissions', PermissionController::class)->name('index','admin.users.permissions.index');
    Route::get('permissions/{permissionId}/delete', [PermissionController::class, 'destroy']);

    Route::post('roles/updaterole', [RoleController::class, 'updaterole'])->name('roles.updaterole');
	Route::resource('roles', RoleController::class)->name('index','admin.users.roles.index');
    Route::get('roles/{roleId}/delete', [RoleController::class, 'destroy']);
    Route::get('roles/{roleId}/give-permissions', [RoleController::class, 'addPermissionToRole']);
    Route::put('roles/{roleId}/give-permissions', [RoleController::class, 'givePermissionToRole']);

    Route::get('users/activate/{userId}', [UserController::class, 'activate']);
	Route::get('users/deactivate/{userId}', [UserController::class, 'deactivate']);
	Route::post('users/updateuser', [UserController::class, 'updateuser'])->name('admin.users.updateuser');
	Route::resource('users', UserController::class);
    Route::get('users/{userId}/delete', [UserController::class, 'destroy']);
	Route::get('users', [UserController::class, 'index'])->name('admin.users.index');
	Route::post('getUsers', [UserController::class, 'getUsers'])->name('admin.users.getUsers');
	Route::get('changepassword', [DashboardController::class, 'changepassword']);
	Route::post('updatepassword', [DashboardController::class, 'updatepassword'])->name('updatepassword');

	//});

}); //prefix=>admin

// Main Page Route
Route::get('/h', [Analytics::class, 'index'])->name('dashboard-analytics');

// layout
Route::get('/layouts/without-menu', [WithoutMenu::class, 'index'])->name('layouts-without-menu');
Route::get('/layouts/without-navbar', [WithoutNavbar::class, 'index'])->name('layouts-without-navbar');
Route::get('/layouts/fluid', [Fluid::class, 'index'])->name('layouts-fluid');
Route::get('/layouts/container', [Container::class, 'index'])->name('layouts-container');
Route::get('/layouts/blank', [Blank::class, 'index'])->name('layouts-blank');

// pages
Route::get('/pages/account-settings-account', [AccountSettingsAccount::class, 'index'])->name('pages-account-settings-account');
Route::get('/pages/account-settings-notifications', [AccountSettingsNotifications::class, 'index'])->name('pages-account-settings-notifications');
Route::get('/pages/account-settings-connections', [AccountSettingsConnections::class, 'index'])->name('pages-account-settings-connections');
Route::get('/pages/misc-error', [MiscError::class, 'index'])->name('pages-misc-error');
Route::get('/pages/misc-under-maintenance', [MiscUnderMaintenance::class, 'index'])->name('pages-misc-under-maintenance');

// authentication
Route::get('/auth/login-basic', [LoginBasic::class, 'index'])->name('auth-login-basic');
Route::get('/auth/register-basic', [RegisterBasic::class, 'index'])->name('auth-register-basic');
Route::get('/auth/forgot-password-basic', [ForgotPasswordBasic::class, 'index'])->name('auth-reset-password-basic');

// cards
Route::get('/cards/basic', [CardBasic::class, 'index'])->name('cards-basic');

// User Interface
Route::get('/ui/accordion', [Accordion::class, 'index'])->name('ui-accordion');
Route::get('/ui/alerts', [Alerts::class, 'index'])->name('ui-alerts');
Route::get('/ui/badges', [Badges::class, 'index'])->name('ui-badges');
Route::get('/ui/buttons', [Buttons::class, 'index'])->name('ui-buttons');
Route::get('/ui/carousel', [Carousel::class, 'index'])->name('ui-carousel');
Route::get('/ui/collapse', [Collapse::class, 'index'])->name('ui-collapse');
Route::get('/ui/dropdowns', [Dropdowns::class, 'index'])->name('ui-dropdowns');
Route::get('/ui/footer', [Footer::class, 'index'])->name('ui-footer');
Route::get('/ui/list-groups', [ListGroups::class, 'index'])->name('ui-list-groups');
Route::get('/ui/modals', [Modals::class, 'index'])->name('ui-modals');
Route::get('/ui/navbar', [Navbar::class, 'index'])->name('ui-navbar');
Route::get('/ui/offcanvas', [Offcanvas::class, 'index'])->name('ui-offcanvas');
Route::get('/ui/pagination-breadcrumbs', [PaginationBreadcrumbs::class, 'index'])->name('ui-pagination-breadcrumbs');
Route::get('/ui/progress', [Progress::class, 'index'])->name('ui-progress');
Route::get('/ui/spinners', [Spinners::class, 'index'])->name('ui-spinners');
Route::get('/ui/tabs-pills', [TabsPills::class, 'index'])->name('ui-tabs-pills');
Route::get('/ui/toasts', [Toasts::class, 'index'])->name('ui-toasts');
Route::get('/ui/tooltips-popovers', [TooltipsPopovers::class, 'index'])->name('ui-tooltips-popovers');
Route::get('/ui/typography', [Typography::class, 'index'])->name('ui-typography');

// extended ui
Route::get('/extended/ui-perfect-scrollbar', [PerfectScrollbar::class, 'index'])->name('extended-ui-perfect-scrollbar');
Route::get('/extended/ui-text-divider', [TextDivider::class, 'index'])->name('extended-ui-text-divider');

// icons
Route::get('/icons/boxicons', [Boxicons::class, 'index'])->name('icons-boxicons');

// form elements
Route::get('/forms/basic-inputs', [BasicInput::class, 'index'])->name('forms-basic-inputs');
Route::get('/forms/input-groups', [InputGroups::class, 'index'])->name('forms-input-groups');

// form layouts
Route::get('/form/layouts-vertical', [VerticalForm::class, 'index'])->name('form-layouts-vertical');
Route::get('/form/layouts-horizontal', [HorizontalForm::class, 'index'])->name('form-layouts-horizontal');

// tables
Route::get('/tables/basic', [TablesBasic::class, 'index'])->name('tables-basic');

//users


//Auth::routes();
Route::group(['prefix' => 'auth'], function(){
    Auth::routes();
});

Route::get('/home', [App\Http\Controllers\HomeController::class, 'index'])->name('home');
