<?php

namespace Modules\Admin\Config;

use Config;
// Create a new instance of our RouteCollection class.
$routes = Config\Services::routes();

// Load the system's routing file first, so that the app and ENVIRONMENT
// can override as needed.
if (is_file(SYSTEMPATH . 'Config/Routes.php')) {
    require SYSTEMPATH . 'Config/Routes.php';
}


//setting up Inventory routes.
$routes->group('administrator', ['filter' => ['isLoggedIn' , 'checkPermission'], 'namespace' => 'Modules\Admin\Controllers'],   static function($routes){
 

    $routes->get('/', 'Dashboard::index');
    $routes->get('my-profile', 'Dashboard::userProfile');
    $routes->post('my-profile/update', 'Dashboard::updateUserProfile');
    $routes->post('password/update', 'Dashboard::updateUserPwd');


    $routes->get('users', 'AdminUsers::index');
    $routes->get('users/list', 'AdminUsers::usersList');
    $routes->get('users/add', 'AdminUsers::addUser');
    $routes->post('users/add', 'AdminUsers::addUser');
    $routes->get('users/edit/(:any)', 'AdminUsers::editUser/$1');
    $routes->post('users/update', 'AdminUsers::updateUser');
    $routes->get('users/delete/(:any)', 'AdminUsers::deleteUser/$1');
    $routes->post('users/change/password', 'AdminUsers::changePwd');
    $routes->post('users/change/group', 'AdminUsers::changeGroup');

});

//Administrator settings not affected by permissions
$routes->group('administrator', ['filter' => 'isLoggedIn', 'namespace' => 'Modules\Admin\Controllers'],   static function($routes){
 

    $routes->get('notifications', 'Notifications::index');
    $routes->get('notifications/list', 'Notifications::getNotificationsList');
    $routes->post('notifications/status/(:num)', 'Notifications::status/$1');

    $routes->get('hits', 'Dashboard::view_hit_count');
});

