@php $type = strtolower($type ?? ''); $config = [ 'employee' => [ 'title' => 'Employee Home History', 'show_role' => true, ], 'resident' => [ 'title' => 'Resident Home History', 'show_role' => false, ], 'vehicle' => [ 'title' => 'Vehicle Home History', 'show_role' => false, ], ]; $historyConfig = $config[$type] ?? $config['employee']; $moveHistory = $data->getMoveHistory(); $firstHome = $moveHistory['first_home']; $moves = $moveHistory['moves']; $formatMoveDate = 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')); }; @endphp
@include('partials.breadcrumbs') @include('layouts.crmnov')

Home History

{{ $historyConfig['title'] }}

Review the home movement history and duration details.
{{ $firstHome['title'] }}

From Home

{{ $firstHome['from_home'] ?? '-' }}

Current Home

{{ $firstHome['home'] ?: '-' }} @if(!empty($firstHome['home']) && !empty($firstHome['status_label'])) {{ $firstHome['status_label'] }} @endif

@if($historyConfig['show_role'])

Role

{{ $firstHome['role'] ?? '-' }}

@endif

Stay Duration

{{ $firstHome['stay_duration'] ?: '-' }}

Start Date

{{ $formatMoveDate($firstHome['start_date']) }}

End Date

{{ $formatMoveDate($firstHome['end_date']) }}

@foreach($moves as $move)
{{ $move['title'] }}

From Home

{{ $move['from_home'] ?? '-' }}

To Home

{{ $move['to_home'] ?: '-' }} @if(!empty($move['to_home']) && !empty($move['status_label'])) {{ $move['status_label'] }} @endif

@if($historyConfig['show_role'])

Role

{{ $move['role'] ?? '-' }}

@endif

Start Date

{{ $formatMoveDate($move['start_date']) }}

End Date

{{ $formatMoveDate($move['end_date']) }}

Stay Duration

{{ $move['stay_duration'] ?: '-' }}

@endforeach