-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreports.js
47 lines (42 loc) · 1.06 KB
/
reports.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
$(function() {
$( "#from" ).datepicker();
$( "#to" ).datepicker();
$(document).on("keyup", ".volunteer-name", function() {
var str = $(this).val();
var target = $(this);
$.ajax({
type: 'get',
url: 'reportsAjax.php?q='+str,
success: function (response) {
var suggestions = $.parseJSON(response);
console.log(target);
target.autocomplete({
source: suggestions
});
}
});
});
$("input[name='date']").change(function() {
if ($("input[name='date']:checked").val() == 'date-range') {
$("#fromto").show();
} else {
$("#fromto").hide();
}
});
$("#report-submit").on('click', function (e) {
e.preventDefault();
$.ajax({
type: 'post',
url: 'reportsAjax.php',
data: $('#search-fields').serialize(),
success: function (response) {
$("#outputs").html(response);
}
});
} );
$("#add-more").on('click', function(e) {
e.preventDefault();
var new_input = '<div class="ui-widget"> <input type="text" name="volunteer-names[]" class="volunteer-name"></div>';
$("#volunteer-name-inputs").append(new_input);
})
});