Files
alla-tms/plans/change-training-type-options.md
2026-07-16 09:53:14 +07:00

3.4 KiB

You are a Senior Full Stack Engineer.

Project: Training Management System (TMS)

Current task: Update Training Type options in Create/Edit Training Record form.

Requirement: Change the training type dropdown options to the approved list below.

New Training Type options:

  1. อบรมภายใน (Internal Training)
  2. อบรมภายนอก (Public Training)
  3. e-Learning / Online Course
  4. On the Job Training (OJT)

Important constraints:

  • Do NOT change folder structure.
  • Do NOT migrate ORM unless absolutely necessary.
  • Do NOT break existing training records.
  • Keep Thai UI.
  • Keep responsive/mobile behavior.
  • Minimal-impact changes only.

Implementation rules:

  1. Update training type options used in:
  • Create Training Record form
  • Edit Training Record form
  • Training Record Detail
  • HRD Review page
  • Training Record table
  • Reports export if training type is displayed
  • Filter dropdown if training type filter exists
  1. Internal values should stay in English-friendly constants.

Recommended internal values:

  • INTERNAL_TRAINING
  • EXTERNAL_TRAINING
  • ONLINE_COURSE
  • OJT

Display labels:

  • อบรมภายใน (Internal Training)
  • อบรมภายนอก (Public Training)
  • e-Learning / Online Course
  • On the Job Training (OJT)
  1. Backward compatibility:

If old values exist in database, map them safely:

Old value -> New display/value:

  • INTERNAL -> INTERNAL_TRAINING
  • EXTERNAL -> EXTERNAL_TRAINING
  • ONLINE -> ONLINE_COURSE
  • ONSITE -> EXTERNAL_TRAINING or keep display as "อบรมภายนอก (Public Training)" unless business rule says otherwise

Do not break old records.

  1. Validation:

Update Zod schema to allow only the new training type values.

If old records are edited:

  • normalize old value to new value before saving if appropriate.

Thai validation message:

  • กรุณาเลือกประเภทการอบรม
  1. Files likely involved:
  • src/features/training-records/constants/training-record-options.ts
  • src/features/training-records/schemas/training-record.ts
  • src/features/training-records/components/training-record-form.tsx
  • src/features/training-records/components/training-record-view-page.tsx
  • src/features/training-records/components/training-record-review-page.tsx
  • src/features/training-records/components/training-record-tables/columns.tsx
  • src/constants/thai-labels.ts
  • src/features/reports/server/report-data.ts
  • src/app/api/training-records/route.ts
  • src/app/api/training-records/[id]/route.ts
  1. Output Review File

Create: docs/management-change-training-type-options-review.md

Include:

  1. Summary
  2. Files Changed
  3. Training Type Options Updated
  4. Backward Compatibility Mapping
  5. Validation Rules
  6. UI Changes
  7. Report/Filter Impact
  8. Manual Test Checklist
  9. Known Limitations

Manual Test Checklist:

  • Create form shows only 4 new training type options.
  • Edit form shows only 4 new training type options.
  • Training detail displays Thai/English label correctly.
  • HRD review displays training type correctly.
  • Training table displays training type correctly.
  • Reports display training type correctly.
  • Old INTERNAL value still displays safely.
  • Old EXTERNAL value still displays safely.
  • Old ONLINE value maps to e-Learning / Online Course.
  • Old ONSITE value maps safely.
  • Validation blocks empty training type.
  • Mobile dropdown works.

Return:

  • Complete code changes with file paths.
  • Content of docs/management-change-training-type-options-review.md.