<?php

namespace Config;

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

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

/*
 * --------------------------------------------------------------------
 * Router Setup
 * --------------------------------------------------------------------
 */
$routes->setDefaultNamespace('App\Controllers');
$routes->setDefaultController('Home');
$routes->setDefaultMethod('index');
$routes->setTranslateURIDashes(false);
if (ENVIRONMENT != 'development') {
    $routes->set404Override(function () {
        return view('Utils/404');
    });
}
$routes->setAutoRoute(false);

/*
 * --------------------------------------------------------------------
 * Route Definitions
 * --------------------------------------------------------------------
 */

// We get a performance increase by specifying the default
// route since we don't have to scan directories.


$routes->group('', ['namespace' => MOBILE_NAMESPACE], function ($routes) {
    $routes->get('/', 'Dashboard::index', ['filter' => 'mlogin']);
    //utils
    $routes->group('utils', ['namespace' => MOBILE_NAMESPACE . '\Utils'], function ($routes) {
        $routes->get('sidebar', 'Sidebar::index', ['filter' => 'mlogin']);
        $routes->get('logActivity', 'LogActivity::index', ['filter' => 'mlogin']);
    });


    $routes->get('/shortcut', 'Dashboard::shortcut');
    $routes->get('/osc', 'Dashboard::osc');
    //auth
    $routes->group('login', ['namespace' => MOBILE_NAMESPACE . "\Auth"], function ($routes) {
        $routes->get('/', 'Login::index');
        $routes->post('/', 'Login::check');
    });
    $routes->get('/logout', 'Auth\Logout::index');
    $routes->group('daily-presence', function ($routes) {
        $routes->group('map', ['namespace' => MOBILE_NAMESPACE . "\DailyPresence"], function ($routes) {
            $routes->get('/', 'Map::index', ['filter' => 'mlogin']);
            $routes->get('rekap', 'Map::rekap', ['filter' => 'mlogin']);
            $routes->get('config', 'Map::config', ['filter' => 'mlogin']);
            $routes->post('present', 'Map::present', ['filter' => 'mlogin']);
            $routes->post('presentQR', 'QR::present', ['filter' => 'mlogin']);
        });
    });
    $routes->group('approvals', ['namespace' => MOBILE_NAMESPACE . "\Approvals"], function ($routes) {
        $routes->get('/', 'Main::index', ['filter' => 'mlogin']);
        $routes->group('presence', function ($routes) {
            $routes->get('/', 'Presence::index', ['filter' => 'mlogin']);
            $routes->get('all', 'Presence::all', ['filter' => 'mlogin']);
            $routes->post('add', 'Presence::add', ['filter' => 'mlogin']);
            $routes->get('detail/(:num)', 'Presence::detail/$1', ['filter' => 'mlogin']);
            $routes->patch('cancel/(:num)', 'Presence::cancel/$1', ['filter' => 'mlogin']);
            $routes->post('imageUploader', 'Presence::imageUploader', ['filter' => 'mlogin']);
        });
    });
    $routes->group('kelas', ['namespace' => MOBILE_NAMESPACE . "\Kelas"], function ($routes) {
        $routes->group('jadwal', ['namespace' => MOBILE_NAMESPACE . "\Kelas"], function ($routes) {
            $routes->get('/', 'Jadwal::index', ['filter' => 'mlogin']);
            $routes->get('all', 'Jadwal::all', ['filter' => 'mlogin']);
        });
        $routes->group('materi', ['namespace' => MOBILE_NAMESPACE . "\Kelas"], function ($routes) {
            $routes->get('(:hash)', 'Materi::index/$1', ['filter' => 'mlogin']);
            $routes->get('(:hash)/all', 'Materi::all/$1', ['filter' => 'mlogin']);
            $routes->patch('(:hash)/viewing/(:num)', 'Materi::viewing/$1/$2', ['filter' => 'mlogin']);
        });
        $routes->group('tugas', ['namespace' => MOBILE_NAMESPACE . "\Kelas"], function ($routes) {
            $routes->get('(:hash)', 'Tugas::index/$1', ['filter' => 'mlogin']);
            $routes->get('(:hash)/all', 'Tugas::all/$1', ['filter' => 'mlogin']);
            $routes->patch('(:hash)/save/(:hash)', 'Tugas::save/$1/$2', ['filter' => 'mlogin']);
            $routes->post('(:hash)/file/(:hash)', 'Tugas::file/$1/$2', ['filter' => 'mlogin']);
            $routes->delete('(:hash)/file/(:hash)', 'Tugas::delete_file/$1/$2', ['filter' => 'mlogin']);
        });
        $routes->group('diskusi', ['namespace' => MOBILE_NAMESPACE . "\Kelas"], function ($routes) {
            $routes->get('(:hash)', 'Diskusi::index/$1', ['filter' => 'mlogin']);
            $routes->put('(:hash)/add', 'Diskusi::add/$1', ['filter' => 'mlogin']);
            $routes->get('(:hash)/init', 'Diskusi::init/$1', ['filter' => 'mlogin']);
            $routes->get('(:hash)/newest', 'Diskusi::newest/$1', ['filter' => 'mlogin']);
            $routes->get('(:hash)/oldest', 'Diskusi::oldest/$1', ['filter' => 'mlogin']);
            $routes->post('(:hash)/imageUploader', 'Diskusi::imageUploader', ['filter' => 'mlogin']);
            $routes->delete('(:hash)/delete/(:hash)', 'Diskusi::delete/$1/$2', ['filter' => 'mlogin']);
        });
    });
    $routes->group('ujian', ['namespace' => MOBILE_NAMESPACE . "\Ujian"], function ($routes) {
        $routes->group('jadwal', ['namespace' => MOBILE_NAMESPACE . "\Ujian\Jadwal"], function ($routes) {
            $routes->get('/', 'Overview::index', ['filter' => 'mlogin']);
            $routes->get('all', 'Overview::all', ['filter' => 'mlogin']);
            $routes->group('confirm', ['namespace' => MOBILE_NAMESPACE . "\Ujian\Jadwal"], function ($routes) {
                $routes->get('(:hash)', 'Overview::confirm/$1', ['filter' => 'mlogin']);
                $routes->post('(:hash)', 'Overview::verify_token/$1', ['filter' => 'mlogin']);
            });
        });
        $routes->get('(:hash)', 'Ujian::index/$1', ['filter' => 'mlogin']);
        $routes->get('(:hash)/soal-answered', 'Ujian::soalAnswered/$1', ['filter' => 'mlogin']);
        $routes->get('(:hash)/config', 'Ujian::config/$1', ['filter' => 'mlogin']);
        $routes->get('(:hash)/soals', 'Ujian::soals/$1', ['filter' => 'mlogin']);
        $routes->put('(:hash)/hc', 'Ujian::hc/$1', ['filter' => 'mlogin']);
        $routes->put('(:hash)/soals', 'Ujian::save_soals/$1', ['filter' => 'mlogin']);
        $routes->get('(:hash)/soal/(:num)', 'Ujian::soal/$1/$2', ['filter' => 'mlogin']);
        $routes->put('(:hash)/soal/(:num)', 'Ujian::save_soal/$1/$2', ['filter' => 'mlogin']);
        $routes->post('(:hash)/imageUploader', 'Ujian::imageUploader/$1', ['filter' => 'mlogin']);
        $routes->get('(:hash)/soal/all', 'Ujian::soal_all/$1', ['filter' => 'mlogin']);
        $routes->get('(:hash)/finish', 'Ujian::finish/$1', ['filter' => 'mlogin']);
        $routes->get('(:hash)/point', 'Ujian::point/$1', ['filter' => 'mlogin']);
    });
    $routes->group('profile', function ($routes) {
        $routes->get('/', 'Profile::index', ['filter' => 'mlogin']);
        $routes->get('me', 'Profile::me', ['filter' => 'mlogin']);
        $routes->put('/', 'Profile::save', ['filter' => 'mlogin']);
        $routes->post('photo', 'Profile::photo', ['filter' => 'mlogin']);
    });
    $routes->group('pengumuman', function ($routes) {
        $routes->get('/', 'Pengumuman::index', ['filter' => 'mlogin']);
        $routes->get('all', 'Pengumuman::all', ['filter' => 'mlogin']);
    });
    $routes->get('offline', 'Pages\Offline::index');
    $routes->get('clock-error', 'Pages\ClockError::index');
    $routes->get('maintenance', 'Pages\Maintenance::index');
});

