Skip to content
Snippets Groups Projects
Commit 4640893c authored by PavelBegunkov's avatar PavelBegunkov
Browse files

...

parent c09c195f
Branches
Tags
No related merge requests found
...@@ -10,19 +10,22 @@ function BindGroup(id, StudyGroupName){ ...@@ -10,19 +10,22 @@ function BindGroup(id, StudyGroupName){
} }
// Прикрепить группу // Прикрепить группу
$('.AttachGroupButton').click(function(){ $('.AttachGroupButton').click(function()
var StudyGroupID = $('.SelectStudyGroup').val(); {
var StudyGroupName = $(".SelectStudyGroup option:selected").text(); var jSelector = $(this).prev();
var StudyGroupID = jSelector.val();
var StudyGroupName = jSelector.children("option:selected").first().text();
$.post( $.post(
URLdir + 'handler/map/BindGroup', URLdir + 'handler/map/BindGroup',
{ {
'StudyGroupID': StudyGroupID, 'StudyGroupID': StudyGroupID,
'DisciplineID': DisciplineID 'DisciplineID': DisciplineID
}, },
function(data){ function(data)
{
data = $.parseJSON(data); data = $.parseJSON(data);
if(data.success === true) { if(data.success === true) {
$('.AttachedGroupsList').append(BindGroup(StudyGroupID, StudyGroupName)); jSelector.parent().next().append(BindGroup(StudyGroupID, StudyGroupName));
EventInspector_ShowMsg('Группа добавлена', 'success'); EventInspector_ShowMsg('Группа добавлена', 'success');
} }
else EventInspector_ShowMsg('Ошибка при добавление группы', 'error'); else EventInspector_ShowMsg('Ошибка при добавление группы', 'error');
...@@ -31,16 +34,18 @@ $('.AttachGroupButton').click(function(){ ...@@ -31,16 +34,18 @@ $('.AttachGroupButton').click(function(){
}); });
// Отсоединить группу // Отсоединить группу
$('.AttachedGroupsList').on('click', '.UnbindGroup', function(){ $('.AttachedGroupsList').on('click', '.UnbindGroup', function()
var StudyGroupID = $(this).parent().attr('id'); {
var GroupDIV = $(this).parent(); var GroupDIV = $(this).parent();
var StudyGroupID = GroupDIV.attr('id');
$.post( $.post(
URLdir + 'handler/map/UnbindGroup', URLdir + 'handler/map/UnbindGroup',
{ {
'StudyGroupID': StudyGroupID, 'StudyGroupID': StudyGroupID,
'DisciplineID': DisciplineID 'DisciplineID': DisciplineID
}, },
function(data){ function(data)
{
data = $.parseJSON(data); data = $.parseJSON(data);
if(data.success === true) { if(data.success === true) {
GroupDIV.remove(); GroupDIV.remove();
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment