[Secondary Groups] Change secondary groups from selected to non selected in agent edit view

This commit is contained in:
fermin831 2018-03-21 18:32:14 +01:00
parent efe420edfb
commit 26da63610a
1 changed files with 21 additions and 2 deletions

View File

@ -625,12 +625,31 @@ ui_require_jquery_file('bgiframe');
function agent_manager_add_secondary_groups (event) {
event.preventDefault();
// TODO
var primary_value = $("#grupo").val()
// The selected primary value cannot be selected like secondary
if ($("#secondary_groups option:selected[value=" + primary_value + "]").length > 0) {
alert("<?php echo __("Primary group cannot be secondary too.");?>")
return
}
// Move from one input to the other
$("#secondary_groups_selected option[value=0]").remove()
$("#secondary_groups option:selected").each(function(){
$(this).remove().appendTo("#secondary_groups_selected")
})
}
function agent_manager_remove_secondary_groups (event) {
event.preventDefault();
// TODO
$("#secondary_groups_selected option:selected").each(function(){
$(this).remove().appendTo("#secondary_groups")
})
if ($("#secondary_groups_selected option").length == 0) {
$("#secondary_groups_selected").append($('<option>',{
value: 0,
text: "<?php echo __("None");?>"
}))
}
}
$(document).ready (function() {