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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
(function() {
var ids = Array();
$(document).ready(function() {
$("input[id^=check_all]").click(function() {
// Check or uncheck all requests
var checked = ($(this).attr('checked') == 'checked') ? true : false;
$("input[id^=multi]").each(function() {
$(this).attr('checked', checked);
var id = $(this).data('id');
if (checked && $.inArray(id, ids) == -1) {
ids.push(id);
} else if (!checked && $.inArray(id, ids) != -1) {
ids = $.grep(ids, function(value) {
return value != id;
});
}
});
});
$("input[id^=multi]").click(function() {
// Put the ID in the array if checked, or removed if unchecked
var checked = ($(this).attr('checked') == 'checked') ? true : false;
var id = $(this).data('id');
if (checked && $.inArray(id, ids) == -1) {
ids.push(id);
} else if (!checked && $.inArray(id, ids) != -1) {
ids = $.grep(ids, function(value) {
return value != id;
});
}
});
$("input[id^=outcome]").click(function() {
if ($(this).val() != 'Discard' && !confirm('Are you sure you wish to do this? This cannot be undone!')) {
return false;
}
var id = $(this).data('id');
if (id !== undefined) {
// Only resolving one row
resolveIDs = [id];
var comment = $("input[id^=comment" + id + "]").val();
} else {
resolveIDs = ids;
comment = '';
}
$.ajax({
type : "GET",
dataType : "json",
url : "tools.php?action=ajax_take_enable_request",
data : {
"ids" : resolveIDs,
"comment" : comment,
"status" : $(this).val(),
"type" : "resolve"
}
}).done(function(response) {
if (response['status'] == 'success') {
for (var i = 0; i < resolveIDs.length; i++) {
$("#row_" + resolveIDs[i]).remove();
}
} else {
alert(response['status']);
}
});
});
$("a[id^=unresolve]").click(function() {
var id = $(this).data('id');
if (id !== undefined) {
$.ajax({
type: "GET",
dataType: "json",
url: "tools.php?action=ajax_take_enable_request",
data : {
"id" : id,
"type" : "unresolve"
}
}).done(function(response) {
if (response['status'] == 'success') {
$("#row_" + id).remove();
alert("The request has been un-resolved. Please refresh your browser to see it.");
} else {
alert(response['status']);
}
});
}
});
});
})();
function ChangeDateSearch(rangeVariable, dateTwoID) {
var fullID = "#" + dateTwoID;
if (rangeVariable === 'between') {
$(fullID).show();
} else {
$(fullID).hide();
}
}
|