[add] Bloodhoung search
This commit is contained in:
parent
e9effb7fcc
commit
49e114c18a
@ -1,13 +1,22 @@
|
|||||||
<script src="../js/editEmployee.js"></script>
|
|
||||||
<script src="../js/getBaseUrl.js"></script>
|
<script src="../js/getBaseUrl.js"></script>
|
||||||
|
<script src="../js/editEmployee.js"></script>
|
||||||
|
|
||||||
<form class="form-horizontal" id="editEmployee">
|
<form class="form-horizontal" id="editEmployee">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
<h3 class="panel-title">New employee</h3>
|
<h3 class="panel-title">Edit employee</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
|
<div class="row">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-md-4 control-label" for="editEmploySearch">Employee</label>
|
||||||
|
<div class="col-md-5">
|
||||||
|
<input id="editEmploySearch" name="editEmploySearch" type="text" class="form-control input-md">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
@ -226,6 +226,7 @@ if(!isset($_SESSION['userName'])){
|
|||||||
<script src="../js/getBaseUrl.js"></script>
|
<script src="../js/getBaseUrl.js"></script>
|
||||||
<script src="../js/landing.js"></script>
|
<script src="../js/landing.js"></script>
|
||||||
<script src="../js/bootstrap-datepicker.min.js"></script>
|
<script src="../js/bootstrap-datepicker.min.js"></script>
|
||||||
|
<script src="https://twitter.github.io/typeahead.js/releases/latest/typeahead.bundle.js"></script>
|
||||||
|
|
||||||
<link href="../css/bootstrap-datepicker.min.css" rel="stylesheet">
|
<link href="../css/bootstrap-datepicker.min.css" rel="stylesheet">
|
||||||
<link href="../css/landing.css" rel="stylesheet">
|
<link href="../css/landing.css" rel="stylesheet">
|
||||||
|
@ -0,0 +1,42 @@
|
|||||||
|
/**
|
||||||
|
* Bootstrapping the starting actions for the module
|
||||||
|
*/
|
||||||
|
$(document).ready(function(){
|
||||||
|
let baseUrl = getbaseUrl();
|
||||||
|
|
||||||
|
let productos = new Bloodhound({
|
||||||
|
datumTokenizer: Bloodhound.tokenizers.obj.whitespace("name"),
|
||||||
|
queryTokenizer: Bloodhound.tokenizers.whitespace,
|
||||||
|
remote: {
|
||||||
|
'cache': false,
|
||||||
|
url: baseUrl + '/api/employee/find',
|
||||||
|
|
||||||
|
replace: function(url, uriEncodedQuery) {
|
||||||
|
|
||||||
|
return url + '/' + uriEncodedQuery
|
||||||
|
|
||||||
|
},
|
||||||
|
wildcard: '%QUERY',
|
||||||
|
filter: function (data) {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Initialize the Bloodhound suggestion engine
|
||||||
|
productos.initialize();
|
||||||
|
|
||||||
|
$("#editEmploySearch").typeahead({
|
||||||
|
hint: true,
|
||||||
|
highlight: true,
|
||||||
|
minLength: 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "result",
|
||||||
|
displayKey: "fullName",
|
||||||
|
source: productos.ttAdapter()
|
||||||
|
}).bind("typeahead:selected", function(obj, datum, name) {
|
||||||
|
$(this).data("id", datum.code);
|
||||||
|
console.log(datum.code);
|
||||||
|
});
|
||||||
|
});
|
@ -536,7 +536,7 @@ class EmployeeApplication{
|
|||||||
/**
|
/**
|
||||||
* Takes an array of all active employees and filters them by a string, returning
|
* Takes an array of all active employees and filters them by a string, returning
|
||||||
* all sub arrays that contain such string
|
* all sub arrays that contain such string
|
||||||
*
|
*
|
||||||
* @param $partialName string
|
* @param $partialName string
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user