<?php defined('ABSPATH') or die("No script kiddies please!");
global $post;
$post_id = $post->ID;
$egpr_viewall_settings = get_post_meta($post_id, 'egpr_viewall_settings', true);
$enable_viewall = (isset($egpr_viewall_settings['enable']) && $egpr_viewall_settings['enable'] == "true") ? "true" : "false";
$enable_nofollow = (isset($egpr_viewall_settings['enable_nofollow']) && $egpr_viewall_settings['enable_nofollow'] == "true") ? "true" : "false";
$text_btitle = (isset($egpr_viewall_settings['text_btitle']) && $egpr_viewall_settings['text_btitle'] != "") ? $egpr_viewall_settings['text_btitle'] : "";
$view_all_custom_url = (isset($egpr_viewall_settings['custom_url']) && $egpr_viewall_settings['custom_url'] != "") ? $egpr_viewall_settings['custom_url'] : "";
$blink_target = (isset($egpr_viewall_settings['link_target']) && $egpr_viewall_settings['link_target'] != "") ? $egpr_viewall_settings['link_target'] : "_self";
?>
<div class="egpr_viewallsection_wrapper">
    <div class="egpr-type-field">
        <label for="egpr_meta_view_enable"><h4><?php _e('Enable', 'everest-google-places-reviews'); ?></h4></label>
        <label class="egpr-switch">
            <input type="checkbox" id="egpr_meta_view_enable" name="egpr_viewall_settings[enable]"  value="true" <?php checked($enable_viewall, 'true'); ?>/>
        <div class="egpr-slider round"></div>
        </label>
       <div class="egpr-tooltip-description">
                <div class="egpr-description">
                   <?php _e('Show/hide view all button.', 'everest-google-places-reviews'); ?>
                </div>
       </div>
    </div>
    <div class="egpr-type-field">
        <label for="egpr_meta_text_btitle2"><h4><?php _e('Button Title', 'everest-google-places-reviews'); ?></h4></label>
        <label class="egpr-noswitch">
            <input type="text" id="egpr_meta_text_title2" name="egpr_viewall_settings[text_btitle]"  value="<?php echo esc_attr($text_btitle); ?>"/>
        </label>
    </div>
       <div class="egpr-type-field">
        <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_viewall_settings[custom_url]"  value="<?php echo esc_url($view_all_custom_url); ?>"/>
            <p class="description"><?php _e('Note: If left empty, the default value will be set as link to your above setup google map location and redirect to specific google places map with its reviews browser page. If you want your own custom URL link then please do fill this field with valid URL Link.','everest-google-places-reviews');?></p>
        </label>
    </div>
    <div class="egpr-type-field">
        <label for="egpr_meta_view_link_target"><h4><?php _e('Link Target', 'everest-google-places-reviews'); ?></h4></label>
        <label class="egpr-noswitch">
            <select name="egpr_viewall_settings[link_target]" class="egpr-field-selection">
                <option value="_parent" <?php selected($blink_target,"_parent");?>>_parent</option>
                <option value="_self" <?php selected($blink_target,"_self");?>>_self</option>
                <option value="_top" <?php selected($blink_target,"_top");?>>_top</option>
                <option value="_blank" <?php selected($blink_target,"_blank");?>>_blank</option>
            </select>
        </label>
    </div>
    <div class="egpr-type-field egpr-nofollow-wrap">
        <label for="egpr_meta_view_enable_nofollow"><h4><?php _e('Enable NoFollow Attribute', 'everest-google-places-reviews'); ?></h4></label>
        <label class="egpr-switch">
            <input type="checkbox" id="egpr_meta_view_enable_nofollow" name="egpr_viewall_settings[enable_nofollow]"  value="true" <?php checked($enable_nofollow, 'true'); ?>/>
           <div class="egpr-slider round"></div>
        </label>
       <div class="egpr-tooltip-description">
                <div class="egpr-description">
                   <?php _e('Enable nofollow tag as attribute to discourage comment spam for this a tag button.', 'everest-google-places-reviews'); ?>
                </div>
       </div>
    </div>
</div>