added labour
This commit is contained in:
parent
9f57c8b8b4
commit
a2a711f887
120
assets/css/custom.css
Normal file
120
assets/css/custom.css
Normal file
@ -0,0 +1,120 @@
|
||||
body {
|
||||
background-color: #f8fafc;
|
||||
font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
||||
color: #0f172a;
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
|
||||
.navbar {
|
||||
background-color: #ffffff;
|
||||
border-bottom: 1px solid #e2e8f0;
|
||||
padding: 0.75rem 1.5rem;
|
||||
}
|
||||
|
||||
.navbar-brand {
|
||||
font-weight: 700;
|
||||
color: #0f172a;
|
||||
letter-spacing: -0.025em;
|
||||
}
|
||||
|
||||
.nav-link {
|
||||
color: #475569;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.nav-link:hover {
|
||||
color: #3b82f6;
|
||||
}
|
||||
|
||||
.dropdown-menu {
|
||||
border: 1px solid #e2e8f0;
|
||||
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
|
||||
border-radius: 0.375rem;
|
||||
padding: 0.5rem;
|
||||
}
|
||||
|
||||
.dropdown-item {
|
||||
border-radius: 0.25rem;
|
||||
padding: 0.5rem 0.75rem;
|
||||
color: #475569;
|
||||
}
|
||||
|
||||
.dropdown-item:hover {
|
||||
background-color: #f1f5f9;
|
||||
color: #3b82f6;
|
||||
}
|
||||
|
||||
.card {
|
||||
background-color: #ffffff;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 0.375rem;
|
||||
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
.card-header {
|
||||
background-color: #ffffff;
|
||||
border-bottom: 1px solid #e2e8f0;
|
||||
padding: 1rem 1.5rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
background-color: #3b82f6;
|
||||
border-color: #3b82f6;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.btn-primary:hover {
|
||||
background-color: #2563eb;
|
||||
border-color: #2563eb;
|
||||
}
|
||||
|
||||
.table {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.table th {
|
||||
background-color: #f8fafc;
|
||||
color: #64748b;
|
||||
text-transform: uppercase;
|
||||
font-size: 0.75rem;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.05em;
|
||||
padding: 0.75rem 1.5rem;
|
||||
border-top: none;
|
||||
}
|
||||
|
||||
.table td {
|
||||
padding: 1rem 1.5rem;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.status-badge {
|
||||
padding: 0.25rem 0.5rem;
|
||||
border-radius: 9999px;
|
||||
font-size: 0.75rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.status-active { background-color: #dcfce7; color: #166534; }
|
||||
.status-on-hold { background-color: #fef9c3; color: #854d0e; }
|
||||
.status-completed { background-color: #dbeafe; color: #1e40af; }
|
||||
|
||||
.activity-feed {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.activity-item {
|
||||
padding: 0.75rem 0;
|
||||
border-bottom: 1px solid #f1f5f9;
|
||||
}
|
||||
|
||||
.activity-item:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.activity-time {
|
||||
font-size: 0.75rem;
|
||||
color: #94a3b8;
|
||||
}
|
||||
43
db/migrations/001_initial_schema.sql
Normal file
43
db/migrations/001_initial_schema.sql
Normal file
@ -0,0 +1,43 @@
|
||||
-- Initial Schema for SR&ED Manager
|
||||
CREATE TABLE IF NOT EXISTS tenants (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
name VARCHAR(255) NOT NULL,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS users (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
tenant_id INT,
|
||||
name VARCHAR(255) NOT NULL,
|
||||
email VARCHAR(255) UNIQUE NOT NULL,
|
||||
role ENUM('global_admin', 'tenant_admin', 'staff') DEFAULT 'staff',
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (tenant_id) REFERENCES tenants(id) ON DELETE SET NULL
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS projects (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
tenant_id INT NOT NULL,
|
||||
name VARCHAR(255) NOT NULL,
|
||||
code VARCHAR(50) NOT NULL,
|
||||
status ENUM('active', 'completed', 'on_hold') DEFAULT 'active',
|
||||
start_date DATE,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (tenant_id) REFERENCES tenants(id) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS activity_log (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
tenant_id INT NOT NULL,
|
||||
user_id INT,
|
||||
action VARCHAR(255) NOT NULL,
|
||||
details TEXT,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (tenant_id) REFERENCES tenants(id) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
-- Seed Initial Demo Data
|
||||
INSERT IGNORE INTO tenants (id, name) VALUES (1, 'Acme Research Corp');
|
||||
INSERT IGNORE INTO users (id, tenant_id, name, email, role) VALUES (1, 1, 'John Manager', 'john@acme.com', 'tenant_admin');
|
||||
INSERT IGNORE INTO projects (tenant_id, name, code, start_date) VALUES (1, 'Project Alpha: Quantum AI', 'PA-001', '2025-01-01');
|
||||
INSERT IGNORE INTO activity_log (tenant_id, user_id, action, details) VALUES (1, 1, 'System Setup', 'Initial tenant environment created.');
|
||||
74
db/migrations/002_labour_module.sql
Normal file
74
db/migrations/002_labour_module.sql
Normal file
@ -0,0 +1,74 @@
|
||||
-- Migration for Labour Module and Centralized Attachments
|
||||
|
||||
-- Table for Employees
|
||||
CREATE TABLE IF NOT EXISTS employees (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
tenant_id INT NOT NULL,
|
||||
name VARCHAR(255) NOT NULL,
|
||||
email VARCHAR(255),
|
||||
position VARCHAR(255),
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (tenant_id) REFERENCES tenants(id) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
-- Table for Labour Types (e.g., Experimental Development, Technical Support)
|
||||
CREATE TABLE IF NOT EXISTS labour_types (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
tenant_id INT NOT NULL,
|
||||
name VARCHAR(255) NOT NULL,
|
||||
FOREIGN KEY (tenant_id) REFERENCES tenants(id) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
-- Table for Objective Evidence Types (e.g., Logbooks, Test Results, Design Docs)
|
||||
CREATE TABLE IF NOT EXISTS evidence_types (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
tenant_id INT NOT NULL,
|
||||
name VARCHAR(255) NOT NULL,
|
||||
FOREIGN KEY (tenant_id) REFERENCES tenants(id) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
-- Table for Labour Entries
|
||||
CREATE TABLE IF NOT EXISTS labour_entries (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
tenant_id INT NOT NULL,
|
||||
project_id INT NOT NULL,
|
||||
employee_id INT NOT NULL,
|
||||
entry_date DATE NOT NULL,
|
||||
hours DECIMAL(10, 2) NOT NULL,
|
||||
labour_type_id INT,
|
||||
evidence_type_id INT,
|
||||
notes TEXT,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (tenant_id) REFERENCES tenants(id) ON DELETE CASCADE,
|
||||
FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE,
|
||||
FOREIGN KEY (employee_id) REFERENCES employees(id) ON DELETE CASCADE,
|
||||
FOREIGN KEY (labour_type_id) REFERENCES labour_types(id) ON DELETE SET NULL,
|
||||
FOREIGN KEY (evidence_type_id) REFERENCES evidence_types(id) ON DELETE SET NULL
|
||||
);
|
||||
|
||||
-- Centralized Attachments Table
|
||||
CREATE TABLE IF NOT EXISTS attachments (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
tenant_id INT NOT NULL,
|
||||
entity_type VARCHAR(50) NOT NULL, -- 'labour_entry', 'project', 'expense', etc.
|
||||
entity_id INT NOT NULL,
|
||||
file_name VARCHAR(255) NOT NULL,
|
||||
file_path VARCHAR(255) NOT NULL,
|
||||
file_size INT,
|
||||
mime_type VARCHAR(100),
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (tenant_id) REFERENCES tenants(id) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
-- Seed some initial settings for the demo tenant
|
||||
INSERT IGNORE INTO employees (tenant_id, name, position) VALUES (1, 'Alice Smith', 'Lead Researcher');
|
||||
INSERT IGNORE INTO employees (tenant_id, name, position) VALUES (1, 'Bob Jones', 'Developer');
|
||||
|
||||
INSERT IGNORE INTO labour_types (tenant_id, name) VALUES (1, 'Experimental Development');
|
||||
INSERT IGNORE INTO labour_types (tenant_id, name) VALUES (1, 'Technical Support');
|
||||
INSERT IGNORE INTO labour_types (tenant_id, name) VALUES (1, 'Technical Planning');
|
||||
|
||||
INSERT IGNORE INTO evidence_types (tenant_id, name) VALUES (1, 'Logbooks');
|
||||
INSERT IGNORE INTO evidence_types (tenant_id, name) VALUES (1, 'Test Results');
|
||||
INSERT IGNORE INTO evidence_types (tenant_id, name) VALUES (1, 'Design Documents');
|
||||
INSERT IGNORE INTO evidence_types (tenant_id, name) VALUES (1, 'Source Code Commits');
|
||||
513
index.php
513
index.php
@ -1,150 +1,387 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
@ini_set('display_errors', '1');
|
||||
@error_reporting(E_ALL);
|
||||
@date_default_timezone_set('UTC');
|
||||
require_once __DIR__ . '/db/config.php';
|
||||
|
||||
$phpVersion = PHP_VERSION;
|
||||
$now = date('Y-m-d H:i:s');
|
||||
// Simulate Tenant Context (Hardcoded for demo)
|
||||
$tenant_id = 1;
|
||||
|
||||
// Handle Add Project
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['add_project'])) {
|
||||
$name = $_POST['name'] ?? '';
|
||||
$code = $_POST['code'] ?? '';
|
||||
$start_date = $_POST['start_date'] ?? date('Y-m-d');
|
||||
|
||||
if ($name && $code) {
|
||||
$stmt = db()->prepare("INSERT INTO projects (tenant_id, name, code, start_date) VALUES (?, ?, ?, ?)");
|
||||
$stmt->execute([$tenant_id, $name, $code, $start_date]);
|
||||
|
||||
// Log Activity
|
||||
$stmt = db()->prepare("INSERT INTO activity_log (tenant_id, action, details) VALUES (?, ?, ?)");
|
||||
$stmt->execute([$tenant_id, 'Project Created', "Added project: $name ($code)"]);
|
||||
|
||||
header("Location: index.php?success=1");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
// Handle Add Labour
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['add_labour'])) {
|
||||
$project_id = (int)($_POST['project_id'] ?? 0);
|
||||
$employee_id = (int)($_POST['employee_id'] ?? 0);
|
||||
$entry_date = $_POST['entry_date'] ?? date('Y-m-d');
|
||||
$hours = (float)($_POST['hours'] ?? 0);
|
||||
$labour_type_id = (int)($_POST['labour_type_id'] ?? 0);
|
||||
$evidence_type_id = (int)($_POST['evidence_type_id'] ?? 0);
|
||||
$notes = $_POST['notes'] ?? '';
|
||||
|
||||
if ($project_id && $employee_id && $hours > 0) {
|
||||
$stmt = db()->prepare("INSERT INTO labour_entries (tenant_id, project_id, employee_id, entry_date, hours, labour_type_id, evidence_type_id, notes) VALUES (?, ?, ?, ?, ?, ?, ?, ?)");
|
||||
$stmt->execute([$tenant_id, $project_id, $employee_id, $entry_date, $hours, $labour_type_id, $evidence_type_id, $notes]);
|
||||
$labour_entry_id = (int)db()->lastInsertId();
|
||||
|
||||
// Handle File Uploads
|
||||
if (!empty($_FILES['attachments']['name'][0])) {
|
||||
foreach ($_FILES['attachments']['tmp_name'] as $key => $tmp_name) {
|
||||
$file_name = $_FILES['attachments']['name'][$key];
|
||||
$file_size = $_FILES['attachments']['size'][$key];
|
||||
$mime_type = $_FILES['attachments']['type'][$key];
|
||||
$file_ext = pathinfo($file_name, PATHINFO_EXTENSION);
|
||||
$new_file_name = uniqid() . '.' . $file_ext;
|
||||
$file_path = 'uploads/' . $new_file_name;
|
||||
|
||||
if (move_uploaded_file($tmp_name, $file_path)) {
|
||||
$stmt = db()->prepare("INSERT INTO attachments (tenant_id, entity_type, entity_id, file_name, file_path, file_size, mime_type) VALUES (?, 'labour_entry', ?, ?, ?, ?, ?)");
|
||||
$stmt->execute([$tenant_id, $labour_entry_id, $file_name, $file_path, $file_size, $mime_type]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Log Activity
|
||||
$stmt = db()->prepare("INSERT INTO activity_log (tenant_id, action, details) VALUES (?, ?, ?)");
|
||||
$stmt->execute([$tenant_id, 'Labour Added', "Logged $hours hours for employee ID $employee_id"]);
|
||||
|
||||
header("Location: index.php?success=labour");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
// Fetch Data
|
||||
$projects = db()->prepare("SELECT * FROM projects WHERE tenant_id = ? ORDER BY created_at DESC");
|
||||
$projects->execute([$tenant_id]);
|
||||
$projectList = $projects->fetchAll();
|
||||
|
||||
$employees = db()->prepare("SELECT * FROM employees WHERE tenant_id = ? ORDER BY name");
|
||||
$employees->execute([$tenant_id]);
|
||||
$employeeList = $employees->fetchAll();
|
||||
|
||||
$labourTypes = db()->prepare("SELECT * FROM labour_types WHERE tenant_id = ? ORDER BY name");
|
||||
$labourTypes->execute([$tenant_id]);
|
||||
$labourTypeList = $labourTypes->fetchAll();
|
||||
|
||||
$evidenceTypes = db()->prepare("SELECT * FROM evidence_types WHERE tenant_id = ? ORDER BY name");
|
||||
$evidenceTypes->execute([$tenant_id]);
|
||||
$evidenceTypeList = $evidenceTypes->fetchAll();
|
||||
|
||||
$labourEntries = db()->prepare("
|
||||
SELECT le.*, p.name as project_name, e.name as employee_name, lt.name as labour_type, et.name as evidence_type
|
||||
FROM labour_entries le
|
||||
JOIN projects p ON le.project_id = p.id
|
||||
JOIN employees e ON le.employee_id = e.id
|
||||
LEFT JOIN labour_types lt ON le.labour_type_id = lt.id
|
||||
LEFT JOIN evidence_types et ON le.evidence_type_id = et.id
|
||||
WHERE le.tenant_id = ?
|
||||
ORDER BY le.entry_date DESC, le.created_at DESC
|
||||
");
|
||||
$labourEntries->execute([$tenant_id]);
|
||||
$labourList = $labourEntries->fetchAll();
|
||||
|
||||
$activities = db()->prepare("SELECT * FROM activity_log WHERE tenant_id = ? ORDER BY created_at DESC LIMIT 10");
|
||||
$activities->execute([$tenant_id]);
|
||||
$activityList = $activities->fetchAll();
|
||||
|
||||
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? 'SR&ED Project Tracking Software';
|
||||
?>
|
||||
<!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);
|
||||
}
|
||||
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>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>SR&ED Manager - Dashboard</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
||||
<link href="assets/css/custom.css?v=<?= time() ?>" rel="stylesheet">
|
||||
</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>
|
||||
|
||||
<nav class="navbar navbar-expand-lg sticky-top">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="index.php">SR&ED MANAGER</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarNav">
|
||||
<ul class="navbar-nav me-auto">
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown">Projects</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a class="dropdown-item" href="#" data-bs-toggle="modal" data-bs-target="#addProjectModal">Add Project</a></li>
|
||||
<li><a class="dropdown-item" href="index.php">List Projects</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown">Labour</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a class="dropdown-item" href="#" data-bs-toggle="modal" data-bs-target="#addLabourModal">Add Labour</a></li>
|
||||
<li><a class="dropdown-item" href="#labour-section">List Labour</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown">Expenses</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a class="dropdown-item" href="#">Add Expense</a></li>
|
||||
<li><a class="dropdown-item" href="#">List Expenses</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown">Users</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a class="dropdown-item" href="#">Employees</a></li>
|
||||
<li><a class="dropdown-item" href="#">Roles</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown">Reports</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a class="dropdown-item" href="#">Labour Summary</a></li>
|
||||
<li><a class="dropdown-item" href="#">Project Expenses</a></li>
|
||||
<li><a class="dropdown-item" href="#">SR&ED Claim Export</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="d-flex align-items-center text-muted small">
|
||||
<span class="me-3">Tenant: <strong>Acme Research</strong></span>
|
||||
<span class="badge bg-light text-dark border">Global Admin</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
<footer>
|
||||
Page updated: <?= htmlspecialchars($now) ?> (UTC)
|
||||
</footer>
|
||||
</nav>
|
||||
|
||||
<div class="container-fluid py-4">
|
||||
<div class="row">
|
||||
<!-- Main Content -->
|
||||
<div class="col-lg-9">
|
||||
<?php if (isset($_GET['success'])): ?>
|
||||
<div class="alert alert-success alert-dismissible fade show border-0 shadow-sm mb-4" role="alert">
|
||||
<?= $_GET['success'] === 'labour' ? 'Labour entry successfully saved.' : 'Project successfully added to the tracker.' ?>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="card mb-4">
|
||||
<div class="card-header d-flex justify-content-between align-items-center">
|
||||
<span>Active Projects</span>
|
||||
<button class="btn btn-sm btn-primary" data-bs-toggle="modal" data-bs-target="#addProjectModal">+ New Project</button>
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table align-middle">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Project Name</th>
|
||||
<th>Code</th>
|
||||
<th>Start Date</th>
|
||||
<th>Status</th>
|
||||
<th class="text-end">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($projectList as $p): ?>
|
||||
<tr>
|
||||
<td><strong><?= htmlspecialchars($p['name']) ?></strong></td>
|
||||
<td><code class="text-primary"><?= htmlspecialchars($p['code']) ?></code></td>
|
||||
<td><?= $p['start_date'] ?></td>
|
||||
<td><span class="status-badge status-<?= $p['status'] ?>"><?= ucfirst($p['status']) ?></span></td>
|
||||
<td class="text-end">
|
||||
<button class="btn btn-sm btn-outline-secondary">Edit</button>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php if (empty($projectList)): ?>
|
||||
<tr><td colspan="5" class="text-center py-5 text-muted">No projects found. Start by adding one.</td></tr>
|
||||
<?php endif; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card mb-4" id="labour-section">
|
||||
<div class="card-header d-flex justify-content-between align-items-center">
|
||||
<span>Recent Labour Entries</span>
|
||||
<button class="btn btn-sm btn-primary" data-bs-toggle="modal" data-bs-target="#addLabourModal">+ Add Labour</button>
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table align-middle">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Employee</th>
|
||||
<th>Project</th>
|
||||
<th>Hours</th>
|
||||
<th>Type / Evidence</th>
|
||||
<th class="text-end">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($labourList as $l): ?>
|
||||
<tr>
|
||||
<td><?= $l['entry_date'] ?></td>
|
||||
<td><strong><?= htmlspecialchars($l['employee_name']) ?></strong></td>
|
||||
<td><?= htmlspecialchars($l['project_name']) ?></td>
|
||||
<td><span class="badge bg-light text-primary border"><?= number_format((float)$l['hours'], 2) ?> h</span></td>
|
||||
<td>
|
||||
<div class="small fw-bold"><?= htmlspecialchars($l['labour_type'] ?? 'N/A') ?></div>
|
||||
<div class="extra-small text-muted"><?= htmlspecialchars($l['evidence_type'] ?? 'N/A') ?></div>
|
||||
</td>
|
||||
<td class="text-end">
|
||||
<button class="btn btn-sm btn-outline-secondary">Details</button>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php if (empty($labourList)): ?>
|
||||
<tr><td colspan="6" class="text-center py-5 text-muted">No labour entries found.</td></tr>
|
||||
<?php endif; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Activity Hub -->
|
||||
<div class="col-lg-3">
|
||||
<div class="card">
|
||||
<div class="card-header">Activity Hub</div>
|
||||
<div class="card-body p-3">
|
||||
<ul class="activity-feed">
|
||||
<?php foreach ($activityList as $a): ?>
|
||||
<li class="activity-item">
|
||||
<div class="fw-bold small"><?= htmlspecialchars($a['action']) ?></div>
|
||||
<div class="text-muted extra-small" style="font-size: 0.8rem;"><?= htmlspecialchars($a['details']) ?></div>
|
||||
<div class="activity-time mt-1"><?= date('M d, H:i', strtotime($a['created_at'])) ?></div>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Add Project Modal -->
|
||||
<div class="modal fade" id="addProjectModal" tabindex="-1">
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-content border-0">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title fw-bold">Add New Project</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
||||
</div>
|
||||
<form method="POST">
|
||||
<div class="modal-body">
|
||||
<div class="mb-3">
|
||||
<label class="form-label small fw-bold">Project Name</label>
|
||||
<input type="text" name="name" class="form-control" placeholder="e.g. AI Optimization" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label small fw-bold">Project Code</label>
|
||||
<input type="text" name="code" class="form-control" placeholder="SR-2025-01" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label small fw-bold">Start Date</label>
|
||||
<input type="date" name="start_date" class="form-control" value="<?= date('Y-m-d') ?>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer border-0">
|
||||
<button type="button" class="btn btn-light" data-bs-dismiss="modal">Cancel</button>
|
||||
<button type="submit" name="add_project" class="btn btn-primary px-4">Create Project</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Add Labour Modal -->
|
||||
<div class="modal fade" id="addLabourModal" tabindex="-1">
|
||||
<div class="modal-dialog modal-lg modal-dialog-centered">
|
||||
<div class="modal-content border-0">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title fw-bold">Add Labour Tracking</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
||||
</div>
|
||||
<form method="POST" enctype="multipart/form-data">
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<div class="col-md-6 mb-3">
|
||||
<label class="form-label small fw-bold">Project</label>
|
||||
<select name="project_id" class="form-select" required>
|
||||
<option value="">Select Project...</option>
|
||||
<?php foreach ($projectList as $p): ?>
|
||||
<option value="<?= $p['id'] ?>"><?= htmlspecialchars($p['name']) ?> (<?= htmlspecialchars($p['code']) ?>)</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
<label class="form-label small fw-bold">Employee</label>
|
||||
<select name="employee_id" class="form-select" required>
|
||||
<option value="">Select Employee...</option>
|
||||
<?php foreach ($employeeList as $e): ?>
|
||||
<option value="<?= $e['id'] ?>"><?= htmlspecialchars($e['name']) ?> (<?= htmlspecialchars($e['position']) ?>)</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
<label class="form-label small fw-bold">Date</label>
|
||||
<input type="date" name="entry_date" class="form-control" value="<?= date('Y-m-d') ?>" required>
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
<label class="form-label small fw-bold">Time (Hours)</label>
|
||||
<input type="number" name="hours" class="form-control" step="0.25" min="0.25" placeholder="e.g. 7.5" required>
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
<label class="form-label small fw-bold">Type of Labour</label>
|
||||
<select name="labour_type_id" class="form-select">
|
||||
<option value="">Select Type...</option>
|
||||
<?php foreach ($labourTypeList as $lt): ?>
|
||||
<option value="<?= $lt['id'] ?>"><?= htmlspecialchars($lt['name']) ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
<label class="form-label small fw-bold">Objective Evidence</label>
|
||||
<select name="evidence_type_id" class="form-select">
|
||||
<option value="">Select Evidence Type...</option>
|
||||
<?php foreach ($evidenceTypeList as $et): ?>
|
||||
<option value="<?= $et['id'] ?>"><?= htmlspecialchars($et['name']) ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-12 mb-3">
|
||||
<label class="form-label small fw-bold">Attachments</label>
|
||||
<input type="file" name="attachments[]" class="form-control" multiple>
|
||||
<div class="extra-small text-muted mt-1">Upload relevant evidence (logs, photos, docs).</div>
|
||||
</div>
|
||||
<div class="col-12 mb-3">
|
||||
<label class="form-label small fw-bold">Comments / Notes</label>
|
||||
<textarea name="notes" class="form-control" rows="3" placeholder="Briefly describe the work done..."></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer border-0">
|
||||
<button type="button" class="btn btn-light" data-bs-dismiss="modal">Cancel</button>
|
||||
<button type="submit" name="add_labour" class="btn btn-primary px-4">Save Labour Entry</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user