callback.js
1.76 KB
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
$(document).ready(function()
{
$('[data-toggle="popover"]').popover();
$('body').on('click', function (e)
{
$('[data-toggle="popover"]').each(function ()
{
//the 'is' for buttons that trigger popups
//the 'has' for icons within a button that triggers a popup
if (!$(this).is(e.target) && $(this).has(e.target).length === 0 && $('.popover').has(e.target).length === 0) {
$(this).popover('hide');
}
});
});
$('#callback .btn.read').on('click', function (e)
{
var $obj = $(this).closest('tr');
callbackAction ({
'json': {
'jaction': 'getOne',
'callback_id': $obj.attr('callback_id'),
}
}).done(function ($result)
{
modalBoxLoad($result.text);
});
});
$(document).on('click', '#callback .status .dropdown-menu li a', function(e)
{
e.preventDefault();
var $obj = $(this).closest('tr');
var $callback_status_id = $(this).attr('value');
callbackAction ({
'json': {
'jaction': 'setStatus',
'callback_id': $obj.attr('callback_id'),
'callback_status_id': $callback_status_id,
}
}).done(function ($result)
{
// done
// $obj.addClass('done');
if ($result.code == 0)
{
$obj.find('.manager').html($result.manager);
$obj.find('.date_edit').html($result.date_edit);
$obj.find('.status').html($result.button);
}
else if ($result.code == 1)
{
modalBoxLoad($result.html);
}
});
});
});