918 lines
32 KiB
PHP
918 lines
32 KiB
PHP
<!DOCTYPE HTML>
|
|
<!--
|
|
Alpha by HTML5 UP
|
|
html5up.net | @n33co
|
|
Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
|
|
-->
|
|
<html>
|
|
<head>
|
|
<?php
|
|
|
|
error_reporting(E_ALL);
|
|
ini_set('display_errors', '1');
|
|
register_shutdown_function(static function (): void {
|
|
$error = error_get_last();
|
|
if ($error === null) {
|
|
return;
|
|
}
|
|
|
|
$fatalTypes = [E_ERROR, E_PARSE, E_CORE_ERROR, E_COMPILE_ERROR, E_USER_ERROR];
|
|
if (!in_array((int)$error['type'], $fatalTypes, true)) {
|
|
return;
|
|
}
|
|
|
|
if (!headers_sent()) {
|
|
header('Content-Type: text/html; charset=utf-8');
|
|
}
|
|
|
|
echo '<div style="max-width:900px;margin:20px auto;padding:16px;border:3px solid #b30000;background:#fff7f7;color:#111;font-family:Arial,sans-serif;">'
|
|
. '<h3 style="margin-top:0;">Fehler in impfwarteliste.php</h3>'
|
|
. '<p>Die Seite ist wegen eines PHP-Fehlers abgebrochen.</p>'
|
|
. '<p><strong>Meldung:</strong> ' . htmlspecialchars((string)$error['message'], ENT_QUOTES, 'UTF-8') . '<br>'
|
|
. '<strong>Datei:</strong> ' . htmlspecialchars((string)$error['file'], ENT_QUOTES, 'UTF-8') . '<br>'
|
|
. '<strong>Zeile:</strong> ' . (int)$error['line'] . '</p>'
|
|
. '</div>';
|
|
});
|
|
|
|
include('header.php');
|
|
|
|
?>
|
|
<title>Praxis Creutzburg - Impfung Warteliste</title>
|
|
|
|
</head>
|
|
<body >
|
|
|
|
<!-- Header -->
|
|
<header id="header" class="../skel-layers-fixed">
|
|
|
|
|
|
<?php
|
|
|
|
include('menu.php');
|
|
include_once("inc/config.inc.php");
|
|
include_once("inc/functions.inc.php");
|
|
include_once('inc/functions.impfen.inc.php');
|
|
include_once('inc/impfworkflow_notifications.inc.php');
|
|
$workflowSetupError = '';
|
|
if ($con instanceof mysqli) {
|
|
mysqli_set_charset($con, "utf8mb4");
|
|
}
|
|
if (isset($pdo) && $pdo instanceof PDO) {
|
|
try {
|
|
impfWorkflowEnsureTables($pdo);
|
|
} catch (Throwable $e) {
|
|
$workflowSetupError = $e->getMessage();
|
|
}
|
|
}
|
|
$zeitOptionenJson = "{}";
|
|
?>
|
|
</header>
|
|
|
|
|
|
|
|
|
|
<?php
|
|
|
|
|
|
$mailbetreff = "Ihr Wartelistenplatz für eine Impfung bei Praxis Creutzburg";
|
|
|
|
?>
|
|
|
|
|
|
<!-- Main -->
|
|
<section id="main" class="container">
|
|
<?php
|
|
echo showHeaderpraxis();
|
|
?>
|
|
|
|
|
|
|
|
<section class="box special">
|
|
<h2>Impfwarteliste</h2>
|
|
<?php if ($workflowSetupError !== ''): ?>
|
|
<div style="border:3px solid red; margin: 10px 0; padding: 10px; text-align:left;">
|
|
Die Impfworkflow-Tabellen konnten nicht automatisch geprueft werden: <?php echo htmlspecialchars($workflowSetupError, ENT_QUOTES, 'UTF-8'); ?><br>
|
|
Bitte fuehren Sie zuerst das Migrationsskript aus.
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<?php
|
|
|
|
|
|
if($workflowSetupError !== ''){
|
|
// Hinweis wurde bereits oberhalb ausgegeben.
|
|
|
|
}else if(isset($_POST["id"]) || isset($_GET["id"])){
|
|
|
|
if(isset($_POST["id"])){
|
|
$id = mysqli_real_escape_string($con, $_POST["id"]);
|
|
}else if(isset($_GET["id"])){
|
|
$id = mysqli_real_escape_string($con, $_GET["id"]);
|
|
}
|
|
$queryimpf = mysqli_query($con, "SELECT * FROM warteliste WHERE hash='" . $id . "'");
|
|
|
|
if($queryimpf->num_rows == 1){
|
|
$rowimpf = $queryimpf->fetch_assoc() ;
|
|
$userid = $rowimpf["userid"];
|
|
$checked = $rowimpf["checked"];
|
|
$warteid = $rowimpf["warteid"];
|
|
$impfenzeitraum = $rowimpf["impfenzeitraum"];
|
|
$zeitraumId = (int)($rowimpf["zeitraum_id"] ?? 0);
|
|
if ($zeitraumId > 0 && isset($pdo) && $pdo instanceof PDO) {
|
|
$zeitraumAktuell = impfLoadZeitraumById($pdo, $zeitraumId, true);
|
|
if ($zeitraumAktuell) {
|
|
$impfenzeitraum = $zeitraumAktuell['label'];
|
|
}
|
|
}
|
|
$ausgewaehlteZeitraeume = [];
|
|
if (isset($pdo) && $pdo instanceof PDO) {
|
|
$ausgewaehlteZeitraeume = impfGetWartelistenZeitraeumeLabels($pdo, (int)$warteid, false);
|
|
}
|
|
if (!empty($ausgewaehlteZeitraeume)) {
|
|
$impfenzeitraum = implode('<br>', array_map(static function ($label) {
|
|
return e((string)$label);
|
|
}, $ausgewaehlteZeitraeume));
|
|
} else {
|
|
$impfenzeitraum = htmlspecialchars((string)$impfenzeitraum, ENT_QUOTES, 'UTF-8');
|
|
}
|
|
//echo $userid;
|
|
$queryuser = mysqli_query($con, "SELECT * FROM persons WHERE person_id='" . $userid . "'");
|
|
$rowuser = $queryuser->fetch_assoc();
|
|
$vorname = $rowuser["vorname"];
|
|
$nachname = $rowuser["nachname"];
|
|
$mail = $rowuser["email"];
|
|
//echo $mail;
|
|
$tel = $rowuser["tele"];
|
|
$geburtstag = $rowuser["geburtstag"];
|
|
$userausgabe = $vorname . " " . $nachname;
|
|
|
|
|
|
// Impfstoff
|
|
$impfstoff = $rowimpf["impfstoff"];
|
|
$sqlimpfstoffstring = "SELECT * FROM impfstoff WHERE impfid ='" . $impfstoff . "'";
|
|
$queryimpfstoff = mysqli_query($con,$sqlimpfstoffstring);
|
|
$rowimpf = mysqli_fetch_assoc($queryimpfstoff);
|
|
$impfstofftext = $rowimpf["impfname"];
|
|
|
|
|
|
|
|
$Patientenart = $rowuser["patientenart"];
|
|
if($Patientenart == "1"){
|
|
$Patientenart = "Patient";
|
|
}else{
|
|
$Patientenart = "neuer Patient";
|
|
}
|
|
$Impfaufklaerung = $rowimpf["Impfaufklaerung"];
|
|
if($Impfaufklaerung == "1"){
|
|
$Impfaufklaerung = "Ja";
|
|
}else{
|
|
$Impfaufklaerung = "Nein";
|
|
}
|
|
$WeitereFragen = $rowimpf["WeitereFragen"];
|
|
if($WeitereFragen == "1"){
|
|
$WeitereFragen = "Ja";
|
|
}else{
|
|
$WeitereFragen = "Nein";
|
|
}
|
|
|
|
//$mailbetreff = "Ihre Coronaimpfung bei Praxis Creutzburg";
|
|
|
|
$Zeitanzeige = $datum . " " . $start . "-" . $ende ;
|
|
if($checked == 0){
|
|
echo "<h4>Sie haben Ihren Wartelisten-Eintrag aktuell noch nicht bestätigt!<br><br>Über diese Oberfäche können Sie bei freien Impftermin schneller einen Termin buchen!<br><br>";
|
|
echo "Sie haben die folgenden Angaben:<br><br>";
|
|
echo "<h4>Name: $userausgabe</h4>";
|
|
echo "<h4>Art: $Patientenart</h4>";
|
|
echo "<h4>Telefon: $tel</h4>";
|
|
echo "<h4>Impfstoff: $impfstofftext</h4>";
|
|
echo "<h4>Zeitraum:<br>$impfenzeitraum</h4><br>";
|
|
|
|
echo "<form action='". $_SERVER['PHP_SELF'] . "' method=POST>";
|
|
echo '<input type="hidden" name="warteid" id="warteid" value="'. $warteid .'" />';
|
|
echo '<input type="hidden" name="aktion" id="aktion" value="2" />';
|
|
echo '<input type="submit" id="submit" value="Warteplatz ZUSAGEN" />';
|
|
echo "</form>";
|
|
echo "<form action='". $_SERVER['PHP_SELF'] . "' method=POST>";
|
|
echo '<input type="hidden" name="aktion" id="aktion" value="3" />';
|
|
echo '<input type="hidden" name="warteid" id="warteid" value="'. $warteid .'" />';
|
|
echo '<input type="submit" id="submit" value="Warteplatz LÖSCHEN!" />';
|
|
echo "</form>";
|
|
|
|
}else if($checked == 1){
|
|
echo "<h4>Sie haben Ihren Warteplatz bestätigt!</h4><br><b>Vielen Dank!</b><br><br>Sie erhalten von uns automatisch eine Terminanfrage, sobald ein passendes Impfevent geplant wurde.<br><br><br>";
|
|
echo "Sie haben die folgenden Angaben:<br><br>";
|
|
echo "<h4>Name: $userausgabe</h4>";
|
|
echo "<h4>Impfstoff: $impfstofftext</h4><br>";
|
|
if (!empty($ausgewaehlteZeitraeume)) {
|
|
echo "<h4>Ausgewählte Zeitfenster:<br>" . implode('<br>', array_map(static function ($label) {
|
|
return e((string)$label);
|
|
}, $ausgewaehlteZeitraeume)) . "</h4>";
|
|
} else {
|
|
echo "<h4>Zeitraum: $impfenzeitraum</h4>";
|
|
}
|
|
echo "<h4>Wir informieren Sie, sobald ein konkreter Impftermin für Ihren Impfstoff festgelegt wurde.</h4>";
|
|
echo "Die Terminvergabe erfolgt durch das Praxisteam, sobald eine komplette Impfflasche mit passenden Wartelistenplätzen gefüllt ist.<br><br>";
|
|
echo "Können Sie Ihren Warteplatz nicht wahrnehmen oder benötigen diesen nicht mehr, dann tragen Sie sich bitte aus:<br>";
|
|
echo "<form action='". $_SERVER['PHP_SELF'] . "' method=POST>";
|
|
echo '<input type="hidden" name="aktion" id="aktion" value="3" />';
|
|
echo '<input type="hidden" name="warteid" id="warteid" value="'. $warteid .'" />';
|
|
echo '<input type="submit" id="submit" value="Warteplatz LÖSCHEN!" />';
|
|
echo "</form>";
|
|
|
|
|
|
}else if($checked == 2){
|
|
echo "<h4>Ihr Warteplatz wurde erfolgreich abgesagt!!</h4><br>Wünschen Sie einen neuen Warteplatz, tragen Sie sich wieder über das Formular ein.<br>";
|
|
|
|
|
|
}else if($checked == 3){
|
|
echo "<h4>Ihr Warteplatz wurde vom Praxisteam storniert!</h4><br>Wünschen Sie einen neuen Warteplatz, tragen Sie sich wieder über das Formular ein.<br>";
|
|
|
|
|
|
}else if($checked == 4){
|
|
echo "<h4>Ihr Warteplatz wurde vom Praxisteam storniert!</h4><br>Wünschen Sie einen neuen Warteplatz, tragen Sie sich wieder über das Formular ein.<br>";
|
|
|
|
|
|
}
|
|
|
|
}else{
|
|
echo "<h4>Ihre Warteplatz ist gelöscht.</h4><br>Eine weitere Bearbeitung ist nicht mehr möglich.<br><br>";
|
|
|
|
}
|
|
|
|
|
|
|
|
}else if(isset($_POST["submitbox"]) && !isset($_POST["aktion"])){
|
|
|
|
|
|
echo '<h4>Kontrollieren Sie Ihre Angaben!</h4><br>';
|
|
echo '<form action="'. $_SERVER['PHP_SELF'] .'" method=POST>';
|
|
echo '<table border="0">';
|
|
// Schleife durch Clemens 15.10.2018
|
|
$ignoreKeys = ["impfenangebot", "Patientenart", "Impfaufklaerung", "WeitereFragen", "zusammenmit"];
|
|
foreach ($_POST as $key => $value) {
|
|
if($key === "submitbox"){
|
|
continue;
|
|
}
|
|
if(in_array($key, $ignoreKeys, true)){
|
|
echo "<input type=hidden name='".$key."' value='".$value. "'>\n";
|
|
continue;
|
|
}
|
|
if($key === "impfenzeitraeume" && is_array($value)){
|
|
$zeitraumIds = impfNormalizeZeitraumIds($value);
|
|
$zeitraumLabels = [];
|
|
foreach ($zeitraumIds as $zeitraumId) {
|
|
$zeitraumRow = null;
|
|
if (isset($pdo) && $pdo instanceof PDO) {
|
|
$zeitraumRow = impfLoadZeitraumById($pdo, (int)$zeitraumId, true);
|
|
}
|
|
if ($zeitraumRow) {
|
|
$zeitraumLabels[] = (string)$zeitraumRow['label'];
|
|
echo '<input type="hidden" name="impfenzeitraeume[]" value="'.(int)$zeitraumId.'">' . "\n";
|
|
}
|
|
}
|
|
echo "<tr><td width=100 valign=top class=fett>$key:</td><td>" . implode("<br>", array_map(static function ($label) {
|
|
return e((string)$label);
|
|
}, $zeitraumLabels)) . "</td></tr>\n";
|
|
continue;
|
|
}
|
|
if($value !== ""){
|
|
if($key == "Impfstoff"){
|
|
$sqlimpfstoffstring = "SELECT * FROM impfstoff WHERE impfid ='" . $value . "' order by sortierung";
|
|
$queryimpfstoff = mysqli_query($con,$sqlimpfstoffstring);
|
|
$rowimpf = mysqli_fetch_assoc($queryimpfstoff);
|
|
$impfstofftext = $rowimpf["impfname"];
|
|
|
|
|
|
echo "<tr><td width=100 valign=top class=fett>$key:</td><td>$impfstofftext</td></tr>\n";
|
|
echo"<input type=hidden name='".$key."' value='".$value. "'>\n";
|
|
}else if($key == "impfenzeitraum"){
|
|
$zeitraumRow = null;
|
|
if (isset($pdo) && $pdo instanceof PDO) {
|
|
$zeitraumRow = impfLoadZeitraumById($pdo, (int)$value, true);
|
|
}
|
|
$zeitraumText = $zeitraumRow ? $zeitraumRow['label'] : 'Unbekannter Zeitraum';
|
|
echo "<tr><td width=100 valign=top class=fett>$key:</td><td>$zeitraumText</td></tr>\n";
|
|
echo"<input type=hidden name='impfenzeitraeume[]' value='".(int)$value."'>\n";
|
|
echo"<input type=hidden name='".$key."' value='".$value. "'>\n";
|
|
}else{
|
|
echo "<tr><td width=100 valign=top class=fett>$key:</td><td>$value</td></tr>\n";
|
|
echo"<input type=hidden name='".$key."' value='".$value. "'>\n";
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
echo '</table>';
|
|
echo '<input type="hidden" name="aktion" value="1" />';
|
|
echo '<input type="submit" value="Anfrage abschicken" />';
|
|
echo '</form >';
|
|
|
|
|
|
}else if(isset($_POST["aktion"])){
|
|
|
|
if($_POST["aktion"] == "1"){
|
|
|
|
$vorname = mysqli_real_escape_string($con, $_POST["Vorname"] ?? "");
|
|
$nachname = mysqli_real_escape_string($con, $_POST["Name"] ?? "");
|
|
$geburtstag = mysqli_real_escape_string($con, $_POST["Geburtsjahr"] ?? "");
|
|
$Email = mysqli_real_escape_string($con, $_POST["Email"] ?? "");
|
|
$tele = mysqli_real_escape_string($con, $_POST["Tel"] ?? "");
|
|
$plz = mysqli_real_escape_string($con, $_POST["plz"] ?? "");
|
|
$ort = mysqli_real_escape_string($con, $_POST["ort"] ?? "");
|
|
$strasse = mysqli_real_escape_string($con, $_POST["strasse"] ?? "");
|
|
$impfenangebotstring = $_POST["impfenangebot"] ?? "I";
|
|
$impfstoff = (int)($_POST["Impfstoff"] ?? 0);
|
|
$Patientenartstring = mysqli_real_escape_string($con, $_POST["Patientenart"] ?? "Neupatient");
|
|
$Impfaufklaerung = mysqli_real_escape_string($con, $_POST["Impfaufklaerung"] ?? "Nein");
|
|
$WeitereFragen = mysqli_real_escape_string($con, $_POST["WeitereFragen"] ?? "Nein");
|
|
$impfenmit = mysqli_real_escape_string($con, $_POST["zusammenmit"] ?? "");
|
|
$impfenzeitraumIds = impfNormalizeZeitraumIds($_POST["impfenzeitraeume"] ?? ($_POST["impfenzeitraum"] ?? []));
|
|
$impfart = (int)($_POST["impfart"] ?? 0);
|
|
$letzteimpfung = trim($_POST["letzteimpfung"] ?? "");
|
|
|
|
if ($impfstoff <= 0 || $impfart <= 0 || empty($impfenzeitraumIds)) {
|
|
echo "<h3>Pflichtfelder fehlen</h3><br>Bitte wählen Sie Impfstoff, mindestens einen Zeitraum und die Impfungsart aus.<br><br>";
|
|
goto end_aktion_1;
|
|
}
|
|
|
|
if ($impfart > 1 && $letzteimpfung === "") {
|
|
echo "<h3>Letzte Impfung fehlt</h3><br>Bitte geben Sie das Datum der letzten Impfung an.<br><br>";
|
|
goto end_aktion_1;
|
|
}
|
|
|
|
if ($impfart === 1) {
|
|
$letzteimpfung = "";
|
|
}
|
|
|
|
$zeitraumLabels = [];
|
|
if (isset($pdo) && $pdo instanceof PDO) {
|
|
foreach ($impfenzeitraumIds as $impfenzeitraumId) {
|
|
$zeitraumRow = impfLoadZeitraumById($pdo, (int)$impfenzeitraumId, true);
|
|
if (!$zeitraumRow || !in_array($impfstoff, $zeitraumRow['impfstoff_id_list'] ?? [], true)) {
|
|
echo "<h3>Ungültiger Zeitraum</h3><br>Bitte wählen Sie einen gültigen Zeitraum für den ausgewählten Impfstoff aus.<br><br>";
|
|
goto end_aktion_1;
|
|
}
|
|
$zeitraumLabels[] = (string)$zeitraumRow['label'];
|
|
}
|
|
}
|
|
$impfenzeitraum = mysqli_real_escape_string($con, implode(' | ', $zeitraumLabels));
|
|
$impfenzeitraumId = (int)($impfenzeitraumIds[0] ?? 0);
|
|
|
|
|
|
//echo $impfenmit;
|
|
if($impfenangebotstring == "S"){
|
|
$impfenangebot = 2;
|
|
}else if($impfenangebotstring == "I"){
|
|
$impfenangebot = 1;
|
|
}else{
|
|
$impfenangebot = 1;
|
|
}
|
|
|
|
// Impfstoff
|
|
//$impfstoff = $rowtime["impfstoff"];
|
|
$sqlimpfstoffstring = "SELECT * FROM impfstoff WHERE impfid ='" . $impfstoff . "'";
|
|
$queryimpfstoff = mysqli_query($con,$sqlimpfstoffstring);
|
|
$rowimpf = mysqli_fetch_assoc($queryimpfstoff);
|
|
$impfstofftext = $rowimpf["impfname"];
|
|
|
|
|
|
|
|
if($Patientenartstring == "Patient"){
|
|
$Patientenart = 1;
|
|
}else{
|
|
$Patientenart = 0;
|
|
}
|
|
$Impfaufklaerung = mysqli_real_escape_string($con, $Impfaufklaerung);
|
|
if($Impfaufklaerung == "Ja"){
|
|
$Impfaufklaerung = 1;
|
|
}else{
|
|
$Impfaufklaerung = 0;
|
|
}
|
|
$WeitereFragen = mysqli_real_escape_string($con, $WeitereFragen);
|
|
if($WeitereFragen == "Ja"){
|
|
$WeitereFragen = 1;
|
|
}else{
|
|
$WeitereFragen = 0;
|
|
}
|
|
|
|
$sendmail = false;
|
|
|
|
$userid = Userspeichern(
|
|
$vorname,
|
|
$nachname,
|
|
$geburtstag,
|
|
$Email,
|
|
$tele,
|
|
$ort,
|
|
$plz,
|
|
$strasse,
|
|
0,
|
|
$Patientenart,
|
|
0
|
|
);
|
|
|
|
$hashvorher = $vorname . $nachname . $Email;
|
|
$hash = md5($hashvorher) . date("Ymd");
|
|
|
|
$letzteimpfungSql = ($letzteimpfung !== "") ? ("'" . mysqli_real_escape_string($con, $letzteimpfung) . "'") : "NULL";
|
|
$query = mysqli_query($con, "SELECT * FROM warteliste WHERE userid='" . (int)$userid . "'");
|
|
if($query && $query->num_rows == 0){
|
|
$warteid = 0;
|
|
$saveOk = false;
|
|
$saveErrorShown = false;
|
|
try {
|
|
if (isset($pdo) && $pdo instanceof PDO) {
|
|
[$ok, $msg, $newWarteid] = impfCreateWaitlistEntryForPerson(
|
|
$pdo,
|
|
(int)$userid,
|
|
$impfstoff,
|
|
$impfenzeitraumIds,
|
|
$impfart,
|
|
($letzteimpfung !== "") ? $letzteimpfung : null,
|
|
0
|
|
);
|
|
if (!$ok) {
|
|
throw new RuntimeException($msg);
|
|
}
|
|
$warteid = (int)$newWarteid;
|
|
$pdo->prepare("UPDATE warteliste SET impfenangebot = :impfenangebot, impfenmit = :impfenmit, Impfaufklaerung = :aufklaerung, WeitereFragen = :fragen WHERE warteid = :warteid")
|
|
->execute([
|
|
'impfenangebot' => $impfenangebot,
|
|
'impfenmit' => $impfenmit,
|
|
'aufklaerung' => $Impfaufklaerung,
|
|
'fragen' => $WeitereFragen,
|
|
'warteid' => $warteid,
|
|
]);
|
|
$saveOk = true;
|
|
} else {
|
|
throw new RuntimeException("PDO Verbindungsobjekt fehlt.");
|
|
}
|
|
SendMailMessageVorlage($pdo, "2", (int)$warteid, "8" );
|
|
echo "<h3>Nachricht abgeschickt!</h3><br>Sie müssen die Eintragung in der Warteliste noch bestätigen!<br>Überprüfen Sie auch Ihren Spam-Filter!<br><br>";
|
|
} catch (Throwable $e) {
|
|
echo "<h3>Speicherung nicht erfolgreich</h3><br>" . htmlspecialchars($e->getMessage(), ENT_QUOTES, 'UTF-8') . "<br><br>";
|
|
$saveErrorShown = true;
|
|
}
|
|
if(!$saveOk && !$saveErrorShown){
|
|
echo "<h3>Speicherung nicht erfolgreich</h3><br>Ihre Anfrage konnte nicht gespeichert werden.<br>Nutzen Sie das Formular erneut<br><br>";
|
|
}
|
|
}else{
|
|
echo "<h3>Kein Versand!</h3><h4>Dieser Benutzer ist schon in unserer Warteliste eingetragen. Eine Doppelbuchung ist nicht möglich!</h4><br><br><br>";
|
|
}
|
|
end_aktion_1:
|
|
|
|
}else if($_POST["aktion"] == 2){
|
|
|
|
$querychecked = mysqli_query($con, "SELECT checked FROM warteliste WHERE warteid='" . $_POST["warteid"] . "'");
|
|
$rowchecked = $querychecked->fetch_assoc() ;
|
|
$checked = $rowchecked["checked"];
|
|
|
|
if($checked >= 1){
|
|
echo "<h4>Sie haben Ihren Termin schon bestätigt.</h4>";
|
|
|
|
}else{
|
|
$query = mysqli_query($con, "Update warteliste SET checked='1' WHERE warteid ='".$_POST["warteid"]."'");
|
|
if($query){
|
|
echo "<h4>Ihr Termin wurde erfolgreich bestätigt!<h4><br>";
|
|
echo "Sie erhalten gleiche eine schriftliche Bestätigung per E-Mail<br>";
|
|
|
|
|
|
$queryimpf = mysqli_query($con, "SELECT * FROM warteliste WHERE warteid='" . $_POST["warteid"] . "'");
|
|
|
|
$rowimpf = $queryimpf->fetch_assoc() ;
|
|
$userid = $rowimpf["userid"];
|
|
$checked = $rowimpf["checked"];
|
|
$warteid = $rowimpf["warteid"];
|
|
$timeid = $rowimpf["timeid"];
|
|
//echo $userid;
|
|
$queryuser = mysqli_query($con, "SELECT * FROM persons WHERE person_id='" . $userid . "'");
|
|
$rowuser = $queryuser->fetch_assoc();
|
|
$vorname = $rowuser["vorname"];
|
|
$nachname = $rowuser["nachname"];
|
|
$mail = $rowuser["email"];
|
|
//echo $mail;
|
|
$tel = $rowuser["tele"];
|
|
$geburtstag = $rowuser["geburtstag"];
|
|
$userausgabe = $vorname . " " . $nachname;
|
|
|
|
SendMailMessageVorlage($pdo, "2", $warteid , "9" );
|
|
if (isset($pdo) && $pdo instanceof PDO) {
|
|
try {
|
|
impfWorkflowNotificationProcess($pdo);
|
|
} catch (Throwable $e) {
|
|
error_log('impfWorkflowNotificationProcess failed in impfwarteliste confirm: ' . $e->getMessage());
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
}else if($_POST["aktion"] == 3){
|
|
$querychecked = mysqli_query($con, "SELECT checked FROM warteliste WHERE warteid='" . $_POST["warteid"] . "'");
|
|
$rowchecked = $querychecked->fetch_assoc() ;
|
|
$checked = $rowchecked["checked"];
|
|
if($checked >= 2){
|
|
echo "<h4>Sie haben Ihren Warteplatz schon abgesagt.</h4>";
|
|
|
|
}else{
|
|
$queryimpf = mysqli_query($con, "SELECT * FROM warteliste WHERE warteid='" . $_POST["warteid"] . "'");
|
|
$rowimpf = $queryimpf->fetch_assoc() ;
|
|
SendMailMessageVorlage($pdo, "2", $_POST["warteid"], "10" );
|
|
if (isset($pdo) && $pdo instanceof PDO) {
|
|
$pdo->prepare("DELETE FROM warteliste_zeitraum WHERE warteid = :warteid")->execute([
|
|
'warteid' => (int)$_POST["warteid"],
|
|
]);
|
|
}
|
|
$query = mysqli_query($con, "DELETE FROM warteliste WHERE warteid ='".$_POST["warteid"]."'");
|
|
if($query){
|
|
echo "<h4>Ihr Warteplatz wurde erfolgreich gelöscht!<h4><br>";
|
|
echo "Sie erhalten gleiche eine schriftliche Bestätigung per E-Mail<br>";
|
|
if (isset($pdo) && $pdo instanceof PDO) {
|
|
try {
|
|
impfWorkflowNotificationProcess($pdo);
|
|
} catch (Throwable $e) {
|
|
error_log('impfWorkflowNotificationProcess failed in impfwarteliste delete: ' . $e->getMessage());
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
}else if($_POST["aktion"] == 4){
|
|
|
|
$timeid = mysqli_real_escape_string($con, $_POST["Terminzeitraum"]);
|
|
//echo $timeid ;
|
|
//echo "<br>";
|
|
|
|
$warteid = mysqli_real_escape_string($con, $_POST["warteid"]);
|
|
//echo $warteid ;
|
|
$query = mysqli_query($con, "SELECT impfdosen FROM timeslots WHERE timeid ='". $timeid ."'");
|
|
$row = $query->fetch_assoc();
|
|
$dosenanzahl = $row["impfdosen"];
|
|
if($dosenanzahl >= 1){
|
|
$queryuser = mysqli_query($con, "SELECT userid, hash, warteid, impfart FROM warteliste WHERE warteid='" . $warteid . "'");
|
|
$row = mysqli_fetch_assoc($queryuser);
|
|
$userid = $row['userid'];
|
|
$warteid = $row['warteid'];
|
|
$hash = $row['hash'];
|
|
$impfartwarte = (int)($row['impfart'] ?? 1);
|
|
$datestring = date("Y-m-d");
|
|
$query = mysqli_query($con, "SELECT * FROM impftermin INNER JOIN timeslots ON impftermin.timeid = timeslots.timeid WHERE userid='". $userid ."' AND date >= '". $datestring ."' AND checked IN ('0','1')");
|
|
|
|
if($query->num_rows == 0){
|
|
$queryinsert = mysqli_query($con, "INSERT INTO impftermin (userid, timeid, hash, coronafragen, astraok, impfart, checked, behandelt) VALUES ('".$userid."', '".$timeid."', '".$hash."', '0', '1', '".$impfartwarte."', '0', '0')");
|
|
|
|
if($queryinsert){
|
|
//echo "Select terminid FROM impftermin WHERE userid='" . $userid . "' AND timeid='" . $timeid . "'";
|
|
$querytermin = mysqli_query($con, "Select terminid FROM impftermin WHERE userid='" . $userid . "' AND timeid='" . $timeid . "'");
|
|
$rowtermin = mysqli_fetch_assoc($querytermin);
|
|
$terminid = $rowtermin["terminid"];
|
|
$query = mysqli_query($con, "Select impfdosen FROM timeslots WHERE timeid='".$timeid."'");
|
|
$row = mysqli_fetch_assoc($query);
|
|
$dosen = $row["impfdosen"] - 1;
|
|
$query = mysqli_query($con, "Update timeslots SET impfdosen='".$dosen ."' WHERE timeid ='".$timeid."'");
|
|
if($query){
|
|
echo "<h4>Mail wird gleich versendet!</h4>";
|
|
echo "<br>Überprüfen Sie auch Ihren SPAM Ordner!<br>";
|
|
SendMailMessageVorlage($pdo, "1", (int)$terminid, "1" );
|
|
if (isset($pdo) && $pdo instanceof PDO) {
|
|
$pdo->prepare("DELETE FROM warteliste_zeitraum WHERE warteid = :warteid")->execute([
|
|
'warteid' => (int)$warteid,
|
|
]);
|
|
}
|
|
$query = mysqli_query($con, "DELETE FROM warteliste WHERE warteid ='".$warteid."'");
|
|
}else{
|
|
echo "<h4>Fehler bei Speichern der Anfragen!</h4>";
|
|
echo "<br>Versuchen Sie es später erneut!<br>";
|
|
}
|
|
}
|
|
|
|
}else{
|
|
echo "<h3>Kein Versand!</h3><h4>Dieser Benutzer hat schon einen Termin eingetragen. Eine Doppelbuchung ist nicht möglich!</h4>
|
|
<br><b>Achtung!</b> Sagen Sie Ihren Termin ab können Sie eine Woche keinen neuen Termin erhalten.<br>
|
|
Haben Sie Ihren Termin abgesagt, können Sie sieben Tage keinen neuen Termin beantragen!
|
|
<br><br><br>";
|
|
|
|
}
|
|
|
|
|
|
}else{
|
|
echo "<h4>Kein Termin mehr frei!</h4>";
|
|
echo "<br>Aktuell ist zu diesem Zeitabschnitt keine Impfung mehr möglich!<br>";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
}else{
|
|
|
|
|
|
?>
|
|
|
|
<div class="12u">
|
|
|
|
<section class="box" id="box" >
|
|
<h3>Impfwillig? </h3>
|
|
|
|
|
|
Sie wollen sich impfen lassen?<br>Schnell und unkompliziert? <br>
|
|
Melden Sie sich unverbindlich auf unserer Warteliste an. Sollten wir entsprechend wieder Impfstoff vorrätig haben, dann bekommen Sie eine Information per E-Mail.
|
|
<br><br>
|
|
|
|
<?php
|
|
$zeitOptionenByImpfstoff = [];
|
|
$verfuegbareImpfstoffe = [];
|
|
if (isset($pdo) && $pdo instanceof PDO) {
|
|
$stImpfstoffe = $pdo->prepare("SELECT r.impfstoff_id, i.impfname
|
|
FROM impfstoff_workflow r
|
|
INNER JOIN impfstoff i ON i.impfid = r.impfstoff_id
|
|
WHERE (i.aktiv = 1 OR i.aktivwarteliste = 1 OR i.aktivtermin = 1 OR i.aktivgrippe = 1)
|
|
AND r.dosen_pro_flasche > 0
|
|
ORDER BY i.impfname");
|
|
$stImpfstoffe->execute();
|
|
foreach ($stImpfstoffe->fetchAll(PDO::FETCH_ASSOC) as $impfstoffRow) {
|
|
$verfuegbareImpfstoffe[(int)$impfstoffRow['impfstoff_id']] = (string)$impfstoffRow['impfname'];
|
|
}
|
|
|
|
$zeitraeumeByImpfstoff = impfGetZeitraeumeByImpfstoff($pdo, true);
|
|
foreach ($zeitraeumeByImpfstoff as $iid => $zeitraeume) {
|
|
foreach ($zeitraeume as $zeitraum) {
|
|
if (!isset($verfuegbareImpfstoffe[$iid])) {
|
|
continue;
|
|
}
|
|
if (!isset($zeitOptionenByImpfstoff[$iid])) {
|
|
$zeitOptionenByImpfstoff[$iid] = [];
|
|
}
|
|
$zeitOptionenByImpfstoff[$iid][] = [
|
|
'id' => (int)$zeitraum['zeitraum_id'],
|
|
'label' => impfZeitraumLabel($zeitraum, false),
|
|
];
|
|
}
|
|
}
|
|
foreach ($verfuegbareImpfstoffe as $iid => $impfname) {
|
|
if (empty($zeitOptionenByImpfstoff[$iid])) {
|
|
unset($verfuegbareImpfstoffe[$iid]);
|
|
}
|
|
}
|
|
}
|
|
$zeitOptionenJson = json_encode($zeitOptionenByImpfstoff, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
|
|
?>
|
|
|
|
|
|
|
|
|
|
<!-- Form -->
|
|
|
|
|
|
<h3 align="center">Anmeldung</h3>
|
|
|
|
Füllen Sie das Formular für jede anzumeldende Person einzeln aus: <br><br>
|
|
|
|
<!--<br>Es werden nur die ersten beiden Buchstaben Ihres Vor- und Nachnamens sowie Ihr Geburtsdatum elektronisch einfach verschlüsselt übermittelt.-->
|
|
|
|
<?php echo '<form action="'. $_SERVER['PHP_SELF'] .'" method=POST>';?>
|
|
<div class="row uniform 50%">
|
|
<div class="6u 12u(3)">
|
|
<label for="vorname">Vorname:</label>
|
|
<input type="text" name="Vorname" id="Vorname" size=12 maxlength="30"value="" placeholder="Vorname" required />
|
|
</div>
|
|
<div class="6u 12u(3)">
|
|
<label for="Name">Nachname:</label>
|
|
<input type="text"name="Name" size=12 maxlength="30" placeholder="Name" required />
|
|
</div>
|
|
<div class="6u 12u(3)">
|
|
<label for="Email">E-Mail:</label>
|
|
<input type="email" name="Email" id="Email" value="" placeholder="Email" required />
|
|
</div>
|
|
|
|
|
|
|
|
<?php
|
|
|
|
$mintimegeburtstag = strtotime("-5 year", time());
|
|
$mindategeburtstag = date("Y-m-d", $mintimegeburtstag);
|
|
|
|
?>
|
|
|
|
<div class="6u 12u(3)">
|
|
<label for="Tel">Telefon:</label>
|
|
<input type="text" name="Tel" size=4 maxlength="15" id="" value="" placeholder="Telefon" required />
|
|
</div>
|
|
<div class="6u 12u(3)">
|
|
<label for="plz">PLZ:</label>
|
|
<input type="text" name="plz" size=4 maxlength="5" id="" value="" placeholder="PLZ" required />
|
|
</div>
|
|
<div class="6u 12u(3)">
|
|
<label for="ort">Ort:</label>
|
|
<input type="text" name="ort" size=4 maxlength="50" id="" value="" placeholder="Ort" required />
|
|
</div>
|
|
<div class="6u 12u(3)">
|
|
<label for="strasse">Straße:</label>
|
|
<input type="text" name="strasse" size=4 maxlength="50" id="" value="" placeholder="Straße" required />
|
|
</div>
|
|
<div class="6u 12u(3)">
|
|
<label for="Geburtsjahr">Geburtstag:</label>
|
|
<input type="date" class="input" name="Geburtsjahr" id="" value="" max="<?php echo $mindategeburtstag; ?>" placeholder="Geburtsjahr" required />
|
|
</div>
|
|
</div>
|
|
<div class="12u">
|
|
|
|
<label for="AstraImpfung">Ich möchte mich mit dem folgenden Impfstoff impfen lassen:</label>
|
|
<div class="select-wrapper">
|
|
<select name="Impfstoff" id="AstraImpfung" required onchange="updateZeitfenster()" <?php echo empty($verfuegbareImpfstoffe) ? 'disabled' : ''; ?>>
|
|
<?php if (empty($verfuegbareImpfstoffe)): ?>
|
|
<option value="">- Aktuell keine Impfstoffe verfügbar -</option>
|
|
<?php else: ?>
|
|
<option value="">- Bitte auswählen -</option>
|
|
<?php foreach ($verfuegbareImpfstoffe as $impfid => $impfstofftext): ?>
|
|
<option value="<?php echo (int)$impfid; ?>"><?php echo htmlspecialchars($impfstofftext); ?></option>
|
|
<?php endforeach; ?>
|
|
<?php endif; ?>
|
|
</select>
|
|
|
|
<div id="AstraInfobox"></div>
|
|
</div>
|
|
</div>
|
|
<br>
|
|
<div class="12u">
|
|
<label for="impfenzeitraeume">Wählen Sie die möglichen Zeitbereiche für den gewählten Impfstoff:</label>
|
|
<div class="select-wrapper">
|
|
<select name="impfenzeitraeume[]" id="impfenzeitraeume" multiple size="6" required disabled onchange="checkZeitraum()">
|
|
<option value="">- Bitte zuerst Impfstoff auswählen -</option>
|
|
</select>
|
|
<div id="Zeitrauminfo"></div>
|
|
</div>
|
|
</div>
|
|
|
|
<br>
|
|
<label for="impfart">Welche Impfungsart benötigen Sie?</label>
|
|
<div class="select-wrapper">
|
|
<select name="impfart" id="impfart" required onchange="checklastImpf()">
|
|
<option value="">- Bitte auswählen -</option>
|
|
<option value="1">Erstimpfung</option>
|
|
<option value="2">Zweitimpfung</option>
|
|
<option value="3">Drittimpfung</option>
|
|
<option value="4">Viertimpfung</option>
|
|
</select>
|
|
|
|
</div>
|
|
<br>
|
|
<div id="letzteimpfung" style="display:none;">
|
|
|
|
<label for="lastimpf">Wann war Ihre letzte Impfung?</label>
|
|
<div class="select-wrapper">
|
|
<input type="date" class="input" name="letzteimpfung" id="lastimpf" value="" />
|
|
</div>
|
|
<br>
|
|
</div>
|
|
<input type="hidden" name="impfenangebot" value="I" />
|
|
<input type="hidden" name="Patientenart" value="Neupatient" />
|
|
<input type="hidden" name="Impfaufklaerung" value="Nein" />
|
|
<input type="hidden" name="WeitereFragen" value="Nein" />
|
|
<input type="hidden" name="zusammenmit" value="" />
|
|
|
|
<br>
|
|
<div class="12u">
|
|
<ul class="actions">
|
|
<li><input type="submit" name="submitbox" id="submitbox" value="In Warteliste eintragen!" /></li>
|
|
<li><input type="reset" value="Reset" class="alt" /></li>
|
|
</ul>
|
|
|
|
|
|
|
|
<br>
|
|
Impfanfragen werden nur online bearbeitet!<br>
|
|
Ohne Chipkarte sind seit 1.1.2016 keine Kassendienstleistungen mehr möglich. <br>
|
|
Kassenleistungen sind an die gesetzlichen Regelungen gebunden. Fragen Sie Ihre Krankenkasse.<br>
|
|
Datenschutz Belehrung: Elektronische Nachrichten können von Dritten gelesen werden. <br>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</form>
|
|
|
|
</section>
|
|
|
|
<?php
|
|
}
|
|
|
|
|
|
|
|
?>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<script>
|
|
const zeitfensterByImpfstoff = <?php echo $zeitOptionenJson ?: '{}'; ?>;
|
|
const initialZeitraumIds = <?php echo json_encode(impfNormalizeZeitraumIds($_POST["impfenzeitraeume"] ?? ($_POST["impfenzeitraum"] ?? [])), JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); ?>;
|
|
|
|
function isIE() {
|
|
return /Trident\/|MSIE/.test(window.navigator.userAgent);
|
|
}
|
|
|
|
function updateZeitfenster() {
|
|
const impfstoff = document.getElementById('AstraImpfung');
|
|
const zeitraum = document.getElementById('impfenzeitraeume');
|
|
const zeitraumInfo = document.getElementById('Zeitrauminfo');
|
|
const submit = document.getElementById('submitbox');
|
|
const impfstoffId = impfstoff.value;
|
|
const optionen = zeitfensterByImpfstoff[impfstoffId] || [];
|
|
|
|
zeitraum.innerHTML = '';
|
|
if (!impfstoffId || optionen.length === 0) {
|
|
const opt = document.createElement('option');
|
|
opt.value = '';
|
|
opt.textContent = '- Keine Zeitbereiche verfügbar -';
|
|
zeitraum.appendChild(opt);
|
|
zeitraum.disabled = true;
|
|
submit.disabled = true;
|
|
zeitraumInfo.innerHTML = '';
|
|
return;
|
|
}
|
|
|
|
const optDefault = document.createElement('option');
|
|
optDefault.value = '';
|
|
optDefault.textContent = '- Bitte auswählen -';
|
|
zeitraum.appendChild(optDefault);
|
|
optionen.forEach((eintrag) => {
|
|
const opt = document.createElement('option');
|
|
opt.value = String(eintrag.id || '');
|
|
opt.textContent = eintrag.label || '';
|
|
if (initialZeitraumIds.includes(Number(eintrag.id))) {
|
|
opt.selected = true;
|
|
}
|
|
zeitraum.appendChild(opt);
|
|
});
|
|
zeitraum.disabled = false;
|
|
submit.disabled = false;
|
|
zeitraumInfo.innerHTML = '';
|
|
checkZeitraum();
|
|
}
|
|
|
|
function checklastImpf() {
|
|
const impfart = document.getElementById('impfart');
|
|
const letzteBox = document.getElementById('letzteimpfung');
|
|
const letzteInput = document.getElementById('lastimpf');
|
|
if (impfart.value === "" || impfart.value === "1") {
|
|
letzteBox.style.display = "none";
|
|
letzteInput.required = false;
|
|
letzteInput.value = "";
|
|
} else {
|
|
letzteBox.style.display = "block";
|
|
letzteInput.required = true;
|
|
}
|
|
}
|
|
|
|
function checkZeitraum() {
|
|
const info = document.getElementById('Zeitrauminfo');
|
|
const submit = document.getElementById('submitbox');
|
|
const selected = Array.from(document.getElementById('impfenzeitraeume').selectedOptions || []).filter((opt) => opt.value !== '');
|
|
if (selected.length === 0) {
|
|
info.innerHTML = "";
|
|
submit.disabled = true;
|
|
} else {
|
|
info.innerHTML = '<div style="border:5px solid red; margin: 5px; padding: 5px;">Bitte halten Sie sich die gewählten Zeitbereiche frei. Die konkrete Terminanfrage erhalten Sie später per E-Mail.</div>';
|
|
submit.disabled = false;
|
|
}
|
|
}
|
|
|
|
document.addEventListener('DOMContentLoaded', function () {
|
|
if (isIE()) {
|
|
document.getElementById('box').innerHTML = '<div style="border:5px solid red; margin: 5px; padding: 5px;"><h3>Der Internet Explorer unterstützt dieses Formular nicht.<br><b>Bitte nutzen Sie einen alternativen Browser.</b><br>Vielen Dank.</h3></div>';
|
|
return;
|
|
}
|
|
checklastImpf();
|
|
updateZeitfenster();
|
|
checkZeitraum();
|
|
});
|
|
</script>
|
|
|
|
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
include_once('footer.php');
|
|
|
|
?>
|
|
|
|
|
|
|
|
</body>
|
|
</html>
|