From 45a207d4a8201aa839681f0736b130c453c340db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B6=8C=ED=98=81=EC=84=B1?= Date: Mon, 9 Mar 2026 21:06:10 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20[=EA=B2=B0=EC=9E=AC]=20=ED=85=8C?= =?UTF-8?q?=EB=84=8C=ED=8A=B8=20=EB=B6=80=ED=8A=B8=EC=8A=A4=ED=8A=B8?= =?UTF-8?q?=EB=9E=A9=EC=97=90=20=EA=B8=B0=EB=B3=B8=20=EA=B2=B0=EC=9E=AC=20?= =?UTF-8?q?=EC=96=91=EC=8B=9D=20=EC=9E=90=EB=8F=99=20=EC=8B=9C=EB=94=A9=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - ApprovalFormsStep 신규 생성 (proposal, expenseReport, expenseEstimate, attendance_request, reason_report) - RecipeRegistry STANDARD 레시피에 등록 - 테넌트 생성 시 TenantObserver → TenantBootstrapper로 자동 실행 - 기존 테넌트는 php artisan tenants:bootstrap --all로 적용 Co-Authored-By: Claude Opus 4.6 --- .../TenantBootstrap/RecipeRegistry.php | 2 + .../Steps/ApprovalFormsStep.php | 105 ++++++++++++++++++ 2 files changed, 107 insertions(+) create mode 100644 app/Services/TenantBootstrap/Steps/ApprovalFormsStep.php 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, + ] + ); + } + } +}