Erstellt, Grundgerüst steht
Eigentliche Funktion folgt in reservierung_bestaetigungmaster
parent
26db92adeb
commit
9a64d32046
283
reservierung.php
283
reservierung.php
|
@ -1,125 +1,216 @@
|
||||||
|
<!--
|
||||||
|
TODO (optional):
|
||||||
|
- 80 Zeichen
|
||||||
|
-->
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta lang="de"/>
|
<meta lang="de"/>
|
||||||
<meta charset="utf-8"/>
|
<meta charset="utf-8"/>
|
||||||
<meta name="viewport" content="device=device-width, initial-scaling=1"/>
|
<meta name="viewport" content="device=device-width, initial-scaling=1"/>
|
||||||
<link rel="Stylesheet" type="text/css" href="style.css"/>
|
<link rel="Stylesheet" type="text/css" href="style.css"/>
|
||||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
|
<link rel="Stylesheet" type="text/css" href="reservierung.css"/>
|
||||||
<title>Candle Bibliothek | Reservierung</title>
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
|
||||||
<link rel="icon" href="pictures/candle.png">
|
<title>Candle Bibliothek | Reservierungsbestätigung</title>
|
||||||
<script src="burgerIcon.js"></script>
|
<link rel="icon" href="pictures/candle.png">
|
||||||
<script src="notwendiges_laden.js" defer></script>
|
<script src="notwendiges_laden.js" defer></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header id="header">
|
<header id="header"></header>
|
||||||
<h1 class="kopf" >
|
|
||||||
<br><br>
|
|
||||||
Bibliothek
|
|
||||||
<a href="index.php" id="bildID">
|
|
||||||
<img id="CandleID" src="pictures/candle.png"
|
|
||||||
alt="Bild von einer Kerze" width="200" height="192"/></a>
|
|
||||||
<br><br>
|
|
||||||
Candle
|
|
||||||
</h1>
|
|
||||||
<div>
|
|
||||||
<a id="uberuns" href="uberuns.php">Über Uns</a>
|
|
||||||
<a id="buecher" href="buecher.php">Bücher</a>
|
|
||||||
<a id="meinebuecher" href="anmelden_meinebuecher.php">
|
|
||||||
Meine Bücher</a>
|
|
||||||
<?php
|
|
||||||
session_start();
|
|
||||||
if(isset($_SESSION["eingeloggt"]) && $_SESSION["eingeloggt"] == 1 ){
|
|
||||||
echo "<a id='abmelden' href='abmelden.php'>Abmelden</a>";}
|
|
||||||
?>
|
|
||||||
<form action="suchergebnisse.php">
|
|
||||||
<input type="hidden" name="searchType" value="simple">
|
|
||||||
<input name="searchFor" class="suchleiste" type="search"
|
|
||||||
placeholder="Suche...">
|
|
||||||
<button type="submit" id="buttonID" class="searchButton">
|
|
||||||
<i class="fa fa-search"></i>
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
<a id="erweitertesuche" href="erweitertesuche.php">
|
|
||||||
Erweiterte Suche</a>
|
|
||||||
<a href="anmelden.php" id="warenKorbID">
|
|
||||||
<img id="shoppingCard" src="pictures/einkaufswagen.png"
|
|
||||||
alt="Bild von einem Wagen" width="50" height="50"/>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
|
<!------------------------------------------------------------------------->
|
||||||
|
|
||||||
|
<div class="hauptcontainer">
|
||||||
|
<h1 id="reservationConfirmation_heading">Reservierungsbestätigung</h1>
|
||||||
|
<h2 id="reservationConfirmation_subHeading">
|
||||||
|
Möchten Sie die folgenden Bücher reservieren?
|
||||||
|
</h2>
|
||||||
|
<div id="booksToReserve_container">
|
||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
|
||||||
<div id="reservierung">
|
// Counter für Divider
|
||||||
<h1>Reservierungsbestätigung</h1>
|
$counter = 0;
|
||||||
<div id="reservierung-left">
|
|
||||||
<p id="möchten-sie">Möchten Sie die folgenden Bücher reservieren?</p>
|
|
||||||
<div class="item">
|
|
||||||
<img src="pictures/percy_jackson_diebe_im_olymp.jpg" alt="Percy Jackson: Diebe im Olymp" height="120">
|
|
||||||
<div class="beschreibung">
|
|
||||||
<h2>Percy Jackson: Diebe in Olymp</h2>
|
|
||||||
<div class="b2 green">Sofort Abholbereit</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<hr>
|
// Überprüfen, ob Bücher im Warenkorb liegen
|
||||||
|
if(isset($_SESSION['cart']) && !empty($_SESSION['cart'])) {
|
||||||
|
// Es liegen Bücher im Warenkorb
|
||||||
|
// Alle Elemente im Warenkorb durchgehen
|
||||||
|
foreach ($_SESSION["cart"] as $key=>$item) {
|
||||||
|
|
||||||
<div class="item">
|
$quantity = $item['quantity'];
|
||||||
<img src="pictures/the_hundred_and_one_dalmatians.jpg" alt="The Hundred and One Dalmatians" height="120">
|
|
||||||
<div class="beschreibung">
|
|
||||||
<h2>The Hundred and One Dalmatians</h2>
|
|
||||||
<div class="b2 red">Verfügbar ab: 03.05.2023</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<hr>
|
$sql = '';
|
||||||
|
|
||||||
<div class="item">
|
$servername = "localhost";
|
||||||
<img src="pictures/penguin_highway.jpg" alt="Penguin Highway" height="120">
|
$username = "web_b-3";
|
||||||
<div class="beschreibung">
|
$password = "een7Ao6s";
|
||||||
<h2>Penguin Highway</h2>
|
$dbname = "bibliothek_candle";
|
||||||
<div class="b2 red">Verfügbar ab: 30.04.2023</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<p id="erklärung">Bitte beachten Sie, dass die Reservierung für ein Buch automatisch verfällt, sollten Sie es nicht
|
$connection =
|
||||||
innerhalb von 7 Tagen abholen.</br>
|
mysqli_connect($servername, $username, $password, $dbname);
|
||||||
Die Informationen darüber, ab wann ein Buch verfügbar ist und bis wann es spätestens abgeholt werden muss,
|
|
||||||
finden Sie nach einer erfolgreichen Reservierung auf der Seite "<a href="meinebuecher.php">Meine Bücher</a>".
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<div id="button-container">
|
if (!$connection) {
|
||||||
<a href="warenkorb.php">Zurück zum Warenkorb</a>
|
die("Verbindung fehlgeschlagen: " . mysqli_connect_error());
|
||||||
<a href="reservierung-bestaetigung.html">Bestätigen</a>
|
}
|
||||||
</div>
|
|
||||||
|
|
||||||
|
/* SQL-Befehl vorbereiten */
|
||||||
|
$sql = $connection->prepare("SELECT b.BuchID, b.Titel,
|
||||||
|
b.Bild,
|
||||||
|
IF(b.Anzahl!=0, 'Verfügbar', CONCAT('Verfügbar ab: ',
|
||||||
|
(SELECT DATE_FORMAT(DATE_ADD(ab.Enddatum, INTERVAL 1 DAY)
|
||||||
|
,'%d.%m.%Y') FROM `ausgeliehenes_buch` AS ab
|
||||||
|
WHERE ab.BuchID = b.BuchID
|
||||||
|
ORDER BY ab.Reserviert ASC, ab.Enddatum ASC LIMIT 1)))
|
||||||
|
AS 'Verfügbarkeit' FROM `buch` AS b
|
||||||
|
WHERE b.BuchID = ?
|
||||||
|
GROUP BY b.BuchID;");
|
||||||
|
|
||||||
|
// Parameter binden
|
||||||
|
$sql->bind_param("i", $ID);
|
||||||
|
|
||||||
|
// ID festlegen
|
||||||
|
$ID = $key;
|
||||||
|
|
||||||
|
// SQL-Befehl ausführen
|
||||||
|
$sql->execute();
|
||||||
|
|
||||||
|
// Ergebnis speichern
|
||||||
|
$result = $sql->get_result();
|
||||||
|
|
||||||
|
if ($counter != 0) {
|
||||||
|
echo "<div class='divider'></div>";
|
||||||
|
}
|
||||||
|
if (mysqli_num_rows($result) > 0) {
|
||||||
|
while($row = mysqli_fetch_assoc($result)) {
|
||||||
|
$bookID = $row['BuchID'];
|
||||||
|
$bookCover = $row['Bild'];
|
||||||
|
$bookTitle = $row['Titel'];
|
||||||
|
$bookAuthor = $row['Autor'];
|
||||||
|
$bookAvailability = $row['Verfügbarkeit'];
|
||||||
|
|
||||||
|
// TODO: OnClick auslagern.
|
||||||
|
echo "<div id='book_container$bookID' class='book_container'
|
||||||
|
onclick='open_bookDetails(this.id)'>
|
||||||
|
<div class='bookCover_container'>
|
||||||
|
<img class='bookCover'
|
||||||
|
src='book_covers/$bookCover'
|
||||||
|
alt='Kein Bild vorhanden'>
|
||||||
|
</div>
|
||||||
|
<div class='bookDetails_container'>
|
||||||
|
<h2 class='bookTitle'>$bookTitle</h2>
|
||||||
|
<div class='available_container'>
|
||||||
|
<p id='available_$bookID' class='available'>
|
||||||
|
$bookAvailability</p>
|
||||||
|
<!--TODO: Auslagern-->
|
||||||
|
<script type='text/javascript'
|
||||||
|
language='JavaScript'>
|
||||||
|
(function() {
|
||||||
|
var currentElement = document.
|
||||||
|
getElementById('available_$bookID');
|
||||||
|
var parentDiv =
|
||||||
|
currentElement.parentElement;
|
||||||
|
if (currentElement.innerHTML.trim()
|
||||||
|
== 'Verfügbar') {
|
||||||
|
parentDiv.style.backgroundColor
|
||||||
|
= '#70AD47';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
parentDiv.style.backgroundColor
|
||||||
|
= '#F34343';
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>";
|
||||||
|
$counter++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
echo "Keine Ergebnisse.";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$result) {
|
||||||
|
die("Ungültige SQL-Abfrage: " . mysqli_connect_error());
|
||||||
|
}
|
||||||
|
|
||||||
|
mysqli_close($connection);
|
||||||
|
|
||||||
|
$counter++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Es liegen keine Bücher im Warenkorb
|
||||||
|
echo
|
||||||
|
"Der Warenkorb ist leer,
|
||||||
|
bitte fügen Sie Bücher hinzu.";
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
<p id="reservationConfirmationText">Bitte beachten Sie,
|
||||||
|
dass die Reservierung für ein Buch automatisch verfällt,
|
||||||
|
sollten Sie es nicht innerhalb von 7 Tagen abholen.
|
||||||
|
<br>
|
||||||
|
Die Informationen darüber, ab wann ein Buch verfügbar ist
|
||||||
|
und bis wann es spätestens abgeholt werden muss,
|
||||||
|
finden Sie nach einer erfolgreichen Reservierung auf der Seite
|
||||||
|
<a id="meinebuecher_link" href="meinebuecher.php">
|
||||||
|
„Meine Bücher“</a>.
|
||||||
|
</p>
|
||||||
|
<div id="button_container">
|
||||||
|
<input id="backToCart_button" class="reserve_button" type="button"
|
||||||
|
onclick="open_cart()" value="Zurück zum Warenkorb">
|
||||||
|
<input id="confirm_button" class="reserve_button" type="button"
|
||||||
|
onclick="open_reservationConfirmation()" value="Bestätigen">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!------------------------------------------------------------------------->
|
||||||
|
|
||||||
|
<!-- TODO: Auslagern (falls möglich) -->
|
||||||
|
<script>
|
||||||
|
function open_bookDetails(ID) {
|
||||||
|
var data = new URLSearchParams();
|
||||||
|
data.append("bookID", ID);
|
||||||
|
var url = "http://141.19.142.11/buch_details.php?" +
|
||||||
|
data.toString();
|
||||||
|
location.href = url;
|
||||||
|
}
|
||||||
|
|
||||||
|
function open_reservationConfirmation() {
|
||||||
|
var url = "http://141.19.142.11/reservierung_bestaetigung.php";
|
||||||
|
location.href = url;
|
||||||
|
}
|
||||||
|
|
||||||
|
function open_cart() {
|
||||||
|
var url = "http://141.19.142.11/warenkorb.php";
|
||||||
|
location.href = url;
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<!------------------------------------------------------------------------->
|
||||||
|
|
||||||
<!--Link JS file-->
|
<!--Link JS file-->
|
||||||
<!--If it was small and got big, it calls the function only one time and doesn't do it all the time-->
|
<script src="burgerIcon.js"></script>
|
||||||
|
<!--If it was small and got big,
|
||||||
|
it calls the function only one time and doesn't do it all the time-->
|
||||||
<script>
|
<script>
|
||||||
var widthissue = false;
|
var widthissue = false;
|
||||||
window.addEventListener("resize", function(event) {
|
window.addEventListener("resize", function(event) {
|
||||||
if(window.innerWidth > 800 && widthissue) {
|
if(window.innerWidth > 800 && widthissue) {
|
||||||
widthissue = false
|
widthissue = false
|
||||||
unset()
|
unset()
|
||||||
}
|
}
|
||||||
else if(window.innerWidth < 800) widthissue = true;
|
else if(window.innerWidth < 800) widthissue = true;
|
||||||
})
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<nav id="activeid" class="active"></nav>
|
<nav id="activeid" class="active"></nav>
|
||||||
|
|
||||||
<footer id="footer" class="fuss" ></footer>
|
<footer id="footer" class="fuss" ></footer>
|
||||||
</body>
|
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
Loading…
Reference in New Issue