ResultManager/script/phases.js

126 lines
3.5 KiB
JavaScript
Raw Normal View History

2019-08-08 13:58:29 +00:00
/**
* /script/phases.js
* @version 1.0
* @desc phases 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 phasesLoadList(){
$("#list").slideUp(function(){
$.ajax({
url: "./subs/loader.php?load=phases&backend&list",
type: "GET",
success: function(response){
$("#list").html(response);
$(".table").footable();
$("#list").slideDown();
}
});
});
}
function phasesFilterApply(){
$("#list").slideUp(function(){
$.ajax({
url: "./subs/loader.php?load=phases&backend&list",
type: "POST",
data: $("#dd_filter_form").serialize(),
success: function(response){
$("#list").html(response);
$(".table").footable();
$("#list").slideDown();
}
});
});
}
function phasesFilterReset(){
$("#dd_filter_form")[0].reset();
phasesLoadList();
}
function phasesNew(){
$.ajax({
url: "./subs/loader.php?load=phases&backend",
type: "POST",
data: $("#dd_new_form").serialize(),
success: function(){
$("#dd_new_form")[0].reset();
loadMessages();
phasesLoadList();
}
});
}
function phasesEdit(id){
$.ajax({
url: "./subs/loader.php?load=phases&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 phasesSubmitEdit(){
$.ajax({
url: "./subs/loader.php?load=phases&backend",
type: "POST",
data: $("#dd_edit_form").serialize(),
success: function(){
$("#dd_edit").slideUp(function(){
$("#dd_edit_form")[0].reset();
});
loadMessages();
phasesLoadList();
}
});
}
function phasesCancelEdit(){
$("#dd_edit").slideUp(function(){
$("#dd_edit_form")[0].reset();
});
}
function phasesDelete(id, elem){
if(confirm($("#phasesDeleteConfirm").text())){
$.ajax({
url: "./subs/loader.php?load=phases&backend",
type: "POST",
data: {"delete": id},
success: function(){
loadMessages();
footableRemoveElem(elem);
}
});
}
}
/*
* RUN
*/
phasesLoadList();