Completed questionnaire form with all sections and validation logic

This commit is contained in:
overplayed 2025-03-15 22:24:56 -04:00
parent 4627c7ef00
commit 3089a26449
5 changed files with 571 additions and 42 deletions

View File

@ -0,0 +1,29 @@
body {
font-family: Arial, sans-serif;
background-color: #f8f9fa;
}
.container {
max-width: 800px;
background: white;
padding: 20px;
border-radius: 8px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
h3 {
color: #253f8a;
}
.btn-primary {
background-color: #253f8a;
border: none;
}
.btn-primary:hover {
background-color: #1a2d6d;
}
.alert {
display: none;
}

View File

@ -115,5 +115,34 @@ document.addEventListener("DOMContentLoaded", function () {
localStorage.setItem("assessmentData", JSON.stringify(formData));
});
prepopulateForm();
fetch("../load-responses.php?token=" + new URLSearchParams(window.location.search).get("token"))
.then(response => response.json())
.then(data => {
if (data.error) {
document.getElementById("auth-message").style.display = "block";
} else {
document.getElementById("assessment-form").style.display = "block";
if (data.is_board_member == 1) {
document.getElementById("board-member-section").style.display = "block";
document.getElementById("board-member-image").src = data.board_member_image;
}
// Fetch board member data
fetch("../board-member.php")
.then(response => response.json())
.then(data => {
if (data.is_board_member) {
document.getElementById("board-member-questions").style.display = "block";
}
})
.catch(error => console.error("Failed to load board member data:", error));
prepopulateForm();
}
})
.catch(error => {
console.error("Failed to validate token:", error);
document.getElementById("auth-message").style.display = "block";
});
});

35
board-member.php Normal file
View File

@ -0,0 +1,35 @@
<?php
require_once __DIR__ . "/db.php";
session_start();
// Ensure user is authenticated
if (!isset($_SESSION['user_id'])) {
http_response_code(403);
echo json_encode(["error" => "Unauthorized access."]);
exit;
}
// Check if the user is a board member
$userId = $_SESSION['user_id'];
$stmt = $conn->prepare("SELECT is_board_member FROM users WHERE id = ?");
$stmt->bind_param("i", $userId);
$stmt->execute();
$result = $stmt->get_result();
$user = $result->fetch_assoc();
$isBoardMember = $user['is_board_member'] ?? 0;
$response = ["is_board_member" => $isBoardMember];
if ($isBoardMember) {
// Fetch board member image
$stmt = $conn->prepare("SELECT image_url FROM board_members WHERE user_id = ?");
$stmt->bind_param("i", $userId);
$stmt->execute();
$result = $stmt->get_result();
$boardMember = $result->fetch_assoc();
$response["board_member_image"] = $boardMember['image_url'] ?? "../assets/img/ccah-logo.png";
}
echo json_encode($response);
?>

View File

