<?php
/*
 * @package CCTV Services
 */

 function cctv_services_admin_enqueue_scripts() {
    wp_enqueue_style( 'cctv-services-admin-style', esc_url( get_template_directory_uri() ).'/assets/css/addon.css' );
}
add_action( 'admin_enqueue_scripts', 'cctv_services_admin_enqueue_scripts' );

function cctv_services_theme_info_menu_link() {

    $cctv_services_theme = wp_get_theme();
    add_theme_page(
        /* translators: 1: Theme name. */
        sprintf( esc_html__( 'Welcome to %1$s', 'cctv-services' ), $cctv_services_theme->get( 'Name' )),
        esc_html__( 'Theme Info', 'cctv-services' ),
        'edit_theme_options',
        'cctv-services',
        'cctv_services_theme_info_page'
    );
}
add_action( 'admin_menu', 'cctv_services_theme_info_menu_link' );

function cctv_services_theme_info_page() {

    $cctv_services_theme = wp_get_theme();
    ?>
<div class="wrap theme-info-wrap">
    <h1><?php printf( esc_html__( 'Welcome to %1$s', 'cctv-services' ), esc_html($cctv_services_theme->get( 'Name' ))); ?>
    </h1>
    <p class="theme-description">
    <?php esc_html_e( 'Do you want to configure this theme? Look no further, our easy-to-follow theme documentation will walk you through it.', 'cctv-services' ); ?>
    </p>
    <div class="columns-wrapper clearfix theme-demo">
        <div class="column column-quarter clearfix start-box"> 
            <div class="demo-import">
                <div class="theme-name">
                    <h2><?php echo esc_html( $cctv_services_theme->get( 'Name' ) ); ?></h2>
                    <p class="version"><?php esc_html_e( 'Version', 'cctv-services' ); ?>: <?php echo esc_html( wp_get_theme()->get( 'Version' ) ); ?></p>	
                </div>              
                <?php
                $cctv_services_demo_completed = get_option( 'cctv_services_demo_import_completed' );
                if ( $cctv_services_demo_completed ) {
                    ?>
                    <div class="success"><?php esc_html_e( 'Demo Import Successful', 'cctv-services' ); ?></div>
                    <hr>
                    <p><?php esc_html_e( 'You can now visit your site or edit it further.', 'cctv-services' ); ?></p>
                    <div class="demo-buttons" style="margin-top:15px; margin-bottom:30px; display:flex; justify-content:center; align-items: center; gap:10px">
                    <a href="<?php echo esc_url( home_url( '/' ) ); ?>" class="button button-primary button-large" style="margin-top: 10px;" target="_blank" style="margin-left:10px;">
                        <?php esc_html_e( 'View Site', 'cctv-services' ); ?>
                    </a>
                    <a href="<?php echo esc_url( admin_url() . 'site-editor.php' ); ?>" class="button button-primary button-large" style="margin-top: 10px;" target="_blank">
                        <?php esc_html_e( 'Edit Site', 'cctv-services' ); ?>
                    </a>
                    </div>
                    <?php
                }
                ?>
            </div>
        </div>
        <div class="column column-half clearfix">
            <div class="important-link">
                <div class="main-box columns-wrapper clearfix">

                    <div class="themelink column column-half column-border clearfix">
                        <p><strong><?php esc_html_e( 'Free Theme Documentation', 'cctv-services' ); ?></strong></p>
                        <p><?php esc_html_e( 'Need more details? Please check our full documentation for detailed theme setup.', 'cctv-services' ); ?></p>
                        <a href="<?php echo esc_url( CCTV_SERVICES_THEME_DOCUMENTATION ); ?>" target="_blank">
                        <?php esc_html_e( 'Documentation', 'cctv-services' ); ?>
                        </a>
                    </div>

                    <div class="themelink column column-half column-padding clearfix">
                        <p><strong><?php esc_html_e( 'Need Help?', 'cctv-services' ); ?></strong></p>
                        <p><?php esc_html_e( 'Go to our support forum to help you out in case of queries and doubts regarding our theme.', 'cctv-services' ); ?></p>
                        <a href="<?php echo esc_url( CCTV_SERVICES_SUPPORT ); ?>" target="_blank">
                        <?php esc_html_e( 'Contact Us', 'cctv-services' ); ?>
                        </a>
                    </div>
                </div>
                <hr>
                <div class="main-box columns-wrapper clearfix">

                    <div class="themelink column column-half column-border clearfix">
                        <p><strong><?php esc_html_e( 'Pro version of our theme', 'cctv-services' ); ?></strong></p>
                        <p><?php esc_html_e( 'Are you excited for our theme? Then we will proceed for pro version of theme.', 'cctv-services' ); ?></p>
                        <a class="get-premium" href="<?php echo esc_url( CCTV_SERVICES_PREMIUM_PAGE ); ?>" target="_blank">
                        <?php esc_html_e( 'Get Premium', 'cctv-services' ); ?>
                        </a>
                    </div>

                    <div class="themelink column column-half column-padding clearfix">
                        <p><strong><?php esc_html_e( 'Leave us a review', 'cctv-services' ); ?></strong></p>
                        <p><?php esc_html_e( 'Are you enjoying our theme? We would love to hear your feedback.', 'cctv-services' ); ?></p>
                        <a href="<?php echo esc_url( CCTV_SERVICES_REVIEW ); ?>" target="_blank">
                        <?php esc_html_e( 'Rate This Theme', 'cctv-services' ); ?>
                        </a>
                    </div>

                </div>
            </div>
        </div>
        <div class="column column-quarter clearfix start-box"> 
            <div class="bundle-info">
                <img src="<?php echo esc_url( get_template_directory_uri().'/assets/images/bundle.png'); ?>" alt="<?php echo esc_attr( 'screenshot', 'cctv-services'); ?>" class="bundle-image"/>
                <div class="bundle-content themelink">
                    <h3><?php esc_html_e( 'WordPress Theme Bundle', 'cctv-services' ); ?></h3>
                    <small><b><?php esc_html_e( 'Get access to a collection of 100+ stunning WordPress themes for just $99 — featuring designs for every business niche!', 'cctv-services' ); ?></small></b>
                    <div class="bundle-bottom">
                        <div class="coupon-box">
                            <span class="discount"><?php esc_html_e( 'Get 20% Flat Discount', 'cctv-services' ); ?></span>
                            <span class="coupon"><?php esc_html_e( 'Use Coupon : CLASSIC20', 'cctv-services' ); ?></span>
                        </div>
                        <a class="get-premium" href="<?php echo esc_url( CCTV_SERVICES_BUNDLE_PAGE ); ?>" target="_blank">
                            <?php esc_html_e( 'Get Bundle', 'cctv-services' ); ?>
                        </a>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div id="getting-started">
        <div class="section">
            <h3><?php 
            /* translators: %s: Theme name. */
            printf( esc_html__( 'Getting started with %s', 'cctv-services' ),
            esc_html($cctv_services_theme->get( 'Name' ))); ?></h3>
            <div class="columns-wrapper clearfix">
                <div class="column column-half clearfix">
                    <div class="section themelink">
                        <div class="">
                            <a class="" href="<?php echo esc_url( CCTV_SERVICES_PREMIUM_PAGE ); ?>" target="_blank"><?php esc_html_e( 'Get Premium', 'cctv-services' ); ?></a>
                            <a href="<?php echo esc_url( CCTV_SERVICES_PRO_DEMO ); ?>" target="_blank"><?php esc_html_e( 'View Demo', 'cctv-services' ); ?></a>
                            <a class="get-premium" href="<?php echo esc_url( CCTV_SERVICES_BUNDLE_PAGE ); ?>" target="_blank"><?php esc_html_e( 'Bundle of 100+ Themes at $99', 'cctv-services' ); ?></a>
                        </div>
                        <div class="theme-description-1"><?php echo esc_html($cctv_services_theme->get( 'Description' )); ?></div>
                    </div>
                </div>
                <div class="column column-half clearfix">
                    <img src="<?php echo esc_url( $cctv_services_theme->get_screenshot() ); ?>" alt="<?php echo esc_attr( 'screenshot', 'cctv-services'); ?>"/>
                </div>
            </div>
        </div>
    </div>
    <hr>
    <div id="theme-author">
      <p><?php
        /* translators: 1: Theme name, 2: Author name, 3: Call to action text. */
        printf( esc_html__( '%1$s is proudly brought to you by %2$s. If you like this theme, %3$s :)', 'cctv-services' ),
            esc_html($cctv_services_theme->get( 'Name' )),
            '<a target="_blank" href="' . esc_url( 'https://www.theclassictemplates.com/', 'cctv-services' ) . '">classictemplate</a>',
            '<a target="_blank" href="' . esc_url(CCTV_SERVICES_REVIEW ) . '" title="' . esc_attr__( 'Rate it', 'cctv-services' ) . '">' . esc_html_x( 'rate it', 'If you like this theme, rate it', 'cctv-services' ) . '</a>'
        );
        ?></p>
    </div>
</div>
<?php
}
?>