ResultManager/script/wizard.js

87 lines
3.0 KiB
JavaScript
Raw Normal View History

2019-08-08 13:58:29 +00:00
/**
* /script/wizard.js
* @version 1.0
* @desc javascript for the input wizard
* @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 wizardNextStep(elem){
$(elem).parent("div").slideUp();
$(elem).parent("div").parent("div").next().next().children("div").eq(1).slideDown(function(){
smoothScroll($(elem).parent("div").parent("div").next().next());
});
}
function wizardPrevStep(elem){
$(elem).parent("div").slideUp();
$(elem).parent("div").parent("div").prev().prev().children("div").eq(1).slideDown(function(){
smoothScroll($(elem).parent("div").parent("div").prev().prev());
});
}
function wizardSelectMeAsTeacher(){
$("#wizform input[name=teacher][value="+$("#wizardCurrentId").text()+"]").attr("checked", true);
}
function wizardLoadPrevRecords(elem){
$.ajax({
url: "./subs/loader.php?load=register&backend",
type: "POST",
data: $("#wizform").serialize(),
success: function(response){
var data=JSON.parse(response);
$("input[name=recordParams]").val(JSON.stringify(data.params));
$("#wizardPrevContent tbody").html(data.prev);
$("#wizardPrevContent").footable();
$(elem).parent("div").slideUp();
$("#step7_content").slideDown(function(){
smoothScroll("#step7_content");
});
}
});
}
function wizardSubmitRecord(){
$.ajax({
url: "./subs/loader.php?load=register&backend",
type: "POST",
data: {"newSubmit": $("input[name=recordParams]").val()},
success: function(){
loadMessages();
$(".dropdown.content").slideUp(function(){
$("#wizform")[0].reset();
$("#step1_content").slideDown(function(){
smoothScroll("#step1");
});
});
}
});
}
/*
* RUN
*/
//load register scriptbase
$.getScript("./script/js.php?load=register");
//handler for custom place
$("#wizform input[name=place]").click(function(){
toggleRequiredFormElement("#registerCustomPlaceNew", $("#wizform input[name=place][value=0]").is(":checked"));
});