diff --git a/config/ui_parts.php b/config/ui_parts.php index 928fbf3..db7e15e 100644 --- a/config/ui_parts.php +++ b/config/ui_parts.php @@ -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], diff --git a/resources/views/admin/app/ui-bundles/content.blade.php b/resources/views/admin/app/ui-bundles/content.blade.php index f0f1afb..49a1e35 100644 --- a/resources/views/admin/app/ui-bundles/content.blade.php +++ b/resources/views/admin/app/ui-bundles/content.blade.php @@ -15,34 +15,52 @@
@csrf @method('PUT') -
- @foreach($parts as $key => $part) - @php - $currentId = optional($itemsByPart->get($key))->ui_element_id; - $currentThumb = optional(optional($itemsByPart->get($key))->element)->image_url ?? ''; - @endphp -
- - -
- -

{{ __('No image selected') }}

+ @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) +
+ @endif + @php $firstGroup = false; @endphp + +

{{ $groupDefs[$groupKey] ?? $groupKey }}

+
+ @foreach($grouped[$groupKey] as $key => $part) + @php + $currentId = optional($itemsByPart->get($key))->ui_element_id; + $currentThumb = optional(optional($itemsByPart->get($key))->element)->image_url ?? ''; + @endphp +
+ + +
+ +

{{ __('No image selected') }}

+
-
- @endforeach -
+ @endforeach +
+ @endforeach