From 6e6843fd677e5fd3e8436b71c90c4195e78444ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9C=A0=EB=B3=91=EC=B2=A0?= Date: Mon, 16 Mar 2026 09:37:38 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20[approval]=20=EA=B7=BC=ED=83=9C?= =?UTF-8?q?=EC=8B=A0=EC=B2=AD=C2=B7=EC=82=AC=EC=9C=A0=EC=84=9C=20=EC=96=91?= =?UTF-8?q?=EC=8B=9D=EC=97=90=20select=20options=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 근태신청: 신청유형에 휴가/출장/재택근무/외근 옵션 - 사유서: 사유유형에 지각/조퇴/결근/외출/기타 옵션 - 기존 테넌트 데이터 마이그레이션 포함 Co-Authored-By: Claude Opus 4.6 (1M context) --- .../Steps/ApprovalFormsStep.php | 4 +- ...ate_attendance_approval_form_templates.php | 84 +++++++++++++++++++ 2 files changed, 86 insertions(+), 2 deletions(-) create mode 100644 database/migrations/2026_03_16_100000_update_attendance_approval_form_templates.php diff --git a/app/Services/TenantBootstrap/Steps/ApprovalFormsStep.php b/app/Services/TenantBootstrap/Steps/ApprovalFormsStep.php index 5127e8e..0cc6e9e 100644 --- a/app/Services/TenantBootstrap/Steps/ApprovalFormsStep.php +++ b/app/Services/TenantBootstrap/Steps/ApprovalFormsStep.php @@ -66,7 +66,7 @@ public function run(int $tenantId): void 'template' => json_encode([ 'fields' => [ ['name' => 'user_name', 'type' => 'text', 'label' => '신청자', 'required' => true], - ['name' => 'request_type', 'type' => 'select', 'label' => '신청유형', 'required' => true], + ['name' => 'request_type', 'type' => 'select', 'label' => '신청유형', 'required' => true, 'options' => ['휴가', '출장', '재택근무', '외근']], ['name' => 'period', 'type' => 'daterange', 'label' => '기간', 'required' => true], ['name' => 'days', 'type' => 'number', 'label' => '일수', 'required' => true], ['name' => 'reason', 'type' => 'textarea', 'label' => '사유', 'required' => true], @@ -80,7 +80,7 @@ public function run(int $tenantId): void 'template' => json_encode([ 'fields' => [ ['name' => 'user_name', 'type' => 'text', 'label' => '작성자', 'required' => true], - ['name' => 'report_type', 'type' => 'select', 'label' => '사유유형', 'required' => true], + ['name' => 'report_type', 'type' => 'select', 'label' => '사유유형', 'required' => true, 'options' => ['지각', '조퇴', '결근', '외출', '기타']], ['name' => 'target_date', 'type' => 'date', 'label' => '대상일', 'required' => true], ['name' => 'reason', 'type' => 'textarea', 'label' => '사유', 'required' => true], ], diff --git a/database/migrations/2026_03_16_100000_update_attendance_approval_form_templates.php b/database/migrations/2026_03_16_100000_update_attendance_approval_form_templates.php new file mode 100644 index 0000000..acd7c5e --- /dev/null +++ b/database/migrations/2026_03_16_100000_update_attendance_approval_form_templates.php @@ -0,0 +1,84 @@ + [ + ['name' => 'user_name', 'type' => 'text', 'label' => '신청자', 'required' => true], + ['name' => 'request_type', 'type' => 'select', 'label' => '신청유형', 'required' => true, 'options' => ['휴가', '출장', '재택근무', '외근']], + ['name' => 'period', 'type' => 'daterange', 'label' => '기간', 'required' => true], + ['name' => 'days', 'type' => 'number', 'label' => '일수', 'required' => true], + ['name' => 'reason', 'type' => 'textarea', 'label' => '사유', 'required' => true], + ], + ], JSON_UNESCAPED_UNICODE); + + // 사유서: select 타입 + options 추가 + $reasonTemplate = json_encode([ + 'fields' => [ + ['name' => 'user_name', 'type' => 'text', 'label' => '작성자', 'required' => true], + ['name' => 'report_type', 'type' => 'select', 'label' => '사유유형', 'required' => true, 'options' => ['지각', '조퇴', '결근', '외출', '기타']], + ['name' => 'target_date', 'type' => 'date', 'label' => '대상일', 'required' => true], + ['name' => 'reason', 'type' => 'textarea', 'label' => '사유', 'required' => true], + ], + ], JSON_UNESCAPED_UNICODE); + + // 모든 테넌트의 근태신청 양식 업데이트 + DB::table('approval_forms') + ->where('code', 'attendance_request') + ->update([ + 'template' => $attendanceTemplate, + 'updated_at' => now(), + ]); + + // 모든 테넌트의 사유서 양식 업데이트 + DB::table('approval_forms') + ->where('code', 'reason_report') + ->update([ + 'template' => $reasonTemplate, + 'updated_at' => now(), + ]); + } + + public function down(): void + { + // 원래 text 타입으로 복원 + $attendanceTemplate = json_encode([ + 'fields' => [ + ['name' => 'user_name', 'type' => 'text', 'label' => '신청자'], + ['name' => 'request_type', 'type' => 'text', 'label' => '신청유형'], + ['name' => 'period', 'type' => 'text', 'label' => '기간'], + ['name' => 'days', 'type' => 'number', 'label' => '일수'], + ['name' => 'reason', 'type' => 'text', 'label' => '사유'], + ], + ], JSON_UNESCAPED_UNICODE); + + $reasonTemplate = json_encode([ + 'fields' => [ + ['name' => 'user_name', 'type' => 'text', 'label' => '신청자'], + ['name' => 'report_type', 'type' => 'text', 'label' => '사유서유형'], + ['name' => 'target_date', 'type' => 'date', 'label' => '대상일'], + ['name' => 'reason', 'type' => 'text', 'label' => '사유'], + ], + ], JSON_UNESCAPED_UNICODE); + + DB::table('approval_forms') + ->where('code', 'attendance_request') + ->update([ + 'template' => $attendanceTemplate, + 'updated_at' => now(), + ]); + + DB::table('approval_forms') + ->where('code', 'reason_report') + ->update([ + 'template' => $reasonTemplate, + 'updated_at' => now(), + ]); + } +};