<?php

use WpBookingEvent\Factory;
use WpBookingEvent\Mvc\Model\Model;
use WpBookingEvent\Utilities\Utility;
use WpBookingEvent\Html\WpBookingEventHtmlBackend as WpBookingEventHtmlBackendAlias;
use WpBookingEvent\Language\Text;
defined('_WPBOOKINGEVENT_EXEC') or die;
extract($displayData);
WpBookingEventHtmlBackendAlias::load_jquery_library('auto_numeric');
$doc = Factory::getDocument();
$doc->addLessStyleSheet('admin/app/layouts/WooBooking/form/field/customaddress/customaddress.less');
$modelLocation = Model::getInstance('location');
$list = $modelLocation->getList();
$id_by_name = "element_field_". $name;
?>
    <div id="<?php esc_html_e($id_by_name) ?>" class="field-custom-address">
        <label class="label-select-address"><?php esc_attr_e('Select address','wpbookingevent') ?></label>
        <div class="block-select-address">
            <select name="<?php esc_html_e($name); ?>" class="list-address">
                <option value=""><?php esc_attr_e('Custom address','wpbookingevent') ?></option>
                <?php foreach ($list as $item) { ?>
                    <option <?php echo($value == $item->id ? ' selected ' : '') ?>
                            value="<?php esc_html_e($item->id); ?>"><?php esc_html_e($item->address); ?></option>
                <?php } ?>
            </select>
        </div>
        <div class="wrapper-custom-address">
            <div class="row">
                <div class="col-md-12">
                    <input type="text" class="form-control custom-address" name="<?php esc_html_e($name_custom_address) ?>" placeholder="<?php esc_attr_e('Custom address','wpbookingevent') ?>"  />
                </div>
            </div>
        </div>
    </div>
<?php
$doc->addScriptApplySelector('#'.$id_by_name,'field_customaddress',array(
    "input_name"=>  $name,
),'admin/app/layouts/WooBooking/form/field/customaddress/jquery.customaddress.js');
