<?php

use rentsyst\includes\Rentsyst_PluginSettings;

require_once WP_RENTSYST_PLUGIN_DIR . '/includes/Rentsyst_PluginSettings.php';
$service->add_my_setting();
?>

<div class="rentsyst-page-wrapper wrap base-sub-page">
    <h1 class="wp-heading-inline"><?php esc_html_e('Catalog options', 'rentsyst'); ?></h1>
    <div class="connect-status">
        <div class="ibox-content">
            <form action="<?= $selfUrl ?>" method="POST" class="form form-horizontal">
                <?= wp_nonce_field('rentsyst_ajax_nonce', 'security'); ?>
                <fieldset>
                    <input type="hidden" value="rentsyst" name="page">
                    <div class="form-group">
                        <label class="col-sm-2 control-label"><?php esc_html_e('Enable filter', 'rentsyst'); ?></label>
                        <div class="col-sm-10">
                            <div class="checkbox">
                                <label>

                                    <input type="checkbox"
                                           name="enable_catalog_filter"
                                           value="1" <?= $settings['enable_catalog_filter'] ? 'checked' : '' ?>>
                                    <?php esc_html_e('Enable', 'rentsyst'); ?>
                                </label>
                            </div>
                        </div>
                    </div>
                    <div class="hr-line-dashed"></div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label"><?php esc_html_e('Filter position', 'rentsyst'); ?></label>
                        <div class="col-sm-10">
                            <select class="form-control" name="filter_button_position">
                                <option <?= $settings['filter_button_position'] === 'right' ? 'selected' : ''; ?>
                                        value="right">
                                    <?php esc_html_e('Right', 'rentsyst'); ?>
                                </option>
                                <option <?= $settings['filter_button_position'] === 'left' ? 'selected' : ''; ?>
                                        value="left">
                                    <?php esc_html_e('Left', 'rentsyst'); ?>
                                </option>

                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label"><?php esc_html_e('Accent Color', 'rentsyst'); ?></label>
                        <div class="col-sm-10">
                            <input type="color" name="filter_accent_color" class="form-control"
                                   value="<?= esc_attr($settings['filter_accent_color']); ?>">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label"><?php esc_html_e('Fixed position', 'rentsyst'); ?></label>
                        <div class="col-sm-10">
                            <div class="checkbox">
                                <label>

                                    <input type="checkbox"
                                           name="<?= Rentsyst_PluginSettings::CATALOG_FILTER_ENABLE_FIX; ?>"
                                           value="1" <?= $settings[Rentsyst_PluginSettings::CATALOG_FILTER_ENABLE_FIX] ? 'checked' : '' ?>>
                                    <?php esc_html_e('Enable', 'rentsyst'); ?>
                                </label>
                            </div>
                        </div>
                    </div>
                    <div class="hr-line-dashed"></div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label"><?php esc_html_e('Template for catalog item', 'rentsyst'); ?></label>
                        <div class="col-sm-10">
			                <?php
			                wp_dropdown_pages(['name' => 'rentsyst_catalog_page_id', 'selected' => $settings['rentsyst_catalog_page_id'], 'show_option_none' => __('no selected', 'rentsyst')]);
			                ?>
                        </div>
                    </div>
                    <div class="hr-line-dashed"></div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label"><?php esc_html_e('Template for vehicle single page', 'rentsyst'); ?></label>
                        <div class="col-sm-10">
			                <?php
			                wp_dropdown_pages(['name' => 'rentsyst_catalog_single_page_id', 'selected' => esc_attr($settings['rentsyst_catalog_single_page_id']), 'show_option_none' => __('no selected', 'rentsyst')]);
			                ?>
                        </div>
                    </div>


                    <button class="btn btn-primary btn-block">
                        <?php esc_html_e('Save', 'rentsyst'); ?>
                    </button>
                </fieldset>
            </form>

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