@extends('layouts.app') @section('content')

🎯 Marketing Strategy Dashboard

ROI Analysis & AI-Powered Recommendations

Input Marketing Data

Revenue Display Mode

Toggle to see marketing effectiveness on HQ sales only

All Sales (HQ + Stokis + Agent)
Total Marketing Spend
RM {{ number_format($yearSummary['total_spend'], 2) }}
Total Revenue
RM {{ number_format($yearSummary['total_revenue'], 2) }}
All Sales
Average ROI
{{ number_format($yearSummary['avg_roi'], 1) }}%
@php $allRatio = $yearSummary['total_spend'] > 0 ? $yearSummary['total_revenue'] / $yearSummary['total_spend'] : 0; @endphp
Ratio: {{ number_format($allRatio, 2) }}x
Based on All Sales
Profit from Marketing
RM {{ number_format($yearSummary['total_revenue'] - $yearSummary['total_spend'], 2) }}
All Sales
@if($yearSummary['best_month'])
Best Performing Month (All Sales)
{{ $yearSummary['best_month']->month_name }}: {{ number_format($yearSummary['best_month']->roi_percentage, 1) }}% ROI
@php $bestRatio = $yearSummary['best_month']->total_marketing_spend > 0 ? $yearSummary['best_month']->actual_revenue / $yearSummary['best_month']->total_marketing_spend : 0; @endphp
Ratio: {{ number_format($bestRatio, 2) }}x
Spend: RM {{ number_format($yearSummary['best_month']->total_marketing_spend, 2) }} → Revenue: RM {{ number_format($yearSummary['best_month']->actual_revenue, 2) }}
@endif @if($yearSummary['worst_month'])
Needs Optimization (All Sales)
{{ $yearSummary['worst_month']->month_name }}: {{ number_format($yearSummary['worst_month']->roi_percentage, 1) }}% ROI
@php $worstRatio = $yearSummary['worst_month']->total_marketing_spend > 0 ? $yearSummary['worst_month']->actual_revenue / $yearSummary['worst_month']->total_marketing_spend : 0; @endphp
Ratio: {{ number_format($worstRatio, 2) }}x
Spend: RM {{ number_format($yearSummary['worst_month']->total_marketing_spend, 2) }} → Revenue: RM {{ number_format($yearSummary['worst_month']->actual_revenue, 2) }}
@endif
@if($yearSummary['channel_performance'])

Channel Performance (Average Spend)

@foreach($yearSummary['channel_performance'] as $channelKey => $channel) @php $channelNames = [ 'brand_ambassadors' => 'Brand Ambassadors', 'ads' => 'Ads', 'social_media' => 'Social Media', 'events' => 'Events', 'other' => 'Other' ]; @endphp
{{ $channelNames[$channelKey] }}
RM {{ number_format($channel['average'], 2) }}
{{ $channel['count'] }} month(s)
@endforeach
@endif

Monthly ROI Trend - {{ $year }}

Monthly Breakdown (All Sales)

@forelse($marketingDataWithHq as $data) @empty @endforelse
Month Marketing Spend Total Revenue ROI Best Channel Actions
{{ $data->month_name }}
RM {{ number_format($data->total_marketing_spend, 2) }} @if($data->campaign_details) @endif
RM {{ number_format($data->actual_revenue, 2) }} {{ number_format($data->roi_percentage, 1) }}% @php $dataRatio = $data->total_marketing_spend > 0 ? $data->actual_revenue / $data->total_marketing_spend : 0; @endphp
{{ number_format($dataRatio, 2) }}x
{{ $data->best_channel }} Edit @if($data->ai_recommendations) AI @endif
No marketing data found for {{ $year }}. Click "Input Marketing Data" to add.
@endsection