// Wywołuje skrypt zapisujący rezerwację dokonaną przez pacjenta oraz po 500ms wyświetla ponownie wolne terminy
function bookingdetails(appID, appDate, doctor) {
webix.$$("webix_freeapps").showProgress({
type:"icon",
icon:"spinner"
});
webix.ajax().timeout(5000).get("../wp-content/plugins/wp-sc2/Ajax/AddApp.php?appID=" + appID + "×tamp=" + new Date().getTime(), function(text, data, XmlHttpRequest){
document.getElementById("ScheduleInfo").innerHTML = text;
webix.$$("webix_freeapps").hideProgress();
showfreeapp(appDate, doctor);
}).fail(function (xhr) {
showConnFailMessage();
webix.$$("webix_freeapps").hideProgress();
});
}
function showfreeapp(appDate, doctor) {
webix.$$("webix_freeapps").showProgress({
type:"icon",
icon:"spinner"
});
webix.ajax().timeout(5000).get("../wp-content/plugins/wp-sc2/Ajax/ShowFreeApp.php?appDate=" + appDate + "&doctor=" + doctor + "×tamp=" + new Date().getTime(), function(text, data, XmlHttpRequest){
document.getElementById("FreeApps").innerHTML = text;
webix.$$("webix_freeapps").hideProgress();
}).fail(function (xhr) {
showConnFailMessage();
webix.$$("webix_freeapps").hideProgress();
});
}
function shownextfreeapp(appDate) {
webix.ajax("../wp-content/plugins/wp-sc2/Ajax/ShowNextFreeApp.php?q=" + appDate + "×tamp=" + new Date().getTime(), function(text, data, XmlHttpRequest){
document.getElementById("MiniSchedule").innerHTML = text;
});
}
function showUserApp() {
webix.$$("webix_schedule").adjust();
webix.$$("webix_schedule").showProgress({
type:"icon",
icon:"spinner"
});
webix.ajax().timeout(5000).get("../wp-content/plugins/wp-sc2/Ajax/ShowUserApp.php?timestamp=" + new Date().getTime(), function(text, data, XmlHttpRequest){
document.getElementById("Schedule").innerHTML = text;
webix.$$("webix_schedule").adjust();
webix.$$("webix_schedule").hideProgress();
//var scheduleView = document.getElementById("mod_sc_schedule_main_view");
//scheduleView.scrollIntoView(true);
}).fail(function (xhr) {
webix.$$("webix_schedule").adjust();
webix.$$("webix_schedule").hideProgress();
showConnFailMessage();
});
}
// Wywołuje skrypt wyświetlający formularz szczegółów dla zarezerwowanej wizyty
function showdetails(appID) {
document.getElementById("AppsDetails").innerHTML = '
';
webix.ajax("../wp-content/plugins/wp-sc2/Ajax/ShowAppDet.php?appID=" + appID + "×tamp=" + new Date().getTime(), function(text, data, XmlHttpRequest){
document.getElementById("AppsDetails").innerHTML = text;
});
}
// Wywołuje skrypt dodający szczegóły do już zapisanej rezerwacji
function booking(appID) {
var reason = document.getElementById('przyczynarezerwacji').value;
var info = document.getElementById('opisrezerwacji').value;
document.getElementById("AppsDetails").innerHTML = "";
webix.ajax("../wp-content/plugins/wp-sc2/Ajax/SaveAppDet.php?appID=" + appID + "&appReason=" + reason + "&appInfo=" + info + "×tamp=" + new Date().getTime(), function(text, data, XmlHttpRequest){
document.getElementById("AppsDetails").innerHTML = text;
//webix.delay(showUserApp(), this, 2000);
showUserApp();
});
}
function updateUserData() {
webix.$$("webix_schedule").adjust();
webix.$$("webix_schedule").showProgress({
type:"icon",
icon:"spinner"
});
var firstname = document.getElementById('sc_firstname').value;
var surname = document.getElementById('sc_surname').value;
var secondname = document.getElementById('sc_secondname').value;
var phone = document.getElementById('sc_phone').value;
/*
webix.ajax("../wp-content/plugins/wp-sc2/Ajax/ChangeUserData.php?firstname=" + firstname + "&surname=" + surname + "&secondname=" + secondname + "&sex=" + sex + "&address=" + address + "&city=" + city + "&postcode=" + postcode + "®ion=" + region + "&pesel=" + pesel + "&phone=" + phone + "×tamp=" + new Date().getTime(), function(text, data, XmlHttpRequest){
document.getElementById("Schedule").innerHTML = text;
});
*/
webix.ajax().timeout(5000).get("../wp-content/plugins/wp-sc2/Ajax/ChangeUserData.php?firstname=" + firstname + "&surname=" + surname + "&secondname=" + secondname + "&phone=" + phone + "×tamp=" + new Date().getTime(), function(text, data, XmlHttpRequest){
document.getElementById("Schedule").innerHTML = text;
webix.$$("webix_schedule").adjust();
webix.$$("webix_schedule").hideProgress();
showWorkers();
}).fail(function (xhr) {
webix.$$("webix_schedule").adjust();
webix.$$("webix_schedule").hideProgress();
showConnFailMessage();
});
}
function validLogin() {
webix.$$("webix_login").adjust();
webix.$$("webix_login").showProgress({
type:"icon",
icon:"spinner"
});
var sc_login_email = document.getElementById("sc_login_email").value;
var sc_login_password = document.getElementById("sc_login_password").value;
var dataString = 'email=' + sc_login_email + '&password=' + sc_login_password;
webix.ajax().timeout(5000).post("../wp-content/plugins/wp-sc2/Ajax/UserLogin.php", dataString + "×tamp=" + new Date().getTime(), function(text, data, XmlHttpRequest){
document.getElementById("UserLogin").innerHTML = text;
webix.$$("webix_login").adjust();
webix.$$("webix_login").hideProgress();
showWorkers();
}).fail(function (xhr) {
webix.$$("webix_login").adjust();
webix.$$("webix_login").hideProgress();
showConnFailMessage();
});
}
function validLogOut() {
webix.$$("webix_login").adjust();
webix.$$("webix_login").showProgress({
type:"icon",
icon:"spinner"
});
webix.ajax().timeout(5000).get("../wp-content/plugins/wp-sc2/Ajax/UserLogOut.php?timestamp=" + new Date().getTime(), function(text, data, XmlHttpRequest){
document.getElementById("UserLogin").innerHTML = text;
//webix.delay(showWorkers(), this, 2000);
webix.$$("webix_login").adjust();
webix.$$("webix_login").hideProgress();
showWorkers();
}).fail(function (xhr) {
webix.$$("webix_login").adjust();
webix.$$("webix_login").hideProgress();
showConnFailMessage();
});
}
function showUserLoginForm() {
webix.$$("webix_login").adjust();
webix.$$("webix_login").showProgress({
type:"icon",
icon:"spinner"
});
webix.ajax().timeout(5000).get("../wp-content/plugins/wp-sc2/Ajax/UserLoginForm.php?timestamp=" + new Date().getTime(), function(text, data, XmlHttpRequest){
document.getElementById("UserLogin").innerHTML = text;
webix.$$("webix_login").adjust();
webix.$$("webix_login").hideProgress();
}).fail(function (xhr) {
webix.$$("webix_login").adjust();
webix.$$("webix_login").hideProgress();
showConnFailMessage();
});
}
function showRegisterForm() {
webix.$$("webix_schedule").adjust();
webix.$$("webix_schedule").showProgress({
type:"icon",
icon:"spinner"
});
webix.ajax().timeout(5000).get("../wp-content/plugins/wp-sc2/Ajax/ShowRegisterForm.php?timestamp=" + new Date().getTime(), function(text, data, XmlHttpRequest){
document.getElementById("Schedule").innerHTML = text;
webix.$$("webix_schedule").adjust();
webix.$$("webix_schedule").hideProgress();
}).fail(function (xhr) {
webix.$$("webix_schedule").adjust();
webix.$$("webix_schedule").hideProgress();
showConnFailMessage();
});
}
function changePasswordForm() {
webix.$$("webix_schedule").adjust();
webix.$$("webix_schedule").showProgress({
type:"icon",
icon:"spinner"
});
webix.ajax().timeout(5000).get("../wp-content/plugins/wp-sc2/Ajax/ChangePasswordShow.php?timestamp=" + new Date().getTime(), function(text, data, XmlHttpRequest){
document.getElementById("Schedule").innerHTML = text;
webix.$$("webix_schedule").adjust();
webix.$$("webix_schedule").hideProgress();
}).fail(function (xhr) {
webix.$$("webix_schedule").adjust();
webix.$$("webix_schedule").hideProgress();
showConnFailMessage();
});
}
function changeUserPassword() {
webix.$$("webix_schedule").adjust();
webix.$$("webix_schedule").showProgress({
type:"icon",
icon:"spinner"
});
var nowe_haslo = document.getElementById("nowe_haslo").value;
var nowe_haslo2 = document.getElementById("nowe_haslo2").value;
var dataString = "nowe_haslo=" + nowe_haslo + "&nowe_haslo2=" + nowe_haslo2;
webix.ajax().timeout(5000).get("../wp-content/plugins/wp-sc2/Ajax/ChangePassword.php?" + dataString + "×tamp=" + new Date().getTime(), function(text, data, XmlHttpRequest){
document.getElementById("Schedule").innerHTML = text;
webix.$$("webix_schedule").adjust();
webix.$$("webix_schedule").hideProgress();
}).fail(function (xhr) {
webix.$$("webix_schedule").adjust();
webix.$$("webix_schedule").hideProgress();
showConnFailMessage();
});
}
function unbooking(id) {
webix.$$("webix_schedule").showProgress({
type:"icon",
icon:"spinner"
});
webix.ajax().timeout(5000).get("../wp-content/plugins/wp-sc2/Ajax/UnBookApp.php?appID=" + id + "×tamp=" + new Date().getTime(), function(text, data, XmlHttpRequest){
document.getElementById("ScheduleInfo").innerHTML = text;
webix.$$("webix_schedule").hideProgress();
showUserApp();
}).fail(function (xhr) {
webix.$$("webix_schedule").hideProgress();
showConnFailMessage();
});
}
// Wywołuje skrypt wyświetlający terminy pacjenta
function registerUser() {
var sc_register_email = document.getElementById('sc_register_email').value;
var haslo = document.getElementById('haslo').value;
var haslo2 = document.getElementById('haslo2').value;
var firstname = document.getElementById('firstname').value;
var secondname = document.getElementById('secondname').value;
var surname = document.getElementById('surname').value;
/*
var sex = document.getElementById('sex').value;
var ulica = document.getElementById('ulica').value;
var miasto = document.getElementById('miasto').value;
var kod = document.getElementById('kod').value;
var woj = document.getElementById('woj').value;
var pesel = document.getElementById('pesel').value;
*/
var telkontaktowy = document.getElementById('telkontaktowy').value;
//var dataString = "email=" + email + "&haslo=" + haslo + "&haslo2=" + haslo2 + "&firstname=" + firstname + "&secondname=" + secondname + "&surname=" + surname +
// "&sex=" + sex + "&ulica=" + ulica + "&miasto=" + miasto + "&kod=" + kod + "&woj=" + woj + "&pesel=" + pesel + "&telkontaktowy=" + telkontaktowy;
var dataString = "email=" + sc_register_email + "&haslo=" + haslo + "&haslo2=" + haslo2 + "&firstname=" + firstname + "&secondname=" + secondname + "&surname=" + surname + "&telkontaktowy=" + telkontaktowy;
webix.$$("webix_schedule").adjust();
webix.$$("webix_schedule").showProgress({
type:"icon",
icon:"spinner"
});
webix.ajax().timeout(5000).get("../wp-content/plugins/wp-sc2/Ajax/RegisterUser.php?" + dataString + "×tamp=" + new Date().getTime(), function(text, data, XmlHttpRequest){
document.getElementById("Schedule").innerHTML = text;
webix.$$("webix_schedule").adjust();
webix.$$("webix_schedule").hideProgress();
//webix.delay(showWorkers(), this, 2000);
//window.setTimeout(showWorkers(), 2000);
}).fail(function (xhr) {
webix.$$("webix_schedule").adjust();
webix.$$("webix_schedule").hideProgress();
showConnFailMessage();
});
}
function showCalendar(workerID) {
webix.$$("webix_schedule").adjust();
webix.$$("webix_schedule").showProgress({
type:"icon",
icon:"spinner"
});
webix.ajax().timeout(5000).get("../wp-content/plugins/wp-sc2/Ajax/ShowCalendar.php?workerID=" + workerID + "×tamp=" + new Date().getTime(), function(text, data, XmlHttpRequest){
document.getElementById("Schedule").innerHTML=text;
webix.$$("webix_schedule").adjust();
webix.$$("webix_schedule").hideProgress();
var runscriptRef = document.getElementById("runscript");
if(runscriptRef != null) {
eval(runscriptRef.innerHTML);
}
}).fail(function (xhr) {
webix.$$("webix_schedule").adjust();
webix.$$("webix_schedule").hideProgress();
showConnFailMessage();
});
}
function showWorkers() {
webix.$$("webix_schedule").adjust();
webix.$$("webix_schedule").showProgress({
type:"icon",
icon:"spinner"
});
webix.ajax().timeout(5000).get("../wp-content/plugins/wp-sc2/Ajax/ChooseWorker.php?timestamp=" + new Date().getTime(), function(text, data, XmlHttpRequest){
document.getElementById("Schedule").innerHTML = text;
webix.$$("webix_schedule").adjust();
webix.$$("webix_schedule").hideProgress();
}).fail(function (xhr) {
webix.$$("webix_schedule").adjust();
webix.$$("webix_schedule").hideProgress();
showConnFailMessage();
});
}
function showUserData() {
webix.$$("webix_schedule").adjust();
webix.$$("webix_schedule").showProgress({
type:"icon",
icon:"spinner"
});
webix.ajax().timeout(5000).get("../wp-content/plugins/wp-sc2/Ajax/ShowUserData.php?timestamp=" + new Date().getTime(), function(text, data, XmlHttpRequest){
document.getElementById("Schedule").innerHTML = text;
webix.$$("webix_schedule").adjust();
webix.$$("webix_schedule").hideProgress();
}).fail(function (xhr) {
webix.$$("webix_schedule").adjust();
webix.$$("webix_schedule").hideProgress();
showConnFailMessage();
});
}
function showRemindPassword() {
webix.$$("webix_schedule").adjust();
webix.$$("webix_schedule").showProgress({
type:"icon",
icon:"spinner"
});
webix.ajax().timeout(5000).get("../wp-content/plugins/wp-sc2/Ajax/ShowRemindPassword.php?timestamp=" + new Date().getTime(), function(text, data, XmlHttpRequest){
document.getElementById("Schedule").innerHTML = text;
webix.$$("webix_schedule").adjust();
webix.$$("webix_schedule").hideProgress();
}).fail(function (xhr) {
webix.$$("webix_schedule").adjust();
webix.$$("webix_schedule").hideProgress();
showConnFailMessage();
});
}
function remindPassword() {
webix.$$("webix_schedule").adjust();
webix.$$("webix_schedule").showProgress({
type:"icon",
icon:"spinner"
});
var sc_remind_email = document.getElementById('sc_remind_email').value;
webix.ajax().timeout(5000).get("../wp-content/plugins/wp-sc2/Ajax/RemindPassword.php?email=" + sc_remind_email + "×tamp=" + new Date().getTime(), function(text, data, XmlHttpRequest){
document.getElementById("Schedule").innerHTML = text;
webix.$$("webix_schedule").adjust();
webix.$$("webix_schedule").hideProgress();
}).fail(function (xhr) {
webix.$$("webix_schedule").adjust();
webix.$$("webix_schedule").hideProgress();
showConnFailMessage();
});
}
function trim(str) {
var str=str.replace(/^\s+|\s+$/,'');
return str;
}
function showConnFailMessage() {
webix.message({type: 'error', text: 'Błąd!
Błąd połączenia, spróbuj ponownie.', expire:5000});
}
function limitText(limitField, limitNum) {
if (limitField.value.length > limitNum) {
limitField.value = limitField.value.substring(0, limitNum);
}
}