runPending(); $database = database(); if ($resetExisting) { $database->execute('DELETE FROM activity_log'); $database->execute('DELETE FROM tasks'); $database->execute('DELETE FROM project_members'); $database->execute('DELETE FROM projects'); } $projects = [ [ 'name' => 'Atlas Portfolio Rollout', 'client_name' => 'Atlas Financial', 'description' => 'A multi-quarter portfolio site refresh with content migration, editorial workflow, and KPI reporting.', 'status' => 'active', 'start_date' => '2026-02-10', 'due_date' => '2026-06-30', 'budget_cents' => 1450000, 'owner_name' => 'Maya Chen', 'color_token' => 'teal', 'members_text' => "Maya Chen\nJordan Ellis\nPriya Singh", 'tasks' => [ ['title' => 'Finalize content inventory', 'description' => 'Audit all portfolio assets and map old URLs to the new structure.', 'status' => 'done', 'priority' => 'high', 'assignee' => 'Maya Chen', 'estimate_hours' => 12, 'due_date' => '2026-03-05'], ['title' => 'Build editorial review queue', 'description' => 'Create approvals and publish scheduling for content editors.', 'status' => 'in-progress', 'priority' => 'urgent', 'assignee' => 'Jordan Ellis', 'estimate_hours' => 28, 'due_date' => '2026-05-18'], ['title' => 'Launch executive dashboard', 'description' => 'Surface conversion, retention, and campaign metrics for leadership.', 'status' => 'review', 'priority' => 'high', 'assignee' => 'Priya Singh', 'estimate_hours' => 24, 'due_date' => '2026-05-22'], ['title' => 'Prepare stakeholder training', 'description' => 'Document the content workflow and publish timeline for the business team.', 'status' => 'backlog', 'priority' => 'normal', 'assignee' => 'Maya Chen', 'estimate_hours' => 10, 'due_date' => '2026-06-05'], ], ], [ 'name' => 'Northstar Launch Pad', 'client_name' => 'Northstar Logistics', 'description' => 'A cross-department launch program covering operations, onboarding, and service readiness.', 'status' => 'at-risk', 'start_date' => '2026-03-01', 'due_date' => '2026-05-28', 'budget_cents' => 980000, 'owner_name' => 'Diego Flores', 'color_token' => 'amber', 'members_text' => "Diego Flores\nAvery Brooks\nNina Patel", 'tasks' => [ ['title' => 'Resolve deployment blocker', 'description' => 'Investigate the shipping API timeout and document the fix.', 'status' => 'blocked', 'priority' => 'urgent', 'assignee' => 'Avery Brooks', 'estimate_hours' => 16, 'due_date' => '2026-05-10'], ['title' => 'Coordinate ops handoff', 'description' => 'Align training, support, and fulfillment teams before launch.', 'status' => 'in-progress', 'priority' => 'high', 'assignee' => 'Diego Flores', 'estimate_hours' => 18, 'due_date' => '2026-05-19'], ['title' => 'Validate onboarding scripts', 'description' => 'Check each script against the latest workflow and signoff notes.', 'status' => 'backlog', 'priority' => 'normal', 'assignee' => 'Nina Patel', 'estimate_hours' => 8, 'due_date' => '2026-05-21'], ], ], [ 'name' => 'Studio Systems Upgrade', 'client_name' => 'Bluebird Studios', 'description' => 'An internal tooling rebuild that unifies scheduling, budgeting, and show reporting.', 'status' => 'planned', 'start_date' => '2026-04-15', 'due_date' => '2026-08-01', 'budget_cents' => 650000, 'owner_name' => 'Elena Rossi', 'color_token' => 'violet', 'members_text' => "Elena Rossi\nSam Walker", 'tasks' => [ ['title' => 'Map legacy workflows', 'description' => 'Document existing scheduling and finance handoffs.', 'status' => 'backlog', 'priority' => 'normal', 'assignee' => 'Elena Rossi', 'estimate_hours' => 9, 'due_date' => '2026-05-30'], ['title' => 'Define reporting schema', 'description' => 'Outline the data that finance and production teams need.', 'status' => 'backlog', 'priority' => 'high', 'assignee' => 'Sam Walker', 'estimate_hours' => 14, 'due_date' => '2026-06-10'], ], ], [ 'name' => 'Summit Care Portal', 'client_name' => 'Summit Health', 'description' => 'A patient-facing portal modernization with secure messaging and appointment flow improvements.', 'status' => 'paused', 'start_date' => '2026-01-12', 'due_date' => '2026-07-15', 'budget_cents' => 2100000, 'owner_name' => 'Ari Johnson', 'color_token' => 'blue', 'members_text' => "Ari Johnson\nTaylor Nguyen\nRita Gomez", 'tasks' => [ ['title' => 'Stabilize auth workflow', 'description' => 'Review the sign-in edge cases before resuming development.', 'status' => 'done', 'priority' => 'high', 'assignee' => 'Ari Johnson', 'estimate_hours' => 20, 'due_date' => '2026-03-28'], ['title' => 'Resume design review', 'description' => 'Pick up the paused UX feedback from the accessibility team.', 'status' => 'blocked', 'priority' => 'normal', 'assignee' => 'Taylor Nguyen', 'estimate_hours' => 6, 'due_date' => '2026-06-01'], ], ], ]; $projectRepo = new ProjectRepository($database); $taskRepo = new TaskRepository($database); $activityRepo = new ActivityRepository($database); foreach (array_slice($projects, 0, $projectTotal) as $project) { $projectId = $projectRepo->create([ 'name' => $project['name'], 'code' => '', 'client_name' => $project['client_name'], 'description' => $project['description'], 'status' => $project['status'], 'start_date' => $project['start_date'], 'due_date' => $project['due_date'], 'budget_cents' => $project['budget_cents'], 'owner_name' => $project['owner_name'], 'color_token' => $project['color_token'], 'members' => array_map( static function (string $name, int $index): array { return [ 'full_name' => $name, 'role' => $index === 0 ? 'Project Lead' : 'Contributor', 'allocation_percent' => $index === 0 ? 40 : 20, ]; }, preg_split('/[\r\n]+/', $project['members_text']) ?: [], array_keys(preg_split('/[\r\n]+/', $project['members_text']) ?: []) ), ]); foreach ($project['tasks'] as $task) { $taskId = $taskRepo->create($projectId, $task); $activityRepo->record( 'task_seeded', 'Seeded task ' . $task['title'], 'Sample project data loaded for the dashboard.', $projectId, $taskId ); } } } if (PHP_SAPI === 'cli' && realpath($_SERVER['SCRIPT_FILENAME'] ?? '') === __FILE__) { $count = isset($argv[1]) ? max(1, (int) $argv[1]) : 6; seed_projects($count, in_array('--reset', $argv, true)); }