Member info update

This commit is contained in:
twotalesanimation
2025-06-08 16:29:50 +02:00
parent 85ce1b29e7
commit 4bdfbff0b6
7 changed files with 296 additions and 10 deletions

View File

@@ -1,4 +1,4 @@
php_flag display_errors On
php_flag display_errors Off
# php_value error_reporting -1
RedirectMatch 403 ^/\.well-known
Options -Indexes

View File

@@ -82,6 +82,10 @@ $result = $conn->query($sql);
margin-top: 15px;
margin-bottom: 15px;
}
.theme-btn,
a.theme-btn {
padding: 0px 14px;
}
</style>
<script>
@@ -137,7 +141,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; ?>');">
<div class="banner-overlay"></div>
<div class="banner-overlay"></div>
<div class="container">
<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 Members</h2>
@@ -168,6 +172,7 @@ if (!empty($bannerImages)) {
<th>Email</th>
<th>Date of Birth</th>
<th>Membership</th>
<th>View Info</th>
</tr>
</thead>
<tbody>
@@ -188,6 +193,7 @@ if (!empty($bannerImages)) {
echo 'INACTIVE';
};
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>
</tr>";
}
} else {

View File

@@ -170,7 +170,7 @@ if (!empty($bannerImages)) {
<thead>
<tr>
<th></th>
<th></th>
<!-- <th></th> -->
<th>First Name</th>
<th>Last Name</th>
<th>Email</th>
@@ -209,7 +209,7 @@ if (!empty($bannerImages)) {
echo "<tr>
<td><img src=" . $row['profile_pic'] . " alt='Profile Picture' class='profile-pic'></td>
<td>" . htmlspecialchars($row['user_id']) . "</td>
<td>" . htmlspecialchars($row['first_name']) . "</td>
<td>" . htmlspecialchars($row['last_name']) . "</td>
<td>" . htmlspecialchars($row['email']) . "</td>
@@ -228,10 +228,10 @@ if (!empty($bannerImages)) {
} else {
echo "\u{2713}";
}
echo "</td>
<td><a href='linkmembership.php?user_id=".$row['user_id']."'>Link Membership</a></td>
// echo "</td>
// <td><a href='linkmembership.php?user_id=".$row['user_id']."'>Link Membership</a></td>
</tr>";
// </tr>";
}
} else {
echo '<tr><td colspan="5">No records found</td></tr>';

View File

@@ -245,7 +245,7 @@ function sendAdminNotification($subject, $message)
],
'To' => [
[
'Email' => "info@4wdcsa.co.za",
'Email' => $_ENV['NOTIFICATION_ADDR'],
'Name' => 'Jacqui Boshoff'
]
],

280
member_info.php Normal file
View File

@@ -0,0 +1,280 @@
<?php
include_once('header02.php');
checkAdmin();
if (!isset($_GET['token']) || empty($_GET['token'])) {
die("Invalid request.");
}
$token = $_GET['token'];
// echo $token;
// Use ?user_id=... in the URL to view another user's info
$viewing_user_id = isset($_GET['token']) ? decryptData($token, $salt) : $_SESSION['user_id'];
checkMembershipApplication2($viewing_user_id);
// Fetch membership details
$sql = "SELECT membership_start_date, membership_end_date, payment_status, payment_amount, payment_id FROM membership_fees WHERE user_id = ?";
$stmt = $conn->prepare($sql);
$stmt->bind_param("i", $viewing_user_id);
$stmt->execute();
$result = $stmt->get_result();
$membership = $result->fetch_assoc();
// Fetch application data
$query = "SELECT * FROM membership_application WHERE user_id = ?";
$stmt = $conn->prepare($query);
$stmt->bind_param("i", $viewing_user_id);
$stmt->execute();
$result = $stmt->get_result();
$application = $result->fetch_assoc();
$stmt->close();
?>
<style>
table {
width: 100%;
border-collapse: separate;
border-spacing: 0;
margin: 10px 0;
}
thead th {
cursor: pointer;
text-align: left;
padding: 10px;
font-weight: bold;
position: relative;
}
thead th::after {
content: '\25B2';
/* Up arrow */
font-size: 0.8em;
position: absolute;
right: 10px;
opacity: 0;
transition: opacity 0.2s;
}
thead th.asc::after {
content: '\25B2';
/* Up arrow */
opacity: 1;
}
thead th.desc::after {
content: '\25BC';
/* Down arrow */
opacity: 1;
}
tbody tr:nth-child(odd) {
background-color: transparent;
}
tbody tr:nth-child(even) {
background-color: rgb(255, 255, 255);
border-radius: 10px;
}
tbody td {
padding: 5px;
}
tbody tr:nth-child(even) td:first-child {
border-top-left-radius: 10px;
border-bottom-left-radius: 10px;
}
tbody tr:nth-child(even) td:last-child {
border-top-right-radius: 10px;
border-bottom-right-radius: 10px;
}
</style>
<section class="account-settings-area py-70 rel z-1">
<div class="container">
<button onclick="downloadMembershipPDF()">📄 Open as PDF</button>
<div class="row align-items-center">
<div class="col-lg-12">
<div class="comment-form bgc-lighter z-1 rel mb-30 rmb-55">
<div id="membership-info">
<div class="section-title py-20">
<h2>Member Information: <?php echo getFullName($viewing_user_id); ?></h2>
</div>
<div style='padding:10px;'>
<table>
<thead>
<tr>
<th>Start Date</th>
<th>Renewal Date</th>
<th>Indemnity</th>
<th>Amount</th>
<th>Payment Reference</th>
<th>Payment Status</th>
<th>Membership Status</th>
</tr>
</thead>
<tbody>
<?php if ($membership): ?>
<tr>
<td><?php echo htmlspecialchars($membership['membership_start_date']); ?></td>
<td><?php echo htmlspecialchars($membership['membership_end_date']); ?></td>
<td><?php echo hasAcceptedIndemnity($viewing_user_id) ? 'SIGNED' : 'NOT SIGNED'; ?></td>
<td><?php echo htmlspecialchars($membership['payment_amount']); ?></td>
<td><?php echo htmlspecialchars($membership['payment_id']); ?></td>
<td><?php echo htmlspecialchars($membership['payment_status']); ?></td>
<td><?php echo getUserMemberStatus($viewing_user_id) ? 'ACTIVE' : 'INACTIVE'; ?></td>
</tr>
<?php else: ?>
<tr>
<td colspan="7">No membership records found.</td>
</tr>
<?php endif; ?>
</tbody>
</table>
</div>
<h3>Main Member</h3>
<div class="row mt-35">
<?php
$fields = [
'first_name' => 'First Name',
'last_name' => 'Surname',
'id_number' => 'ID Number / Passport Number',
'dob' => 'Date of Birth',
'occupation' => 'Occupation',
'tel_cell' => 'Cell Phone',
'email' => 'Email Address'
];
foreach ($fields as $key => $label): ?>
<div class="col-md-6">
<div class="form-group">
<label><?php echo $label; ?></label>
<p class="form-control-static"><?php echo htmlspecialchars($application[$key] ?? ''); ?></p>
</div>
</div>
<?php endforeach; ?>
</div>
<h3>Spouse / Life Partner / Other Details</h3>
<div class="row mt-35">
<?php
$spouse_fields = [
'spouse_first_name' => 'First Name',
'spouse_last_name' => 'Surname',
'spouse_id_number' => 'ID Number / Passport Number',
'spouse_dob' => 'Date of Birth',
'spouse_occupation' => 'Occupation',
'spouse_tel_cell' => 'Cell Phone',
'spouse_email' => 'Email Address'
];
foreach ($spouse_fields as $key => $label): ?>
<div class="col-md-6">
<div class="form-group">
<label><?php echo $label; ?></label>
<p class="form-control-static"><?php echo htmlspecialchars($application[$key] ?? ''); ?></p>
</div>
</div>
<?php endforeach; ?>
</div>
<h3>Children's Names</h3>
<div class="row mt-35">
<?php for ($i = 1; $i <= 3; $i++): ?>
<div class="col-md-6">
<div class="form-group">
<label>Child <?php echo $i; ?> Name</label>
<p class="form-control-static"><?php echo htmlspecialchars($application['child_name' . $i] ?? ''); ?></p>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label>Child <?php echo $i; ?> DOB</label>
<p class="form-control-static"><?php echo htmlspecialchars($application['child_dob' . $i] ?? ''); ?></p>
</div>
</div>
<?php endfor; ?>
</div>
<h3>Address</h3>
<div class="row mt-35">
<div class="col-md-6">
<div class="form-group">
<label>Physical Address</label>
<p class="form-control-static"><?php echo nl2br(htmlspecialchars($application['physical_address'] ?? '')); ?></p>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label>Postal Address</label>
<p class="form-control-static"><?php echo nl2br(htmlspecialchars($application['postal_address'] ?? '')); ?></p>
</div>
</div>
</div>
<h3>Interests and Hobbies</h3>
<div class="row mt-35">
<div class="col-md-12">
<div class="form-group">
<p class="form-control-static"><?php echo nl2br(htmlspecialchars($application['interests_hobbies'] ?? '')); ?></p>
</div>
</div>
</div>
<h3>Primary Vehicle</h3>
<div class="row mt-35">
<?php
$vehicle_fields = [
'vehicle_make' => 'Make',
'vehicle_model' => 'Model',
'vehicle_year' => 'Year',
'vehicle_registration' => 'Registration'
];
foreach ($vehicle_fields as $key => $label): ?>
<div class="col-md-3">
<div class="form-group">
<label><?php echo $label; ?></label>
<p class="form-control-static"><?php echo htmlspecialchars($application[$key] ?? ''); ?></p>
</div>
</div>
<?php endforeach; ?>
</div>
<!-- You can add secondary vehicle and other custom sections in the same way -->
</div>
</div>
</div>
</div>
</div>
</section>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.10.1/html2pdf.bundle.min.js"></script>
<script>
function downloadMembershipPDF() {
const element = document.getElementById('membership-info');
// Temporarily shrink element for PDF
element.style.transform = 'scale(0.8)';
element.style.transformOrigin = 'top left';
const opt = {
margin: 0.5,
filename: 'membership-info.pdf',
image: { type: 'jpeg', quality: 0.98 },
html2canvas: { scale: 2 },
jsPDF: { unit: 'in', format: 'a4', orientation: 'portrait' }
};
html2pdf().from(element).set(opt).outputPdf('bloburl').then((pdfUrl) => {
window.open(pdfUrl, '_blank');
// Restore original size
element.style.transform = '';
element.style.transformOrigin = '';
});
}
</script>
<?php include_once("insta_footer.php"); ?>

Binary file not shown.

Binary file not shown.