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(), + ]); + } +};