`;
console.log('started??');
proof = document.querySelector("#main > div > ng-component > div > div > form > form-group:nth-child(8)");
if (proof)
{
proof.innerHTML = `
Voeg een certificaat, diploma of getuigschrift toe (jpg, jpeg, png, pdf)
Certificaat, diploma of getuigschrift werd toegevoegd.
`;
done = "1";
}
}
}
// ARTICLES
if ( artp == "/articles/" )
{
if ( artedit == "/edit" )
{
comparePublishDate();
if ( document.querySelector("#datum") && setdate ===0 )
{
var today = new Date();
document.querySelector('#datum').value = today.getFullYear() + '-' + ('0' + (today.getMonth() + 1)).slice(-2) + '-' + ('0' + today.getDate()).slice(-2);
setdate = 1;
console.log('datum set');
}
else
{
if (setdate === 0 )
{
addbut = document.querySelector("#published_at");
addbut.innerHTML = addbut.innerHTML +
`
Publicatiedatum
Aanpassen
`;
}
}
}
if ( done === 0 )
{
let link = document.querySelector("#main > ng-component > div > div.row.g-4.mb-5 > div.col-md-4 > div:nth-child(1) > experts-list-item > a");
if (link !== null)
{
linkhref = link.href;
linkparts = linkhref.replace(/\/\s*$/,"").split("/");
expert = linkparts[4];
url = getURL()+"/legacy/router.php?type=isactive&user="+expert;
fetch(url)
.then
(
function(response)
{
response.text().then(function(data)
{
qbutton = document.querySelector('#qbuttondiv');
if (data == 'inactive')
{
if (qbutton !== null)
{
qbutton.setAttribute("style", "display:none");
}
done = '1';
}
else
{
if (qbutton !== null)
{
qbutton.setAttribute("style", "display:block");
}
done = "1";
}
});
}
)
.catch(function(err)
{
console.error("Fetch Error -", err);
});
}
else
{
done = "1";
buttona = document.querySelector('#main > ng-component > div > div.row.g-4.mb-5 > div.col-md-4 > div:nth-child(2) > button');
if (buttona !== null)
{
buttona.setAttribute("style", "display:none");
}
}
}
}
// EXPERTS
if ( expertp == "/experts")
{
let uname = window.location.href.split("/").pop();
let eqmodal = document.querySelector("#questionmodal");
let taxidfield = document.querySelector("#taxidfield");
if ( eqmodaldone === 0)
{
if (eqmodal)
{
document.querySelector("#questionmodal").setAttribute("src", getURL()+"/legacy/question-modal.php?expert="+uname);
eqmodaldone = "1";
}
}
/*
if ( gettaxiddone === 0)
{
if (taxidfield)
{
document.querySelector("#questionmodal").setAttribute("src", getURL()+"/legacy/question-modal.php?expert="+uname);
eqmodaldone = "1";
}
}*/
}
// QUESTIONS & ANSWERS
if ( questionp == "/questions/" && done === 0 )
{
iframe = document.querySelector("#answerframe");
if (iframe)
{
fetch(getURL()+"/legacy/router.php?type=isactive&user="+expert)
.then((response) => response.text())
.then((json) => console.log(json));
expertid = "";
user = "";
questionid = "";
iframe.src = getURL()+"/legacy/answer-modal.php?expertid="+expertid+"&user="+user+"&questionid="+questionid;
}
}
// GET POPULAR SPECIALIZATIONS
if ( questionp == "/questions" && getpopularspecsdone === 0 )
{
let popspecsel = document.querySelector('#main > ng-component > div:nth-child(2) > div > div.col-md-4 > div:nth-child(7)');
fetch(getURL()+"/legacy/router.php?type=getpopularspecs&limit=5&noaccepth")
.then((response) => response.text())
.then((text) =>
{
popspecsel.innerHTML = text;
getpopularspecsdone = 1;
});
}
if ( account == 'account' )
{
let vatfield = document.querySelector('#main > ng-component > div:nth-child(2) > form > div:nth-child(2) > div.col > div > div.col-md-12 > form-group > div > input-text > input');
let email = document.querySelector('#main > ng-component > div:nth-child(2) > form > div:nth-child(2) > div.col > div > div:nth-child(3) > form-group > div > input-text > input').value;
if ( vatdone == "0")
{
if ( vatfield )
{
url = getURL()+'/legacy/router.php?type=getvat&email='+email+'&noaccepth';
xhttp = new XMLHttpRequest();
xhttp.open("GET", url, true);
xhttp.onreadystatechange = function()
{
if (this.readyState == 4 && this.status == 200)
{
document.querySelector('#main > ng-component > div:nth-child(2) > form > div:nth-child(2) > div.col > div > div.col-md-12 > form-group > div > label').classList.add("ng-star-inserted");
document.querySelector('#main > ng-component > div:nth-child(2) > form > div:nth-child(2) > div.col > div > div.col-md-12 > form-group > div > label').classList.add("active");
vatfield.value = this.responseText;
vatdone = "1";
}
};
xhttp.send(null);
}
}
}
// MODALS
if ( emodaldone === 0 )
{
// EXPERT
let uname = window.location.href.split("/").pop();
let emodal = document.querySelector("#expertinfomodal");
if (emodal)
{
document.querySelector("#expertinfomodal").setAttribute("src", getURL()+"/legacy/expert-modal.php?user="+uname);
emodaldone = "1";
}
}
if ( qmodaldone === 0 && expertp != "/experts" )
{
// QUESTION
let qmodal = document.querySelector("#questionmodal");
if (qmodal)
{
document.querySelector("#questionmodal").setAttribute("src", getURL()+"/legacy/question-modal.php");
qmodaldone = "1";
}
}
}, 1000);
// FUNC
function uploadFile(action)
{
if (action == "proof")
{
var fileproof = document.getElementById("proof").files;
if ( fileproof.length > 0 )
{
var formData = new FormData();
formData.append("file", fileproof[0]);
var url = getURL()+"/legacy/router.php?type=setupexpert&action="+action;
var xhttp = new XMLHttpRequest();
xhttp.open("POST", url, true);
xhttp.onreadystatechange = function()
{
if (this.readyState == 4 && this.status == 200)
{
var response = this.responseText;
document.getElementById("proofwrapper").setAttribute("style", "display:none;");
document.getElementById("provenwrapper").setAttribute("style", "display:block;");
}
};
xhttp.send(formData);
}
else
{
alert("Selecteer een bestand van maximum 1 Mb");
}
}
else if (action == "avatar")
{
var files = document.getElementById("file").files;
if ( files.length > 0 )
{
var formData = new FormData();
formData.append("file", files[0]);
var url = getURL()+"/legacy/router.php?type=setupexpert&action="+action;
var xhttp = new XMLHttpRequest();
xhttp.open("POST", url, true);
xhttp.onreadystatechange = function()
{
if (this.readyState == 4 && this.status == 200)
{
var response = this.responseText;
document.getElementById("expertAvatar").src = response;
console.log('uploaded and responded');
}
else
{
console.log('uploaded but not responded');
}
};
xhttp.send(formData);
}
else
{
alert("Selecteer een bestand van maximum 1 Mb");
}
}
}
function getAvatarNative(username)
{
expertname = username;
url = getURL()+'/legacy/router.php?type=nativeavatar&expert='+expertname;
xhttp = new XMLHttpRequest();
xhttp.open("GET", url, true);
xhttp.onreadystatechange = function()
{
if (this.readyState == 4 && this.status == 200)
{
response = this.responseText;
file = response; //8yCDVYCleC0RaODe0oSfz8rEn38VzuyaX00lvrQv.jpg
urlbase = getURL()+'/storage/avatars/';
lastfour = file.slice(-4);
filename = file.slice(0, -4);
size = '_md';
newfile = urlbase+filename+size+lastfour;
console.log(newfile);
}
};
xhttp.send(null);
}
function replaceAvatarNative(username)
{
expertname = username;
url = getURL()+'/legacy/router.php?type=nativeavatar&expert='+expertname;
xhttp = new XMLHttpRequest();
xhttp.open("GET", url, true);
xhttp.onreadystatechange = function()
{
if (this.readyState == 4 && this.status == 200)
{
response = this.responseText;
file = response; //8yCDVYCleC0RaODe0oSfz8rEn38VzuyaX00lvrQv.jpg
urlbase = getURL()+'/storage/avatars/';
lastfour = file.slice(-4);
filename = file.slice(0, -4);
size = '_md';
newfile = urlbase+filename+size+lastfour;
if (document.querySelector('#expertAvatar'))
{
document.querySelector('#expertAvatar').src = newfile;
}
}
};
xhttp.send(null);
}
function scheduleArticle()
{
if ( document.querySelector('.cover').src == "" )
{
alert('Coverfoto is verplicht');
}
else
{
let cururl = window.location.href;
let article = cururl.substring( cururl.indexOf("articles/") + 9, cururl.lastIndexOf("/edit"));
let type = 'setpublishdate';
let user = document.querySelector('#myusername').innerHTML;
let date = document.querySelector('#datum').value;
url = getURL()+'/legacy/router.php?type=setpublishdate&date='+date+'&article='+article+'&user='+user+'&noaccepth';
xhttp = new XMLHttpRequest();
xhttp.open("GET", url, true);
xhttp.onreadystatechange = function()
{
if (this.readyState == 4 && this.status == 200)
{
response = this.responseText;
file = response;
}
};
xhttp.send(null);
}
}
function publishNow()
{
if (abletopublish())
{
let cururl = window.location.href;
let article = cururl.substring( cururl.indexOf("articles/") + 9, cururl.lastIndexOf("/edit"));
let type = 'setpublishdate';
let user = document.querySelector('#myusername').innerHTML;
let date = new Date().toJSON().slice(0, 10);
url = getURL()+'/legacy/router.php?type=setpublishdate&date='+date+'&article='+article+'&user='+user+'&noaccepth';
xhttp = new XMLHttpRequest();
xhttp.open("GET", url, true);
xhttp.onreadystatechange = function()
{
if (this.readyState == 4 && this.status == 200)
{
response = this.responseText;
file = response;
}
};
xhttp.send(null);
}
else
{
alert('Coverfoto is verplicht');
}
}
function abletopublish()
{
if ( document.querySelector('.cover').src !== "" )
{
return true;
}
else
{
return false;
}
}
function depublishNow()
{
let cururl = window.location.href;
let article = cururl.substring( cururl.indexOf("articles/") + 9, cururl.lastIndexOf("/edit"));
let type = 'depublish';
let user = document.querySelector('#myusername').innerHTML;
let date = '';
url = getURL()+'/legacy/router.php?type='+type+'&article='+article+'&user='+user+'&noaccepth';
xhttp = new XMLHttpRequest();
xhttp.open("GET", url, true);
xhttp.onreadystatechange = function()
{
if (this.readyState == 4 && this.status == 200)
{
response = this.responseText;
file = response;
}
};
xhttp.send(null);
}
function comparePublishDate()
{
let cururl = window.location.href;
let article = cururl.substring( cururl.indexOf("articles/") + 9, cururl.lastIndexOf("/edit"));
url = getURL()+'/legacy/router.php?type=getpublishdate&article='+article+'&noaccepth';
xhttp = new XMLHttpRequest();
xhttp.open("GET", url, true);
xhttp.onreadystatechange = function()
{
if (this.readyState == 4 && this.status == 200)
{
response = this.responseText;
datarr = response.slice(0, 10);
date = datarr;
datarr = datarr.split("-");
datehtml = datarr[2]+"-"+datarr[1]+"-"+datarr[0];
publishdate = new Date(date);
today = new Date();
if ( response == '' )
{
document.querySelector('#status').innerHTML = "Niet gepubliceerd";
document.querySelector('#plannedlabel').innerHTML = '';
document.querySelector('#planned').style.display = 'none';
document.querySelector('#depublish').style.display = 'none';
document.querySelector('#publishnow').style.display = 'block';
}
else
{
document.querySelector('#planned').style.display = 'block';
if (today < publishdate)
{
console.log('>today');
document.querySelector('#status').innerHTML = "Publicatie gepland";
document.querySelector('#plannedlabel').innerHTML = 'Op ';
document.querySelector('#planned').innerHTML = datehtml;
document.querySelector('#depublish').style.display = 'block';
document.querySelector('#publishnow').style.display = 'none';
}
if (today >= publishdate)
{
console.log('< today');
document.querySelector('#status').innerHTML = "Gepubliceerd";
document.querySelector('#plannedlabel').innerHTML = 'Op ';
document.querySelector('#planned').innerHTML = datehtml;
document.querySelector('#depublish').style.display = 'block';
document.querySelector('#publishnow').style.display = 'none';
}
}
if ( document.querySelector("#datum") )
{
if ( !document.querySelector("#datum").classList.contains('done') )
{
document.querySelector("#datum").value = date;
document.querySelector("#datum").classList.add("done");
}
}
}
};
xhttp.send(null);
}
function pubdatechanged()
{
edbut = document.querySelector("#editdate");
setTimeout(() =>
{
edbut.setAttribute('style', 'background-color:#4DAF58!important;color:white!important;width: 100%;font-size:0.9rem;margin-top:10px;margin-bottom:10px');
}, 200);
setTimeout(() =>
{
edbut.setAttribute('style', 'color:#4DAF58!important;background-color:white!important;width: 100%;font-size:0.9rem;margin-top:10px;margin-bottom:10px');
}, 800);
}
function getDate()
{
var today = new Date();
document.querySelector('#datum').value = today.getFullYear() + '-' + ('0' + (today.getMonth() + 1)).slice(-2) + '-' + ('0' + today.getDate()).slice(-2);
}
function getURL()
{
thisurl = window.location.origin;
if ( thisurl == "http://localhost:4200" )
{
url = "http://localhost:8000";
}
else if ( thisurl == "http://localhost:8000" )
{
url = "http://localhost:8000";
}
else if ( thisurl == 'https://staging.panoramaexperts.be' )
{
url = 'https://staging.panoramaexperts.be'
}
else
{
url = "https://panoramaexperts.be"
}
return url;
}
intervalID = setInterval(stickyEditor, 500);
function stickyEditor()
{
/*
if (document.querySelector("input-wysiwyg"))
{
let editor = document.querySelector("input-wysiwyg");
if (window.scrollY > 100)
{
editor.setAttribute("style", "position:fixed;top:200px;z-index:9999;height:600px;width:800px;overflow:scroll;display:block");
}
else
{
editor.setAttribute("style", "position:relative;top:auto;z-index:9999;");
}
}
*/
}
function paymentModal()
{/*
if ( paymentmodaldone === 0 )
{
let pagepath = window.location.pathname;
let page = pagepath.slice(0, 9);
let usern = pagepath.slice(9, 999);
let pmodal = document.querySelector(".modal-body");
if ( page == "/experts/" )
{
if ( pmodal )
{
let pmcontainer = document.querySelector(".cdk-overlay-pane");
let modbody = document.querySelector(".modal-body");
pmcontainer.style.width = "80%";
pmcontainer.style.height = "80%";
modbody.style.overflow = "hidden";
pmodal.innerHTML = ``;
paymentmodaldone = 1;
}
}
}*/
}
setInterval(() =>
{
paymentModal();
}, 200);
1. Hoe werkt het platform voor de patiënten?