Files
GSB-Construction/docs/PLAN.md
2026-05-25 17:39:57 +08:00

2.4 KiB

PLAN - Task Milestone Tagging

Tag tasks with their specific project milestone to track alignment and timelines.

Proposed Changes

Database Layer

[NEW] 2026_05_25_164000_add_milestone_id_to_tasks_table.php

  • Create a new migration to add nullable milestone_id to tasks referencing project_milestones(id) with nullOnDelete().

Backend Models & Relations

[MODIFY] Task.php

  • Add milestone_id to fillable attributes list.
  • Define milestone(): BelongsTo relationship pointing to ProjectMilestone.

[MODIFY] ProjectMilestone.php

  • Define tasks(): HasMany relationship pointing to Task.

Backend Controllers

[MODIFY] TaskController.php

  • index: Load 'milestones' on $project and 'milestone' on project tasks.
  • store: Validate and resolve optional milestone_id (via ProjectMilestone::resolveUlidToId) before task creation.
  • update: Validate and resolve optional milestone_id on task update.

Frontend Components

[MODIFY] Index.tsx

  • Add milestone_id to taskForm state.
  • Render milestone dropdown in the "Add Task" dialog.
  • Display milestone badge under the task name in table view.
  • Display milestone in Task Details Dialog grid.

[MODIFY] KanbanBoard.tsx

  • Render milestone badge on the kanban card.

[MODIFY] Show.tsx

  • Add milestone_id to taskForm state.
  • Render milestone dropdown in "Add Task" modal.
  • Display milestone badge under task name in table.

Verification Plan

Automated Tests

  • Run migration: php artisan migrate
  • Verify tests in TaskManagement.

Manual Verification

  • Access /tasks?project=<ulid>.
  • Add a new task, select a milestone, and verify the badge appears on the board, in details, and table list.