<?php
$prefixAdmin = config('zvn.url.prefix_admin');

Route::group(['prefix' => $prefixAdmin, 'namespace' => 'Admin', 'middleware' => ['permission.admin']], function () {
    // ============================== DASHBOARD ==============================
    $prefix         = 'dashboard';
    $controllerName = 'dashboard';
    Route::group(['prefix' =>  $prefix], function () use ($controllerName) {
        $controller = ucfirst($controllerName)  . 'Controller@';
        Route::get('/', [ 'as' => $controllerName,                  'uses' => $controller . 'index' ]);
    });

    // ============================== SLIDER ==============================
    $prefix         = 'slider';
    $controllerName = 'slider';
    Route::group(['prefix' =>  $prefix], function () use ($controllerName) {
        $controller = ucfirst($controllerName)  . 'Controller@';
        Route::get('/', [ 'as' => $controllerName,                  'uses' => $controller . 'index' ]);
        Route::get('form/{id?}', [ 'as' => $controllerName . '/form',        'uses' => $controller . 'form'])->where('id', '[0-9]+');
        Route::post('save', [ 'as' => $controllerName . '/save',        'uses' => $controller . 'save']);
        Route::get('delete/{id}', [ 'as' => $controllerName . '/delete',      'uses' => $controller . 'delete'])->where('id', '[0-9]+');
        Route::get('change-status-{status}/{id}', [ 'as' => $controllerName . '/status',      'uses' => $controller . 'status'])->where('id', '[0-9]+');
    });

    // ============================== ATTRIBUTE ==============================
    $prefix         = 'attribute';
    $controllerName = 'attribute';
    Route::group(['prefix' =>  $prefix], function () use ($controllerName) {
        $controller = ucfirst($controllerName)  . 'Controller@';
        Route::get('/', [ 'as' => $controllerName,                  'uses' => $controller . 'index' ]);
        Route::get('form/{id?}', [ 'as' => $controllerName . '/form',        'uses' => $controller . 'form'])->where('id', '[0-9]+');
        Route::post('save', [ 'as' => $controllerName . '/save',        'uses' => $controller . 'save']);
        Route::get('delete/{id}', [ 'as' => $controllerName . '/delete',      'uses' => $controller . 'delete'])->where('id', '[0-9]+');
        Route::get('change-status-{status}/{id}', [ 'as' => $controllerName . '/status',      'uses' => $controller . 'status'])->where('id', '[0-9]+');
        Route::get('change-ordering-{ordering}/{id}', [ 'as' => $controllerName . '/ordering',      'uses' => $controller . 'ordering'])->where('id', '[0-9]+');
    });

    // ============================== CATEGORY ==============================
    $prefix         = 'category';
    $controllerName = 'category';
    Route::group(['prefix' =>  $prefix], function () use ($controllerName) {
        $controller = ucfirst($controllerName)  . 'Controller@';
        Route::get('/', [ 'as' => $controllerName,                  'uses' => $controller . 'index' ]);
        Route::get('form/{id?}', [ 'as' => $controllerName . '/form',        'uses' => $controller . 'form'])->where('id', '[0-9]+');
        Route::post('save', [ 'as' => $controllerName . '/save',        'uses' => $controller . 'save']);
        Route::get('delete/{id}', [ 'as' => $controllerName . '/delete',      'uses' => $controller . 'delete'])->where('id', '[0-9]+');
        Route::get('change-ordering-{ordering}/{id}', [ 'as' => $controllerName . '/ordering',      'uses' => $controller . 'ordering'])->where('id', '[0-9]+');
        Route::get('change-status-{status}/{id}', [ 'as' => $controllerName . '/status',      'uses' => $controller . 'status'])->where('id', '[0-9]+');
        Route::get('change-is-home-{is_home}/{id}', [ 'as' => $controllerName . '/isHome',      'uses' => $controller . 'isHome'])->where('id', '[0-9]+');
        Route::get('change-display-{display}/{id}', [ 'as' => $controllerName . '/display',     'uses' => $controller . 'display']);
    });

    // ============================== ARTICLE ==============================
    $prefix         = 'article';
    $controllerName = 'article';
    Route::group(['prefix' =>  $prefix], function () use ($controllerName) {
        $controller = ucfirst($controllerName)  . 'Controller@';
        Route::get('/', [ 'as' => $controllerName,                  'uses' => $controller . 'index' ]);
        Route::get('form/{id?}', [ 'as' => $controllerName . '/form',        'uses' => $controller . 'form'])->where('id', '[0-9]+');
        Route::post('save', [ 'as' => $controllerName . '/save',        'uses' => $controller . 'save']);
        Route::get('delete/{id}', [ 'as' => $controllerName . '/delete',      'uses' => $controller . 'delete'])->where('id', '[0-9]+');
        Route::get('change-status-{status}/{id}', [ 'as' => $controllerName . '/status',      'uses' => $controller . 'status']);
        Route::get('change-type-{type}/{id}', [ 'as' => $controllerName . '/type',        'uses' => $controller . 'type']);
        Route::get('change-category-{category_id}/{id}', [ 'as' => $controllerName . '/changeCategory',        'uses' => $controller . 'changeCategory']);
    });

    // ============================== CATEGORY PRODUCT ==============================
    $prefix         = 'categoryProduct';
    $controllerName = 'categoryProduct';
    Route::group(['prefix' =>  $prefix], function () use ($controllerName) {
        $controller = ucfirst($controllerName)  . 'Controller@';
        Route::get('/', [ 'as' => $controllerName,                  'uses' => $controller . 'index' ]);
        Route::get('form/{id?}', [ 'as' => $controllerName . '/form',        'uses' => $controller . 'form'])->where('id', '[0-9]+');
        Route::post('save', [ 'as' => $controllerName . '/save',        'uses' => $controller . 'save']);
        Route::get('delete/{id}', [ 'as' => $controllerName . '/delete',      'uses' => $controller . 'delete'])->where('id', '[0-9]+');
        Route::get('change-ordering-{ordering}/{id}', [ 'as' => $controllerName . '/ordering',      'uses' => $controller . 'ordering'])->where('id', '[0-9]+');
        Route::get('change-status-{status}/{id}', [ 'as' => $controllerName . '/status',      'uses' => $controller . 'status'])->where('id', '[0-9]+');
        Route::get('change-is-home-{is_home}/{id}', [ 'as' => $controllerName . '/isHome',      'uses' => $controller . 'isHome'])->where('id', '[0-9]+');
        Route::get('change-display-{display}/{id}', [ 'as' => $controllerName . '/display',     'uses' => $controller . 'display']);
    });

    // ============================== CITY ==============================
    $prefix         = 'city';
    $controllerName = 'city';
    Route::group(['prefix' =>  $prefix], function () use ($controllerName) {
        $controller = ucfirst($controllerName)  . 'Controller@';
        Route::get('/', [ 'as' => $controllerName,                  'uses' => $controller . 'index' ]);
        Route::get('form/{id?}', [ 'as' => $controllerName . '/form',        'uses' => $controller . 'form'])->where('id', '[0-9]+');
        Route::post('save', [ 'as' => $controllerName . '/save',        'uses' => $controller . 'save']);
        Route::get('delete/{id}', [ 'as' => $controllerName . '/delete',      'uses' => $controller . 'delete'])->where('id', '[0-9]+');
        Route::get('change-status-{status}/{id}', [ 'as' => $controllerName . '/status',      'uses' => $controller . 'status']);
    });

    // ============================== COUPON ==============================
    $prefix         = 'coupon';
    $controllerName = 'coupon';
    Route::group(['prefix' =>  $prefix], function () use ($controllerName) {
        $controller = ucfirst($controllerName)  . 'Controller@';
        Route::get('/', [ 'as' => $controllerName,                  'uses' => $controller . 'index' ]);
        Route::get('form/{id?}', [ 'as' => $controllerName . '/form',        'uses' => $controller . 'form'])->where('id', '[0-9]+');
        Route::post('save', [ 'as' => $controllerName . '/save',        'uses' => $controller . 'save']);
        Route::get('delete/{id}', [ 'as' => $controllerName . '/delete',      'uses' => $controller . 'delete'])->where('id', '[0-9]+');
        Route::get('change-status-{status}/{id}', [ 'as' => $controllerName . '/status',      'uses' => $controller . 'status']);
        Route::get('change-code', [ 'as' => $controllerName . '/code',      'uses' => $controller . 'code']);
    });

    // ============================== PRODUCT ==============================
    $prefix         = 'product';
    $controllerName = 'product';
    Route::group(['prefix' =>  $prefix], function () use ($controllerName) {
        $controller = ucfirst($controllerName)  . 'Controller@';
        Route::get('/', [ 'as' => $controllerName,                  'uses' => $controller . 'index' ]);
        Route::get('form/{id?}', [ 'as' => $controllerName . '/form',        'uses' => $controller . 'form'])->where('id', '[0-9]+');
        Route::post('save', [ 'as' => $controllerName . '/save',        'uses' => $controller . 'save']);
        Route::post('save-attribute', [ 'as' => $controllerName . '/save-attribute',        'uses' => $controller . 'saveAttribute']);
        Route::post('save-attribute-price', [ 'as' => $controllerName . '/save-attribute-price',        'uses' => $controller . 'saveAttributePrice']);
        Route::post('upload-image', [ 'as' => $controllerName . '/upload-image',        'uses' => $controller . 'uploadImage']);
        Route::get('delete-product-attribute/{id}', [ 'as' => $controllerName . '/deleteProductAttribute',      'uses' => $controller . 'deleteProductAttribute'])->where('id', '[0-9]+');
        Route::get('ajax-product-detail/{id}', [ 'as' => $controllerName . '/ajaxProductDetail',      'uses' => $controller . 'ajaxProductDetail'])->where('id', '[0-9]+');
        Route::get('delete/{id}', [ 'as' => $controllerName . '/delete',      'uses' => $controller . 'delete'])->where('id', '[0-9]+');
        Route::get('change-status-{status}/{id}', [ 'as' => $controllerName . '/status',      'uses' => $controller . 'status']);
        Route::get('change-type-{type}/{id}', [ 'as' => $controllerName . '/type',        'uses' => $controller . 'type']);
        Route::get('change-category-{category_id}/{id}', [ 'as' => $controllerName . '/changeCategory',        'uses' => $controller . 'changeCategory']);
    });

    // ============================== SETTING ==============================
    $prefix         = 'setting';
    $controllerName = 'setting';
    Route::group(['prefix' =>  $prefix], function () use ($controllerName) {
        $controller = ucfirst($controllerName)  . 'Controller@';
        Route::get('/', [ 'as' => $controllerName,                  'uses' => $controller . 'index' ]);
        Route::get('form/{id?}', [ 'as' => $controllerName . '/form',        'uses' => $controller . 'form'])->where('id', '[0-9]+');
        Route::post('save', [ 'as' => $controllerName . '/save',        'uses' => $controller . 'save']);
        Route::get('delete/{id}', [ 'as' => $controllerName . '/delete',      'uses' => $controller . 'delete'])->where('id', '[0-9]+');
        Route::get('change-status-{status}/{id}', [ 'as' => $controllerName . '/status',      'uses' => $controller . 'status']);
        Route::get('change-type-{type}/{id}', [ 'as' => $controllerName . '/type',        'uses' => $controller . 'type']);
    });

    // ============================== USER ==============================
    $prefix         = 'user';
    $controllerName = 'user';
    Route::group(['prefix' =>  $prefix], function () use ($controllerName) {
        $controller = ucfirst($controllerName)  . 'Controller@';
        Route::get('/', [ 'as' => $controllerName,                  'uses' => $controller . 'index' ]);
        Route::get('form-change-user-password', [ 'as' => $controllerName . '/form-change-user-password',                  'uses' => $controller . 'formChangeUserPassword' ]);
        Route::post('change-user-password', [ 'as' => $controllerName . '/change-user-password',        'uses' => $controller . 'changeUserPassword']);
        Route::get('form/{id?}', [ 'as' => $controllerName . '/form',        'uses' => $controller . 'form'])->where('id', '[0-9]+');
        Route::post('save', [ 'as' => $controllerName . '/save',        'uses' => $controller . 'save']);
        Route::post('change-password', [ 'as' => $controllerName . '/change-password',        'uses' => $controller . 'changePassword']);
        Route::post('change-level', [ 'as' => $controllerName . '/change-level',        'uses' => $controller . 'changeLevel']);
        Route::get('delete/{id}', [ 'as' => $controllerName . '/delete',      'uses' => $controller . 'delete'])->where('id', '[0-9]+');
        Route::get('change-status-{status}/{id}', [ 'as' => $controllerName . '/status',      'uses' => $controller . 'status']);
        Route::get('change-level-{level}/{id}', [ 'as' => $controllerName . '/level',      'uses' => $controller . 'level']);
    });

    // ============================== CONTACT ==============================
    $prefix         = 'contact';
    $controllerName = 'contact';
    Route::group(['prefix' =>  $prefix], function () use ($controllerName) {
        $controller = ucfirst($controllerName)  . 'Controller@';
        Route::get('/', [ 'as' => $controllerName,                  'uses' => $controller . 'index' ]);
        Route::get('form/{id?}', [ 'as' => $controllerName . '/form',        'uses' => $controller . 'form'])->where('id', '[0-9]+');
        Route::post('save', [ 'as' => $controllerName . '/save',        'uses' => $controller . 'save']);
        Route::get('delete/{id}', [ 'as' => $controllerName . '/delete',      'uses' => $controller . 'delete'])->where('id', '[0-9]+');
        Route::get('change-status-{status}/{id}', [ 'as' => $controllerName . '/status',      'uses' => $controller . 'status']);
    });

    // ============================== MENU ==============================
    $prefix         = 'menu';
    $controllerName = 'menu';
    Route::group(['prefix' =>  $prefix], function () use ($controllerName) {
        $controller = ucfirst($controllerName)  . 'Controller@';
        Route::get('/', [ 'as' => $controllerName,                  'uses' => $controller . 'index' ]);
        Route::get('form/{id?}', [ 'as' => $controllerName . '/form',        'uses' => $controller . 'form'])->where('id', '[0-9]+');
        Route::post('save', [ 'as' => $controllerName . '/save',        'uses' => $controller . 'save']);
        Route::post('change-password', [ 'as' => $controllerName . '/change-password',        'uses' => $controller . 'changePassword']);
        Route::post('change-level', [ 'as' => $controllerName . '/change-level',        'uses' => $controller . 'changeLevel']);
        Route::get('delete/{id}', [ 'as' => $controllerName . '/delete',      'uses' => $controller . 'delete'])->where('id', '[0-9]+');
        Route::get('change-status-{status}/{id}', [ 'as' => $controllerName . '/status',      'uses' => $controller . 'status']);
        Route::get('change-level-{level}/{id}', [ 'as' => $controllerName . '/level',      'uses' => $controller . 'level']);
        Route::get('change-type_menu-{type_menu}/{id}', [ 'as' => $controllerName . '/type_menu',        'uses' => $controller . 'type_menu']);
        Route::get('change-type_open-{type_open}/{id}', [ 'as' => $controllerName . '/type_open',        'uses' => $controller . 'type_open']);
        Route::get('change-ordering-{ordering}/{id}', [ 'as' => $controllerName . '/ordering',        'uses' => $controller . 'ordering']);
    });

    // ============================== RSS ==============================
    $prefix         = 'rss';
    $controllerName = 'rss';
    Route::group(['prefix' =>  $prefix], function () use ($controllerName) {
        $controller = ucfirst($controllerName)  . 'Controller@';
        Route::get('/', [ 'as' => $controllerName,                  'uses' => $controller . 'index' ]);
        Route::get('form/{id?}', [ 'as' => $controllerName . '/form',        'uses' => $controller . 'form'])->where('id', '[0-9]+');
        Route::post('save', [ 'as' => $controllerName . '/save',        'uses' => $controller . 'save']);
        Route::get('delete/{id}', [ 'as' => $controllerName . '/delete',      'uses' => $controller . 'delete'])->where('id', '[0-9]+');
        Route::get('change-status-{status}/{id}', [ 'as' => $controllerName . '/status',      'uses' => $controller . 'status'])->where('id', '[0-9]+');
    });

    // ============================== GALLERY ==============================
    $prefix         = 'gallery';
    $controllerName = 'gallery';
    Route::group(['prefix' =>  $prefix], function () use ($controllerName) {
        $controller = ucfirst($controllerName)  . 'Controller@';
        Route::get('/', [ 'as' => $controllerName,                  'uses' => $controller . 'index' ]);
    });

    // ============================== VIDEO ==============================
    $prefix         = 'video';
    $controllerName = 'video';
    Route::group(['prefix' =>  $prefix], function () use ($controllerName) {
        $controller = ucfirst($controllerName)  . 'Controller@';
        Route::get('/', [ 'as' => $controllerName,                  'uses' => $controller . 'index' ]);
        Route::post('save', [ 'as' => $controllerName . '/save',        'uses' => $controller . 'save']);
    });

    // ============================== RSS2 ==============================
    $prefix         = 'rss2';
    $controllerName = 'rss2';
    Route::group(['prefix' =>  $prefix], function () use ($controllerName) {
        $controller = ucfirst($controllerName)  . 'Controller@';
        Route::get('/', [ 'as' => $controllerName,                  'uses' => $controller . 'index' ]);
        Route::get('form/{id?}', [ 'as' => $controllerName . '/form',        'uses' => $controller . 'form'])->where('id', '[0-9]+');
        Route::post('save', [ 'as' => $controllerName . '/save',        'uses' => $controller . 'save']);
        Route::get('delete/{id}', [ 'as' => $controllerName . '/delete',      'uses' => $controller . 'delete'])->where('id', '[0-9]+');
        Route::get('change-status-{status}/{id}', [ 'as' => $controllerName . '/status',      'uses' => $controller . 'status'])->where('id', '[0-9]+');
    });
});
