updated to add country membership

This commit is contained in:
twotalesanimation
2025-12-19 19:50:22 +02:00
parent c618fd4506
commit 782d343243
7 changed files with 306 additions and 184 deletions

View File

@@ -164,7 +164,7 @@ RewriteRule ^autosave$ src/processors/blog/autosave.php [L]
</IfModule>
php_flag display_errors Off
php_flag display_errors On
# php_value error_reporting -1
RedirectMatch 403 ^/\.well-known
Options -Indexes

View File

@@ -27,16 +27,32 @@ if ($showRenewModal) {
} else {
$showRenewModal = false;
}
$user_id = $_SESSION['user_id'];
$stmt = $conn->prepare("SELECT payment_status FROM membership_fees WHERE user_id = ? LIMIT 1");
$stmt->bind_param("i", $user_id);
$stmt->execute();
$stmt->bind_result($payment_status);
$stmt->fetch();
$stmt->close();
if ($payment_status === 'PENDING RENEWAL') {
$user_id = $_SESSION['user_id'];
// Ensure we have a DB connection
if (!isset($conn) || $conn === null) {
$showRenewModal = false;
} else {
$stmt = $conn->prepare("SELECT payment_status FROM membership_fees WHERE user_id = ? LIMIT 1");
$stmt->bind_param("i", $user_id);
$stmt->execute();
// store_result so we can check num_rows
$stmt->store_result();
// If there's no membership_fees record for this user, don't show the renew modal
if ($stmt->num_rows === 0) {
$showRenewModal = false;
} else {
$stmt->bind_result($payment_status);
$stmt->fetch();
if ($payment_status === 'PENDING RENEWAL') {
$showRenewModal = false;
}
}
$stmt->close();
}
}

View File

