1
This commit is contained in:
parent
fa3707bf3d
commit
af39b17050
18
add_club.php
18
add_club.php
@ -11,6 +11,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$number = $_POST['number'] ?? '';
|
||||
$neighborhood = $_POST['neighborhood'] ?? '';
|
||||
$city = $_POST['city'] ?? '';
|
||||
$phone = $_POST['phone'] ?? '';
|
||||
$email = $_POST['email'] ?? '';
|
||||
$description = $_POST['description'] ?? '';
|
||||
|
||||
if (empty($club_name) || empty($address) || empty($city)) {
|
||||
@ -19,9 +21,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
try {
|
||||
$pdo = db();
|
||||
$stmt = $pdo->prepare(
|
||||
'INSERT INTO clubs (name, address, number, neighborhood, city, description) VALUES (?, ?, ?, ?, ?, ?)'
|
||||
'INSERT INTO clubs (name, address, number, neighborhood, city, phone, email, description) VALUES (?, ?, ?, ?, ?, ?, ?, ?)'
|
||||
);
|
||||
$stmt->execute([$club_name, $address, $number, $neighborhood, $city, $description]);
|
||||
$stmt->execute([$club_name, $address, $number, $neighborhood, $city, $phone, $email, $description]);
|
||||
$success_message = 'Club \'' . htmlspecialchars($club_name) . '\' has been added successfully!';
|
||||
} catch (PDOException $e) {
|
||||
$error_message = 'Database error: ' . $e->getMessage();
|
||||
@ -92,13 +94,23 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
<input type="text" class="form-control" id="city" name="city" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6 mb-3">
|
||||
<label for="phone" class="form-label">Telefone</label>
|
||||
<input type="text" class="form-control" id="phone" name="phone">
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
<label for="email" class="form-label">Email</label>
|
||||
<input type="email" class="form-control" id="email" name="email">
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="description" class="form-label">Descrição</label>
|
||||
<textarea class="form-control" id="description" name="description" rows="3"></textarea>
|
||||
</div>
|
||||
<div class="d-flex justify-content-between">
|
||||
<button type="submit" class="btn btn-primary">Add Club</button>
|
||||
<a href="admin.php" class="btn btn-secondary">Back to Dashboard</a>
|
||||
<a href="clubs.php" class="btn btn-secondary">Back to Club List</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@ -34,6 +34,8 @@ try {
|
||||
`number` VARCHAR(50),
|
||||
`neighborhood` VARCHAR(100),
|
||||
`city` VARCHAR(100) NOT NULL,
|
||||
`phone` VARCHAR(100) NULL,
|
||||
`email` VARCHAR(100) NULL,
|
||||
`description` TEXT,
|
||||
`created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
42
index.php
42
index.php
@ -91,31 +91,39 @@
|
||||
<div class="col-lg-4">
|
||||
<h5 class="mb-3"><i class="bi bi-building me-2 text-primary"></i>Clubes Parceiros</h5>
|
||||
<div class="card card-body">
|
||||
<!-- Slider aqui -->
|
||||
<?php
|
||||
require_once 'db/config.php';
|
||||
$pdo = db();
|
||||
$stmt = $pdo->query('SELECT name, description FROM clubs ORDER BY name');
|
||||
$clubs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
?>
|
||||
<?php if (count($clubs) > 0): ?>
|
||||
<div id="clubsCarousel" class="carousel slide" data-bs-ride="carousel">
|
||||
<div class="carousel-inner">
|
||||
<div class="carousel-item active">
|
||||
<h6 class="fw-bold">Santa Cecília Pickleball</h6>
|
||||
<p class="small text-muted">Clube tradicional com excelente estrutura para prática de Pickleball</p>
|
||||
<p class="small mb-1"><i class="bi bi-geo-alt me-2"></i>Av. Santa Cecília, 456 - São Paulo, SP</p>
|
||||
<p class="small mb-1"><i class="bi bi-telephone me-2"></i>(11) 97654-3210</p>
|
||||
<p class="small"><i class="bi bi-envelope me-2"></i>contato@santacecilia.com.br</p>
|
||||
<a href="#" class="btn btn-primary mt-3">Ver Agendamentos Disponíveis</a>
|
||||
</div>
|
||||
<div class="carousel-item">
|
||||
<h6 class="fw-bold">Smash Club</h6>
|
||||
<p class="small text-muted">O melhor lugar para jogar e fazer amigos.</p>
|
||||
<p class="small mb-1"><i class="bi bi-geo-alt me-2"></i>Rua dos Atletas, 123 - Rio de Janeiro, RJ</p>
|
||||
<p class="small mb-1"><i class="bi bi-telephone me-2"></i>(21) 98765-4321</p>
|
||||
<p class="small"><i class="bi bi-envelope me-2"></i>contato@smashclub.com.br</p>
|
||||
<?php foreach ($clubs as $index => $club): ?>
|
||||
<div class="carousel-item <?php echo $index === 0 ? 'active' : ''; ?>">
|
||||
<h6 class="fw-bold"><?php echo htmlspecialchars($club['name']); ?></h6>
|
||||
<p class="small text-muted"><?php echo htmlspecialchars($club['description']); ?></p>
|
||||
<a href="#" class="btn btn-primary mt-3">Ver Agendamentos Disponíveis</a>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php if (count($clubs) > 1): ?>
|
||||
<div class="carousel-indicators-custom">
|
||||
<button type="button" data-bs-target="#clubsCarousel" data-bs-slide-to="0" class="active" aria-current="true" aria-label="Slide 1"></button>
|
||||
<button type="button" data-bs-target="#clubsCarousel" data-bs-slide-to="1" aria-label="Slide 2"></button>
|
||||
<?php foreach ($clubs as $index => $club): ?>
|
||||
<button type="button" data-bs-target="#clubsCarousel" data-bs-slide-to="<?php echo $index; ?>" class="<?php echo $index === 0 ? 'active' : ''; ?>" aria-current="<?php echo $index === 0 ? 'true' : 'false'; ?>" aria-label="Slide <?php echo $index + 1; ?>"></button>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="text-center">
|
||||
<p class="text-muted">Nenhum clube cadastrado ainda.</p>
|
||||
<?php if (isset($_SESSION['user_id']) && $_SESSION['role'] === 'superadmin'): ?>
|
||||
<a href="add_club.php" class="btn btn-primary">Cadastrar Clube</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user