feat: [approval] 근태신청·사유서 양식에 select options 추가

- 근태신청: 신청유형에 휴가/출장/재택근무/외근 옵션
- 사유서: 사유유형에 지각/조퇴/결근/외출/기타 옵션
- 기존 테넌트 데이터 마이그레이션 포함

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
유병철
2026-03-16 09:37:38 +09:00
parent d8560d889c
commit 6e6843fd67
2 changed files with 86 additions and 2 deletions

View File

@@ -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],
],

View File

@@ -0,0 +1,84 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
return new class extends Migration
{
public function up(): void
{
// 근태신청: select 타입 + options 추가
$attendanceTemplate = json_encode([
'fields' => [
['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(),
]);
}
};