@@ -7,7 +7,7 @@ checkUserSession();
// Assuming you have the user ID stored in the session
if (isset($_SESSION['user_id'])) {
$user_id = $_SESSION['user_id'];
}else{
} else {
header('Location: login.php');
exit(); // Stop further script execution
}
@@ -25,7 +25,7 @@ $user = $result->fetch_assoc();
$pageTitle = 'Membership Application';
$breadcrumbs = [['Home' => 'index.php'], ['Membership' => 'membership.php']];
require_once($rootPath . '/components/banner.php');
?>
?>
@@ -39,6 +39,31 @@ $user = $result->fetch_assoc();
<div class="section-title">
<div id="responseMessage"></div> <!-- Message display area -->
</div>
<!-- Membership Type -->
<h3>Membership Type</h3>
<div class="row mt-35">
<div class="col-md-12">
<div class="form-group mb-3">
<div class="form-check">
<input type="checkbox" id="country_membership" name="country_membership" value="1">
<label style="margin-left:20px;" for="country_membership">Country Membership - if you reside more than 150km from BASE4 and qualify for country membership.</label>
</div>
<div class="mt-2">
<div class="form-check form-check-inline">
<input type="radio" name="membership_type" id="membership_full" value="full" checked>
<label style="margin-left:20px;" for="membership_full">Full Membership</label>
</div>
<div class="form-check form-check-inline">
<input type="radio" name="membership_type" id="membership_single" value="single">
<label style="margin-left:20px;" for="membership_single">Single Membership</label>
</div>
</div>
</div>
</div>
</div>
<!-- Personal Details Section -->
<h3>Main Member</h3>
<div class="row mt-35">
@@ -88,193 +113,199 @@ $user = $result->fetch_assoc();
</div>
<!-- Spouse / Partner Details Section -->
<h3>Spouse / Life Partner / Other Details</h3>
<div class="row mt-35">
<div class="col-md-6">
<div class="form-group">
<label for="spouse_first_name">First Name</label>
<input type="text" id="spouse_first_name" name="spouse_first_name" class="form-control" placeholder="Jane">
<div id="spouseSection">
<h3>Spouse / Life Partner / Other Details</h3>
<div class="row mt-35">
<div class="col-md-6">
<div class="form-group">
<label for="spouse_first_name">First Name</label>
<input type="text" id="spouse_first_name" name="spouse_first_name" class="form-control" placeholder="Jane">
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="spouse_last_name">Surname</label>
<input type="text" id="spouse_last_name" name="spouse_last_name" class="form-control" placeholder="Smith">
<div class="col-md-6">
<div class="form-group">
<label for="spouse_last_name">Surname</label>
<input type="text" id="spouse_last_name" name="spouse_last_name" class="form-control" placeholder="Smith">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="spouse_id_number">ID Number / Passport Number</label>
<input type="text" id="spouse_id_number" name="spouse_id_number" class="form-control" placeholder="1234567890">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="spouse_dob">Date of Birth</label>
<input type="date" id="spouse_dob" name="spouse_dob" class="form-control">
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label for="spouse_occupation">Occupation</label>
<input type="text" id="spouse_occupation" name="spouse_occupation" class="form-control" placeholder="Occupation">
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label for="spouse_phone_numbers">Cell Phone</label>
<input type="text" id="spouse_tel_cell" name="spouse_tel_cell" class="form-control" placeholder="Cell Phone">
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label for="spouse_email">Email Address</label>
<input type="email" id="spouse_email" name="spouse_email" class="form-control" placeholder="Enter email">
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="spouse_id_number">ID Number / Passport Number</label>
<input type="text" id="spouse_id_number" name="spouse_id_number" class="form-control" placeholder="1234567890">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="spouse_dob">Date of Birth</label>
<input type="date" id="spouse_dob" name="spouse_dob" class="form-control">
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label for="spouse_occupation">Occupation</label>
<input type="text" id="spouse_occupation" name="spouse_occupation" class="form-control" placeholder="Occupation">
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label for="spouse_phone_numbers">Cell Phone</label>
<input type="text" id="spouse_tel_cell" name="spouse_tel_cell" class="form-control" placeholder="Cell Phone">
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label for="spouse_email">Email Address</label>
<input type="email" id="spouse_email" name="spouse_email" class="form-control" placeholder="Enter email">
</div>
</div> <!-- end spouse row -->
<!-- </div> end spouseSection -->
<!-- Children Section -->
<div id="childrenSection">
<h3>Children's Names</h3>
<div class="row mt-35">
<div class="col-md-6">
<div class="form-group">
<label for="child_name1">Child 1 Name</label>
<input type="text" id="child_name1" name="child_name1" class="form-control" placeholder="Child 1 Name">
</div>
</div>
<!-- Children Section -->
<h3>Children's Names</h3>
<div class="row mt-35">
<div class="col-md-6">
<div class="form-group">
<label for="child_name1">Child 1 Name</label>
<input type="text" id="child_name1" name="child_name1" class="form-control" placeholder="Child 1 Name">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="child_dob1">Child 1 DOB</label>
<input type="date" id="child_dob1" name="child_dob1" class="form-control">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="child_name2">Child 2 Name</label>
<input type="text" id="child_name2" name="child_name2" class="form-control" placeholder="Child 2 Name">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="child_dob2">Child 2 DOB</label>
<input type="date" id="child_dob2" name="child_dob2" class="form-control">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="child_name3">Child 3 Name</label>
<input type="text" id="child_name3" name="child_name3" class="form-control" placeholder="Child 3 Name">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="child_dob3">Child 3 DOB</label>
<input type="date" id="child_dob3" name="child_dob3" class="form-control">
</div>
</div>
<!-- Repeat for other children if needed -->
</div>
<!-- Address Section -->
<h3>Address</h3>
<div class="row mt-35">
<div class="col-md-6">
<div class="form-group">
<label for="physical_address">Physical Address</label>
<textarea id="physical_address" name="physical_address" class="form-control" placeholder="Enter physical address"></textarea>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="postal_address">Postal Address</label>
<textarea id="postal_address" name="postal_address" class="form-control" placeholder="Enter postal address"></textarea>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="child_dob1">Child 1 DOB</label>
<input type="date" id="child_dob1" name="child_dob1" class="form-control">
</div>
</div>
<!-- Interests Section -->
<h3>Interests and Hobbies</h3>
<div class="row mt-35">
<div class="col-md-12">
<div class="form-group">
<textarea id="interests_hobbies" name="interests_hobbies" class="form-control" placeholder="Enter interests and hobbies"></textarea>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="child_name2">Child 2 Name</label>
<input type="text" id="child_name2" name="child_name2" class="form-control" placeholder="Child 2 Name">
</div>
</div>
<!-- Vehicle Section -->
<h3>Primary Vehicle</h3>
<div class="row mt-35">
<div class="col-md-3">
<div class="form-group">
<label for="vehicle_make">Make</label>
<input type="text" id="vehicle_make" name="vehicle_make" class="form-control" placeholder="Vehicle Make">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="vehicle_model">Model</label>
<input type="text" id="vehicle_model" name="vehicle_model" class="form-control" placeholder="Vehicle Model">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="vehicle_year">Year</label>
<input type="text" id="vehicle_year" name="vehicle_year" class="form-control" placeholder="Vehicle Year">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="vehicle_registration">Registration</label>
<input type="text" id="vehicle_registration" name="vehicle_registration" class="form-control" placeholder="Vehicle Registration">
</div>
<div class="col-md-6">
<div class="form-group">
<label for="child_dob2">Child 2 DOB</label>
<input type="date" id="child_dob2" name="child_dob2" class="form-control">
</div>
</div>
<h3>Secondary Vehicle</h3>
<div class="row mt-35">
<div class="col-md-3">
<div class="form-group">
<label for="secondary_vehicle_make">Make</label>
<input type="text" id="secondary_vehicle_make" name="secondary_vehicle_make" class="form-control" placeholder="Vehicle Make">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="secondary_vehicle_model">Model</label>
<input type="text" id="secondary_vehicle_model" name="secondary_vehicle_model" class="form-control" placeholder="Vehicle Model">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="secondary_vehicle_year">Year</label>
<input type="text" id="secondary_vehicle_year" name="secondary_vehicle_year" class="form-control" placeholder="Vehicle Year">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="secondary_vehicle_registration">Registration</label>
<input type="text" id="secondary_vehicle_registration" name="secondary_vehicle_registration" class="form-control" placeholder="Vehicle Registration">
</div>
<div class="col-md-6">
<div class="form-group">
<label for="child_name3">Child 3 Name</label>
<input type="text" id="child_name3" name="child_name3" class="form-control" placeholder="Child 3 Name">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="child_dob3">Child 3 DOB</label>
<input type="date" id="child_dob3" name="child_dob3" class="form-control">
</div>
</div>
<!-- Repeat for other children if needed -->
</div>
</div> <!-- end childrenSection -->
</div>
<!-- Submit Section -->
<div class="col-md-12">
<div class="form-group mb-0">
<button type="submit" class="theme-btn style-two" style="width:100%;">Next</button>
<div id="msgSubmit" class="hidden"></div>
<!-- Address Section -->
<h3>Address</h3>
<div class="row mt-35">
<div class="col-md-6">
<div class="form-group">
<label for="physical_address">Physical Address</label>
<textarea id="physical_address" name="physical_address" class="form-control" placeholder="Enter physical address"></textarea>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="postal_address">Postal Address</label>
<textarea id="postal_address" name="postal_address" class="form-control" placeholder="Enter postal address"></textarea>
</div>
</div>
</div>
<!-- Interests Section -->
<h3>Interests and Hobbies</h3>
<div class="row mt-35">
<div class="col-md-12">
<div class="form-group">
<textarea id="interests_hobbies" name="interests_hobbies" class="form-control" placeholder="Enter interests and hobbies"></textarea>
</div>
</div>
</div>
<!-- Vehicle Section -->
<h3>Primary Vehicle</h3>
<div class="row mt-35">
<div class="col-md-3">
<div class="form-group">
<label for="vehicle_make">Make</label>
<input type="text" id="vehicle_make" name="vehicle_make" class="form-control" placeholder="Vehicle Make">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="vehicle_model">Model</label>
<input type="text" id="vehicle_model" name="vehicle_model" class="form-control" placeholder="Vehicle Model">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="vehicle_year">Year</label>
<input type="text" id="vehicle_year" name="vehicle_year" class="form-control" placeholder="Vehicle Year">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="vehicle_registration">Registration</label>
<input type="text" id="vehicle_registration" name="vehicle_registration" class="form-control" placeholder="Vehicle Registration">
</div>
</div>
</div>
<h3>Secondary Vehicle</h3>
<div class="row mt-35">
<div class="col-md-3">
<div class="form-group">
<label for="secondary_vehicle_make">Make</label>
<input type="text" id="secondary_vehicle_make" name="secondary_vehicle_make" class="form-control" placeholder="Vehicle Make">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="secondary_vehicle_model">Model</label>
<input type="text" id="secondary_vehicle_model" name="secondary_vehicle_model" class="form-control" placeholder="Vehicle Model">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="secondary_vehicle_year">Year</label>
<input type="text" id="secondary_vehicle_year" name="secondary_vehicle_year" class="form-control" placeholder="Vehicle Year">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="secondary_vehicle_registration">Registration</label>
<input type="text" id="secondary_vehicle_registration" name="secondary_vehicle_registration" class="form-control" placeholder="Vehicle Registration">
</div>
</div>
</div>
</form>
</div>
<!-- Submit Section -->
<div class="col-md-12">
<div class="form-group mb-0">
<button type="submit" class="theme-btn style-two" style="width:100%;">Next</button>
<div id="msgSubmit" class="hidden"></div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</section>
<!-- Contact Form Area end -->
@@ -282,3 +313,43 @@ $user = $result->fetch_assoc();
<?php include_once(dirname(dirname(dirname(__DIR__))) . '/components/insta_footer.php'); ?>
<script>
// Toggle spouse and children sections when 'Single Membership' is selected
(function() {
function setSectionState(isSingle) {
var spouse = document.getElementById('spouseSection');
var children = document.getElementById('childrenSection');
[spouse, children].forEach(function(sec) {
if (!sec) return;
var inputs = sec.querySelectorAll('input, select, textarea, button');
if (isSingle) {
sec.style.display = 'none';
inputs.forEach(function(i) {
i.disabled = true;
});
} else {
sec.style.display = '';
inputs.forEach(function(i) {
i.disabled = false;
});
}
});
}
document.addEventListener('DOMContentLoaded', function() {
var full = document.getElementById('membership_full');
var single = document.getElementById('membership_single');
// initialize state
setSectionState(single && single.checked);
if (full) full.addEventListener('change', function() {
if (this.checked) setSectionState(false);
});
if (single) single.addEventListener('change', function() {
if (this.checked) setSectionState(true);
});
});
})();
</script>

