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

{{ __('Point Categories') }}: {{ $test->trans('name') }}

@if(session('success')) @endif
{{ __('Existing Categories') }}
@if($categories->count() > 0) @foreach($categories as $category) @endforeach
{{ __('Name') }} {{ __('Mean') }} {{ __('Std Dev') }} {{ __('Conv.') }}
{{ $category->trans('name') }} @if($category->expected_mean !== null) {{ number_format($category->expected_mean, 1) }} @else - @endif @if($category->expected_std !== null) {{ number_format($category->expected_std, 1) }} @else - @endif @if($category->conversions()->count() > 0) {{ $category->conversions()->distinct('gender')->count('gender') }}g @else @endif
@csrf @method('DELETE')
@else

{{ __('No categories yet. Add your first category.') }}

@endif
@if($test->formula_class && class_exists($test->formula_class)) @php $formulaClass = $test->formula_class; $expectedCategories = method_exists($formulaClass, 'getExpectedCategories') ? $formulaClass::getExpectedCategories() : []; @endphp @if(!empty($expectedCategories))
{{ __('Formula Categories') }}

{{ $formulaClass::getName() }} {{ __('requires') }} {{ count($expectedCategories) }} {{ __('categories') }}:

    @foreach($expectedCategories as $index => $catName)
  • {{ $index + 1 }}. {{ $catName }}
  • @endforeach
@if($categories->count() == 0)
@csrf
@elseif($categories->count() == count($expectedCategories)) @php $orderCorrect = true; $mismatchDetails = []; foreach($categories as $index => $cat) { $expected = $expectedCategories[$index] ?? null; if ($expected && strtolower(trim($cat->getTranslation('name', 'en', false) ?: $cat->trans('name'))) !== strtolower(trim($expected))) { $orderCorrect = false; $mismatchDetails[] = ($index + 1) . ": '{$cat->trans('name')}' should be '{$expected}'"; } } @endphp @if($orderCorrect)
{{ __('All required categories are configured in the correct order.') }}
@else
{{ __('Categories are in the wrong order!') }}
{{ __('Scores will be mapped incorrectly. Please delete all categories and use the auto-create button, or manually reorder them.') }} @if(count($mismatchDetails) <= 5)
    @foreach($mismatchDetails as $detail)
  • {{ $detail }}
  • @endforeach
@endif
@endif @else
{{ __('Expected') }} {{ count($expectedCategories) }} {{ __('categories, found') }} {{ $categories->count() }}. {{ __('Delete existing categories to auto-create from formula.') }}
@endif
@endif @endif
{{ __('Add Category') }}
@csrf
@include('components.translatable-input', [ 'name' => 'name', 'type' => 'text', 'model' => null, 'required' => true ])
@endsection @push('scripts') @endpush