<?php
defined('BASEPATH') OR exit('No direct script access allowed');

/*
| -------------------------------------------------------------------------
| URI ROUTING
| -------------------------------------------------------------------------
| This file lets you re-map URI requests to specific controller functions.
|
| Typically there is a one-to-one relationship between a URL string
| and its corresponding controller class/method. The segments in a
| URL normally follow this pattern:
|
|	example.com/class/method/id/
|
| In some instances, however, you may want to remap this relationship
| so that a different class/function is called than the one
| corresponding to the URL.
|
| Please see the user guide for complete details:
|
|	https://codeigniter.com/userguide3/general/routing.html
|
| -------------------------------------------------------------------------
| RESERVED ROUTES
| -------------------------------------------------------------------------
|
| There are three reserved routes:
|
|	$route['default_controller'] = 'welcome';
|
| This route indicates which controller class should be loaded if the
| URI contains no data. In the above example, the "welcome" class
| would be loaded.
|
|	$route['404_override'] = 'errors/page_missing';
|
| This route will tell the Router which controller/method to use if those
| provided in the URL cannot be matched to a valid route.
|
|	$route['translate_uri_dashes'] = FALSE;
|
| This is not exactly a route, but allows you to automatically route
| controller and method names that contain dashes. '-' isn't a valid
| class or method name character, so it requires translation.
| When you set this option to TRUE, it will replace ALL dashes in the
| controller and method URI segments.
|
| Examples:	my-controller/index	-> my_controller/index
|		my-controller/my-method	-> my_controller/my_method
*/
$route['default_controller'] = 'login';
$route['login'] = 'login/index';
$route['logout'] = 'logout/index';
$route['dashboard'] = 'dashboard/index';
$route['dashboard/ajax_stat'] = 'dashboard/ajax_stat';

// Master Organisasi
$route['master/divisi']              = 'master/divisi/index';
$route['master/divisi/tambah']       = 'master/divisi/tambah';
$route['master/divisi/edit/(:num)']  = 'master/divisi/edit/$1';
$route['master/divisi/toggle/(:num)']= 'master/divisi/toggle/$1';

// Master Jabatan
$route['master/jabatan']                       = 'master/jabatan/index';
$route['master/jabatan/tambah']                = 'master/jabatan/tambah';
$route['master/jabatan/edit/(:num)']           = 'master/jabatan/edit/$1';
$route['master/jabatan/toggle/(:num)']         = 'master/jabatan/toggle/$1';
$route['master/jabatan/ajax_by_divisi/(:num)'] = 'master/jabatan/ajax_by_divisi/$1';

// Master Pegawai
$route['master/pegawai']                        = 'master/pegawai/index';
$route['master/pegawai/tambah']                 = 'master/pegawai/tambah';
$route['master/pegawai/edit/(:num)']            = 'master/pegawai/edit/$1';
$route['master/pegawai/detail/(:num)']          = 'master/pegawai/detail/$1';
$route['master/pegawai/komponen/(:num)']        = 'master/pegawai/komponen/$1';
$route['master/pegawai/toggle_status/(:num)']   = 'master/pegawai/toggle_status/$1';
$route['master/pegawai/ajax_list']              = 'master/pegawai/ajax_list';

// Master Komponen Gaji
$route['master/komponen']              = 'master/komponen/index';
$route['master/komponen/tambah']       = 'master/komponen/tambah';
$route['master/komponen/edit/(:num)']  = 'master/komponen/edit/$1';
$route['master/komponen/toggle/(:num)']= 'master/komponen/toggle/$1';
$route['master/komponen/preview-formula'] = 'master/komponen/preview_formula';

// Mapping Komponen Pegawai
$route['master/mapping_komponen']                    = 'master/mappingkomponen/index';
$route['master/mapping_komponen/pegawai/(:num)']     = 'master/mappingkomponen/pegawai/$1';
$route['master/mapping_komponen/pegawai/(:num)/save']= 'master/mappingkomponen/pegawai/$1';

// Konfigurasi Sistem
$route['master/konfigurasi']             = 'master/konfigurasi/index';
$route['master/konfigurasi/simpan']      = 'master/konfigurasi/simpan';
$route['master/konfigurasi/test_ai_connection'] = 'master/konfigurasi/test_ai_connection';

