<?php /* Smarty version Smarty-3.1.19, created on 2017-03-06 17:34:16
         compiled from "template__system/admin_admin:../field_types/input/user.tpl" */ ?>
<?php /*%%SmartyHeaderCode:202325488158bd9d98ab99a4-35235687%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    'cbb4635ba70fbf2f4d80bb62929ff8b00d7a5a72' => 
    array (
      0 => 'template__system/admin_admin:../field_types/input/user.tpl',
      1 => 1488811000,
      2 => 'template__system/admin_admin',
    ),
  ),
  'nocache_hash' => '202325488158bd9d98ab99a4-35235687',
  'function' => 
  array (
  ),
  'variables' => 
  array (
    'id' => 0,
    'value' => 0,
    'listing' => 0,
    'user_group' => 0,
    'allow_empty' => 0,
    'value_type' => 0,
  ),
  'has_nocache_code' => false,
  'version' => 'Smarty-3.1.19',
  'unifunc' => 'content_58bd9d98ad0ed0_24026241',
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_58bd9d98ad0ed0_24026241')) {function content_58bd9d98ad0ed0_24026241($_smarty_tpl) {?><select type="text" name="<?php echo $_smarty_tpl->tpl_vars['id']->value;?>
" id="<?php echo $_smarty_tpl->tpl_vars['id']->value;?>
">
    <?php if ($_smarty_tpl->tpl_vars['value']->value) {?>
        <option value="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['value']->value, ENT_QUOTES, 'UTF-8', true);?>
" selected="selected"><?php echo $_smarty_tpl->tpl_vars['listing']->value['user']['username'];?>
</option>
    <?php }?>
</select>

<?php $_smarty_tpl->smarty->_tag_stack[] = array('javascript', array()); $_block_repeat=true; echo $_smarty_tpl->smarty->registered_plugins['block']['javascript'][0][0]->_tpl_javascript(array(), null, $_smarty_tpl, $_block_repeat);while ($_block_repeat) { ob_start();?>


    <link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/css/select2.min.css" rel="stylesheet" />
    <script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/select2.min.js"></script>
    <script>
        $(document).ready(function () {
            var userSelector = $('#<?php echo $_smarty_tpl->tpl_vars['id']->value;?>
').select2({
                placeholder: '<?php if ($_smarty_tpl->tpl_vars['user_group']->value['name']=='Job Seeker') {?><?php $_smarty_tpl->smarty->_tag_stack[] = array('tr', array()); $_block_repeat=true; echo $_smarty_tpl->smarty->registered_plugins['block']['tr'][0][0]->translate(array(), null, $_smarty_tpl, $_block_repeat);while ($_block_repeat) { ob_start();?>
Enter full name or email<?php $_block_content = ob_get_clean(); $_block_repeat=false; echo $_smarty_tpl->smarty->registered_plugins['block']['tr'][0][0]->translate(array(), $_block_content, $_smarty_tpl, $_block_repeat); } array_pop($_smarty_tpl->smarty->_tag_stack);?>
<?php } else { ?><?php $_smarty_tpl->smarty->_tag_stack[] = array('tr', array()); $_block_repeat=true; echo $_smarty_tpl->smarty->registered_plugins['block']['tr'][0][0]->translate(array(), null, $_smarty_tpl, $_block_repeat);while ($_block_repeat) { ob_start();?>
Enter company name or email<?php $_block_content = ob_get_clean(); $_block_repeat=false; echo $_smarty_tpl->smarty->registered_plugins['block']['tr'][0][0]->translate(array(), $_block_content, $_smarty_tpl, $_block_repeat); } array_pop($_smarty_tpl->smarty->_tag_stack);?>
<?php }?>',
                <?php if ($_smarty_tpl->tpl_vars['allow_empty']->value) {?>
                    allowClear: true,
                <?php }?>
                ajax: {
                    url: window.SJB_AdminSiteUrl + '/manage-users/<?php echo mb_strtolower($_smarty_tpl->tpl_vars['user_group']->value['id'], 'UTF-8');?>
/',
                    dataType: 'json',
                    delay: 150,
                    data: function (params) {
                        return {
                            'username[user_like]': params.term, // search term
                            page: params.page,
                            action: 'search',
                            format: 'json',
                            minLength: 0,
                            itemsPerPage: 20,
                            page: 1
                        };
                    },
                    processResults: function (data, params) {
                        // parse the results into the format expected by Select2
                        // since we are using custom formatting functions we do not need to
                        // alter the remote JSON data, except to indicate that infinite
                        // scrolling can be used
                        params.page = params.page || 1;
                        for (var i = 0; i < data.length; i++) {
                            <?php if ($_smarty_tpl->tpl_vars['value_type']->value=='sid') {?>
                                data[i].id = data[i].sid;
                            <?php } else { ?>
                                data[i].id = data[i].username;
                            <?php }?>
                        }
                        return {
                            results: data,
                            pagination: {
                                more: false
                            }
                        };
                    },
                    cache: true
                },
                escapeMarkup: function (markup) { return markup; }, // let our custom formatter work
                templateResult: function(res) {
                    if (res.loading) {
                        return res.text;
                    }
                    var item = '';
                    if (res.CompanyName) {
                        item += res.CompanyName;
                    }
                    if (!item && res.FullName) {
                        item += res.FullName;
                    }
                    item += '<div class="select2__email">' + res.username + '</div>';
                    return item;
                },
                templateSelection: function(res) {
                    if (res.text) {
                        return res.text;
                    }
                    return res.CompanyName ? res.CompanyName : res.email;
                }
            });
        });
    </script>
<?php $_block_content = ob_get_clean(); $_block_repeat=false; echo $_smarty_tpl->smarty->registered_plugins['block']['javascript'][0][0]->_tpl_javascript(array(), $_block_content, $_smarty_tpl, $_block_repeat); } array_pop($_smarty_tpl->smarty->_tag_stack);?>

<?php }} ?>
