feat: [demo-tenant] 프로모션 설정 기능 추가

- 생성 모달에 프로모션 섹션 추가 (개발비 할인/면제, 구독료 할인, 무료기간)
- Alpine.js 기반 슬라이더/토글 UI, 자동 비율 조절
- options JSON에 promotion 키로 프로모션 데이터 저장
- 상세 모달에 프로모션 조건 표시
This commit is contained in:
김보곤
2026-03-14 16:32:42 +09:00
parent 9ec944f3f7
commit 8bbf436a37
3 changed files with 269 additions and 2 deletions

View File

@@ -145,6 +145,13 @@ public function store(Request $request)
'email' => 'nullable|email|max:100',
'duration_days' => 'required|integer|min:7|max:60',
'preset' => 'nullable|string|in:manufacturing,none',
'promo_dev_type' => 'nullable|string|in:percent,amount',
'promo_dev_percent' => 'nullable|integer|min:0|max:50',
'promo_dev_amount' => 'nullable|integer|min:0|max:5000000',
'promo_dev_waive' => 'nullable|in:0,1',
'promo_sub_percent' => 'nullable|integer|min:0|max:50',
'promo_free_months' => 'nullable|integer|in:0,1,2,3,6',
'promo_note' => 'nullable|string|max:200',
]);
$partner = SalesPartner::where('user_id', auth()->id())->first();
@@ -158,6 +165,21 @@ public function store(Request $request)
'created_by_user_name' => auth()->user()->name ?? '',
];
// 프로모션 설정
if ($request->filled('promo_dev_type')) {
$options['promotion'] = [
'dev_discount_type' => $request->input('promo_dev_type'),
'dev_discount_percent' => (int) $request->input('promo_dev_percent', 0),
'dev_discount_amount' => (int) $request->input('promo_dev_amount', 0),
'dev_waive' => $request->input('promo_dev_waive') === '1',
'sub_discount_percent' => (int) $request->input('promo_sub_percent', 0),
'free_months' => (int) $request->input('promo_free_months', 0),
'note' => $request->input('promo_note', ''),
'applied_at' => now()->toDateTimeString(),
'applied_by_user_id' => auth()->id(),
];
}
$tenant = new Tenant;
$tenant->forceFill([
'company_name' => $request->input('company_name'),