{{ __('Automations') }}

{{ __('Rules that run automatically on a cadence. Set conditions, actions, and an optional ticket scope. The runner ticks every 15 minutes — each rule fires only when its own schedule cadence has elapsed.') }}

@php $canManage = $this->canManage(); @endphp
{{ __('Execution history') }} @if ($canManage) {{ __('New automation') }} @endif
@php $automations = $this->automations(); @endphp @if (collect($automations)->isEmpty())
{{ __('No automations yet.') }} @if ($canManage)
{{ __('Create the first one') }}
@endif
@else
@foreach ($automations as $automation) @php $days = $automation->olderThanDays(); $scope = is_array($automation->scope_json) ? $automation->scope_json : []; @endphp @endforeach
{{ __('Name') }} {{ __('Trigger') }} {{ __('Schedule') }} {{ __('Scope') }} {{ __('Status') }} {{ __('Last run') }}
{{ $automation->name }}
@if ($days !== null)
{{ __('After :n day(s) since :basis', [ 'n' => $days, 'basis' => $automation->activityBasis()->label(), ]) }}
@endif
{{-- triggerTypeLabel() reads raw + tryFrom so a row with an unknown enum value (legacy / restored backup / future rename pre-conversion) renders as '—' instead of crashing the page. See Automation::triggerTypeLabel(). --}} {{ $automation->triggerTypeLabel() }} {{ $automation->cadenceLabel() }} @if ($scope === []) {{ __('All tickets') }} @else
@if (! empty($scope['assigned_user_id'])) {{ __('Agent #:id', ['id' => $scope['assigned_user_id']]) }} @endif @if (! empty($scope['store_id'])) {{ __('Store #:id', ['id' => $scope['store_id']]) }} @endif @if (! empty($scope['priority'])) {{ ucfirst($scope['priority']) }} @endif
@endif
@if ($automation->enabled) {{ __('Enabled') }} @else {{ __('Disabled') }} @endif @if ($automation->last_run_at) {{ $automation->last_run_at->diffForHumans() }} @else {{ __('Never') }} @endif @if ($canManage)
@if ($confirmingDeleteId === $automation->id) {{ __('Cancel') }} {{ __('Delete automation') }} @else {{ $automation->enabled ? __('Disable') : __('Enable') }} {{ __('Edit') }} {{ __('Delete') }} @endif
@else {{ __('Read-only') }} @endif
@endif