This commit is contained in:
Flatlogic Bot 2025-11-12 15:39:09 +00:00
parent d8cd7d2220
commit 998045f9bc
3 changed files with 397 additions and 143 deletions

16
assets/css/custom.css Normal file
View File

@ -0,0 +1,16 @@
body {
background-color: #f8f9fa;
}
.header {
background: linear-gradient(135deg, #0d6efd, #0d6efd);
color: white;
padding: 4rem 0;
text-align: center;
}
.footer {
position: fixed;
bottom: 0;
width: 100%;
}

1
assets/js/main.js Normal file
View File

@ -0,0 +1 @@
// Custom JavaScript will go here

523
index.php
View File

@ -1,150 +1,387 @@
<?php <!DOCTYPE html>
declare(strict_types=1);
@ini_set('display_errors', '1');
@error_reporting(E_ALL);
@date_default_timezone_set('UTC');
$phpVersion = PHP_VERSION;
$now = date('Y-m-d H:i:s');
?>
<!doctype html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8" /> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>New Style</title> <title>TWU Local 555 BNA Ramp Grievance Tracker</title>
<?php <meta name="description" content="A tool for TWU Local 555 to track ramp grievances at BNA.">
// Read project preview data from environment <meta name="keywords" content="grievance tracker, union grievance, ramp grievance, TWU Local 555, BNA, employee relations, dispute resolution, union representative, workplace issues, Built with Flatlogic Generator">
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? ''; <meta property="og:title" content="TWU Local 555 BNA Ramp Grievance Tracker">
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? ''; <meta property="og:description" content="A tool for TWU Local 555 to track ramp grievances at BNA.">
?> <meta property="og:image" content="">
<?php if ($projectDescription): ?> <meta name="twitter:card" content="summary_large_image">
<!-- Meta description --> <meta name="twitter:image" content="">
<meta name="description" content='<?= htmlspecialchars($projectDescription) ?>' />
<!-- Open Graph meta tags --> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
<meta property="og:description" content="<?= htmlspecialchars($projectDescription) ?>" /> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
<!-- Twitter meta tags --> <link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
<meta property="twitter:description" content="<?= htmlspecialchars($projectDescription) ?>" />
<?php endif; ?>
<?php if ($projectImageUrl): ?>
<!-- Open Graph image -->
<meta property="og:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
<!-- Twitter image -->
<meta property="twitter:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
<?php endif; ?>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
<style>
:root {
--bg-color-start: #6a11cb;
--bg-color-end: #2575fc;
--text-color: #ffffff;
--card-bg-color: rgba(255, 255, 255, 0.01);
--card-border-color: rgba(255, 255, 255, 0.1);
}
body {
margin: 0;
font-family: 'Inter', sans-serif;
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end));
color: var(--text-color);
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
text-align: center;
overflow: hidden;
position: relative;
}
body::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><path d="M-10 10L110 10M10 -10L10 110" stroke-width="1" stroke="rgba(255,255,255,0.05)"/></svg>');
animation: bg-pan 20s linear infinite;
z-index: -1;
}
@keyframes bg-pan {
0% { background-position: 0% 0%; }
100% { background-position: 100% 100%; }
}
main {
padding: 2rem;
}
.card {
background: var(--card-bg-color);
border: 1px solid var(--card-border-color);
border-radius: 16px;
padding: 2rem;
backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px);
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
}
.loader {
margin: 1.25rem auto 1.25rem;
width: 48px;
height: 48px;
border: 3px solid rgba(255, 255, 255, 0.25);
border-top-color: #fff;
border-radius: 50%;
animation: spin 1s linear infinite;
}
@keyframes spin {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
.hint {
opacity: 0.9;
}
.sr-only {
position: absolute;
width: 1px; height: 1px;
padding: 0; margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap; border: 0;
}
h1 {
font-size: 3rem;
font-weight: 700;
margin: 0 0 1rem;
letter-spacing: -1px;
}
p {
margin: 0.5rem 0;
font-size: 1.1rem;
}
code {
background: rgba(0,0,0,0.2);
padding: 2px 6px;
border-radius: 4px;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
footer {
position: absolute;
bottom: 1rem;
font-size: 0.8rem;
opacity: 0.7;
}
</style>
</head> </head>
<body> <body>
<main> <?php
<div class="card"> require_once 'db/config.php';
<h1>Analyzing your requirements and generating your website…</h1>
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes"> $message = '';
<span class="sr-only">Loading…</span> $page = isset($_GET['page']) ? htmlspecialchars($_GET['page']) : 'Local Grievances';
</div> $categories = ['Local Grievances', 'FWD to Office', 'Terminations'];
<p class="hint"><?= ($_SERVER['HTTP_HOST'] ?? '') === 'appwizzy.com' ? 'AppWizzy' : 'Flatlogic' ?> AI is collecting your requirements and applying the first changes.</p>
<p class="hint">This page will update automatically as the plan is implemented.</p> try {
<p>Runtime: PHP <code><?= htmlspecialchars($phpVersion) ?></code> — UTC <code><?= htmlspecialchars($now) ?></code></p> $pdo = db();
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$pdotest = $pdo->query('SHOW TABLES');
if ($pdotest->rowCount() == 0) {
$pdo->exec("CREATE TABLE IF NOT EXISTS grievances (
id INT AUTO_INCREMENT PRIMARY KEY,
grievant_name VARCHAR(255) NOT NULL,
discipline VARCHAR(255) NOT NULL,
subject VARCHAR(255) NOT NULL,
status VARCHAR(100) NOT NULL,
last_updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
union_representative VARCHAR(255) NOT NULL,
category VARCHAR(255) NOT NULL DEFAULT 'Local Grievances'
);");
}
// Check if 'category' column exists and add it if it doesn't
$stmt = $pdo->query("SHOW COLUMNS FROM grievances LIKE 'category'");
if ($stmt->rowCount() == 0) {
$pdo->exec("ALTER TABLE grievances ADD COLUMN category VARCHAR(255) NOT NULL DEFAULT 'Local Grievances'");
}
// Check if 'case_number' column exists and add it if it doesn't
$stmt = $pdo->query("SHOW COLUMNS FROM grievances LIKE 'case_number'");
if ($stmt->rowCount() == 0) {
$pdo->exec("ALTER TABLE grievances ADD COLUMN case_number VARCHAR(255) NULL");
}
} catch (PDOException $e) {
$message = '<div class="alert alert-danger" role="alert">Database error: ' . $e->getMessage() . '</div>';
}
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
if (isset($_POST['add_grievance'])) {
$grievant_name = trim($_POST['grievant_name']);
$discipline = trim($_POST['discipline']);
$subject = trim($_POST['subject']);
$status = trim($_POST['status']);
$union_representative = trim($_POST['union_representative']);
$category = trim($_POST['category']);
if (!empty($grievant_name) && !empty($discipline) && !empty($subject) && !empty($status) && !empty($union_representative) && !empty($category)) {
try {
$stmt = $pdo->prepare("INSERT INTO grievances (grievant_name, discipline, subject, status, union_representative, category) VALUES (?, ?, ?, ?, ?, ?)");
$stmt->execute([$grievant_name, $discipline, $subject, $status, $union_representative, $category]);
$message = '<div class="alert alert-success" role="alert">Grievance added successfully!</div>';
} catch (PDOException $e) {
$message = '<div class="alert alert-danger" role="alert">Error adding grievance: ' . $e->getMessage() . '</div>';
}
} else {
$message = '<div class="alert alert-warning" role="alert">Please fill out all fields.</div>';
}
} elseif (isset($_POST['move_grievance'])) {
$grievance_id = $_POST['grievance_id'];
$new_category = $_POST['new_category'];
if (!empty($grievance_id) && !empty($new_category) && in_array($new_category, $categories)) {
try {
$stmt = $pdo->prepare("UPDATE grievances SET category = ? WHERE id = ?");
$stmt->execute([$new_category, $grievance_id]);
$message = '<div class="alert alert-success" role="alert">Grievance moved successfully!</div>';
} catch (PDOException $e) {
$message = '<div class="alert alert-danger" role="alert">Error moving grievance: ' . $e->getMessage() . '</div>';
}
} else {
$message = '<div class="alert alert-warning" role="alert">Invalid move operation.</div>';
}
} elseif (isset($_POST['edit_grievance'])) {
$grievance_id = $_POST['grievance_id'];
$grievant_name = trim($_POST['grievant_name']);
$discipline = trim($_POST['discipline']);
$subject = trim($_POST['subject']);
$status = trim($_POST['status']);
$union_representative = trim($_POST['union_representative']);
$case_number = isset($_POST['case_number']) ? trim($_POST['case_number']) : null;
if (!empty($grievance_id) && !empty($grievant_name) && !empty($discipline) && !empty($subject) && !empty($status) && !empty($union_representative)) {
try {
// Check category to decide if case_number should be updated
$stmt_cat = $pdo->prepare("SELECT category FROM grievances WHERE id = ?");
$stmt_cat->execute([$grievance_id]);
$grievance_category = $stmt_cat->fetchColumn();
$sql = "UPDATE grievances SET grievant_name = ?, discipline = ?, subject = ?, status = ?, union_representative = ?";
$params = [$grievant_name, $discipline, $subject, $status, $union_representative];
if (($grievance_category === 'FWD to Office' || $grievance_category === 'Terminations')) {
$sql .= ", case_number = ?";
$params[] = $case_number;
}
$sql .= " WHERE id = ?";
$params[] = $grievance_id;
$stmt = $pdo->prepare($sql);
$stmt->execute($params);
$message = '<div class="alert alert-success" role="alert">Grievance updated successfully!</div>';
} catch (PDOException $e) {
$message = '<div class="alert alert-danger" role="alert">Error updating grievance: ' . $e->getMessage() . '</div>';
}
} else {
$message = '<div class="alert alert-warning" role="alert">Please fill out all fields.</div>';
}
}
}
try {
$stmt = $pdo->prepare("SELECT * FROM grievances WHERE category = ? ORDER BY last_updated DESC");
$stmt->execute([$page]);
$grievances = $stmt->fetchAll(PDO::FETCH_ASSOC);
} catch (PDOException $e) {
$grievances = [];
$message .= '<div class="alert alert-danger" role="alert">Error fetching grievances: ' . $e->getMessage() . '</div>';
}
?>
<header class="header">
<div class="container">
<h1 class="display-4">TWU Local 555 BNA Ramp Grievance Tracker</h1>
<p class="lead">A simple tool to track and manage ramp grievances.</p>
</div>
</header>
<main class="container mt-5">
<?php echo $message; ?>
<ul class="nav nav-tabs mb-3">
<?php foreach ($categories as $category): ?>
<li class="nav-item">
<a class="nav-link <?php echo $page === $category ? 'active' : ''; ?>" href="index.php?page=<?php echo urlencode($category); ?>"><?php echo htmlspecialchars($category); ?></a>
</li>
<?php endforeach; ?>
</ul>
<div class="d-flex justify-content-end mb-3">
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#addGrievanceModal">
<i class="bi bi-plus-circle"></i> Add Grievance
</button>
</div>
<div class="card shadow-sm">
<div class="card-body">
<h2 class="card-title"><?php echo htmlspecialchars($page); ?></h2>
<div class="table-responsive">
<table class="table table-hover">
<thead class="table-light">
<tr>
<th>Grievant Name</th>
<th>Discipline</th>
<th>Subject</th>
<?php if ($page === 'FWD to Office' || $page === 'Terminations'): ?>
<th>Case Number</th>
<?php endif; ?>
<th>Status</th>
<th>Last Updated</th>
<th>Union Representative</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php if (empty($grievances)): ?>
<tr>
<td colspan="<?php echo ($page === 'FWD to Office' || $page === 'Terminations') ? '8' : '7'; ?>" class="text-center">No grievances found in this category.</td>
</tr>
<?php else: ?>
<?php foreach ($grievances as $grievance): ?>
<tr>
<td><?php echo htmlspecialchars($grievance['grievant_name']); ?></td>
<td><?php echo htmlspecialchars($grievance['discipline']); ?></td>
<td><?php echo htmlspecialchars($grievance['subject']); ?></td>
<?php if ($page === 'FWD to Office' || $page === 'Terminations'): ?>
<td><?php echo htmlspecialchars($grievance['case_number'] ?? ''); ?></td>
<?php endif; ?>
<td><span class="badge bg-info text-dark"><?php echo htmlspecialchars($grievance['status']); ?></span></td>
<td><?php echo date("m/d/Y h:i A", strtotime($grievance['last_updated'])); ?></td>
<td><?php echo htmlspecialchars($grievance['union_representative']); ?></td>
<td class="d-flex gap-2">
<form action="index.php?page=<?php echo urlencode($page); ?>" method="post" class="d-flex">
<input type="hidden" name="move_grievance" value="1">
<input type="hidden" name="grievance_id" value="<?php echo $grievance['id']; ?>">
<select name="new_category" class="form-select form-select-sm me-2">
<option selected disabled>Move to...</option>
<?php
foreach ($categories as $category) {
if ($category !== $grievance['category']) {
echo '<option value="' . htmlspecialchars($category) . '">' . htmlspecialchars($category) . '</option>';
}
}
?>
</select>
<button type="submit" class="btn btn-sm btn-outline-secondary">Move</button>
</form>
<button type="button" class="btn btn-sm btn-outline-primary edit-btn"
data-bs-toggle="modal"
data-bs-target="#editGrievanceModal"
data-id="<?php echo $grievance['id']; ?>"
data-grievant-name="<?php echo htmlspecialchars($grievance['grievant_name']); ?>"
data-discipline="<?php echo htmlspecialchars($grievance['discipline']); ?>"
data-subject="<?php echo htmlspecialchars($grievance['subject']); ?>"
data-status="<?php echo htmlspecialchars($grievance['status']); ?>"
data-union-representative="<?php echo htmlspecialchars($grievance['union_representative']); ?>"
data-category="<?php echo htmlspecialchars($grievance['category']); ?>"
data-case-number="<?php echo htmlspecialchars($grievance['case_number'] ?? ''); ?>">
Edit
</button>
</td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
</tbody>
</table>
</div>
</div>
</div>
</main>
<!-- Add Grievance Modal -->
<div class="modal fade" id="addGrievanceModal" tabindex="-1" aria-labelledby="addGrievanceModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="addGrievanceModalLabel">Add New Grievance</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<form action="index.php?page=<?php echo urlencode($page); ?>" method="post" id="addGrievanceForm">
<input type="hidden" name="add_grievance" value="1">
<input type="hidden" name="category" value="<?php echo htmlspecialchars($page); ?>">
<div class="mb-3">
<label for="grievant_name" class="form-label">Grievant Name</label>
<input type="text" class="form-control" id="grievant_name" name="grievant_name" required>
</div>
<div class="mb-3">
<label for="discipline" class="form-label">Discipline</label>
<input type="text" class="form-control" id="discipline" name="discipline" required>
</div>
<div class="mb-3">
<label for="subject" class="form-label">Subject</label>
<input type="text" class="form-control" id="subject" name="subject" required>
</div>
<div class="mb-3">
<label for="status" class="form-label">Status</label>
<select class="form-select" id="status" name="status" required>
<option value="Open">Open</option>
<option value="In Progress">In Progress</option>
<option value="Resolved">Resolved</option>
<option value="Closed">Closed</option>
</select>
</div>
<div class="mb-3">
<label for="union_representative" class="form-label">Union Representative</label>
<input type="text" class.form-control" id="union_representative" name="union_representative" required>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
<button type="submit" class="btn btn-primary" form="addGrievanceForm">Save Grievance</button>
</div>
</div>
</div>
</div> </div>
</main>
<footer> <!-- Edit Grievance Modal -->
Page updated: <?= htmlspecialchars($now) ?> (UTC) <div class="modal fade" id="editGrievanceModal" tabindex="-1" aria-labelledby="editGrievanceModalLabel" aria-hidden="true">
</footer> <div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="editGrievanceModalLabel">Edit Grievance</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<form action="index.php?page=<?php echo urlencode($page); ?>" method="post" id="editGrievanceForm">
<input type="hidden" name="edit_grievance" value="1">
<input type="hidden" name="grievance_id" id="edit_grievance_id">
<div class="mb-3">
<label for="edit_grievant_name" class="form-label">Grievant Name</label>
<input type="text" class="form-control" id="edit_grievant_name" name="grievant_name" required>
</div>
<div class="mb-3">
<label for="edit_discipline" class="form-label">Discipline</label>
<input type="text" class="form-control" id="edit_discipline" name="discipline" required>
</div>
<div class="mb-3">
<label for="edit_subject" class="form-label">Subject</label>
<input type="text" class="form-control" id="edit_subject" name="subject" required>
</div>
<div class="mb-3">
<label for="edit_status" class="form-label">Status</label>
<select class="form-select" id="edit_status" name="status" required>
<option value="Open">Open</option>
<option value="In Progress">In Progress</option>
<option value="Resolved">Resolved</option>
<option value="Closed">Closed</option>
</select>
</div>
<div class="mb-3">
<label for="edit_union_representative" class="form-label">Union Representative</label>
<input type="text" class="form-control" id="edit_union_representative" name="union_representative" required>
</div>
<div class="mb-3" id="edit_case_number_wrapper" style="display: none;">
<label for="edit_case_number" class="form-label">Case Number</label>
<input type="text" class="form-control" id="edit_case_number" name="case_number">
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
<button type="submit" class="btn btn-primary" form="editGrievanceForm">Save Changes</button>
</div>
</div>
</div>
</div>
<footer class="footer mt-auto py-3 bg-light">
<div class="container text-center">
<span class="text-muted">Built with <a href="https://flatlogic.com" target="_blank">Flatlogic</a></span>
</div>
</footer>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
<script>
document.addEventListener('DOMContentLoaded', function () {
var editGrievanceModal = document.getElementById('editGrievanceModal');
editGrievanceModal.addEventListener('show.bs.modal', function (event) {
var button = event.relatedTarget;
var id = button.getAttribute('data-id');
var grievantName = button.getAttribute('data-grievant-name');
var discipline = button.getAttribute('data-discipline');
var subject = button.getAttribute('data-subject');
var status = button.getAttribute('data-status');
var unionRepresentative = button.getAttribute('data-union-representative');
var category = button.getAttribute('data-category');
var caseNumber = button.getAttribute('data-case-number');
var modal = this;
modal.querySelector('#edit_grievance_id').value = id;
modal.querySelector('#edit_grievant_name').value = grievantName;
modal.querySelector('#edit_discipline').value = discipline;
modal.querySelector('#edit_subject').value = subject;
modal.querySelector('#edit_status').value = status;
modal.querySelector('#edit_union_representative').value = unionRepresentative;
var caseNumberWrapper = modal.querySelector('#edit_case_number_wrapper');
var caseNumberInput = modal.querySelector('#edit_case_number');
if (category === 'FWD to Office' || category === 'Terminations') {
caseNumberWrapper.style.display = 'block';
caseNumberInput.value = caseNumber;
} else {
caseNumberWrapper.style.display = 'none';
caseNumberInput.value = '';
}
});
});
</script>
</body> </body>
</html> </html>