updated to add country membership
This commit is contained in:
@@ -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
|
||||
|
||||
18
index.php
18
index.php
@@ -27,17 +27,33 @@ if ($showRenewModal) {
|
||||
} else {
|
||||
$showRenewModal = false;
|
||||
}
|
||||
|
||||
$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();
|
||||
$stmt->close();
|
||||
|
||||
if ($payment_status === 'PENDING RENEWAL') {
|
||||
$showRenewModal = false;
|
||||
}
|
||||
}
|
||||
|
||||
$stmt->close();
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_SESSION['user_id']) && isset($conn) && $conn !== null) {
|
||||
|
||||
@@ -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,6 +113,7 @@ $user = $result->fetch_assoc();
|
||||
</div>
|
||||
|
||||
<!-- Spouse / Partner Details Section -->
|
||||
<div id="spouseSection">
|
||||
<h3>Spouse / Life Partner / Other Details</h3>
|
||||
<div class="row mt-35">
|
||||
<div class="col-md-6">
|
||||
@@ -135,7 +161,11 @@ $user = $result->fetch_assoc();
|
||||
</div>
|
||||
</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">
|
||||
@@ -176,6 +206,7 @@ $user = $result->fetch_assoc();
|
||||
</div>
|
||||
<!-- Repeat for other children if needed -->
|
||||
</div>
|
||||
</div> <!-- end childrenSection -->
|
||||
|
||||
<!-- Address Section -->
|
||||
<h3>Address</h3>
|
||||
@@ -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>
|
||||
@@ -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 } ?>
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 |
Reference in New Issue
Block a user