$routes->get('vdtg', 'API\V2\VDTG::index');
$routes->group('api', ['namespace' => API_NAMESPACE], function ($routes) {
    $routes->post('whatsapp-hook',  'V2\WhatsappHook::index');
    $routes->post('presence-rf',  'V1\PresenceRF::index');
    $routes->post('presence-rf/scanner',  'V1\PresenceRF::scanner');
    $routes->get('presence-reminder/(:hash)/staff/masuk',  'V1\PresenceReminder::index/$1/staff/masuk');
    $routes->get('presence-reminder/(:hash)/siswa/masuk',  'V1\PresenceReminder::index/$1/siswa/masuk');
    $routes->get('presence-reminder/(:hash)/staff/keluar',  'V1\PresenceReminder::index/$1/staff/keluar');
    $routes->get('presence-reminder/(:hash)/siswa/keluar',  'V1\PresenceReminder::index/$1/siswa/keluar');
});
$routes->group('exambro', ['namespace' => API_NAMESPACE . '\\V3\\'], function ($routes) {
    $routes->get('credentials', 'ExamBro::getCredentials');
    $routes->get('unlock-app', 'ExamBro::unlockApp');
    $routes->get('blocked-apps', 'ExamBro::blockedApps');
    $routes->get('exam-config/(:hash)', 'ExamBro::examConfig/$1');
});
$routes->group('panel', ['namespace' => PANEL_NAMESPACE], function ($routes) {

    //dashboard
    $routes->group('dashboard', function ($routes) {
        $routes->get('/', 'Dashboard::index', ['filter' => 'prole:admin,kepsek']);
    });
    //profile
    $routes->group('profile', ['namespace' => PANEL_NAMESPACE . '\Profile'], function ($routes) {
        $routes->get('', 'Main::index', ['filter' => 'plogin']);
        $routes->group('me', ['namespace' => PANEL_NAMESPACE . '\Profile'], function ($routes) {
            $routes->get('', 'Me::index', ['filter' => 'plogin']);
            $routes->put('about', 'Me::about', ['filter' => 'plogin']);
            $routes->put('name', 'Me::name', ['filter' => 'plogin']);
            $routes->put('password', 'Me::password', ['filter' => 'plogin']);
            $routes->post('cover', 'Me::image/cover', ['filter' => 'plogin']);
            $routes->post('photo', 'Me::image/photo', ['filter' => 'plogin']);
        });
    });
    //profile
    $routes->group('exambro', ['namespace' => PANEL_NAMESPACE . '\Exambro'], function ($routes) {
        $routes->group('settings', ['namespace' => PANEL_NAMESPACE . '\Exambro'], function ($routes) {
            $routes->get('', 'Settings::index', ['filter' => 'prole:admin']);
            $routes->get('data', 'Settings::data', ['filter' => 'prole:admin']);
            $routes->post('/', 'Settings::save', ['filter' => 'prole:admin']);
        });
        $routes->group('blocked-apps', ['namespace' => PANEL_NAMESPACE . '\Exambro'], function ($routes) {
            $routes->get('/', 'BlockedApps::index', ['filter' => 'prole:admin']);
            $routes->get('all', 'BlockedApps::all', ['filter' => 'prole:admin']);
            $routes->post('add', 'BlockedApps::add', ['filter' => 'prole:admin']);
            $routes->get('detail/(:any)', 'BlockedApps::detail/$1', ['filter' => 'prole:admin']);
            $routes->delete('delete/(:any)', 'BlockedApps::delete/$1', ['filter' => 'prole:admin']);
            $routes->put('edit/(:any)', 'BlockedApps::edit/$1', ['filter' => 'prole:admin']);
        });
    });
    //conversations
    $routes->group('conversations', ['namespace' => PANEL_NAMESPACE . '\Conversations'], function ($routes) {
        $routes->get('config', 'Main::config', ['filter' => 'plogin']);
        $routes->get('chat-list', 'Main::chat_list', ['filter' => 'plogin']);
        $routes->get('init/(:hash)', 'Main::init/$1', ['filter' => 'plogin']);
        $routes->get('users', 'Main::users', ['filter' => 'plogin']);
        $routes->post('create', 'Main::create', ['filter' => 'plogin']);
        $routes->put('add/(:hash)', 'Main::add/$1', ['filter' => 'plogin']);
        $routes->get('newest/(:hash)/(:hash)', 'Main::newest/$1/$2', ['filter' => 'plogin']);
        $routes->get('oldest/(:hash)/(:hash)', 'Main::oldest/$1/$2', ['filter' => 'plogin']);
        $routes->put('imageUploader', 'Main::imageUploader', ['filter' => 'plogin']);
        $routes->delete('out/(:hash)', 'Main::out/$1', ['filter' => 'plogin']);
        $routes->delete('delete/(:hash)/(:hash)', 'Main::delete/$1/$2', ['filter' => 'plogin']);
    });

    $routes->get('osc', 'Dashboard::osc');
    $routes->get('announcement', 'Dashboard::announcement', ['filter' => 'prole:guru,pengawas,piket']);
    $routes->get('announcement/all', 'Dashboard::announcement_all', ['filter' => 'prole:guru,pengawas,piket']);
    //app
    $routes->group('app', ['namespace' => PANEL_NAMESPACE . '\App'], function ($routes) {
        $routes->group('settings', ['namespace' => PANEL_NAMESPACE . '\App\Settings'], function ($routes) {

            $routes->group('general', function ($routes) {
                $routes->get('', 'General::index', ['filter' => 'prole:admin']);
                $routes->get('data', 'General::data', ['filter' => 'prole:admin']);
                $routes->post('data', 'General::save', ['filter' => 'prole:admin']);
            });
            $routes->group('servers', function ($routes) {
                $routes->get('', 'Servers::index', ['filter' => 'prole:admin']);
                $routes->get('all', 'Servers::all', ['filter' => 'prole:admin']);
                $routes->get('(:num)', 'Servers::detail/$1', ['filter' => 'prole:admin']);
                $routes->patch('(:num)', 'Servers::edit/$1', ['filter' => 'prole:admin']);
                $routes->delete('(:num)', 'Servers::delete/$1', ['filter' => 'prole:admin']);
                $routes->post('', 'Servers::add', ['filter' => 'prole:admin']);
            });
            $routes->group('updates', ['namespace' => PANEL_NAMESPACE . '\App\Settings\Updates'], function ($routes) {
                $routes->get('', 'Main::index', ['filter' => 'prole:admin']);
                $routes->post('patch', 'Patch::index', ['filter' => 'prole:admin']);
                $routes->get('state', 'Main::state', ['filter' => 'prole:admin']);
                $routes->get('check', 'Main::check', ['filter' => 'prole:admin']);
                $routes->post('do', 'Main::do', ['filter' => 'prole:admin']);
            });
            $routes->group('backup-restore', ['namespace' => PANEL_NAMESPACE . '\App\Settings\BackupRestore'], function ($routes) {
                $routes->get('', 'Main::index', ['filter' => 'prole:admin']);
                $routes->get('backup', 'Backup::index', ['filter' => 'prole:admin']);
                $routes->post('restore', 'Restore::index', ['filter' => 'prole:admin']);
                $routes->delete('reset', 'Reset::index', ['filter' => 'prole:admin']);
                $routes->delete('data-master', 'DataMaster::index', ['filter' => 'prole:admin']);
            });
            $routes->group('secret-key', ['namespace' => PANEL_NAMESPACE . '\App\Settings'], function ($routes) {
                $routes->get('', 'SecretKey::index', ['filter' => 'prole:admin']);
                $routes->get('data', 'SecretKey::data', ['filter' => 'prole:admin']);
                $routes->get('license', 'SecretKey::license', ['filter' => 'prole:admin']);
                $routes->post('data', 'SecretKey::save_data', ['filter' => 'prole:admin']);
            });
            $routes->group('redis', ['namespace' => PANEL_NAMESPACE . '\App\Settings'], function ($routes) {
                $routes->get('', 'Redis::index', ['filter' => 'prole:admin']);
                $routes->get('data', 'Redis::data', ['filter' => 'prole:admin']);
                $routes->get('state', 'Redis::state', ['filter' => 'prole:admin']);
                $routes->post('data', 'Redis::save', ['filter' => 'prole:admin']);
            });
            $routes->group('attendance', ['namespace' => PANEL_NAMESPACE . '\App\Settings'], function ($routes) {
                $routes->get('', 'Attendance::index', ['filter' => 'prole:admin']);
                $routes->get('config_qr', 'Attendance::config_qr', ['filter' => 'prole:admin']);
                $routes->get('generate_qr', 'Attendance::generate_qr', ['filter' => 'prole:admin']);
                $routes->get('config_map', 'Attendance::config_map', ['filter' => 'prole:admin']);
                $routes->get('timePresence/staff', 'Attendance::timePresence/staff', ['filter' => 'prole:admin']);
                $routes->get('timePresence/siswa', 'Attendance::timePresence/siswa', ['filter' => 'prole:admin']);
                $routes->patch('timePresence/staff', 'Attendance::saveTimePresence/staff', ['filter' => 'prole:admin']);
                $routes->patch('timePresence/siswa', 'Attendance::saveTimePresence/siswa', ['filter' => 'prole:admin']);
                // $routes->patch('timePresence/In', 'Attendance::saveTimePresence/In', ['filter' => 'prole:admin']);
                // $routes->patch('timePresence/Out', 'Attendance::saveTimePresence/Out', ['filter' => 'prole:admin']);
                $routes->patch('save_map', 'Attendance::save_map', ['filter' => 'prole:admin']);
            });
        });
        $routes->post('reset', 'Reset::index', ['filter' => 'prole:admin']);
        $routes->post('delete-data-master', 'DataMaster::index', ['filter' => 'prole:admin']);
        $routes->post('patch', 'Patch::index', ['filter' => 'prole:admin']);
        $routes->get('backup', 'Backup::index', ['filter' => 'prole:admin']);
        $routes->post('restore', 'Restore::index', ['filter' => 'prole:admin']);
        $routes->group('install', ['namespace' => PANEL_NAMESPACE . '\App\Install'], function ($routes) {
            $routes->get('/', 'Main::index', ['filter' => 'pinstall']);
            $routes->get('lc', 'Main::lc');
            $routes->get('step/1', 'DB::index', ['filter' => 'pinstall:step1', 'as' => 'pinstall']);
            $routes->post('step/1', 'DB::init', ['filter' => 'pinstall:step1']);
            $routes->get('step/2', 'Init::index', ['filter' => 'pinstall:step2']);
            $routes->post('step/2/new', 'Init::new', ['filter' => 'pinstall:step2']);
            $routes->post('step/2/restore', 'Init::restore', ['filter' => 'pinstall:step2']);
        });
    });
    //utils
    $routes->group('utils', ['namespace' => PANEL_NAMESPACE . '\Utils'], function ($routes) {
        $routes->get('sidebar', 'Sidebar::index');
        $routes->get('header', 'Header::index');
        $routes->get('logActivity', 'LogActivity::index', ['filter' => 'prole:admin,kepsek']);
    });

    $routes->group('approval', ['namespace' => PANEL_NAMESPACE . "\Approval"], function ($routes) {
        $routes->group('presence',   function ($routes) {
            $routes->get('/', 'Presence::index', ['filter' => 'prole:guru']);
            $routes->get('all', 'Presence::all', ['filter' => 'prole:guru']);
            $routes->get('detail/(:num)', 'Presence::detail/$1', ['filter' => 'prole:guru']);
            $routes->patch('cancel/(:num)', 'Presence::cancel/$1', ['filter' => 'prole:guru']);
            $routes->post('add', 'Presence::add', ['filter' => 'prole:guru']);
            $routes->post('imageUploader', 'Presence::imageUploader', ['filter' => 'prole:guru']);
        });
    });
    $routes->group('approvals', ['namespace' => PANEL_NAMESPACE . "\Approvals"], function ($routes) {
        $routes->group('presence', ['namespace' => PANEL_NAMESPACE . "\Approvals\Presence"],  function ($routes) {
            $routes->group('guru',  function ($routes) {
                $routes->get('/', 'Guru::index', ['filter' => 'prole:admin,piket,kepsek']);
                $routes->get('all', 'Guru::all', ['filter' => 'prole:admin,piket,kepsek']);
                $routes->get('detail/(:num)', 'Guru::detail/$1', ['filter' => 'prole:admin,piket,kepsek']);
                $routes->patch('decline/(:num)', 'Guru::decline/$1', ['filter' => 'prole:admin,piket,kepsek']);
                $routes->patch('approve/(:num)', 'Guru::approve/$1', ['filter' => 'prole:admin,piket,kepsek']);
                $routes->post('imageUploader', 'Guru::imageUploader', ['filter' => 'prole:admin,piket,kepsek']);
            });
            $routes->group('siswa',  function ($routes) {
                $routes->get('/', 'Siswa::index', ['filter' => 'prole:admin,piket,kepsek']);
                $routes->get('all', 'Siswa::all', ['filter' => 'prole:admin,piket,kepsek']);
                $routes->get('detail/(:num)', 'Siswa::detail/$1', ['filter' => 'prole:admin,piket,kepsek']);
                $routes->patch('decline/(:num)', 'Siswa::decline/$1', ['filter' => 'prole:admin,piket,kepsek']);
                $routes->patch('approve/(:num)', 'Siswa::approve/$1', ['filter' => 'prole:admin,piket,kepsek']);
                $routes->post('imageUploader', 'Siswa::imageUploader', ['filter' => 'prole:admin,piket,kepsek']);
            });
        });
    });
    $routes->group('daily-presence', function ($routes) {
        $routes->group('map', ['namespace' => PANEL_NAMESPACE . "\DailyPresence"], function ($routes) {
            $routes->get('/', 'Map::index', ['filter' => 'prole:guru,karyawan']);
            $routes->get('rekap', 'Map::rekap', ['filter' => 'prole:guru,karyawan']);
            $routes->get('config', 'Map::config', ['filter' => 'prole:guru,karyawan']);
            $routes->post('present', 'Map::present', ['filter' => 'prole:guru,karyawan']);
            $routes->post('presentQR', 'QR::present', ['filter' => 'prole:guru,karyawan']);
        });
    });
    //display
    $routes->group('display', function ($routes) {
        $routes->get('/', 'Display::index', ['filter' => 'prole:admin']);
        $routes->get('static', 'Display::static', ['filter' => 'prole:admin']);
        $routes->get('sync-attendance-solution', 'Display::syncAttendanceSolution');
        $routes->get('presentCount', 'Display::presentCount', ['filter' => 'prole:admin']);
        $routes->get('latestPresent', 'Display::latestPresent', ['filter' => 'prole:admin']);
        $routes->get('currentClass', 'Display::currentClass', ['filter' => 'prole:admin']);
        $routes->get('absensi', 'Display::absensi', ['filter' => 'prole:admin']);
        $routes->get('absensi/kelas', 'Display::absensiKelas', ['filter' => 'prole:admin']);
        $routes->get('scan-app-qr', 'Display::scan_aplikasi', ['filter' => 'prole:admin']);
        $routes->get('get-app-qr', 'Display::getAppQR', ['filter' => 'prole:admin']);
    });
    //master data
    $routes->group('md',  function ($routes) {
        $routes->group('pelajaran', ['namespace' => PANEL_NAMESPACE . '\MasterData'], function ($routes) {
            $routes->get('/', 'MataPelajaran::index', ['filter' => 'prole:admin']);
            $routes->get('all', 'MataPelajaran::all', ['filter' => 'prole:admin,guru,kepsek']);
            $routes->get('detail/(:num)', 'MataPelajaran::detail/$1', ['filter' => 'prole:admin']);
            $routes->post('add', 'MataPelajaran::add', ['filter' => 'prole:admin']);
            $routes->patch('edit/(:num)', 'MataPelajaran::edit/$1', ['filter' => 'prole:admin']);
            $routes->delete('delete/(:num)', 'MataPelajaran::delete/$1', ['filter' => 'prole:admin']);
        });
        $routes->group('jurusan', ['namespace' => PANEL_NAMESPACE . '\MasterData'], function ($routes) {
            $routes->get('/', 'Jurusan::index', ['filter' => 'prole:admin']);
            $routes->get('all', 'Jurusan::all', ['filter' => 'prole:admin']);
            $routes->get('detail/(:num)', 'Jurusan::detail/$1', ['filter' => 'prole:admin']);
            $routes->post('add', 'Jurusan::add', ['filter' => 'prole:admin']);
            $routes->patch('edit/(:num)', 'Jurusan::edit/$1', ['filter' => 'prole:admin']);
            $routes->delete('delete/(:num)', 'Jurusan::delete/$1', ['filter' => 'prole:admin']);
        });
        $routes->group('level', ['namespace' => PANEL_NAMESPACE . '\MasterData'], function ($routes) {
            $routes->get('/', 'Tingkat::index', ['filter' => 'prole:admin']);
            $routes->get('all', 'Tingkat::all', ['filter' => 'prole:admin,guru']);
            $routes->get('detail/(:num)', 'Tingkat::detail/$1', ['filter' => 'prole:admin']);
            $routes->post('add', 'Tingkat::add', ['filter' => 'prole:admin']);
            $routes->patch('edit/(:num)', 'Tingkat::edit/$1', ['filter' => 'prole:admin']);
            $routes->delete('delete/(:num)', 'Tingkat::delete/$1', ['filter' => 'prole:admin']);
        });
        $routes->group('jenis-ujian', ['namespace' => PANEL_NAMESPACE . '\MasterData'], function ($routes) {
            $routes->get('/', 'JenisUjian::index', ['filter' => 'prole:admin']);
            $routes->get('all', 'JenisUjian::all', ['filter' => 'prole:admin,guru,pengawas,kepsek']);
            $routes->get('detail/(:num)', 'JenisUjian::detail/$1', ['filter' => 'prole:admin']);
            $routes->post('add', 'JenisUjian::add', ['filter' => 'prole:admin']);
            $routes->patch('edit/(:num)', 'JenisUjian::edit/$1', ['filter' => 'prole:admin']);
            $routes->delete('delete/(:num)', 'JenisUjian::delete/$1', ['filter' => 'prole:admin']);
        });
        $routes->group('ruang-ujian', ['namespace' => PANEL_NAMESPACE . '\MasterData'], function ($routes) {
            $routes->get('/', 'RuangUjian::index', ['filter' => 'prole:admin']);
            $routes->get('all', 'RuangUjian::all', ['filter' => 'prole:admin,guru,pengawas,kepsek']);
            $routes->get('detail/(:num)', 'RuangUjian::detail/$1', ['filter' => 'prole:admin']);
            $routes->post('add', 'RuangUjian::add', ['filter' => 'prole:admin']);
            $routes->patch('edit/(:num)', 'RuangUjian::edit/$1', ['filter' => 'prole:admin']);
            $routes->delete('delete/(:num)', 'RuangUjian::delete/$1', ['filter' => 'prole:admin']);
        });
        $routes->group('kelas', ['namespace' => PANEL_NAMESPACE . '\MasterData'], function ($routes) {
            $routes->get('/', 'Kelas::index', ['filter' => 'prole:admin']);
            $routes->get('all', 'Kelas::all', ['filter' => 'prole:admin,pengawas,guru,kepsek']);
            $routes->group('kartu',  function ($routes) {
                $routes->get('(:num)', 'Kelas::kartu/$1', ['filter' => 'prole:admin']);
                $routes->get('(:num)/data', 'Kelas::kartu_data/$1', ['filter' => 'prole:admin']);
            });
            $routes->get('tingkat', 'Kelas::tingkat', ['filter' => 'prole:admin']);
            $routes->get('jurusan', 'Kelas::jurusan', ['filter' => 'prole:admin']);
            $routes->get('detail/(:num)', 'Kelas::detail/$1', ['filter' => 'prole:admin']);
            $routes->post('add', 'Kelas::add', ['filter' => 'prole:admin']);
            $routes->patch('edit/(:num)', 'Kelas::edit/$1', ['filter' => 'prole:admin']);
            $routes->delete('delete/(:num)', 'Kelas::delete/$1', ['filter' => 'prole:admin']);
        });
        $routes->group('import', ['namespace' => PANEL_NAMESPACE . '\MasterData'], function ($routes) {
            $routes->get('/', 'Import::index', ['filter' => 'prole:admin']);
            $routes->post('run', 'Import::run', ['filter' => 'prole:admin']);
            $routes->get('example/excel', 'Import::example/excel', ['filter' => 'prole:admin']);
            $routes->get('example/zip', 'Import::example/zip', ['filter' => 'prole:admin']);
        });

        $routes->group('siswa', ['namespace' => PANEL_NAMESPACE . '\MasterData'], function ($routes) {
            $routes->get('/', 'Siswa::index', ['filter' => 'prole:admin,guru']);
            $routes->get('rfid', 'Siswa::rfid', ['filter' => 'prole:admin']);
            $routes->get('all', 'Siswa::all', ['filter' => 'prole:admin,pengawas,guru']);
            $routes->get('kelas/(:num)', 'Siswa::detail_kelas/$1', ['filter' => 'prole:admin']);
            $routes->get('kelas/(:num)/siswa', 'Siswa::siswa_kelas/$1', ['filter' => 'prole:admin,pengawas,guru']);
            $routes->put('kelas/pindah', 'Siswa::kelas_pindah', ['filter' => 'prole:admin']);
            $routes->get('ruang/(:num)', 'Siswa::detail_ruang/$1', ['filter' => 'prole:admin']);
            $routes->get('ruang/(:num)/siswa', 'Siswa::siswa_ruang/$1', ['filter' => 'prole:admin']);
            $routes->put('ruang/pindah', 'Siswa::ruang_pindah', ['filter' => 'prole:admin']);
            $routes->get('detail/(:num)', 'Siswa::detail/$1', ['filter' => 'prole:admin,guru']);
            $routes->get('examplePhoto', 'Siswa::examplePhoto', ['filter' => 'prole:admin']);
            $routes->post('add', 'Siswa::add', ['filter' => 'prole:admin']);
            $routes->post('change-data', 'Siswa::changeData', ['filter' => 'prole:admin']);
            $routes->post('uploadPhoto', 'Siswa::uploadPhoto', ['filter' => 'prole:admin']);
            $routes->patch('edit/(:num)', 'Siswa::edit/$1', ['filter' => 'prole:admin']);
            $routes->delete('delete/(:num)', 'Siswa::delete/$1', ['filter' => 'prole:admin']);
        });
        $routes->group('alumni', ['namespace' => PANEL_NAMESPACE . '\MasterData'], function ($routes) {
            $routes->get('/', 'Alumni::index', ['filter' => 'prole:admin,guru']);
            $routes->get('all', 'Alumni::all', ['filter' => 'prole:admin,pengawas,guru']);
            $routes->get('detail/(:num)', 'Alumni::detail/$1', ['filter' => 'prole:admin,guru']);
            $routes->patch('edit/(:num)', 'Alumni::edit/$1', ['filter' => 'prole:admin']);
            $routes->delete('delete/(:num)', 'Alumni::delete/$1', ['filter' => 'prole:admin']);
        });
    });
    $routes->group('e-learning',  function ($routes) {
        $routes->group('jadwal-libur', ['namespace' => PANEL_NAMESPACE . '\Elearning'], function ($routes) {
            $routes->get('/', 'JadwalLibur::index', ['filter' => 'prole:admin']);
            $routes->get('all', 'JadwalLibur::all', ['filter' => 'prole:admin']);
            $routes->get('sinkronisasi_libur', 'JadwalLibur::sinkronisasi_libur', ['filter' => 'prole:admin']);
            $routes->get('detail', 'JadwalLibur::detail', ['filter' => 'prole:admin']);
            $routes->delete('delete', 'JadwalLibur::delete', ['filter' => 'prole:admin']);
            $routes->patch('save', 'JadwalLibur::save', ['filter' => 'prole:admin']);
        });
        $routes->group('kompetensi-dasar', ['namespace' => PANEL_NAMESPACE . '\Elearning'], function ($routes) {
            $routes->get('/', 'KompetensiDasar::index', ['filter' => 'prole:admin,guru']);
            $routes->get('all', 'KompetensiDasar::all', ['filter' => 'prole:admin,guru']);
            $routes->get('mapel', 'KompetensiDasar::mapel', ['filter' => 'prole:admin,guru']);
            $routes->get('tingkat', 'KompetensiDasar::tingkat', ['filter' => 'prole:admin,guru']);
            $routes->get('detail/(:num)', 'KompetensiDasar::detail/$1', ['filter' => 'prole:admin,guru']);
            $routes->patch('edit/(:num)', 'KompetensiDasar::edit/$1', ['filter' => 'prole:admin,guru']);
            $routes->delete('delete/(:num)', 'KompetensiDasar::delete/$1', ['filter' => 'prole:admin,guru']);
            $routes->post('add', 'KompetensiDasar::add', ['filter' => 'prole:admin,guru']);
            $routes->get('config', 'KompetensiDasar::config', ['filter' => 'prole:admin,guru']);
        });
        $routes->group('jadwal-mengajar', ['namespace' => PANEL_NAMESPACE . '\Elearning\JadwalMengajar'], function ($routes) {
            $routes->get('/', 'Main::index', ['filter' => 'prole:guru']);
            $routes->get('all', 'Main::all', ['filter' => 'prole:guru']);
            $routes->group('praktek', function ($routes) {
                $routes->get('(:hash)', 'Main::praktek/$1', ['filter' => 'prole:guru']);
                $routes->get('(:hash)/absensi', 'Absensi::all/$1', ['filter' => 'prole:guru']);
                $routes->get('(:hash)/agenda', 'Agenda::all/$1', ['filter' => 'prole:guru']);
                $routes->patch('(:hash)/agenda', 'Agenda::save/$1', ['filter' => 'prole:guru']);
                $routes->patch('(:hash)/absensi', 'Absensi::save/$1', ['filter' => 'prole:guru']);
                $routes->put('(:hash)/absensi', 'Absensi::allIn/$1', ['filter' => 'prole:guru']);
            });
            $routes->group('materi', function ($routes) {
                $routes->get('(:hash)', 'Materi::index/$1', ['filter' => 'prole:guru']);
                $routes->get('(:hash)/all', 'Materi::all/$1', ['filter' => 'prole:guru']);
                $routes->get('(:hash)/detail/(:num)', 'Materi::detail/$1/$2', ['filter' => 'prole:guru']);
                $routes->get('(:hash)/related', 'Materi::related/$1', ['filter' => 'prole:guru']);
                $routes->get('(:hash)/viewed', 'Materi::viewed/$1', ['filter' => 'prole:guru']);
                $routes->delete('(:hash)/delete/(:num)', 'Materi::delete/$1/$2', ['filter' => 'prole:guru']);
                $routes->post('(:hash)/save', 'Materi::save/$1', ['filter' => 'prole:guru']);
                $routes->post('(:hash)/add', 'Materi::add/$1', ['filter' => 'prole:guru']);
                $routes->post('(:hash)/edit/(:num)', 'Materi::edit/$1/$2', ['filter' => 'prole:guru']);
                $routes->post('(:hash)/imageUploader', 'Materi::imageUploader',     ['filter' => 'prole:guru']);
                $routes->post('(:hash)/audioUploader', 'Materi::audioUploader',     ['filter' => 'prole:guru']);
                $routes->post('(:hash)/videoUploader', 'Materi::videoUploader',     ['filter' => 'prole:guru']);
            });
            $routes->group('tugas', function ($routes) {
                $routes->get('(:hash)', 'Tugas::index/$1', ['filter' => 'prole:guru']);
                $routes->get('(:hash)/all', 'Tugas::all/$1', ['filter' => 'prole:guru']);
                $routes->get('(:hash)/detail/(:num)', 'Tugas::detail/$1/$2', ['filter' => 'prole:guru']);
                $routes->get('(:hash)/answers/(:num)', 'Tugas::answers/$1/$2', ['filter' => 'prole:guru']);
                $routes->get('(:hash)/related', 'Tugas::related/$1', ['filter' => 'prole:guru']);
                $routes->get('(:hash)/answer/(:hash)', 'Tugas::get_answer/$1/$2', ['filter' => 'prole:guru']);
                $routes->patch('(:hash)/answer/(:hash)', 'Tugas::save_answer/$1/$2', ['filter' => 'prole:guru']);
                $routes->delete('(:hash)/delete/(:num)', 'Tugas::delete/$1/$2', ['filter' => 'prole:guru']);
                $routes->post('(:hash)/save', 'Tugas::save/$1', ['filter' => 'prole:guru']);
                $routes->post('(:hash)/add', 'Tugas::add/$1', ['filter' => 'prole:guru']);
                $routes->post('(:hash)/imageUploader', 'Tugas::imageUploader',     ['filter' => 'prole:guru']);
                $routes->post('(:hash)/edit/(:num)', 'Tugas::edit/$1/$2', ['filter' => 'prole:guru']);
            });
            $routes->group('diskusi', function ($routes) {
                $routes->get('(:hash)', 'Diskusi::index/$1', ['filter' => 'prole:guru']);
                $routes->put('(:hash)/add', 'Diskusi::add/$1', ['filter' => 'prole:guru']);
                $routes->get('(:hash)/init', 'Diskusi::init/$1', ['filter' => 'prole:guru']);
                $routes->get('(:hash)/newest', 'Diskusi::newest/$1', ['filter' => 'prole:guru']);
                $routes->get('(:hash)/oldest', 'Diskusi::oldest/$1', ['filter' => 'prole:guru']);
                $routes->post('(:hash)/imageUploader', 'Diskusi::imageUploader', ['filter' => 'prole:guru']);
                $routes->delete('(:hash)/delete/(:hash)', 'Diskusi::delete/$1/$2', ['filter' => 'prole:guru']);
            });
        });
        $routes->group('rekap', ['namespace' => PANEL_NAMESPACE . '\Elearning\Rekap'], function ($routes) {
            $routes->group('agenda', ['namespace' => PANEL_NAMESPACE . '\Elearning\Rekap\Agenda'], function ($routes) {
                $routes->group('mengajar', function ($routes) {
                    $routes->get('/', 'Mengajar::index', ['filter' => 'prole:admin,guru,piket,kepsek']);
                    $routes->get('export', 'Mengajar::export', ['filter' => 'prole:admin,guru,piket,kepsek']);
                    $routes->get('guru', 'Mengajar::guru', ['filter' => 'prole:admin,guru,piket,kepsek']);
                    $routes->get('mapel', 'Mengajar::mapel', ['filter' => 'prole:admin,guru,piket,kepsek']);
                });
            });
            $routes->group('mengajar', function ($routes) {
                $routes->get('/', 'Mengajar::index', ['filter' => 'prole:admin,piket,kepsek']);
                $routes->get('all', 'Mengajar::all', ['filter' => 'prole:admin,piket,kepsek']);
            });
            $routes->group('guru', ['namespace' => PANEL_NAMESPACE . '\Elearning\Rekap\Guru'], function ($routes) {
                $routes->get('absensi', 'Absensi::index', ['filter' => 'prole:admin,piket,kepsek']);
                $routes->get('absensi/all', 'Absensi::all', ['filter' => 'prole:admin,piket,kepsek']);
                $routes->get('absensi/kelas', 'Absensi::kelas', ['filter' => 'prole:admin,piket,kepsek']);
                $routes->post('absensi/(:hash)', 'Absensi::save/$1', ['filter' => 'prole:admin,piket,kepsek']);
                $routes->get('absensi/export', 'Absensi::export', ['filter' => 'prole:admin,piket,kepsek']);
                $routes->get('mengajar', 'Mengajar::index', ['filter' => 'prole:admin,piket,kepsek']);
                $routes->get('mengajar/export', 'Mengajar::export', ['filter' => 'prole:admin,piket,kepsek']);
                $routes->get('mengajar/preview', 'Mengajar::preview', ['filter' => 'prole:admin,piket,kepsek']);
            });
            $routes->group('karyawan', ['namespace' => PANEL_NAMESPACE . '\Elearning\Rekap\Karyawan'], function ($routes) {
                $routes->get('absensi', 'Absensi::index', ['filter' => 'prole:admin,piket,kepsek']);
                $routes->get('absensi/all', 'Absensi::all', ['filter' => 'prole:admin,piket,kepsek']);
                $routes->post('absensi/(:hash)', 'Absensi::save/$1', ['filter' => 'prole:admin,piket,kepsek']);
                $routes->get('absensi/export', 'Absensi::export', ['filter' => 'prole:admin,piket,kepsek']);
            });
            $routes->group('siswa', ['namespace' => PANEL_NAMESPACE . '\Elearning\Rekap\Siswa'], function ($routes) {
                $routes->get('absensi', 'Absensi::index', ['filter' => 'prole:admin,piket,kepsek']);
                $routes->get('absensi/all', 'Absensi::all', ['filter' => 'prole:admin,piket,kepsek']);
                $routes->get('absensi/kelas', 'Absensi::kelas', ['filter' => 'prole:admin,piket,kepsek']);
                $routes->post('absensi/(:hash)', 'Absensi::save/$1', ['filter' => 'prole:admin,piket,kepsek']);
                $routes->get('absensi/export', 'Absensi::export', ['filter' => 'prole:admin,piket,kepsek']);
                $routes->get('belajar', 'Belajar::index', ['filter' => 'prole:admin,guru,kepsek']);
                $routes->get('belajar/export', 'Belajar::export', ['filter' => 'prole:admin,guru,kepsek']);
                $routes->get('belajar/preview', 'Belajar::preview', ['filter' => 'prole:admin,guru,kepsek']);
                $routes->get('mapel', 'Belajar::mapel', ['filter' => 'prole:admin,guru,kepsek']);
                $routes->get('kelas', 'Absensi::list_kelas', ['filter' => 'prole:admin,guru,piket,kepsek']);
            });
        });
        $routes->group('jadwal-pelajaran', ['namespace' => PANEL_NAMESPACE . '\Elearning'], function ($routes) {
            $routes->get('/', 'JadwalPelajaran::index', ['filter' => 'prole:admin,guru']);
            $routes->get('all', 'JadwalPelajaran::all', ['filter' => 'prole:admin,guru']);
            $routes->get('detail/(:num)', 'JadwalPelajaran::detail/$1', ['filter' => 'prole:admin,guru']);
            $routes->patch('edit/(:num)', 'JadwalPelajaran::edit/$1', ['filter' => 'prole:admin,guru']);
            $routes->delete('delete/(:num)', 'JadwalPelajaran::delete/$1', ['filter' => 'prole:admin,guru']);
            $routes->post('add', 'JadwalPelajaran::add', ['filter' => 'prole:admin,guru']);
            $routes->get('config', 'JadwalPelajaran::config', ['filter' => 'prole:admin,guru']);
        });
        $routes->group('rpp', ['namespace' => PANEL_NAMESPACE . '\Elearning'], function ($routes) {
            $routes->get('/', 'RPP::index', ['filter' => 'prole:admin,guru']);
            $routes->get('all', 'RPP::all', ['filter' => 'prole:admin,guru']);
            $routes->get('detail/(:num)', 'RPP::detail/$1', ['filter' => 'prole:admin,guru']);
            $routes->post('edit/(:num)', 'RPP::edit/$1', ['filter' => 'prole:admin,guru']);
            $routes->delete('delete/(:num)', 'RPP::delete/$1', ['filter' => 'prole:admin,guru']);
            $routes->post('add', 'RPP::add', ['filter' => 'prole:admin,guru']);
            $routes->post('file/(:num)', 'RPP::file/(:num)', ['filter' => 'prole:admin,guru']);
            $routes->get('config', 'RPP::config', ['filter' => 'prole:admin,guru']);
        });
        $routes->group('tahun-pelajaran', ['namespace' => PANEL_NAMESPACE . '\Elearning'], function ($routes) {
            $routes->get('/', 'TahunPelajaran::index', ['filter' => 'prole:admin']);
            $routes->get('all', 'TahunPelajaran::all', ['filter' => 'prole:admin,guru,pengawas,kepsek']);
            $routes->post('add', 'TahunPelajaran::add', ['filter' => 'prole:admin']);
            $routes->get('detail/(:num)', 'TahunPelajaran::detail/$1', ['filter' => 'prole:admin']);
            $routes->patch('edit/(:num)', 'TahunPelajaran::edit/$1', ['filter' => 'prole:admin']);
            $routes->delete('delete/(:num)', 'TahunPelajaran::delete/$1', ['filter' => 'prole:admin']);
        });
    });

    //bank soal
    // V1
    // $routes->group('bank-soal', ['namespace' => PANEL_NAMESPACE . '\BankSoal'], function ($routes) {
    // $routes->get('/', 'Main::index', ['filter' => 'prole:admin,guru']);
    // $routes->delete('delete/(:num)', 'Main::delete/$1',     ['filter' => 'prole:admin,guru']);
    // $routes->post('add', 'Main::add', ['filter' => 'prole:admin,guru']);
    // $routes->get('print/(:num)', 'Main::print/$1', ['filter' => 'prole:admin,guru']);
    // $routes->put('edit/(:num)', 'Main::edit/$1', ['filter' => 'prole:admin,guru']);
    // $routes->get('detail/(:num)', 'Main::detail/$1', ['filter' => 'prole:admin,guru']);
    // $routes->get('preview/(:num)', 'Main::preview/$1', ['filter' => 'prole:admin,guru']);
    // $routes->get('preview/(:num)/soal', 'Main::preview/$1/soal', ['filter' => 'prole:admin,guru']);
    // $routes->get('preview/(:num)/opsi', 'Main::preview/$1/opsi', ['filter' => 'prole:admin,guru']);
    // $routes->get('preview/(:num)/couple', 'Main::preview/$1/couple', ['filter' => 'prole:admin,guru']);
    // $routes->get('all', 'Main::all',     ['filter' => 'prole:admin,guru,kepsek']);
    // $routes->get('config', 'Main::config',     ['filter' => 'prole:admin,guru']);
    // $routes->get('soals/(:num)', 'Main::soals/$1',     ['filter' => 'prole:admin,guru,kepsek']);
    // $routes->get('export/(:num)', 'Export::run/$1',     ['filter' => 'prole:admin,guru']);
    // $routes->get('example/zip', 'Import::example/zip', ['filter' => 'prole:admin,guru']);
    // $routes->get('example/excel', 'Import::example/excel', ['filter' => 'prole:admin,guru']);
    // $routes->get('example/docx', 'Import::example/docx', ['filter' => 'prole:admin,guru']);
    // $routes->post('import', 'Import::run',     ['filter' => 'prole:admin,guru']);
    // $routes->post('editor/imageUploader', 'Editor::imageUploader',     ['filter' => 'prole:admin,guru']);
    // $routes->post('editor/audioUploader', 'Editor::audioUploader',     ['filter' => 'prole:admin,guru']);
    // $routes->post('editor/videoUploader', 'Editor::videoUploader',     ['filter' => 'prole:admin,guru']);

    // $routes->get('editor/(:num)', 'Editor::index/$1',     ['filter' => 'prole:admin,guru']);
    // $routes->get('editor/(:num)/soal', 'Editor::soal/$1',     ['filter' => 'prole:admin,guru']);
    // $routes->get('editor/(:num)/soal/(:num)', 'Editor::detail/$1/$2',     ['filter' => 'prole:admin,guru']);
    // $routes->put('editor/(:num)/soal/(:num)/save', 'Editor::save/$1/$2',     ['filter' => 'prole:admin,guru']);
    // $routes->patch('editor/edit/(:num)', 'Editor::edit/$1',     ['filter' => 'prole:admin,guru']);
    // $routes->delete('editor/(:num)/soal/(:num)/delete', 'Editor::delete/$1/$2',     ['filter' => 'prole:admin,guru']);
    // });
    // V2
    $routes->group('bank-soal', ['namespace' => PANEL_NAMESPACE . '\BankSoal'], function ($routes) {
        $routes->get('(:num)', 'Main::detail/$1',     ['filter' => 'prole:admin,guru,kepsek']);
        $routes->put('(:num)', 'Main::save/$1',     ['filter' => 'prole:admin,guru,kepsek']);
        $routes->get('/', 'Main::index', ['filter' => 'prole:admin,guru']);
        $routes->get('all', 'Main::all',     ['filter' => 'prole:admin,guru,kepsek']);
        $routes->delete('/', 'Main::deleteBatch',     ['filter' => 'prole:admin,guru,kepsek']);
        $routes->post('files', 'Main::files',     ['filter' => 'prole:admin,guru,kepsek']);
        $routes->delete('(:num)', 'Main::delete/$1',     ['filter' => 'prole:admin,guru,kepsek']);
        $routes->get('export/(:num)', 'Export::run/$1',     ['filter' => 'prole:admin,guru']);
        $routes->get('example/zip', 'Import::example/zip', ['filter' => 'prole:admin,guru']);
        $routes->get('example/excel', 'Import::example/excel', ['filter' => 'prole:admin,guru']);
        $routes->get('example/docx', 'Import::example/docx', ['filter' => 'prole:admin,guru']);
        $routes->post('import', 'Import::run',     ['filter' => 'prole:admin,guru']);
        $routes->get('preview/(:num)', 'Main::preview/$1', ['filter' => 'prole:admin,guru']);
        $routes->get('preview/(:num)/soal', 'Main::preview/$1/soal', ['filter' => 'prole:admin,guru']);
        $routes->get('preview/(:num)/opsi', 'Main::preview/$1/opsi', ['filter' => 'prole:admin,guru']);
        $routes->get('preview/(:num)/couple', 'Main::preview/$1/couple', ['filter' => 'prole:admin,guru']);
        $routes->get('print/(:num)', 'Main::print/$1', ['filter' => 'prole:admin,guru']);

        $routes->group('editor', ['namespace' => PANEL_NAMESPACE . '\BankSoal'], function ($routes) {
            $routes->get('(:num)/soals', 'Editor::soals/$1', ['filter' => 'prole:admin,guru']);
            $routes->get('(:num)', 'Editor::index/$1', ['filter' => 'prole:admin,guru']);
            $routes->post('(:num)', 'Editor::save/$1', ['filter' => 'prole:admin,guru']);
            $routes->delete('(:num)/(:num)', 'Editor::delete/$1/$2', ['filter' => 'prole:admin,guru']);
        });
    });

    //ujian
    $routes->group('ujian', ['namespace' => PANEL_NAMESPACE . '\Ujian'], function ($routes) {
        $routes->group('draft', function ($routes) {
            $routes->get('/', 'Draft::index', ['filter' => 'prole:admin,guru,kepsek']);
            $routes->get('print/(:num)', 'Draft::print/$1', ['filter' => 'prole:admin,guru,kepsek']);
            $routes->get('all', 'Draft::all', ['filter' => 'prole:admin,guru,kepsek,pengawas']);
            $routes->get('mapel', 'Draft::mapel', ['filter' => 'prole:admin,guru,kepsek']);
            $routes->get('detail/(:num)', 'Draft::detail/$1', ['filter' => 'prole:admin,guru,kepsek']);
            $routes->get('soals/(:num)', 'Draft::soals/$1', ['filter' => 'prole:admin,guru,kepsek']);
            $routes->put('soals/(:num)', 'Draft::saveSoals/$1', ['filter' => 'prole:admin,guru,kepsek']);
            $routes->put('edit/(:num)', 'Draft::edit/$1', ['filter' => 'prole:admin,guru,kepsek']);
            $routes->post('add', 'Draft::add', ['filter' => 'prole:admin,guru,kepsek']);
            $routes->delete('delete/(:num)', 'Draft::delete/$1', ['filter' => 'prole:admin,guru,kepsek']);
        });
        $routes->group('jadwal', ['namespace' => PANEL_NAMESPACE . '\Ujian\Jadwal'], function ($routes) {
            $routes->get('/', 'Main::index', ['filter' => 'prole:admin,guru,pengawas,kepsek']);
            $routes->get('all', 'Main::all', ['filter' => 'prole:admin,guru,pengawas,kepsek']);
            $routes->get('detail/(:num)', 'Main::detail/$1', ['filter' => 'prole:admin,guru,kepsek']);
            $routes->put('batch/time', 'Main::batch_time', ['filter' => 'prole:admin,guru,kepsek']);
            $routes->put('clear/respond', 'Main::clear_respond', ['filter' => 'prole:admin,guru,kepsek']);
            $routes->put('edit/(:num)', 'Main::edit/$1', ['filter' => 'prole:admin,guru,kepsek']);
            $routes->post('add', 'Main::add', ['filter' => 'prole:admin,guru,kepsek']);
            $routes->delete('delete/(:num)', 'Main::delete/$1', ['filter' => 'prole:admin,guru,kepsek']);
            $routes->group('export', ['namespace' => PANEL_NAMESPACE . '\Ujian\Jadwal\Export'], function ($routes) {
                $routes->get('belum-ujian', 'BelumUjian::index', ['filter' => 'prole:admin,guru,pengawas']);
            });
            $routes->group('', ['namespace' => PANEL_NAMESPACE . '\Ujian\Jadwal\Detail'], function ($routes) {
                $routes->get('(:hash)', 'Main::index/$1', ['filter' => 'prole:admin,guru,pengawas']);
                $routes->get('(:hash)/peserta', 'Main::peserta/$1', ['filter' => 'prole:admin,guru,pengawas']);
                $routes->put('(:hash)/peserta', 'Main::simpanPeserta/$1', ['filter' => 'prole:admin,guru']);
                $routes->get('(:hash)/detail', 'Main::detail/$1', ['filter' => 'prole:admin,guru,pengawas']);
                $routes->get('(:hash)/status', 'Main::status/$1', ['filter' => 'prole:admin,guru,pengawas']);
                $routes->put('(:hash)/extra-time', 'Main::extra_time/$1', ['filter' => 'prole:admin,guru,pengawas']);
                $routes->get('(:hash)/token', 'Main::token/$1', ['filter' => 'prole:admin,guru,pengawas']);
                $routes->get('(:hash)/progress', 'Main::progress/$1', ['filter' => 'prole:admin,guru,pengawas']);
                $routes->get('(:hash)/jawaban/(:hash)', 'Main::jawaban/$1/$2', ['filter' => 'prole:admin,guru,pengawas']);
                $routes->get('(:hash)/export', 'Result\Export::index/$1', ['filter' => 'prole:admin,guru,pengawas']);
                $routes->get('(:hash)/print-kehadiran', 'Result\Kehadiran::index/$1', ['filter' => 'prole:admin,guru,pengawas']);
                $routes->get('(:hash)/print-nilai', 'Result\Nilai::index/$1', ['filter' => 'prole:admin,guru,pengawas']);
                $routes->get('(:hash)/print-jawaban', 'Result\Jawaban::index/$1', ['filter' => 'prole:admin,guru,pengawas']);
                $routes->put('(:hash)/jawaban/(:hash)', 'Main::save_jawaban/$1/$2', ['filter' => 'prole:admin,guru,pengawas']);
                // $routes->put('(:hash)/reset/(:hash)', 'Main::reset/$1/$2', ['filter' => 'prole:admin,guru,pengawas']);
                // $routes->put('(:hash)/reset-batch', 'Main::reset_batch/$1', ['filter' => 'prole:admin,guru,pengawas']);
                $routes->put('(:hash)/finish-batch', 'Main::finish_batch/$1', ['filter' => 'prole:admin,guru,pengawas']);
                $routes->put('(:hash)/unlock/(:hash)', 'Main::unlock/$1/$2', ['filter' => 'prole:admin,guru,pengawas']);
                $routes->put('(:hash)/unlock-batch', 'Main::unlock_batch/$1', ['filter' => 'prole:admin,guru,pengawas']);
                $routes->put('(:hash)/finish/(:hash)', 'Main::finish/$1/$2', ['filter' => 'prole:admin,guru,pengawas']);
                $routes->post('(:hash)/generate-soal', 'Generator::index/$1', ['filter' => 'prole:admin,guru,pengawas']);
            });
        });
        $routes->group('overview', function ($routes) {
            $routes->get('/', 'Overview::index', ['filter' => 'prole:admin,guru,pengawas,kepsek']);
            $routes->get('data', 'Overview::data', ['filter' => 'prole:admin,guru,pengawas,kepsek']);
            $routes->get('change-passcode-app', 'Overview::changePasscodeApp', ['filter' => 'prole:admin,guru,pengawas,kepsek']);
            $routes->get('(:num)', 'Overview::detail/$1', ['filter' => 'prole:admin,guru,pengawas,kepsek']);
        });
        $routes->group('legger-nilai', function ($routes) {
            $routes->get('/', 'LeggerNilai::index', ['filter' => 'prole:admin,guru,pengawas,kepsek']);
            $routes->get('all', 'LeggerNilai::all', ['filter' => 'prole:admin,guru,pengawas,kepsek']);
            $routes->get('tahun-pelajaran', 'LeggerNilai::tahun_pelajaran', ['filter' => 'prole:admin,guru,pengawas,kepsek']);
            $routes->get('jenis-ujian', 'LeggerNilai::jenis_ujian', ['filter' => 'prole:admin,guru,pengawas,kepsek']);
            $routes->get('export', 'LeggerNilai::export', ['filter' => 'prole:admin,guru,pengawas,kepsek']);
            $routes->get('preview', 'LeggerNilai::preview', ['filter' => 'prole:admin,guru,pengawas,kepsek']);
            // $routes->get('(:num)', 'LeggerNilai::detail/$1', ['filter' => 'prole:admin,guru,pengawas,kepsek']);
        });
    });

    //users
    $routes->group('users',  function ($routes) {
        $routes->group('administrator', ['namespace' => PANEL_NAMESPACE . '\Users'], function ($routes) {
            $routes->get('/', 'Administrator::index', ['filter' => 'prole:admin']);
            $routes->get('all', 'Administrator::all', ['filter' => 'prole:admin']);
            $routes->get('roles', 'Administrator::roles', ['filter' => 'prole:admin']);
            $routes->get('detail/(:num)', 'Administrator::detail/$1', ['filter' => 'prole:admin']);
            $routes->post('add', 'Administrator::add', ['filter' => 'prole:admin']);
            $routes->patch('edit/(:num)', 'Administrator::edit/$1', ['filter' => 'prole:admin']);
            $routes->delete('delete/(:num)', 'Administrator::delete/$1', ['filter' => 'prole:admin']);
        });
        $routes->group('staff', ['namespace' => PANEL_NAMESPACE . '\Users'], function ($routes) {
            $routes->get('/', 'Staff::index', ['filter' => 'prole:admin']);
            $routes->get('import', 'Staff::import_view', ['filter' => 'prole:admin']);
            $routes->get('rfid', 'Staff::rfid', ['filter' => 'prole:admin']);
            $routes->get('all', 'Staff::all', ['filter' => 'prole:admin,guru,pengawas,piket,kepsek']);
            $routes->get('roles', 'Staff::roles', ['filter' => 'prole:admin']);
            $routes->get('kelas', 'Staff::kelas', ['filter' => 'prole:admin']);
            $routes->get('import/example/zip', 'Staff::example/zip', ['filter' => 'prole:admin']);
            $routes->get('import/example/excel', 'Staff::example/excel', ['filter' => 'prole:admin']);
            $routes->get('detail/(:num)', 'Staff::detail/$1', ['filter' => 'prole:admin']);
            $routes->post('add', 'Staff::add', ['filter' => 'prole:admin']);
            $routes->post('import', 'Staff::import_run', ['filter' => 'prole:admin']);
            $routes->patch('edit/(:num)', 'Staff::edit/$1', ['filter' => 'prole:admin']);
            $routes->delete('delete/(:num)', 'Staff::delete/$1', ['filter' => 'prole:admin']);
        });
    });

    //berita acara
    $routes->group('berita-acara', ['namespace' => PANEL_NAMESPACE . '\LainLain'], function ($routes) {
        $routes->get('/', 'BeritaAcara::index', ['filter' => 'prole:admin']);
        $routes->get('all', 'BeritaAcara::all', ['filter' => 'prole:admin']);
        $routes->get('detail/(:num)', 'BeritaAcara::detail/$1', ['filter' => 'prole:admin']);
        $routes->get('print/(:num)', 'BeritaAcara::print/$1', ['filter' => 'prole:admin']);
        $routes->delete('delete/(:num)', 'BeritaAcara::delete/$1', ['filter' => 'prole:admin']);
        $routes->post('add', 'BeritaAcara::add', ['filter' => 'prole:admin']);
    });
    //kartu ujian
    $routes->group('pengumuman', ['namespace' => PANEL_NAMESPACE . '\LainLain'], function ($routes) {
        $routes->get('/', 'Pengumuman::index', ['filter' => 'prole:admin']);
        $routes->get('all', 'Pengumuman::all', ['filter' => 'prole:admin']);
        $routes->get('detail/(:num)', 'Pengumuman::detail/$1', ['filter' => 'prole:admin']);
        $routes->put('edit/(:num)', 'Pengumuman::edit/$1', ['filter' => 'prole:admin']);
        $routes->post('/', 'Pengumuman::add', ['filter' => 'prole:admin']);
        $routes->delete('delete/(:num)', 'Pengumuman::delete/$1', ['filter' => 'prole:admin']);
        $routes->post('imageUploader', 'Pengumuman::imageUploader', ['filter' => 'prole:admin']);
        $routes->post('audioUploader', 'Pengumuman::audioUploader', ['filter' => 'prole:admin']);
    });
    //logs 
    $routes->group('logs', ['namespace' => PANEL_NAMESPACE . '\LainLain'], function ($routes) {
        $routes->get('/', 'Logs::index', ['filter' => 'prole:admin']);
        $routes->delete('/', 'Logs::delete', ['filter' => 'prole:admin']);
        $routes->get('all', 'Logs::all', ['filter' => 'prole:admin']);
        $routes->get('users', 'Logs::users', ['filter' => 'prole:admin']);
    });

    //whatsapp
    $routes->group('whatsapp', ['namespace' => PANEL_NAMESPACE . '\Whatsapp'], function ($routes) {
        $routes->get('contact-list', 'Send::contactList', ['filter' => 'prole:admin,guru,kepsek']);
        $routes->group('devices', ['namespace' => PANEL_NAMESPACE . '\Whatsapp'], function ($routes) {
            $routes->get('/', 'Device::index', ['filter' => 'prole:admin']);
            $routes->get('all', 'Device::all', ['filter' => 'prole:admin']);
            $routes->get('(:num)', 'Device::detail/$1', ['filter' => 'prole:admin']);
            $routes->put('(:num)', 'Device::edit/$1', ['filter' => 'prole:admin']);
            $routes->delete('(:num)', 'Device::delete/$1', ['filter' => 'prole:admin']);
            $routes->post('/', 'Device::add', ['filter' => 'prole:admin']);
        });
        $routes->group('settings', ['namespace' => PANEL_NAMESPACE . '\Whatsapp'], function ($routes) {
            $routes->get('/', 'Setting::index', ['filter' => 'prole:admin']);
            $routes->get('data', 'Setting::data', ['filter' => 'prole:admin']);
            $routes->post('/', 'Setting::save', ['filter' => 'prole:admin']);
        });
        $routes->group('send', ['namespace' => PANEL_NAMESPACE . '\Whatsapp'], function ($routes) {
            $routes->get('/', 'Send::index', ['filter' => 'prole:admin,guru,kepsek']);
            $routes->post('/', 'Send::send', ['filter' => 'prole:admin,guru,kepsek']);
        });
        $routes->group('history', ['namespace' => PANEL_NAMESPACE . '\Whatsapp'], function ($routes) {
            $routes->get('/', 'History::index', ['filter' => 'prole:admin']);
            $routes->get('all', 'History::all', ['filter' => 'prole:admin']);
        });
    });
    // attendance solution
    $routes->group("attendance-solution", ['namespace' => PANEL_NAMESPACE . "\AttendanceSolution"], function ($routes) {
        $routes->group("device", ['namespace' => PANEL_NAMESPACE . "\AttendanceSolution"], function ($routes) {
            $routes->get("", "Device::index", ['filter' => "prole:admin"]);
            $routes->get("all", "Device::all", ['filter' => "prole:admin"]);
            $routes->get("check-connection/(:num)", "Device::checkConnection/$1", ['filter' => "prole:admin"]);
            $routes->get("detail/(:num)", "Device::detail/$1", ['filter' => "prole:admin"]);
            $routes->post("add", "Device::add", ['filter' => "prole:admin"]);
            $routes->put("edit/(:num)", "Device::edit/$1", ['filter' => "prole:admin"]);
            $routes->delete("delete/(:num)", "Device::delete/$1", ['filter' => "prole:admin"]);
        });
        $routes->group("assign", ['namespace' => PANEL_NAMESPACE . "\AttendanceSolution"], function ($routes) {
            $routes->get("", "Assign::index", ['filter' => "prole:admin"]);
            $routes->get("users", "Assign::users", ['filter' => "prole:admin"]);
            $routes->post("", "Assign::sinkronData", ['filter' => "prole:admin"]);
        });
    });
    //auth
    $routes->group('auth', ['namespace' => PANEL_NAMESPACE . '\Auth'], function ($routes) {
        $routes->get('switch/(:hash)/(:hash)', 'Account::switch/$1/$2', ['filter' => 'prole:admin,guru']);
        $routes->group('login', function ($routes) {
            $routes->get('/', 'Login::index', ['as' => 'pnlogin']);
            $routes->post('/', 'Login::check');
        });
        $routes->group('logout', function ($routes) {
            $routes->get('/', 'Logout::index');
        });
    });
});
$routes->addRedirect('pnl', 'pnlogin');
$routes->addRedirect('pnli', 'pinstall');
/*
 * --------------------------------------------------------------------
 * Additional Routing
 * --------------------------------------------------------------------
 *
 * There will often be times that you need additional routing and you
 * need it to be able to override any defaults in this file. Environment
 * based routes is one such time. require() additional route files here
 * to make that happen.
 *
 * You will have access to the $routes object within that file without
 * needing to reload it.
 */
if (file_exists(APPPATH . 'Config/' . ENVIRONMENT . '/Routes.php')) {
    require APPPATH . 'Config/' . ENVIRONMENT . '/Routes.php';
}
