@php use App\Services\Targets\SalesForecastService; $dashboardSlides = $dashboardSlides ?? []; $initialScopeIndex = (int) ($initialScopeIndex ?? 0); $teamForecastChartCode = (string) ($teamForecastChartCode ?? 'gross_profit'); $teamForecastChartSelectOptions = $teamForecastChartSelectOptions ?? []; $forecastPaceBadgeClasses = [ SalesForecastService::PACE_AHEAD => 'bg-green-100 text-green-800 border-green-200', SalesForecastService::PACE_ON_TRACK => 'bg-indigo-100 text-indigo-900 border-indigo-200', SalesForecastService::PACE_AT_RISK => 'bg-amber-100 text-amber-900 border-amber-200', SalesForecastService::PACE_BEHIND => 'bg-red-100 text-red-800 border-red-200', SalesForecastService::PACE_NO_TARGET => 'bg-gray-100 text-gray-700 border-gray-200', SalesForecastService::PACE_NO_ELAPSED_DAYS => 'bg-gray-100 text-gray-600 border-gray-200', ]; $forecastPaceLabels = [ SalesForecastService::PACE_AHEAD => 'Ahead', SalesForecastService::PACE_ON_TRACK => 'On track', SalesForecastService::PACE_AT_RISK => 'At risk', SalesForecastService::PACE_BEHIND => 'Behind', SalesForecastService::PACE_NO_TARGET => 'No targets', SalesForecastService::PACE_NO_ELAPSED_DAYS => 'Period not started', ]; $gallerySlides = collect($dashboardSlides)->map(fn (array $slide) => [ 'key' => (string) ($slide['key'] ?? ''), 'label' => (string) ($slide['label'] ?? ''), 'forecastByMetric' => $slide['forecastByMetric'] ?? [], ])->values()->all(); $initialLabel = $dashboardSlides[$initialScopeIndex]['label'] ?? 'Dealer'; @endphp {{ $title }}
@foreach ($dashboardSlides as $slide) @include('dashboard.departments.partials.sales-dashboard-slide-top', [ 'slide' => $slide, 'reportingPeriodLabel' => $reportingPeriod->label(), ]) @endforeach
@include('dashboard.departments.partials.sales-dashboard-forecast-panel', [ 'teamForecastChartCode' => $teamForecastChartCode, 'teamForecastChartSelectOptions' => $teamForecastChartSelectOptions, ])
@foreach ($dashboardSlides as $slide) @include('dashboard.departments.partials.sales-dashboard-slide-bottom', [ 'slide' => $slide, 'reportingPeriodLabel' => $reportingPeriod->label(), ]) @endforeach