@extends('layouts.app') @section('title', __('New submission')) @section('content') @php $grouped = collect($types ?? [])->groupBy(fn ($t) => $t['group'] ?? 'general', true); $valuationMethods = $methodCatalog['valuation_methods'] ?? []; $forecastMethods = $methodCatalog['forecast_methods'] ?? []; $families = $methodCatalog['families'] ?? []; $rules = $methodCatalog['rules'] ?? ['min_methods' => 2, 'max_methods' => 6, 'weights_must_sum_to' => 100]; // Default selected methods + weights per type, derived from catalog default_weight values. $defaults = function ($methods) { $picked = []; foreach ($methods as $code => $m) if (($m['default_weight'] ?? 0) > 0) $picked[$code] = (float) $m['default_weight']; return $picked; }; $forecastDefaults = $defaults($forecastMethods); $valuationDefaults = $defaults($valuationMethods); $initialType = old('analysis_type', $gates['analysis'] ? 'analysis' : ($gates['forecast'] ? 'forecast' : ($gates['valuation'] ? 'valuation' : 'analysis'))); // Start with a clean slate — user picks methods explicitly. Only repopulate from old() after a failed submit. $initialMethods = old('methods', []); $initialWeights = old('method_weights', []); @endphp
{{ __('Back to submissions') }}

{{ __('Upload a file for analysis') }}

{{ __('Allowed:') }} {{ implode(', ', $allowed) }} · {{ __('max') }} {{ number_format($maxKb / 1024, 0) }} MB

@csrf {{-- LEFT — main column --}}
{{-- Hidden submitted fields driven by Alpine state --}} {{-- STEP 0 — Type chooser --}}

0 {{ __('What kind of work do you need?') }}

@foreach([ ['analysis', __('Diagnostic analysis'), __('Where is my company today?'), 'chart'], ['forecast', __('Financial forecast'), __('Where will I be in 5 years?'), 'trending-up'], ['valuation', __('Enterprise valuation'), __('What is my company worth?'), 'star'], ] as [$key, $label, $tagline, $icon]) @endforeach

{{ __('Locked options require a higher plan or this feature in your subscription.') }}

@error('analysis_type')
{{ $message }}
@enderror
{{-- File dropzone --}}

1 {{ __('Your file') }}

@error('file')
{{ $message }}
@enderror
{{-- Title & note --}}

2 {{ __('Describe your submission') }}

@error('title')
{{ $message }}
@enderror
@error('note')
{{ $message }}
@enderror
{{-- Optional client linkage. Hidden for end-users (the picker only makes sense for the tenant admin / operator role). --}} @if(auth()->user()->isTenantAdmin() && isset($clients))
{{ __('+ New') }}

{{ __('Links this analysis to a client for chronological tracking and comparison.') }}

@endif
{{-- Analysis type picker (multi) --}}

3 {{ __('What analyses do you want?') }} ({{ __('optional, multi-select') }})

{{ __('selected') }}

{{ __('Pick zero, one, or several. Your analyst will use these as the starting point — they can still adjust before running.') }}

@foreach($grouped as $groupKey => $items)
{{ __($groups[$groupKey] ?? $groupKey) }}
@foreach($items as $key => $type) @endforeach
@endforeach @error('analysis_types')
{{ $message }}
@enderror @error('analysis_types.*')
{{ $message }}
@enderror
{{-- STEP 4 — Methods (only for forecast / valuation) --}}

4 {{ __('Choose your methods') }} ({{ __('min :n, max :m', ['n' => $rules['min_methods'], 'm' => $rules['max_methods']]) }})

{{ __('selected') }} % / 100
{{-- Valuation methods --}} {{-- Forecast methods --}}

{{ __('Methods triangulate the result. The system blends them with your weights and flags inter-method divergence.') }}

@error('methods')
{{ $message }}
@enderror @error('method_weights')
{{ $message }}
@enderror
{{-- RIGHT — sticky summary --}}
@endsection