From f79d4be8cdba71ad5e26de3ae7ffe6646be1ab76 Mon Sep 17 00:00:00 2001 From: Flatlogic Bot Date: Sun, 23 Nov 2025 19:48:03 +0000 Subject: [PATCH] Test1 --- assets/css/custom.css | 34 ++++ assets/js/main.js | 1 + db/migrations/001_initial_schema.sql | 22 ++ db/migrations/002_seed_data.sql | 21 ++ db/setup.php | 34 ++++ index.php | 288 ++++++++++++++------------- 6 files changed, 259 insertions(+), 141 deletions(-) create mode 100644 assets/css/custom.css create mode 100644 assets/js/main.js create mode 100644 db/migrations/001_initial_schema.sql create mode 100644 db/migrations/002_seed_data.sql create mode 100644 db/setup.php diff --git a/assets/css/custom.css b/assets/css/custom.css new file mode 100644 index 0000000..0d99773 --- /dev/null +++ b/assets/css/custom.css @@ -0,0 +1,34 @@ +@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap'); + +body { + font-family: 'Inter', sans-serif; + background-color: #f8f9fa; +} + +.navbar { + box-shadow: 0 2px 4px rgba(0,0,0,.04); +} + +.gradient-header { + background: linear-gradient(90deg, #0d6efd, #0dcaf0); + color: white; +} + +.task-card { + transition: all 0.2s ease-in-out; + border-left-width: 4px; +} + +.task-card:hover { + transform: translateY(-5px); + box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15); +} + +.border-high { border-left-color: #dc3545; } +.border-medium { border-left-color: #ffc107; } +.border-low { border-left-color: #0dcaf0; } + +.status-badge { + font-size: 0.8em; + font-weight: 600; +} diff --git a/assets/js/main.js b/assets/js/main.js new file mode 100644 index 0000000..24b6b1c --- /dev/null +++ b/assets/js/main.js @@ -0,0 +1 @@ +// Future JavaScript can go here. diff --git a/db/migrations/001_initial_schema.sql b/db/migrations/001_initial_schema.sql new file mode 100644 index 0000000..712bcff --- /dev/null +++ b/db/migrations/001_initial_schema.sql @@ -0,0 +1,22 @@ +CREATE TABLE IF NOT EXISTS `users` ( + `id` INT AUTO_INCREMENT PRIMARY KEY, + `username` VARCHAR(50) NOT NULL UNIQUE, + `password` VARCHAR(255) NOT NULL, + `role` ENUM('employee', 'manager', 'admin') NOT NULL, + `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +CREATE TABLE IF NOT EXISTS `tasks` ( + `id` INT AUTO_INCREMENT PRIMARY KEY, + `title` VARCHAR(255) NOT NULL, + `description` TEXT, + `status` ENUM('Not started', 'In progress', 'Blocked', 'Done') NOT NULL DEFAULT 'Not started', + `priority` ENUM('Low', 'Medium', 'High') NOT NULL DEFAULT 'Medium', + `assignee_id` INT, + `manager_id` INT, + `due_date` DATE, + `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + `updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + FOREIGN KEY (`assignee_id`) REFERENCES `users`(`id`) ON DELETE SET NULL, + FOREIGN KEY (`manager_id`) REFERENCES `users`(`id`) ON DELETE SET NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; diff --git a/db/migrations/002_seed_data.sql b/db/migrations/002_seed_data.sql new file mode 100644 index 0000000..6c212d9 --- /dev/null +++ b/db/migrations/002_seed_data.sql @@ -0,0 +1,21 @@ +-- Dummy password for all is 'password' +-- Hash: $2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi + +-- Clear existing data to make this script idempotent +DELETE FROM `tasks`; +DELETE FROM `users`; +ALTER TABLE `users` AUTO_INCREMENT = 1; +ALTER TABLE `tasks` AUTO_INCREMENT = 1; + + +INSERT INTO `users` (`username`, `password`, `role`) VALUES +('manager', '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', 'manager'), +('employee1', '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', 'employee'), +('employee2', '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', 'employee'); + +INSERT INTO `tasks` (`title`, `description`, `status`, `priority`, `assignee_id`, `manager_id`, `due_date`) VALUES +('Design the new dashboard UI', 'Create mockups in Figma based on the new branding guidelines.', 'In progress', 'High', 2, 1, '2025-12-15'), +('Develop the login page', 'Implement the front-end and back-end for the user login functionality.', 'Not started', 'High', 2, 1, '2025-12-10'), +('Fix the reporting bug', 'The monthly report is not generating correctly. Investigate and fix.', 'Blocked', 'Medium', 3, 1, '2025-12-05'), +('Write API documentation', 'Document all the endpoints for the new tasks API.', 'Done', 'Low', 3, 1, '2025-11-30'), +('Onboard new team members', 'Prepare onboarding materials and schedule introduction meetings.', 'Not started', 'Medium', 2, 1, '2025-12-20'); diff --git a/db/setup.php b/db/setup.php new file mode 100644 index 0000000..17dfa95 --- /dev/null +++ b/db/setup.php @@ -0,0 +1,34 @@ +exec($sql_schema); + error_log("Schema migration applied successfully."); + + // Run seed data + $sql_seed = file_get_contents(__DIR__ . '/migrations/002_seed_data.sql'); + if ($sql_seed === false) { + throw new Exception("Could not read seed file."); + } + $pdo->exec($sql_seed); + error_log("Data seeding applied successfully."); + + echo "Database setup complete!"; + +} catch (PDOException $e) { + http_response_code(500); + error_log("Database error: " . $e->getMessage()); + die("Database error: " . $e->getMessage()); +} catch (Exception $e) { + http_response_code(500); + error_log("Error: " . $e->getMessage()); + die("Error: " . $e->getMessage()); +} diff --git a/index.php b/index.php index 7205f3d..d33bc81 100644 --- a/index.php +++ b/index.php @@ -1,150 +1,156 @@ prepare( + 'SELECT id, title, status, priority, due_date FROM tasks WHERE assignee_id = ? ORDER BY due_date ASC' + ); + $stmt->execute([$employee_id]); + $tasks = $stmt->fetchAll(PDO::FETCH_ASSOC); + +} catch (Exception $e) { + // In a real app, you'd log this error. For now, we'll just display a message. + $error_message = "Error fetching tasks: " . $e->getMessage(); +} + +// --- Helper function for styling --- +function get_priority_border_class($priority) { + switch (strtolower($priority)) { + case 'high': return 'border-high'; + case 'medium': return 'border-medium'; + case 'low': return 'border-low'; + default: return 'border-secondary'; + } +} + +function get_status_badge_class($status) { + switch (strtolower($status)) { + case 'done': return 'bg-success'; + case 'in progress': return 'bg-primary'; + case 'blocked': return 'bg-warning text-dark'; + case 'not started': return 'bg-secondary'; + default: return 'bg-light text-dark'; + } +} ?> - + - - - New Style - - - - - - - - - - - - - - - - - - - + // --- End Flatlogic Meta Tags --- + ?> -
-
-

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

-
-
- + + + +
+
+

My Tasks

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

All caught up!

+

You have no pending tasks.

+
+ +
+ +
+
+
+
+
+
+ + Due: + +
+ + + +
+
+
+
+ +
+ + +
+ + + + + + + - + \ No newline at end of file