<?php
/**
 * Rest House Theme - Admin About Page & Notices
 */

add_action('admin_menu', 'rest_house_gettingstarted');
function rest_house_gettingstarted() {
    add_theme_page(
        esc_html__('About Theme', 'rest-house'),
        esc_html__('About Theme', 'rest-house'),
        'edit_theme_options',
        'rest-house-guide-page',
        'rest_house_guide'
    );
}

add_action('admin_enqueue_scripts', 'rest_house_admin_theme_style');
function rest_house_admin_theme_style() {
    wp_enqueue_style(
        'rest-house-custom-admin-style',
        get_template_directory_uri() . '/inc/dashboard/get_started_info.css'
    );
    wp_enqueue_script(
        'rest-house-tab',
        get_template_directory_uri() . '/inc/dashboard/js/get_started_tab.js',
        array('jquery'),
        false,
        true
    );
}
add_action('admin_notices', 'rest_house_admin_notice');
function rest_house_admin_notice() {
    if (!current_user_can('manage_options')) return;

    $dismissed = get_option('rest_house_admin_notice');
    $screen = get_current_screen();
    global $pagenow;

    // Don't show notice if dismissed or on About Theme page
    if ($dismissed || ($screen && $screen->id === 'appearance_page_rest-house-guide-page')) return;

    ?>
     <div class="notice notice-success is-dismissible getting_started activation-notice">
		<div class="notice-info">
			<div class="notice-image">
				<img style="width: 100%;max-width: 320px;line-height: 40px;display: inline-block;vertical-align: top;" src="<?php echo esc_url(get_stylesheet_directory_uri()) .'/screenshot.png'; ?>" />
			</div>
			<div class="notice-content">
				<h2><?php esc_html_e( 'Thanks For Installing Rest House, You Rock!', 'rest-house' ) ?> </h2>
				<p><?php esc_html_e( 'Take benefit of a variety of features, functionalities, elements, and an exclusive set of customization options to build your own professional charity website. Please Click on the link below to know the theme setup information.', 'rest-house' ) ?></p>
				<div style="display: grid;">
					<a class="button notice-btn" href="<?php echo esc_url( admin_url( 'themes.php?page=rest-house-guide-page' )); ?>"><?php esc_html_e( 'Getting Started', 'rest-house' ) ?></a>
					<a class="button notice-btn" target="_blank" href="<?php echo esc_url( REST_HOUSE_LIVE_DEMO ); ?>"><?php esc_html_e('Pro Demo', 'rest-house') ?></a>
					<a  class="button notice-btn" target="_blank" href="<?php echo esc_url( REST_HOUSE_FREE_DOC ); ?>"><?php esc_html_e('Free Doc', 'rest-house') ?></a>
					<a  class="button notice-btn" target="_blank" href="<?php echo esc_url( REST_HOUSE_BUY_PRO ); ?>"><?php esc_html_e('Upgrade To Pro', 'rest-house') ?></a>
				</div>
			</div>
		</div>
	</div>

    <script>
    jQuery(document).on('click', '.getting_started.activation-notice .notice-dismiss', function() {
        jQuery.post(ajaxurl, { action: 'rest_house_dismiss_notice' }, function(){
            jQuery('.getting_started.activation-notice').fadeOut();
        });
    });
    </script>
    <?php
}

add_action('wp_ajax_rest_house_dismiss_notice', 'rest_house_dismiss_notice');
function rest_house_dismiss_notice() {
    update_option('rest_house_admin_notice', true);
    wp_die();
}

add_action('after_switch_theme', 'rest_house_getstart_setup_options');
function rest_house_getstart_setup_options() {
    update_option('rest_house_admin_notice', false);
}

