diff --git a/assets/css/custom.css b/assets/css/custom.css index 886b3fb..c987b0e 100644 --- a/assets/css/custom.css +++ b/assets/css/custom.css @@ -1,16 +1,21 @@ body { - background-color: #f8f9fa; + } .header { - background: linear-gradient(135deg, #0d6efd, #0d6efd); + background: linear-gradient(to right, #007bff, #0056b3); color: white; padding: 4rem 0; text-align: center; } +.header h1 { + text-shadow: none; +} + + .footer { position: fixed; bottom: 0; width: 100%; -} +} \ No newline at end of file diff --git a/assets/css/dark-mode.css b/assets/css/dark-mode.css new file mode 100644 index 0000000..2ba1049 --- /dev/null +++ b/assets/css/dark-mode.css @@ -0,0 +1,100 @@ +body.dark-mode { + background-color: #121212; + color: #e0e0e0; +} + +body.dark-mode .header { + background: #1e1e1e; + border-bottom: 1px solid #333; +} + +body.dark-mode .card { + background-color: #1e1e1e; + border: 1px solid #333; +} + +body.dark-mode .modal-content { + background-color: #1e1e1e; + border: 1px solid #333; +} + +body.dark-mode .footer { + background-color: #1e1e1e; + border-top: 1px solid #333; +} + +body.dark-mode .table { + background-color: #1e1e1e; + color: #e0e0e0; +} + +body.dark-mode .table-light { + background-color: #333; + color: #e0e0e0; +} + +body.dark-mode .nav-tabs .nav-link { + color: #e0e0e0; + border: 1px solid #333; +} + +body.dark-mode .nav-tabs .nav-link.active { + background-color: #333; + border-color: #333; +} + +body.dark-mode .form-control { + background-color: #333; + color: #e0e0e0; + border: 1px solid #555; +} + +body.dark-mode .form-select { + background-color: #333; + color: #e0e0e0; + border: 1px solid #555; +} + +body.dark-mode .btn-primary { + background-color: #0d6efd; + border-color: #0d6efd; +} + +body.dark-mode .btn-outline-primary { + color: #0d6efd; + border-color: #0d6efd; +} + +body.dark-mode .btn-outline-primary:hover { + background-color: #0d6efd; + color: #fff; +} + +body.dark-mode .btn-outline-secondary { + color: #6c757d; + border-color: #6c757d; +} + +body.dark-mode .btn-outline-secondary:hover { + background-color: #6c757d; + color: #fff; +} + +body.dark-mode .btn-outline-info { + color: #0dcaf0; + border-color: #0dcaf0; +} + +body.dark-mode .btn-outline-info:hover { + background-color: #0dcaf0; + color: #000; +} + +body.dark-mode .text-muted { + color: #aaa !important; +} + +body.dark-mode .badge.bg-info { + background-color: #0dcaf0 !important; + color: #000 !important; +} diff --git a/assets/pasted-20251112-162625-ae9fd705.jpg b/assets/pasted-20251112-162625-ae9fd705.jpg new file mode 100644 index 0000000..05d0748 Binary files /dev/null and b/assets/pasted-20251112-162625-ae9fd705.jpg differ diff --git a/footer.php b/footer.php new file mode 100644 index 0000000..fc6fb5e --- /dev/null +++ b/footer.php @@ -0,0 +1,67 @@ + + + + + + + + \ No newline at end of file diff --git a/header.php b/header.php new file mode 100644 index 0000000..5200081 --- /dev/null +++ b/header.php @@ -0,0 +1,196 @@ + + + + + + TWU Local 555 BNA Ramp Grievance Tracker + + + + + + + + + + + + + + + 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"); + } + + $pdo->exec("CREATE TABLE IF NOT EXISTS grievance_updates ( + id INT AUTO_INCREMENT PRIMARY KEY, + grievance_id INT NOT NULL, + update_text TEXT NOT NULL, + representative_name VARCHAR(255) NOT NULL, + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + FOREIGN KEY (grievance_id) REFERENCES grievances(id) ON DELETE CASCADE + );"); + + } 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 = ''; + } + } elseif (isset($_POST['add_grievance_update'])) { + $grievance_id = $_POST['grievance_id']; + $update_text = trim($_POST['update_text']); + $representative_name = trim($_POST['representative_name']); + + if (!empty($grievance_id) && !empty($update_text) && !empty($representative_name)) { + try { + $stmt = $pdo->prepare("INSERT INTO grievance_updates (grievance_id, update_text, representative_name) VALUES (?, ?, ?)"); + $stmt->execute([$grievance_id, $update_text, $representative_name]); + $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.

+
+
+ + +
+
+
+
+ +
+ diff --git a/index.php b/index.php index 129b98b..9120167 100644 --- a/index.php +++ b/index.php @@ -1,156 +1,4 @@ - - - - - - TWU Local 555 BNA Ramp Grievance Tracker - - - - - - - - - - - - - - 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.

-
-
- -
- +
@@ -179,6 +30,9 @@ Case Number + + Timeframes + Status Last Updated Union Representative @@ -188,7 +42,7 @@ - No grievances found in this category. + No grievances found in this category. @@ -199,6 +53,9 @@ + + + @@ -231,6 +88,47 @@ data-case-number=""> Edit + + + + + +
+
Updates
+ prepare("SELECT * FROM grievance_updates WHERE grievance_id = ? ORDER BY created_at DESC"); + $update_stmt->execute([$grievance['id']]); + $updates = $update_stmt->fetchAll(PDO::FETCH_ASSOC); + ?> + +

No updates for this grievance yet.

+ +
    + +
  • +

    + By on +
  • + +
+ + +
+ + +
+ + +
+
+ + +
+ +
+
@@ -269,10 +167,11 @@
@@ -316,10 +215,11 @@
@@ -340,48 +240,4 @@
- - - - - - - + diff --git a/statistics.php b/statistics.php new file mode 100644 index 0000000..3c56748 --- /dev/null +++ b/statistics.php @@ -0,0 +1,232 @@ +setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + + // Fetch data for Discipline + $discipline_stmt = $pdo->query("SELECT discipline, COUNT(*) as count FROM grievances GROUP BY discipline"); + $discipline_data = $discipline_stmt->fetchAll(PDO::FETCH_ASSOC); + + // Fetch data for Subject + $subject_stmt = $pdo->query("SELECT subject, COUNT(*) as count FROM grievances GROUP BY subject"); + $subject_data = $subject_stmt->fetchAll(PDO::FETCH_ASSOC); + + // Fetch data for Grievances per Quarter + $quarter_stmt = $pdo->query("SELECT QUARTER(last_updated) as quarter, COUNT(*) as count FROM grievances GROUP BY QUARTER(last_updated)"); + $quarter_data = $quarter_stmt->fetchAll(PDO::FETCH_ASSOC); + +} catch (PDOException $e) { + echo '
Database error: ' . $e->getMessage() . '
'; + exit; +} + +$discipline_labels = []; +$discipline_values = []; +foreach ($discipline_data as $data) { + $discipline_labels[] = $data['discipline']; + $discipline_values[] = $data['count']; +} + +$subject_labels = []; +$subject_values = []; +foreach ($subject_data as $data) { + $subject_labels[] = $data['subject']; + $subject_values[] = $data['count']; +} + +$quarter_labels = []; +$quarter_values = []; +foreach ($quarter_data as $data) { + $quarter_labels[] = 'Q' . $data['quarter']; + $quarter_values[] = $data['count']; +} +?> + +
+

Grievance Statistics

+
+
+

Discipline

+ +
+
+

Subject

+ +
+
+

Grievances per Quarter

+ +
+
+
+ + + + \ No newline at end of file