Files
alla-tms/docs/training-record-draft-feature-report.md
2026-07-16 09:53:14 +07:00

1.5 KiB

Training Record Draft Feature Report

Summary

Implemented the draft workflow for training records based on the existing training-records feature pattern.

Key behavior now supported:

  • Employees can save a training record as draft
  • Employees can edit their own records only when status is draft or needs_revision
  • Submitting a record moves it to pending
  • HRD review can return a record as needs_revision
  • The pending review queue is hard-scoped to pending records only

Main Changes

  • Added draft to the approval_status enum in Drizzle schema
  • Generated migration drizzle/0014_sweet_nico_minoru.sql
  • Extended training-record API types and UI label maps to include draft
  • Added submissionMode handling for create/update flows
  • Reset previous review data when a returned record is re-submitted
  • Switched employee edit permission from pending to draft | needs_revision
  • Updated pending-review pages to always query only pending records
  • Updated summary typing in overview and employee-directory to handle the new status safely

Decisions

  • draft is a real persisted status, not a client-only flag
  • needs_revision is reused as the returned-for-revision state
  • Draft records are excluded from the HRD pending-review queue
  • Draft hours are not counted into review-progress summaries that previously reflected submitted/reviewed work

Verification

  • npm run gen
  • npm run lint
  • npm run build

All three completed successfully after the implementation updates.