// AI Chatbox
$route['ai/chat/sessions']               = 'ai/chatbox/sessions';
$route['ai/chat/messages/(:num)']        = 'ai/chatbox/messages/$1';
$route['ai/chat/session/delete/(:num)']  = 'ai/chatbox/delete_session/$1';
$route['ai/chat/send']                   = 'ai/chatbox/send';

// Hari Libur
$route['master/harlibur']              = 'master/harilibur/index';
$route['master/harlibur/events_json']  = 'master/harilibur/events_json';
$route['master/harlibur/save_ajax']    = 'master/harilibur/save_ajax';
$route['master/harlibur/delete_ajax/(:num)'] = 'master/harilibur/delete_ajax/$1';
$route['master/harlibur/sync_nasional'] = 'master/harilibur/sync_nasional';
$route['master/harlibur/tambah']       = 'master/harilibur/tambah';
$route['master/harlibur/edit/(:num)']  = 'master/harilibur/edit/$1';
$route['master/harlibur/hapus/(:num)'] = 'master/harilibur/hapus/$1';

// Riwayat Perubahan Pegawai
$route['master/pegawai/riwayat']       = 'master/pegawai/riwayat';

// Import Pegawai
$route['master/import_pegawai']          = 'master/importpegawai/index';
$route['master/import_pegawai/template'] = 'master/importpegawai/template';
$route['master/import_pegawai/upload']   = 'master/importpegawai/upload';
$route['master/import_pegawai/simpan']   = 'master/importpegawai/simpan';

// Sprint 4: Absensi, Izin/Cuti, Lembur
$route['transaksi/absensi']              = 'transaksi/absensi/index';
$route['transaksi/absensi/ajax_list']    = 'transaksi/absensi/ajax_list';
$route['transaksi/absensi/tambah']       = 'transaksi/absensi/tambah';
$route['transaksi/absensi/detail/(:num)']= 'transaksi/absensi/detail/$1';
$route['transaksi/absensi/detail_json/(:num)'] = 'transaksi/absensi/detail_json/$1';
$route['transaksi/absensi/edit/(:num)']  = 'transaksi/absensi/edit/$1';
$route['transaksi/absensi/simpan']       = 'transaksi/absensi/simpan';
$route['transaksi/absensi/simpan_inline'] = 'transaksi/absensi/simpan_inline';
$route['transaksi/absensi/hapus/(:num)'] = 'transaksi/absensi/hapus/$1';
$route['transaksi/absensi/import']       = 'transaksi/absensi/import';
$route['transaksi/absensi/template']     = 'transaksi/absensi/template';
$route['transaksi/absensi/reset_periode'] = 'transaksi/absensi/reset_periode';
$route['transaksi/absensi/delete_batch/(:num)'] = 'transaksi/absensi/delete_batch/$1';

$route['transaksi/izin_cuti']            = 'transaksi/izincuti/index';
$route['transaksi/izin_cuti/ajax_list']  = 'transaksi/izincuti/ajax_list';
$route['transaksi/izin_cuti/ajax_pegawai_search'] = 'transaksi/izincuti/ajax_pegawai_search';
$route['transaksi/izin_cuti/tambah']     = 'transaksi/izincuti/tambah';
$route['transaksi/izin_cuti/edit/(:num)']= 'transaksi/izincuti/edit/$1';
$route['transaksi/izin_cuti/simpan']     = 'transaksi/izincuti/simpan';
$route['transaksi/izin_cuti/approve/(:num)'] = 'transaksi/izincuti/approve/$1';
$route['transaksi/izin_cuti/reject/(:num)']  = 'transaksi/izincuti/reject/$1';
$route['transaksi/izin_cuti/hapus/(:num)']   = 'transaksi/izincuti/hapus/$1';

$route['transaksi/lembur']               = 'transaksi/lembur/index';
$route['transaksi/lembur/ajax_list']     = 'transaksi/lembur/ajax_list';
$route['transaksi/lembur/ajax_pegawai_search'] = 'transaksi/lembur/ajax_pegawai_search';
$route['transaksi/lembur/tambah']        = 'transaksi/lembur/tambah';
$route['transaksi/lembur/edit/(:num)']   = 'transaksi/lembur/edit/$1';
$route['transaksi/lembur/simpan']        = 'transaksi/lembur/simpan';
$route['transaksi/lembur/approve/(:num)']= 'transaksi/lembur/approve/$1';
$route['transaksi/lembur/reject/(:num)'] = 'transaksi/lembur/reject/$1';
$route['transaksi/lembur/hapus/(:num)']  = 'transaksi/lembur/hapus/$1';

