1
0
mirror of https://github.com/JannikKoester/Tischverwaltung.git synced 2026-01-10 14:50:07 +01:00

Compare commits

...

2 Commits

Author SHA1 Message Date
Jannik
6600f5f381 mehrfachauswahl 2020-08-19 17:23:59 +03:00
Jannik
4ed8831781 Autorefresh 2020-08-19 15:18:22 +03:00
6 changed files with 476 additions and 484 deletions

View File

@@ -494,3 +494,4 @@ if(isset($_POST['getTables']))
}
//Parkplatz 2 Ende
?>

194
index.php
View File

@@ -1,8 +1,8 @@
<!DOCTYPE html>
<body>
<?php
if(!file_exists("settings.php"))
{
if (!file_exists("settings.php")) {
header("location:install.php");
}
@@ -10,8 +10,7 @@ if(!file_exists("settings.php"))
if (session_status() == PHP_SESSION_NONE) {
session_start();
}else
{
} else {
session_destroy();
session_start();
}
@@ -23,10 +22,8 @@ require 'modal.php';
<?php
if(isset($_GET['result']))
{
if($_GET['result'] == "gotrecords" || $_GET['result'] == "loggedin")
{
if (isset($_GET['result'])) {
if ($_GET['result'] == "gotrecords" || $_GET['result'] == "loggedin") {
$selectedjan = '';
$selectedfeb = '';
$selectedmar = '';
@@ -40,8 +37,7 @@ require 'modal.php';
$selectednov = '';
$selecteddez = '';
switch($_SESSION["month_string"])
{
switch ($_SESSION["month_string"]) {
case "Januar":
$selectedjan = 'selected';
@@ -90,15 +86,13 @@ require 'modal.php';
case "Dezember":
$selecteddez = 'selected';
break;
}
echo '<form action="getTables.php" method="post">
<div class="form-group">
<label for="sel1"style="color:white;font-family:Bitter;font-size:24px;">Jahr:</label>
<select class="form-control" name="year">';
<select class="form-control" name="year" onchange="refreshListe()">';
for ($i = 2020; $i < 2030; $i++) {
if ($i == $_SESSION["year"]) {
@@ -106,7 +100,6 @@ require 'modal.php';
} else {
echo '<option value =' . $i . '>' . $i . '</option>';
}
}
@@ -115,7 +108,7 @@ require 'modal.php';
echo '<form action="getTables.php" method="post">
<div class="form-group">
<label for="sel1"style="color:white;font-family:Bitter;font-size:24px;">Monat:</label>
<select class="form-control" name="month">
<select class="form-control" name="month"onchange="refreshListe()">
<option value ="Januar"' . $selectedjan . '>Januar</option>
<option value ="Februar"' . $selectedfeb . '>Februar</option>
<option value ="März"' . $selectedmar . '>März</option>
@@ -135,7 +128,7 @@ require 'modal.php';
echo '<div class="form-group">
<label for="sel1"style="color:white;font-family:Bitter;font-size:24px;">Tag:</label>
<select class="form-control" name="day">';
<select class="form-control" name="day" onchange="refreshListe()">';
for ($i = 1; $i < 32; $i++) {
if ($i == $_SESSION["day"]) {
@@ -146,22 +139,16 @@ require 'modal.php';
}
echo '</select>
</div>
<button id="trigger" name="getTables" type="submit" class="btnchange" id="aktualisiere">Aktualisiere erneut</button>
<button id="refresh" name="getTables" type="submit" class="btnchange"style="display:none;" >Aktualisiere erneut</button>
</form>
<h2 style="color:white;font-family:Bitter; text-align:center;">' . $_SESSION["day_string"] . '. ' . $_SESSION["month_string"] . ' ' . $_SESSION["year"] . ' </h2>';
} else {
}
else{
}
}
else{
} else {
echo '<form action="getTables.php" method="post">
<div class="form-group">
<label for="sel1"style="color:white;font-family:Bitter;font-size:24px;">Jahr:</label>
<select class="form-control" name="year">';
<select class="form-control" name="year" onchange="refreshListe()">';
for ($i = 2020; $i < 2030; $i++) {
if ($i == $_SESSION["year"]) {
@@ -169,14 +156,13 @@ require 'modal.php';
} else {
echo '<option value =' . $i . '>' . $i . '</option>';
}
}
echo '</select>';
echo '<form action="getTables.php" method="post">
<div class="form-group">
<label for="sel1" style="color:white;font-family:Bitter;font-size:24px;">Monat:</label>
<select class="form-control" name="month">
<select class="form-control" name="month"onchange="refreshListe()">
<option value ="Januar">Januar</option>
<option value ="Februar">Februar</option>
<option value ="März">März</option>
@@ -194,7 +180,7 @@ require 'modal.php';
echo '<div class="form-group">
<label for="sel1"style="color:white;font-family:Bitter;font-size:24px;">Tag:</label>
<select class="form-control" name="day">';
<select class="form-control" name="day" onchange="refreshListe()">';
for ($i = 1; $i < 32; $i++) {
if ($i == $_SESSION["day"]) {
@@ -205,10 +191,8 @@ require 'modal.php';
}
echo '</select>
</div>
<button name="getTables" type="submit" class="btnchange">Aktualisieren</button>
<button id="refresh" name="getTables" type="submit" class="btnchange style="display:none;"" >Aktualisiere</button>
</form>';
}
@@ -224,24 +208,17 @@ require 'modal.php';
<div class="container-fluid" style="background-color:lightgrey;opacity: 0.6;border:solid; width:800px;">
<div class="right-tables">
<ul> <li>
<ul>
<li>
<div id="table4">
<?php
if(isset($_GET['result']))
{
if($_GET['result'] == "gotrecords")
{
if($_SESSION["Tisch4"] == "FREI")
{
if (isset($_GET['result'])) {
if ($_GET['result'] == "gotrecords") {
if ($_SESSION["Tisch4"] == "FREI") {
echo '<button id="buttonTable1" type="button" class="btn btn-light" data-toggle="modal" data-target="#myModal4" style="color:green; width:120px;">Tisch 4 <br> ist frei.</button>';
}
else
{
} else {
echo '<button id="buttonTable1" type="button" class="btn btn-light" data-toggle="modal" data-target="#myModal_change4" style="color:red;width:120px;" >Tisch 4 ist belegt durch <br>' . $_SESSION["Tisch4"][4] . '.</button>';
}
}
}
?>
@@ -252,21 +229,13 @@ require 'modal.php';
<li>
<div id="table3">
<?php
if(isset($_GET['result']))
{
if($_GET['result'] == "gotrecords")
{
if($_SESSION["Tisch3"] == "FREI" || $_SESSION["Tisch3"][6] != $_SESSION["year"] )
{
if (isset($_GET['result'])) {
if ($_GET['result'] == "gotrecords") {
if ($_SESSION["Tisch3"] == "FREI" || $_SESSION["Tisch3"][6] != $_SESSION["year"]) {
echo '<button id="buttonTable1" type="button" class="btn btn-light" data-toggle="modal" data-target="#myModal3" style="color:green;opacity: 1.5;width:120px;">Tisch 3 <br> ist frei.</button>';
}
else
{
} else {
echo '<button id="buttonTable1" type="button" class="btn btn-light" data-toggle="modal" data-target="#myModal_change3" style="color:red;width:120px;">Tisch 3 ist belegt durch <br>' . $_SESSION["Tisch3"][4] . '.</button>';
}
}
}
?>
@@ -279,21 +248,13 @@ require 'modal.php';
<div id="table2">
<?php
if(isset($_GET['result']))
{
if($_GET['result'] == "gotrecords")
{
if($_SESSION["Tisch2"] == "FREI")
{
if (isset($_GET['result'])) {
if ($_GET['result'] == "gotrecords") {
if ($_SESSION["Tisch2"] == "FREI") {
echo '<button id="buttonTable1" type="button" class="btn btn-light" data-toggle="modal" data-target="#myModal2" style="color:green;">Tisch 2 <br> ist frei.</button>';
}
else
{
} else {
echo '<button id="buttonTable1" type="button" class="btn btn-light" data-toggle="modal" data-target="#myModal_change2" style="color:red;">Tisch 2 ist belegt durch <br>' . $_SESSION["Tisch2"][4] . '.</button>';
}
}
}
?>
@@ -305,21 +266,13 @@ require 'modal.php';
<div id="table1">
<?php
if(isset($_GET['result']))
{
if($_GET['result'] == "gotrecords")
{
if($_SESSION["Tisch1"] == "FREI")
{
if (isset($_GET['result'])) {
if ($_GET['result'] == "gotrecords") {
if ($_SESSION["Tisch1"] == "FREI") {
echo '<button id="buttonTable1" type="button" class="btn btn-light" data-toggle="modal" data-target="#myModal" style="color:green;">Tisch 1 <br> ist frei.</button>';
}
else
{
} else {
echo '<button id="buttonTable1" type="button" class="btn btn-light" data-toggle="modal" data-target="#myModal_change" style="color:red;">Tisch 1 ist belegt durch <br>' . $_SESSION["Tisch1"][4] . '</button>';
}
}
}
?>
@@ -338,21 +291,13 @@ require 'modal.php';
<div id="table5">
<?php
if(isset($_GET['result']))
{
if($_GET['result'] == "gotrecords")
{
if($_SESSION["Tisch5"] == "FREI")
{
if (isset($_GET['result'])) {
if ($_GET['result'] == "gotrecords") {
if ($_SESSION["Tisch5"] == "FREI") {
echo '<button id="buttonTable1" type="button" class="btn btn-light" data-toggle="modal" data-target="#myModal5" style="color:green;">Tisch 5 <br> ist frei.</button>';
}
else
{
} else {
echo '<button id="buttonTable1" type="button" class="btn btn-light" data-toggle="modal" data-target="#myModal_change5" style="color:red;">Tisch 5 ist belegt durch <br>' . $_SESSION["Tisch5"][4] . '.</button>';
}
}
}
?>
@@ -364,21 +309,13 @@ require 'modal.php';
<div id="table6">
<?php
if(isset($_GET['result']))
{
if($_GET['result'] == "gotrecords")
{
if($_SESSION["Tisch6"] == "FREI")
{
if (isset($_GET['result'])) {
if ($_GET['result'] == "gotrecords") {
if ($_SESSION["Tisch6"] == "FREI") {
echo '<button id="buttonTable1" type="button" class="btn btn-light" data-toggle="modal" data-target="#myModal6" style="color:green;">Tisch 6 <br> ist frei.</button>';
}
else
{
} else {
echo '<button id="buttonTable1" type="button" class="btn btn-light" data-toggle="modal" data-target="#myModal_change6" style="color:red;">Tisch 6 ist belegt durch <br>' . $_SESSION["Tisch6"][4] . '.</button>';
}
}
}
?>
@@ -389,21 +326,13 @@ require 'modal.php';
<li>
<div id="park1" style="margin-left:250px;margin-top:-268px;">
<?php
if(isset($_GET['result']))
{
if($_GET['result'] == "gotrecords")
{
if($_SESSION["Park1"] == "FREI")
{
if (isset($_GET['result'])) {
if ($_GET['result'] == "gotrecords") {
if ($_SESSION["Park1"] == "FREI") {
echo '<button id="buttonTable1" type="button" class="btn btn-light" data-toggle="modal" data-target="#myModalpark1" style="color:green; height:265px;">Parkplatz 1 <br> ist frei.</button>';
}
else
{
} else {
echo '<button id="buttonTable1" type="button" class="btn btn-light" data-toggle="modal" data-target="#myModal_changepark1" style="color:red; height:265px;">Parkplatz 1 ist belegt durch <br>' . $_SESSION["Park1"][4] . '.</button>';
}
}
}
?>
@@ -414,21 +343,13 @@ require 'modal.php';
<li>
<div id="park2" style="margin-left:500px;margin-top:-273px;">
<?php
if(isset($_GET['result']))
{
if($_GET['result'] == "gotrecords")
{
if($_SESSION["Park2"] == "FREI")
{
if (isset($_GET['result'])) {
if ($_GET['result'] == "gotrecords") {
if ($_SESSION["Park2"] == "FREI") {
echo '<button id="buttonTable1" type="button" class="btn btn-light" data-toggle="modal" data-target="#myModalpark2" style="color:green; height:265px;">Parkplatz 2 <br> ist frei.</button>';
}
else
{
} else {
echo '<button id="buttonTable1" type="button" class="btn btn-light" data-toggle="modal" data-target="#myModal_changepark2" style="color:red; height:265px;">Parkplatz 2 ist belegt durch <br>' . $_SESSION["Park2"][4] . '.</button>';
}
}
}
?>
@@ -454,9 +375,9 @@ require 'modal.php';
echo $_SESSION["sucessmessagereplaced"];
$_SESSION["sucessmessagereplaced"] = "";
}
if(isset( $_SESSION["accnotfound"])){
echo $_SESSION["accnotfound"];
$_SESSION["accnotfound"]="";
if (isset($_SESSION["errmsg"])) {
echo $_SESSION["errmsg"];
$_SESSION["errmsg"] = "";
}
@@ -471,10 +392,13 @@ require 'modal.php';
</div>
<br>
<?php
require 'required/footer.php';
?>
</body>
@@ -488,6 +412,7 @@ require 'modal.php';
border: solid;
}
.left-tables ul li {
list-style-type: none;
@@ -501,6 +426,7 @@ require 'modal.php';
border: solid;
}
.right-tables ul li {
list-style-type: none;
display: inline-block;
@@ -521,12 +447,10 @@ require 'modal.php';
height: 50px;
width: 200px;
}
.btnchange:hover {
background: #269d9d;
}
</style>

View File

@@ -5,36 +5,36 @@ require 'settings.php';
if(isset($_POST['reservierenBtnTisch1'])){
$month = $_SESSION["month"];
$day = $_SESSION["day"];
$daystart=intval($_POST['daystart']);
$dayend = intval($_POST['dayend']);
$name = $_POST['reservierterName'];
$year = $_SESSION["year"];
$table = 1;
$sql = "INSERT INTO calenderplanner (year, month, day,reserviert,reserviertvon,tisch)
VALUES ('$year', '$month', '$day', '1', '$name', '$table')";
if ($conn->query($sql) === TRUE) {
echo "New record created successfully";
if($daystart > $dayend)
{
$_SESSION["errmsg"] = '<div class="alert alert-danger">
Fehler! Der Starttag lag über dem Endtag.</div>';
header("location:index.php?result=gotrecords");
}
else{
for ($daystart; $daystart <= $dayend ; $daystart++) {
$sql = "INSERT INTO calenderplanner (year, month, day,reserviert,reserviertvon,tisch)
VALUES ('$year', '$month', '$daystart', '1', '$name', '$table')";
$conn->query($sql);
}
$_SESSION["sucessmessage"] = '<div class="alert alert-success">
Du hast den Tisch erfolgreich reserviert.</div>';
$sql = "SELECT * FROM calenderplanner WHERE month='$month' AND day='$day'AND year='$year' AND tisch='1'";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
//echo $row['uniqueid'].$row['year'].$row['month'].$row['day'].$row['reserviert'].$row['reserviertvon'].$row['tisch']."<br>" ;
$_SESSION["Tisch1"] = array($row['uniqueid'],$row['month'],$row['day'],$row['reserviert'],$row['reserviertvon'],$row['tisch'],$row['year']);
//echo $_SESSION["Tisch3"][6];
}
}
header("location:index.php?result=gotrecords");
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
header("location:index.php");
}
}
else if(isset($_POST['reservierenBtnTisch2'])){
$month = $_SESSION["month"];
$day = $_SESSION["day"];

View File

@@ -1,13 +1,31 @@
<script>
function ValidInputs(){
var e = document.getElementById("daystart");
var daystart = e.options[e.selectedIndex].value;
var b = document.getElementById("dayend");
var dayend = b.options[b.selectedIndex].value;
if(daystart > dayend)
{
document.getElementById("reservierenbutton").disabled = true;
alert("Starttag liegt nach dem Endtag");
}
else{
document.getElementById("reservierenbutton").disabled = false;
}
//alert(daystart +" " + dayend);
}
</script>
<?php
if (session_status() == PHP_SESSION_NONE) {
session_start();
}else
{
}
function selected()
{
}
?>
<!-- Modals für erstes belegen-->
@@ -21,7 +39,7 @@ function selected()
<!-- Modal Header -->
<div class="modal-header">
<h4 class="modal-title">Tisch 1</h4>
<h4 class="modal-title">Tisch 1 neu</h4>
<button type="button" class="close" data-dismiss="modal">&times;</button>
</div>
@@ -31,7 +49,38 @@ function selected()
<h2>Geben Sie Ihren Namen ein:</h2>
<label for="lname">Name:</label>
<input type="text" id="lname" name="reservierterName"required><br><br>
<input class="btn btn-primary" type="submit" value="Reservieren" name="reservierenBtnTisch1" >
<?php
echo '<h3>Reservieren von</h3>';
echo '<select class="form-control" name="daystart" id="daystart" onchange="ValidInputs()">';
for ($i=1; $i <32 ; $i++) {
$month = $_SESSION['month_string'];
if ($i == 1) {
echo "<option value='$i' selected>$i. $month</option>";
} else {
echo "<option value ='$i'> $i. $month</option>";
}
}
echo '</select>';
echo '<h3>bis</h3>';
echo '<select class="form-control" name="dayend" id="dayend" onchange="ValidInputs()">';
for ($i=1; $i <32 ; $i++) {
$month = $_SESSION['month_string'];
if ($i == 1) {
echo "<option value='$i' selected>$i. $month</option>";
} else {
echo "<option value ='$i'> $i. $month</option>";
}
}
echo '</select>';
?>
<br>
<input class="btn btn-primary" type="submit" id="reservierenbutton"value="Reservieren" name="reservierenBtnTisch1" >
</form>
</div>

View File

@@ -8,6 +8,19 @@
<link rel="stylesheet" href="assets/css/Footer-Dark.css">
<link rel="stylesheet" href="assets/css/Header-Dark.css">
<link rel="stylesheet" href="assets/css/styles.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
function refreshListe() {
$("#refresh").click();
}
function ValidInputs(){
//var daystart = $( "#daystart:selected" ).text();
alert("daystart");
}
</script>
</head>
@@ -20,17 +33,6 @@
<ul class="nav navbar-nav">
<li class="nav-item" role="presentation"><a class="nav-link" href="#">Tischverwaltung</a></li>
</ul>
<!--
<div class="navbar-collapse collapse w-100 order-3 dual-collapse2">
<ul class="navbar-nav ml-auto">
<form class="form-inline" action="/action_page.php">
<input type="text" class="form-control" placeholder="Username" style="margin-right:10px;">
<input type="password" class="form-control" placeholder="Password"style="margin-right:10px;">
<button type="submit" class="btnheader">Einloggen</button>
</form>
</ul>
</div>
-->
</nav>
</div>

16
test.php Normal file
View File

@@ -0,0 +1,16 @@
<?php
require './required/header.php';
?>
<label for="cars">Choose a car:</label>
<select id="cars" onchange="test()">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="vw">VW</option>
<option value="audi" selected>Audi</option>
</select>
<script>
function test() {
alert( "ready!" );
}
</script>