forked from krisskiemel/ws
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwypozyczenie.php
75 lines (71 loc) · 2.98 KB
/
wypozyczenie.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
if (isset($_COOKIE['kolory'])) {
$kolory = $_COOKIE['kolory'];
} else {
$kolory = "dark";
}
?>
<?php include "db_conn.php";?>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
<title>Wypożyczalnia samochodów</title>
</head>
<body>
<?php
include "menu.php";
$sql = "SELECT w.id_wyp, w.data_wyp, w.data_zwr, concat(k.imie, ' ',k.nazwisko) klient, CONCAT(s.marka, ' ', s.model, ' ', s.nr_rej) samochod
FROM wypozyczenia w, samochody s, klienci k
WHERE w.id_samochodu=s.vin AND w.id_klienta=k.id_klienta
ORDER BY w.data_wyp DESC";
$result = $conn->query($sql);
if ($result->num_rows > 0) {?>
<div class="container-fluid">
<br>
<div class="mb-3">
<a href="wypozycz.php"><button type="button" class="btn btn-<?php echo $kolory?>" >Nowe wypożyczenie</button></a>
</div>
<table class="table table-bordered">
<thead>
<tr>
<th>ID</th>
<th>Data wyp.</th>
<th>Data zwr.</th>
<th>Klient</th>
<th>Samochód</th>
<th></th>
</tr>
</thead>
<?php
echo "<tbody>\n";
while($row = $result->fetch_assoc()) {
if ($row['data_zwr'] == '0000-00-00') {
$data_zwr = "";
$button = "<td><a href='zwroc.php?id_wyp=" . $row["id_wyp"] . "'><button type='button' class='btn btn-$kolory'>Zwrot</button></a></td>";
} else{
$data_zwr = $row['data_zwr'];
$button = "<td></td>";
}
echo "<tr><td>" . $row["id_wyp"] . "</td><td>" . $row["data_wyp"] . "</td><td>" . $data_zwr . "</td><td>" . $row["klient"] . "</td><td>" . $row["samochod"] . "</td>$button</tr>\n";
}
echo "<tbody>\n";
echo "</table>\n";
} else {?>
<div class="container-fluid">
<br>
<div class="mb-3">
<a href="wypozycz.php"><button type="button" class="btn btn-<?php echo $kolory?>" >Nowe wypożyczenie</button></a>
</div>
</div>
<?php
}
$conn->close();
?>
</div>
</div>
</body>
</html>