<?php 
global $post;
$lang = 1;

$gocars_display = get_post_meta( $post->ID, 'gocars_display', true );

//form fields
$form_display = get_post_meta( $post->ID, 'form_display', true );
$vehicle_display = get_post_meta( $post->ID, 'vehicle_display', true );
$vehicle_type_border = get_post_meta( $post->ID, 'vehicle_type_border', true );

//header fields 
$header_text_color = get_post_meta( $post->ID, 'header_text_color', true );
$header_background_color = get_post_meta( $post->ID, 'header_background_color', true );
$header_text_content = get_post_meta( $post->ID, 'header_text_content', true );

//body fields
$body_text_color = get_post_meta( $post->ID, 'body_text_color', true );
$body_background_color = get_post_meta( $post->ID, 'body_background_color', true );
// $search_text = get_post_meta($post->ID, 'search_text', true) ? get_post_meta($post->ID, 'search_text', true) :  __( 'Search Prices', 'gocars_admin' );
$search_text = get_post_meta($post->ID, 'search_text', true) ? get_post_meta($post->ID, 'search_text', true) :  '';
$show_footer = get_post_meta( $post->ID, 'show_footer', true );
$footer_text = get_post_meta( $post->ID, 'footer_text', true );

//color fields
$primary_color = get_post_meta( $post->ID, 'primary_color', true );
$primary_text_color = get_post_meta( $post->ID, 'primary_text_color', true );
$primary_dark_color = get_post_meta( $post->ID, 'primary_dark_color', true );
$alternative_color = get_post_meta( $post->ID, 'alternative_color', true );
$alternative_light_color = get_post_meta( $post->ID, 'alternative_light_color', true );
$icons_color = get_post_meta( $post->ID, 'icons_color', true );
$border_color = get_post_meta( $post->ID, 'border_color', true );

//general fields
$timepicker = get_post_meta( $post->ID, 'timepicker', true );
$show_border = get_post_meta( $post->ID, 'show_border', true );
$loading_effect = get_post_meta( $post->ID, 'loading_effect', true );

//locations
$selected_locations = get_post_meta($post->ID, 'selected_locations', true);
$selected_locations = !empty($selected_locations) ? explode(',', $selected_locations) : array();
$display_selected_locations = get_post_meta($post->ID, 'display_selected_locations', true);

$language_id = get_post_meta( $post->ID, 'language_id', true );

$cached_opts = get_post_meta( $post->ID, 'options_data', true );
$option_arr = null;
if ( $cached_opts !== '' && $cached_opts !== false ) {
    $option_arr = json_decode( wp_unslash( $cached_opts ) );
}
if ( empty( $option_arr ) || ! is_object( $option_arr ) ) {
    $option_arr = getGcOptions( $post->ID );
}

$getGcVehicleTypes = null;
$vehicle_meta_raw  = get_post_meta( $post->ID, 'vehicle_data', true );
if ( $vehicle_meta_raw !== '' && $vehicle_meta_raw !== false ) {
    $decoded_vt = json_decode( wp_unslash( $vehicle_meta_raw ), true );
    if ( is_array( $decoded_vt ) ) {
        $getGcVehicleTypes = $decoded_vt;
    }
}
if ( $getGcVehicleTypes === null ) {
    $getGcVehicleTypes = getGcVehicleTypes( $post->ID, $option_arr, null );
}

if (isset($option_arr->o_translate_website) && $option_arr->o_translate_website == 1 && defined('ICL_LANGUAGE_CODE') && isset($language_id)) {
    $lang = $language_id;
}

$locations = gocars_admin_locations_from_meta( $post->ID, $lang );
if ( $locations === null ) {
    $locations = getGcLocations($lang, $post->ID);
}
$locations_arr = array();
foreach ( gocars_normalize_locations_to_list( $locations ) as $loc ) {
    $locations_arr[ $loc->id ] = gocars_location_display_name( $loc );
}
$user_area = isset($option_arr->o_translate_website) ? $option_arr->o_allow_user_area : 0;
$user_area_background_color = get_post_meta( $post->ID, 'user_area_background_color', true );
$user_area_text_color = get_post_meta( $post->ID, 'user_area_text_color', true );

