{{ __('Automation rules') }}
{{ \App\Models\Crm\AutomationRule::STATUSES[$rule->status] ?? $rule->status }} @if ($canManage) @if ($rule->status === 'active') {{ __('Pause') }} @else {{ __('Test') }} {{ __('Testing…') }} {{ __('Switch on') }} @endif @endif @if ($rule->tested_at)

{{ trans_choice('This rule would have matched :count record in the last 30 days.|This rule would have matched :count records in the last 30 days.', (int) $rule->test_match_count, ['count' => (int) $rule->test_match_count]) }}

{{ __('Tested :when. Nothing was changed.', ['when' => $rule->tested_at->diffForHumans()]) }}

@if ($testRuns->isNotEmpty())
    @foreach ($testRuns as $run)
  • {{ $run->actions_taken[0]['detail'] ?? ('#'.$run->subject_id) }}
  • @endforeach
@endif
@endif @php $tabMeta = [ 'builder' => ['label' => __('Rule'), 'icon' => 'bolt'], 'log' => ['label' => __('Run log'), 'icon' => 'queue-list'], ]; @endphp
@foreach ($tabMeta as $key => $meta) @endforeach
@if ($tab === 'builder')

{{ __('After this many completed runs in a day, further matches are skipped and logged.') }}

{{ __('Read only. A rule cannot change a price or a value.') }}

{{ __('Won and Lost can start a rule. A rule can never move a deal there.') }}

{{ __('If') }}

@if ($canManage) @endif
@forelse ($conditions as $index => $condition)
@if ($canManage) @endif
@empty

{{ __('No extra conditions. The rule runs whenever the trigger happens.') }}

@endforelse

{{ __('Then') }}

@if ($canManage) @endif
@foreach ($actions as $index => $action)
@if ($canManage) @endif
@if (in_array($action['type'] ?? '', ['create_task', 'notify', 'open_opportunity'], true)) @endif @if (($action['type'] ?? '') === 'create_task')
@endif @if (($action['type'] ?? '') === 'notify') @endif @if (($action['type'] ?? '') === 'move_stage') @endif @if (($action['type'] ?? '') === 'set_field')
@endif @if (in_array($action['type'] ?? '', ['enrol_sequence', 'stop_sequence'], true)) @endif @if (($action['type'] ?? '') === 'send_template') @endif @if (($action['type'] ?? '') === 'assign_owner') @endif
@endforeach
@if ($canManage && $rule->status !== 'active')
{{ __('Save') }} {{ __('Saving…') }}
@endif
@else

{{ __('Run log') }}

{{ __('Every time the rule ran, what it did, or why it was skipped.') }}

@forelse ($runs as $run) @empty @endforelse
{{ __('When') }} {{ __('Record') }} {{ __('Result') }} {{ __('What happened') }}
{{ $run->ran_at?->format('j M Y H:i') }} {{ class_basename($run->subject_type) }} #{{ $run->subject_id }} {{ $statuses[$run->status] ?? $run->status }} {{ $run->skipped_reason ?: $run->error }} @foreach ($run->actions_taken ?? [] as $taken) {{ $taken['detail'] ?? '' }} @endforeach
{{ $runs->links() }}
@endif