feat: 작업 관리 시스템 및 TBM 공정/작업 통합

## Backend Changes
- Create tasks table with work_type_id FK to work_types
- Add taskModel, taskController, taskRoutes for task CRUD
- Update tbmModel to support work_type_id and task_id
- Add migrations for tasks table and TBM integration

## Frontend Changes
- Create task management admin page (tasks.html, task-management.js)
- Update TBM modal to include work type (공정) and task (작업) selection
- Add cascading dropdown: work type → task selection
- Display work type and task info in TBM session cards
- Update sidebar navigation in all admin pages

## Database Schema
- tasks: task_id, work_type_id, task_name, description, is_active
- tbm_sessions: add work_type_id, task_id columns with FKs
- Foreign keys maintain referential integrity with work_types and tasks

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Hyungi Ahn
2026-01-26 15:06:43 +09:00
parent 9c636bf6ad
commit 7acb835c39
15 changed files with 1157 additions and 3 deletions

View File

@@ -10,15 +10,17 @@ const TbmModel = {
createSession: (sessionData, callback) => {
const sql = `
INSERT INTO tbm_sessions
(session_date, leader_id, project_id, work_location, work_description,
safety_notes, start_time, created_by)
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
(session_date, leader_id, project_id, work_type_id, task_id, work_location,
work_description, safety_notes, start_time, created_by)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
`;
const values = [
sessionData.session_date,
sessionData.leader_id,
sessionData.project_id,
sessionData.work_type_id,
sessionData.task_id,
sessionData.work_location,
sessionData.work_description,
sessionData.safety_notes,
@@ -40,11 +42,16 @@ const TbmModel = {
w.job_type as leader_job_type,
p.project_name,
p.job_no,
wt.name as work_type_name,
wt.category as work_type_category,
t.task_name,
u.username as created_by_username,
COUNT(DISTINCT ta.worker_id) as team_member_count
FROM tbm_sessions s
LEFT JOIN workers w ON s.leader_id = w.worker_id
LEFT JOIN projects p ON s.project_id = p.project_id
LEFT JOIN work_types wt ON s.work_type_id = wt.id
LEFT JOIN tasks t ON s.task_id = t.task_id
LEFT JOIN users u ON s.created_by = u.user_id
LEFT JOIN tbm_team_assignments ta ON s.session_id = ta.session_id
WHERE s.session_date = ?
@@ -68,11 +75,17 @@ const TbmModel = {
p.project_name,
p.job_no,
p.site,
wt.name as work_type_name,
wt.category as work_type_category,
t.task_name,
t.description as task_description,
u.username as created_by_username,
u.name as created_by_name
FROM tbm_sessions s
LEFT JOIN workers w ON s.leader_id = w.worker_id
LEFT JOIN projects p ON s.project_id = p.project_id
LEFT JOIN work_types wt ON s.work_type_id = wt.id
LEFT JOIN tasks t ON s.task_id = t.task_id
LEFT JOIN users u ON s.created_by = u.user_id
WHERE s.session_id = ?
`;