feat: [document] 범용 블록 빌더 Phase 1 구현
- block-editor.blade.php: 3패널 UI (Palette + Canvas + Properties) - Alpine.js blockEditor() 컴포넌트 (CRUD, Undo/Redo, SortableJS) - 기본 Block 6종: heading, paragraph, table, columns, divider, spacer - 폼 필드 Block 7종: text, number, date, select, checkbox, textarea, signature - BlockRendererService: JSON → HTML 렌더링 서비스 - 컨트롤러 분기: builder_type = 'block' → 블록 빌더 뷰 - 라우트 추가: block-create, block-edit - API store/update에 schema JSON 처리 추가 - index 페이지에 블록 빌더 진입 버튼 추가 - 목록에 builder_type 뱃지 표시
This commit is contained in:
@@ -127,6 +127,7 @@ public function store(Request $request): JsonResponse
|
||||
$validated = $request->validate([
|
||||
'name' => 'required|string|max:100',
|
||||
'category' => 'nullable|string|max:50',
|
||||
'builder_type' => 'nullable|string|in:legacy,block',
|
||||
'title' => 'nullable|string|max:200',
|
||||
'company_name' => 'nullable|string|max:100',
|
||||
'company_address' => 'nullable|string|max:255',
|
||||
@@ -134,6 +135,8 @@ public function store(Request $request): JsonResponse
|
||||
'footer_remark_label' => 'nullable|string|max:50',
|
||||
'footer_judgement_label' => 'nullable|string|max:50',
|
||||
'footer_judgement_options' => 'nullable|array',
|
||||
'schema' => 'nullable|array',
|
||||
'page_config' => 'nullable|array',
|
||||
'is_active' => 'boolean',
|
||||
'linked_item_ids' => 'nullable|array',
|
||||
'linked_item_ids.*' => 'integer',
|
||||
@@ -162,6 +165,7 @@ public function store(Request $request): JsonResponse
|
||||
'tenant_id' => session('selected_tenant_id'),
|
||||
'name' => $validated['name'],
|
||||
'category' => $validated['category'] ?? null,
|
||||
'builder_type' => $validated['builder_type'] ?? 'legacy',
|
||||
'title' => $validated['title'] ?? null,
|
||||
'company_name' => $validated['company_name'] ?? '경동기업',
|
||||
'company_address' => $validated['company_address'] ?? null,
|
||||
@@ -169,6 +173,8 @@ public function store(Request $request): JsonResponse
|
||||
'footer_remark_label' => $validated['footer_remark_label'] ?? '부적합 내용',
|
||||
'footer_judgement_label' => $validated['footer_judgement_label'] ?? '종합판정',
|
||||
'footer_judgement_options' => $validated['footer_judgement_options'] ?? ['적합', '부적합'],
|
||||
'schema' => $validated['schema'] ?? null,
|
||||
'page_config' => $validated['page_config'] ?? null,
|
||||
'is_active' => $validated['is_active'] ?? true,
|
||||
'linked_item_ids' => $validated['linked_item_ids'] ?? null,
|
||||
'linked_process_id' => $validated['linked_process_id'] ?? null,
|
||||
@@ -204,6 +210,7 @@ public function update(Request $request, int $id): JsonResponse
|
||||
$validated = $request->validate([
|
||||
'name' => 'required|string|max:100',
|
||||
'category' => 'nullable|string|max:50',
|
||||
'builder_type' => 'nullable|string|in:legacy,block',
|
||||
'title' => 'nullable|string|max:200',
|
||||
'company_name' => 'nullable|string|max:100',
|
||||
'company_address' => 'nullable|string|max:255',
|
||||
@@ -211,6 +218,8 @@ public function update(Request $request, int $id): JsonResponse
|
||||
'footer_remark_label' => 'nullable|string|max:50',
|
||||
'footer_judgement_label' => 'nullable|string|max:50',
|
||||
'footer_judgement_options' => 'nullable|array',
|
||||
'schema' => 'nullable|array',
|
||||
'page_config' => 'nullable|array',
|
||||
'is_active' => 'boolean',
|
||||
'linked_item_ids' => 'nullable|array',
|
||||
'linked_item_ids.*' => 'integer',
|
||||
@@ -235,7 +244,7 @@ public function update(Request $request, int $id): JsonResponse
|
||||
try {
|
||||
DB::beginTransaction();
|
||||
|
||||
$template->update([
|
||||
$updateData = [
|
||||
'name' => $validated['name'],
|
||||
'category' => $validated['category'] ?? null,
|
||||
'title' => $validated['title'] ?? null,
|
||||
@@ -248,7 +257,20 @@ public function update(Request $request, int $id): JsonResponse
|
||||
'is_active' => $validated['is_active'] ?? true,
|
||||
'linked_item_ids' => $validated['linked_item_ids'] ?? null,
|
||||
'linked_process_id' => $validated['linked_process_id'] ?? null,
|
||||
]);
|
||||
];
|
||||
|
||||
// 블록 빌더 전용 필드
|
||||
if (isset($validated['builder_type'])) {
|
||||
$updateData['builder_type'] = $validated['builder_type'];
|
||||
}
|
||||
if (array_key_exists('schema', $validated)) {
|
||||
$updateData['schema'] = $validated['schema'];
|
||||
}
|
||||
if (array_key_exists('page_config', $validated)) {
|
||||
$updateData['page_config'] = $validated['page_config'];
|
||||
}
|
||||
|
||||
$template->update($updateData);
|
||||
|
||||
// 관계 데이터 저장 (기존 데이터 삭제 후 재생성)
|
||||
$this->saveRelations($template, $validated, true);
|
||||
@@ -396,6 +418,7 @@ public function duplicate(Request $request, int $id): JsonResponse
|
||||
'tenant_id' => $source->tenant_id,
|
||||
'name' => $newName,
|
||||
'category' => $source->category,
|
||||
'builder_type' => $source->builder_type ?? 'legacy',
|
||||
'title' => $source->title,
|
||||
'company_name' => $source->company_name,
|
||||
'company_address' => $source->company_address,
|
||||
@@ -403,6 +426,8 @@ public function duplicate(Request $request, int $id): JsonResponse
|
||||
'footer_remark_label' => $source->footer_remark_label,
|
||||
'footer_judgement_label' => $source->footer_judgement_label,
|
||||
'footer_judgement_options' => $source->footer_judgement_options,
|
||||
'schema' => $source->schema,
|
||||
'page_config' => $source->page_config,
|
||||
'is_active' => false,
|
||||
'linked_item_ids' => null, // 연결품목은 복사하지 않음 (중복 방지)
|
||||
'linked_process_id' => null,
|
||||
|
||||
Reference in New Issue
Block a user