var firstrkcop = true; function fs_initrkcop(id, data, showWaitinglist){ firstrkcop = false; var html="", specs="", recipeOnly = false var buttonText="Rezept oder Überweisung anfragen"; if(recipeOnly) { buttonText="Rezept anfragen"; } for (var i = 0; i < data.specs.length; i++) { if(i!==0){ specs+=", "; } specs+=data.specs[i]; } var color= "00b6e8"; var width= "100%"; var height= ""; if(height==""){ height="100%"; } if(width!="100%"){ width+="px"; } if(height!="50%"){ height+="px"; } html+=''; html+="TerMed.de Logo"; html+="

"+specs+"
"+data.title+" "+data.name+" "+data.surname+"

"; if(data.request_mode){ html+="" + buttonText + ""; } if(!showWaitinglist) { if (!recipeOnly) { html += "

Terminbuchung für Ihre kosmetische Beratung und Behandlung

"; html += "

Sichern Sie sich den nächsten freien Termin in unserer Praxis. Zur Anmeldung bitte die gewünschte Art von Termin anklicken.

Nach Anklicken des Termins werden Sie zu unserem Terminportal Termed weitergeleitet af"; if(data.reasonMode){ html += buildReasons(data.reasons, data.reasonQuestion, data.reasonAction); } html+="
"; } document.getElementById(id).innerHTML = html; if (typeof customizeFSWidget === "function") { customizeFSWidget('rkcop'); } if(data.reasonMode){ var select= document.querySelectorAll("#"+id+" .rselect")[0]; select.onchange = function(e){ if(select.value){ fs_loadAPSrkcop("rkcop", select.value); } }; } }else { html += "
"; document.getElementById(id).innerHTML = html; var htmlAdd = "

Momentan sind keine freien Termine verfügbar.

"; htmlAdd += "

Sie können sich jedoch in die Warteliste eintragen. Somit werden Sie benachrichtigt, sobald wieder Termine zur Verfügung stehen.

"; htmlAdd += "In Warteliste eintragen" document.getElementById("content").innerHTML = htmlAdd; } } function buildReasons(reasons, question, action) { var html = "

"+question+"

"; html+=""; return html; } function buildEventsrkcop(id, events) { var html = ""; var len = events.length, lastDate=""; if(len===0){ html += "

Derzeit sind online keine freien Termine auf TerMed.de verfügbar.

"; } for (var t = 0; t < len; t++) { var ap = events[t]; if(lastDate===""){ lastDate=ap.date; html+="

"+ap.date+"

"; } else if (lastDate!=ap.date){ lastDate=ap.date; html+="

"+ap.date+"

"; } if(ap['reason']) { var obj = { d: ap['doc'], s: ap['start'], r: ap['reason'] } html+="" + ap.time + " Uhr"; } else { html+="" + ap.time + " Uhr"; } if(ap.ins==1){ html+="
für Privatpatienten"; } // console.log(ap); html+="
"; } var events = document.querySelectorAll("#"+id+" .events")[0]; events.innerHTML = html; } function umlautToUrl(str) { if(str==null){ return "-"; } return str.toLowerCase() .replace(/ä/g, 'ae') .replace(/ö/g, 'oe') .replace(/ü/g, 'ue') .replace(/ß/g, 'ss') .replace(/&/g, 'und') .replace(/é/g, 'e') .replace(/á/g, 'a') .replace(/ó/g, 'o') .replace(/ /g, '-') .replace(/\./g, '') .replace(/,/g, '') .replace(/\(/g, '') .replace(/\)/g, ''); } function fs_loadAPSrkcop(id, r) { var xmlhttp; if (window.XMLHttpRequest) { xmlhttp = new XMLHttpRequest(); } else { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } var reasonFilter = ""; if(r !== undefined) { reasonFilter = "&reason=" + r; } xmlhttp.onreadystatechange = function () { if (xmlhttp.readyState == XMLHttpRequest.DONE) { recipeOnly = false; if (xmlhttp.status == 200) { var data = JSON.parse(xmlhttp.responseText); var appsExist = false; if(data.aps.length > 0) { appsExist = true; } if (firstrkcop) { loadDocApirkcop("rkcop", data, appsExist); } if((!data.reasonMode || r!=undefined) && !recipeOnly) { buildEventsrkcop(id, data.aps); } } else if (xmlhttp.status == 400) { } else { } } } xmlhttp.open("GET", "https://api.termed.de/v2/getEvents.php?action=free&time=4&id=3374" + reasonFilter, true); xmlhttp.send(); } function loadDocApirkcop(id, data, appsExist) { var xmlhttp; if (window.XMLHttpRequest) { xmlhttp = new XMLHttpRequest(); } else { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange = function () { if (xmlhttp.readyState == XMLHttpRequest.DONE) { if (xmlhttp.status == 200) { var docData = JSON.parse(xmlhttp.responseText); var showWaitinglist = false; if(!appsExist && docData.package >=2 && docData.waitinglist == "1") { showWaitinglist = true; } fs_initrkcop(id, data, showWaitinglist); } else if (xmlhttp.status == 400) { } else { } } } xmlhttp.open("GET", "https://api.termed.de/v2/public/doc/3374", false); xmlhttp.send(); } fs_loadAPSrkcop("rkcop");