@section('title', get_setting('site_name') . ' | Staff Branch Transfer') @push('css') @endpush

{{ __('Staff Branch Transfer') }}

{{ __('Transfer employees between branches and review tenure history.') }}

@if (session()->has('message'))
{{ session('message') }}
@endif @if (session()->has('error'))
{{ session('error') }}
@endif
{{ __('Transfer History') }}
@forelse($history as $row) @empty @endforelse
{{ __('Recorded') }} {{ __('Effective') }} {{ __('Employee') }} {{ __('From') }} {{ __('To') }} {{ __('Days at From') }} {{ __('Transfer Reason') }} {{ __('Status') }} {{ __('By') }} {{ __('Action') }}
{{ $row->created_at?->format('Y-m-d') }} {{ $row->effective_date?->format('Y-m-d') ?? '—' }} @if($row->staff)
{{ $row->staff->user?->name ?? 'Staff #'.$row->staff->id }}
{{ $row->staff->user_id }}
@else — @endif
{{ $row->fromBranch?->name ?? '—' }} {{ $row->toBranch?->name ?? '—' }} @if(isset($historyDays[$row->id]) && $historyDays[$row->id] !== null) {{ $historyDays[$row->id] }} days @else — @endif {{ $row->reason ? \Illuminate\Support\Str::limit($row->reason, 180) : '—' }} @php $status = $row->approval_status ?? 'approved'; $badge = match ($status) { 'pending' => 'badge-warning', 'rejected' => 'badge-danger', default => 'badge-success', }; @endphp {{ ucfirst($status) }} @if($status === 'approved' && ($row->joining_form_status ?? '') === 'pending')
{{ __('Join form pending') }}
@elseif($status === 'approved' && ($row->joining_form_status ?? '') === 'submitted')
{{ __('Joined') }}
@endif
{{ $row->createdBy?->name ?? '—' }}
@if(($row->approval_status ?? '') === 'approved')
@endif @if(($row->approval_status ?? 'approved') === 'pending') @endif
{{ __('No Records Yet') }}
{{ __('Branch Tenure Overview') }}
{{ __('See how long each employee has been in their current branch — useful for transfer planning.') }}
@forelse($overviewStaff as $staff) @php $summary = $overviewSummaries[$staff->id] ?? null; @endphp @empty @endforelse
{{ __('Employee') }} {{ __('Current Branch') }} {{ __('Joined Branch On') }} {{ __('Days in Current') }} {{ __('Previous Branch') }} {{ __('Days in Previous') }} {{ __('Transfers') }}
{{ $staff->user?->name ?? '—' }} ({{ $staff->user_id }}) {{ $summary['current']?->branch?->name ?? ($staff->warehouse?->name ?? '—') }} {{ $summary['current']?->joined_at?->format('Y-m-d') ?? '—' }} @php $days = $summary['current_days'] ?? 0; @endphp {{ $days }} days @if($summary['current'] ?? null)
{{ $summary['current']->durationLabel() }}
@endif
{{ $summary['previous']?->branch?->name ?? '—' }} @if($summary['previous'] ?? null) {{ $summary['previous_days'] }} days
{{ $summary['previous']->durationLabel() }}
@else — @endif
{{ $summary['transfer_count'] ?? 0 }} {{ __('History') }}
{{ __('No active employees match these filters.') }}
{{-- Create Transfer Modal --}}
@section('script') @endsection