File size: 8,781 Bytes
39033c5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Admin Dashboard</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css">
    <style>
        .sidebar {
            min-height: 100vh;
            background-color: #212529;
            color: white;
        }
        .sidebar-link {
            color: rgba(255, 255, 255, 0.75);
            text-decoration: none;
            display: block;
            padding: 10px 15px;
            border-radius: 5px;
            margin-bottom: 5px;
        }
        .sidebar-link:hover, .sidebar-link.active {
            color: white;
            background-color: #495057;
        }
        .stat-card {
            border-radius: 10px;
            padding: 20px;
            color: white;
            margin-bottom: 20px;
        }
        .stat-card.total {
            background: linear-gradient(135deg, #6B73FF 0%, #000DFF 100%);
        }
        .stat-card.open {
            background: linear-gradient(135deg, #FF6B6B 0%, #FF0000 100%);
        }
        .stat-card.progress {
            background: linear-gradient(135deg, #FFD166 0%, #FF9500 100%);
        }
        .stat-card.resolved {
            background: linear-gradient(135deg, #06D6A0 0%, #00A86B 100%);
        }
        .ticket-table th {
            background-color: #f8f9fa;
        }
    </style>
</head>
<body>
    <div class="container-fluid">
        <div class="row">
            <!-- Sidebar -->
            <div class="col-md-3 col-lg-2 d-md-block sidebar collapse bg-dark">
                <div class="position-sticky pt-3">
                    <div class="text-center mb-4">
                        <h4>SupportHub Admin</h4>
                        <p class="text-muted">Welcome, <?php echo htmlspecialchars($_SESSION['username']); ?></p>
                    </div>
                    
                    <ul class="nav flex-column">
                        <li>
                            <a href="dashboard.php" class="sidebar-link active">
                                <i class="bi bi-speedometer2 me-2"></i> Dashboard
                            </a>
                        </li>
                        <li>
                            <a href="tickets.php" class="sidebar-link">
                                <i class="bi bi-ticket-detailed me-2"></i> Tickets
                            </a>
                        </li>
                        <li>
                            <a href="staff.php" class="sidebar-link">
                                <i class="bi bi-people me-2"></i> Staff
                            </a>
                        </li>
                        <li>
                            <a href="reports.php" class="sidebar-link">
                                <i class="bi bi-graph-up me-2"></i> Reports
                            </a>
                        </li>
                        <li>
                            <a href="settings.php" class="sidebar-link">
                                <i class="bi bi-gear me-2"></i> Settings
                            </a>
                        </li>
                        <li class="mt-4">
                            <a href="../logout.php" class="sidebar-link text-danger">
                                <i class="bi bi-box-arrow-right me-2"></i> Logout
                            </a>
                        </li>
                    </ul>
                </div>
            </div>

            <!-- Main Content -->
            <main class="col-md-9 ms-sm-auto col-lg-10 px-md-4 py-4">
                <div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
                    <h1 class="h2">Dashboard</h1>
                    <div class="btn-toolbar mb-2 mb-md-0">
                        <div class="btn-group me-2">
                            <button type="button" class="btn btn-sm btn-outline-secondary">Export</button>
                        </div>
                    </div>
                </div>

                <!-- Stats Cards -->
                <div class="row">
                    <div class="col-md-3">
                        <div class="stat-card total">
                            <h5>Total Tickets</h5>
                            <h2><?php echo $total_tickets; ?></h2>
                        </div>
                    </div>
                    <div class="col-md-3">
                        <div class="stat-card open">
                            <h5>Open Tickets</h5>
                            <h2><?php echo $open_tickets; ?></h2>
                        </div>
                    </div>
                    <div class="col-md-3">
                        <div class="stat-card progress">
                            <h5>In Progress</h5>
                            <h2><?php echo $in_progress_tickets; ?></h2>
                        </div>
                    </div>
                    <div class="col-md-3">
                        <div class="stat-card resolved">
                            <h5>Resolved</h5>
                            <h2><?php echo $resolved_tickets; ?></h2>
                        </div>
                    </div>
                </div>

                <!-- Recent Tickets -->
                <div class="card mt-4">
                    <div class="card-header">
                        <h5 class="mb-0">Recent Tickets</h5>
                    </div>
                    <div class="card-body">
                        <div class="table-responsive">
                            <table class="table table-hover ticket-table">
                                <thead>
                                    <tr>
                                        <th>Ticket ID</th>
                                        <th>Subject</th>
                                        <th>Status</th>
                                        <th>Priority</th>
                                        <th>Created</th>
                                        <th>Actions</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <?php while ($ticket = mysqli_fetch_assoc($recent_tickets)): ?>
                                        <tr>
                                            <td><?php echo htmlspecialchars($ticket['ticket_id']); ?></td>
                                            <td><?php echo htmlspecialchars($ticket['subject']); ?></td>
                                            <td>
                                                <span class="badge 
                                                    <?php 
                                                    switch ($ticket['status']) {
                                                        case 'Open': echo 'bg-danger'; break;
                                                        case 'In Progress': echo 'bg-warning text-dark'; break;
                                                        case 'Resolved': echo 'bg-success'; break;
                                                        case 'Closed': echo 'bg-secondary'; break;
                                                    }
                                                    ?>">
                                                    <?php echo htmlspecialchars($ticket['status']); ?>
                                                </span>
                                            </td>
                                            <td><?php echo htmlspecialchars($ticket['priority']); ?></td>
                                            <td><?php echo date('M d, Y', strtotime($ticket['created_at'])); ?></td>
                                            <td>
                                                <a href="view-ticket.php?id=<?php echo $ticket['id']; ?>" class="btn btn-sm btn-outline-primary">
                                                    <i class="bi bi-eye"></i> View
                                                </a>
                                            </td>
                                        </tr>
                                    <?php endwhile; ?>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </main>
        </div>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>