From 62c0e9ec81412436530faa7bf3be4bdd35a4a75d Mon Sep 17 00:00:00 2001 From: Flatlogic Bot Date: Mon, 3 Nov 2025 08:24:38 +0000 Subject: [PATCH] JT.03.11.25 --- admin.php | 79 +++++++++++++++++ admin_add_tour.php | 95 +++++++++++++++++++++ admin_add_vehicle.php | 101 ++++++++++++++++++++++ admin_bookings.php | 147 ++++++++++++++++++++++++++++++++ admin_delete_tour.php | 28 +++++++ admin_delete_vehicle.php | 28 +++++++ admin_edit_tour.php | 119 ++++++++++++++++++++++++++ admin_edit_vehicle.php | 125 +++++++++++++++++++++++++++ admin_tours.php | 69 +++++++++++++++ admin_vehicles.php | 71 ++++++++++++++++ assets/css/custom.css | 137 ++++++++++++++++++++++++++++++ assets/js/main.js | 1 + booking.php | 80 ++++++++++++++++++ contact.php | 83 ++++++++++++++++++ dashboard.php | 78 +++++++++++++++++ db/001_create_tables.sql | 57 +++++++++++++ db/config.php | 14 +++- db/migrate.php | 13 +++ includes/admin_footer.php | 5 ++ includes/admin_header.php | 49 +++++++++++ includes/admin_sidebar.php | 46 ++++++++++ includes/footer.php | 56 +++++++++++++ includes/header.php | 76 +++++++++++++++++ index.php | 168 +++++-------------------------------- rental.php | 46 ++++++++++ tour_booking.php | 80 ++++++++++++++++++ travel.php | 44 ++++++++++ 27 files changed, 1743 insertions(+), 152 deletions(-) create mode 100644 admin.php create mode 100644 admin_add_tour.php create mode 100644 admin_add_vehicle.php create mode 100644 admin_bookings.php create mode 100644 admin_delete_tour.php create mode 100644 admin_delete_vehicle.php create mode 100644 admin_edit_tour.php create mode 100644 admin_edit_vehicle.php create mode 100644 admin_tours.php create mode 100644 admin_vehicles.php create mode 100644 assets/css/custom.css create mode 100644 assets/js/main.js create mode 100644 booking.php create mode 100644 contact.php create mode 100644 dashboard.php create mode 100644 db/001_create_tables.sql create mode 100644 db/migrate.php create mode 100644 includes/admin_footer.php create mode 100644 includes/admin_header.php create mode 100644 includes/admin_sidebar.php create mode 100644 includes/footer.php create mode 100644 includes/header.php create mode 100644 rental.php create mode 100644 tour_booking.php create mode 100644 travel.php diff --git a/admin.php b/admin.php new file mode 100644 index 0000000..6db42e9 --- /dev/null +++ b/admin.php @@ -0,0 +1,79 @@ + + + + + + + Admin Login - Juanda Transport + + + + + + + +
+
+

Admin Login

