@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
Relazioni (beta) — {{ ucfirst($segment) }}
Collega campi legacy ad entità target (FK/lookup)
Definisci regole semplici: legacy_field → match su tabella target → assegna a campo.
@php $rows = count($existing) ? $existing : [['legacy_field'=>null,'target_table'=>null,'match'=>['by'=>'field','rules'=>[['table'=>null,'field'=>null,'source'=>'legacy']]],'assign_to'=>null]]; @endphp @foreach($rows as $i=>$r)
@foreach($legacyFields as $lf) @endforeach
Match
Regola principale: @php $rule = ($r['match']['rules'][0] ?? []); @endphp @php $onMiss = ($r['match']['on_miss'] ?? 'log'); @endphp
@endforeach