@extends('layouts.main') @section('title', 'Branch Dashboard - ' . $branch->branch_name) @section('content')

{{ $branch->branch_name }}

@if($branch->branch_code) {{ $branch->branch_code }} @endif

{{ $branch->address_line_1 ?? '' }}, {{ $branch->city ?? '' }} - {{ $branch->postal_code ?? '' }}

{{ $branch->contact_number ?? 'N/A' }} {{ $branch->email ?? 'N/A' }} Opened: {{ $branch->opening_date ? \Carbon\Carbon::parse($branch->opening_date)->format('d M Y') : 'N/A' }}
Partners & Equity
@forelse($branch->branch_partner as $partner)
{{ $partner->partner->full_name ?? 'N/A' }}
{{ $partner->partner->partner_code ?? '' }}
{{ number_format($partner->equity_percentage, 2) }}%
{{ \Carbon\Carbon::parse($partner->effective_date)->format('d M Y') }}
@if(!$loop->last)
@endif @empty

No partners assigned

@endforelse @if($branch->branch_partner->count() > 0) @endif
Total Sales

This Month

{{ number_format($metrics['total_sales_month'] ?? 0, 2) }}

Total Staff

Current Employees

{{ $metrics['total_staff']->first()->total_staff_count ?? 0 }}

Managers: {{ $metrics['total_staff']->first()->managers_count ?? 0 }} Kitchen: {{ $metrics['total_staff']->first()->kitchen_staff_count ?? 0 }}
Food Cost

This Month

{{ number_format($metrics['avg_food_cost'] ?? 0, 2) }}

Recent Activities

Latest updates from your branch

{{ $recentActivities->count() ?? 0 }} Activities
@forelse($recentActivities ?? [] as $activity)
@if($activity->type == 'sale')
@elseif($activity->type == 'staff')
@elseif($activity->type == 'food_cost')
@else
@endif
{{ $activity->title ?? 'Activity' }}
{{ $activity->time ?? '' }}

{{ $activity->description ?? '' }}

{{ $activity->user ?? 'System' }} {{ $activity->date ?? '' }}
@if(!$loop->last)
@endif @empty
No Recent Activities

Activities will appear here when you add records

@endforelse
@if(isset($recentActivities) && $recentActivities->count() > 0) @endif
Monthly Expenses
{{ isset($currentMonthYear) ? \Carbon\Carbon::parse($currentMonthYear)->format('F Y') : date('F Y') }}
@if(!empty($monthlyExpenses['items']))
@foreach($monthlyExpenses['items'] as $expense)
{!! $expense['icon'] ?? '' !!}
{{ $expense['name'] ?? 'Expense' }}
Monthly
{{ number_format($expense['amount'] ?? 0, 2) }}
@endforeach

Total Expenses
{{ number_format($monthlyExpenses['total'] ?? 0, 2) }}
@if(isset($monthlyExpenses['food_cost_percentage']))
Food Cost
{{ $monthlyExpenses['food_cost_percentage'] }}
@endif
@else

No expenses recorded

@endif
@endsection