+
+ + Juanda Transport Logo + +
+ +
+ +
+
+ + +
+
+ + +
+
+ +
+
+
+ Use admin / password to login. +
+
+
+ + diff --git a/admin_add_tour.php b/admin_add_tour.php new file mode 100644 index 0000000..37bb7e7 --- /dev/null +++ b/admin_add_tour.php @@ -0,0 +1,95 @@ + ["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'; +?> + +

Add New Tour Package

+

Fill out the form to add a new tour package.

+ +
+
+
Tour Package Details
+
+
+ +
+ +

+ +
+ +
+
+ + +
+
+ + +
+
+
+ + +
+
+ + +
+
+
+ + +
+
+ + Cancel +
+
+
+ + diff --git a/admin_add_vehicle.php b/admin_add_vehicle.php new file mode 100644 index 0000000..3f16fc4 --- /dev/null +++ b/admin_add_vehicle.php @@ -0,0 +1,101 @@ + ["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'; +?> + +

Add New Vehicle

+

Fill out the form to add a new vehicle to the fleet.

+ +
+
+
Vehicle Details
+
+
+ +
+ +

+ +
+ +
+
+ + +
+
+ + +
+
+
+ + +
+
+ + +
+
+
+ + +
+
+ + Cancel +
+
+
+ + diff --git a/admin_bookings.php b/admin_bookings.php new file mode 100644 index 0000000..d33001a --- /dev/null +++ b/admin_bookings.php @@ -0,0 +1,147 @@ +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'; +?> + +
+

Manage Bookings

+

View and manage customer bookings for vehicles and tours.

+ +
+
+
Vehicle Rentals
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
CustomerVehicleDatesStatusAction
No vehicle bookings found.
+
+ +
to +
+ + +
+ + +
+
+
+
+ +
+
+
Tour Package Bookings
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
CustomerTour PackageTour Date# of PeopleStatusAction
No tour bookings found.
+
+ +
+
+ + +
+ + +
+
+
+
+
+ + diff --git a/admin_delete_tour.php b/admin_delete_tour.php new file mode 100644 index 0000000..bf1cc12 --- /dev/null +++ b/admin_delete_tour.php @@ -0,0 +1,28 @@ +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; +} diff --git a/admin_delete_vehicle.php b/admin_delete_vehicle.php new file mode 100644 index 0000000..839f8e0 --- /dev/null +++ b/admin_delete_vehicle.php @@ -0,0 +1,28 @@ +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; +} diff --git a/admin_edit_tour.php b/admin_edit_tour.php new file mode 100644 index 0000000..2d1caa3 --- /dev/null +++ b/admin_edit_tour.php @@ -0,0 +1,119 @@ +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'; +?> + +

Edit Tour Package

+

Update the details for the tour package below.

+ +
+
+
Tour Package Details
+
+
+ +
+ +

+ +
+ +
+
+ + +
+
+ + +
+
+
+ + +
+
+ + +
+
+
+ + +
+
+ + Cancel +
+
+
+ + diff --git a/admin_edit_vehicle.php b/admin_edit_vehicle.php new file mode 100644 index 0000000..6bbf0e7 --- /dev/null +++ b/admin_edit_vehicle.php @@ -0,0 +1,125 @@ +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'; +?> + +

Edit Vehicle

+

Update the details for the vehicle below.

+ +
+
+
Vehicle Details
+
+
+ +
+ +

+ +
+ +
+
+ + +
+
+ + +
+
+
+ + +
+
+ + +
+
+
+ > + +
+
+ + Cancel +
+
+
+ + diff --git a/admin_tours.php b/admin_tours.php new file mode 100644 index 0000000..4e4d02b --- /dev/null +++ b/admin_tours.php @@ -0,0 +1,69 @@ +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'; +?> + +

Manage Tour Packages

+

Add, edit, or remove tour packages.

+ +
+
+
Tour Package List
+ Add Tour Package +
+
+ +
+ +
+ +
+ No tour packages found. Add one now. +
+ +
+ + + + + + + + + + + + + + + + + + + + + +
NameDestinationDuration (days)PriceActions
Rp + + +
+
+ +
+
+ + diff --git a/admin_vehicles.php b/admin_vehicles.php new file mode 100644 index 0000000..6089f41 --- /dev/null +++ b/admin_vehicles.php @@ -0,0 +1,71 @@ +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'; +?> + +

Manage Vehicles

+

Add, edit, or remove vehicles from your fleet.

+ +
+
+
Vehicle List
+ Add Vehicle +
+
+ +
+ +
+ +
+ No vehicles found. Add one now. +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
NameTypeCapacityPrice per DayStatusActions
Rp + + +
+
+ +
+
+ + diff --git a/assets/css/custom.css b/assets/css/custom.css new file mode 100644 index 0000000..44e4ca7 --- /dev/null +++ b/assets/css/custom.css @@ -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; +} diff --git a/assets/js/main.js b/assets/js/main.js new file mode 100644 index 0000000..6130445 --- /dev/null +++ b/assets/js/main.js @@ -0,0 +1 @@ +// Custom JavaScript will go here diff --git a/booking.php b/booking.php new file mode 100644 index 0000000..d12deaa --- /dev/null +++ b/booking.php @@ -0,0 +1,80 @@ +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 '
Thank you! Your booking has been received. We will contact you shortly.
'; + } else { + echo '
Please fill in all required fields.
'; + } +} + +if (!$vehicle) { + echo '
Vehicle not found.
'; + require_once 'includes/footer.php'; + exit; +} +?> + +
+

