<?php

defined('ABSPATH') || exit;

?>

<div class="col-12">
    <div class="row ">
        <?php if (!empty($shortcode_instance->booking_type->get_meta('questions') ?? [])) : ?>
            <h6 class="mb-3"> <?php esc_html_e("Questions:", 'wpbookit') ?> </h6>
            <?php
            $wpbookit_questions = array_map(function ($item) {
                $item['question'] = wpbookit_unicode_to_utf8($item['question']);
                if (!empty($item['options']) && is_array($item['options'])) {
                    $item['options'] = array_map(function ($option) {
                        return wpbookit_unicode_to_utf8($option);
                    }, $item['options']);
                }
                return $item;
            }, json_decode($shortcode_instance->booking_type->get_meta('questions') ?? [], true));

            foreach ($wpbookit_questions as $wpbookit_index => $wpbookit_question) {
                do_action('wpbookit_booking_shortcode_form_question_type', ['question' => $wpbookit_question]);
            }

            ?>
        <?php endif; ?>
    </div>
</div>
