<?php

use WpBookingHotel\Factory;
use WpBookingHotel\Mvc\Model\Model;
use WpBookingHotel\Utilities\Utility;
use WpBookingHotel\Html\WpBookingHotelHtmlFrontend as WpBookingHotelHtmlFrontendAlias;
use WpBookingHotel\Language\Text;
defined('_WPBOOKINGHOTEL_EXEC') or die;
extract($displayData);
WpBookingHotelHtmlFrontendAlias::load_jquery_library('select2');
$id_by_name = "element_field_". $name;
$input = Factory::getInput();
$number_adult = $input->getInt('number_adult',0);
$number_child = $input->getInt('number_child',0);

?>
    <div id="<?php echo (esc_attr($id_by_name)) ?>" class="<?php echo (esc_attr($class)); ?> field-total-people">
        <div class="dropdown main-block">
            <div class="block-top" data-toggle="dropdown">
                <div class="block-content">
                    <div class="adult-content">
                        <span class="number-adult"><?php echo($number_adult>0?$number_adult:$default_value_field_number_adult);?></span>
                        <span><?php esc_html_e('Adult','wpbookinghotel');?></span>
                    </div>
                    <div class="child-content">
                        <span class="number-child"><?php echo ($number_child>0?$number_child:$default_value_field_number_child);?></span>
                        <span><?php esc_html_e('Child','wpbookinghotel');?></span>
                    </div>
                </div>
                <div class="icon">
                    <i class="far fa-user"></i>
                </div>
            </div>
            <ul class="dropdown-menu">
                <li>
                    <div class="block-select block-select-adult">
                        <div class="content">
                            <span><?php esc_html_e('Number Adult','wpbookinghotel');?></span>
                        </div>
                        <div class="block-increment">
                            <button type="button" class="btn-minius">-</button>
                            <input type="text" class="input-field" value="<?php echo($number_adult>0?$number_adult:$default_value_field_number_adult);?>">
                            <button type="button" class="btn-plus">+</button>
                        </div>
                    </div>
                </li>
                <li>
                    <div class="block-select block-select-child">
                        <div class="content">
                            <span><?php esc_html_e('Number Child','wpbookinghotel');?></span>
                        </div>
                        <div class="block-increment">
                            <button type="button" class="btn-minius">-</button>
                            <input type="text" class="input-field" value="<?php echo ($number_child>0?$number_child:$default_value_field_number_child);?>">
                            <button type="button" class="btn-plus">+</button>
                        </div>
                    </div>
                </li>
            </ul>
        </div>
        <input type="hidden" name="<?php echo (esc_attr($name_field_number_adult));?>">
        <input type="hidden" name="<?php echo (esc_attr($name_field_number_child));?>">
    </div>
<?php
$doc = Factory::getDocument();
$doc->addLessStyleSheet('frontend/app/layouts/WooBooking/form/field/totalpeople/totalpeople.less');
$doc->addStyleSheet('frontend/app/assets/nb-font-icon/nb-font-icon.css');
$doc->addScriptApplySelector('.field-total-people','field_totalpeople',array(
        "name_field_number_adult"=>$name_field_number_adult,
        "name_field_number_child"=>$name_field_number_child
),'frontend/app/layouts/WooBooking/form/field/totalpeople/totalpeople.js');