This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
lnapp/views/field/account.php

36 lines
1.1 KiB
PHP
Raw Normal View History

<!-- field = field name -->
<!-- text = field text -->
<!-- value = array of values -->
<!-- name = account name -->
<!-- ajaxurl = ajax URL -->
<div class="form-group">
<label for="<?php echo $data['field']; ?>_label" class="col-md-2 control-label"><?php echo $data['text']; ?></label>
<div class="input-group col-md-4">
<input type="text" id="<?php echo $data['field']; ?>_label" value="<?php echo $data['name']; ?>" class="form-control" autocomplete="off" placeholder="<?php echo $data['text']; ?>">
<span class="input-group-addon"><i class="fa fa-refresh" name="account_lookup"></i></span>
</div>
<input type="hidden" name="<?php echo $data['field']; ?>" value="<?php echo $data['value']; ?>">
</div>
<?php
Script::factory()
->type('stdin')
->data('
$(document).ready(function() {
$("input[id=account_id_label]").typeahead({
minLength: 2,
source: function (query,process) {
search("'.$data['ajaxurl'].'",query,process,"account_lookup");
},
matcher: function () { return true; },
updater: function (item) {
$("input[name=account_id]").val(users[item]).trigger("change");
return item;
},
});
});');
?>