@if ($form['columns'])
@if($hasTabs)
{{-- Tabs at Page Level (NO card wrapper!) --}}
{{--
Tab types:
- 'standard': Renders form fields from DataDefinition
- 'custom': Renders a Blade view (for non-form content like account deletion, data export)
When a custom tab is active, the CRUD's OTP verification and save buttons are hidden.
Custom tabs must implement their own verification mechanisms.
--}}
@php
// Group columns by their tab for easier rendering
$columnsByTab = collect($form['columns'])
->filter(fn($col) => !$col['hidden'] && isset($col['tab']))
->groupBy('tab')
->toArray();
// Check if any tabs are custom type (used to conditionally show/hide CRUD elements)
$hasCustomTabs = collect($form['tabs'])->contains(fn($tab) => ($tab['type'] ?? 'standard') === 'custom');
// Get the first tab's type to know initial visibility state
$firstTabType = collect($form['tabs'])->first()['type'] ?? 'standard';
@endphp
@foreach ($form['tabs'] as $tabKey => $tabMeta)
@if (($tabMeta['type'] ?? 'standard') === 'custom' && !empty($tabMeta['view']))
{{-- Custom Tab: Render the specified Blade view --}}
{{-- Pass common context variables to the custom view --}}
@include($tabMeta['view'], [
'form' => $form,
'settings' => $settings,
'dataDefinition' => $dataDefinition,
'member' => $form['data'],
])
@else
{{-- Standard Tab: Render form fields --}}
@foreach ($columnsByTab[$tabKey] ?? [] as $column)
@if($column['container_start::edit'] ?? $column['container_start::insert'])
@endif
{{--
Password, OTP Verification, and Save Button sections.
These are hidden when a custom tab is active because custom tabs
implement their own verification and action buttons.
--}}
@if ($hasTabs && $hasCustomTabs)