diff --git a/assets/css/custom.css b/assets/css/custom.css new file mode 100644 index 0000000..886b3fb --- /dev/null +++ b/assets/css/custom.css @@ -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%; +} diff --git a/assets/js/main.js b/assets/js/main.js new file mode 100644 index 0000000..6130445 --- /dev/null +++ b/assets/js/main.js @@ -0,0 +1 @@ +// Custom JavaScript will go here diff --git a/index.php b/index.php index 7205f3d..129b98b 100644 --- a/index.php +++ b/index.php @@ -1,150 +1,387 @@ - - + - - - New Style - - - - - - - - - - - - - - - - - - - + + + TWU Local 555 BNA Ramp Grievance Tracker + + + + + + + + + + + -
-
-

Analyzing your requirements and generating your website…

-
- Loading… -
-

AI is collecting your requirements and applying the first changes.

-

This page will update automatically as the plan is implemented.

-

Runtime: PHP — UTC

+ 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 = ''; + } + + 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 = ''; + } catch (PDOException $e) { + $message = ''; + } + } else { + $message = ''; + } + } 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 = ''; + } catch (PDOException $e) { + $message = ''; + } + } else { + $message = ''; + } + } 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 = ''; + } catch (PDOException $e) { + $message = ''; + } + } else { + $message = ''; + } + } + } + + 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 .= ''; + } + ?> + +
+
+

TWU Local 555 BNA Ramp Grievance Tracker

+

A simple tool to track and manage ramp grievances.

+
+
+ +
+ + + + +
+ +
+ +
+
+

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Grievant NameDisciplineSubjectCase NumberStatusLast UpdatedUnion RepresentativeActions
No grievances found in this category.
+
+ + + + +
+ +
+
+
+
+
+ + + -
- + + + + + + + + +