<?php
defined('ABSPATH') or die("No script kiddies please!");
global $post;
$post_id = $post->ID;
$egpr_rateus_settings = get_post_meta($post_id, 'egpr_rateus_settings', true);
//$this->displayArr($egpr_rateus_settings );
$enable_rateus = (isset($egpr_rateus_settings['enable']) && $egpr_rateus_settings['enable'] == "true") ? "true" : "false";
$text_title = (isset($egpr_rateus_settings['text_title']) && $egpr_rateus_settings['text_title'] != "") ? $egpr_rateus_settings['text_title'] : "";
$link_target = (isset($egpr_rateus_settings['link_target']) && $egpr_rateus_settings['link_target'] != "") ? $egpr_rateus_settings['link_target'] : "_self";
$link_type = (isset($egpr_rateus_settings['link_type']) && $egpr_rateus_settings['link_type'] != "") ? $egpr_rateus_settings['link_type'] : "";
$custom_url = (isset($egpr_rateus_settings['custom_url']) && $egpr_rateus_settings['custom_url'] != "") ? $egpr_rateus_settings['custom_url'] : "";

?>
<div class="egpr_rate_us_section_wrapper">
    <div class="egpr-type-field">
        <label for="egpr_meta_rateus_enable"><h4><?php _e('Enable', 'everest-google-places-reviews'); ?></h4></label>
        <label class="egpr-switch">
            <input type="checkbox" id="egpr_meta_rateus_enable" name="egpr_rateus_settings[enable]"  value="true" <?php checked($enable_rateus, 'true'); ?>/>
        <div class="egpr-slider round"></div>
        </label>
       <div class="egpr-tooltip-description">
                <div class="egpr-description">
                   <?php _e('Show/hide rate us button at last of reviews.', 'everest-google-places-reviews'); ?>
                </div>
       </div>
    </div>
    <div class="egpr-type-field">
        <label for="egpr_meta_text_title"><h4><?php _e('Text Title', 'everest-google-places-reviews'); ?></h4></label>
        <label class="egpr-noswitch">
            <input type="text" id="egpr_meta_text_title" name="egpr_rateus_settings[text_title]"  value="<?php echo esc_attr($text_title); ?>"/>
        </label>
    </div>
      <div class="egpr-type-field">
        <label><h4><?php _e('Rate Us Link Type', 'everest-google-places-reviews'); ?></h4></label>
        <label class="egpr-noswitch">
            <select name="egpr_rateus_settings[link_type]" class="egpr-link-type egpr-field-selection">
                <option value="default" <?php selected($link_type,"default");?>>Default</option>
                <option value="custom_link" <?php selected($link_type,"custom_link");?>>Custom Link</option>
            </select>
            <p class="description"><?php _e('If you set button type as default then your link will goes to google rate us form link but if you want your own custom link then please choose second option.','everest-google-places-reviews');?></p>
        </label>
    </div>

     <div class="egpr-type-field egpr-custom-link-rateus">
        <label for="egpr_meta_custom_url"><h4><?php _e('Custom Link URL', 'everest-google-places-reviews'); ?></h4></label>
        <label class="egpr-noswitch">
            <input type="text" id="egpr_meta_custom_url" name="egpr_rateus_settings[custom_url]"  value="<?php echo esc_url($custom_url); ?>"/>
        <p class="description"><?php _e('Fill your custom url link here.','everest-google-places-reviews');?></p>
        </label>
    </div>

    <div class="egpr-type-field">
        <label for="egpr_meta_link_target"><h4><?php _e('Link Target', 'everest-google-places-reviews'); ?></h4></label>
        <label class="egpr-noswitch">
            <select name="egpr_rateus_settings[link_target]" class="egpr-field-selection">
                <option value="_parent" <?php selected($link_target,"_parent");?>>_parent</option>
                <option value="_self" <?php selected($link_target,"_self");?>>_self</option>
                <option value="_top" <?php selected($link_target,"_top");?>>_top</option>
                <option value="_blank" <?php selected($link_target,"_blank");?>>_blank</option>
            </select>
        </label>
    </div>
</div>