<?php

use CodeIgniter\Router\RouteCollection;

/**
 * @var RouteCollection $routes
 */
$routes->get('/', 'Home::index');
$routes->get('expaired', 'Expaired::index');

$routes->group('auth', function($routes) {
    $routes->get('/', 'Auth::index');
    $routes->post('login', 'Auth::login');
    $routes->get('logout', 'Auth::logout');
});

$routes->group('dashboard', function($routes) {
    $routes->post('/', 'Dashboard::index');
    $routes->post('get-payment-count', 'Dashboard::getPaymentCount');
    $routes->post('get-out-in-total', 'Dashboard::getOutInTotal');
    $routes->post('get-line-out-in', 'Dashboard::getLineOutIn');

    $routes->get('add', 'Dashboard::add');
    $routes->post('get-all-data', 'Dashboard::getAllData');
    $routes->post('delete', 'Dashboard::delete');
    $routes->get('edit/(:num)', 'Dashboard::edit/$1');
    $routes->post('update', 'Dashboard::update');

    $routes->post('get-all-role-name', 'Dashboard::getAllRoleName');
    $routes->post('load-data', 'Dashboard::loadData');
});




$routes->group('area', function($routes) {

    $routes->group('subdistrict', function($routes) {
        $routes->post('/', 'Subdistrict::index');
        $routes->get('add', 'Subdistrict::add');
        $routes->post('save', 'Subdistrict::save');
        $routes->post('get-all-data', 'Subdistrict::getAllData');
        $routes->post('delete', 'Subdistrict::delete');
        $routes->get('edit/(:num)', 'Subdistrict::edit/$1');
        $routes->post('update', 'Subdistrict::update');

        $routes->post('get-all-subdistrict-name', 'Subdistrict::getAllSubdistirctName');
    });

    
    $routes->group('village', function($routes) {
        $routes->post('/', 'Village::index');
        $routes->get('add', 'Village::add');
        $routes->post('save', 'Village::save');
        $routes->post('get-all-data', 'Village::getAllData');
        $routes->post('delete', 'Village::delete');
        $routes->get('edit/(:num)', 'Village::edit/$1');
        $routes->post('update', 'Village::update');

        $routes->post('get-all-village-name', 'Village::getAllVillageName');
    });

});


$routes->group('package', function($routes) {
    $routes->post('/', 'Package::index');
    $routes->get('add', 'Package::add');
    $routes->post('save', 'Package::save');
    $routes->post('get-all-data', 'Package::getAllData');
    $routes->post('delete', 'Package::delete');
    $routes->get('edit/(:num)', 'Package::edit/$1');
    $routes->post('update', 'Package::update');

    $routes->post('get-all-package-name', 'Package::getAllPackageName');
});


$routes->group('customer', function($routes) {
    $routes->post('/', 'Customer::index');
    $routes->get('add', 'Customer::add');
    $routes->post('save', 'Customer::save');
    $routes->post('get-all-data', 'Customer::getAllData');
    $routes->post('delete', 'Customer::delete');
    $routes->get('edit/(:num)', 'Customer::edit/$1');
    $routes->post('update', 'Customer::update');
    $routes->get('detail/(:num)', 'Customer::detail/$1');
    $routes->get('export/(:any)', 'Customer::export/$1');
    $routes->post('get-payment-year', 'Customer::getPaymentYear');

    $routes->post('get-all-customer-name', 'Customer::getAllCustomerName');
});



$routes->group('payment', function($routes) {
    $routes->post('payment-history', 'Payment::index');
    $routes->get('add', 'Payment::add');
    $routes->post('get-all-data-pay-customer', 'Payment::getAllDataPayCustomer');
    $routes->post('get-all-data-customer', 'Payment::getAllDataCustomer');
    $routes->post('save-pay', 'Payment::savePay');
    $routes->post('get-all-data', 'Payment::getAllData');

    $routes->post('save', 'Payment::save');
    $routes->post('get-all-data', 'Payment::getAllData');
    $routes->post('delete', 'Payment::delete');
    $routes->get('edit/(:num)', 'Payment::edit/$1');
    $routes->post('update', 'Payment::update');
    $routes->get('detail/(:num)', 'Payment::detail/$1');

    $routes->post('get-all-payment-name', 'Payment::getAllCustomerName');
});