//keypoints
$display_keypoints = get_post_meta($post->ID, 'display_keypoints', true);
$keypoints_color = get_post_meta( $post->ID, 'keypoints_color', true );
$keypoints_data = get_post_meta($post->ID, 'keypoints_data', true);
$keypoints_data_arr = json_decode($keypoints_data);

?>

<table class="form-table shortcode-table search_form_fields" id="search_form_fields" role="presentation"<?php echo ($gocars_display != 'search_form') ? ' style="display: none;"' : '' ?>>
    <tbody>
        <tr class="title-row">
            <th scope="row">
                <p><?php esc_html_e( 'Form Settings','gocars_admin' ); ?></p>
            </th>
        </tr>
        <tr>
            <th scope="row">
                <label for="form_display"><?php esc_html_e( 'Form Display','gocars_admin' ); ?></label>
            </th>
            <td>
                <fieldset>
                    <legend class="screen-reader-text">
                        <span>
                            <?php esc_html_e( 'Display','gocars_admin' ); ?>
                        </span>
                    </legend>
                    <label>
                        <input name="form_display" type="radio" id="form_display" value="V" <?php checked( $form_display, 'V'); ?><?php echo ($form_display == '') ? ' checked' : '' ?>>
                        <?php esc_html_e( 'Vertical','gocars_admin' ); ?>
                    </label>
                    <br>
                    <label>
                        <input name="form_display" id="form_display" type="radio" value="H" <?php checked( $form_display, 'H'); ?>>
                        <?php esc_html_e( 'Horizontal','gocars_admin' ); ?>
                    </label>
                </fieldset>
            </td>
        </tr>
        <tr>
            <th scope="row">
                <label for="vehicle_display"><?php esc_html_e( 'Return Vehicle Label','gocars_admin' ); ?></label>
            </th>
            <td>
                <fieldset>
                    <legend class="screen-reader-text">
                        <span>
                            <?php esc_html_e( 'Vehicle','gocars_admin' ); ?>
                        </span>
                    </legend>
                    <label>
                        <input name="vehicle_display" type="radio" id="vehicle_display" value="<?php _e('car','gocars_admin'); ?>" <?php checked( $vehicle_display, 'car'); ?><?php echo ($vehicle_display == '') ? ' checked' : '' ?>>
                        <?php esc_html_e( 'Car','gocars_admin' ); ?>
                    </label>
                    <br>
                    <label>
                        <input name="vehicle_display" id="vehicle_display" type="radio" value="<?php _e('moto','gocars_admin'); ?>" <?php checked( $vehicle_display, 'moto'); ?>>
                        <?php esc_html_e( 'Moto','gocars_admin' ); ?>
                    </label>
                    <br>
                    <label>
                        <input name="vehicle_display" id="vehicle_display" type="radio" value="<?php _e('bicycle','gocars_admin'); ?>" <?php checked( $vehicle_display, 'bicycle'); ?>>
                        <?php esc_html_e( 'Bicycle','gocars_admin' ); ?>
                    </label>
                    <br>
                    <label>
                        <input name="vehicle_display" id="vehicle_display" type="radio" value="<?php _e('vehicle','gocars_admin'); ?>" <?php checked( $vehicle_display, 'vehicle'); ?>>
                        <?php esc_html_e( 'Vehicle','gocars_admin' ); ?>
                    </label>
                </fieldset>
            </td>
        </tr>
        <tr>
            <th scope="row">
                <label for="vehicle_type"><?php esc_html_e( 'Show Vehicle Types','gocars_admin' ); ?></label>
            </th>
            <td>
                <?php 
                if ($getGcVehicleTypes) {
                    ?>
                    <p>
                        <?php esc_html_e( 'Vehicle Types are active','gocars_admin' ); ?>
                    </p>
                    <p>
                        <?php esc_html_e( 'To hide vehicle types go to your booking\'s system Reservation Process and 1. Search tab','gocars_admin' ); ?>
                    </p>
                    <?php
                } else {
                    ?>
                    <p>
                        <?php esc_html_e( 'To show vehicle types go to your booking\'s system Reservation Process and 1. Search tab','gocars_admin' ); ?>
                    </p>
                    <?php
                }
                ?>
                
            </td>
        </tr>
        <?php if ($getGcVehicleTypes) { ?>
            <tr data-input="vehicle_type">
                <th scope="row">
                    <label for="vehicle_type_border"><?php esc_html_e( 'Vehicle Type Border','gocars_admin' ); ?></label>
                </th>
                <td>
                    <input name="vehicle_type_border" type="color" id="vehicle_type_border" value="<?php echo ($vehicle_type_border == '') ? '#FFFFFF' : esc_attr( $vehicle_type_border ) ; ?>">
                </td>
            </tr>
        <?php } ?>
        <tr class="title-row">
            <th scope="row">
                <p><?php esc_html_e( 'Header Settings','gocars_admin' ); ?></p>
            </th>
        </tr>
        <tr>
            <th scope="row">
                <label for="header_text_color"><?php esc_html_e( 'Text Color','gocars_admin' ); ?></label>
            </th>
            <td>
                <input name="header_text_color" type="color" id="header_text_color" value="<?php echo ($header_text_color == '') ? '#FFFFFF' : esc_attr( $header_text_color ) ; ?>">
            </td>
        </tr>
        <tr>
            <th scope="row">
                <label for="header_background_color"><?php esc_html_e( 'Background Color','gocars_admin' ); ?></label>
            </th>
            <td>
                <input name="header_background_color" type="color" id="header_background_color" value="<?php echo ($header_background_color == '') ? '#4F4872;' : esc_attr( $header_background_color ) ; ?>">
            </td>
        </tr>
        <tr>
            <th scope="row">
                <label for="header_text_content"><?php esc_html_e( 'Text','gocars_admin' ); ?></label>
            </th>
            <td>
                <input name="header_text_content" placeholder="<?php _e('Start Your Reservation!','gocars_admin'); ?>" type="text" maxlength="25" id="header_text_content" value="<?php echo ($header_text_content != '') ? esc_attr( $header_text_content ) : '' ; ?>" class="regular-text">
            </td>
        </tr>
        <tr class="title-row">
            <th scope="row">
                <p><?php esc_html_e( 'Body Settings','gocars_admin' ); ?></p>
            </th>
        </tr>
        <tr>
            <th scope="row">
                <label for="body_text_color"><?php esc_html_e( 'Text Color','gocars_admin' ); ?></label>
            </th>
            <td>
                <input name="body_text_color" type="color" id="body_text_color" value="<?php echo ($body_text_color == '') ? '#000000' : esc_attr( $body_text_color ) ; ?>">
            </td>
        </tr>
        <tr>
            <th scope="row">
                <label for="body_background_color"><?php esc_html_e( 'Background Color','gocars_admin' ); ?></label>
            </th>
            <td>
                <input name="body_background_color" type="color" id="body_background_color" value="<?php echo ($body_background_color == '') ? '#FFFFFF' : esc_attr( $body_background_color ) ; ?>">
            </td>
        </tr>
        <tr>
            <th scope="row">
                <label for="search_text"><?php esc_html_e( 'Search Text','gocars_admin' ); ?></label>
            </th>
            <td>
                <input name="search_text" placeholder="<?php _e('Search Prices','gocars_admin'); ?>" type="text" maxlength="25" id="search_text" value="<?php echo esc_attr( $search_text ) ; ?>" class="regular-text">
            </td>
        </tr>
        <tr>
            <th scope="row">
                <label for="show_footer"><?php esc_html_e( 'Show Footer Text','gocars_admin' ); ?></label>
            </th>
            <td>
                <fieldset>
                    <legend class="screen-reader-text">
                        <span>
                            <?php esc_html_e( 'Show Footer Text','gocars_admin' ); ?>
                        </span>
                    </legend>
                    <label>
                        <input name="show_footer" type="radio" id="show_footer" value="show" <?php checked( $show_footer, 'show'); ?><?php echo ($show_footer == '') ? ' checked' : '' ?>>
                        <?php esc_html_e( 'Show','gocars_admin' ); ?>
                    </label>
                    <br>
                    <label>
                        <input name="show_footer" id="show_footer" type="radio" value="hide" <?php checked( $show_footer, 'hide'); ?>>
                        <?php esc_html_e( 'Hide','gocars_admin' ); ?>
                    </label>
                </fieldset>
            </td>
        </tr>
        <tr data-input="show_footer"<?php echo ($show_footer == 'hide') ? ' style="display:none;"' : '' ?>>
            <th scope="row">
                <label for="footer_text"><?php esc_html_e( 'Text','gocars_admin' ); ?></label>
            </th>
            <td>
                <input name="footer_text" placeholder="<?php _e('Best Price Guarantee','gocars_admin'); ?>" type="text" maxlength="25" id="footer_text" value="<?php echo ($footer_text != '') ? esc_attr( $footer_text ) : '' ; ?>" class="regular-text">
            </td>
        </tr>
        <tr class="title-row">
            <th scope="row">
                <p><?php esc_html_e( 'Color Settings','gocars_admin' ); ?></p>
            </th>
        </tr>
        <tr>
            <th scope="row">
                <label for="primary_color"><?php esc_html_e( 'Primary Color','gocars_admin' ); ?></label>
            </th>
            <td>
                <input name="primary_color" type="color" id="primary_color" value="<?php echo ($primary_color == '') ? '#4F4872' : esc_attr( $primary_color ); ?>">
            </td>
        </tr>
        <tr>
            <th scope="row">
                <label for="primary_text_color"><?php esc_html_e( 'Primary Text Color','gocars_admin' ); ?></label>
            </th>
            <td>
                <input name="primary_text_color" type="color" id="primary_text_color" value="<?php echo ($primary_text_color == '') ? '#FFFFFF' : esc_attr( $primary_text_color ); ?>">
            </td>
        </tr>
        <tr>
            <th scope="row">
                <label for="primary_dark_color"><?php esc_html_e( 'Primary Dark Color','gocars_admin' ); ?></label>
            </th>
            <td>
                <input name="primary_dark_color" type="color" id="primary_dark_color" value="<?php echo ($primary_dark_color == '') ? '#352C45' : esc_attr( $primary_dark_color ); ?>">
            </td>
        </tr>
        <tr>
            <th scope="row">
                <label for="alternative_color"><?php esc_html_e( 'Alternative Color','gocars_admin' ); ?></label>
            </th>
            <td>
                <input name="alternative_color" type="color" id="alternative_color" value="<?php echo ($alternative_color == '') ? '#FFBA44' : esc_attr( $alternative_color ); ?>">
            </td>
        </tr>
        <tr>
            <th scope="row">
                <label for="alternative_light_color"><?php esc_html_e( 'Alternative Light Color','gocars_admin' ); ?></label>
            </th>
            <td>
                <input name="alternative_light_color" type="color" id="alternative_light_color" value="<?php echo ($alternative_light_color == '') ? '#FFE9C4' : esc_attr( $alternative_light_color ); ?>">
            </td>
        </tr>
        <tr>
            <th scope="row">
                <label for="icons_color"><?php esc_html_e( 'Icons Color','gocars_admin' ); ?></label>
            </th>
            <td>
                <input name="icons_color" type="color" id="icons_color" value="<?php echo ($icons_color == '') ? '#352C45' : esc_attr( $icons_color ); ?>">
            </td>
        </tr>
        <tr data-input="show_border"<?php echo ($show_border == 'hide') ? ' style="display:none;"' : '' ?>>
            <th scope="row">
                <label for="border_color"><?php esc_html_e( 'Border Color','gocars_admin' ); ?></label>
            </th>
            <td>
                <input name="border_color" type="color" id="border_color" value="<?php echo ($border_color == '') ? '#E6E6E6' : esc_attr( $border_color ); ?>">
            </td>
        </tr>
        <tr class="title-row">
            <th scope="row">
                <p><?php esc_html_e( 'General Settings','gocars_admin' ); ?></p>
            </th>
        </tr>
        <?php
	    $timepicker_display = '';
        foreach ($option_arr as $key => $value) {
            if ($key == 'o_timer_type') {
                $timepicker_display = $value;
            }
        }
        if ($timepicker_display != '') { ?>
            <tr>
                <th scope="row">
                    <label for="timepicker"><?php esc_html_e( 'Timepicker Display','gocars_admin' ); ?></label>
                </th>
                <td>
                    <fieldset>
                        <legend class="screen-reader-text">
                            <span>
                                <?php esc_html_e( 'Timepicker Display','gocars_admin' ); ?>
                            </span>
                        </legend>
                        <label>
                            <input name="timepicker" type="radio" id="timepicker" value="timepicker_input" <?php checked( $timepicker, 'timepicker_input'); ?><?php echo ($timepicker == '') ? ' checked' : '' ?>>
                            <?php esc_html_e( 'Input','gocars_admin' ); ?>
                        </label>
                        <br>
                        <label>
                            <input name="timepicker" id="timepicker" type="radio" value="timepicker_select" <?php checked( $timepicker, 'timepicker_select'); ?>>
                            <?php esc_html_e( 'Select','gocars_admin' ); ?>
                        </label>
                    </fieldset>
                </td>
            </tr>
        <?php } ?>
        <?php
	    $timepicker_steps = '';
        foreach ($option_arr as $key => $value) {
            if ($key == 'o_timer_step') {
                $timepicker_steps = $value;
            }
        }
        if ($timepicker_steps != '') { ?>
            <tr>
                <th scope="row">
                    <label for="timepicker_steps"><?php esc_html_e( 'Timepicker Steps','gocars_admin' ); ?></label>
                </th>
                <td>
                    <p>
                        <?php esc_html_e( 'Current steps are ' . $timepicker_steps . ' minutes' ,'gocars_admin' ); ?>
                    </p>
                    <p>
                        <?php esc_html_e( 'To change timepicker steps go to your booking\'s system Reservation Process and 1. Search tab','gocars_admin' ); ?>
                    </p>
                </td>
            </tr>
        <?php } ?>
        <tr>
            <th scope="row">
                <label for="show_border"><?php esc_html_e( 'Show Border','gocars_admin' ); ?></label>
            </th>
            <td>
                <fieldset>
                    <legend class="screen-reader-text">
                        <span>
                            <?php esc_html_e( 'Show Border','gocars_admin' ); ?>
                        </span>
                    </legend>
                    <label>
                        <input name="show_border" type="radio" id="show_border" value="show" <?php checked( $show_border, 'show'); ?><?php echo ($show_border == '') ? ' checked' : '' ?>>
                        <?php esc_html_e( 'Show','gocars_admin' ); ?>
                    </label>
                    <br>
                    <label>
                        <input name="show_border" id="show_border" type="radio" value="hide" <?php checked( $show_border, 'hide'); ?>>
                        <?php esc_html_e( 'Hide','gocars_admin' ); ?>
                    </label>
                </fieldset>
            </td>
        </tr>

        <tr>
            <th scope="row">
                <label for="loading_effect"><?php esc_html_e( 'Loading Effect','gocars_admin' ); ?></label>
            </th>
            <td>
                <fieldset>
                    <legend class="screen-reader-text">
                        <span>
                            <?php esc_html_e( 'Loading Effect','gocars_admin' ); ?>
                        </span>
                    </legend>
                    <label>
                        <input name="loading_effect" type="radio" id="loading_effect" value="opacity" <?php checked( $loading_effect, 'opacity'); ?><?php echo ($loading_effect == '') ? ' checked' : '' ?>>
                        <?php esc_html_e( 'Opacity','gocars_admin' ); ?>
                    </label>
                    <br>
                    <label>
                        <input name="loading_effect" id="loading_effect" type="radio" value="blur" <?php checked( $loading_effect, 'blur'); ?>>
                        <?php esc_html_e( 'Blur','gocars_admin' ); ?>
                    </label>
                    <br>
                    <label>
                        <input name="loading_effect" id="loading_effect" type="radio" value="" <?php checked( $loading_effect, ''); ?>>
                        <?php esc_html_e( 'None','gocars_admin' ); ?>
                    </label>
                </fieldset>
            </td>
        </tr>

        <tr>
            <th scope="row">
                <label for="display_selected_locations"><?php esc_html_e( 'Display Selected Locations','gocars_admin' ); ?></label>
            </th>
            <td>
                <fieldset>
                    <legend class="screen-reader-text">
                        <span>
                            <?php esc_html_e( 'Display Selected Locations','gocars_admin' ); ?>
                        </span>
                    </legend>
                    <label>
                        <select name="display_selected_locations" id="display_selected_locations">
                            <option value="no"<?php echo ($display_selected_locations == 'no') ? ' selected' : ''; ?>> <?php echo __( 'No', 'gocars_admin' ); ?> </option>
                            <option value="yes"<?php echo ($display_selected_locations == 'yes') ? ' selected' : ''; ?>> <?php echo __( 'Yes', 'gocars_admin' ); ?> </option>
                        </select>
                    </label>
                </fieldset>
            </td>
        </tr>
        <tr class="selected-locations-row"<?php echo $display_selected_locations == 'no' || $display_selected_locations == '' ? ' style="display: none;"' : ''; ?>>
            <th scope="row">
                <label for="selected_locations"><?php esc_html_e( 'Selected Locations','gocars_admin' ); ?></label>
            </th>
            <td>
                <fieldset>
                    <legend class="screen-reader-text">
                        <span>
                            <?php esc_html_e( 'Selected Locations','gocars_admin' ); ?>
                        </span>
                    </legend>
                    
                    <label class="select-2-label">
                        <select class="select-2-item selected_locations" multiple name="selected_locations[]" id="selected_locations"<?php echo ($selected_locations != '') ? " data-value='" . json_encode($selected_locations) . "'" : ''; ?>>
                            <?php 
                            if ( count($selected_locations) != 0 && is_array($locations_arr) ) : 
                                // Sort the $locations_arr array based on the desired order
                                uksort($locations_arr, function($a, $b) use ($selected_locations) {
                                    return array_search($a, $selected_locations) - array_search($b, $selected_locations);
                                });
                            endif; 
                            foreach ($locations_arr as $key => $value) {
                                ?>
                                <option value="<?php echo $key; ?>"<?php echo (in_array($key, $selected_locations) || count($selected_locations) === 0 ) ? ' selected' : ''; ?> title="<?php echo __( $value, 'gocars_admin' ); ?>"><?php echo __( $value, 'gocars_admin' ); ?></option>
                                <?php
                            }
                            ?>
                        </select>
                        <button class="select-2-all"><?php esc_html_e( 'Select All','gocars_admin' ); ?></button>
                    </label>
                    <input type="hidden" name="locations_arr" value='<?php echo json_encode($locations_arr); ?>'>
                    
                </fieldset>
            </td>
        </tr>

        <tr>
            <th scope="row">
                <label for="display_keypoints"><?php esc_html_e( 'Keypoints','gocars_admin' ); ?></label>
            </th>
            <td>
                <fieldset>
                    <legend class="screen-reader-text">
                        <span>
                            <?php esc_html_e( 'Keypoints','gocars_admin' ); ?>
                        </span>
                    </legend>
                    <label>
                        <select name="display_keypoints" id="display_keypoints">
                            <option value="no"<?php echo ($display_keypoints == 'no') ? ' selected' : ''; ?>> <?php echo __( 'No', 'gocars_admin' ); ?> </option>
                            <option value="yes"<?php echo ($display_keypoints == 'yes') ? ' selected' : ''; ?>> <?php echo __( 'Yes', 'gocars_admin' ); ?> </option>
                        </select>
                    </label>
                </fieldset>
            </td>
        </tr>
        <tr class="elements-wrapper-row"<?php echo $display_keypoints == 'no' || $display_keypoints == '' ? ' style="display: none;"' : ''; ?>>
            <th scope="row">
                
            </th>
            <td>
                <label for="keypoints_color">
                    <p>
                        <?php esc_html_e( 'Text Color','gocars_admin' ); ?>
                    </p>
                    <input name="keypoints_color" type="color" id="keypoints_color" value="<?php echo ($keypoints_color == '') ? '#000000' : esc_attr( $keypoints_color ) ; ?>">
                </label>
            </td>
        </tr>
        <tr class="elements-wrapper-row"<?php echo $display_keypoints == 'no' || $display_keypoints == '' ? ' style="display: none;"' : ''; ?>>
            <th scope="row">
               
            </th>
            <td>
                <fieldset>
                    <legend class="screen-reader-text">
                        <span>
                            <?php esc_html_e( 'Keypoints','gocars_admin' ); ?>
                        </span>
                    </legend>
                    
                    <div id="repeater-container">
                        <?php 
                        if ( $keypoints_data_arr ) : 
                            foreach ($keypoints_data_arr as $data => $element) {
                                ?>
                                <div class="field-group">
                                    <label class="repeater-field">
                                        <input name="keypoints[]" type="text" id="keypoints-<?php echo $data; ?>" class="single-keypoint large-text" value="<?php echo $element; ?>">
                                    </label> 
                                    <button class="remove-field button"><?php esc_html_e( 'Remove','gocars_admin' ); ?></button>                             
                                </div>
                                <?php
                            }
                        endif; 
                        ?>
                        
                    </div>           
                    <input type="hidden" name="keypoints_data" id="keypoints_data" value="<?php echo esc_attr( $keypoints_data ) ; ?>">         
                </fieldset>
                <fieldset>
                    <label>
                        <button id="add-keypoint" class="button add-field"><?php esc_html_e( 'Add Row','gocars_admin' ); ?></button>
                    </label>
                </fieldset>
            </td>
        </tr>

        <?php
        if ($user_area == 1) { ?>
            <tr class="title-row">
                <th scope="row">
                    <p><?php esc_html_e( 'User Area Settings','gocars_admin' ); ?></p>
                </th>
            </tr>
            <tr>
                <th scope="row">
                    <label for="user_area_text_color"><?php esc_html_e( 'User Area Tab Text Color','gocars_admin' ); ?></label>
                </th>
                <td>
                    <input name="user_area_text_color" type="color" id="user_area_text_color" value="<?php echo ($user_area_text_color == '') ? '#3A3453' : esc_attr( $user_area_text_color ) ; ?>">
                </td>
            </tr>
            <tr>
                <th scope="row">
                    <label for="user_area_background_color"><?php esc_html_e( 'User Area Tab Background Color','gocars_admin' ); ?></label>
                </th>
                <td>
                    <input name="user_area_background_color" type="color" id="user_area_background_color" value="<?php echo ($user_area_background_color == '') ? '#FCFAFD' : esc_attr( $user_area_background_color ) ; ?>">
                </td>
            </tr>
            
        <?php } ?>
        
    </tbody>
</table>   
<div class="hidden" data-id="search_form_fields">
    <label class="repeater-field">
        <input name="keypoints[]" type="text" id="keypoints-{INDEX}" class="single-keypoint large-text">
    </label>
</div>