function rest_house_guide() {
    $rest_house_theme = wp_get_theme('rest-house'); ?>
    <div class="wrap getting-started">
        <div class="tab-sec">
            <div class="tab">
                <button role="tab" class="tablinks home" onclick="rest_house_openCity(event, 'bwp_getstart')"><?php esc_html_e('About Theme', 'rest-house'); ?></button>
                <button role="tab" class="tablinks" onclick="rest_house_openCity(event, 'bwp_setup')"><?php esc_html_e('Free Theme Information', 'rest-house'); ?></button>
                <button role="tab" class="tablinks" onclick="rest_house_openCity(event, 'bwp_premium_info')"><?php esc_html_e('Premium Theme Information', 'rest-house'); ?></button>
                <a class="tablinks tablinks-demo" role="tab" href="<?php echo esc_url(defined('REST_HOUSE_LIVE_DEMO') ? REST_HOUSE_LIVE_DEMO : '#'); ?>" target="_blank"><?php esc_html_e('Live Demo', 'rest-house'); ?></a>
                <a class="tablinks tablinks-pro" role="tab" href="<?php echo esc_url(defined('REST_HOUSE_BUY_PRO') ? REST_HOUSE_BUY_PRO : '#'); ?>" target="_blank"><?php esc_html_e('Buy Pro', 'rest-house'); ?></a>
            </div>

            <!-- About Theme Tab -->
            <div id="bwp_getstart" class="tabcontent">
                <div class="row">
                    <div class="col-md-5 intro">
                        <div class="pad-box">
                            <h2><?php esc_html_e('Welcome to Rest House Theme', 'rest-house'); ?>
                            <span><?php esc_html_e('Version: ', 'rest-house'); ?><?php echo esc_html($rest_house_theme['Version']); ?></span></h2>
                            <span class="intro__version"><?php esc_html_e('A premium-quality theme for resorts, hotels, homestays & vacation rentals.', 'rest-house'); ?></span>
                            <div class="powered-by">
                                <p><strong><?php esc_html_e('Theme created by Buy WP Templates', 'rest-house'); ?></strong></p>
                                <p><img class="logo" src="<?php echo esc_url(get_template_directory_uri() . '/inc/dashboard/media/theme-logo.png'); ?>"/></p>
                                <p class="notice-text"><strong><?php echo esc_html__( 'Click the button below to visit your site.', 'rest-house' ); ?></strong></p>
                                <?php echo '<span><a href="' . esc_url(home_url()) . '" class="site-btn" target="_blank">' . esc_html__('VIEW SITE', 'rest-house') . '</a></span>'; ?>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-7">
                        <div class="install-plugins">
                            <img src="<?php echo esc_url(get_template_directory_uri() . '/inc/dashboard/media/responsive1.png'); ?>" alt="responsive-image" />
                        </div>
                    </div>
                </div>
            </div>

            <!-- Free Setup Tab -->
            <div id="bwp_setup" class="tabcontent">
                <h2><?php esc_html_e('1) Setup Rest House Theme', 'rest-house'); ?></h2>
                <div class="row">
                    <div class="theme-instruction-block col-md-7">
                        <div class="pad-box">
                            <p><?php esc_html_e('Step into comfort and elegance with the Rest House Theme, the perfect choice for hotels, guesthouses, bed and breakfasts, and vacation rentals. Designed with a clean, modern layout and warm, inviting visuals, this theme gives your accommodation website a professional and welcoming appearance. Whether you offer luxury rooms, cozy cottages, or family suites, Rest House ensures your online presence stands out. With seamless booking system integration, you can easily showcase your rooms, services, and special offers to guests worldwide. Its fully responsive design guarantees your website looks stunning on every device, from desktop to mobile. Customization is simple with drag-and-drop options, allowing you to personalize every section of your website effortlessly. The theme is optimized for SEO, helping your property rank higher on search engines and attract more visitors. It includes pre-designed templates for room listings, amenities, testimonials, and promotional banners, perfect for highlighting seasonal deals or special packages. Fast performance and compatibility with major plugins make managing your hotel or guesthouse website smooth and efficient. Whether you run a small boutique inn or a large resort, the Rest House Theme is your ultimate solution for crafting a memorable, user-friendly, and professional online hospitality experience.', 'rest-house'); ?></p>
                            <ol>
                                <li><?php esc_html_e('Start', 'rest-house'); ?> <a target="_blank" href="<?php echo esc_url(admin_url('customize.php')); ?>"><?php esc_html_e('Customizing', 'rest-house'); ?></a> <?php esc_html_e('your website.', 'rest-house'); ?></li>
                                <li><?php esc_html_e('Rest House', 'rest-house'); ?> <a target="_blank" href="<?php echo esc_url(defined('REST_HOUSE_FREE_DOC') ? REST_HOUSE_FREE_DOC : '#'); ?>"><?php esc_html_e('Documentation', 'rest-house'); ?></a></li>
                            </ol>
                        </div>
                    </div>
                    <div class="col-md-5">
                        <div class="pad-box">
                            <img class="logo" src="<?php echo esc_url(get_template_directory_uri() . '/inc/dashboard/media/screenshot.png'); ?>" alt="setup-image"/>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Premium Info Tab -->
            <div id="bwp_premium_info" class="tabcontent">
                <h2><?php esc_html_e('2) Premium Theme Information.', 'rest-house'); ?></h2>
                <div class="row">
                    <div class="col-md-7">
                        <img src="<?php echo esc_url(get_template_directory_uri() . '/inc/dashboard/media/responsive.png'); ?>" alt="responsive-image">
                        <div class="pad-box">
                            <h3><?php esc_html_e('Pro Theme Description', 'rest-house'); ?></h3>
                            <p><?php esc_html_e('Welcome guests to comfort and style with the Rest House WordPress Theme, a high-quality, professional design that brings warmth and elegance to your accommodation website. Perfect for hotels, guesthouses, resorts, vacation rentals, or B&Bs, this theme captures the essence of hospitality with clean layouts, soothing colors, and inviting typography. Every element is crafted to create a welcoming atmosphere that instantly impresses visitors. The fully responsive design ensures your website looks flawless on all devices, from desktops to mobile phones, providing a seamless browsing experience. With an intuitive customization panel, you can easily adjust colors, fonts, layouts, and sections without coding skills. The theme is compatible with popular WordPress plugins such as Elementor, Contact Form 7, and Yoast SEO, giving you complete flexibility to enhance your site. Rest House also features fast load times, retina-ready images, and SEO optimization to help your property attract more bookings and rank higher in search engines. Whether you’re showcasing rooms, amenities, special packages, or guest testimonials, this theme provides the perfect foundation for a professional and memorable hospitality website. Its elegant design, flexible tools, and reliable performance make it an ideal choice for creating an inviting online presence that stands out and delights visitors.', 'rest-house'); ?></p>
                        </div>
                    </div>
                    <div class="col-md-5 install-plugin-right">
                        <div class="pad-box">
                            <h3><?php esc_html_e('Pro Theme Features', 'rest-house'); ?></h3>
                            <ul>
                                <li><?php esc_html_e('Responsive & Mobile-Friendly Design', 'rest-house'); ?></li>
                                <li><?php esc_html_e('Retina-Ready Display', 'rest-house'); ?></li>
                                <li><?php esc_html_e('Bootstrap Framework', 'rest-house'); ?></li>
                                <li><?php esc_html_e('Fast Load Times', 'rest-house'); ?></li>
                                <li><?php esc_html_e('Advanced Customization Options', 'rest-house'); ?></li>
                                <li><?php esc_html_e('Interactive CTA Buttons', 'rest-house'); ?></li>
                                <li><?php esc_html_e('Attractive Hero & Banner Sections', 'rest-house'); ?></li>
                                <li><?php esc_html_e('Testimonial Showcase Section', 'rest-house'); ?></li>
                                <li><?php esc_html_e('Team & Staff Showcase Layouts', 'rest-house'); ?></li>
                                <li><?php esc_html_e('Pre-Designed Shortcodes', 'rest-house'); ?></li>
                                <li><?php esc_html_e('Clean and Secure Code', 'rest-house'); ?></li>
                                <li><?php esc_html_e('SEO-Friendly Structure', 'rest-house'); ?></li>
                                <li><?php esc_html_e('Modern and Elegant UI Design', 'rest-house'); ?></li>
                                <li><?php esc_html_e('One-Click Demo Import Feature', 'rest-house'); ?></li>
                                <li><?php esc_html_e('Booking Plugin Compatibility', 'rest-house'); ?></li>
                                <li><?php esc_html_e('Customizable Typography Options', 'rest-house'); ?></li>
                                <li><?php esc_html_e('Color Scheme Management', 'rest-house'); ?></li>
                                <li><?php esc_html_e('Cross-Browser Compatible', 'rest-house'); ?></li>
                                <li><?php esc_html_e('Regular Theme Updates', 'rest-house'); ?></li>
                                <li><?php esc_html_e('Hotel-Oriented Layouts', 'rest-house'); ?></li>
                                <li><?php esc_html_e('Lightweight & Optimized Performance', 'rest-house'); ?></li>
                                <li><?php esc_html_e('Room Showcase Sections', 'rest-house'); ?></li>
                                <li><?php esc_html_e('Built-In Blog Support', 'rest-house'); ?></li>
                                <li><?php esc_html_e('Contact Form Integration', 'rest-house'); ?></li>
                                <li><?php esc_html_e('Compatible with Page Builders', 'rest-house'); ?></li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>

        </div>
    </div>
<?php }
?>
