Hubs
+Hub management will be implemented here.
+diff --git a/assets/css/custom.css b/assets/css/custom.css new file mode 100644 index 0000000..8d9585b --- /dev/null +++ b/assets/css/custom.css @@ -0,0 +1,195 @@ + +/* General Body Styles */ +body { + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; + background-color: #f8f9fa; + margin: 0; + display: flex; + height: 100vh; + color: #333; +} + +/* Sidebar Styles */ +.sidebar { + width: 260px; + background-color: #800020; /* Burgundy */ + color: #fff; + display: flex; + flex-direction: column; + padding: 20px; +} + +.sidebar h2 { + margin: 0 0 30px 0; + font-size: 24px; + text-align: center; +} + +.sidebar nav ul { + list-style: none; + padding: 0; + margin: 0; +} + +.sidebar nav li { + margin-bottom: 10px; +} + +.sidebar nav a { + color: #fff; + text-decoration: none; + display: block; + padding: 12px 15px; + border-radius: 4px; + transition: background-color 0.3s; +} + +.sidebar nav li.active a, +.sidebar nav a:hover { + background-color: #a00028; /* Darker Burgundy */ +} + +.logout-area { + margin-top: auto; +} + +.logout-area a { + display: block; + padding: 12px 15px; + background-color: #600018; + color: #fff; + text-align: center; + text-decoration: none; + border-radius: 4px; + transition: background-color 0.3s; +} + +.logout-area a:hover { + background-color: #500014; +} + +/* Main Content Styles */ +.main-content { + flex-grow: 1; + display: flex; + flex-direction: column; + overflow-y: auto; +} + +.main-content header { + padding: 20px 40px; + background-color: #fff; + border-bottom: 1px solid #e9ecef; +} + +.main-content header h1 { + margin: 0; + font-size: 28px; + font-weight: 600; +} + +.main-content main { + padding: 40px; + flex-grow: 1; +} + +/* Dashboard Cards */ +.cards-container { + display: grid; + grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); + gap: 30px; +} + +.card { + background-color: #fff; + padding: 25px; + border-radius: 8px; + box-shadow: 0 4px 12px rgba(0,0,0,0.05); + transition: transform 0.2s, box-shadow 0.2s; +} + +.card:hover { + transform: translateY(-5px); + box-shadow: 0 8px 20px rgba(0,0,0,0.08); +} + +.card h3 { + margin: 0 0 10px 0; + font-size: 18px; + color: #555; +} + +.card p { + margin: 0; + font-size: 36px; + font-weight: 600; + color: #800020; /* Burgundy */ +} + +/* Login Page Specific Styles */ +.login-body { + background-color: #f5f5f5; + display: flex; + justify-content: center; + align-items: center; + height: 100vh; +} + +.login-container { + background-color: #fff; + padding: 40px; + border-radius: 8px; + box-shadow: 0 4px 10px rgba(0,0,0,0.1); + text-align: center; + max-width: 400px; + width: 100%; +} + +.login-container h2 { + margin-top: 0; + font-size: 24px; + color: #333; +} + +.login-container p { + color: #666; + margin-bottom: 30px; +} + +.login-container .form-group { + margin-bottom: 20px; + text-align: left; +} + +.login-container label { + display: block; + margin-bottom: 5px; + font-weight: 600; + color: #333; +} + +.login-container input[type="text"], +.login-container input[type="password"] { + width: 100%; + padding: 10px; + border: 1px solid #ddd; + border-radius: 4px; + box-sizing: border-box; +} + +.login-container button { + width: 100%; + padding: 12px; + background-color: #800020; /* Burgundy */ + color: #fff; + border: none; + border-radius: 4px; + cursor: pointer; + font-size: 16px; + font-weight: 600; + transition: background-color 0.3s; +} + +.login-container button:hover { + background-color: #a00028; /* Darker Burgundy */ +} diff --git a/assets/pasted-20251012-111458-24ba26de.png b/assets/pasted-20251012-111458-24ba26de.png new file mode 100644 index 0000000..e84cee0 Binary files /dev/null and b/assets/pasted-20251012-111458-24ba26de.png differ diff --git a/db/config.php b/db/config.php index bb98f7d..ea122f8 100644 --- a/db/config.php +++ b/db/config.php @@ -7,11 +7,39 @@ define('DB_PASS', 'e45f2778-db1f-450c-99c6-29efb4601472'); function db() { static $pdo; - if (!$pdo) { + if ($pdo) { + return $pdo; + } + + try { + // Connect with DB name $pdo = new PDO('mysql:host='.DB_HOST.';dbname='.DB_NAME.';charset=utf8mb4', DB_USER, DB_PASS, [ PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, ]); + } catch (PDOException $e) { + // If database doesn't exist, create it + if ($e->getCode() === 1049) { // SQLSTATE[HY000] [1049] Unknown database + try { + $tempPdo = new PDO('mysql:host='.DB_HOST, DB_USER, DB_PASS, [ + PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, + ]); + $tempPdo->exec('CREATE DATABASE IF NOT EXISTS `'.DB_NAME.'` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); + + // Reconnect with the new database + $pdo = new PDO('mysql:host='.DB_HOST.';dbname='.DB_NAME.';charset=utf8mb4', DB_USER, DB_PASS, [ + PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, + PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, + ]); + } catch (PDOException $ce) { + // If creation fails, die + die('Failed to create database: ' . $ce->getMessage()); + } + } else { + // For other errors, die + die('DB Connection failed: ' . $e->getMessage()); + } } + return $pdo; } diff --git a/db/migrate.php b/db/migrate.php new file mode 100644 index 0000000..68b9ef3 --- /dev/null +++ b/db/migrate.php @@ -0,0 +1,43 @@ +exec($sql); + echo "Table 'users' created successfully.\n"; + + // New users + $users = [ + ['Admin', 'admin', 'password123', 'Admin'], + ['Rumaiz', 'rumaiz', 'Rumaiz4556', 'Manager'], + ['Nadeeni', 'nadeeni', 'Nadz1234', 'Manager'], + ['Kaveesh', 'kaveesh', 'Kaveesh123', 'Staff'], + ['Sarani', 'sarani', 'Sarani789', 'Staff'], + ['Nazeeha', 'nazeeha', 'Nazeeha1234', 'Staff'], + ['Thiwanka', 'thiwanka', 'Thiwanka567', 'Staff'], + ['Customer Service', 'customerservice', 'Coho2646', 'Staff'], + ['Siranjeewan', 'siranjeewan', 'Siranjeewan123', 'Rider'], + ['Rozan', 'rozan', 'Rozan123', 'Rider'], + ['Coho Rider', 'cohorider', 'Coho123456', 'Rider'], + ]; + + $stmt = $pdo->prepare( + 'INSERT INTO users (full_name, username, password, role) VALUES (?, ?, ?, ?)' + ); + + foreach ($users as $user) { + $fullName = $user[0]; + $username = $user[1]; + $password = password_hash($user[2], PASSWORD_DEFAULT); + $role = $user[3]; + $stmt->execute([$fullName, $username, $password, $role]); + } + + echo "Users inserted successfully.\n"; + echo "Migration completed successfully.\n"; + +} catch (PDOException $e) { + die("Migration failed: " . $e->getMessage() . "\n"); +} \ No newline at end of file diff --git a/db/migrations/001_create_users_table.sql b/db/migrations/001_create_users_table.sql new file mode 100644 index 0000000..9986d12 --- /dev/null +++ b/db/migrations/001_create_users_table.sql @@ -0,0 +1,12 @@ +DROP TABLE IF EXISTS users; + +CREATE TABLE IF NOT EXISTS users ( + id INT AUTO_INCREMENT PRIMARY KEY, + full_name VARCHAR(255) NOT NULL, + username VARCHAR(255) NOT NULL UNIQUE, + password VARCHAR(255) NOT NULL, + role ENUM('Admin', 'Manager', 'Staff', 'Dispatcher', 'Rider', 'Viewer') NOT NULL, + is_active BOOLEAN DEFAULT TRUE, + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + last_login TIMESTAMP NULL +); \ No newline at end of file diff --git a/hubs.php b/hubs.php new file mode 100644 index 0000000..fc75317 --- /dev/null +++ b/hubs.php @@ -0,0 +1,50 @@ + + + +
+ + +Hub management will be implemented here.
+= ($_SERVER['HTTP_HOST'] ?? '') === 'appwizzy.com' ? 'AppWizzy' : 'Flatlogic' ?> AI is collecting your requirements and applying the first changes.
-This page will update automatically as the plan is implemented.
-Runtime: PHP = htmlspecialchars($phpVersion) ?> — UTC = htmlspecialchars($now) ?>
0
+0
+0
+0
+Please sign in to continue
+ + + + + + +Order management will be implemented here.
+Report generation will be implemented here.
+Rider management will be implemented here.
+Staff management will be implemented here.
+