3 Commits

Author SHA1 Message Date
twotalesanimation
b69f8f5f1b local changes. 2025-07-24 07:20:51 +02:00
twotalesanimation
53c29b62ca Merge branch 'main' of http://192.168.0.107:30008/TwoTalesDev/4WDCSA.co.za 2025-06-13 10:45:41 +02:00
twotalesanimation
c8c8dfb9c7 Update .gitignore on live server 2025-06-13 10:40:46 +02:00
25 changed files with 332 additions and 116 deletions

1
.gitignore vendored
View File

@@ -1,5 +1,6 @@
.env .env
/vendor/ /vendor/
.htaccess .htaccess
/uploads/
/uploads/pop/ /uploads/pop/

View File

@@ -2,7 +2,8 @@
checkAdmin(); checkAdmin();
// Fetch all trips // Fetch all trips
$courseSql = "SELECT date, course_id, course_type FROM courses"; $courseSql = "SELECT date, course_id, course_type FROM courses WHERE DATE(date) >= CURDATE()";
$courseResult = $conn->query($courseSql); $courseResult = $conn->query($courseSql);
if (!$courseResult) { if (!$courseResult) {
echo "Error in SQL query: " . $conn->error; echo "Error in SQL query: " . $conn->error;

View File

@@ -1,7 +1,19 @@
<?php include_once('header02.php'); <?php include_once('header02.php');
checkAdmin(); checkAdmin();
if ($_SERVER["REQUEST_METHOD"] === "POST" && isset($_POST['accept_indemnity'])) {
$user_id = intval($_POST['user_id']);
$stmt = $conn->prepare("UPDATE membership_application SET accept_indemnity = 1 WHERE user_id = ?");
if ($stmt) {
$stmt->bind_param("i", $user_id);
$stmt->execute();
$stmt->close();
}
}
// SQL query to fetch data // SQL query to fetch data
$sql = "SELECT user_id, first_name, last_name, tel_cell, email, dob FROM membership_application"; $sql = "SELECT user_id, first_name, last_name, tel_cell, email, dob, accept_indemnity FROM membership_application";
$result = $conn->query($sql); $result = $conn->query($sql);
?> ?>
<style> <style>
@@ -173,6 +185,7 @@ if (!empty($bannerImages)) {
<th>Date of Birth</th> <th>Date of Birth</th>
<th>Membership</th> <th>Membership</th>
<th>View Info</th> <th>View Info</th>
<th>Indemnity</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@@ -181,24 +194,32 @@ if (!empty($bannerImages)) {
// Output data of each row // Output data of each row
while ($row = $result->fetch_assoc()) { while ($row = $result->fetch_assoc()) {
echo "<tr> echo "<tr>
<td>" . htmlspecialchars($row['first_name']) . "</td> <td>" . htmlspecialchars($row['first_name']) . "</td>
<td>" . htmlspecialchars($row['last_name']) . "</td> <td>" . htmlspecialchars($row['last_name']) . "</td>
<td>" . htmlspecialchars($row['tel_cell']) . "</td> <td>" . htmlspecialchars($row['tel_cell']) . "</td>
<td>" . htmlspecialchars($row['email']) . "</td> <td>" . htmlspecialchars($row['email']) . "</td>
<td>" . htmlspecialchars($row['dob']) . "</td> <td>" . htmlspecialchars($row['dob']) . "</td>
<td>"; <td>" . (getUserMemberStatus($row['user_id']) ? 'ACTIVE' : 'INACTIVE') . "</td>
if (getUserMemberStatus($row['user_id'])) { <td><a href='member_info.php?token=" . encryptData($row['user_id'], $salt) . "' class='theme-btn style-two style-three'><span data-hover='PAYMENT RECEIVED'>View Info</span></a></td>
echo 'ACTIVE'; <td>";
if (!$row['accept_indemnity']) {
echo "<form method='POST' style='display:inline;'>
<input type='hidden' name='user_id' value='" . $row['user_id'] . "'>
<button type='submit' name='accept_indemnity' class='theme-btn small'>Accept</button>
</form>";
} else { } else {
echo 'INACTIVE'; echo "✅ Accepted";
}; }
echo "</td>
<td><a href='member_info.php?token=" . encryptData($row['user_id'], $salt) . "' class='theme-btn style-two style-three'><span data-hover='PAYMENT RECEIVED'>View Info</span></a></td> echo "</td>
</tr>"; </tr>";
} }
} else { } else {
echo '<tr><td colspan="5">No records found</td></tr>'; echo '<tr><td colspan="8">No records found</td></tr>';
} ?> }
?>
</tbody> </tbody>
</table> </table>

View File

@@ -170,7 +170,7 @@ if (!empty($bannerImages)) {
echo "<h4>{$tripName}</h4>"; echo "<h4>{$tripName}</h4>";
// Fetch bookings for the current trip // Fetch bookings for the current trip
$bookingsSql = "SELECT b.user_id, b.num_vehicles, b.num_adults, b.num_children, b.radio, b.status, $bookingsSql = "SELECT b.user_id, b.num_vehicles, b.num_adults, b.num_children, b.num_pensioners, b.radio, b.status,
u.first_name, u.last_name, u.first_name, u.last_name,
(b.total_amount - b.discount_amount) AS paid (b.total_amount - b.discount_amount) AS paid
FROM bookings b FROM bookings b
@@ -192,6 +192,7 @@ if (!empty($bannerImages)) {
<th>Vehicles</th> <th>Vehicles</th>
<th>Adults</th> <th>Adults</th>
<th>Children</th> <th>Children</th>
<th>Pensioners</th>
<th>Radio</th> <th>Radio</th>
<th>Status</th> <th>Status</th>
<th>Amount</th> <th>Amount</th>
@@ -202,6 +203,7 @@ if (!empty($bannerImages)) {
$userName = htmlspecialchars($booking['first_name'] . ' ' . $booking['last_name']); $userName = htmlspecialchars($booking['first_name'] . ' ' . $booking['last_name']);
$numVehicles = htmlspecialchars($booking['num_vehicles']); $numVehicles = htmlspecialchars($booking['num_vehicles']);
$numAdults = htmlspecialchars($booking['num_adults']); $numAdults = htmlspecialchars($booking['num_adults']);
$numPensioners = htmlspecialchars($booking['num_pensioners']);
$numChildren = htmlspecialchars($booking['num_children']); $numChildren = htmlspecialchars($booking['num_children']);
$radio = $booking['radio'] == 1 ? "YES" : "NO"; $radio = $booking['radio'] == 1 ? "YES" : "NO";
$status = htmlspecialchars($booking['status']); $status = htmlspecialchars($booking['status']);
@@ -213,6 +215,7 @@ if (!empty($bannerImages)) {
<td>{$numVehicles}</td> <td>{$numVehicles}</td>
<td>{$numAdults}</td> <td>{$numAdults}</td>
<td>{$numChildren}</td> <td>{$numChildren}</td>
<td>{$numPensioners}</td>
<td>{$radio}</td> <td>{$radio}</td>
<td>{$status}</td> <td>{$status}</td>
<td>{$paid}</td> <td>{$paid}</td>

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 334 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 258 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

Binary file not shown.

View File

@@ -2,20 +2,66 @@
<style> <style>
.image { .image {
width: 400px; /* Set your desired width */ width: 400px;
height: 320px; /* Set your desired height */ /* Set your desired width */
overflow: hidden; /* Hide any overflow */ height: 320px;
display: block; /* Ensure proper block behavior */ /* Set your desired height */
} overflow: hidden;
/* Hide any overflow */
display: block;
/* Ensure proper block behavior */
}
.image img { .image img {
width: 100%; /* Image scales to fill the container */ width: 100%;
height: 100%; /* Image scales to fill the container */ /* Image scales to fill the container */
object-fit: cover; /* Fills the container while maintaining aspect ratio */ height: 100%;
object-position: top; /* Aligns the top of the image with the top of the container */ /* Image scales to fill the container */
display: block; /* Prevents inline whitespace issues */ object-fit: cover;
} /* Fills the container while maintaining aspect ratio */
object-position: top;
/* Aligns the top of the image with the top of the container */
display: block;
/* Prevents inline whitespace issues */
}
.custom-modal {
display: none;
position: fixed;
z-index: 9999;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgba(0, 0, 0, 0.9);
}
.custom-modal-content {
margin: 5% auto;
padding: 20px;
max-width: 800px;
text-align: center;
background: #fff;
border-radius: 10px;
position: relative;
}
.custom-modal-content img {
max-width: 100%;
height: auto;
border-radius: 5px;
}
.custom-modal-close {
position: absolute;
top: 10px;
right: 20px;
font-size: 30px;
font-weight: bold;
color: #333;
cursor: pointer;
}
</style> </style>
<?php <?php
@@ -28,7 +74,7 @@ if (!empty($bannerImages)) {
} }
?> ?>
<section class="page-banner-area pt-50 pb-35 rel z-1 bgs-cover" style="background-image: url('<?php echo $randomBanner; ?>');"> <section class="page-banner-area pt-50 pb-35 rel z-1 bgs-cover" style="background-image: url('<?php echo $randomBanner; ?>');">
<div class="banner-overlay"></div> <div class="banner-overlay"></div>
<div class="container"> <div class="container">
<div class="banner-inner text-white mb-50"> <div class="banner-inner text-white mb-50">
<h2 class="page-title mb-10" data-aos="fade-left" data-aos-duration="1500" data-aos-offset="50">4WDCSA events</h2> <h2 class="page-title mb-10" data-aos="fade-left" data-aos-duration="1500" data-aos-offset="50">4WDCSA events</h2>
@@ -69,7 +115,7 @@ if (!empty($bannerImages)) {
<?php <?php
// Query to retrieve data from the trips table // Query to retrieve data from the trips table
$sql = "SELECT event_id, date, time, name, image, description, feature, location, type FROM events WHERE date > CURDATE()"; $sql = "SELECT event_id, date, time, name, image, description, feature, location, type, promo FROM events WHERE date > CURDATE() ORDER BY date ASC";
$result = $conn->query($sql); $result = $conn->query($sql);
@@ -85,6 +131,7 @@ if (!empty($bannerImages)) {
$feature = $row['feature']; $feature = $row['feature'];
$location = $row['location']; $location = $row['location'];
$type = $row['type']; $type = $row['type'];
$promo = $row['promo'];
// Determine the badge text based on the status // Determine the badge text based on the status
$badge_text = 'OPEN DAY'; $badge_text = 'OPEN DAY';
@@ -104,8 +151,14 @@ if (!empty($bannerImages)) {
<p>' . $description . '</p> <p>' . $description . '</p>
<ul class="blog-meta"> <ul class="blog-meta">
<li><i class="far fa-calendar"></i> ' . convertDate($date) . '</li> <li><i class="far fa-calendar"></i> ' . convertDate($date) . '</li>
<li><i class="far fa-clock"></i> '.$time.'</li> <li><i class="far fa-clock"></i> ' . $time . '</li>
</ul> </ul>
<button type="button" class="theme-btn style-three view-image-btn" style="padding: 2px 20px"
data-image-src="' . $promo . '"
data-image-title="' . htmlspecialchars($name, ENT_QUOTES) . '">
View Promo
</button>
</div> </div>
</div>'; </div>';
} }
@@ -123,6 +176,45 @@ if (!empty($bannerImages)) {
</div> </div>
</section> </section>
<!-- Tour List Area end --> <!-- Tour List Area end -->
<!-- Custom Image Modal -->
<div id="customImageModal" class="custom-modal">
<div class="custom-modal-content">
<span class="custom-modal-close">&times;</span>
<h5 id="modalImageTitle"></h5>
<img id="modalImageElement" src="" alt="" class="img-fluid">
</div>
</div>
<script>
document.addEventListener("DOMContentLoaded", function() {
const modal = document.getElementById("customImageModal");
const modalImg = document.getElementById("modalImageElement");
const modalTitle = document.getElementById("modalImageTitle");
const closeBtn = document.querySelector(".custom-modal-close");
document.querySelectorAll(".view-image-btn").forEach(button => {
button.addEventListener("click", () => {
const src = button.getAttribute("data-image-src");
const title = button.getAttribute("data-image-title");
modalImg.src = src;
modalTitle.textContent = title;
modal.style.display = "block";
});
});
closeBtn.addEventListener("click", () => {
modal.style.display = "none";
modalImg.src = "";
});
// Optional: click outside modal to close
window.addEventListener("click", (e) => {
if (e.target === modal) {
modal.style.display = "none";
modalImg.src = "";
}
});
});
</script>
<?php include_once("insta_footer.php"); ?> <?php include_once("insta_footer.php"); ?>

View File

@@ -32,7 +32,7 @@ function getTripCount()
$conn = openDatabaseConnection(); $conn = openDatabaseConnection();
// SQL query to count the number of rows // SQL query to count the number of rows
$sql = "SELECT COUNT(*) AS total FROM trips WHERE start_date > CURDATE()"; $sql = "SELECT COUNT(*) AS total FROM trips WHERE published = 1 AND start_date > CURDATE()";
$result = $conn->query($sql); $result = $conn->query($sql);
// Fetch the count from the result // Fetch the count from the result
@@ -1391,7 +1391,8 @@ function countUpcomingTrips()
// Open database connection // Open database connection
$conn = openDatabaseConnection(); $conn = openDatabaseConnection();
$query = "SELECT COUNT(*) AS trip_count FROM trips WHERE start_date > CURDATE()"; $query = "SELECT COUNT(*) AS trip_count FROM trips WHERE published = 1 AND start_date > CURDATE()";
if ($result = $conn->query($query)) { if ($result = $conn->query($query)) {
$row = $result->fetch_assoc(); $row = $result->fetch_assoc();

View File

@@ -81,7 +81,11 @@ if (countUpcomingTrips() > 0) { ?>
<div class="row justify-content-center"> <div class="row justify-content-center">
<?php <?php
// Query to retrieve data from the trips table // Query to retrieve data from the trips table
$sql = "SELECT trip_id, trip_name, location, short_description, start_date, end_date, vehicle_capacity, cost_members, places_booked FROM trips ORDER BY trip_id DESC LIMIT 4"; $sql = "SELECT trip_id, trip_name, location, short_description, start_date, end_date, vehicle_capacity, cost_members, places_booked
FROM trips
WHERE published = 1
ORDER BY trip_id DESC
LIMIT 4";
$result = $conn->query($sql); $result = $conn->query($sql);
if ($result->num_rows > 0) { if ($result->num_rows > 0) {
@@ -114,7 +118,7 @@ if (countUpcomingTrips() > 0) { ?>
</div> </div>
<div class="destination-footer"> <div class="destination-footer">
<span class="price"><span>R ' . $cost_members . '</span>/per member</span> <span class="price"><span>R ' . $cost_members . '</span>/per member</span>
<a href="trip-details.php?trip_id=' . $trip_id . '" class="read-more">Book Now <i class="fal fa-angle-right"></i></a> <a href="trip-details.php?token=' . encryptData($trip_id, $salt) . '" class="read-more">Book Now <i class="fal fa-angle-right"></i></a>
</div> </div>
</div> </div>
</div>'; </div>';

View File

@@ -132,7 +132,7 @@ if (!empty($bannerImages)) {
</div> </div>
<p>Your invoice has been sent to <b><?php echo htmlspecialchars($user_email); ?></b>. Please upload your proof of payment below.</p> <p>Your invoice has been sent to <b><?php echo htmlspecialchars($user_email); ?></b>. Please upload your proof of payment below.</p>
<p>Bookings not paid for within 24 hours will be forfeited.</p> <!-- <p>Bookings not paid for within 24 hours will be forfeited.</p> -->
<h5>Payment Details:</h5> <h5>Payment Details:</h5>
<p>The Four Wheel Drive Club of Southern Africa<br>FNB<br>Account Number: 58810022334<br>Branch code: 250655<br>Reference: <?php echo htmlspecialchars($eft_id); ?><br>Amount: R <?php echo number_format($payment_amount, 2); ?></p> <p>The Four Wheel Drive Club of Southern Africa<br>FNB<br>Account Number: 58810022334<br>Branch code: 250655<br>Reference: <?php echo htmlspecialchars($eft_id); ?><br>Amount: R <?php echo number_format($payment_amount, 2); ?></p>
<a href="submit_pop.php" class="theme-btn style-two style-three" style="width:100%;"> <a href="submit_pop.php" class="theme-btn style-two style-three" style="width:100%;">

View File

@@ -107,6 +107,7 @@ if (!empty($bannerImages)) {
// Loop through each row // Loop through each row
while ($row = $result->fetch_assoc()) { while ($row = $result->fetch_assoc()) {
$eft_id = $row['eft_id']; $eft_id = $row['eft_id'];
$file_name = str_replace(' ', '_', $eft_id);
$eft_user = $row['user_id']; $eft_user = $row['user_id'];
$eft_amount = $row['amount']; $eft_amount = $row['amount'];
$eft_description = $row['description']; $eft_description = $row['description'];
@@ -115,8 +116,8 @@ if (!empty($bannerImages)) {
echo ' echo '
<div class="destination-item style-three bgc-lighter booking " data-aos="fade-up" data-aos-duration="1500" data-aos-offset="50"> <div class="destination-item style-three bgc-lighter booking " data-aos="fade-up" data-aos-duration="1500" data-aos-offset="50">
<div class="p-4" > <div class="p-4" >
<iframe src="uploads/pop/'.$eft_id.'.pdf#toolbar=0" width="400px" height="200px"></iframe> <iframe src="uploads/pop/'.$file_name.'.pdf#toolbar=0" width="400px" height="200px"></iframe>
<p><a href="uploads/pop/'.$eft_id.'.pdf" target="_new" class="theme-btn style-three" style="width:100%;">View Full PDF</a></p> <p><a href="uploads/pop/'.$file_name.'.pdf" target="_new" class="theme-btn style-three" style="width:100%;">View Full PDF</a></p>
</div> </div>
<div style="width:100%;" class="content"> <div style="width:100%;" class="content">

View File

@@ -34,9 +34,10 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$num_vehicles = isset($_POST['vehicles']) ? intval($_POST['vehicles']) : 1; // Default to 1 vehicle $num_vehicles = isset($_POST['vehicles']) ? intval($_POST['vehicles']) : 1; // Default to 1 vehicle
$num_adults = isset($_POST['adults']) ? intval($_POST['adults']) : 1; // Default to 1 adult $num_adults = isset($_POST['adults']) ? intval($_POST['adults']) : 1; // Default to 1 adult
$num_children = isset($_POST['children']) ? intval($_POST['children']) : 0; // Default to 0 children $num_children = isset($_POST['children']) ? intval($_POST['children']) : 0; // Default to 0 children
$radio = isset($_POST['AddExtra']) ? 1 : 0; // Checkbox for extras $num_pensioners = isset($_POST['pensioners']) ? intval($_POST['pensioners']) : 0; // Default to 0 pensioners
// $radio = isset($_POST['AddExtra']) ? 1 : 0; // Checkbox for extras
// Fetch trip costs from the database // Fetch trip costs from the database
$query = "SELECT trip_name, cost_members, cost_nonmembers, booking_fee, start_date, end_date, trip_code FROM trips WHERE trip_id = ?"; $query = "SELECT trip_name, cost_members, cost_nonmembers, cost_pensioner_member, cost_pensioner, booking_fee, start_date, end_date, trip_code FROM trips WHERE trip_id = ?";
$stmt = $conn->prepare($query); $stmt = $conn->prepare($query);
$stmt->bind_param('i', $trip_id); $stmt->bind_param('i', $trip_id);
$stmt->execute(); $stmt->execute();
@@ -56,7 +57,10 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$trip_name = $trip['trip_name']; $trip_name = $trip['trip_name'];
$cost_members = intval($trip['cost_members']); $cost_members = intval($trip['cost_members']);
$cost_nonmembers = intval($trip['cost_nonmembers']); $cost_nonmembers = intval($trip['cost_nonmembers']);
$cost_pensioner_member = intval($trip['cost_pensioner_member']);
$cost_pensioner = intval($trip['cost_pensioner']);
$member_discount = $cost_nonmembers - $cost_members; $member_discount = $cost_nonmembers - $cost_members;
$member_discount_pensioner = $cost_pensioner - $cost_pensioner_member;
$booking_fee = $trip['booking_fee']; $booking_fee = $trip['booking_fee'];
$radioCost = $radio ? 50 : 0; $radioCost = $radio ? 50 : 0;
$start_date = $trip['start_date']; // Start date of the trip $start_date = $trip['start_date']; // Start date of the trip
@@ -72,11 +76,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
// Calculate total based on membership // Calculate total based on membership
if ($is_member) { if ($is_member) {
$total = (($num_adults + $num_children) * $cost_nonmembers) + $radioCost + ($num_vehicles * $booking_fee); $total = (($num_adults + $num_children) * $cost_nonmembers) + ($num_pensioners * $cost_pensioner) + $radioCost + ($num_vehicles * $booking_fee);
$discountAmount = ($num_adults + $num_children) * $member_discount; $discountAmount = (($num_adults + $num_children) * $member_discount) + ($num_pensioners * $member_discount_pensioner );
$payment_amount = $total - $discountAmount; $payment_amount = $total - $discountAmount;
} else { } else {
$total = (($num_adults + $num_children) * $cost_nonmembers) + $radioCost + ($num_vehicles * $booking_fee); $total = (($num_adults + $num_children) * $cost_nonmembers) + ($num_pensioners * $cost_pensioner) + $radioCost + ($num_vehicles * $booking_fee);
$payment_amount = $total; $payment_amount = $total;
} }
@@ -85,19 +89,19 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$type = 'trip'; $type = 'trip';
$payment_id = uniqid(); $payment_id = uniqid();
// $eft_id = strtoupper(base_convert(time(), 10, 36)); // Convert timestamp to base36 // $eft_id = strtoupper(base_convert(time(), 10, 36)); // Convert timestamp to base36
$eft_id = strtoupper($trip_code." ".getLastName($user_id)); $eft_id = strtoupper($trip_code." ".getInitialSurname($user_id));
// Insert booking into the database // Insert booking into the database
$sql = "INSERT INTO bookings (booking_type, user_id, from_date, to_date, num_vehicles, num_adults, num_children, total_amount, discount_amount, status, payment_id, trip_id, radio, eft_id) $sql = "INSERT INTO bookings (booking_type, user_id, from_date, to_date, num_vehicles, num_adults, num_children, total_amount, discount_amount, status, payment_id, trip_id, radio, eft_id, num_pensioners)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
$stmt = $conn->prepare($sql); $stmt = $conn->prepare($sql);
if (!$stmt) { if (!$stmt) {
die("Preparation failed: " . $conn->error); die("Preparation failed: " . $conn->error);
} }
$stmt->bind_param('sissiiiddssiis', $type, $user_id, $start_date, $end_date, $num_vehicles, $num_adults, $num_children, $total, $discountAmount, $status, $payment_id, $trip_id, $radio, $eft_id); $stmt->bind_param('sissiiiddssiisi', $type, $user_id, $start_date, $end_date, $num_vehicles, $num_adults, $num_children, $total, $discountAmount, $status, $payment_id, $trip_id, $radio, $eft_id, $num_pensioners);
if ($stmt->execute()) { if ($stmt->execute()) {
// Get the generated booking_id // Get the generated booking_id

View File

@@ -12,7 +12,7 @@ $trip_id = intval(decryptData($token, $salt)); // Ensures $trip_id is treated as
// Prepare the SQL query // Prepare the SQL query
$sql = "SELECT trip_id, trip_name, location, short_description, long_description, start_date, end_date, $sql = "SELECT trip_id, trip_name, location, short_description, long_description, start_date, end_date,
vehicle_capacity, cost_members, cost_nonmembers, places_booked, booking_fee vehicle_capacity, cost_members, cost_nonmembers, places_booked, booking_fee, cost_pensioner, cost_pensioner_member
FROM trips FROM trips
WHERE trip_id = ?"; WHERE trip_id = ?";
@@ -45,7 +45,10 @@ if ($stmt) {
$capacity = $row['vehicle_capacity']; $capacity = $row['vehicle_capacity'];
$cost_members = $row['cost_members']; $cost_members = $row['cost_members'];
$cost_nonmembers = $row['cost_nonmembers']; $cost_nonmembers = $row['cost_nonmembers'];
$cost_pensioner = $row['cost_pensioner'];
$cost_pensioner_member = $row['cost_pensioner_member'];
$member_discount = $cost_nonmembers - $cost_members; $member_discount = $cost_nonmembers - $cost_members;
$member_discount_pensioner = $cost_pensioner - $cost_pensioner_member;
$places_booked = $row['places_booked']; $places_booked = $row['places_booked'];
$booking_fee = $row['booking_fee']; $booking_fee = $row['booking_fee'];
$remaining_places = getAvailableSpaces($trip_id); $remaining_places = getAvailableSpaces($trip_id);
@@ -145,25 +148,52 @@ $conn->close();
/* Optional: makes non-member price stand out */ /* Optional: makes non-member price stand out */
} }
</style> </style>
<!-- Page Banner Start --> <?php include_once('header02.php');
<section class="page-banner-two rel z-1"> ?>
<div class="container-fluid">
<hr class="mt-0"> <style>
<div class="container"> .image {
<div class="banner-inner pt-15 pb-25"> width: 400px;
<h2 class="page-title mb-10" data-aos="fade-left" data-aos-duration="1500" data-aos-offset="50"><?php echo $trip_name; ?></h2> /* Set your desired width */
<div class="banner-overlay"></div> height: 350px;
<nav aria-label="breadcrumb"> /* Set your desired height */
<ol class="breadcrumb justify-content-center mb-20" data-aos="fade-right" data-aos-delay="200" data-aos-duration="1500" data-aos-offset="50"> overflow: hidden;
<li class="breadcrumb-item"><a href="index.html">Home</a></li> /* Hide any overflow */
<li class="breadcrumb-item active">Tour Details</li> display: block;
</ol> /* Ensure proper block behavior */
</nav> }
</div>
.image img {
width: 100%;
/* Image scales to fill the container */
height: 100%;
/* Image scales to fill the container */
object-fit: cover;
/* Fills the container while maintaining aspect ratio */
object-position: top;
/* Aligns the top of the image with the top of the container */
display: block;
/* Prevents inline whitespace issues */
}
</style>
<section class=" pt-50 pb-35 rel z-1 ">
<div class="container">
<div class="banner-inner text-black mb-50">
<h2 class="page-title mb-10" data-aos="fade-left" data-aos-duration="1500" data-aos-offset="50"><?php echo $trip_name; ?></h2>
<nav aria-label="breadcrumb">
<ol class="breadcrumb justify-content-center mb-20" data-aos="fade-right" data-aos-delay="200" data-aos-duration="1500" data-aos-offset="50">
<li class="breadcrumb-item"><a href="index.php">Home</a></li>
<li class="breadcrumb-item active">4WDCSA Trips</li>
</ol>
</nav>
</div> </div>
</div> </div>
</section> </section>
<!-- Page Banner End -->
<!-- Tour Gallery start --> <!-- Tour Gallery start -->
@@ -215,23 +245,23 @@ $conn->close();
<div class="section-title pb-5"> <div class="section-title pb-5">
<h2><?php echo $trip_name; ?></h2> <h2><?php echo $trip_name; ?></h2>
</div> </div>
<div class="ratting"> <!-- <div class="ratting">
<i class="fas fa-star"></i> <i class="fas fa-star"></i>
<i class="fas fa-star"></i> <i class="fas fa-star"></i>
<i class="fas fa-star"></i> <i class="fas fa-star"></i>
<i class="fas fa-star"></i> <i class="fas fa-star"></i>
<i class="fas fa-star-half-alt"></i> <i class="fas fa-star-half-alt"></i>
</div> </div> -->
</div> </div>
<span class="subtitle mb-15"><?php echo $badge_text; ?></span> <span class="subtitle mb-15"><?php echo $badge_text; ?></span>
</div> </div>
<div class="col-xl-4 col-lg-5 text-lg-end" data-aos="fade-right" data-aos-duration="1500" data-aos-offset="50"> <!-- <div class="col-xl-4 col-lg-5 text-lg-end" data-aos="fade-right" data-aos-duration="1500" data-aos-offset="50">
<div class="tour-header-social mb-10"> <div class="tour-header-social mb-10">
<a href="#"><i class="far fa-share-alt"></i>Share tours</a> <a href="#"><i class="far fa-share-alt"></i>Share tours</a>
<a href="#"><i class="fas fa-heart bgc-secondary"></i>Wish list</a> <a href="#"><i class="fas fa-heart bgc-secondary"></i>Wish list</a>
</div> </div>
</div> </div> -->
</div> </div>
<hr class="mt-50 mb-70"> <hr class="mt-50 mb-70">
</div> </div>
@@ -263,7 +293,7 @@ $conn->close();
<h2 class="price">R <?php echo $booking_fee; ?></h2><span class="per-person">/club fee per vehicle</span> <h2 class="price">R <?php echo $booking_fee; ?></h2><span class="per-person">/club fee per vehicle</span>
</div> </div>
</div> </div>
<div class="row pb-55"> <!-- <div class="row pb-55">
<div class="col-md-6"> <div class="col-md-6">
<div class="tour-include-exclude mt-30"> <div class="tour-include-exclude mt-30">
<h5>Included and Excluded</h5> <h5>Included and Excluded</h5>
@@ -290,10 +320,10 @@ $conn->close();
</ul> </ul>
</div> </div>
</div> </div>
</div> </div> -->
</div> </div>
<h3>Activities</h3> <!-- <h3>Activities</h3>
<div class="tour-activities mt-30 mb-45"> <div class="tour-activities mt-30 mb-45">
<div class="tour-activity-item"> <div class="tour-activity-item">
<i class="flaticon-hiking"></i> <i class="flaticon-hiking"></i>
@@ -327,9 +357,9 @@ $conn->close();
<i class="flaticon-meditation"></i> <i class="flaticon-meditation"></i>
<b>Yoga</b> <b>Yoga</b>
</div> </div>
</div> </div> -->
<h3>Itinerary</h3> <!-- <h3>Itinerary</h3>
<div class="accordion-two mt-25 mb-60" id="faq-accordion-two"> <div class="accordion-two mt-25 mb-60" id="faq-accordion-two">
<div class="accordion-item"> <div class="accordion-item">
<h5 class="accordion-header"> <h5 class="accordion-header">
@@ -391,11 +421,11 @@ $conn->close();
</div> </div>
</div> </div>
</div> </div>
</div> </div> -->
<h3>Maps</h3> <!-- <h3>Maps</h3> -->
<div class="tour-map mt-30 mb-50"> <div class="tour-map mt-30 mb-50">
<iframe src="https://www.google.com/maps/embed?pb=!1m10!1m8!1m3!1d96777.16150026117!2d-74.00840582560909!3d40.71171357405996!3m2!1i1024!2i768!4f13.1!5e0!3m2!1sen!2sbd!4v1706508986625!5m2!1sen!2sbd" style="border:0; width: 100%;" allowfullscreen="" loading="lazy" referrerpolicy="no-referrer-when-downgrade"></iframe> <iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d13894.816708766162!2d29.256367272652284!3d-29.46664742147583!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x1ef37aefd73de6bd%3A0xf35ffec07e766685!2sDrakensberg!5e0!3m2!1sen!2sza!4v1750666087092!5m2!1sen!2sza" style="border:0; width: 100%;" allowfullscreen="" loading="lazy" referrerpolicy="no-referrer-when-downgrade"></iframe>
</div> </div>
</div> </div>
@@ -430,6 +460,7 @@ $conn->close();
<li> <li>
Adults <span class="price"></span> Adults <span class="price"></span>
<select name="adults" id="adults"> <select name="adults" id="adults">
<option value="0">00</option>
<option value="1" selected>01</option> <option value="1" selected>01</option>
<option value="2">02</option> <option value="2">02</option>
<option value="3">03</option> <option value="3">03</option>
@@ -446,15 +477,24 @@ $conn->close();
<option value="3">03</option> <option value="3">03</option>
</select> </select>
</li> </li>
</ul>
<hr class="mb-25">
<h6>Extras:</h6>
<ul class="radio-filter pt-5">
<li> <li>
<input class="form-check-input" type="checkbox" name="AddExtra" id="add-extra1" value="50" style="background:#fff;"> Pensioners <span class="price"></span>
<label for="add-extra1">4WDCSA Handheld Radio Rental <span>R 50,00</span></label> <select name="pensioners" id="pensioners">
<option value="0" selected>00</option>
<option value="1">01</option>
<option value="2">02</option>
<option value="3">03</option>
</select>
</li> </li>
</ul> </ul>
<!-- <hr class="mb-25"> -->
<!-- <h6>Extras:</h6> -->
<!-- <ul class="radio-filter pt-5">
<li>
<input class="form-check-input" type="checkbox" name="AddExtra" id="add-extra1" value="50" style="background:#fff;">
<label for="add-extra1">4WDCSA Pensioner Discount </label>
</li>
</ul> -->
<hr> <hr>
@@ -474,6 +514,34 @@ $conn->close();
<label for="add-extra1">4WDCSA Booking Fee <span id="booking_fee">R <?php echo $booking_fee; ?></span></label> <label for="add-extra1">4WDCSA Booking Fee <span id="booking_fee">R <?php echo $booking_fee; ?></span></label>
</li> </li>
</ul> </ul>
<div style="margin: 20px 0;">
<div id="indemnityBox" style="border: 1px solid #ccc; padding: 10px; height: 150px; overflow-y: scroll; background: #f9f9f9; font-size: 12px;">
<p><strong>INDEMNITY AND WAIVER</strong></p>
<p>1. I agree to abide by the Code of Conduct as listed below, as well as any reasonable instructions given by any Member of the Committee of the Club, or any person appointed by the Club to organise or control any event (Club Officer).</p>
<p>2. I acknowledge that driving the off-road track is inherently dangerous, and that I am fully aware of the dangers thereof. I warrant that I will make all members of my party aware of such dangers prior to driving the track.</p>
<p>3. While I, or any member of my party, enjoy the facilities at Base 4 including overnight camping, picnicking, driving the track, using the swimming pool facility or activity or any other activity while at Base 4, I agree that under no circumstances shall the Club be liable for any loss or damage of any kind whatsoever (including consequential loss) which I or any of my party may suffer, regardless of how such loss or damage may have been caused or sustained, and whether or not as a result of the negligence or breach of contract (whether fundamental or otherwise) or other wrongful act of the Club, or any Club Officer, or any of the Clubs agents or contractors, and I hereby indemnify and hold harmless the Club and any Club Officer against all such loss or damage.</p>
<p>4. The expression, member of my party, means all persons who accompany me or attending any event at my specific invitation, request or suggestion, and includes without limitation, members of family, guests and invitees.</p>
<p>5. I understand that I am responsible for ensuring my vehicle and equipment and that all members of my party have adequate health and medical insurance to cover any and all likely occurrences.</p>
<p>6. This indemnity is irrevocable and shall apply to me and the members of my party for any Club events in which I may participate or attend.</p>
<p><strong>BASE 4 CODE OF CONDUCT</strong></p>
<p>1. No motorbikes or quadbikes.</p>
<p>2. No loud music (unless authorised by the Committee or its representatives).</p>
<p>3. Dogs to be controlled by their owners who take full responsibility for the animals behaviour.</p>
<p>4. No dogs belonging to non-members are allowed at Base 4 unless with the express permission of the Committee.</p>
<p>5. No person in the rear of open vehicles when driving on obstacles.</p>
<p>6. When driving the obstacles stay on the tracks.</p>
<p>7. Engage 4WD when driving the obstacles to minimise wear and damage to the track.</p>
<p>8. No alcohol to be consumed while driving the track.</p>
<p>9. No littering (please pick up cigarette butts etc.)</p>
<p>10. All rubbish is to be taken away with you when leaving. Dustbins and refuse collection is not provided.</p>
<p>11. Use water sparingly. Please bring your own water and a little extra for the Club.</p>
<p>I am a member of the Four Wheel Drive Club of Southern Africa and I will strive to uphold these Codes.</p>
</div>
<div style="margin-top: 10px;">
<input type="checkbox" id="agreeCheckbox" name="agree" disabled required>
<label for="agreeCheckbox" id="agreeLabel" style="color: #888;">I have read and agree to the indemnity terms</label>
</div>
</div>
<h6>Total: <span id="booking_total" class="price">-</span></h6> <h6>Total: <span id="booking_total" class="price">-</span></h6>
<?php if ($remaining_places < 1): ?> <?php if ($remaining_places < 1): ?>
<button type="button" class="theme-btn style-two w-100 mt-15 mb-5" disabled> <button type="button" class="theme-btn style-two w-100 mt-15 mb-5" disabled>
@@ -487,7 +555,7 @@ $conn->close();
</button> </button>
<?php endif; ?> <?php endif; ?>
<div class="text-center"> <div class="text-center">
<a href="contact.html">Need some help?</a> | Payments will be redirected to Payfast. <a href="contact.php">Need some help?</a>
</div> </div>
</form> </form>
@@ -498,12 +566,12 @@ $conn->close();
<div class="widget widget-contact" data-aos="fade-up" data-aos-duration="1500" data-aos-offset="50"> <div class="widget widget-contact" data-aos="fade-up" data-aos-duration="1500" data-aos-offset="50">
<h5 class="widget-title">Need Help?</h5> <h5 class="widget-title">Need Help?</h5>
<ul class="list-style-one"> <ul class="list-style-one">
<li><i class="far fa-envelope"></i> <a href="mailto:4wdcsa@gmail.com">4wdcsa@gmail.com</a></li> <li><i class="far fa-envelope"></i> <a href="mailto:info@4wdcsa.co.za">info@4wdcsa.co.za</a></li>
<li><i class="far fa-phone-volume"></i> <a href="#">+27 </a></li> <li><i class="far fa-phone-volume"></i> <a href="#">+27 79 065 2795</a></li>
</ul> </ul>
</div> </div>
<div class="widget widget-cta" data-aos="fade-up" data-aos-duration="1500" data-aos-offset="50"> <!-- <div class="widget widget-cta" data-aos="fade-up" data-aos-duration="1500" data-aos-offset="50">
<div class="content text-white"> <div class="content text-white">
<span class="h6">Explore The World</span> <span class="h6">Explore The World</span>
<h3>Best Tourist Place</h3> <h3>Best Tourist Place</h3>
@@ -516,7 +584,7 @@ $conn->close();
<img src="assets/images/widgets/cta-widget.png" alt="CTA"> <img src="assets/images/widgets/cta-widget.png" alt="CTA">
</div> </div>
<div class="cta-shape"><img src="assets/images/widgets/cta-shape3.png" alt="Shape"></div> <div class="cta-shape"><img src="assets/images/widgets/cta-shape3.png" alt="Shape"></div>
</div> </div> -->
</div> </div>
</div> </div>
@@ -528,40 +596,65 @@ $conn->close();
<!-- About Us Area end --> <!-- About Us Area end -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<!-- Shop Details Area end -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script>
const indemnityBox = document.getElementById('indemnityBox');
const agreeCheckbox = document.getElementById('agreeCheckbox');
const bookingForm = document.querySelector('form');
indemnityBox.addEventListener('scroll', function() {
const scrollTop = indemnityBox.scrollTop;
const scrollHeight = indemnityBox.scrollHeight;
const offsetHeight = indemnityBox.offsetHeight;
// Enable checkbox when scrolled to bottom
if (scrollTop + offsetHeight >= scrollHeight - 1) {
agreeCheckbox.disabled = false;
document.getElementById('agreeLabel').style.color = "#000"; // optional: make label active
}
});
bookingForm.addEventListener('submit', function(e) {
if (agreeCheckbox.disabled || !agreeCheckbox.checked) {
alert('Please read and agree to the indemnity terms before booking.');
e.preventDefault(); // stop form submission
}
});
</script>
<script> <script>
$(document).ready(function() { $(document).ready(function() {
// Function to calculate booking total // Function to calculate booking total
function calculateTotal() { function calculateTotal() {
// Get selected values from the form // Get selected values from the form
var vehicles = parseInt($('#vehicles').val()) || 1; // Default to 1 vehicle if not selected var vehicles = parseInt($('#vehicles').val()) || 1; // Default to 1 vehicle if not selected
var adults = parseInt($('#adults').val()) || 1; // Default to 1 adult if not selected var adults = parseInt($('#adults').val()) || 0; // Default to 1 adult if not selected
var pensioners = parseInt($('#pensioners').val()) || 0; // Default to 1 adult if not selected
var children = parseInt($('#children').val()) || 0; // Default to 0 children if not selected var children = parseInt($('#children').val()) || 0; // Default to 0 children if not selected
var radio = $('#add-extra1').is(':checked') ? 50 : 0; // Extra cost for radio rental var radio = $('#add-extra1').is(':checked') ? 50 : 0; // Extra cost for radio rental
// Fetch PHP variables // Fetch PHP variables
var isMember = <?php echo $is_member ? 'true' : 'false'; ?>; const isMember = <?php echo isset($is_member) && $is_member ? 'true' : 'false'; ?>;
var cost_members = <?php echo $cost_members; ?>; const cost_members = <?php echo $cost_members ?? 0; ?>;
var cost_nonmembers = <?php echo $cost_nonmembers; ?>; const cost_nonmembers = <?php echo $cost_nonmembers ?? 0; ?>;
var member_discount = <?php echo $member_discount; ?>; const cost_pensioner = <?php echo $cost_pensioner ?? 0; ?>;
var booking_fee = <?php echo $booking_fee; ?>; const cost_pensioner_member = <?php echo $cost_pensioner_member ?? 0; ?>;
const member_discount = <?php echo $member_discount ?? 0; ?>;
const member_discount_pensioner = <?php echo $member_discount_pensioner ?? 0; ?>;
const booking_fee = <?php echo $booking_fee ?? 0; ?>;
// Calculate the total cost based on membership // Calculate the total cost based on membership
var total = 0; let total = 0;
var discountAmount = 0; let discountAmount = 0;
// Calculate cost for members
if (isMember) { if (isMember) {
total = ((adults + children) * cost_members) + radio + (vehicles * booking_fee); total = ((adults + children) * cost_members) + (pensioners * cost_pensioner_member) + radio + (vehicles * booking_fee);
discountAmount = ((adults + children) * member_discount); // Member discount discountAmount = ((adults + children) * member_discount) + (pensioners * member_discount_pensioner);
} else { } else {
// Calculate cost for non-members total = ((adults + children) * cost_nonmembers) + (pensioners * cost_pensioner) + radio + (vehicles * booking_fee);
total = ((adults + children) * cost_nonmembers) + radio + (vehicles * booking_fee);
} }
// Update total price in the DOM
$('#booking_total').text('R ' + total.toFixed(2)); $('#booking_total').text('R ' + total.toFixed(2));
// If the user is a member, show the discount section
if (isMember) { if (isMember) {
$('#discount_amount').text('R ' + discountAmount.toFixed(2)); $('#discount_amount').text('R ' + discountAmount.toFixed(2));
$('#discount_section').show(); $('#discount_section').show();
@@ -570,12 +663,7 @@ $conn->close();
} }
} }
// Event listeners to trigger recalculation when any form field changes $('#vehicles, #adults, #children, #pensioners, #add-extra1').on('change', calculateTotal);
$('#vehicles, #adults, #children, #add-extra1').on('change', function() {
calculateTotal();
});
// Initial calculation on page load
calculateTotal(); calculateTotal();
}); });
</script> </script>

View File

@@ -80,7 +80,7 @@ if (!empty($bannerImages)) {
// Query to retrieve data from the trips table // Query to retrieve data from the trips table
$sql = "SELECT trip_id, trip_name, location, short_description, start_date, end_date, vehicle_capacity, cost_members, places_booked FROM trips WHERE start_date > CURDATE()"; $sql = "SELECT trip_id, trip_name, location, short_description, start_date, end_date, vehicle_capacity, cost_members, places_booked FROM trips WHERE published = 1 AND start_date > CURDATE()";
$result = $conn->query($sql); $result = $conn->query($sql);
if ($result->num_rows > 0) { if ($result->num_rows > 0) {