@php // Skeleton for relations mapping UI (modular, opt-in per segment) // Props: // - $segment: 'stabili'|'unita'|'tabelle'|'voci' // - $legacyFields: array of legacy keys to map from (strings) // - $existingRelations: array of relation rules persisted in meta (same shape as emitted below) $segment = $segment ?? 'stabili'; $legacyFields = array_values(array_filter(($legacyFields ?? []), 'strlen')); $existing = collect(($existingRelations ?? []))->where('segment', $segment)->values(); $targets = [ 'unita' => [ ['table' => 'soggetti', 'label' => 'Soggetti (anagrafiche)'], ['table' => 'unita_immobiliari', 'label' => 'Unità immobiliari'], ], 'tabelle' => [ ['table' => 'unita_immobiliari', 'label' => 'Unità immobiliari'], ], 'voci' => [ ['table' => 'voci_spesa', 'label' => 'Voci di spesa'], ], 'stabili' => [ ['table' => 'stabili', 'label' => 'Stabili'], ], ][$segment] ?? []; @endphp