@extends('layouts.main') @section('title', 'Select Branch') @section('content')
@foreach($branches as $branch)
@if(isset($branch->equity_percentage) && $branch->equity_percentage) {{ $branch->equity_percentage }}% Equity @endif

{{ $branch->branch_name }}

{{ $branch->branch_code }}
Location {{ $branch->city ?? 'N/A' }}, {{ $branch->state ?? '' }}
Contact {{ $branch->contact_number ?? 'N/A' }}
Established {{ $branch->opening_date ? \Carbon\Carbon::parse($branch->opening_date)->format('d M Y') : 'N/A' }}
Performance {{ ucfirst($branch->status) }}
@endforeach @if(Auth::user()->hasRole('superadmin'))
Global Branch Analytics

Comprehensive overview of all branches

Total Branches

{{ $branches->count() }}

Across {{ $branches->pluck('city')->unique()->count() }} cities
Active Branches

{{ $branches->where('status', 'active')->count() }}

{{ round(($branches->where('status', 'active')->count() / max($branches->count(), 1)) * 100) }}% of total
Avg. Performance

84%

+12% from last month
Total Staff

{{ $branches->sum(function($b) { return $b->total_staff ?? 0; }) }}

Across all branches
@endif
@endsection