View File

@@ -189,7 +189,7 @@ if (empty($application['id_number'])) {
<td><?php echo htmlspecialchars($membership['payment_amount']); ?></td>
<td><?php echo htmlspecialchars($membership['payment_id']); ?></td>
<?php if ($membership['payment_status'] == "AWAITING PAYMENT" || $membership['payment_status'] == "PENDING RENEWAL") { ?>
<td><a href='<?= $payment_link; ?>' class='theme-btn style-two style-three' style='padding: 0px 14px;'><span data-hover='PAY NOW'>PENDING RENEWAL</span></a></td>
<td><a href='<?= $payment_link; ?>' class='theme-btn style-two style-three' style='padding: 0px 14px;'><span data-hover='<?= $membership['payment_status'] ?>'><?= $membership['payment_status'] ?></span></a></td>
<?php } else { ?>
<td><?php echo htmlspecialchars($membership['payment_status']); ?></td>
<?php } ?>

View File

@@ -141,6 +141,17 @@ include_once($rootPath . '/header.php');
margin: 50px;
padding: 20px;
border-radius: 20px;
box-sizing: border-box;
}
@media (max-width: 768px) {
#map {
margin: 0 !important;
padding: 0 !important;
width: 100% !important;
height: 500px !important;
border-radius: 0 !important;
}
}
.obstacle-popup h4 {

View File

@@ -4,6 +4,7 @@ require_once($rootPath . "/src/config/env.php");
require_once($rootPath . "/src/config/session.php");
require_once($rootPath . "/src/config/connection.php");
require_once($rootPath . "/src/config/functions.php");
require_once($rootPath . "/src/helpers/notification_helper.php");
$user_id = isset($_SESSION['user_id']) ? $_SESSION['user_id'] : null;
$payment_id = generatePaymentRef('SUBS', null, $user_id);
@@ -92,6 +93,16 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
die('Invalid email format.');
}
//MEMBERSHIP TYPE
$country_membership = isset($_POST['country_membership']) ? 1 : 0;
$membership_type = in_array($_POST['membership_type'] ?? '', ['full', 'single']) ? $_POST['membership_type'] : 'full';
if ($country_membership) {
$membership_type = 'country';
}else{
$membership_type = $membership_type;
}
// Spouse or Partner details (optional)
$spouse_first_name = !empty($_POST['spouse_first_name']) ? validateName($_POST['spouse_first_name']) : null;
$spouse_last_name = !empty($_POST['spouse_last_name']) ? validateName($_POST['spouse_last_name']) : null;
@@ -136,8 +147,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
spouse_first_name, spouse_last_name, spouse_id_number, spouse_dob, spouse_occupation, spouse_tel_cell, spouse_email,
child_name1, child_dob1, child_name2, child_dob2, child_name3, child_dob3,
physical_address, postal_address, interests_hobbies, vehicle_make, vehicle_model, vehicle_year, vehicle_registration,
secondary_vehicle_make, secondary_vehicle_model, secondary_vehicle_year, secondary_vehicle_registration
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
secondary_vehicle_make, secondary_vehicle_model, secondary_vehicle_year, secondary_vehicle_registration, membership_type
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
// Check if preparation was successful
if (!$stmt) {
@@ -145,7 +156,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
}
$stmt->bind_param(
"isssssssssssssssssssssssssssssss",
"issssssssssssssssssssssssssssssss",
$user_id,
$first_name,
$last_name,
@@ -177,7 +188,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$secondary_vehicle_make,
$secondary_vehicle_model,
$secondary_vehicle_year,
$secondary_vehicle_registration
$secondary_vehicle_registration,
$membership_type
);
if ($stmt->execute()) {
@@ -187,10 +199,22 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$year = (int)$today->format('Y');
$payment_date = $today->format('Y-m-d');
$membership_start_date = $payment_date;
if ($membership_type === 'country') {
$payment_amount = getPriceByDescription('country_membership');
$prorata_amount = calculateProrata(getPriceByDescription('country_prorata'));
} elseif ($membership_type === 'single') {
$payment_amount = getPriceByDescription('single');
$prorata_amount = calculateProrata(getPriceByDescription('single_prorata'));
} else {
$payment_amount = getPriceByDescription('membership_fees');
$prorata_amount = calculateProrata(getPriceByDescription('pro_rata'));
}
if ($month == 12 || $month == 1 || $month == 2) {
// December, January, February: charge full fee, valid till end of next Feb
$payment_amount = getPriceByDescription('membership_fees');
$payment_amount = $payment_amount;
// If Dec, Jan, Feb, set end to next year's Feb
$end_year = ($month == 12) ? $year + 2 : $year + 1;
$membership_end_date = (new DateTime("$end_year-02-01"))
@@ -198,7 +222,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
->format('Y-m-d');
} else {
// Prorata for Mar-Nov
$payment_amount = calculateProrata(getPriceByDescription('pro_rata'));
$payment_amount = $prorata_amount;
// End of next Feb if after Feb, else this Feb
if ($month > 2) {
$end_year = $year + 1;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.7 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB