Skip to content
Snippets Groups Projects
Commit 99cabf89 authored by Антон Шалимов's avatar Антон Шалимов
Browse files

add confirm delete discipline + fix

parent 8cd17b3f
Branches
Tags
No related merge requests found
......@@ -15,7 +15,7 @@
<div class="Name">{{ Teacher.LastName }} {{ Teacher.FirstName }} {{ Teacher.SecondName }}</div>
{% if Teacher.isAuthor == 0 %}
<button class="Action_UnbindTeacher Action">Отсоединить</button>
<button class="Action_ChangeOwner Action">Передать дисциплину</button>
<button class="Action_ChangeOwner Action" style="display: none">Передать дисциплину</button>
{% else %}
<div class="Action">Автор дисциплины</div>
{% endif %}
......
......@@ -87,7 +87,7 @@
{% block main_content %}
<div class="disciplines_wrapper">
<div class="TransferDisList">
<div class="TransferDisList" style="display: none">
<div class="TransferDisItem">
<p>Пользователь Кирютенко Юрий Александрович желает передать Вам дисциплину.</p>
<p>Предмет: Математический анализ; Группа(ы): 1.6, 1.7</p>
......
$(function() {
// Удаление дисциплины
$(".DeleteDiscipline").click(function()
{
var thisObj = $(this);
$(this).attr("disabled", true);
$.post(
URLdir + 'handler/map/DeleteDiscipline',
{
'DisciplineID': parseInt($(this).attr('id'))
},
function(data)
{
data = $.parseJSON(data);
if(data.success === true) {
EventInspector_ShowMsg('Дисциплина удалена', 'success');
} else {
thisObj.removeAttr('disabled');
EventInspector_ShowMsg('Ошибка при удалении дисциплины', 'error');
$(".DeleteDiscipline").click(function() {
if (confirm('Вы действительно хотите удалить дисциплину?')) {
var thisObj = $(this);
$(this).attr("disabled", true);
$.post(
URLdir + 'handler/map/DeleteDiscipline',
{
'DisciplineID': parseInt($(this).attr('id'))
},
function(data)
{
data = $.parseJSON(data);
if(data.success === true) {
EventInspector_ShowMsg('Дисциплина удалена', 'success');
} else {
thisObj.removeAttr('disabled');
EventInspector_ShowMsg('Ошибка при удалении дисциплины', 'error');
}
var count = thisObj.parent().parent().parent().find('.group_block').size();
if (count < 2)
thisObj.closest('.discipline_groups').remove();
else
thisObj.parent().parent().remove();
}
var count = thisObj.parent().parent().parent().find('.group_block').size();
if (count < 2)
thisObj.closest('.discipline_groups').remove();
else
thisObj.parent().parent().remove();
}
);
});
);
}
});
})
\ No newline at end of file
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