// Sprint 5: Sistem Payroll
$route['transaksi/payroll']              = 'transaksi/payroll/index';
$route['transaksi/payroll/tambah']       = 'transaksi/payroll/tambah';
$route['transaksi/payroll/simpan']       = 'transaksi/payroll/simpan';
$route['transaksi/payroll/approval']     = 'transaksi/payroll/approval';
$route['transaksi/payroll/detail/(:num)']= 'transaksi/payroll/detail/$1';
$route['transaksi/payroll/proses/(:num)']= 'transaksi/payroll/proses/$1';
// API endpoints for modal processing and ajax employee list
$route['transaksi/payroll/proses_api/(:num)'] = 'transaksi/payroll/proses_api/$1';
$route['transaksi/payroll/ajax_employees/(:num)'] = 'transaksi/payroll/ajax_employees/$1';
$route['transaksi/payroll/ajax_detail_list/(:num)'] = 'transaksi/payroll/ajax_detail_list/$1';
$route['transaksi/payroll/detail_komponen_json/(:num)/(:num)'] = 'transaksi/payroll/detail_komponen_json/$1/$2';
$route['transaksi/payroll/adjustment_save'] = 'transaksi/payroll/adjustment_save';
$route['transaksi/payroll/adjustment_delete'] = 'transaksi/payroll/adjustment_delete';
$route['transaksi/payroll/approve/(:num)']= 'transaksi/payroll/approve/$1';
$route['transaksi/payroll/lock/(:num)']  = 'transaksi/payroll/lock/$1';
$route['transaksi/payroll/hapus/(:num)'] = 'transaksi/payroll/hapus/$1';

// Output: Slip Gaji
$route['output/slip_gaji']                     = 'output/slipgaji/index';
$route['output/slip_gaji/cetak/(:num)']        = 'output/slipgaji/cetak/$1';
$route['output/slip_gaji/kolektif/(:num)']     = 'output/slipgaji/kolektif/$1';

// Output: Laporan
$route['output/laporan']                       = 'output/laporan/index';
$route['output/laporan/payroll']               = 'output/laporan/payroll';
$route['output/laporan/bank']                  = 'output/laporan/bank';
$route['output/laporan/absensi']               = 'output/laporan/absensi';

// Pengaturan: Manajemen Pengguna
$route['pengaturan/pengguna']                       = 'pengaturan/pengguna/index';
$route['pengaturan/pengguna/tambah']                = 'pengaturan/pengguna/tambah';
$route['pengaturan/pengguna/edit/(:num)']            = 'pengaturan/pengguna/edit/$1';
$route['pengaturan/pengguna/simpan']                = 'pengaturan/pengguna/simpan';
$route['pengaturan/pengguna/toggle_active/(:num)']   = 'pengaturan/pengguna/toggle_active/$1';
$route['pengaturan/pengguna/reset_password/(:num)']  = 'pengaturan/pengguna/reset_password/$1';
$route['pengaturan/pengguna/hapus/(:num)']           = 'pengaturan/pengguna/hapus/$1';

$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;

// Master Shift (Jadwal Kerja)
$route['master/shift']                             = 'master/shift/index';
$route['master/shift/tambah']                      = 'master/shift/tambah';
$route['master/shift/edit/(:num)']                 = 'master/shift/edit/$1';
$route['master/shift/hapus/(:num)']                = 'master/shift/hapus/$1';
$route['master/shift/assignment']                  = 'master/shift/assignment';
$route['master/shift/simpan_assignment']           = 'master/shift/simpan_assignment';
$route['master/shift/hapus_assignment/(:num)']     = 'master/shift/hapus_assignment/$1';
$route['master/shift/hapus_jadwal_group']          = 'master/shift/hapus_jadwal_group';
$route['master/shift/get_pegawai_by_divisi']       = 'master/shift/get_pegawai_by_divisi';
