Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
62c0e9ec81 |
79
admin.php
Normal file
79
admin.php
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] === true) {
|
||||||
|
header('Location: dashboard.php');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$error = '';
|
||||||
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||||
|
$username = 'admin'; // Hardcoded for now
|
||||||
|
$password = 'password'; // Hardcoded for now
|
||||||
|
|
||||||
|
if ($_POST['username'] === $username && $_POST['password'] === $password) {
|
||||||
|
$_SESSION['loggedin'] = true;
|
||||||
|
$_SESSION['username'] = $username;
|
||||||
|
header('Location: dashboard.php');
|
||||||
|
exit;
|
||||||
|
} else {
|
||||||
|
$error = 'Invalid username or password.';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Admin Login - Juanda Transport</title>
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="assets/css/custom.css">
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
min-height: 100vh;
|
||||||
|
background-color: #f8f9fa;
|
||||||
|
font-family: 'Poppins', sans-serif;
|
||||||
|
}
|
||||||
|
.login-card {
|
||||||
|
max-width: 400px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="card login-card shadow-sm">
|
||||||
|
<div class="card-body p-5">
|
||||||
|
<h3 class="card-title text-center mb-4">Admin Login</h3>
|
||||||
|
<div class="text-center mb-4">
|
||||||
|
<a href="index.php">
|
||||||
|
<img src="https://www.flatlogic.com/assets/logo-c69533d8159b5d5b5a5d27dc2b6045a3.svg" alt="Juanda Transport Logo" height="40">
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<?php if ($error): ?>
|
||||||
|
<div class="alert alert-danger"><?php echo $error; ?></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<form action="admin.php" method="POST">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="username" class="form-label">Username</label>
|
||||||
|
<input type="text" class="form-control" id="username" name="username" required>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="password" class="form-label">Password</label>
|
||||||
|
<input type="password" class="form-control" id="password" name="password" required>
|
||||||
|
</div>
|
||||||
|
<div class="d-grid">
|
||||||
|
<button type="submit" class="btn btn-primary">Login</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
<div class="text-center mt-3">
|
||||||
|
<small>Use <strong>admin</strong> / <strong>password</strong> to login.</small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
95
admin_add_tour.php
Normal file
95
admin_add_tour.php
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
<?php
|
||||||
|
require_once 'includes/admin_header.php';
|
||||||
|
require_once 'db/config.php';
|
||||||
|
|
||||||
|
$name = $destination = $duration_days = $price = $description = '';
|
||||||
|
$errors = [];
|
||||||
|
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
|
$name = trim($_POST['name'] ?? '');
|
||||||
|
$destination = trim($_POST['destination'] ?? '');
|
||||||
|
$duration_days = trim($_POST['duration_days'] ?? '');
|
||||||
|
$price = trim($_POST['price'] ?? '');
|
||||||
|
$description = trim($_POST['description'] ?? '');
|
||||||
|
|
||||||
|
if (empty($name)) {
|
||||||
|
$errors[] = 'Package name is required.';
|
||||||
|
}
|
||||||
|
if (empty($destination)) {
|
||||||
|
$errors[] = 'Destination is required.';
|
||||||
|
}
|
||||||
|
if (!filter_var($duration_days, FILTER_VALIDATE_INT, ["options" => ["min_range" => 1]])) {
|
||||||
|
$errors[] = 'Duration must be a positive number.';
|
||||||
|
}
|
||||||
|
if (!filter_var($price, FILTER_VALIDATE_INT, ["options" => ["min_range" => 0]])) {
|
||||||
|
$errors[] = 'Price must be a non-negative number.';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($errors)) {
|
||||||
|
try {
|
||||||
|
$pdo = db();
|
||||||
|
$sql = "INSERT INTO tour_packages (name, destination, duration_days, price, description, image_url) VALUES (?, ?, ?, ?, ?, ?)";
|
||||||
|
$stmt = $pdo->prepare($sql);
|
||||||
|
// Using a placeholder image for now
|
||||||
|
$placeholder_image = 'assets/images/tour_placeholder.png';
|
||||||
|
$stmt->execute([$name, $destination, $duration_days, $price, $description, $placeholder_image]);
|
||||||
|
|
||||||
|
header("Location: admin_tours.php?success=1");
|
||||||
|
exit;
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
$errors[] = "Database error: " . $e->getMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
require_once 'includes/admin_sidebar.php';
|
||||||
|
?>
|
||||||
|
|
||||||
|
<h1 class="h2">Add New Tour Package</h1>
|
||||||
|
<p>Fill out the form to add a new tour package.</p>
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<h5 class="mb-0">Tour Package Details</h5>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<?php if (!empty($errors)): ?>
|
||||||
|
<div class="alert alert-danger">
|
||||||
|
<?php foreach ($errors as $error): ?>
|
||||||
|
<p class="mb-0"><?php echo htmlspecialchars($error); ?></p>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<form action="admin_add_tour.php" method="POST">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="name" class="form-label">Package Name</label>
|
||||||
|
<input type="text" class="form-control" id="name" name="name" value="<?php echo htmlspecialchars($name); ?>" required>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="destination" class="form-label">Destination</label>
|
||||||
|
<input type="text" class="form-control" id="destination" name="destination" value="<?php echo htmlspecialchars($destination); ?>" required>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6 mb-3">
|
||||||
|
<label for="duration_days" class="form-label">Duration (days)</label>
|
||||||
|
<input type="number" class="form-control" id="duration_days" name="duration_days" value="<?php echo htmlspecialchars($duration_days); ?>" required min="1">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6 mb-3">
|
||||||
|
<label for="price" class="form-label">Price (Rp)</label>
|
||||||
|
<input type="number" class="form-control" id="price" name="price" value="<?php echo htmlspecialchars($price); ?>" required min="0">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="description" class="form-label">Description</label>
|
||||||
|
<textarea class="form-control" id="description" name="description" rows="3"><?php echo htmlspecialchars($description); ?></textarea>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<button type="submit" class="btn btn-primary">Add Tour Package</button>
|
||||||
|
<a href="admin_tours.php" class="btn btn-secondary">Cancel</a>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
require_once 'includes/admin_footer.php';
|
||||||
|
?>
|
||||||
101
admin_add_vehicle.php
Normal file
101
admin_add_vehicle.php
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
<?php
|
||||||
|
require_once 'includes/admin_header.php';
|
||||||
|
require_once 'db/config.php';
|
||||||
|
|
||||||
|
$name = $type = $capacity = $price_per_day = '';
|
||||||
|
$errors = [];
|
||||||
|
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
|
$name = trim($_POST['name'] ?? '');
|
||||||
|
$type = trim($_POST['type'] ?? '');
|
||||||
|
$capacity = trim($_POST['capacity'] ?? '');
|
||||||
|
$price_per_day = trim($_POST['price_per_day'] ?? '');
|
||||||
|
$is_available = isset($_POST['is_available']) ? 1 : 0;
|
||||||
|
|
||||||
|
if (empty($name)) {
|
||||||
|
$errors[] = 'Vehicle name is required.';
|
||||||
|
}
|
||||||
|
if (empty($type)) {
|
||||||
|
$errors[] = 'Vehicle type is required.';
|
||||||
|
}
|
||||||
|
if (!filter_var($capacity, FILTER_VALIDATE_INT, ["options" => ["min_range" => 1]])) {
|
||||||
|
$errors[] = 'Capacity must be a positive number.';
|
||||||
|
}
|
||||||
|
if (!filter_var($price_per_day, FILTER_VALIDATE_INT, ["options" => ["min_range" => 0]])) {
|
||||||
|
$errors[] = 'Price must be a non-negative number.';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($errors)) {
|
||||||
|
try {
|
||||||
|
$pdo = db();
|
||||||
|
$sql = "INSERT INTO vehicles (name, type, capacity, price_per_day, is_available, image_url) VALUES (?, ?, ?, ?, ?, ?)";
|
||||||
|
$stmt = $pdo->prepare($sql);
|
||||||
|
// Using a placeholder image for now
|
||||||
|
$placeholder_image = 'assets/images/vehicle_placeholder.png';
|
||||||
|
$stmt->execute([$name, $type, $capacity, $price_per_day, $is_available, $placeholder_image]);
|
||||||
|
|
||||||
|
header("Location: admin_vehicles.php?success=1");
|
||||||
|
exit;
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
$errors[] = "Database error: " . $e->getMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
require_once 'includes/admin_sidebar.php';
|
||||||
|
?>
|
||||||
|
|
||||||
|
<h1 class="h2">Add New Vehicle</h1>
|
||||||
|
<p>Fill out the form to add a new vehicle to the fleet.</p>
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<h5 class="mb-0">Vehicle Details</h5>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<?php if (!empty($errors)): ?>
|
||||||
|
<div class="alert alert-danger">
|
||||||
|
<?php foreach ($errors as $error): ?>
|
||||||
|
<p class="mb-0"><?php echo htmlspecialchars($error); ?></p>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<form action="admin_add_vehicle.php" method="POST">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="name" class="form-label">Vehicle Name</label>
|
||||||
|
<input type="text" class="form-control" id="name" name="name" value="<?php echo htmlspecialchars($name); ?>" required>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="type" class="form-label">Vehicle Type</label>
|
||||||
|
<select class="form-select" id="type" name="type" required>
|
||||||
|
<option value="" disabled <?php if(empty($type)) echo 'selected'; ?>>Select a type</option>
|
||||||
|
<option value="mpv" <?php if($type === 'mpv') echo 'selected'; ?>>MPV</option>
|
||||||
|
<option value="suv" <?php if($type === 'suv') echo 'selected'; ?>>SUV</option>
|
||||||
|
<option value="sedan" <?php if($type === 'sedan') echo 'selected'; ?>>Sedan</option>
|
||||||
|
<option value="minibus" <?php if($type === 'minibus') echo 'selected'; ?>>Minibus</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6 mb-3">
|
||||||
|
<label for="capacity" class="form-label">Capacity (seats)</label>
|
||||||
|
<input type="number" class="form-control" id="capacity" name="capacity" value="<?php echo htmlspecialchars($capacity); ?>" required min="1">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6 mb-3">
|
||||||
|
<label for="price_per_day" class="form-label">Price per Day (Rp)</label>
|
||||||
|
<input type="number" class="form-control" id="price_per_day" name="price_per_day" value="<?php echo htmlspecialchars($price_per_day); ?>" required min="0">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3 form-check">
|
||||||
|
<input type="checkbox" class="form-check-input" id="is_available" name="is_available" value="1" checked>
|
||||||
|
<label class="form-check-label" for="is_available">Available for rent</label>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<button type="submit" class="btn btn-primary">Add Vehicle</button>
|
||||||
|
<a href="admin_vehicles.php" class="btn btn-secondary">Cancel</a>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
require_once 'includes/admin_footer.php';
|
||||||
|
?>
|
||||||
147
admin_bookings.php
Normal file
147
admin_bookings.php
Normal file
@ -0,0 +1,147 @@
|
|||||||
|
<?php
|
||||||
|
require_once 'includes/admin_header.php';
|
||||||
|
require_once 'db/config.php';
|
||||||
|
|
||||||
|
$pdo = db();
|
||||||
|
|
||||||
|
// Handle vehicle booking status update
|
||||||
|
if (isset($_POST['update_vehicle_booking'])) {
|
||||||
|
$booking_id = $_POST['booking_id'];
|
||||||
|
$status = $_POST['status'];
|
||||||
|
$stmt = $pdo->prepare("UPDATE bookings SET status = ? WHERE id = ?");
|
||||||
|
$stmt->execute([$status, $booking_id]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle tour booking status update
|
||||||
|
if (isset($_POST['update_tour_booking'])) {
|
||||||
|
$booking_id = $_POST['booking_id'];
|
||||||
|
$status = $_POST['status'];
|
||||||
|
$stmt = $pdo->prepare("UPDATE tour_bookings SET status = ? WHERE id = ?");
|
||||||
|
$stmt->execute([$status, $booking_id]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fetch vehicle bookings
|
||||||
|
$stmt_bookings = $pdo->query('SELECT b.*, v.name as vehicle_name FROM bookings b JOIN vehicles v ON b.vehicle_id = v.id ORDER BY b.start_date DESC');
|
||||||
|
$vehicle_bookings = $stmt_bookings->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
// Fetch tour bookings
|
||||||
|
$stmt_tour_bookings = $pdo->query('SELECT tb.*, tp.name as package_name FROM tour_bookings tb JOIN tour_packages tp ON tb.tour_package_id = tp.id ORDER BY tb.tour_date DESC');
|
||||||
|
$tour_bookings = $stmt_tour_bookings->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
$statuses = ['pending', 'confirmed', 'completed', 'cancelled'];
|
||||||
|
|
||||||
|
require_once 'includes/admin_sidebar.php';
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="container-fluid">
|
||||||
|
<h1 class="h2">Manage Bookings</h1>
|
||||||
|
<p>View and manage customer bookings for vehicles and tours.</p>
|
||||||
|
|
||||||
|
<div class="card mb-4">
|
||||||
|
<div class="card-header">
|
||||||
|
<h5 class="mb-0">Vehicle Rentals</h5>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Customer</th>
|
||||||
|
<th>Vehicle</th>
|
||||||
|
<th>Dates</th>
|
||||||
|
<th>Status</th>
|
||||||
|
<th>Action</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php if (empty($vehicle_bookings)): ?>
|
||||||
|
<tr>
|
||||||
|
<td colspan="5" class="text-center">No vehicle bookings found.</td>
|
||||||
|
</tr>
|
||||||
|
<?php else: ?>
|
||||||
|
<?php foreach ($vehicle_bookings as $booking): ?>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<?php echo htmlspecialchars($booking['customer_name']); ?><br>
|
||||||
|
<small class="text-muted"><?php echo htmlspecialchars($booking['customer_email']); ?></small>
|
||||||
|
</td>
|
||||||
|
<td><?php echo htmlspecialchars($booking['vehicle_name']); ?></td>
|
||||||
|
<td><?php echo htmlspecialchars($booking['start_date']); ?> to <?php echo htmlspecialchars($booking['end_date']); ?></td>
|
||||||
|
<td>
|
||||||
|
<form method="POST" action="">
|
||||||
|
<input type="hidden" name="booking_id" value="<?php echo $booking['id']; ?>">
|
||||||
|
<select name="status" class="form-select form-select-sm">
|
||||||
|
<?php foreach ($statuses as $status): ?>
|
||||||
|
<option value="<?php echo $status; ?>" <?php echo ($booking['status'] == $status) ? 'selected' : ''; ?>><?php echo ucfirst($status); ?></option>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<button type="submit" name="update_vehicle_booking" class="btn btn-primary btn-sm">Update</button>
|
||||||
|
</form>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<h5 class="mb-0">Tour Package Bookings</h5>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Customer</th>
|
||||||
|
<th>Tour Package</th>
|
||||||
|
<th>Tour Date</th>
|
||||||
|
<th># of People</th>
|
||||||
|
<th>Status</th>
|
||||||
|
<th>Action</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php if (empty($tour_bookings)): ?>
|
||||||
|
<tr>
|
||||||
|
<td colspan="6" class="text-center">No tour bookings found.</td>
|
||||||
|
</tr>
|
||||||
|
<?php else: ?>
|
||||||
|
<?php foreach ($tour_bookings as $booking): ?>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<?php echo htmlspecialchars($booking['customer_name']); ?><br>
|
||||||
|
<small class="text-muted"><?php echo htmlspecialchars($booking['customer_email']); ?></small>
|
||||||
|
</td>
|
||||||
|
<td><?php echo htmlspecialchars($booking['package_name']); ?></td>
|
||||||
|
<td><?php echo htmlspecialchars($booking['tour_date']); ?></td>
|
||||||
|
<td><?php echo htmlspecialchars($booking['num_people']); ?></td>
|
||||||
|
<td>
|
||||||
|
<form method="POST" action="">
|
||||||
|
<input type="hidden" name="booking_id" value="<?php echo $booking['id']; ?>">
|
||||||
|
<select name="status" class="form-select form-select-sm">
|
||||||
|
<?php foreach ($statuses as $status): ?>
|
||||||
|
<option value="<?php echo $status; ?>" <?php echo ($booking['status'] == $status) ? 'selected' : ''; ?>><?php echo ucfirst($status); ?></option>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<button type="submit" name="update_tour_booking" class="btn btn-primary btn-sm">Update</button>
|
||||||
|
</form>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php require_once 'includes/admin_footer.php'; ?>
|
||||||
28
admin_delete_tour.php
Normal file
28
admin_delete_tour.php
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
require_once 'db/config.php';
|
||||||
|
|
||||||
|
// If the user is not logged in, redirect to the login page.
|
||||||
|
if (!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] !== true) {
|
||||||
|
header('Location: admin.php');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$id = $_GET['id'] ?? null;
|
||||||
|
if (!$id) {
|
||||||
|
header('Location: admin_tours.php');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$pdo = db();
|
||||||
|
$stmt = $pdo->prepare("DELETE FROM tour_packages WHERE id = ?");
|
||||||
|
$stmt->execute([$id]);
|
||||||
|
|
||||||
|
header("Location: admin_tours.php?success=3");
|
||||||
|
exit;
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
// Redirect with an error message
|
||||||
|
header("Location: admin_tours.php?error=db");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
28
admin_delete_vehicle.php
Normal file
28
admin_delete_vehicle.php
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
require_once 'db/config.php';
|
||||||
|
|
||||||
|
// If the user is not logged in, redirect to the login page.
|
||||||
|
if (!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] !== true) {
|
||||||
|
header('Location: admin.php');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$id = $_GET['id'] ?? null;
|
||||||
|
if (!$id) {
|
||||||
|
header('Location: admin_vehicles.php');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$pdo = db();
|
||||||
|
$stmt = $pdo->prepare("DELETE FROM vehicles WHERE id = ?");
|
||||||
|
$stmt->execute([$id]);
|
||||||
|
|
||||||
|
header("Location: admin_vehicles.php?success=3");
|
||||||
|
exit;
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
// Redirect with an error message
|
||||||
|
header("Location: admin_vehicles.php?error=db");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
119
admin_edit_tour.php
Normal file
119
admin_edit_tour.php
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
<?php
|
||||||
|
require_once 'includes/admin_header.php';
|
||||||
|
require_once 'db/config.php';
|
||||||
|
|
||||||
|
$id = $_GET['id'] ?? null;
|
||||||
|
if (!$id) {
|
||||||
|
header('Location: admin_tours.php');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$name = $destination = $duration_days = $price = $description = '';
|
||||||
|
$errors = [];
|
||||||
|
|
||||||
|
try {
|
||||||
|
$pdo = db();
|
||||||
|
$stmt = $pdo->prepare("SELECT * FROM tour_packages WHERE id = ?");
|
||||||
|
$stmt->execute([$id]);
|
||||||
|
$tour = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
if (!$tour) {
|
||||||
|
header('Location: admin_tours.php?error=notfound');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$name = $tour['name'];
|
||||||
|
$destination = $tour['destination'];
|
||||||
|
$duration_days = $tour['duration_days'];
|
||||||
|
$price = $tour['price'];
|
||||||
|
$description = $tour['description'];
|
||||||
|
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
$errors[] = "Database error: " . $e->getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
|
$name = trim($_POST['name'] ?? '');
|
||||||
|
$destination = trim($_POST['destination'] ?? '');
|
||||||
|
$duration_days = trim($_POST['duration_days'] ?? '');
|
||||||
|
$price = trim($_POST['price'] ?? '');
|
||||||
|
$description = trim($_POST['description'] ?? '');
|
||||||
|
|
||||||
|
if (empty($name)) {
|
||||||
|
$errors[] = 'Package name is required.';
|
||||||
|
}
|
||||||
|
if (empty($destination)) {
|
||||||
|
$errors[] = 'Destination is required.';
|
||||||
|
}
|
||||||
|
if (!filter_var($duration_days, FILTER_VALIDATE_INT, ["options" => ["min_range" => 1]])) {
|
||||||
|
$errors[] = 'Duration must be a positive number.';
|
||||||
|
}
|
||||||
|
if (!filter_var($price, FILTER_VALIDATE_INT, ["options" => ["min_range" => 0]])) {
|
||||||
|
$errors[] = 'Price must be a non-negative number.';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($errors)) {
|
||||||
|
try {
|
||||||
|
$sql = "UPDATE tour_packages SET name = ?, destination = ?, duration_days = ?, price = ?, description = ? WHERE id = ?";
|
||||||
|
$stmt = $pdo->prepare($sql);
|
||||||
|
$stmt->execute([$name, $destination, $duration_days, $price, $description, $id]);
|
||||||
|
|
||||||
|
header("Location: admin_tours.php?success=2");
|
||||||
|
exit;
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
$errors[] = "Database error: " . $e->getMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
require_once 'includes/admin_sidebar.php';
|
||||||
|
?>
|
||||||
|
|
||||||
|
<h1 class="h2">Edit Tour Package</h1>
|
||||||
|
<p>Update the details for the tour package below.</p>
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<h5 class="mb-0">Tour Package Details</h5>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<?php if (!empty($errors)): ?>
|
||||||
|
<div class="alert alert-danger">
|
||||||
|
<?php foreach ($errors as $error): ?>
|
||||||
|
<p class="mb-0"><?php echo htmlspecialchars($error); ?></p>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<form action="admin_edit_tour.php?id=<?php echo $id; ?>" method="POST">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="name" class="form-label">Package Name</label>
|
||||||
|
<input type="text" class="form-control" id="name" name="name" value="<?php echo htmlspecialchars($name); ?>" required>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="destination" class="form-label">Destination</label>
|
||||||
|
<input type="text" class="form-control" id="destination" name="destination" value="<?php echo htmlspecialchars($destination); ?>" required>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6 mb-3">
|
||||||
|
<label for="duration_days" class="form-label">Duration (days)</label>
|
||||||
|
<input type="number" class="form-control" id="duration_days" name="duration_days" value="<?php echo htmlspecialchars($duration_days); ?>" required min="1">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6 mb-3">
|
||||||
|
<label for="price" class="form-label">Price (Rp)</label>
|
||||||
|
<input type="number" class="form-control" id="price" name="price" value="<?php echo htmlspecialchars($price); ?>" required min="0">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="description" class="form-label">Description</label>
|
||||||
|
<textarea class="form-control" id="description" name="description" rows="3"><?php echo htmlspecialchars($description); ?></textarea>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<button type="submit" class="btn btn-primary">Save Changes</button>
|
||||||
|
<a href="admin_tours.php" class="btn btn-secondary">Cancel</a>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
require_once 'includes/admin_footer.php';
|
||||||
|
?>
|
||||||
125
admin_edit_vehicle.php
Normal file
125
admin_edit_vehicle.php
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
<?php
|
||||||
|
require_once 'includes/admin_header.php';
|
||||||
|
require_once 'db/config.php';
|
||||||
|
|
||||||
|
$id = $_GET['id'] ?? null;
|
||||||
|
if (!$id) {
|
||||||
|
header('Location: admin_vehicles.php');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$name = $type = $capacity = $price_per_day = '';
|
||||||
|
$is_available = 0;
|
||||||
|
$errors = [];
|
||||||
|
|
||||||
|
try {
|
||||||
|
$pdo = db();
|
||||||
|
$stmt = $pdo->prepare("SELECT * FROM vehicles WHERE id = ?");
|
||||||
|
$stmt->execute([$id]);
|
||||||
|
$vehicle = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
if (!$vehicle) {
|
||||||
|
header('Location: admin_vehicles.php?error=notfound');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$name = $vehicle['name'];
|
||||||
|
$type = $vehicle['type'];
|
||||||
|
$capacity = $vehicle['capacity'];
|
||||||
|
$price_per_day = $vehicle['price_per_day'];
|
||||||
|
$is_available = $vehicle['is_available'];
|
||||||
|
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
$errors[] = "Database error: " . $e->getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
|
$name = trim($_POST['name'] ?? '');
|
||||||
|
$type = trim($_POST['type'] ?? '');
|
||||||
|
$capacity = trim($_POST['capacity'] ?? '');
|
||||||
|
$price_per_day = trim($_POST['price_per_day'] ?? '');
|
||||||
|
$is_available = isset($_POST['is_available']) ? 1 : 0;
|
||||||
|
|
||||||
|
if (empty($name)) {
|
||||||
|
$errors[] = 'Vehicle name is required.';
|
||||||
|
}
|
||||||
|
if (empty($type)) {
|
||||||
|
$errors[] = 'Vehicle type is required.';
|
||||||
|
}
|
||||||
|
if (!filter_var($capacity, FILTER_VALIDATE_INT, ["options" => ["min_range" => 1]])) {
|
||||||
|
$errors[] = 'Capacity must be a positive number.';
|
||||||
|
}
|
||||||
|
if (!filter_var($price_per_day, FILTER_VALIDATE_INT, ["options" => ["min_range" => 0]])) {
|
||||||
|
$errors[] = 'Price must be a non-negative number.';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($errors)) {
|
||||||
|
try {
|
||||||
|
$sql = "UPDATE vehicles SET name = ?, type = ?, capacity = ?, price_per_day = ?, is_available = ? WHERE id = ?";
|
||||||
|
$stmt = $pdo->prepare($sql);
|
||||||
|
$stmt->execute([$name, $type, $capacity, $price_per_day, $is_available, $id]);
|
||||||
|
|
||||||
|
header("Location: admin_vehicles.php?success=2");
|
||||||
|
exit;
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
$errors[] = "Database error: " . $e->getMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
require_once 'includes/admin_sidebar.php';
|
||||||
|
?>
|
||||||
|
|
||||||
|
<h1 class="h2">Edit Vehicle</h1>
|
||||||
|
<p>Update the details for the vehicle below.</p>
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<h5 class="mb-0">Vehicle Details</h5>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<?php if (!empty($errors)): ?>
|
||||||
|
<div class="alert alert-danger">
|
||||||
|
<?php foreach ($errors as $error): ?>
|
||||||
|
<p class="mb-0"><?php echo htmlspecialchars($error); ?></p>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<form action="admin_edit_vehicle.php?id=<?php echo $id; ?>" method="POST">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="name" class="form-label">Vehicle Name</label>
|
||||||
|
<input type="text" class="form-control" id="name" name="name" value="<?php echo htmlspecialchars($name); ?>" required>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="type" class="form-label">Vehicle Type</label>
|
||||||
|
<select class="form-select" id="type" name="type" required>
|
||||||
|
<option value="mpv" <?php if($type === 'mpv') echo 'selected'; ?>>MPV</option>
|
||||||
|
<option value="suv" <?php if($type === 'suv') echo 'selected'; ?>>SUV</option>
|
||||||
|
<option value="sedan" <?php if($type === 'sedan') echo 'selected'; ?>>Sedan</option>
|
||||||
|
<option value="minibus" <?php if($type === 'minibus') echo 'selected'; ?>>Minibus</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6 mb-3">
|
||||||
|
<label for="capacity" class="form-label">Capacity (seats)</label>
|
||||||
|
<input type="number" class="form-control" id="capacity" name="capacity" value="<?php echo htmlspecialchars($capacity); ?>" required min="1">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6 mb-3">
|
||||||
|
<label for="price_per_day" class="form-label">Price per Day (Rp)</label>
|
||||||
|
<input type="number" class="form-control" id="price_per_day" name="price_per_day" value="<?php echo htmlspecialchars($price_per_day); ?>" required min="0">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3 form-check">
|
||||||
|
<input type="checkbox" class="form-check-input" id="is_available" name="is_available" value="1" <?php if($is_available) echo 'checked'; ?>>
|
||||||
|
<label class="form-check-label" for="is_available">Available for rent</label>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<button type="submit" class="btn btn-primary">Save Changes</button>
|
||||||
|
<a href="admin_vehicles.php" class="btn btn-secondary">Cancel</a>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
require_once 'includes/admin_footer.php';
|
||||||
|
?>
|
||||||
69
admin_tours.php
Normal file
69
admin_tours.php
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
<?php
|
||||||
|
require_once 'includes/admin_header.php';
|
||||||
|
require_once 'db/config.php';
|
||||||
|
|
||||||
|
// Fetch tour packages from the database
|
||||||
|
try {
|
||||||
|
$pdo = db();
|
||||||
|
$stmt = $pdo->query('SELECT * FROM tour_packages ORDER BY name ASC');
|
||||||
|
$tours = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
$error_message = "Database error: " . $e->getMessage();
|
||||||
|
$tours = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
require_once 'includes/admin_sidebar.php';
|
||||||
|
?>
|
||||||
|
|
||||||
|
<h1 class="h2">Manage Tour Packages</h1>
|
||||||
|
<p>Add, edit, or remove tour packages.</p>
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header d-flex justify-content-between align-items-center">
|
||||||
|
<h5 class="mb-0">Tour Package List</h5>
|
||||||
|
<a href="admin_add_tour.php" class="btn btn-primary"><i class="bi bi-plus-circle me-2"></i>Add Tour Package</a>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<?php if (isset($error_message)): ?>
|
||||||
|
<div class="alert alert-danger">
|
||||||
|
<?php echo htmlspecialchars($error_message); ?>
|
||||||
|
</div>
|
||||||
|
<?php elseif (empty($tours)): ?>
|
||||||
|
<div class="alert alert-info">
|
||||||
|
No tour packages found. <a href="admin_add_tour.php">Add one now</a>.
|
||||||
|
</div>
|
||||||
|
<?php else: ?>
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-striped table-hover">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Destination</th>
|
||||||
|
<th>Duration (days)</th>
|
||||||
|
<th>Price</th>
|
||||||
|
<th>Actions</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach ($tours as $tour): ?>
|
||||||
|
<tr>
|
||||||
|
<td><?php echo htmlspecialchars($tour['name']); ?></td>
|
||||||
|
<td><?php echo htmlspecialchars($tour['destination']); ?></td>
|
||||||
|
<td><?php echo htmlspecialchars($tour['duration_days']); ?></td>
|
||||||
|
<td>Rp <?php echo number_format($tour['price'], 0, ',', '.'); ?></td>
|
||||||
|
<td>
|
||||||
|
<a href="admin_edit_tour.php?id=<?php echo $tour['id']; ?>" class="btn btn-sm btn-outline-primary"><i class="bi bi-pencil-square"></i></a>
|
||||||
|
<a href="admin_delete_tour.php?id=<?php echo $tour['id']; ?>" class="btn btn-sm btn-outline-danger" onclick="return confirm('Are you sure you want to delete this tour package?');"><i class="bi bi-trash"></i></a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
require_once 'includes/admin_footer.php';
|
||||||
|
?>
|
||||||
71
admin_vehicles.php
Normal file
71
admin_vehicles.php
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
<?php
|
||||||
|
require_once 'includes/admin_header.php';
|
||||||
|
require_once 'db/config.php';
|
||||||
|
|
||||||
|
// Fetch vehicles from the database
|
||||||
|
try {
|
||||||
|
$pdo = db();
|
||||||
|
$stmt = $pdo->query('SELECT * FROM vehicles ORDER BY name ASC');
|
||||||
|
$vehicles = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
$error_message = "Database error: " . $e->getMessage();
|
||||||
|
$vehicles = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
require_once 'includes/admin_sidebar.php';
|
||||||
|
?>
|
||||||
|
|
||||||
|
<h1 class="h2">Manage Vehicles</h1>
|
||||||
|
<p>Add, edit, or remove vehicles from your fleet.</p>
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header d-flex justify-content-between align-items-center">
|
||||||
|
<h5 class="mb-0">Vehicle List</h5>
|
||||||
|
<a href="admin_add_vehicle.php" class="btn btn-primary"><i class="bi bi-plus-circle me-2"></i>Add Vehicle</a>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<?php if (isset($error_message)): ?>
|
||||||
|
<div class="alert alert-danger">
|
||||||
|
<?php echo htmlspecialchars($error_message); ?>
|
||||||
|
</div>
|
||||||
|
<?php elseif (empty($vehicles)): ?>
|
||||||
|
<div class="alert alert-info">
|
||||||
|
No vehicles found. <a href="admin_add_vehicle.php">Add one now</a>.
|
||||||
|
</div>
|
||||||
|
<?php else: ?>
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-striped table-hover">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Type</th>
|
||||||
|
<th>Capacity</th>
|
||||||
|
<th>Price per Day</th>
|
||||||
|
<th>Status</th>
|
||||||
|
<th>Actions</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach ($vehicles as $vehicle): ?>
|
||||||
|
<tr>
|
||||||
|
<td><?php echo htmlspecialchars($vehicle['name']); ?></td>
|
||||||
|
<td><?php echo htmlspecialchars(ucfirst($vehicle['type'])); ?></td>
|
||||||
|
<td><?php echo htmlspecialchars($vehicle['capacity']); ?></td>
|
||||||
|
<td>Rp <?php echo number_format($vehicle['price_per_day'], 0, ',', '.'); ?></td>
|
||||||
|
<td><span class="badge bg-<?php echo $vehicle['is_available'] ? 'success' : 'secondary'; ?>"><?php echo $vehicle['is_available'] ? 'Available' : 'Unavailable'; ?></span></td>
|
||||||
|
<td>
|
||||||
|
<a href="admin_edit_vehicle.php?id=<?php echo $vehicle['id']; ?>" class="btn btn-sm btn-outline-primary"><i class="bi bi-pencil-square"></i></a>
|
||||||
|
<a href="admin_delete_vehicle.php?id=<?php echo $vehicle['id']; ?>" class="btn btn-sm btn-outline-danger" onclick="return confirm('Are you sure you want to delete this vehicle?');"><i class="bi bi-trash"></i></a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
require_once 'includes/admin_footer.php';
|
||||||
|
?>
|
||||||
137
assets/css/custom.css
Normal file
137
assets/css/custom.css
Normal file
@ -0,0 +1,137 @@
|
|||||||
|
/* Import Font */
|
||||||
|
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;700;900&display=swap');
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-family: 'Poppins', sans-serif;
|
||||||
|
background-color: #f8f9fa;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Header */
|
||||||
|
.navbar-brand .brand-text {
|
||||||
|
font-size: 1.5rem;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
.navbar-brand .sub-text {
|
||||||
|
font-size: 0.8rem;
|
||||||
|
display: block;
|
||||||
|
line-height: 1;
|
||||||
|
color: #6c757d;
|
||||||
|
}
|
||||||
|
.nav-link.active {
|
||||||
|
background-color: #0d6efd;
|
||||||
|
color: white !important;
|
||||||
|
border-radius: 0.375rem;
|
||||||
|
padding-left: 1rem !important;
|
||||||
|
padding-right: 1rem !important;
|
||||||
|
}
|
||||||
|
.btn-contact {
|
||||||
|
background-color: #198754;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
.btn-contact:hover {
|
||||||
|
background-color: #157347;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Hero Section */
|
||||||
|
.hero-section {
|
||||||
|
background: linear-gradient(90deg, #2c3e50, #fd7e14);
|
||||||
|
color: white;
|
||||||
|
padding: 8rem 0;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.hero-section h1 {
|
||||||
|
font-size: 3.5rem;
|
||||||
|
font-weight: 900;
|
||||||
|
text-transform: uppercase;
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
|
}
|
||||||
|
.hero-section .highlight-text {
|
||||||
|
color: #ffc107;
|
||||||
|
}
|
||||||
|
.hero-section .sub-heading {
|
||||||
|
font-size: 1.25rem;
|
||||||
|
font-weight: 400;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
|
.hero-section .location-text {
|
||||||
|
font-size: 0.9rem;
|
||||||
|
color: #e9ecef;
|
||||||
|
margin-bottom: 2rem;
|
||||||
|
}
|
||||||
|
.hero-section .btn {
|
||||||
|
font-size: 1.2rem;
|
||||||
|
padding: 0.8rem 2rem;
|
||||||
|
border-radius: 50px;
|
||||||
|
font-weight: 700;
|
||||||
|
margin: 0 0.5rem;
|
||||||
|
}
|
||||||
|
.btn-rental {
|
||||||
|
background-color: #0d6efd;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
.btn-tour {
|
||||||
|
background-color: #ff8c00;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Floating WhatsApp Button */
|
||||||
|
.whatsapp-float {
|
||||||
|
position: fixed;
|
||||||
|
width: 60px;
|
||||||
|
height: 100vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
.vehicle-card {
|
||||||
|
transition: transform 0.3s ease, box-shadow 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.vehicle-card:hover {
|
||||||
|
transform: translateY(-10px);
|
||||||
|
box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.vehicle-card .card-img-top {
|
||||||
|
height: 200px;
|
||||||
|
object-fit: cover;
|
||||||
|
}
|
||||||
|
bottom: 40px;
|
||||||
|
right: 40px;
|
||||||
|
background-color: #25d366;
|
||||||
|
color: #FFF;
|
||||||
|
border-radius: 50px;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 30px;
|
||||||
|
box-shadow: 2px 2px 3px #999;
|
||||||
|
z-index: 100;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
.whatsapp-float:hover {
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Footer */
|
||||||
|
footer {
|
||||||
|
background-color: #212529;
|
||||||
|
color: #adb5bd;
|
||||||
|
padding: 3rem 0;
|
||||||
|
}
|
||||||
|
footer .footer-logo {
|
||||||
|
font-size: 1.5rem;
|
||||||
|
font-weight: 700;
|
||||||
|
color: white;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
|
footer a {
|
||||||
|
color: #adb5bd;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
footer a:hover {
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
footer .social-icons a {
|
||||||
|
font-size: 1.5rem;
|
||||||
|
margin-right: 1rem;
|
||||||
|
}
|
||||||
1
assets/js/main.js
Normal file
1
assets/js/main.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
// Custom JavaScript will go here
|
||||||
80
booking.php
Normal file
80
booking.php
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
<?php
|
||||||
|
require_once 'db/config.php';
|
||||||
|
require_once 'includes/header.php';
|
||||||
|
|
||||||
|
$vehicle_id = isset($_GET['vehicle_id']) ? (int)$_GET['vehicle_id'] : 0;
|
||||||
|
$vehicle = null;
|
||||||
|
|
||||||
|
if ($vehicle_id) {
|
||||||
|
$stmt = db()->prepare("SELECT * FROM vehicles WHERE id = ?");
|
||||||
|
$stmt->execute([$vehicle_id]);
|
||||||
|
$vehicle = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
|
$customer_name = $_POST['customer_name'] ?? '';
|
||||||
|
$customer_email = $_POST['customer_email'] ?? '';
|
||||||
|
$customer_phone = $_POST['customer_phone'] ?? '';
|
||||||
|
$start_date = $_POST['start_date'] ?? '';
|
||||||
|
$end_date = $_POST['end_date'] ?? '';
|
||||||
|
$status = 'pending';
|
||||||
|
|
||||||
|
if ($vehicle_id && !empty($customer_name) && !empty($customer_email) && !empty($start_date) && !empty($end_date)) {
|
||||||
|
$stmt = db()->prepare("INSERT INTO bookings (vehicle_id, customer_name, customer_email, customer_phone, start_date, end_date, status) VALUES (?, ?, ?, ?, ?, ?, ?)");
|
||||||
|
$stmt->execute([$vehicle_id, $customer_name, $customer_email, $customer_phone, $start_date, $end_date, $status]);
|
||||||
|
$booking_id = db()->lastInsertId();
|
||||||
|
|
||||||
|
echo '<div class="container mt-5 pt-5"><div class="alert alert-success">Thank you! Your booking has been received. We will contact you shortly.</div></div>';
|
||||||
|
} else {
|
||||||
|
echo '<div class="container mt-5 pt-5"><div class="alert alert-danger">Please fill in all required fields.</div></div>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$vehicle) {
|
||||||
|
echo '<div class="container mt-5 pt-5"><div class="alert alert-danger">Vehicle not found.</div></div>';
|
||||||
|
require_once 'includes/footer.php';
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="container mt-5 pt-5">
|
||||||
|
<h2 class="text-center mb-4">Book Vehicle: <?php echo htmlspecialchars($vehicle['name']); ?></h2>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<img src="assets/images/<?php echo htmlspecialchars($vehicle['image']); ?>" class="img-fluid rounded" alt="<?php echo htmlspecialchars($vehicle['name']); ?>">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<p><strong>Type:</strong> <?php echo htmlspecialchars($vehicle['type']); ?></p>
|
||||||
|
<p><strong>Capacity:</strong> <?php echo htmlspecialchars($vehicle['capacity']); ?> people</p>
|
||||||
|
<p><strong>Price:</strong> Rp <?php echo number_format($vehicle['price_per_day'], 0, ',', '.'); ?> / day</p>
|
||||||
|
<hr>
|
||||||
|
<form action="booking.php?vehicle_id=<?php echo $vehicle_id; ?>" method="POST">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="customer_name" class="form-label">Full Name</label>
|
||||||
|
<input type="text" class="form-control" id="customer_name" name="customer_name" required>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="customer_email" class="form-label">Email Address</label>
|
||||||
|
<input type="email" class="form-control" id="customer_email" name="customer_email" required>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="customer_phone" class="form-label">Phone Number</label>
|
||||||
|
<input type="tel" class="form-control" id="customer_phone" name="customer_phone" required>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6 mb-3">
|
||||||
|
<label for="start_date" class="form-label">Start Date</label>
|
||||||
|
<input type="date" class="form-control" id="start_date" name="start_date" required>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6 mb-3">
|
||||||
|
<label for="end_date" class="form-label">End Date</label>
|
||||||
|
<input type="date" class="form-control" id="end_date" name="end_date" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<button type="submit" class="btn btn-primary w-100">Book Now</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php require_once 'includes/footer.php'; ?>
|
||||||
83
contact.php
Normal file
83
contact.php
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
<?php
|
||||||
|
require_once __DIR__ . '/mail/MailService.php';
|
||||||
|
|
||||||
|
$page_title = "Kontak Kami";
|
||||||
|
$page_description = "Hubungi Juanda Transport untuk pertanyaan, pemesanan, atau informasi lebih lanjut.";
|
||||||
|
|
||||||
|
include __DIR__ . '/includes/header.php';
|
||||||
|
|
||||||
|
$feedback_message = '';
|
||||||
|
$feedback_type = '';
|
||||||
|
|
||||||
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||||
|
$name = trim($_POST['name']);
|
||||||
|
$email = trim($_POST['email']);
|
||||||
|
$message = trim($_POST['message']);
|
||||||
|
|
||||||
|
if (empty($name) || empty($email) || empty($message)) {
|
||||||
|
$feedback_message = "Silakan lengkapi semua kolom.";
|
||||||
|
$feedback_type = 'danger';
|
||||||
|
} elseif (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
||||||
|
$feedback_message = "Alamat email tidak valid.";
|
||||||
|
$feedback_type = 'danger';
|
||||||
|
} else {
|
||||||
|
$to = getenv('MAIL_TO') ?: 'support@yourdomain.com'; // Fallback for safety
|
||||||
|
$subject = "Pesan Baru dari Formulir Kontak Juanda Transport";
|
||||||
|
|
||||||
|
$res = MailService::sendContactMessage($name, $email, $message, $to, $subject);
|
||||||
|
|
||||||
|
if (!empty($res['success'])) {
|
||||||
|
$feedback_message = "Terima kasih telah menghubungi kami! Pesan Anda telah terkirim.";
|
||||||
|
$feedback_type = 'success';
|
||||||
|
} else {
|
||||||
|
$feedback_message = "Terjadi kesalahan saat mengirim pesan. Silakan coba lagi nanti.";
|
||||||
|
$feedback_type = 'danger';
|
||||||
|
// For debugging: error_log("Mail Error: " . $res['error']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="container my-5">
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-lg-8">
|
||||||
|
<h1 class="text-center mb-4">Hubungi Kami</h1>
|
||||||
|
<p class="text-center mb-5">Punya pertanyaan atau ingin memesan? Isi formulir di bawah ini dan tim kami akan segera menghubungi Anda.</p>
|
||||||
|
|
||||||
|
<?php if ($feedback_message): ?>
|
||||||
|
<div class="alert alert-<?php echo $feedback_type; ?>" role="alert">
|
||||||
|
<?php echo $feedback_message; ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<div class="card shadow-sm">
|
||||||
|
<div class="card-body p-5">
|
||||||
|
<form action="contact.php" method="POST">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="name" class="form-label">Nama Lengkap</label>
|
||||||
|
<input type="text" class="form-control" id="name" name="name" required>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="email" class="form-label">Alamat Email</label>
|
||||||
|
<input type="email" class="form-control" id="email" name="email" required>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="message" class="form-label">Pesan Anda</label>
|
||||||
|
<textarea class="form-control" id="message" name="message" rows="5" required></textarea>
|
||||||
|
</div>
|
||||||
|
<div class="d-grid">
|
||||||
|
<button type="submit" class="btn btn-primary btn-lg">Kirim Pesan</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="text-center mt-4">
|
||||||
|
<p>Untuk respons lebih cepat, hubungi kami langsung melalui WhatsApp.</p>
|
||||||
|
<a href="https://wa.me/628973577791" class="btn btn-success btn-lg"><i class="bi bi-whatsapp"></i> Hubungi via WhatsApp</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php include __DIR__ . '/includes/footer.php'; ?>
|
||||||
78
dashboard.php
Normal file
78
dashboard.php
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
<?php
|
||||||
|
require_once 'includes/admin_header.php';
|
||||||
|
require_once 'db/config.php';
|
||||||
|
|
||||||
|
// Fetch counts from the database
|
||||||
|
try {
|
||||||
|
$pdo = db();
|
||||||
|
|
||||||
|
// Count vehicles
|
||||||
|
$stmt_vehicles = $pdo->query('SELECT COUNT(*) FROM vehicles');
|
||||||
|
$vehicle_count = $stmt_vehicles->fetchColumn();
|
||||||
|
|
||||||
|
// Count tour packages
|
||||||
|
$stmt_tours = $pdo->query('SELECT COUNT(*) FROM tour_packages');
|
||||||
|
$tour_count = $stmt_tours->fetchColumn();
|
||||||
|
|
||||||
|
// Count bookings
|
||||||
|
$stmt_bookings = $pdo->query('SELECT COUNT(*) FROM bookings');
|
||||||
|
$booking_count = $stmt_bookings->fetchColumn();
|
||||||
|
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
// Handle database errors gracefully
|
||||||
|
$error_message = "Database error: " . $e->getMessage();
|
||||||
|
$vehicle_count = 0;
|
||||||
|
$tour_count = 0;
|
||||||
|
$booking_count = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
require_once 'includes/admin_sidebar.php';
|
||||||
|
?>
|
||||||
|
|
||||||
|
<h1 class="h2">Dashboard</h1>
|
||||||
|
<p>Welcome back, <strong><?php echo htmlspecialchars($_SESSION['username']); ?></strong>! Here's a summary of your site.</p>
|
||||||
|
|
||||||
|
<?php if (isset($error_message)): ?>
|
||||||
|
<div class="alert alert-danger">
|
||||||
|
<?php echo htmlspecialchars($error_message); ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="card text-white bg-primary mb-3">
|
||||||
|
<div class="card-header">Total Vehicles</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<h5 class="card-title"><?php echo $vehicle_count; ?></h5>
|
||||||
|
<a href="admin_vehicles.php" class="text-white">View Details <i class="bi bi-arrow-right-circle"></i></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="card text-white bg-success mb-3">
|
||||||
|
<div class="card-header">Tour Packages</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<h5 class="card-title"><?php echo $tour_count; ?></h5>
|
||||||
|
<a href="admin_tours.php" class="text-white">View Details <i class="bi bi-arrow-right-circle"></i></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="card text-white bg-warning mb-3">
|
||||||
|
<div class="card-header">Total Bookings</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<h5 class="card-title"><?php echo $booking_count; ?></h5>
|
||||||
|
<a href="admin_bookings.php" class="text-white">View Details <i class="bi bi-arrow-right-circle"></i></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="alert alert-info mt-4">
|
||||||
|
<i class="bi bi-info-circle-fill"></i>
|
||||||
|
<strong>Under Construction:</strong> More features are coming soon!
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
require_once 'includes/admin_footer.php';
|
||||||
|
?>
|
||||||
57
db/001_create_tables.sql
Normal file
57
db/001_create_tables.sql
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
-- Create the customers table
|
||||||
|
CREATE TABLE IF NOT EXISTS `customers` (
|
||||||
|
`id` INT AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
`name` VARCHAR(255) NOT NULL,
|
||||||
|
`email` VARCHAR(255) NOT NULL UNIQUE,
|
||||||
|
`phone` VARCHAR(50),
|
||||||
|
`created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
|
|
||||||
|
-- Create the vehicles table
|
||||||
|
CREATE TABLE IF NOT EXISTS `vehicles` (
|
||||||
|
`id` INT AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
`name` VARCHAR(255) NOT NULL,
|
||||||
|
`type` VARCHAR(100),
|
||||||
|
`price_per_day` DECIMAL(10, 2) NOT NULL,
|
||||||
|
`image_url` VARCHAR(255),
|
||||||
|
`description` TEXT,
|
||||||
|
`created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
|
|
||||||
|
-- Create the bookings table for vehicle rentals
|
||||||
|
CREATE TABLE IF NOT EXISTS `bookings` (
|
||||||
|
`id` INT AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
`customer_id` INT NOT NULL,
|
||||||
|
`vehicle_id` INT NOT NULL,
|
||||||
|
`start_date` DATE NOT NULL,
|
||||||
|
`end_date` DATE NOT NULL,
|
||||||
|
`total_price` DECIMAL(10, 2) NOT NULL,
|
||||||
|
`status` VARCHAR(50) DEFAULT 'pending',
|
||||||
|
`created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
FOREIGN KEY (`customer_id`) REFERENCES `customers`(`id`),
|
||||||
|
FOREIGN KEY (`vehicle_id`) REFERENCES `vehicles`(`id`)
|
||||||
|
);
|
||||||
|
|
||||||
|
-- Create the tour_packages table
|
||||||
|
CREATE TABLE IF NOT EXISTS `tour_packages` (
|
||||||
|
`id` INT AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
`name` VARCHAR(255) NOT NULL,
|
||||||
|
`description` TEXT,
|
||||||
|
`price` DECIMAL(10, 2) NOT NULL,
|
||||||
|
`image_url` VARCHAR(255),
|
||||||
|
`created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
|
|
||||||
|
-- Create the tour_bookings table
|
||||||
|
CREATE TABLE IF NOT EXISTS `tour_bookings` (
|
||||||
|
`id` INT AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
`customer_id` INT NOT NULL,
|
||||||
|
`package_id` INT NOT NULL,
|
||||||
|
`booking_date` DATE NOT NULL,
|
||||||
|
`num_people` INT NOT NULL,
|
||||||
|
`total_price` DECIMAL(10, 2) NOT NULL,
|
||||||
|
`status` VARCHAR(50) DEFAULT 'pending',
|
||||||
|
`created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
FOREIGN KEY (`customer_id`) REFERENCES `customers`(`id`),
|
||||||
|
FOREIGN KEY (`package_id`) REFERENCES `tour_packages`(`id`)
|
||||||
|
);
|
||||||
@ -8,10 +8,16 @@ define('DB_PASS', '2c66b530-2a65-423a-a106-6760b49ad1a2');
|
|||||||
function db() {
|
function db() {
|
||||||
static $pdo;
|
static $pdo;
|
||||||
if (!$pdo) {
|
if (!$pdo) {
|
||||||
$pdo = new PDO('mysql:host='.DB_HOST.';dbname='.DB_NAME.';charset=utf8mb4', DB_USER, DB_PASS, [
|
try {
|
||||||
|
$pdo = new PDO('mysql:host='.DB_HOST.';charset=utf8mb4', DB_USER, DB_PASS, [
|
||||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
||||||
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
|
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
|
||||||
]);
|
]);
|
||||||
|
$pdo->exec('CREATE DATABASE IF NOT EXISTS `'.DB_NAME.'`');
|
||||||
|
$pdo->exec('USE `'.DB_NAME.'`');
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
die("DB connection failed: " . $e->getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return $pdo;
|
return $pdo;
|
||||||
}
|
}
|
||||||
|
|||||||
13
db/migrate.php
Normal file
13
db/migrate.php
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<?php
|
||||||
|
// Simple migration script
|
||||||
|
|
||||||
|
require_once __DIR__ . '/config.php';
|
||||||
|
|
||||||
|
try {
|
||||||
|
$pdo = db();
|
||||||
|
$sql = file_get_contents(__DIR__ . '/001_create_tables.sql');
|
||||||
|
$pdo->exec($sql);
|
||||||
|
echo "Database migration completed successfully.";
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
die("Database migration failed: " . $e->getMessage());
|
||||||
|
}
|
||||||
5
includes/admin_footer.php
Normal file
5
includes/admin_footer.php
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
49
includes/admin_header.php
Normal file
49
includes/admin_header.php
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
// If the user is not logged in, redirect to the login page.
|
||||||
|
if (!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] !== true) {
|
||||||
|
header('Location: admin.php');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Logout logic
|
||||||
|
if (isset($_GET['logout'])) {
|
||||||
|
session_destroy();
|
||||||
|
header('Location: admin.php');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Admin Dashboard - Juanda Transport</title>
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="assets/css/custom.css">
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
display: flex;
|
||||||
|
min-height: 100vh;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
.main-container {
|
||||||
|
display: flex;
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
.sidebar {
|
||||||
|
width: 250px;
|
||||||
|
background-color: #343a40;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
.content {
|
||||||
|
flex: 1;
|
||||||
|
padding: 2rem;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="main-container">
|
||||||
46
includes/admin_sidebar.php
Normal file
46
includes/admin_sidebar.php
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
<div class="sidebar p-3">
|
||||||
|
<a class="d-flex align-items-center mb-3 mb-md-0 me-md-auto text-white text-decoration-none" href="dashboard.php">
|
||||||
|
<img src="https://www.flatlogic.com/assets/logo-c69533d8159b5d5b5a5d27dc2b6045a3.svg" alt="Juanda Transport Logo" height="30" class="me-2">
|
||||||
|
<span class="fs-4">Admin</span>
|
||||||
|
</a>
|
||||||
|
<hr>
|
||||||
|
<ul class="nav nav-pills flex-column mb-auto">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a href="dashboard.php" class="nav-link text-white active" aria-current="page">
|
||||||
|
<i class="bi bi-speedometer2 me-2"></i>
|
||||||
|
Dashboard
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="admin_vehicles.php" class="nav-link text-white">
|
||||||
|
<i class="bi bi-truck me-2"></i>
|
||||||
|
Vehicles
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="admin_tours.php" class="nav-link text-white">
|
||||||
|
<i class="bi bi-map me-2"></i>
|
||||||
|
Tour Packages
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="admin_bookings.php" class="nav-link text-white">
|
||||||
|
<i class="bi bi-calendar-check me-2"></i>
|
||||||
|
Bookings
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<hr>
|
||||||
|
<div class="dropdown">
|
||||||
|
<a href="#" class="d-flex align-items-center text-white text-decoration-none dropdown-toggle" id="dropdownUser1" data-bs-toggle="dropdown" aria-expanded="false">
|
||||||
|
<i class="bi bi-person-circle me-2"></i>
|
||||||
|
<strong><?php echo htmlspecialchars($_SESSION['username']); ?></strong>
|
||||||
|
</a>
|
||||||
|
<ul class="dropdown-menu dropdown-menu-dark text-small shadow" aria-labelledby="dropdownUser1">
|
||||||
|
<li><a class="dropdown-item" href="index.php" target="_blank">View Site</a></li>
|
||||||
|
<li><hr class="dropdown-divider"></li>
|
||||||
|
<li><a class="dropdown-item" href="dashboard.php?logout=true">Sign out</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="content">
|
||||||
56
includes/footer.php
Normal file
56
includes/footer.php
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
</main>
|
||||||
|
|
||||||
|
<!-- Floating WhatsApp Button -->
|
||||||
|
<a href="https://wa.me/628973577791" class="whatsapp-float" target="_blank">
|
||||||
|
<i class="bi bi-whatsapp"></i>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<!-- Footer -->
|
||||||
|
<footer class="text-center text-lg-start">
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-4 col-md-12 mb-4 mb-md-0">
|
||||||
|
<h5 class="footer-logo">Juanda Transport</h5>
|
||||||
|
<p>
|
||||||
|
Penyedia layanan transportasi dan paket wisata terbaik di Indonesia. Kami berkomitmen untuk memberikan pengalaman perjalanan yang aman, nyaman, dan tak terlupakan.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-2 col-md-6 mb-4 mb-md-0">
|
||||||
|
<h5 class="text-uppercase text-white">Link Cepat</h5>
|
||||||
|
<ul class="list-unstyled mb-0">
|
||||||
|
<li><a href="index.php">Beranda</a></li>
|
||||||
|
<li><a href="rental.php">Rental Kendaraan</a></li>
|
||||||
|
<li><a href="travel.php">Paket Wisata</a></li>
|
||||||
|
<li><a href="contact.php">Kontak</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-3 col-md-6 mb-4 mb-md-0">
|
||||||
|
<h5 class="text-uppercase text-white">Kontak</h5>
|
||||||
|
<ul class="list-unstyled mb-0">
|
||||||
|
<li><i class="bi bi-geo-alt-fill"></i> Calukan RT 1 RW 5, Keboansikep, East Java</li>
|
||||||
|
<li><i class="bi bi-whatsapp"></i> +62 897-3577-791</li>
|
||||||
|
<li><i class="bi bi-envelope-fill"></i> admin@juandatransport.com</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-3 col-md-12 mb-4 mb-md-0">
|
||||||
|
<h5 class="text-uppercase text-white">Sosial Media</h5>
|
||||||
|
<div class="social-icons">
|
||||||
|
<a href="#" target="_blank"><i class="bi bi-facebook"></i></a>
|
||||||
|
<a href="#" target="_blank"><i class="bi bi-instagram"></i></a>
|
||||||
|
<a href="#" target="_blank"><i class="bi bi-tiktok"></i></a>
|
||||||
|
<a href="https://wa.me/628973577791" target="_blank"><i class="bi bi-whatsapp"></i></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="text-center p-3 mt-4 border-top border-secondary">
|
||||||
|
Copyright © 2025 Juanda Transport.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
<!-- Bootstrap 5 JS -->
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
<!-- Custom JS -->
|
||||||
|
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
76
includes/header.php
Normal file
76
includes/header.php
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
<?php
|
||||||
|
$current_page = basename($_SERVER['PHP_SELF']);
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="id">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
|
||||||
|
<!-- Meta Tags -->
|
||||||
|
<title><?php echo isset($page_title) ? htmlspecialchars($page_title) . ' - Juanda Transport' : 'Juanda Transport Rental Tour Travel'; ?></title>
|
||||||
|
<meta name="description" content="<?php echo isset($page_description) ? htmlspecialchars($page_description) : 'Juanda Transport menyediakan layanan rental kendaraan dan paket wisata terpercaya di Indonesia.'; ?>">
|
||||||
|
<meta name="keywords" content="rental mobil, sewa mobil, paket wisata, travel indonesia, juanda transport, rental mpv, sewa minibus, tour travel, wisata jawa timur, Built with Flatlogic Generator">
|
||||||
|
<meta property="og:title" content="<?php echo isset($page_title) ? htmlspecialchars($page_title) : 'Juanda Transport'; ?>">
|
||||||
|
<meta property="og:description" content="<?php echo isset($page_description) ? htmlspecialchars($page_description) : 'Layanan rental kendaraan & paket wisata terpercaya.'; ?>">
|
||||||
|
<meta property="og:image" content="<?php echo htmlspecialchars($_SERVER['PROJECT_IMAGE_URL'] ?? ''); ?>">
|
||||||
|
<meta name="twitter:card" content="summary_large_image">
|
||||||
|
<meta name="twitter:image" content="<?php echo htmlspecialchars($_SERVER['PROJECT_IMAGE_URL'] ?? ''); ?>">
|
||||||
|
|
||||||
|
<!-- Bootstrap 5 CSS -->
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
<!-- Bootstrap Icons -->
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css" rel="stylesheet">
|
||||||
|
<!-- Google Fonts (Poppins) -->
|
||||||
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700;900&display=swap" rel="stylesheet">
|
||||||
|
<!-- Custom CSS -->
|
||||||
|
<link rel="stylesheet" href="assets/css/custom.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<!-- Header -->
|
||||||
|
<header class="bg-light shadow-sm">
|
||||||
|
<nav class="navbar navbar-expand-lg navbar-light">
|
||||||
|
<div class="container">
|
||||||
|
<a class="navbar-brand" href="index.php">
|
||||||
|
<span class="brand-text">Juanda Transport</span>
|
||||||
|
<span class="sub-text">Rental & Tour</span>
|
||||||
|
</a>
|
||||||
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
||||||
|
<span class="navbar-toggler-icon"></span>
|
||||||
|
</button>
|
||||||
|
<div class="collapse navbar-collapse" id="navbarNav">
|
||||||
|
<ul class="navbar-nav mx-auto">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link <?php echo ($current_page == 'index.php') ? 'active' : ''; ?>" href="index.php">Beranda</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link <?php echo ($current_page == 'rental.php') ? 'active' : ''; ?>" href="rental.php">Rental Kendaraan</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link <?php echo ($current_page == 'travel.php') ? 'active' : ''; ?>" href="travel.php">Paket Wisata</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link <?php echo ($current_page == 'booking.php') ? 'active' : ''; ?>" href="booking.php">Booking</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link <?php echo ($current_page == 'contact.php') ? 'active' : ''; ?>" href="contact.php">Kontak</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<div class="d-flex align-items-center">
|
||||||
|
<a href="admin.php" class="btn btn-outline-secondary me-2">
|
||||||
|
<i class="bi bi-person-circle"></i> Admin
|
||||||
|
</a>
|
||||||
|
<a href="https://wa.me/628973577791" target="_blank" class="btn btn-contact">
|
||||||
|
<i class="bi bi-whatsapp"></i> Hubungi Kami
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<!-- Main Content -->
|
||||||
|
<main>
|
||||||
164
index.php
164
index.php
@ -1,150 +1,22 @@
|
|||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
$page_title = "Juanda Transport Rental Tour Travel";
|
||||||
@ini_set('display_errors', '1');
|
$page_description = "Juanda Transport menyediakan layanan rental kendaraan dan paket wisata terpercaya di Indonesia. Jelajahi Indonesia dengan nyaman bersama kami.";
|
||||||
@error_reporting(E_ALL);
|
include __DIR__ . '/includes/header.php';
|
||||||
@date_default_timezone_set('UTC');
|
|
||||||
|
|
||||||
$phpVersion = PHP_VERSION;
|
|
||||||
$now = date('Y-m-d H:i:s');
|
|
||||||
?>
|
?>
|
||||||
<!doctype html>
|
<!-- Hero Section -->
|
||||||
<html lang="en">
|
<section class="hero-section">
|
||||||
<head>
|
<div class="container">
|
||||||
<meta charset="utf-8" />
|
<h1>Jelajahi Indonesia dengan <br><span class="highlight-text">Juanda Travel</span></h1>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<p class="sub-heading">Rental kendaraan & paket wisata terpercaya untuk perjalanan Anda.</p>
|
||||||
<title>New Style</title>
|
<p class="location-text">Melayani dari Calukan RT 1 RW 5 Keboansikep, East Java</p>
|
||||||
<?php
|
<div>
|
||||||
// Read project preview data from environment
|
<a href="rental.php" class="btn btn-rental">
|
||||||
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? '';
|
<i class="bi bi-car-front-fill"></i> Rental Kendaraan
|
||||||
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
|
</a>
|
||||||
?>
|
<a href="travel.php" class="btn btn-tour">
|
||||||
<?php if ($projectDescription): ?>
|
<i class="bi bi-arrow-right-circle-fill"></i> Paket Wisata
|
||||||
<!-- Meta description -->
|
</a>
|
||||||
<meta name="description" content='<?= htmlspecialchars($projectDescription) ?>' />
|
|
||||||
<!-- Open Graph meta tags -->
|
|
||||||
<meta property="og:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
|
||||||
<!-- Twitter meta tags -->
|
|
||||||
<meta property="twitter:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if ($projectImageUrl): ?>
|
|
||||||
<!-- Open Graph image -->
|
|
||||||
<meta property="og:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
|
||||||
<!-- Twitter image -->
|
|
||||||
<meta property="twitter:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
|
||||||
<?php endif; ?>
|
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
|
|
||||||
<style>
|
|
||||||
:root {
|
|
||||||
--bg-color-start: #6a11cb;
|
|
||||||
--bg-color-end: #2575fc;
|
|
||||||
--text-color: #ffffff;
|
|
||||||
--card-bg-color: rgba(255, 255, 255, 0.01);
|
|
||||||
--card-border-color: rgba(255, 255, 255, 0.1);
|
|
||||||
}
|
|
||||||
body {
|
|
||||||
margin: 0;
|
|
||||||
font-family: 'Inter', sans-serif;
|
|
||||||
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end));
|
|
||||||
color: var(--text-color);
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
min-height: 100vh;
|
|
||||||
text-align: center;
|
|
||||||
overflow: hidden;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
body::before {
|
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><path d="M-10 10L110 10M10 -10L10 110" stroke-width="1" stroke="rgba(255,255,255,0.05)"/></svg>');
|
|
||||||
animation: bg-pan 20s linear infinite;
|
|
||||||
z-index: -1;
|
|
||||||
}
|
|
||||||
@keyframes bg-pan {
|
|
||||||
0% { background-position: 0% 0%; }
|
|
||||||
100% { background-position: 100% 100%; }
|
|
||||||
}
|
|
||||||
main {
|
|
||||||
padding: 2rem;
|
|
||||||
}
|
|
||||||
.card {
|
|
||||||
background: var(--card-bg-color);
|
|
||||||
border: 1px solid var(--card-border-color);
|
|
||||||
border-radius: 16px;
|
|
||||||
padding: 2rem;
|
|
||||||
backdrop-filter: blur(20px);
|
|
||||||
-webkit-backdrop-filter: blur(20px);
|
|
||||||
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
.loader {
|
|
||||||
margin: 1.25rem auto 1.25rem;
|
|
||||||
width: 48px;
|
|
||||||
height: 48px;
|
|
||||||
border: 3px solid rgba(255, 255, 255, 0.25);
|
|
||||||
border-top-color: #fff;
|
|
||||||
border-radius: 50%;
|
|
||||||
animation: spin 1s linear infinite;
|
|
||||||
}
|
|
||||||
@keyframes spin {
|
|
||||||
from { transform: rotate(0deg); }
|
|
||||||
to { transform: rotate(360deg); }
|
|
||||||
}
|
|
||||||
.hint {
|
|
||||||
opacity: 0.9;
|
|
||||||
}
|
|
||||||
.sr-only {
|
|
||||||
position: absolute;
|
|
||||||
width: 1px; height: 1px;
|
|
||||||
padding: 0; margin: -1px;
|
|
||||||
overflow: hidden;
|
|
||||||
clip: rect(0, 0, 0, 0);
|
|
||||||
white-space: nowrap; border: 0;
|
|
||||||
}
|
|
||||||
h1 {
|
|
||||||
font-size: 3rem;
|
|
||||||
font-weight: 700;
|
|
||||||
margin: 0 0 1rem;
|
|
||||||
letter-spacing: -1px;
|
|
||||||
}
|
|
||||||
p {
|
|
||||||
margin: 0.5rem 0;
|
|
||||||
font-size: 1.1rem;
|
|
||||||
}
|
|
||||||
code {
|
|
||||||
background: rgba(0,0,0,0.2);
|
|
||||||
padding: 2px 6px;
|
|
||||||
border-radius: 4px;
|
|
||||||
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
||||||
}
|
|
||||||
footer {
|
|
||||||
position: absolute;
|
|
||||||
bottom: 1rem;
|
|
||||||
font-size: 0.8rem;
|
|
||||||
opacity: 0.7;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<main>
|
|
||||||
<div class="card">
|
|
||||||
<h1>Analyzing your requirements and generating your website…</h1>
|
|
||||||
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes">
|
|
||||||
<span class="sr-only">Loading…</span>
|
|
||||||
</div>
|
</div>
|
||||||
<p class="hint"><?= ($_SERVER['HTTP_HOST'] ?? '') === 'appwizzy.com' ? 'AppWizzy' : 'Flatlogic' ?> AI is collecting your requirements and applying the first changes.</p>
|
|
||||||
<p class="hint">This page will update automatically as the plan is implemented.</p>
|
|
||||||
<p>Runtime: PHP <code><?= htmlspecialchars($phpVersion) ?></code> — UTC <code><?= htmlspecialchars($now) ?></code></p>
|
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</section>
|
||||||
<footer>
|
<?php include __DIR__ . '/includes/footer.php'; ?>
|
||||||
Page updated: <?= htmlspecialchars($now) ?> (UTC)
|
|
||||||
</footer>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
46
rental.php
Normal file
46
rental.php
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
<?php
|
||||||
|
require_once 'db/config.php';
|
||||||
|
$page_title = "Rental Kendaraan";
|
||||||
|
$page_description = "Sewa kendaraan terbaik di Juanda Transport. Pilihan lengkap, harga kompetitif.";
|
||||||
|
include __DIR__ . '/includes/header.php';
|
||||||
|
|
||||||
|
$vehicles = db()->query("SELECT * FROM vehicles ORDER BY name ASC")->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="container mt-5 pt-5">
|
||||||
|
<div class="text-center mb-5">
|
||||||
|
<h1 class="display-5 fw-bold text-uppercase">Katalog Kendaraan</h1>
|
||||||
|
<p class="lead text-muted">Pilih kendaraan yang paling sesuai dengan kebutuhan perjalanan Anda.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row row-cols-1 row-cols-md-2 row-cols-lg-3 g-4">
|
||||||
|
<?php if (empty($vehicles)): ?>
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="alert alert-info text-center">Saat ini belum ada kendaraan yang tersedia. Silakan cek kembali nanti.</div>
|
||||||
|
</div>
|
||||||
|
<?php else: ?>
|
||||||
|
<?php foreach ($vehicles as $vehicle): ?>
|
||||||
|
<div class="col">
|
||||||
|
<div class="card h-100 shadow-sm vehicle-card">
|
||||||
|
<img src="assets/images/<?php echo htmlspecialchars($vehicle['image']); ?>" class="card-img-top" alt="<?php echo htmlspecialchars($vehicle['name']); ?>">
|
||||||
|
<div class="card-body d-flex flex-column">
|
||||||
|
<h5 class="card-title fw-bold"><?php echo htmlspecialchars($vehicle['name']); ?></h5>
|
||||||
|
<p class="card-text text-muted flex-grow-1"><?php echo htmlspecialchars($vehicle['description']); ?></p>
|
||||||
|
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||||
|
<span class="badge bg-light text-dark p-2"><i class="bi bi-people-fill me-1"></i> <?php echo htmlspecialchars($vehicle['capacity']); ?> Penumpang</span>
|
||||||
|
<span class="badge bg-light text-dark p-2"><i class="bi bi-gear-fill me-1"></i> <?php echo htmlspecialchars($vehicle['transmission']); ?></span>
|
||||||
|
</div>
|
||||||
|
<h4 class="card-text text-end fw-bold text-primary mb-3">Rp <?php echo number_format($vehicle['price_per_day'], 0, ',', '.'); ?> <span class="fw-normal fs-6 text-muted">/ hari</span></h4>
|
||||||
|
<a href="booking.php?vehicle_id=<?php echo $vehicle['id']; ?>" class="btn btn-primary w-100 fw-bold">
|
||||||
|
<i class="bi bi-calendar-check-fill"></i> Book Now
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php include __DIR__ . '/includes/footer.php'; ?>
|
||||||
|
|
||||||
80
tour_booking.php
Normal file
80
tour_booking.php
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
<?php
|
||||||
|
require_once 'db/config.php';
|
||||||
|
require_once 'includes/header.php';
|
||||||
|
|
||||||
|
$tour_id = isset($_GET['tour_id']) ? (int)$_GET['tour_id'] : 0;
|
||||||
|
$tour = null;
|
||||||
|
|
||||||
|
if ($tour_id) {
|
||||||
|
$stmt = db()->prepare("SELECT * FROM tour_packages WHERE id = ?");
|
||||||
|
$stmt->execute([$tour_id]);
|
||||||
|
$tour = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
|
$customer_name = $_POST['customer_name'] ?? '';
|
||||||
|
$customer_email = $_POST['customer_email'] ?? '';
|
||||||
|
$customer_phone = $_POST['customer_phone'] ?? '';
|
||||||
|
$tour_date = $_POST['tour_date'] ?? '';
|
||||||
|
$num_people = $_POST['num_people'] ?? 1;
|
||||||
|
$status = 'pending';
|
||||||
|
|
||||||
|
if ($tour_id && !empty($customer_name) && !empty($customer_email) && !empty($tour_date)) {
|
||||||
|
$stmt = db()->prepare("INSERT INTO tour_bookings (tour_package_id, customer_name, customer_email, customer_phone, tour_date, num_people, status) VALUES (?, ?, ?, ?, ?, ?, ?)");
|
||||||
|
$stmt->execute([$tour_id, $customer_name, $customer_email, $customer_phone, $tour_date, $num_people, $status]);
|
||||||
|
$booking_id = db()->lastInsertId();
|
||||||
|
|
||||||
|
echo '<div class="container mt-5 pt-5"><div class="alert alert-success">Thank you! Your tour booking has been received. We will contact you shortly.</div></div>';
|
||||||
|
} else {
|
||||||
|
echo '<div class="container mt-5 pt-5"><div class="alert alert-danger">Please fill in all required fields.</div></div>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$tour) {
|
||||||
|
echo '<div class="container mt-5 pt-5"><div class="alert alert-danger">Tour package not found.</div></div>';
|
||||||
|
require_once 'includes/footer.php';
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="container mt-5 pt-5">
|
||||||
|
<h2 class="text-center mb-4">Book Tour: <?php echo htmlspecialchars($tour['name']); ?></h2>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<img src="assets/images/<?php echo htmlspecialchars($tour['image']); ?>" class="img-fluid rounded" alt="<?php echo htmlspecialchars($tour['name']); ?>">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<p><strong>Duration:</strong> <?php echo htmlspecialchars($tour['duration']); ?></p>
|
||||||
|
<p><strong>Itinerary:</strong> <?php echo nl2br(htmlspecialchars($tour['itinerary'])); ?></p>
|
||||||
|
<p><strong>Price:</strong> Rp <?php echo number_format($tour['price'], 0, ',', '.'); ?> / person</p>
|
||||||
|
<hr>
|
||||||
|
<form action="tour_booking.php?tour_id=<?php echo $tour_id; ?>" method="POST">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="customer_name" class="form-label">Full Name</label>
|
||||||
|
<input type="text" class="form-control" id="customer_name" name="customer_name" required>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="customer_email" class="form-label">Email Address</label>
|
||||||
|
<input type="email" class="form-control" id="customer_email" name="customer_email" required>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="customer_phone" class="form-label">Phone Number</label>
|
||||||
|
<input type="tel" class="form-control" id="customer_phone" name="customer_phone" required>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6 mb-3">
|
||||||
|
<label for="tour_date" class="form-label">Tour Date</label>
|
||||||
|
<input type="date" class="form-control" id="tour_date" name="tour_date" required>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6 mb-3">
|
||||||
|
<label for="num_people" class="form-label">Number of People</label>
|
||||||
|
<input type="number" class="form-control" id="num_people" name="num_people" min="1" value="1" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<button type="submit" class="btn btn-primary w-100">Book Now</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php require_once 'includes/footer.php'; ?>
|
||||||
44
travel.php
Normal file
44
travel.php
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
require_once 'db/config.php';
|
||||||
|
$page_title = "Paket Travel";
|
||||||
|
$page_description = "Jelajahi destinasi terbaik bersama kami.";
|
||||||
|
include __DIR__ . '/includes/header.php';
|
||||||
|
|
||||||
|
$tours = db()->query("SELECT * FROM tour_packages ORDER BY name ASC")->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="container mt-5 pt-5">
|
||||||
|
<div class="text-center mb-5">
|
||||||
|
<h1 class="display-5 fw-bold text-uppercase">Paket Wisata</h1>
|
||||||
|
<p class="lead text-muted">Jelajahi destinasi terbaik bersama kami.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row row-cols-1 row-cols-md-2 row-cols-lg-3 g-4">
|
||||||
|
<?php if (empty($tours)): ?>
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="alert alert-info text-center">Saat ini belum ada paket wisata yang tersedia. Silakan cek kembali nanti.</div>
|
||||||
|
</div>
|
||||||
|
<?php else: ?>
|
||||||
|
<?php foreach ($tours as $tour): ?>
|
||||||
|
<div class="col">
|
||||||
|
<div class="card h-100 shadow-sm vehicle-card">
|
||||||
|
<img src="assets/images/<?php echo htmlspecialchars($tour['image']); ?>" class="card-img-top" alt="<?php echo htmlspecialchars($tour['name']); ?>" style="height: 200px; object-fit: cover;">
|
||||||
|
<div class="card-body d-flex flex-column">
|
||||||
|
<h5 class="card-title fw-bold"><?php echo htmlspecialchars($tour['name']); ?></h5>
|
||||||
|
<p class="card-text text-muted flex-grow-1"><?php echo nl2br(htmlspecialchars($tour['itinerary'])); ?></p>
|
||||||
|
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||||
|
<span class="badge bg-light text-dark p-2"><i class="bi bi-clock-fill me-1"></i> <?php echo htmlspecialchars($tour['duration']); ?></span>
|
||||||
|
</div>
|
||||||
|
<h4 class="card-text text-end fw-bold text-primary mb-3">Rp <?php echo number_format($tour['price'], 0, ',', '.'); ?> <span class="fw-normal fs-6 text-muted">/ pax</span></h4>
|
||||||
|
<a href="tour_booking.php?tour_id=<?php echo $tour['id']; ?>" class="btn btn-primary w-100 fw-bold">
|
||||||
|
<i class="bi bi-calendar-check-fill"></i> Book Now
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php include __DIR__ . '/includes/footer.php'; ?>
|
||||||
Loading…
x
Reference in New Issue
Block a user