Book Vehicle:

+
+
+ <?php echo htmlspecialchars($vehicle['name']); ?> +
+
+

Type:

+

Capacity: people

+

Price: Rp / day

+
+
+
+ + +
+
+ + +
+
+ + +
+
+
+ + +
+
+ + +
+
+ +
+
+
+
+ + \ No newline at end of file diff --git a/contact.php b/contact.php new file mode 100644 index 0000000..7e13933 --- /dev/null +++ b/contact.php @@ -0,0 +1,83 @@ + + +
+
+
+

Hubungi Kami

+

Punya pertanyaan atau ingin memesan? Isi formulir di bawah ini dan tim kami akan segera menghubungi Anda.

+ + + + + +
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ +
+
+
+
+ +
+

Untuk respons lebih cepat, hubungi kami langsung melalui WhatsApp.

+ Hubungi via WhatsApp +
+
+
+
+ + diff --git a/dashboard.php b/dashboard.php new file mode 100644 index 0000000..6b6e2cc --- /dev/null +++ b/dashboard.php @@ -0,0 +1,78 @@ +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'; +?> + +

Dashboard

+

Welcome back, ! Here's a summary of your site.

+ + +
+ +
+ + +
+
+
+
Total Vehicles
+ +
+
+
+
+
Tour Packages
+ +
+
+
+
+
Total Bookings
+ +
+
+
+ +
+ + Under Construction: More features are coming soon! +
+ + \ No newline at end of file diff --git a/db/001_create_tables.sql b/db/001_create_tables.sql new file mode 100644 index 0000000..c0d6549 --- /dev/null +++ b/db/001_create_tables.sql @@ -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`) +); diff --git a/db/config.php b/db/config.php index f12ebaf..a6bdebe 100644 --- a/db/config.php +++ b/db/config.php @@ -8,10 +8,16 @@ define('DB_PASS', '2c66b530-2a65-423a-a106-6760b49ad1a2'); function db() { static $pdo; if (!$pdo) { - $pdo = new PDO('mysql:host='.DB_HOST.';dbname='.DB_NAME.';charset=utf8mb4', DB_USER, DB_PASS, [ - PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, - PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, - ]); + try { + $pdo = new PDO('mysql:host='.DB_HOST.';charset=utf8mb4', DB_USER, DB_PASS, [ + PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, + 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; } diff --git a/db/migrate.php b/db/migrate.php new file mode 100644 index 0000000..e1973e0 --- /dev/null +++ b/db/migrate.php @@ -0,0 +1,13 @@ +exec($sql); + echo "Database migration completed successfully."; +} catch (PDOException $e) { + die("Database migration failed: " . $e->getMessage()); +} diff --git a/includes/admin_footer.php b/includes/admin_footer.php new file mode 100644 index 0000000..b25163b --- /dev/null +++ b/includes/admin_footer.php @@ -0,0 +1,5 @@ + + + + + diff --git a/includes/admin_header.php b/includes/admin_header.php new file mode 100644 index 0000000..099296c --- /dev/null +++ b/includes/admin_header.php @@ -0,0 +1,49 @@ + + + + + + + Admin Dashboard - Juanda Transport + + + + + + + +
diff --git a/includes/admin_sidebar.php b/includes/admin_sidebar.php new file mode 100644 index 0000000..b437dd2 --- /dev/null +++ b/includes/admin_sidebar.php @@ -0,0 +1,46 @@ + +
diff --git a/includes/footer.php b/includes/footer.php new file mode 100644 index 0000000..db5af6e --- /dev/null +++ b/includes/footer.php @@ -0,0 +1,56 @@ + + + + + + + + +
+
+
+
+ +

+ Penyedia layanan transportasi dan paket wisata terbaik di Indonesia. Kami berkomitmen untuk memberikan pengalaman perjalanan yang aman, nyaman, dan tak terlupakan. +

+
+
+
Link Cepat
+ +
+
+
Kontak
+
    +
  • Calukan RT 1 RW 5, Keboansikep, East Java
  • +
  • +62 897-3577-791
  • +
  • admin@juandatransport.com
  • +
+
+
+
Sosial Media
+ +
+
+
+ Copyright © 2025 Juanda Transport. +
+
+
+ + + + + + + diff --git a/includes/header.php b/includes/header.php new file mode 100644 index 0000000..3f60c97 --- /dev/null +++ b/includes/header.php @@ -0,0 +1,76 @@ + + + + + + + + + <?php echo isset($page_title) ? htmlspecialchars($page_title) . ' - Juanda Transport' : 'Juanda Transport Rental Tour Travel'; ?> + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + +
diff --git a/index.php b/index.php index 7205f3d..8b27452 100644 --- a/index.php +++ b/index.php @@ -1,150 +1,22 @@ - - - - - - New Style - - - - - - - - - - - - - - - - - - - - - -
-
-

Analyzing your requirements and generating your website…

-
- Loading… -
-

AI is collecting your requirements and applying the first changes.

-

This page will update automatically as the plan is implemented.

-

Runtime: PHP — UTC

-
-
-
- Page updated: (UTC) -
- - + +
+
+

Jelajahi Indonesia dengan
Juanda Travel

+

Rental kendaraan & paket wisata terpercaya untuk perjalanan Anda.

+

Melayani dari Calukan RT 1 RW 5 Keboansikep, East Java

+ +
+
+ \ No newline at end of file diff --git a/rental.php b/rental.php new file mode 100644 index 0000000..e42b242 --- /dev/null +++ b/rental.php @@ -0,0 +1,46 @@ +query("SELECT * FROM vehicles ORDER BY name ASC")->fetchAll(PDO::FETCH_ASSOC); +?> + +
+
+

Katalog Kendaraan

+

Pilih kendaraan yang paling sesuai dengan kebutuhan perjalanan Anda.

+
+ +
+ +
+
Saat ini belum ada kendaraan yang tersedia. Silakan cek kembali nanti.
+
+ + +
+
+ <?php echo htmlspecialchars($vehicle['name']); ?> +
+
+

+
+ Penumpang + +
+

Rp / hari

+ + Book Now + +
+
+
+ + +
+
+ + + diff --git a/tour_booking.php b/tour_booking.php new file mode 100644 index 0000000..382b915 --- /dev/null +++ b/tour_booking.php @@ -0,0 +1,80 @@ +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 '
Thank you! Your tour booking has been received. We will contact you shortly.
'; + } else { + echo '
Please fill in all required fields.
'; + } +} + +if (!$tour) { + echo '
Tour package not found.
'; + require_once 'includes/footer.php'; + exit; +} +?> + +
+

Book Tour:

+
+
+ <?php echo htmlspecialchars($tour['name']); ?> +
+
+

Duration:

+

Itinerary:

+

Price: Rp / person

+
+
+
+ + +
+
+ + +
+
+ + +
+
+
+ + +
+
+ + +
+
+ +
+
+
+
+ + diff --git a/travel.php b/travel.php new file mode 100644 index 0000000..275ef48 --- /dev/null +++ b/travel.php @@ -0,0 +1,44 @@ +query("SELECT * FROM tour_packages ORDER BY name ASC")->fetchAll(PDO::FETCH_ASSOC); +?> + +
+
+

Paket Wisata

+

Jelajahi destinasi terbaik bersama kami.

+
+ +
+ +
+
Saat ini belum ada paket wisata yang tersedia. Silakan cek kembali nanti.
+
+ + +
+
+ <?php echo htmlspecialchars($tour['name']); ?> +
+
+

+
+ +
+

Rp / pax

+ + Book Now + +
+
+
+ + +
+
+ +