<?php defined('ABSPATH') || die('Cheatin\' uh?'); ?>
<link href='https://unpkg.com/boxicons@2.1.4/css/boxicons.min.css' rel='stylesheet'> 

<div class="customize-pannel" style="width:100%;min-height:800px;position:absolute;top:0px;background-color:#F4F4F4;top:0px;padding:1vw;">
    
    <div style="min-height:20vw;width:78vw;padding-top:2vw;background-color:white;scale:0.9;border-radius:2vw;margin-left:5vw;">
        <div style="display:flex;align-items:center;padding-left:2vw;">
            <?php  echo '<img  style="width:4vw;height:4vw;" src='.plugins_url(). "/starboxnew/view/assets/img/logo.png".' alt="">';?>
            <div style="margin-left:0.5vw;">
                <div style="font-size:1.2vw;font-weight:700;">Starbox</div>
                <div style="font-size:0.9vw;font-weight:700;color:#fbcc34;margin-top:-.3vw;">Dare to stand out.</div>
            </div>
        </div>

        <div class="general-author" style="padding-left:2vw;padding-top:2vw;display:flex;">
            
            <div class="settngs-section" style="width:50%;padding:2vw;">
                <div style="font-size:1.1vw;font-weight:700;width:100%;">This author box applies for all authors that are not having a custom one.</div>
                <div style="margin-top:2vw;">
                    <div class="innerTheme" style="height:25vw;width:30vw;border-radius:8px;display:flex;align-items:center;justify-content:center;margin-top:5px;">
                        <?php $STB_user_data = new STRB_Models_ThemeUserData();
                            $author_obj =get_user_by('email',"strb@starbox.com");
                            if($author_obj!=null){
                                $id=$author_obj->ID;
                                
                                $STB_user_data->loadThemeDataByID($id);   
                                $theme= $STB_user_data->getData('user_theme');  
                                $img = $STB_user_data->getData('background_img');
                    
                                $theme= $STB_user_data->getData('user_theme');
                                $img = $STB_user_data->getData('background_img');
                                echo '<div style="">'.STRB_Classes_ObjController::getClass('STRB_Classes_FrontController')->getThemeViewImg($id,$theme,$img,TRUE).'</div>'; 
                            }?>
                    </div>

                    <div style="display:flex;width:100%;padding-top:0.7vw;gap:2vw;margin-top:2vw;">
                        <?php if($author_obj!=null){
                                echo'<input type="hidden" class="theme_val_db" value="'.$theme.'" name="'.$img.'"/>
                                    <button  value="'.$id.'" class="edit_theme_info_customize action-btn" style="height:2.5vw;font-size:1vw;width:12vw;font-weight:600;border-radius:2vw;margin-left:8vw;border:none;background-color:#033;color:white;text-align:center;cursor:pointer;">Edit theme</button>';
                        }?>
                    </div> 
                </div>
            </div>

            <div class="settngs-section"  style="padding:2vw;width:45%;">
                <div class="select-menu">
                    <span style="font-weight:700;font-size:1.1vw;">Don't show your author boxes for:</span>
                    <div class="select-btn" id="select-btn" style="background-color:#F3F6F8;width:17vw;height:3vw;font-size:1vw;font-weight:500;margin-top:5px;">
                        <div class="btn-text" id="btn-text">Select an author</div>
                        <i class="bx bx-chevron-down"></i>
                    </div>
                    <ul class="options" style="width:17vw;height:12vw;padding:0px;overflow:hidden;overflow-y:scroll;position:absolute;z-index:9;">
                        <?php  $users = get_users( array( 'role_in' => array( 'author' ),array('exclude'=>array('meta_key'=>'strb_dont_show_author_box')) ) );
                            foreach ( $users as $user ) {
                            echo '<li class="option strb-dont-show-box-for-auth" value="'.$user->ID.'" style="color:black;height:2.5vw;padding-top:0.4vw;">
                                    <span class="option-text" name="userid" value="'.$user->ID.'" style="color:black;font-size:1vw;">' . esc_html( $user->display_name ) . ' </span>
                                </li>';
                        }?>
                    </ul>
                </div>
    
                <?php  $users = get_users( array( 'role_in' => array( 'author' ) ,'meta_key'=>'strb_dont_show_author_box') );
                $STB_user = new STRB_Models_ThemeUserData();?>
                
                <div style="min-height:5vw;display:flex;flex-wrap:wrap;gap:2vw;margin-top:1vw;">
                    <?php
                        foreach ( $users as $user ) {
                            $STB_user->loadUserDataByID($user->ID);
                            if($STB_user->getData("img")!="empty")
                                $img=$STB_user->getData("img");
                            else
                                $img=plugins_url(). '/starboxnew/view/assets/img/avatar.png';

                            echo '<div class="chip" style="height:3vw;min-width:10vw;border-radius:5vw;align-items:center;">
                                    <img src="'.$img.'" alt="" style=" width:3vw; height:3vw;">
                                    <span style="font-size:1vw;">'.get_user_meta($user->ID,"first_name",true).'</span>
                                    <span style="margin-left:3px;font-size:1vw;">'.get_user_meta($user->ID,"last_name",true).'</span>
                                    <li style="list-style:none;" value="'.$user->ID.'" class="show-author-box"><span>&times;</span></li>
                                </div>';
                        }?>
                </div>
                
                <div style="font-size:1.1vw;font-weight:700;">Display author box in:</div>
    
                <div  style="display:flex;margin-top:1vw;">
                    <label class="toggler-wrapper style-1">   
                    <input type="checkbox" <?php echo STRB_Classes_Helpers_Tools::getOption('allPost')=='true' ? 'checked' : ''; ?> name="extra_field_check" class="strb-switch all-post-types"  />
                    <div class="toggler-slider" style="width:4vw;height:1.6vw;">
                        <div class="toggler-knob" style="height:1.2vw;width:1.2vw;top:0.3vw;margin-left:0.4vw;"></div>
                    </div>
                    </label>
                    <label style="font-size:1.1vw;font-weight:500;margin-left:3vw;">All post types</label>
                </div>
        
                <div  style="display:flex;margin-top:1vw;">
                    <label class="toggler-wrapper style-1">
                    <input type="hidden" name="strb_option" value="0"/>
                    <input type="checkbox" <?php echo STRB_Classes_Helpers_Tools::getOption('specificPost')=='true' ? 'checked' : ''; ?>  name="extra_field_check" class="strb-switch add-specific-post-types" />
                    <div class="toggler-slider" style="width:4vw;height:1.6vw;">
                        <div class="toggler-knob" style="height:1.2vw;width:1.2vw;top:0.3vw;margin-left:0.4vw;"></div>
                    </div>
                    </label>
                    <label style="font-weight:500;font-size:1.1vw;margin-left:3vw;">Specific Wordpress post types</label>
                </div>
        
                <form class="display-options-form" method="POST" enctype="multipart/form-data">
                    <div class="specific-pos specific-posts<?php  echo STRB_Classes_Helpers_Tools::getOption('specificPost')?>" style="width:24vw;gap:1vw;min-height:100px;flex-wrap:wrap;background-color:rgba(0,0,0,0.2);padding:1.5vw;border-radius:2vw;margin-top:1vw;">
                    <?php   $types = get_post_types();
                            foreach ($types as $type) {
                                $type_data = get_post_type_object($type);
                                if (!isset($type_data->show_ui) || $type_data->show_ui != 1) {
                                    unset($types[$type]);
                                } else {?>
                                <div  style="display:flex;gap:0.4vw;min-width:7vw;flex-direction:column;width:10vw;">
                                    <div style="font-weight:500;font-size:1vw;"><?php echo $type_data->labels->name; ?></div>
                                    <label class="toggler-wrapper style-1">
                                        <input type="hidden" name="strb_option" value="0"/>
                                        <input type="checkbox" value="<?php echo $type ?>" <?php  if(STRB_Classes_Helpers_Tools::getOption('field-check')!=null) echo  in_array($type,STRB_Classes_Helpers_Tools::getOption('field-check')) ? 'checked' : ''; ?>  name="<?php echo $type_data->labels->name; ?>" class="abh_post_types strb-switch add-specific-pages" />
                
                                        <div class="toggler-slider" style="width:4vw;height:1.6vw;">
                                            <div class="toggler-knob" style="height:1.2vw;width:1.2vw;top:0.3vw;margin-left:0.4vw;"></div>
                                        </div>
                                </label>
                                    
                                </div> 
                                <?php
                                }
                            }?>
                    </div>
      
                    <div style="font-size:1.1vw;font-weight:700;margin-top:3vw;">Delete all data on deactivation</div>
                    <div  style="display:flex;margin-top:0.5vw;">
                        <label class="toggler-wrapper style-1">   
                            <input type="checkbox" <?php if(STRB_Classes_Helpers_Tools::getOption('deleteDataCheck')!=null) echo STRB_Classes_Helpers_Tools::getOption('deleteDataCheck')=='true' ? 'checked' : ''; ?> name="extra_field_check" class="delete-data-toggler"  />
                            <div class="toggler-slider" style="width:4vw;height:1.6vw;">
                                <div class="toggler-knob" style="height:1.2vw;width:1.2vw;top:0.3vw;margin-left:0.4vw;"></div>
                            </div>
                        </label>
                    </div>
                    </div>
            </div>
            </br>
            </br>
            <div style="width:49%;background-color:rgba(0,0,0,0.1);margin-left:2vw;margin-bottom:5vw;display:flex;flex-direction:column;border-radius:1vw;padding:1vw;font-size:1.3vw;font-weight:500;">
                <div>Renew subscription</div>
                <div class="input-fields" style="">
                    <input type="text" class="input-tk" name="accesToken" value=""  style="font-size:0.8vw;height:2.2vw;width:20vw;border:none;background-color:rgba(255,255,255,0.7);border-radius:0.5vw;"/>
                </div>
                <div class="token-alert" style="display:none;color:red;font-size:0.6vw;font-weight:500;">Please enter a valid token.</div>
                <div>
                    <button style="cursor:pointer;border-radius:1vw;background-color:#fbcc34;font-size:0.9vw;font-weight:700;width:12vw;height:2.2vw;border:none;margin-top:0.5vw;"  class="strb-check-token"><?php echo esc_html__("Activate", 'squirrly-seo'); ?></button>
                </div>
            </div>

            <button class="save-display-options" style="background-color:#fbcc34;color:black;font-weight:700;font-size:1.1vw;height:2.5vw;width:12vw;margin-bottom:2vw;border:none;margin-left:2vw;margin-top:3vw;border-radius:5vw;position:absolute;right:4vw;bottom:1vw;cursor:pointer;">
                <span>Save Changes</span>
            </button>    
        </form>

    </br></br>
    </div>
    </br>
