<?php

use WpBookingHotel\Factory;
use WpBookingHotel\Language\Text;
use WpBookingHotel\Mvc\Model\Model;
use WpBookingHotel\Utilities\Utility;
use WpBookingHotel\Html\WpBookingHotelHtmlBackend as WpBookingHotelHtmlBackendAlias;
defined('_WPBOOKINGHOTEL_EXEC') or die;
extract($displayData);
WpBookingHotelHtmlBackendAlias::load_jquery_library('select2');
$id_by_name = "element_field_". $name;
$modelSmsactions = Model::getInstance('Smscontents');
$list = $modelSmsactions->getList();
$data = $displayData['field']->getForm()->getData();
$uri = Factory::getUri();
$list_page_id = [];
if (!is_array($value)) {
    $list_page_id[] = $value;
} else {
    $list_page_id = $value;
}
$sms_action = $default_smsaction;
?>
    <div id="<?php esc_attr_e($id_by_name) ?>" class="<?php esc_attr_e($class); ?> field-smsaction">
        <select name="<?php echo (esc_attr($name)); ?>"
                required="<?php echo (esc_attr($required)) ?>" <?php echo ($multiple ? ' multiple ' : ""); ?>
                class="list-page">
            <option value=""><?php esc_html_e('Select Action SMS','wpbookinghotel') ?></option>
            <?php foreach ($list as $item) { ?>
                <option <?php echo (in_array($item->action_sms, $list_page_id) ? ' selected ' : null) ?>
                    value="<?php echo (esc_attr($item->action_sms)); ?>"><?php echo (esc_html(str_replace(" ","_",$item->action_sms))); ?>
                </option>
            <?php } ?>
        </select>
    </div>
<?php

$doc = Factory::getDocument();
$doc->addLessStyleSheet('admin/app/layouts/WooBooking/form/field/smsaction/smsaction.less');
$doc->addScriptApplySelector('.field-smsaction','field_smsaction',array(
),'admin/app/layouts/WooBooking/form/field/smsaction/smsaction.jquery.js');