<?php

namespace Modules\Team\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/team', ['filter' => ['isLoggedIn', 'checkPermission'], 'namespace' => 'Modules\Team\Controllers'],   static function($routes){

    $routes->get('members', 'Team::index');
    $routes->get('member/add', 'Team::addMember');
    $routes->post('member/add', 'Team::addMember');
    $routes->get('member/view/(:any)', 'Team::viewMember/$1');
    $routes->get('member/edit/(:any)', 'Team::editMember/$1');
    $routes->post('member/update', 'Team::updateMember');
    $routes->get('member/delete/(:any)', 'Team::deleteMember/$1');

    $routes->get('member/blocks', 'Team::allBlockMembers');
    $routes->get('member/block/add', 'Team::addblockMember');
    $routes->post('member/block/add', 'Team::addblockMember');
    $routes->get('member/block/edit/(:any)', 'Team::editblockMember/$1');
    $routes->post('member/block/update', 'Team::updateblockMember');
    $routes->get('member/block/view/(:any)', 'Team::viewblockMember/$1');

    $routes->post('block/text/add', 'TeamBlocks::addTextBlock');
    $routes->post('block/heading/add', 'TeamBlocks::addHeadingBlock');
    $routes->post('block/list/add', 'TeamBlocks::addListBlock');
    $routes->post('block/image/add', 'TeamBlocks::addImageBlock');
    $routes->post('block/video/add', 'TeamBlocks::addVideoBlock');
    $routes->post('block/code/add', 'TeamBlocks::addCodeBlock');
    $routes->post('block/advert-code/add', 'TeamBlocks::addAdvertCodeBlock');

    $routes->get('block/text/edit/(:num)', 'TeamBlocks::editTextBlock/$1');
    $routes->get('block/heading/edit/(:num)', 'TeamBlocks::editHeadingBlock/$1');
    $routes->get('block/list/edit/(:num)', 'TeamBlocks::editListBlock/$1');
    $routes->get('block/image/edit/(:num)', 'TeamBlocks::editImageBlock/$1');
    $routes->get('block/video/edit/(:num)', 'TeamBlocks::editVideoBlock/$1');
    $routes->get('block/code/edit/(:num)', 'TeamBlocks::editCodeBlock/$1');
    $routes->get('block/advertcode/edit/(:num)', 'TeamBlocks::editAdvertCodeBlock/$1');

    $routes->post('block/text/update', 'TeamBlocks::updateTextBlock');
    $routes->post('block/heading/update', 'TeamBlocks::updateHeadingBlock');
    $routes->post('block/list/update', 'TeamBlocks::updateListBlock');
    $routes->post('block/image/update', 'TeamBlocks::updateImageBlock');
    $routes->post('block/video/update', 'TeamBlocks::updateVideoBlock');
    $routes->post('block/code/update', 'TeamBlocks::updateCodeBlock');
    $routes->post('block/advertcode/update', 'TeamBlocks::updateAdvertCodeBlock');

    $routes->get('block/text/delete/(:num)', 'TeamBlocks::deleteTextBlock/$1');
    $routes->get('block/heading/delete/(:num)', 'TeamBlocks::deleteHeadingBlock/$1');
    $routes->get('block/list/delete/(:num)', 'TeamBlocks::deleteListBlock/$1');
    $routes->get('block/image/delete/(:num)', 'TeamBlocks::deleteImageBlock/$1');
    $routes->get('block/video/delete/(:num)', 'TeamBlocks::deleteVideoBlock/$1');
    $routes->get('block/code/delete/(:num)', 'TeamBlocks::deleteCodeBlock/$1');
    $routes->get('block/advertcode/delete/(:num)', 'TeamBlocks::deleteAdvertCodeBlock/$1');

    $routes->get('categories', 'Team::categories');
    $routes->post('categories/add', 'Team::addCategory');
    $routes->get('categories/edit/(:any)', 'Team::editCategory/$1');
    $routes->post('categories/update', 'Team::updateCategory');
    $routes->get('categories/delete/(:any)', 'Team::delCategory/$1');

});
