# Phase 4: Tasks & Scheduling - Implementation Plan

## Goal

Implement the operational nervous system of the facility: Task Templates (SOPs), Scheduling (Recurring & One-off), and Execution (Staff Workflow), as defined in `specs/tasks-and-scheduling.md`.

## 🏃 Sprint 1: Task Templates (Standard Operating Procedures)

**Objective**: Allow Head Grower to define how work should be done.

- **Backend**:
  - `TaskTemplatesController`: CRUD for templates.
  - Support "Room Type" association (e.g. "Veg" templates only show for Veg rooms).
- **Frontend**:
  - **SOP Manager**: Library view of all task templates.
  - **Template Creator**: Form to define title, instructions, materials, and recurrence defaults.

## 🏃 Sprint 2: Scheduling & Assignment

**Objective**: Assign work to Rooms and Batches.

- **Backend**:
  - `TasksController`: Create tasks from templates.
  - Logic to inherit properties (Batch ID, Room ID) when a task is created in context.
- **Frontend**:
  - **Quick Task**: "Add Task" button on Batches and Rooms.
  - **Task Calendar**: View upcoming work.

## 🏃 Sprint 3: Staff Execution ("My Tasks")

**Objective**: The daily workflow for growers.

- **Frontend**:
  - **Today's Tasks UI**: High-visibility list of work due today.
  - **Task Filter**: "My Tasks" vs "All Tasks".
  - **Completion Flow**: Mark complete, add notes, upload photo.

---

## Technical Dependencies

- Existing `Task` and `TaskTemplate` Prisma models are ready.
- Need to ensure `batchId` and `roomId` are correctly propagated.
