@php $kindMeta = [ 'organisation' => ['label' => __('Organisations'), 'icon' => 'building-office'], 'opportunity' => ['label' => __('Opportunities'), 'icon' => 'flag'], ]; $kindNoun = $appliesTo === 'opportunity' ? __('open opportunities') : __('organisations'); $metrics = [ ['label' => __('Rules in use'), 'value' => number_format($stats['active']), 'icon' => 'star', 'accent' => '#6366f1', 'sub' => $stats['off'] > 0 ? trans_choice(':n switched off|:n switched off', $stats['off'], ['n' => $stats['off']]) : __('All switched on')], ['label' => __('Scored'), 'value' => number_format($stats['scored']), 'icon' => 'check-circle', 'accent' => '#10b981', 'sub' => __('of :n :what', ['n' => number_format($stats['records']), 'what' => $kindNoun])], ['label' => __('Highest score'), 'value' => $stats['highest'] === null ? __('Not scored') : number_format($stats['highest']), 'icon' => 'arrow-trending-up', 'accent' => '#0ea5e9', 'sub' => __('Across :what', ['what' => $kindNoun])], ['label' => __('Lowest score'), 'value' => $stats['lowest'] === null ? __('Not scored') : number_format($stats['lowest']), 'icon' => 'arrow-trending-down', 'accent' => '#f59e0b', 'sub' => __('Across :what', ['what' => $kindNoun])], ]; $select = 'mt-1 block w-full rounded-xl border-slate-300 text-sm shadow-sm focus:border-indigo-500 focus:ring-indigo-500'; @endphp
@include('livewire.crm.settings.partials.nav', ['current' => 'crm.settings.scoring']) @if ($canManage) {{ __('Recalculate now') }} {{ __('Recalculating…') }} {{ __('Add a rule') }} @endif
@foreach ($kindMeta as $key => $meta) @endforeach
@foreach ($metrics as $m)

{{ $m['label'] }}

{{ $m['value'] }}

{{ $m['sub'] }}
@endforeach
{{-- The rules --}}

{{ __('Rules for :what', ['what' => $kindMeta[$appliesTo]['label']]) }}

@if ($appliesTo === 'opportunity') {{ __('Only open opportunities are scored. A won, lost or deferred opportunity has no score.') }} @else {{ __('Every organisation is scored, whatever its lifecycle.') }} @endif {{ __('The reason is what appears in each record\'s breakdown, for example "+20 Tier 1 priority".') }}

@if ($canManage) @endif @if ($canManage) @endif @forelse ($rules as $rule) @if ($canManage) @endif @if ($canManage) @endif @empty @endforelse
{{ __('Order') }}{{ __('Reason shown') }} {{ __('When') }} {{ __('Points') }} {{ __('Status') }}{{ __('Actions') }}
{{ $rule->label }} {{ $describe($rule) }} {{ $rule->points >= 0 ? '+' : '' }}{{ $rule->points }} @if ($rule->is_active) {{ __('In use') }} @else {{ __('Switched off') }} @endif
@if ($canManage)

{{ __('Start from suggested rules') }}

{{ __('A starting set you can change or remove afterwards. There is no sector rule: add the sectors that matter to you.') }}

    @foreach ($starter as $row)
  • {{ __($row['label']) }} {{ $row['points'] >= 0 ? '+' : '' }}{{ $row['points'] }}
  • @endforeach
{{ __('Add these rules') }} {{ __('Adding…') }}
@endif
{{-- Any record's breakdown, rule by rule --}}

{{ __('See how a score is made') }}

{{ __('Pick a record to see every rule against it: what the rule asks, what the record holds, and the points it gets.') }}

@if ($searchResults->isNotEmpty())
    @foreach ($searchResults as $result)
  • @endforeach
@endif
@if ($record && $explanation)

{{ $record instanceof \App\Models\Opportunity ? $record->title : $record->name }}

@if ($record instanceof \App\Models\Opportunity && $record->customer)

{{ $record->customer->name }}

@endif
@if ($explanation['score'] === null) {{ __('Not scored: no rules in use') }} @else {{ __('Score') }} {{ $explanation['score'] }} @endif
@foreach ($explanation['rules'] as $row) @endforeach @if ($explanation['score'] !== null) @endif
{{ __('Rule') }} {{ __('Asks') }} {{ __('This record') }} {{ __('Met?') }} {{ __('Points given') }}
{{ $row['rule']->label }} {{ $row['condition'] }} {{ $row['actual'] }} @if ($row['matched']) {{ __('Yes') }} @else {{ __('No') }} @endif {{ $row['matched'] ? (($row['points'] >= 0 ? '+' : '').$row['points']) : '0' }}
{{ __('Score: the sum of the points given') }} {{ $explanation['score'] }}
@else
{{ __('Search above to pick a record.') }}
@endif
{{-- What is and is not scored --}}

{{ __('What a rule can look at') }}

@foreach ($factors as $key => $factorLabel)
{{ __($factorLabel) }}
{{ __($factorHelp[$key] ?? '') }}
@endforeach

{{ __('Not scored') }}

{{ __('Organisation size') }}
{{ __('Not scored. No size is recorded on an organisation, so a rule could only guess at it. Sector, tier, lifecycle, engagement, budget and decision-maker are scored instead.') }}
{{ __('Email opens') }}
{{ __('Not scored. Opens are not tracked; replies and meetings are.') }}
{{ __('Hidden weighting or AI judgement') }}
{{ __('None. A score is only the sum of the rules above that the record meets, recalculated whenever the record changes and every night.') }}
@if ($canManage) {{ $editingId ? __('Change a rule') : __('Add a rule for :what', ['what' => mb_strtolower($kindMeta[$appliesTo]['label'])]) }}
@if ($factor !== '')

{{ __($factorHelp[$factor] ?? '') }}

@endif @if (in_array($operator, ['in', 'not_in', 'equals'], true) && $choices !== null)
@foreach ($choices as $value => $choiceLabel) @endforeach
@elseif (in_array($operator, ['gte', 'lte', 'within_days', 'older_than_days'], true))
@endif
{{ __('Cancel') }} {{ __('Save and rescore') }} {{ __('Saving…') }}
@endif