@extends('layouts.dashboard') @section('title', 'Proj Mgr - Task List Templates') @section('content') @php $priorityOrder = ['urgent' => 0, 'high' => 1, 'medium' => 2, 'low' => 3]; // Tree for "Add Existing Tasks" picker: Project -> Task List -> Tasks $treeData = []; foreach ($projects as $proj) { $projNode = ['id' => $proj->id, 'name' => $proj->name, 'lists' => []]; $sortedLists = $proj->taskLists->sortBy('name'); foreach ($sortedLists as $list) { $listNode = ['id' => $list->id, 'name' => $list->name, 'tasks' => []]; $sortedTasks = $list->tasks->sortBy([ fn($t) => $priorityOrder[$t->priority ?? 'medium'] ?? 2, fn($t) => strtolower($t->title ?? ''), ]); foreach ($sortedTasks as $task) { $listNode['tasks'][] = [ 'id' => $task->id, 'title' => $task->title ?? '', 'description' => $task->description ?? '', 'priority' => $task->priority ?? 'medium', 'estimated_hours' => $task->estimated_hours ?? '', 'task_type' => $task->task_type ?? 'general', 'status' => $task->task_status ?? 'pending', 'projectName' => $proj->name, 'listName' => $list->name, ]; } if (!empty($listNode['tasks'])) { $projNode['lists'][] = $listNode; } } if (!empty($projNode['lists'])) { $treeData[] = $projNode; } } usort($treeData, fn($a, $b) => strcasecmp($a['name'], $b['name'])); @endphp
Create templates to quickly scaffold task lists with predefined tasks and structure.
{{ $template->description }}
@endif