function ajaxresults(aObj, aData, aStatus, aListMode) { if (typeof(aListMode) == 'undefined') { aListMode=0; } // console.log(aData); let MJSON = JSON.parse(aData); // console.log(MJSON); switch (MJSON["phpresult"][0].acparam) { case "IDLE": { return; break; } case "M-RQMAIL": { if (MJSON["phpresult"][0].msg == "OK") { jAlert('Die Bestätigung wurde an die angegebene Emailadresse versandt'); } if (MJSON["phpresult"][0].msg == "ERROR") { jAlert('Error #42:24, die Bestätigungsmail konnte nicht versandt werden'); } rqFeld=document.getElementById('REQMAIL'); rqButton=document.getElementById('RQMAILSEND'); if (rqFeld) { rqFeld.style.setProperty('border-color','initial','important'); rqFeld.setAttribute('disabled','disabled'); rqButton.style.setProperty('background-color','#808080','important'); rqButton.setAttribute('disabled','disabled'); } break; } case "SENDUNG": { var sStatus=(MJSON["phpdata"][0].xstatus * 1); document.body.innerHTML=resultFormString; document.getElementById('SNR_INDEX').innerHTML=MJSON['phpdata'][0].SN1+'-'+MJSON['phpdata'][0].SN2+'-'+MJSON['phpdata'][0].SN3; if (0==1) { document.getElementById('BTI').style.display='none'; } else { document.getElementById('BTI').addEventListener('click',function(){ absenden('BACKTOINPUT',''); }); } if (MJSON["phpresult"][0].msg == "ERROR-10") { document.getElementById('STATIONH_IMP').firstChild.innerHTML=''; document.getElementById('STATIONH_IMP').firstChild.nextSibling.innerHTML='Sendungsnummer nicht gefunden!'; document.getElementById('STATIONH_IMP').firstChild.nextSibling.className='STHTD2 PROBLEM'; document.getElementById('STATION_IMP').firstChild.nextSibling.innerHTML='Überprüfen Sie bitte die eingegebene Sendungsnummer!'; /* for (var i=2; i <= 9; i++) { document.getElementById('STATIONH_'+i).firstChild.nextSibling.innerHTML=''; document.getElementById('STATION_'+i).firstChild.nextSibling.innerHTML=''; } */ } if (MJSON["phpresult"][0].msg == "ERROR-15") { document.getElementById('STATIONH_IMP').firstChild.innerHTML=''; document.getElementById('STATIONH_IMP').firstChild.nextSibling.innerHTML='Zustell-PLZ stimmt nicht überein!'; document.getElementById('STATIONH_IMP').firstChild.nextSibling.className='STHTD2 PROBLEM'; document.getElementById('STATION_IMP').firstChild.nextSibling.innerHTML='Überprüfen Sie bitte die eingegebene Ziel-PLZ der Sendung!'; /* for (var i=2; i <= 9; i++) { document.getElementById('STATIONH_'+i).firstChild.nextSibling.innerHTML=''; document.getElementById('STATION_'+i).firstChild.nextSibling.innerHTML=''; } */ } if (MJSON["phpresult"][0].msg == "OK") { var stationMarker=''; var hpeFlag=false; var ideFlag=false; for (var i=1; i <= 9; i++) { if (MJSON["phpdata"][i]) { stationMarker=MJSON["phpdata"][i].code; if (stationMarker == 'HPE') { hpeFlag = true; stationMarker='HPX'; } if (MJSON["phpdata"][i].code == 'HPA') { stationMarker='HPX'; if (hpeFlag) { continue; } } if (stationMarker == 'IDE') { ideFlag=true; } } else { stationMarker=''; } if (MJSON["phpdata"][i] && (stationMarker > '')) { document.getElementById('STATIONH_'+stationMarker).className='STH'; document.getElementById('STATION_'+stationMarker).className='STEXPL'; document.getElementById('STATIONH_'+stationMarker).firstChild.innerHTML=''; document.getElementById('STATIONH_'+stationMarker).firstChild.nextSibling.className='STHTD2 OK'; document.getElementById('STATION_'+stationMarker).firstChild.nextSibling.innerHTML=getEventTime(MJSON["phpdata"][i].zeitpunkt); } } // MJSON["phpdata"][0].zugestellt=1; if (MJSON["phpdata"][0].zugestellt==1) { if (! ideFlag) { document.getElementById('STATIONH_IDE').className='STHINV'; document.getElementById('STATION_IDE').className='STEXPL STHINV'; document.getElementById('STATIONH_TST').firstChild.nextSibling.innerHTML='Sendung ist angekommen'; } var zugestelltString=getEventTime(MJSON["phpdata"][0].zeit); if (MJSON["phpdata"][0].uebernommen !='') { zugestelltString+='
Übernommen: '+MJSON["phpdata"][0].uebernommen; } if (MJSON["phpdata"][0].unterschrift !='') { zugestelltString+='
Unterschrift'; } i=9; document.getElementById('STATIONH_POD').firstChild.innerHTML=''; document.getElementById('STATIONH_POD').firstChild.nextSibling.className='STHTD2 OK'; document.getElementById('STATION_POD').firstChild.nextSibling.innerHTML=zugestelltString; rqFeld=document.getElementById('REQMAIL'); rqButton=document.getElementById('RQMAILSEND'); if (rqFeld) { rqFeld.style.setProperty('border-color','#002440','important'); rqFeld.removeAttribute('disabled'); rqButton.style.setProperty('background-color','#d51317','important'); rqButton.removeAttribute('disabled'); rqButton.addEventListener('submit',function(evt){ evt.preventDefault(); }); rqButton.addEventListener('click',function(evt){ evt.preventDefault(); submitRQMail(rqFeld.value,MJSON['phpdata'][0].SN1+'-'+MJSON['phpdata'][0].SN2+'-'+MJSON['phpdata'][0].SN3,MJSON["phpdata"][0].zeit,MJSON["phpdata"][0].uebernommen); return false; }); } } checkForEmptyStations(); } break; } case "BACKTOINPUT": { location.reload(); break; } default: { } } } function getEventTime(t) { var retVal=''; retVal=t.substr(8,2)+'.'+t.substr(5,2)+'.'+t.substr(0,4); // var mez=(t.substr(11,2)*1) + (t.substr(23,3)*1); var mez=(t.substr(11,2)*1); if (mez > 23) { mez -= 24; } retVal+=' | '+chr_num(mez,2)+':'+t.substr(14,2)+':'+t.substr(17,2); return retVal; } function submitRQMail(email,sernr,zeitpunkt,uebernommen) { if (email == '') { jAlert('Bitte geben Sie Ihre Emailadresse ein.'); return false; } if (! emailCheck(email)) { jAlert('Keine gültige Emailadresse'); return false; } mailAbsenden('','','&ACPARAM=M-RQMAIL&email='+email+'&sernr='+sernr+'&zeitpunkt='+zeitpunkt+'&uebernommen='+uebernommen); // console.log(arguments); return false; } function showSignaturePic(s1,s2,s3) { var picName='signatures/'+s1+'_'+s2+'_'+s3+'.png' // console.log(picName); swal({ /* className: 'SWALCONFIRMAGBS', */ title: 'Unterschrift Sendung '+s1+'-'+s2+'-'+s3, closeOnClickOutside: false, content: { element: "img", attributes: { id:"SHOWSIGNATUREPIC", src:picName, }, }, buttons: { cancel: { text: 'Ok', value:null, className: "SSPBT", visible: true } } }); } function checkForEmptyStations() { var checkPointArr=new Array(); var statCounter=0; var lastCheckPoint=0; var lastCheckPointCode=''; for (var i=0; i < document.getElementsByTagName('tr').length; i++) { var station=document.getElementsByTagName('tr')[i]; if (station.id.indexOf('STATIONH') == -1) { continue; } checkPointArr[statCounter]=station.firstChild.innerHTML.indexOf('check_b.gif') > -1; // console.log(station.id,checkPointArr[statCounter]); if (checkPointArr[statCounter]) { lastCheckPoint=statCounter; lastCheckPointCode=station.id.substr(9,3) } statCounter++; } statCounter=0; for (var i=0; i < document.getElementsByTagName('tr').length; i++) { var station=document.getElementsByTagName('tr')[i]; if (station.id.indexOf('STATIONH') == -1) { continue; } if (! checkPointArr[statCounter]) { station.className='STHINV'; document.getElementById(station.id.replace(/STATIONH/,'STATION')).className='STEXPL STHINV'; } statCounter++; if (statCounter >= lastCheckPoint) { break; } } }