@ -25,116 +25,533 @@
<form id="assessment-form">
<div id="form-message" class="alert d-none mt-3"></div>
<!-- General Information -->
<h2>General Information</h2>
<!-- Role/Title -->
<div class="mb-3">
<label class="form-label">Role/Title at CCAH</label>
<label class="form-label">Role/Title at CCAH <span class="text-danger">*</span></label>
<input type="text" class="form-control" name="role" required>
</div>
<!-- Role Function -->
<div class="mb-3">
<label class="form-label">Briefly describe your role function</label>
<label class="form-label">Briefly describe your role function <span class="text-danger">*</span></label>
<textarea class="form-control" name="role_function" required></textarea>
</div>
<!-- Primary Daily/Weekly Tasks -->
<div class="mb-3">
<label class="form-label">Devices Used For CCAH Work</label>
<label class="form-label">Primary Daily/Weekly Tasks <span class="text-danger">*</span></label>
<textarea class="form-control" name="tasks" required></textarea>
</div>
<!-- Devices Used -->
<div class="mb-3">
<label class="form-label">Devices Used For CCAH Work <span class="text-danger">*</span></label>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="devices" value="PC" id="device-pc">
<input class="form-check-input" type="checkbox" name="devices[]" value="PC" id="device-pc">
<label class="form-check-label" for="device-pc">PC</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="devices" value="Mac" id="device-mac">
<input class="form-check-input" type="checkbox" name="devices[]" value="Mac" id="device-mac">
<label class="form-check-label" for="device-mac">Mac</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="devices" value="Tablet" id="device-tablet">
<input class="form-check-input" type="checkbox" name="devices[]" value="Tablet" id="device-tablet">
<label class="form-check-label" for="device-tablet">Tablet</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="devices" value="Phone" id="device-phone">
<input class="form-check-input" type="checkbox" name="devices[]" value="Phone" id="device-phone">
<label class="form-check-label" for="device-phone">Phone</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="devices" value="Other" id="device-other"
<input class="form-check-input" type="checkbox" name="devices[]" value="Other" id="device-other"
onclick="toggleOtherField(this, 'device-other-text')">
<label class="form-check-label" for="device-other">Other</label>
</div>
<input type="text" class="form-control mt-2" id="device-other-text" name="device_other"
placeholder="Specify other device" style="display: none;">
</div>
<!-- PC Operating System (Shown if "PC" is selected) -->
<div id="pc-os-section" class="mb-3" style="display: none;">
<label class="form-label">What operating system does your PC use? <span class="text-danger">*</span></label>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="pc_os[]" value="Windows">
<label class="form-check-label">Windows</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="pc_os[]" value="Linux">
<label class="form-check-label">Linux</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="pc_os[]" value="Other"
onclick="toggleOtherField(this, 'pc-os-other-text')">
<label class="form-check-label">Other</label>
</div>
<input type="text" class="form-control mt-2" id="pc-os-other-text" name="pc_os_other"
placeholder="Specify other OS" style="display: none;">
</div>
<!-- Tablet Operating System (Shown if "Tablet" is selected) -->
<div id="tablet-os-section" class="mb-3" style="display: none;">
<label class="form-label">What type of tablet do you use? <span class="text-danger">*</span></label>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="tablet_os[]" value="iOS">
<label class="form-check-label">iOS</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="tablet_os[]" value="Android">
<label class="form-check-label">Android</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="tablet_os[]" value="Other"
onclick="toggleOtherField(this, 'tablet-os-other-text')">
<label class="form-check-label">Other</label>
</div>
<input type="text" class="form-control mt-2" id="tablet-os-other-text" name="tablet_os_other"
placeholder="Specify other OS" style="display: none;">
</div>
<!-- Phone Operating System (Shown if "Phone" is selected) -->
<div id="phone-os-section" class="mb-3" style="display: none;">
<label class="form-label">What type of phone do you use? <span class="text-danger">*</span></label>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="phone_os[]" value="iOS">
<label class="form-check-label">iOS</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="phone_os[]" value="Android">
<label class="form-check-label">Android</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="phone_os[]" value="Other"
onclick="toggleOtherField(this, 'phone-os-other-text')">
<label class="form-check-label">Other</label>
</div>
<input type="text" class="form-control mt-2" id="phone-os-other-text" name="phone_os_other"
placeholder="Specify other OS" style="display: none;">
</div>
<!-- Work Location -->
<div class="mb-3">
<label class="form-label">Work Location</label>
<label class="form-label">Work Location <span class="text-danger">*</span></label>
<select class="form-control" name="work_location" required>
<option value="">Select...</option>
<option value="100% Office">100% Office</option>
<option value="Mostly Office">Mostly office with some remote work</option>
<option value="Balanced">Balanced (50/50 office & remote)</option>
<option value="Mostly Remote">Mostly remote with some office work</option>
<option value="Mostly Office">Mostly Office with some remote work</option>
<option value="Balanced">Balanced (50/50 Office & Remote)</option>
<option value="Mostly Remote">Mostly Remote with some office work</option>
<option value="100% Remote">100% Remote</option>
</select>
</div>
<!--******************************************************************************************************-->
<h2>Board Member Specific Questions</h2>
<!-- Document Access -->
<div class="mb-3">
<label class="form-label">Do you currently have adequate access to the documents and information needed to fulfill your role as a board member?</label>
<div class="form-check">
<input class="form-check-input" type="radio" name="board_doc_access" value="Yes" required>
<label class="form-check-label">Yes</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="board_doc_access" value="No" required onclick="toggleOtherField('access_issues_details', this)">
<label class="form-check-label">No</label>
</div>
<input type="text" class="form-control mt-2" id="access_issues_details" name="access_issues_details" placeholder="Please describe any issues" style="display: none;">
</div>
<!-- Collaboration Effectiveness -->
<div class="mb-3">
<label class="form-label">How effective do you find current collaboration tools for board-related communications?</label>
<select class="form-control" name="board_collab_effectiveness" required>
<option value="Very Effective">Very Effective</option>
<option value="Somewhat Effective">Somewhat Effective</option>
<option value="Neutral">Neutral</option>
<option value="Somewhat Ineffective">Somewhat Ineffective</option>
<option value="Very Ineffective">Very Ineffective</option>
</select>
</div>
<!-- Meeting Issues -->
<div class="mb-3">
<label class="form-label">Have you experienced any difficulties in attending board meetings virtually or in person as a result of technology-related issues?</label>
<div class="form-check">
<input class="form-check-input" type="radio" name="meeting_issues" value="Yes" required onclick="toggleOtherField('meeting_issues_details', this)">
<label class="form-check-label">Yes</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="meeting_issues" value="No" required>
<label class="form-check-label">No</label>
</div>
<input type="text" class="form-control mt-2" id="meeting_issues_details" name="meeting_issues_details" placeholder="Please describe any issues" style="display: none;">
</div>
<!-- Suggestions for Improvement -->
<div class="mb-3">
<label class="form-label">Do you have any suggestions to improve board communication, document sharing, or meeting accessibility?</label>
<textarea class="form-control" name="board_suggestions" rows="3"></textarea>
</div>
<!--******************************************************************************************************-->
<h2>Email & Collaboration</h2>
<!-- Email Access -->
<div class="mb-3">
<label class="form-label">How do you access your email?</label>
<label class="form-label">How do you access your email? <span class="text-danger">*</span></label>
<select class="form-control" name="email_access" required>
<option value="">Select...</option>
<option value="Outlook">Outlook (Installed)</option>
<option value="Webmail">Webmail (Browser)</option>
<option value="Mobile">Mobile (Phone/Tablet)</option>
<option value="All Methods">I use all 3 methods</option>
<option value="Outlook">Outlook (Installed on PC or Mac)</option>
<option value="Webmail">Webmail (Accessing email in a browser)</option>
<option value="Mobile">Mobile (iOS/Android - Phone or Tablet)</option>
<option value="Outlook and Mobile">Outlook and Mobile</option>
<option value="Webmail and Mobile">Webmail and Mobile</option>
<option value="All Methods">I use all three methods</option>
<option value="Outlook or Webmail Only">I only use Outlook or Webmail (no phone/tablet email setup)</option>
</select>
</div>
<!-- Shared Mailbox, Calendars, or Contacts -->
<div class="mb-3">
<label class="form-label">Do you share mailboxes, calendars, or contacts? <span class="text-danger">*</span></label>
<div class="form-check">
<input class="form-check-input" type="radio" name="shared_mailbox" value="Yes" required onclick="toggleOtherField('shared_mailbox_details', this)">
<label class="form-check-label">Yes</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="shared_mailbox" value="No" required>
<label class="form-check-label">No</label>
</div>
</div>
<!-- Shared Mailbox Details (Shown if "Yes" is selected) -->
<div class="mb-3" id="shared_mailbox_details_section" style="display: none;">
<label class="form-label">Please provide details:</label>
<textarea class="form-control" id="shared_mailbox_details" name="shared_mailbox_details" rows="3"></textarea>
</div>
<!-- Collaboration Tools Used -->
<div class="mb-3">
<label class="form-label">Do you use Microsoft Teams, SharePoint, OneDrive, or other tools? <span class="text-danger">*</span></label>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="tools_used[]" value="Teams">
<label class="form-check-label">Teams</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="tools_used[]" value="SharePoint">
<label class="form-check-label">SharePoint</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="tools_used[]" value="OneDrive">
<label class="form-check-label">OneDrive</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="tools_used[]" value="Zoom">
<label class="form-check-label">Zoom</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="tools_used[]" value="WebEx">
<label class="form-check-label">WebEx</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="tools_used[]" value="Other" onclick="toggleOtherField(this, 'tools-used-other-text')">
<label class="form-check-label">Other</label>
</div>
<input type="text" class="form-control mt-2" id="tools-used-other-text" name="tools_used_other" placeholder="Specify other tool" style="display: none;">
</div>
<!-- Email Issues -->
<div class="mb-3">
<label class="form-label">Are you experiencing any issues with your current email setup? (Select all that apply)</label>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="email_issues[]" value="No Issues">
<label class="form-check-label">No, I have no email issues</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="email_issues[]" value="Login Problems">
<label class="form-check-label">Difficulty logging into email</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="email_issues[]" value="Delayed Emails">
<label class="form-check-label">Emails are delayed or not sending</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="email_issues[]" value="Missing Emails">
<label class="form-check-label">Some emails are missing</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="email_issues[]" value="Sync Issues">
<label class="form-check-label">Email not syncing properly across devices</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="email_issues[]" value="Spam Issues">
<label class="form-check-label">Too many spam emails</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="email_issues[]" value="Other" onclick="toggleOtherField(this, 'email-issues-other-text')">
<label class="form-check-label">Other</label>
</div>
<input type="text" class="form-control mt-2" id="email-issues-other-text" name="email_issues_other" placeholder="Specify other issue" style="display: none;">
</div>
<!-- Meeting Frequency -->
<div class="mb-3">
<label class="form-label">How many meetings do you participate in per week? <span class="text-danger">*</span></label>
<select class="form-control" name="meetings_count" required>
<option value="">Select...</option>
<option value="0">0 (No meetings)</option>
<option value="1-2">1-2 meetings per week</option>
<option value="3-5">3-5 meetings per week</option>
<option value="6-10">6-10 meetings per week</option>
<option value="11+">More than 10 meetings per week</option>
</select>
</div>
<!--********************************************************************************************-->
<h2>File Storage & Access</h2>
<!-- File Storage Options -->
<div class="mb-3">
<label class="form-label">Where do you currently store your files? <span class="text-danger">*</span></label>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="file_storage[]" value="OneDrive">
<label class="form-check-label">OneDrive</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="file_storage[]" value="Google Drive">
<label class="form-check-label">Google Drive</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="file_storage[]" value="Local PC/Mac">
<label class="form-check-label">Local PC/Mac</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="file_storage[]" value="Company Server">
<label class="form-check-label">Company Server</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="file_storage[]" value="USB Drive">
<label class="form-check-label">USB Drive</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="file_storage[]" value="External Hard Drive">
<label class="form-check-label">External Hard Drive</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="file_storage[]" value="Other"
onclick="toggleOtherField(this, 'file-storage-other-text')">
<label class="form-check-label">Other</label>
</div>
<input type="text" class="form-control mt-2" id="file-storage-other-text" name="file_storage_other"
placeholder="Specify other storage method" style="display: none;">
</div>
<!-- Shared Folder/File Access -->
<div class="mb-3">
<label class="form-label">Do you need access to shared folders/files with other team members? <span class="text-danger">*</span></label>
<div class="form-check">
<input class="form-check-input" type="radio" name="shared_files" value="Yes" required>
<label class="form-check-label">Yes</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="shared_files" value="No" required>
<label class="form-check-label">No</label>
</div>
</div>
<!-- Critical Files -->
<div class="mb-3">
<label class="form-label">Are there any files that are critical for daily operations? <span class="text-danger">*</span></label>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="critical_files[]" value="Client Documents">
<label class="form-check-label">Client Documents</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="critical_files[]" value="Financial Reports">
<label class="form-check-label">Financial Reports</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="critical_files[]" value="HR Records">
<label class="form-check-label">HR Records</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="critical_files[]" value="Program/Project Documents">
<label class="form-check-label">Program/Project Documents</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="critical_files[]" value="Legal Documents">
<label class="form-check-label">Legal Documents</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="critical_files[]" value="Other"
onclick="toggleOtherField(this, 'critical-files-other-text')">
<label class="form-check-label">Other</label>
</div>
<input type="text" class="form-control mt-2" id="critical-files-other-text" name="critical_files_other"
placeholder="Specify other critical files" style="display: none;">
</div>
<!--************************************************************************************************-->
<h2>Security & Access</h2>
<!-- Multi-Factor Authentication (MFA) -->
<div class="mb-3">
<label class="form-label">Do you use Multi-Factor Authentication (MFA)?</label>
<select class="form-control" name="mfa" id="mfa-select" onchange="toggleDependentField(this, 'Yes', 'mfa-types')">
<option value="No">No</option>
<option value="Yes">Yes</option>
</select>
<label class="form-label">Do you use Multi-Factor Authentication (MFA) for your Microsoft 365 login? <span class="text-danger">*</span></label>
<div class="form-check">
<input class="form-check-input" type="radio" name="mfa" value="Yes" required onclick="toggleOtherField('mfa-types-section', this)">
<label class="form-check-label">Yes</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="mfa" value="No" required>
<label class="form-check-label">No</label>
</div>
</div>
<div id="mfa-types" class="mt-3" style="display: none;">
<label class="form-label">What type of MFA do you use?</label>
<!-- MFA Type Options (Only if "Yes" is selected) -->
<div id="mfa-types-section" class="mb-3" style="display: none;">
<label class="form-label">What type of MFA do you use? <span class="text-danger">*</span></label>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="mfa_types" value="Email">
<input class="form-check-input" type="checkbox" name="mfa_types[]" value="Email">
<label class="form-check-label">Email</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="mfa_types" value="Text">
<input class="form-check-input" type="checkbox" name="mfa_types[]" value="Text">
<label class="form-check-label">Text</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="mfa_types" value="Authenticator App"
onclick="toggleOtherField(this, 'mfa-app-name')">
<input class="form-check-input" type="checkbox" name="mfa_types[]" value="Authenticator App" onclick="toggleOtherField(this, 'mfa-app-section')">
<label class="form-check-label">Authenticator App</label>
</div>
<input type="text" class="form-control mt-2" id="mfa-app-name" name="mfa_apps"
placeholder="Specify MFA App" style="display: none;">
</div>
<!-- MFA App Options (Only if "Authenticator App" is selected) -->
<div id="mfa-app-section" class="mb-3" style="display: none;">
<label class="form-label">Which authenticator app do you use? <span class="text-danger">*</span></label>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="mfa_apps[]" value="Microsoft Authenticator">
<label class="form-check-label">Microsoft Authenticator</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="mfa_apps[]" value="Google Authenticator">
<label class="form-check-label">Google Authenticator</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="mfa_apps[]" value="FreeOTP">
<label class="form-check-label">FreeOTP</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="mfa_apps[]" value="Other" onclick="toggleOtherField(this, 'mfa-app-other-text')">
<label class="form-check-label">Other</label>
</div>
<input type="text" class="form-control mt-2" id="mfa-app-other-text" name="mfa_app_other" placeholder="Specify other MFA app" style="display: none;">
</div>
<!-- Personal Device Usage -->
<div class="mb-3">
<label class="form-label">Do you use any personal devices to perform CCAH work? <span class="text-danger">*</span></label>
<div class="form-check">
<input class="form-check-input" type="radio" name="personal_device" value="Yes" required onclick="toggleOtherField('device-options-section', this)">
<label class="form-check-label">Yes</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="personal_device" value="No" required>
<label class="form-check-label">No</label>
</div>
</div>
<!-- Personal Devices Used (Only if "Yes" is selected) -->
<div id="device-options-section" class="mb-3" style="display: none;">
<label class="form-label">Which personal devices do you use?</label>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="personal_device_types[]" value="Phone">
<label class="form-check-label">Phone</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="personal_device_types[]" value="Computer">
<label class="form-check-label">Computer</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="personal_device_types[]" value="Tablet">
<label class="form-check-label">Tablet</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="personal_device_types[]" value="Other" onclick="toggleOtherField(this, 'device-other-text')">
<label class="form-check-label">Other</label>
</div>
<input type="text" class="form-control mt-2" id="device-other-text" name="personal_device_other" placeholder="Specify other device" style="display: none;">
</div>
<!-- Security Concerns -->
<div class="mb-3">
<label class="form-label">Have you experienced any security issues or concerns? (Select all that apply)</label>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="security_concerns[]" value="Phishing Attempts">
<label class="form-check-label">Phishing Attempts</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="security_concerns[]" value="Ransomware or Malware">
<label class="form-check-label">Ransomware or Malware</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="security_concerns[]" value="Unauthorized Access">
<label class="form-check-label">Unauthorized Access</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="security_concerns[]" value="Data Loss">
<label class="form-check-label">Data Loss</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="security_concerns[]" value="Other" onclick="toggleOtherField(this, 'security-other-text')">
<label class="form-check-label">Other</label>
</div>
<input type="text" class="form-control mt-2" id="security-other-text" name="security_concerns_other" placeholder="Specify other security concerns" style="display: none;">
</div>
<!--************************************************************************************************-->
<h2>Recommendations & Challenges</h2>
<!-- IT Challenges -->
<div class="mb-3">
<label class="form-label">Are there any IT challenges you face regularly?</label>
<label class="form-label">Are there any IT challenges you face regularly? (Select all that apply) <span class="text-danger">*</span></label>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="it_challenges" value="Slow Performance">
<input class="form-check-input" type="checkbox" name="it_challenges[]" value="Slow Computer Performance">
<label class="form-check-label">Slow Computer Performance</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="it_challenges" value="Software Issues">
<input class="form-check-input" type="checkbox" name="it_challenges[]" value="Software Issues">
<label class="form-check-label">Software Issues</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="it_challenges" value="Other"
onclick="toggleOtherField(this, 'it-other-text')">
<input class="form-check-input" type="checkbox" name="it_challenges[]" value="Connectivity Problems">
<label class="form-check-label">Connectivity Problems</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="it_challenges[]" value="File Sharing Difficulties">
<label class="form-check-label">File Sharing Difficulties</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="it_challenges[]" value="Security Concerns">
<label class="form-check-label">Security Concerns</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="it_challenges[]" value="Other" onclick="toggleOtherField(this, 'it-challenges-other-text')">
<label class="form-check-label">Other</label>
</div>
<input type="text" class="form-control mt-2" id="it-other-text" name="it_other"
placeholder="Specify other challenges" style="display: none;">
<input type="text" class="form-control mt-2" id="it-challenges-other-text" name="it_challenges_other" placeholder="Specify other IT challenges" style="display: none;">
</div>
<!-- IT Setup Improvement -->
<div class="mb-3">
<label class="form-label">Is there anything you would like to improve about your IT setup?</label>
<textarea class="form-control" name="improvements" rows="3" placeholder="Example: Faster computer, better internet connectivity, upgraded software versions, etc."></textarea>
</div>
<!-- Operations Improvement -->
<div class="mb-3">
<label class="form-label">Do you have any recommendations on improving CCAHs overall operations?</label>
<textarea class="form-control" name="operations_improvement" rows="3" placeholder="Example: More training for staff on Microsoft 365, clearer IT support request process, etc."></textarea>
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
</div>

View File

@ -36,13 +36,32 @@ if (!$user) {
exit;
}
// Check if token is expired
if (strtotime($user['token_expires_at']) < time()) {
if ($user['expired'] == 1) {
http_response_code(403);
echo json_encode(["error" => "Authentication token has expired."]);
exit;
}
$userId = $user['id'];
$isBoardMember = $user['is_board_member'];
// Fetch board member profile image (if applicable)
$boardMemberImage = "img/ccah-logo.png"; // Default image
if ($isBoardMember == 1) {
$stmt = $conn->prepare("SELECT image_url FROM board_members WHERE user_id = ?");
$stmt->bind_param("i", $userId);
$stmt->execute();
$result = $stmt->get_result();
if ($result->num_rows > 0) {
$boardMember = $result->fetch_assoc();
$boardMemberImage = $boardMember['image_url'] ?: "img/ccah-logo.png";
}
}
// Add board membership and image to the response
$response['is_board_member'] = $isBoardMember;
$response['board_member_image'] = $boardMemberImage;
// Fetch saved responses