82 lines
No EOL
3 KiB
PHP
82 lines
No EOL
3 KiB
PHP
<?php
|
|
require_once('../includes/functions.php');
|
|
|
|
checkSession();
|
|
|
|
error_reporting(E_ALL);
|
|
ini_set('display_errors', 1);
|
|
|
|
try {
|
|
$connection = getDbConnection();
|
|
$connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
|
} catch (PDOException $e) {
|
|
die("Error: " . $e->getMessage());
|
|
}
|
|
$marche = $connection->query("SELECT * FROM tipologia")->fetchAll(PDO::FETCH_ASSOC);
|
|
$biciclette = $connection->query("SELECT * FROM modello")->fetchAll(PDO::FETCH_ASSOC);
|
|
?>
|
|
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Admin Dashboard</title>
|
|
<link rel="stylesheet" href="../includes/css/pico.min.css">
|
|
</head>
|
|
<body>
|
|
<main class="container">
|
|
<h1>Admin Dashboard</h1>
|
|
<a href="logout.php" class="button">Logout</a>
|
|
|
|
<!-- Tipologia Section -->
|
|
<h2>Tipologia</h2>
|
|
<form method="get" action="actions/getQuantityTipologia.php">
|
|
<label for="tipologia">Tipologia:</label>
|
|
<select name="tipologia" aria-label="Cerca per tipologia" required>
|
|
<option selected disabled value="">
|
|
Cerca per Tipologia
|
|
</option>
|
|
<?php foreach ($marche as $rw) : ?>
|
|
<option value=<?= $rw["codice"] ?>><?= $rw["nome"] ?></option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
<button type="submit">Cerca</button>
|
|
</form>
|
|
|
|
<!-- Add bici Section -->
|
|
<h2>Aggiungi Bicicletta</h2>
|
|
<form method="post" action="actions/addNewBike.php">
|
|
<label for="descrizione">Descrizione</label>
|
|
<input type="text" name="descrizione" id="descrizione" required>
|
|
<label for="quantita">Quantità</label>
|
|
<input type="text" name="quantita" id="quantita" required>
|
|
<label for="tipologia">Tipologia:</label>
|
|
<select name="tipologia" aria-label="Cerca per tipologia" required>
|
|
<option selected disabled value="">
|
|
Cerca per Tipologia
|
|
</option>
|
|
<?php foreach ($marche as $rw) : ?>
|
|
<option value=<?= $rw["codice"] ?>><?= $rw["nome"] ?></option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
<button type="submit">Aggiungi</button>
|
|
</form>
|
|
|
|
<!--Delete biciclette-->
|
|
<h2>Cancella biciclette</h2>
|
|
<form method="post" action="actions/deleteBike.php">
|
|
<label for="codice">Bici:</label>
|
|
<select name="codice" aria-label="Seleziona bici" required>
|
|
<option selected disabled value="">
|
|
Seleziona Bicicletta
|
|
</option>
|
|
<?php foreach ($biciclette as $rw) : ?>
|
|
<option value=<?= $rw["codice"] ?>><?= $rw["descrizione"] ?></option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
<button type="submit">Cancella</button>
|
|
</form>
|
|
</main>
|
|
</body>
|
|
</html>
|