</div>
           
    <div class="edit-theme-options" style="display:none;position:absolute;width:100%;">
        <?php  $view->show_view('Blocks/EditTheme');?>
    </div>
    <?php wp_enqueue_media();?>
    <?php  $view->show_view('Blocks/SelectTheme');?>

    <style>
        .chip {
            display: flex;
            padding: 0 25px;
            height: 50px;
            font-size: 16px;
            line-height: 50px;
            border-radius: 25px;
            background-color: #f1f1f1;
        }
        .chip img {
            float: left;
            margin: 0 10px 0 -25px;
            height: 50px;
            width: 50px;
            border-radius: 50%;
        }
        .show-author-box {
            padding-left: 10px;
            color: #888;
            font-weight: bold;
            float: right;
            font-size: 20px;
            cursor: pointer;
        }
        .show-author-box:hover {
            color: #000;
        }
        .toggler-wrapper.style-1 input[type="checkbox"]:checked+.toggler-slider .toggler-knob {
            left: calc(55%);
        }
        .settngs-section:hover{
            box-shadow: 0 4px 30px rgba(0,0,0,0.1);
            background-color:rgba(0,0,0,0.1);
            border-radius:2vw;
        }
        .save-display-options:hover{
            opacity:0.8;
        }

        .help_and_support:hover{
            scale:1.2;
            opacity:0.8;
            -webkit-transform:rotate(10deg);
        }
        @media (max-width: 1811px) {
        .innerTheme{
            scale:0.9;  
            }
        }

        @media (max-width: 1750px) {
        .innerTheme{
            scale:0.8;
            }
        }
        @media (max-width: 1614px) {
            .innerTheme{
                scale:0.75;
            }
        }
        @media (max-width: 1478px) {
            .innerTheme{
                scale:0.7;
            
            }
        }
        @media (max-width: 1353px) {
            .innerTheme{
                scale:0.65;
            
            }
        }
        @media (max-width: 1236px) {
            .innerTheme{
                scale:0.6;
            }
        }
        @media (max-width: 1140px) {
            .innerTheme{
                scale:0.55;      
            }
        }
        @media (max-width: 1050px) {
            .innerTheme{
                scale:0.5;      
            }
        }
        @media (max-width: 1050px) {
            .innerTheme{
                scale:0.5; 
            }
        }
        @media (max-width: 942px) {
            .innerTheme{
                scale:0.45;
            }
        }
    </style>