<?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 (is_file(SYSTEMPATH . 'Config/Routes.php')) {
    require SYSTEMPATH . 'Config/Routes.php';
}

/*
 * --------------------------------------------------------------------
 * Router Setup
 * --------------------------------------------------------------------
 */
$routes->setDefaultNamespace('App\Controllers');
$routes->setDefaultController('Home');
$routes->setDefaultMethod('index');
$routes->setTranslateURIDashes(false);
$routes->set404Override();
// The Auto Routing (Legacy) is very dangerous. It is easy to create vulnerable apps
// where controller filters or CSRF protection are bypassed.
// If you don't want to define all routes, please use the Auto Routing (Improved).
// Set `$autoRoutesImproved` to true in `app/Config/Feature.php` and set the following to true.
// $routes->setAutoRoute(false);

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

// We get a performance increase by specifying the default
// route since we don't have to scan directories.
$routes->get('login', 'CredentialController::Login');
$routes->POST('login/auth', 'CredentialController::auth');
$routes->get('user/logout', 'CredentialController::Logout');

$routes->get('/', 'Dashboard::index',['filter' => 'auth']);
//master page


// Finance Rate
$routes->get('master/finance', 'MasterController::Finance',['filter' => 'auth']);
$routes->GET('finance/talent/fetch', 'MasterController::Get_talent');
$routes->POST('finance/simpan', 'MasterController::Finance_simpan');
$routes->GET('finance/fetch', 'MasterController::Finance_fetch');
$routes->POST('finance/edit', 'MasterController::Finance_detail');
$routes->POST('finance/update', 'MasterController::Finance_update');


// User
$routes->get('master/user', 'CredentialController::Masteruser',['filter' => 'auth']);
$routes->POST('user/simpan', 'CredentialController::Simpan');
$routes->GET('user/fetch', 'CredentialController::fetch');
$routes->POST('user/edit', 'CredentialController::get_detail');
$routes->POST('user/update', 'CredentialController::Update_data');
$routes->POST('user/delete', 'CredentialController::delete');
$routes->POST('user/fetch/where', 'CredentialController::Wherecon'); 
$routes->GET('user/profile', 'CredentialController::User_profile',['filter' => 'auth']);
$routes->POST('user/update-profile', 'CredentialController::Update_profile');



//brand
$routes->get('master/brand', 'MasterController::Brand',['filter' => 'auth']);
$routes->POST('brand/simpan', 'MasterController::Brand_simpan');
$routes->GET('brand/fetch', 'MasterController::Brand_fetch');
$routes->POST('brand/edit', 'MasterController::Brand_detail');
$routes->POST('brand/update', 'MasterController::Brand_update');
$routes->POST('brand/delete', 'MasterController::Brand_delete');


//talent
$routes->get('master/talent', 'MasterController::Talent',['filter' => 'auth']);
$routes->POST('talent/simpan', 'MasterController::Talent_simpan');
$routes->GET('talent/fetch', 'MasterController::Talent_fetch');
$routes->POST('talent/edit', 'MasterController::Talent_detail');
$routes->POST('talent/update', 'MasterController::Talent_update');



// Staf
$routes->get('master/staff', 'MasterController::Staff',['filter' => 'auth']);
$routes->POST('staf/simpan', 'MasterController::Staf_simpan');
$routes->GET('staf/fetch', 'MasterController::Staf_fetch');
$routes->POST('staf/edit', 'MasterController::Staf_detail');
$routes->POST('staf/update', 'MasterController::Staf_update');

//transactional page
$routes->get('tran/job-payment', 'TransactionalController::Job_payment');
$routes->GET('tran/get/talent', 'TransactionalController::Display_talent');
$routes->GET('tran/get/brand', 'TransactionalController::Display_brand');
$routes->POST('tran/simpan/job-payment/manager', 'TransactionalController::Job_payment_save_manager');
$routes->POST('tran/update/job-payment', 'TransactionalController::Job_payment_update');
$routes->GET('tran/getdeal/fetch', 'TransactionalController::Dealjob_fetch');
$routes->POST('tran/deal/edit', 'TransactionalController::Deal_detail');



$routes->get('tran/draft-post', 'TransactionalController::draf_post');
$routes->POST('tran/simpan/schedule', 'TransactionalController::draft_save');
$routes->POST('tran/get/calendar', 'TransactionalController::calendarView');
$routes->GET('tran/get/event/(:num)', 'TransactionalController::event_detail/$1');
$routes->POST('getevent/edit', 'TransactionalController::eventdetailshow');
$routes->POST('tran/update/schedule', 'TransactionalController::update_schedule');





$routes->get('tran/talent-performance', 'TransactionalController::talent_performance');
$routes->POST('tran/simpan/performance/save', 'TransactionalController::performance_save');
$routes->GET('tran/getperformance/fetch', 'TransactionalController::performance_fetch');
$routes->POST('tran/performance/edit', 'TransactionalController::Performance_detail');
$routes->POST('tran/update/performance', 'TransactionalController::Performance_update');


//Report
$routes->get('report/finance-report', 'ReportController::finance_report');
$routes->POST('report/search-report', 'ReportController::get_finance');
$routes->get('report/finance-recap', 'ReportController::finance_recap');
$routes->POST('report/search-recap', 'ReportController::get_recap');
$routes->get('report/deal-job-payment', 'ReportController::deal_job_payment');
$routes->get('report/draft-post', 'ReportController::draft_post');
$routes->get('report/talent-performance', 'ReportController::talent_performance');
$routes->POST('report/search-performance', 'ReportController::get_performance');
$routes->POST('report/schedule', 'ReportController::calendarView');

/*
 * --------------------------------------------------------------------
 * 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 (is_file(APPPATH . 'Config/' . ENVIRONMENT . '/Routes.php')) {
    require APPPATH . 'Config/' . ENVIRONMENT . '/Routes.php';
}
