126 lines
3.5 KiB
JavaScript
126 lines
3.5 KiB
JavaScript
|
/**
|
||
|
* /script/subjects.js
|
||
|
* @version 1.3
|
||
|
* @desc Subjects javascript file
|
||
|
* @author Fándly Gergő Zoltán (fandlygergo@gmail.hu, systemtest.tk)
|
||
|
* @copy 2017 Fándly Gergő Zoltán
|
||
|
* License:
|
||
|
Result Manager for managing results of students in bilingual school systems.
|
||
|
Copyright (C) 2017 Fándly Gergő Zoltán
|
||
|
|
||
|
This program is free software: you can redistribute it and/or modify
|
||
|
it under the terms of the GNU General Public License as published by
|
||
|
the Free Software Foundation, either version 3 of the License, or
|
||
|
(at your option) any later version.
|
||
|
|
||
|
This program is distributed in the hope that it will be useful,
|
||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
GNU General Public License for more details.
|
||
|
|
||
|
You should have received a copy of the GNU General Public License
|
||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||
|
**/
|
||
|
|
||
|
function subjectsLoadList(){
|
||
|
$("#list").slideUp(function(){
|
||
|
$.ajax({
|
||
|
url: "./subs/loader.php?load=subjects&backend&list",
|
||
|
type: "GET",
|
||
|
success: function(response){
|
||
|
$("#list").html(response);
|
||
|
$(".table").footable();
|
||
|
$("#list").slideDown();
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
}
|
||
|
|
||
|
function subjectsFilterApply(){
|
||
|
$("#list").slideUp(function(){
|
||
|
$.ajax({
|
||
|
url: "./subs/loader.php?load=subjects&backend&list",
|
||
|
type: "POST",
|
||
|
data: $("#dd_filter_form").serialize(),
|
||
|
success: function(response){
|
||
|
$("#list").html(response);
|
||
|
$(".table").footable();
|
||
|
$("#list").slideDown();
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
}
|
||
|
|
||
|
function subjectsFilterReset(){
|
||
|
$("#dd_filter_form")[0].reset();
|
||
|
subjectsLoadList();
|
||
|
}
|
||
|
|
||
|
function subjectsNew(){
|
||
|
$.ajax({
|
||
|
url: "./subs/loader.php?load=subjects&backend",
|
||
|
type: "POST",
|
||
|
data: $("#dd_new_form").serialize(),
|
||
|
success: function(){
|
||
|
$("#dd_new_form")[0].reset();
|
||
|
loadMessages();
|
||
|
subjectsLoadList();
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
function subjectsEdit(id){
|
||
|
$.ajax({
|
||
|
url: "./subs/loader.php?load=subjects&backend&getdata="+id,
|
||
|
type: "GET",
|
||
|
success: function(response){
|
||
|
var data=JSON.parse(response);
|
||
|
$("#dd_edit_form input[name=edit]").val(data.id);
|
||
|
$("#dd_edit_form input[name=name_1]").val(data.name_1);
|
||
|
$("#dd_edit_form input[name=name_2]").val(data.name_2);
|
||
|
$("#dd_edit").slideDown();
|
||
|
smoothScroll("#dd_edit");
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
function subjectsSubmitEdit(){
|
||
|
$.ajax({
|
||
|
url: "./subs/loader.php?load=subjects&backend",
|
||
|
type: "POST",
|
||
|
data: $("#dd_edit_form").serialize(),
|
||
|
success: function(){
|
||
|
$("#dd_edit").slideUp(function(){
|
||
|
$("#dd_edit_form")[0].reset();
|
||
|
});
|
||
|
loadMessages();
|
||
|
subjectsLoadList();
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
function subjectsCancelEdit(){
|
||
|
$("#dd_edit").slideUp(function(){
|
||
|
$("#dd_edit_form")[0].reset();
|
||
|
});
|
||
|
}
|
||
|
|
||
|
function subjectsDelete(id, elem){
|
||
|
if(confirm($("#subjectsDeleteConfirm").text())){
|
||
|
$.ajax({
|
||
|
url: "./subs/loader.php?load=subjects&backend",
|
||
|
type: "POST",
|
||
|
data: {"delete": id},
|
||
|
success: function(){
|
||
|
loadMessages();
|
||
|
footableRemoveElem(elem);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
* RUN
|
||
|
*/
|
||
|
subjectsLoadList();
|