Test1
This commit is contained in:
parent
4b75df4191
commit
f79d4be8cd
34
assets/css/custom.css
Normal file
34
assets/css/custom.css
Normal file
@ -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;
|
||||
}
|
||||
1
assets/js/main.js
Normal file
1
assets/js/main.js
Normal file
@ -0,0 +1 @@
|
||||
// Future JavaScript can go here.
|
||||
22
db/migrations/001_initial_schema.sql
Normal file
22
db/migrations/001_initial_schema.sql
Normal file
@ -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;
|
||||
21
db/migrations/002_seed_data.sql
Normal file
21
db/migrations/002_seed_data.sql
Normal file
@ -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');
|
||||
34
db/setup.php
Normal file
34
db/setup.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/config.php';
|
||||
|
||||
try {
|
||||
$pdo = db();
|
||||
error_log("Database connection successful.");
|
||||
|
||||
// Run initial schema
|
||||
$sql_schema = file_get_contents(__DIR__ . '/migrations/001_initial_schema.sql');
|
||||
if ($sql_schema === false) {
|
||||
throw new Exception("Could not read schema file.");
|
||||
}
|
||||
$pdo->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());
|
||||
}
|
||||
286
index.php
286
index.php
@ -1,150 +1,156 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
@ini_set('display_errors', '1');
|
||||
@error_reporting(E_ALL);
|
||||
@date_default_timezone_set('UTC');
|
||||
require_once 'db/config.php';
|
||||
|
||||
$phpVersion = PHP_VERSION;
|
||||
$now = date('Y-m-d H:i:s');
|
||||
// --- Data Fetching ---
|
||||
$tasks = [];
|
||||
$error_message = '';
|
||||
try {
|
||||
$pdo = db();
|
||||
// For this first step, we hardcode the employee ID.
|
||||
// In the future, this will come from the logged-in user's session.
|
||||
$employee_id = 2;
|
||||
|
||||
$stmt = $pdo->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';
|
||||
}
|
||||
}
|
||||
?>
|
||||
<!doctype html>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>New Style</title>
|
||||
<?php
|
||||
// Read project preview data from environment
|
||||
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? '';
|
||||
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
|
||||
?>
|
||||
<?php if ($projectDescription): ?>
|
||||
<!-- Meta description -->
|
||||
<meta name="description" content='<?= htmlspecialchars($projectDescription) ?>' />
|
||||
<!-- Open Graph meta tags -->
|
||||
<meta property="og:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
||||
<!-- Twitter meta tags -->
|
||||
<meta property="twitter:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
||||
<?php endif; ?>
|
||||
<?php if ($projectImageUrl): ?>
|
||||
<!-- Open Graph image -->
|
||||
<meta property="og:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
||||
<!-- Twitter image -->
|
||||
<meta property="twitter:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
||||
<?php endif; ?>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
|
||||
<style>
|
||||
:root {
|
||||
--bg-color-start: #6a11cb;
|
||||
--bg-color-end: #2575fc;
|
||||
--text-color: #ffffff;
|
||||
--card-bg-color: rgba(255, 255, 255, 0.01);
|
||||
--card-border-color: rgba(255, 255, 255, 0.1);
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>My Tasks - Task Tracker</title>
|
||||
|
||||
<!-- Bootstrap 5 CSS -->
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<!-- Bootstrap Icons -->
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
||||
<!-- Custom CSS -->
|
||||
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||
|
||||
<?php
|
||||
// --- Flatlogic Meta Tags ---
|
||||
$project_image_url = isset($_SERVER['PROJECT_IMAGE_URL']) ? $_SERVER['PROJECT_IMAGE_URL'] : '';
|
||||
if ($project_image_url) {
|
||||
echo '<meta property="og:image" content="' . htmlspecialchars($project_image_url) . '">';
|
||||
echo '<meta name="twitter:image" content="' . htmlspecialchars($project_image_url) . '">';
|
||||
}
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: 'Inter', sans-serif;
|
||||
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end));
|
||||
color: var(--text-color);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
min-height: 100vh;
|
||||
text-align: center;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
}
|
||||
body::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><path d="M-10 10L110 10M10 -10L10 110" stroke-width="1" stroke="rgba(255,255,255,0.05)"/></svg>');
|
||||
animation: bg-pan 20s linear infinite;
|
||||
z-index: -1;
|
||||
}
|
||||
@keyframes bg-pan {
|
||||
0% { background-position: 0% 0%; }
|
||||
100% { background-position: 100% 100%; }
|
||||
}
|
||||
main {
|
||||
padding: 2rem;
|
||||
}
|
||||
.card {
|
||||
background: var(--card-bg-color);
|
||||
border: 1px solid var(--card-border-color);
|
||||
border-radius: 16px;
|
||||
padding: 2rem;
|
||||
backdrop-filter: blur(20px);
|
||||
-webkit-backdrop-filter: blur(20px);
|
||||
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
.loader {
|
||||
margin: 1.25rem auto 1.25rem;
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
border: 3px solid rgba(255, 255, 255, 0.25);
|
||||
border-top-color: #fff;
|
||||
border-radius: 50%;
|
||||
animation: spin 1s linear infinite;
|
||||
}
|
||||
@keyframes spin {
|
||||
from { transform: rotate(0deg); }
|
||||
to { transform: rotate(360deg); }
|
||||
}
|
||||
.hint {
|
||||
opacity: 0.9;
|
||||
}
|
||||
.sr-only {
|
||||
position: absolute;
|
||||
width: 1px; height: 1px;
|
||||
padding: 0; margin: -1px;
|
||||
overflow: hidden;
|
||||
clip: rect(0, 0, 0, 0);
|
||||
white-space: nowrap; border: 0;
|
||||
}
|
||||
h1 {
|
||||
font-size: 3rem;
|
||||
font-weight: 700;
|
||||
margin: 0 0 1rem;
|
||||
letter-spacing: -1px;
|
||||
}
|
||||
p {
|
||||
margin: 0.5rem 0;
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
code {
|
||||
background: rgba(0,0,0,0.2);
|
||||
padding: 2px 6px;
|
||||
border-radius: 4px;
|
||||
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
||||
}
|
||||
footer {
|
||||
position: absolute;
|
||||
bottom: 1rem;
|
||||
font-size: 0.8rem;
|
||||
opacity: 0.7;
|
||||
}
|
||||
</style>
|
||||
// --- End Flatlogic Meta Tags ---
|
||||
?>
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<div class="card">
|
||||
<h1>Analyzing your requirements and generating your website…</h1>
|
||||
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes">
|
||||
<span class="sr-only">Loading…</span>
|
||||
</div>
|
||||
<p class="hint"><?= ($_SERVER['HTTP_HOST'] ?? '') === 'appwizzy.com' ? 'AppWizzy' : 'Flatlogic' ?> AI is collecting your requirements and applying the first changes.</p>
|
||||
<p class="hint">This page will update automatically as the plan is implemented.</p>
|
||||
<p>Runtime: PHP <code><?= htmlspecialchars($phpVersion) ?></code> — UTC <code><?= htmlspecialchars($now) ?></code></p>
|
||||
</div>
|
||||
</main>
|
||||
<footer>
|
||||
Page updated: <?= htmlspecialchars($now) ?> (UTC)
|
||||
</footer>
|
||||
|
||||
<nav class="navbar navbar-expand-lg navbar-light bg-white sticky-top">
|
||||
<div class="container">
|
||||
<a class="navbar-brand fw-bold" href="#">
|
||||
<i class="bi bi-check2-square me-2"></i>TaskTracker
|
||||
</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarNav">
|
||||
<ul class="navbar-nav ms-auto">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" aria-current="page" href="#">My Tasks</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#">Dashboard</a>
|
||||
</li>
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
<i class="bi bi-person-circle me-1"></i> Employee1
|
||||
</a>
|
||||
<ul class="dropdown-menu" aria-labelledby="navbarDropdown">
|
||||
<li><a class="dropdown-item" href="#">Profile</a></li>
|
||||
<li><hr class="dropdown-divider"></li>
|
||||
<li><a class="dropdown-item" href="#">Logout</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<main class="container py-5">
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h1 class="h2">My Tasks</h1>
|
||||
<button class="btn btn-primary">
|
||||
<i class="bi bi-plus-lg me-1"></i> New Task
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<?php if ($error_message): ?>
|
||||
<div class="alert alert-danger">
|
||||
<?php echo htmlspecialchars($error_message); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (empty($tasks) && !$error_message): ?>
|
||||
<div class="text-center p-5 bg-light rounded">
|
||||
<i class="bi bi-check-all fs-1 text-success"></i>
|
||||
<h3 class="mt-3">All caught up!</h3>
|
||||
<p class="text-muted">You have no pending tasks.</p>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="row g-4">
|
||||
<?php foreach ($tasks as $task): ?>
|
||||
<div class="col-12">
|
||||
<div class="card task-card shadow-sm <?php echo get_priority_border_class($task['priority']); ?>">
|
||||
<div class="card-body">
|
||||
<div class="d-flex justify-content-between align-items-start">
|
||||
<div>
|
||||
<h5 class="card-title mb-1"><?php echo htmlspecialchars($task['title']); ?></h5>
|
||||
<small class="text-muted">
|
||||
Due: <?php echo htmlspecialchars(date('M d, Y', strtotime($task['due_date']))); ?>
|
||||
</small>
|
||||
</div>
|
||||
<span class="badge status-badge <?php echo get_status_badge_class($task['status']); ?>">
|
||||
<?php echo htmlspecialchars($task['status']); ?>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
</main>
|
||||
|
||||
<footer class="text-center py-4 text-muted border-top">
|
||||
© <?php echo date('Y'); ?> TaskTracker. All Rights Reserved.
|
||||
</footer>
|
||||
|
||||
<!-- Bootstrap 5 JS -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||
<!-- Custom JS -->
|
||||
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
x
Reference in New Issue
Block a user