Dashboard

New Customer Application

Your dashboard is ready. From here you can manage customer applications.

Submitted Applications
' : ' '; } return ''; } function getStatusBadgeClass($status) { switch ($status) { case 'pending_approval': return 'bg-warning'; case 'approved': return 'bg-success'; case 'rejected': return 'bg-danger'; case 'reverted': return 'bg-info'; case 'draft': default: return 'bg-secondary'; } } $sort_column = $_GET['sort'] ?? 'created_at'; $sort_order = $_GET['order'] ?? 'DESC'; $valid_columns = ['id', 'application_id', 'company_name', 'status', 'created_at']; if (!in_array($sort_column, $valid_columns)) { $sort_column = 'created_at'; } $status_filter = $_GET['status'] ?? ''; $sql = "SELECT id, application_id, company_name, status, created_at FROM customer_applications"; $params = []; if ($status_filter) { $sql .= " WHERE status = ?"; $params[] = $status_filter; } $sql .= " ORDER BY $sort_column $sort_order"; $stmt = $pdo->prepare($sql); $stmt->execute($params); $applications = $stmt->fetchAll(PDO::FETCH_ASSOC); if (count($applications) > 0) { echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; foreach ($applications as $app) { $badgeClass = getStatusBadgeClass($app['status']); echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; } echo ''; echo '
Application ID' . getSortIcon('application_id', $sort_column, $sort_order) . 'Company Name' . getSortIcon('company_name', $sort_column, $sort_order) . 'Status' . getSortIcon('status', $sort_column, $sort_order) . 'Date Submitted' . getSortIcon('created_at', $sort_column, $sort_order) . '
' . htmlspecialchars($app['application_id']) . '' . htmlspecialchars($app['company_name']) . '' . htmlspecialchars(ucfirst(str_replace('_', ' ', $app['status']))) . '' . htmlspecialchars(date("Y-m-d H:i", strtotime($app['created_at']))) . '
'; } else { echo '

No customer applications found.

'; } } catch (PDOException $e) { echo '
Error: Could not fetch applications.
'; // Optional: log error to a file // error_log($e->getMessage()); } ?>