diff --git a/app/Services/TenantBootstrap/RecipeRegistry.php b/app/Services/TenantBootstrap/RecipeRegistry.php index 9ca16eb..cef7992 100644 --- a/app/Services/TenantBootstrap/RecipeRegistry.php +++ b/app/Services/TenantBootstrap/RecipeRegistry.php @@ -2,6 +2,7 @@ namespace App\Services\TenantBootstrap; +use App\Services\TenantBootstrap\Steps\ApprovalFormsStep; use App\Services\TenantBootstrap\Steps\CapabilityProfilesStep; use App\Services\TenantBootstrap\Steps\CategoriesStep; use App\Services\TenantBootstrap\Steps\MenusStep; @@ -24,6 +25,7 @@ public function steps(string $recipe = 'STANDARD'): array new CategoriesStep, // new MenusStep, // Disabled: Use MenuBootstrapService in RegisterService instead new SettingsStep, + new ApprovalFormsStep, ], }; } diff --git a/app/Services/TenantBootstrap/Steps/ApprovalFormsStep.php b/app/Services/TenantBootstrap/Steps/ApprovalFormsStep.php new file mode 100644 index 0000000..5127e8e --- /dev/null +++ b/app/Services/TenantBootstrap/Steps/ApprovalFormsStep.php @@ -0,0 +1,105 @@ +hasTable('approval_forms')) { + return; + } + + $now = now(); + $forms = [ + [ + 'name' => '품의서', + 'code' => 'proposal', + 'category' => '일반', + 'template' => json_encode([ + 'fields' => [ + ['name' => 'title', 'type' => 'text', 'label' => '제목', 'required' => true], + ['name' => 'vendor', 'type' => 'text', 'label' => '거래처', 'required' => false], + ['name' => 'description', 'type' => 'textarea', 'label' => '내용', 'required' => true], + ['name' => 'reason', 'type' => 'textarea', 'label' => '사유', 'required' => true], + ['name' => 'estimatedCost', 'type' => 'number', 'label' => '예상비용', 'required' => false], + ], + ]), + ], + [ + 'name' => '지출결의서', + 'code' => 'expenseReport', + 'category' => '경비', + 'template' => json_encode([ + 'fields' => [ + ['name' => 'requestDate', 'type' => 'date', 'label' => '신청일', 'required' => true], + ['name' => 'paymentDate', 'type' => 'date', 'label' => '지급일', 'required' => true], + ['name' => 'items', 'type' => 'array', 'label' => '지출항목', 'required' => true], + ['name' => 'totalAmount', 'type' => 'number', 'label' => '총액', 'required' => true], + ], + ]), + ], + [ + 'name' => '비용견적서', + 'code' => 'expenseEstimate', + 'category' => '경비', + 'template' => json_encode([ + 'fields' => [ + ['name' => 'items', 'type' => 'array', 'label' => '비용항목', 'required' => true], + ['name' => 'totalExpense', 'type' => 'number', 'label' => '총지출', 'required' => true], + ['name' => 'accountBalance', 'type' => 'number', 'label' => '계좌잔액', 'required' => true], + ], + ]), + ], + [ + 'name' => '근태신청', + 'code' => 'attendance_request', + 'category' => '일반', + 'template' => json_encode([ + 'fields' => [ + ['name' => 'user_name', 'type' => 'text', 'label' => '신청자', 'required' => true], + ['name' => 'request_type', 'type' => 'select', 'label' => '신청유형', 'required' => true], + ['name' => 'period', 'type' => 'daterange', 'label' => '기간', 'required' => true], + ['name' => 'days', 'type' => 'number', 'label' => '일수', 'required' => true], + ['name' => 'reason', 'type' => 'textarea', 'label' => '사유', 'required' => true], + ], + ]), + ], + [ + 'name' => '사유서', + 'code' => 'reason_report', + 'category' => '일반', + 'template' => json_encode([ + 'fields' => [ + ['name' => 'user_name', 'type' => 'text', 'label' => '작성자', 'required' => true], + ['name' => 'report_type', 'type' => 'select', 'label' => '사유유형', 'required' => true], + ['name' => 'target_date', 'type' => 'date', 'label' => '대상일', 'required' => true], + ['name' => 'reason', 'type' => 'textarea', 'label' => '사유', 'required' => true], + ], + ]), + ], + ]; + + foreach ($forms as $form) { + DB::table('approval_forms')->updateOrInsert( + ['tenant_id' => $tenantId, 'code' => $form['code']], + [ + 'name' => $form['name'], + 'category' => $form['category'], + 'template' => $form['template'], + 'is_active' => true, + 'updated_at' => $now, + 'created_at' => $now, + ] + ); + } + } +}