$routes->group('user', function($routes) {
    $routes->post('/', 'User::index');
    $routes->get('add', 'User::add');
    $routes->post('save', 'User::save');
    $routes->post('get-all-data', 'User::getAllData');
    $routes->post('delete', 'User::delete');
    $routes->get('edit/(:num)', 'User::edit/$1');
    $routes->post('update', 'User::update');
});


$routes->group('out', function($routes) {
    $routes->post('/', 'Out::index');
    $routes->get('add', 'Out::add');
    $routes->post('save', 'Out::save');
    $routes->post('get-all-data', 'Out::getAllData');
    $routes->post('delete', 'Out::delete');
    $routes->get('edit/(:num)', 'Out::edit/$1');
    $routes->post('update', 'Out::update');
});


$routes->group('role', function($routes) {
    $routes->post('/', 'Role::index');
    $routes->get('add', 'Role::add');
    $routes->post('save', 'Role::save');
    $routes->post('get-all-data', 'Role::getAllData');
    $routes->post('delete', 'Role::delete');
    $routes->get('edit/(:num)', 'Role::edit/$1');
    $routes->post('update', 'Role::update');

    $routes->post('get-all-role-name', 'Role::getAllRoleName');
});



$routes->group('setting', function($routes) {

    $routes->group('info', function($routes) {
        $routes->post('/', 'Info::index');

        $routes->get('add', 'Subdistrict::add');
        $routes->post('save', 'Subdistrict::save');
        $routes->post('get-all-data', 'Subdistrict::getAllData');
        $routes->post('delete', 'Subdistrict::delete');
        $routes->get('edit/(:num)', 'Subdistrict::edit/$1');
        $routes->post('update', 'Subdistrict::update');

        $routes->post('get-all-subdistrict-name', 'Subdistrict::getAllSubdistirctName');
    });

    
    $routes->group('village', function($routes) {
        $routes->post('/', 'Village::index');
        $routes->get('add', 'Village::add');
        $routes->post('save', 'Village::save');
        $routes->post('get-all-data', 'Village::getAllData');
        $routes->post('delete', 'Village::delete');
        $routes->get('edit/(:num)', 'Village::edit/$1');
        $routes->post('update', 'Village::update');

        $routes->post('get-all-village-name', 'Village::getAllVillageName');
    });

});














// $routes->group('category', function($routes) {
//     $routes->post('/', 'Category::index');
//     $routes->get('add', 'Category::add');
//     $routes->post('save', 'Category::save');
//     $routes->post('get-all-data', 'Category::getAllData');
//     $routes->post('delete', 'Category::delete');
//     $routes->get('edit/(:num)', 'Category::edit/$1');
//     $routes->post('update', 'Category::update');

//     $routes->post('get-all-category-name', 'Category::getAllCategoryName');
// });


// $routes->group('unit', function($routes) {
//     $routes->post('/', 'Unit::index');
//     $routes->get('add', 'Unit::add');
//     $routes->post('save', 'Unit::save');
//     $routes->post('get-all-data', 'Unit::getAllData');
//     $routes->post('delete', 'Unit::delete');
//     $routes->get('edit/(:num)', 'Unit::edit/$1');
//     $routes->post('update', 'Unit::update');

//     $routes->post('get-all-unit-name', 'Unit::getAllUnitName');
// });



// $routes->group('sale', function($routes) {
//     $routes->get('/', 'Sale::index');
//     $routes->post('add-to-cart', 'Sale::addToCart');
//     $routes->post('get-all-cart', 'Sale::getAllCart');
//     $routes->post('get-all-product', 'Sale::getAllProduct');
//     $routes->post('change-quantity', 'Sale::changeQuantity');
//     $routes->post('create-order', 'Sale::createOrder');
//     $routes->get('cart', 'Sale::cart');

//     $routes->get('add', 'Unit::add');
//     $routes->post('save', 'Unit::save');
//     $routes->post('get-all-data', 'Unit::getAllData');
//     $routes->post('delete', 'Unit::delete');
//     $routes->get('edit/(:num)', 'Unit::edit/$1');
//     $routes->post('update', 'Unit::update');

//     $routes->post('get-all-unit-name', 'Unit::getAllUnitName');
// });







