<?php
defined('ABSPATH') or die("No script kiddies please!");
global $post;
$post_id = $post->ID;
$egpr_reviews = get_option('egp_reviews');
$account_type = (isset($egpr_reviews['account_type']) && $egpr_reviews['account_type'] != '') ? esc_attr($egpr_reviews['account_type']) : '';
$egpr_review_settings = get_post_meta($post_id, 'egpr_review_settings', true);
$total_number_nonverified_reviews = (isset($egpr_review_settings['total_number_nonverified_reviews']) && $egpr_review_settings['total_number_nonverified_reviews'] != '') ? $egpr_review_settings['total_number_nonverified_reviews'] : '3';
$hide_usr_image = (isset($egpr_review_settings['hide_usr_image']) && $egpr_review_settings['hide_usr_image'] == 'true') ? "true" : "false";
$hide_user_name = (isset($egpr_review_settings['hide_user_name']) && $egpr_review_settings['hide_user_name'] == 'true') ? "true" : "false";
$hide_user_rating = (isset($egpr_review_settings['hide_user_rating']) && $egpr_review_settings['hide_user_rating'] == 'true') ? "true" : "false";
$hide_avg_rating = (isset($egpr_review_settings['hide_avg_rating']) && $egpr_review_settings['hide_avg_rating'] == 'true')? "true" : "false";
$show_5star_rating = (isset($egpr_review_settings['show_5star_rating']) && $egpr_review_settings['show_5star_rating'] != '') ? $egpr_review_settings['show_5star_rating'] : '';
$show_description = (isset($egpr_review_settings['show_description']) && $egpr_review_settings['show_description'] != '') ? $egpr_review_settings['show_description'] : '';
$show_desc_limit_rating = (isset($egpr_review_settings['show_desc_limit_rating']) && $egpr_review_settings['show_desc_limit_rating'] != '') ? $egpr_review_settings['show_desc_limit_rating'] : '20';
$desc_text_show = (isset($egpr_review_settings['desc_text_show']) && $egpr_review_settings['desc_text_show'] != '') ? $egpr_review_settings['desc_text_show'] : '';
$desc_text_hide = (isset($egpr_review_settings['desc_text_hide']) && $egpr_review_settings['desc_text_hide'] != '') ? $egpr_review_settings['desc_text_hide'] : '';
$total_review_count = (isset($egpr_review_settings['total_review_count']) && $egpr_review_settings['total_review_count'] != '') ? $egpr_review_settings['total_review_count'] : '';
$price_range = (isset($egpr_review_settings['price_range']) && $egpr_review_settings['price_range'] != '') ? $egpr_review_settings['price_range'] : '';
$language_code = (isset($egpr_review_settings['language_code']) && $egpr_review_settings['language_code'] != '') ? $egpr_review_settings['language_code'] : 'en';
?>
<div class="egpr_review_section-wrapper">
        <div class="egpr-type-field">
            <label><h4><?php _e('Total Number of Reviews', 'everest-google-places-reviews'); ?></h4></label>
            <label class="egpr-noswitch">
                <select name="egpr_review_settings[total_number_nonverified_reviews]" class="egpr-field-selection">
                    <option value="1" <?php selected($total_number_nonverified_reviews, '1'); ?>>1</option>
                    <option value="2" <?php selected($total_number_nonverified_reviews, '2'); ?>>2</option>
                    <option value="3" <?php selected($total_number_nonverified_reviews, '3'); ?>>3</option>
                    <option value="4" <?php selected($total_number_nonverified_reviews, '4'); ?>>4</option>
                    <option value="5" <?php selected($total_number_nonverified_reviews, '5'); ?>>5</option>
                </select>
            </label>

        </div>

    <div class="egpr-type-field">
        <label for="egpr_meta_hide_user_name">
            <h4><?php _e('Hide Reviewer Name', 'everest-google-places-reviews'); ?></h4>
        </label>
        <label class="egpr-switch">
            <input type="checkbox" name="egpr_review_settings[hide_user_name]" id="egpr_meta_hide_user_name"
                   value="true" <?php
                    if ( isset($hide_user_name) ) {
                        checked($hide_user_name, 'true');
                    }
                ?>/>
            <div class="egpr-slider round"></div>
        </label>
        <div class="egpr-tooltip-description">
                <div class="egpr-description">
                   <?php _e('Hide Reviewer Name by enabling this checkbox.', 'everest-google-places-reviews'); ?>
                </div>
         </div>
    </div>

    <div class="egpr-type-field">
        <label for="egpr_meta_hide_usr_image">
            <h4><?php _e('Hide Reviewer Image', 'everest-google-places-reviews'); ?></h4>
        </label>
        <label class="egpr-switch">
            <input type="checkbox" name="egpr_review_settings[hide_usr_image]" id="egpr_meta_hide_usr_image"
                   value="true" <?php
                    if ( isset($hide_usr_image) ) {
                        checked($hide_usr_image, 'true');
                    }
                ?>/>
            <div class="egpr-slider round"></div>
        </label>
        <div class="egpr-tooltip-description">
                <div class="egpr-description">
                   <?php _e('Hide Reviewer Image by enabling this checkbox.', 'everest-google-places-reviews'); ?>
                </div>
         </div>
    </div>
    
    <div class="egpr-type-field">
        <label for="egpr_meta_hide_user_rating">
            <h4><?php _e('Hide User Rating', 'everest-google-places-reviews'); ?></h4>
        </label>
        <label class="egpr-switch">
            <input type="checkbox" name="egpr_review_settings[hide_user_rating]" id="egpr_meta_hide_user_rating" 
                   value="true" <?php
                    if ( isset($hide_user_rating) ) {
                        checked($hide_user_rating, 'true');
                    }
                ?>/>
        <div class="egpr-slider round"></div>
        </label>
        <div class="egpr-tooltip-description">
                <div class="egpr-description">
                   <?php _e('Hide user rating by enabling this checkbox.', 'everest-google-places-reviews'); ?>
                </div>
         </div>

    </div>
    
       <div class="egpr-type-field">
        <label for="egpr_meta_hide_avg_rating">
            <h4><?php _e('Hide Average Rating', 'everest-google-places-reviews'); ?></h4>
        </label>
        <label class="egpr-switch">
            <input type="checkbox" name="egpr_review_settings[hide_avg_rating]" id="egpr_meta_hide_avg_rating" 
                   value="true" <?php
                    if ( isset($hide_avg_rating) ) {
                        checked($hide_avg_rating, 'true');
                    }
                ?>/>
            <div class="egpr-slider round"></div>
        </label>
         <div class="egpr-tooltip-description">
                <div class="egpr-description">
                   <?php _e('Hide average rating by enabling this checkbox on business badge.', 'everest-google-places-reviews'); ?>
                </div>
         </div>

    </div>
    
     <div class="egpr-type-field">
        <label for="egpr_meta_show_fivestar_rating">
            <h4><?php _e('Show 5 Star Rating Only', 'everest-google-places-reviews'); ?></h4>
        </label>
        <label class="egpr-switch">
            <input type="checkbox" name="egpr_review_settings[show_5star_rating]" id="egpr_meta_show_fivestar_rating" 
                   value="true" <?php
                    if ( isset($show_5star_rating) ) {
                        checked($show_5star_rating, 'true');
                    }
                ?>/>
            <div class="egpr-slider round"></div>
        </label>
         <div class="egpr-tooltip-description">
                <div class="egpr-description">
                   <?php _e('Enable this checkbox to show only 5 star rating on list of user reviews.', 'everest-google-places-reviews'); ?>
                </div>
         </div>

    </div>
      <div class="egpr-type-field">
          <label for="egpr_meta_show_description"><h4><?php _e('Show Description', 'everest-google-places-reviews'); ?></h4></label>
         <label class="egpr-switch">
            <input type="checkbox" name="egpr_review_settings[show_description]" id="egpr_meta_show_description" 
                   value="true" <?php
                    if ( isset($show_description) ) {
                        checked($show_description, 'true');
                    }
                ?>/>
             <div class="egpr-slider round"></div>
         </label>

    </div>
    
      <div class="egpr-type-field">
        <label for="egpr_meta_desc_limit">
            <h4><?php _e('Description (Character) Limit', 'everest-google-places-reviews'); ?></h4></label>
         <label class="egpr-noswitch">
            <input type="number" name="egpr_review_settings[show_desc_limit_rating]" id="egpr_meta_desc_limit" 
                   value="<?php echo esc_attr($show_desc_limit_rating);?>" placeholder="E,g 300"/>
         <p class="description">
           <?php _e('Please fill character to be displayed at first. Default Value is set to 300 if left empty.', 'everest-google-places-reviews'); ?>
         </p>
        </label>
    </div>
     <div class="egpr-type-field">
         <label for="egpr_meta_readmore_txt"><h4><?php _e('Read More Text', 'everest-google-places-reviews'); ?></h4></label>
        <label class="egpr-noswitch">
            <input type="text" placeholder="Read More" name="egpr_review_settings[desc_text_show]" 
                   id="egpr_meta_readmore_txt" value="<?php echo esc_attr($desc_text_show);?>"/>
            <p class="description"><?php _e('Display text such as Read More , View More after set limit for user rating description.','everest-google-places-reviews');?></p>
        </label>

    </div>
    <div class="egpr-type-field">
        <label for="egpr_meta_readless_txt">
            <h4><?php _e('Read Less Text', 'everest-google-places-reviews'); ?></h4></label>
       <label class="egpr-noswitch">
            <input type="text" placeholder="Read Less" name="egpr_review_settings[desc_text_hide]" 
                   id="egpr_meta_readless_txt" value="<?php echo esc_attr($desc_text_hide);?>"/>
            <p class="description"><?php _e('Display text such as Read More , View More after set limit for user rating description.','everest-google-places-reviews');?></p>
        </label>
    </div>
       <div class="egpr-type-field">
         <label><h4><?php _e('Review Count', 'everest-google-places-reviews'); ?></h4></label>
        <label class="egpr-noswitch">
            <input type="text" name="egpr_review_settings[total_review_count]" 
                   value="<?php echo esc_attr($total_review_count);?>" placeholder="5"/>
            <p class="description"><?php _e('Fill your actual total review count here since retrieving total review count automatically is not provided by Google Places API key so you have to fill default count here. Useful for Schema error suppression.','everest-google-places-reviews');?></p>
        </label>

    </div>
    <div class="egpr-type-field">
         <label><h4><?php _e('Price Range', 'everest-google-places-reviews'); ?></h4></label>
        <label class="egpr-noswitch">
            <input type="text"  name="egpr_review_settings[price_range]" 
                   id="egpr_meta_readmore_txt" value="<?php echo esc_attr($price_range);?>" placeholder="$40"/>
               <p class="description"><?php _e('Fill your actual price of your location here if you have 
             since retrieving price automatically is not provided by Google Places API key so you have to fill default price here. Useful for schema error suppression.','everest-google-places-reviews');?></p>
            
        </label>

    </div>
    <div class="egpr-type-field">
         <label><h4><?php _e('Language Code', 'everest-google-places-reviews'); ?></h4></label>
        <label class="egpr-noswitch">
           <select name="egpr_review_settings[language_code]">
              <option value="ar" <?php selected($language_code, 'ar'); ?>>Arabic</option>
              <option value="bg" <?php selected($language_code, 'bg'); ?>>Bulgaraian</option>
              <option value="bn" <?php selected($language_code, 'bn'); ?>>Bengali</option>
              <option value="ca" <?php selected($language_code, 'ca'); ?>>Catalan</option>
              <option value="cs" <?php selected($language_code, 'cs'); ?>>Czech</option>
              <option value="da" <?php selected($language_code, 'da'); ?>>Danish</option>
              <option value="de" <?php selected($language_code, 'de'); ?>>German</option>
              <option value="el" <?php selected($language_code, 'el'); ?>>Greek</option>
              <option value="en" <?php selected($language_code, 'en'); ?>>English</option>
              <option value="en-AU" <?php selected($language_code, 'en-AU'); ?>>English (Australian)</option>
              <option value="en-GB" <?php selected($language_code, 'en-GB'); ?>>English (Great Britain)</option>
              <option value="es" <?php selected($language_code, 'es'); ?>>Spanish</option>
              <option value="eu" <?php selected($language_code, 'eu'); ?>>Basque</option>
              <option value="fi" <?php selected($language_code, 'fi'); ?>>Farsi</option>
              <option value="fil" <?php selected($language_code, 'fil'); ?>>Filipino</option>
              <option value="fr" <?php selected($language_code, 'fr'); ?>>French</option>
              <option value="gl" <?php selected($language_code, 'gl'); ?>>Galician</option>
              <option value="gu" <?php selected($language_code, 'gu'); ?>>Gujarati</option>
              <option value="hi" <?php selected($language_code, 'hi'); ?>>Hindi</option>
              <option value="hr" <?php selected($language_code, 'hr'); ?>>Croatian</option>
              <option value="hu" <?php selected($language_code, 'hu'); ?>>Hungarian</option>
              <option value="id" <?php selected($language_code, 'id'); ?>>Indonesian</option>
              <option value="it" <?php selected($language_code, 'it'); ?>>Italian</option>
              <option value="iw" <?php selected($language_code, 'iw'); ?>>Hebrew</option>
              <option value="ja" <?php selected($language_code, 'ja'); ?>>Japanese</option>
              <option value="kn" <?php selected($language_code, 'kn'); ?>>Kannada</option>
              <option value="ko" <?php selected($language_code, 'ko'); ?>>Korean</option>
              <option value="lt" <?php selected($language_code, 'lt'); ?>>Lithuanian</option>
              <option value="lv" <?php selected($language_code, 'lv'); ?>>Latvian</option>
              <option value="ml" <?php selected($language_code, 'ml'); ?>>Malayalam</option>
              <option value="mr" <?php selected($language_code, 'mr'); ?>>Marathi</option>
              <option value="nl" <?php selected($language_code, 'nl'); ?>>Dutch</option>
              <option value="no" <?php selected($language_code, 'no'); ?>>Norwegian</option>
              <option value="pl" <?php selected($language_code, 'pl'); ?>>Polish</option>
              <option value="pt" <?php selected($language_code, 'pt'); ?>>Portuguese</option>
              <option value="pt-BR" <?php selected($language_code, 'pt-BR'); ?>>Portuguese (Brazil)</option>
              <option value="pt-PT" <?php selected($language_code, 'pt-PT'); ?>>Portuguese (Portugal)</option>
              <option value="ro" <?php selected($language_code, 'ro'); ?>>Romanian</option>
              <option value="ru" <?php selected($language_code, 'ru'); ?>>Russian</option>
              <option value="sk" <?php selected($language_code, 'sk'); ?>>Slovak</option>
              <option value="sl" <?php selected($language_code, 'sl'); ?>>Slovenian</option>
              <option value="sr" <?php selected($language_code, 'sr'); ?>>Serbian</option>
              <option value="sv" <?php selected($language_code, 'sv'); ?>>Swedish</option>
              <option value="ta" <?php selected($language_code, 'ta'); ?>>Tamil</option>
              <option value="te" <?php selected($language_code, 'te'); ?>>Telugu</option>
              <option value="th" <?php selected($language_code, 'th'); ?>>Thai</option>
              <option value="tl" <?php selected($language_code, 'tl'); ?>>Tagalog</option>
              <option value="tr" <?php selected($language_code, 'tr'); ?>>Turkish</option>
              <option value="uk" <?php selected($language_code, 'uk'); ?>>Ukrainian</option>
              <option value="vi" <?php selected($language_code, 'vi'); ?>>Vietnamese</option>
              <option value="zh-CN" <?php selected($language_code, 'zh-CN'); ?>>Chinese (Simplified)</option>
              <option value="zh-TW" <?php selected($language_code, 'zh-TW'); ?>>Chinese (Traditional)</option>
           </select>
             <p class="description"><?php _e('Select specific language reviews to display on your site. Default is set as English.','everest-google-places-reviews');?></p>
        </label>
    </div>
</div>