<?php
/*====================================================
/* REGISTER SCRIPTS ADMIN
/*====================================================*/
function retheme_admin_register_scripts() {
    wp_enqueue_style('retheme-admin', get_template_directory_uri() . '/core/admin/assets/css/admin-style.min.css', '', '1.2.0');
    wp_enqueue_script('retheme-admin', get_template_directory_uri() . '/core/admin/assets/js/admin-script.min.js', '', '1.0.0', true);
}
add_action('admin_enqueue_scripts', 'retheme_admin_register_scripts', 999);

/*====================================================
/* ADD PANEL MENU
/*====================================================*/
function retheme_admin_add_menu_panel() {

    add_menu_page('Theme Panel', __('Theme Panel', 'bagus-core'), 'manage_options', 'theme-panel', false, '', 999);

    add_submenu_page('theme-panel', 'Dashboard', __('Dashboard', 'bagus-core'), 'manage_options', 'theme-panel', function () {
        get_template_part("core/admin/views/dashboard");
    }, 1);

    add_submenu_page('theme-panel', 'License', __('License', 'bagus-core'), 'manage_options', 'theme-license', function () {
        get_template_part("core/admin/views/license");
    }, 99);

    add_submenu_page('theme-panel', 'Theme Setup', __('Setup', 'bagus-core'), 'manage_options', 'theme-setup', function () {
        $url = get_admin_url() . 'themes.php?page=merlin';
        echo "<script>location.href = '{$url}'</script>";
    }, 99);
}
add_action('admin_menu', 'retheme_admin_add_menu_panel');
