<?php defined('ABSPATH') or die('No script kiddies please!'); ?>
<div class="wrap wpwab-wrap">
    <div class="wpwab-content-wrap">
        <div class="wpwab-page-list">
            <div class="wpwab-content-wrap">
                <div class="wpwab-field-wrap" id="wpwab-pages" >
                    <label><?php _e('Pages', wpwab_TD); ?></label>
                    <div class="wpwab-field">
                        <label><input type="radio" name="wpwab_settings[pages]" value="all" id="wpwab-all-pages"  <?php echo ((isset($wpwab_settings['pages'])) && $wpwab_settings['pages'] === "all") ? "checked='checked'" : ""; ?>>All Pages</label>
                        <label><input type="radio" name="wpwab_settings[pages]" value="page" id="wpwab-specific-pages"   <?php echo ((isset($wpwab_settings['pages'])) && $wpwab_settings['pages'] === "page") ? "checked='checked'" : ""; ?>>Specific Pages</label><br>
                    </div>
                    <div class="wpwab-floating-button-page" id="wpwab-show-pagelist"></div>
                    <input type="hidden" name="wpwab_settings[page_details]" value=<?php echo isset($wpwab_settings['pages']) ? $wpwab_settings['pages']:''; ?> id="wpwab-page-details">
                </div>
                <div class="wpwab-field-wrap" >
                    <label><?php _e('Post', wpwab_TD); ?></label>
                    <div class="wpwab-field">
                        <label><input type="radio" name="wpwab_settings[posts]" value="all" id="wpwab-all-post" <?php echo ((isset($wpwab_settings['posts'])) && $wpwab_settings['posts'] === "all") ? "checked='checked'" : ""; ?> >All Post</label>
                        <label><input type="radio" name="wpwab_settings[posts]" value="post"  class="wpwab-list" id="wpwab-specific-post" <?php echo ((isset($wpwab_settings['posts'])) && $wpwab_settings['posts'] === "post") ? "checked='checked'" : ""; ?>>
                            Specific Post </label> <br >
                    </div>
                    <div class="wpwab-floating-button-post" id="wpwab-show-postlist" > </div>
                    <input type="hidden" name="wpwab_settings[post_details]" value=<?php echo isset($wpwab_settings['posts']) ? $wpwab_settings['posts']:''; ?> id="wpwab-post-details">
                </div>
                <div class="wpwab-field-wrap">
                    <label><?php _e('Category', wpwab_TD); ?></label>
                    <div class="wpwab-field">
                        <label><input type="radio" name="wpwab_settings[category]" value="all" id="wpwab-all-category"<?php echo ((isset($wpwab_settings['category'])) && $wpwab_settings['category'] === "all") ? "checked='checked'" : ""; ?>>All Category</label>
                        <label><input type="radio" name="wpwab_settings[category]" id="wpwab-specific-category" value="specific" <?php echo ((isset($wpwab_settings['category'])) && $wpwab_settings['category'] === "specific") ? "checked='checked'" : ""; ?>>Specific Category</label><br>
                    </div>
                </div>
                <div id="wpwab-display-selection" >
                    <div class="wpwab-tab-contents" >
                        <?php
                        $selected_pages = (!empty($wpwab_settings['specific_page'])) ? implode(',', $wpwab_settings['specific_page']) : '';
                        $selected_posts = (!empty($wpwab_settings['specific_post'])) ? implode(',', $wpwab_settings['specific_post']) : '';
                        ?>
                        <input type="hidden" id="wpwab-selected-pages" name="wpwab_settings[specific_pages_list]" value="<?php echo $selected_pages; ?>"/>
                        <input type="hidden" id="wpwab-selected-posts" name="wpwab_settings[specific_posts_list]" value="<?php echo $selected_posts; ?>"/>

                    </div>
                </div>
                <div id="wpwab-display-category" style="display: none;" >
                    <div class="wpwab-field-wrap" >
                        <label class="wpwab-block"><?php _e('Select Category', wpwab_TD); ?></label>
                        <div class="wpwab-field">
                            <?php
                            $categories = get_categories(array('hide_empty' => 0));
                            $specific_category = (!empty($wpwab_settings['specific_category'])) ? $wpwab_settings['specific_category'] : array();
                            foreach ($categories as $category) {
                                ?>
                                <label class="wpwab-block"><input type="checkbox" id="wpwab-category-" value="<?php echo $category->term_id; ?>"  name="wpwab_settings[specific_category][]" <?php echo (in_array($category->term_id, $specific_category)) ? 'checked="checked"' : ''; ?> ><?php echo $category->name; ?></label>
                                <?php }
                                ?>
                        </div>
                    </div>
                </div>


            </div>
        </div>
    </div>
</div>
