feat(app-ui): 組合內容設定頁依類別群組分塊+分隔線(A系列/E系列/P系列)
config 加 groups 定義(標題+順序);content 頁 groupBy group 渲染,塊間加 hr Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
de3723bb1e
commit
b3d4760b55
@ -20,6 +20,13 @@
|
||||
*/
|
||||
|
||||
return [
|
||||
// 群組定義(決定內容設定頁的分塊標題與順序;未列到的群組排最後)
|
||||
'groups' => [
|
||||
'fullscreen' => '滿版畫面(A 系列)',
|
||||
'transaction' => '交易結果(E 系列)',
|
||||
'payment' => '支付方式(P 系列)',
|
||||
],
|
||||
|
||||
'parts' => [
|
||||
// === A 系列:滿版 / 大圖背景 ===
|
||||
'A1' => ['label' => 'A1 - 頁面跳轉中', 'group' => 'fullscreen', 'type' => 'image', 'width' => 1080, 'height' => 1920, 'active' => true],
|
||||
|
||||
@ -15,8 +15,25 @@
|
||||
<form action="{{ route('admin.app.ui-bundles.content.update', $bundle) }}" method="POST">
|
||||
@csrf @method('PUT')
|
||||
|
||||
@php
|
||||
$grouped = collect($parts)->groupBy('group', true);
|
||||
$groupDefs = config('ui_parts.groups', []);
|
||||
// 群組順序:先照 config 定義,未定義者排最後,且只留實際有部位的群組
|
||||
$orderedGroups = collect($groupDefs)->keys()
|
||||
->merge($grouped->keys())->unique()
|
||||
->filter(fn($g) => $grouped->has($g))->values();
|
||||
$firstGroup = true;
|
||||
@endphp
|
||||
|
||||
@foreach($orderedGroups as $groupKey)
|
||||
@if(!$firstGroup)
|
||||
<hr class="my-8 border-t border-gray-200 dark:border-gray-700">
|
||||
@endif
|
||||
@php $firstGroup = false; @endphp
|
||||
|
||||
<h4 class="text-base font-semibold text-gray-800 dark:text-gray-200 mb-3">{{ $groupDefs[$groupKey] ?? $groupKey }}</h4>
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4">
|
||||
@foreach($parts as $key => $part)
|
||||
@foreach($grouped[$groupKey] as $key => $part)
|
||||
@php
|
||||
$currentId = optional($itemsByPart->get($key))->ui_element_id;
|
||||
$currentThumb = optional(optional($itemsByPart->get($key))->element)->image_url ?? '';
|
||||
@ -43,6 +60,7 @@
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@endforeach
|
||||
|
||||
<div class="mt-6 flex justify-end">
|
||||
<button type="submit" class="btn-luxury-primary">{{ __('Save') }}</button>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user