{{-- Reusable "Home Transfer Audit Trail" popup. Renders the same move-history data as the components.home-history full page (same $data->getMoveHistory() call, same trait, same fields) but inside a Bootstrap modal so it can be opened without leaving the current page. This partial is intentionally generic (driven by $type/$subjectName) so the same markup/CSS can be reused for employees, residents and vehicles by including it from their respective detail views. Expected variables: - $data Model instance using HomeHistoryTrait (Employee|Resident|Vehicle) - $type 'employee' | 'resident' | 'vehicle' (defaults to 'employee') - $subjectName Display name shown in the subtitle - $modalId Optional explicit modal id (defaults to a type+id based id) --}} @php $historyType = strtolower($type ?? 'employee'); $historyModalId = $modalId ?? ('home-history-audit-modal-' . $historyType . '-' . ($data->id ?? '')); $historySubjectName = $subjectName ?? ($data->name ?? ''); $homeHistoryData = $data->getMoveHistory(); $homeHistoryFirst = $homeHistoryData['first_home']; $homeHistoryMoves = $homeHistoryData['moves']; $homeHistoryHomesWorked = 1 + $homeHistoryMoves->count(); $homeHistoryFormatDate = function ($date) { if (empty($date) || $date === '0000-00-00' || $date === '0000-00-00 00:00:00') { return '-'; } return \Carbon\Carbon::parse($date)->format(config('choicescrm.date_format_forms')); }; $homeHistoryAbbreviateDuration = function ($text) { if (empty($text)) { return '-'; } return str_ireplace( ['years', 'year', 'months', 'month', 'days', 'day'], ['yrs', 'yr', 'mos', 'mo', 'days', 'day'], $text ); }; @endphp