|
1
|
|
|
|
|
2
|
|
|
function show_loading() |
|
3
|
|
|
{ |
|
4
|
|
|
$('#org_openpsa_mypage_workingon_widget .org_openpsa_mypage_workingon').hide(); |
|
5
|
|
|
$('#org_openpsa_mypage_workingon_loading').show(); |
|
6
|
|
|
} |
|
7
|
|
|
|
|
8
|
|
|
function send_working_on(action) |
|
9
|
|
|
{ |
|
10
|
|
|
var description = $("#working_description").serialize(), |
|
11
|
|
|
task = $("#working_task_selection").val().replace(/[\[|"|\]]/g, ''), |
|
12
|
|
|
invoiceable = $('#working_invoiceable').is(':checked'), |
|
13
|
|
|
send_url = MIDCOM_PAGE_PREFIX + "workingon/set/"; |
|
14
|
|
|
|
|
15
|
|
|
$.ajax({ |
|
16
|
|
|
type: "POST", |
|
17
|
|
|
url: send_url, |
|
18
|
|
|
data: description + "&task=" + task + "&invoiceable=" + invoiceable + '&action=' + action, |
|
19
|
|
|
success: function(msg) |
|
20
|
|
|
{ |
|
21
|
|
|
$("#org_openpsa_mypage_workingon_widget").html(msg); |
|
22
|
|
|
}, |
|
23
|
|
|
error: function() { |
|
24
|
|
|
location.href = location.href; |
|
25
|
|
|
}, |
|
26
|
|
|
beforeSend: function() { |
|
27
|
|
|
show_loading(); |
|
28
|
|
|
} |
|
29
|
|
|
}); |
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
var org_openpsa_workingon = |
|
33
|
|
|
{ |
|
34
|
|
|
setup_widget: function() |
|
35
|
|
|
{ |
|
36
|
|
|
$('#org_openpsa_mypage_workingon_loading').hide(); |
|
37
|
|
|
$('#org_openpsa_mypage_workingon_start') |
|
38
|
|
|
.prop("disabled", true) |
|
39
|
|
|
.bind('click', function() |
|
40
|
|
|
{ |
|
41
|
|
|
send_working_on('start'); |
|
42
|
|
|
}); |
|
43
|
|
|
|
|
44
|
|
|
$('#org_openpsa_mypage_workingon_stop') |
|
45
|
|
|
.bind('click', function() |
|
46
|
|
|
{ |
|
47
|
|
|
send_working_on('stop'); |
|
48
|
|
|
}); |
|
49
|
|
|
|
|
50
|
|
|
if ($('#working_task_selection').val() === '') |
|
51
|
|
|
{ |
|
52
|
|
|
$('#org_openpsa_mypage_workingon_stop').hide(); |
|
53
|
|
|
} |
|
54
|
|
|
else |
|
55
|
|
|
{ |
|
56
|
|
|
$('#org_openpsa_mypage_workingon_start').hide(); |
|
57
|
|
|
} |
|
58
|
|
|
}, |
|
59
|
|
|
select: function(event, ui) |
|
60
|
|
|
{ |
|
61
|
|
|
midcom_helper_datamanager2_autocomplete.select(event, ui); |
|
62
|
|
|
if ($('#working_task_selection').val() !== '') |
|
63
|
|
|
{ |
|
64
|
|
|
$('#org_openpsa_mypage_workingon_start').prop("disabled", false); |
|
65
|
|
|
} |
|
66
|
|
|
else |
|
67
|
|
|
{ |
|
68
|
|
|
$('#org_openpsa_mypage_workingon_start').prop("disabled", true); |
|
69
|
|
|
} |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
} |
|
73
|
|
|
|