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
|
const Statusgroups = {
ajax_endpoint: false,
apply: function() {
$('.movable tbody').sortable({
axis: 'y',
handle: '.drag-handle',
helper: function(event, ui) {
ui.children().each(function() {
$(this).width($(this).width());
});
return ui;
},
start: function(event, ui) {
$(this)
.closest('table')
.addClass('nohover');
},
stop: function(event, ui) {
var table = $(this).closest('table'),
group = table.attr('id'),
user = ui.item.data('userid'),
position = $(ui.item).prevAll().length;
table.removeClass('nohover');
$.ajax({
type: 'POST',
url: Statusgroups.ajax_endpoint,
dataType: 'html',
data: { group: group, user: user, pos: position },
async: false
}).done(function(data) {
$('tbody', table).html(data);
Statusgroups.apply();
});
}
});
},
initInputs: function() {
$('input[name="numbering_type"]').on('click', function() {
var type = $('input[name="numbering_type"]:checked').val(),
disabled = parseInt(type, 10) === 2;
$('input[name="startnumber"]')
.prop('disabled', disabled)
.toggle(!disabled);
});
}
};
export default Statusgroups;
|