@extends('setting.nav') @section('title', 'Next Actions') @section('content')

Next Action Recommendation

The actions the classifier may recommend for a mail. These rows drive the AI prompt, the Next Action column on the mail list and the Next Action filter menu. The list is shared by everyone — an action an administrator adds here is recommended on every user's mail, not just their own.

@if (session('success')) @endif @if (session('error')) @endif @if ($errors->any())
Please fix the following:
@endif @php $isAdmin = auth()->check() && auth()->user()->auth_id == 0; // Mail counts are keyed by the code stored on the row, and an action // also owns the words it lists as aliases. $countFor = function ($action) use ($counts) { $total = $counts[strtolower((string) $action->code)] ?? 0; foreach ($action->aliasList() as $alias) { $total += $counts[$alias] ?? 0; } return $total; }; @endphp @if ($usingDefaults) {{-- Nothing configured yet. The app is running on the built-in list, so say so plainly rather than showing an empty table. --}}
Running on the built-in actions. The eight actions below are already in force — they are what the AI is offered and what the mail list shows. Add them as rows to reorder them, reword them for your business, or add your own.
@endif @if ($unclassified > 0) {{-- Every mail that arrived before this feature shipped. Worth stating, because the column shows those rows as inferred. --}}
{{ number_format($unclassified) }} mails arrived before next actions existed, so the AI never recommended one for them. The mail list infers an action for those from the labels they already carry — the reply flag, the sentiment and the category — and marks it inferred. Mail fetched from now on gets a real recommendation.
@endif
{{ $usingDefaults ? 'Actions in force' : 'Actions' }}
@if ($isAdmin && $canSeed)
@csrf
@endif
{{-- Counted across every mailbox, because deactivating an action affects every mailbox. The link opens your own listing. --}} @forelse ($actions as $action) @empty {{-- No rows, so show the built-in list that is actually in force. --}} @foreach ($effective as $action) @endforeach @endforelse
Action AI code Mail (all users) Active Actions
{{ $loop->iteration }} {{ $action->name }} @if ($action->description)
{{ \Illuminate\Support\Str::limit($action->description, 120) }}
@endif @if ($action->ai_aliases)
also matches: {{ $action->ai_aliases }}
@endif
{{ $action->code }}
/mails/{{ $action->filter_slug }}
@php $used = $countFor($action); @endphp @if ($used > 0) {{ number_format($used) }} @else 0 @endif @if ($isAdmin)
@csrf
@else {{ $action->is_active ? 'Active' : 'Inactive' }} @endif
@if ($isAdmin) {{-- Order is the urgency ranking: the prompt prefers the action nearest the top when two of them fit. --}}
@csrf
@csrf
@csrf @method('DELETE')
@endif
{{ $loop->iteration }} {{ $action->name }} @if ($action->description)
{{ \Illuminate\Support\Str::limit($action->description, 120) }}
@endif
{{ $action->code }}
/mails/{{ $action->filter_slug }}
{{ number_format($countFor($action)) }} Built in not editable yet
@if ($isAdmin)
Add action
@csrf @include('next_actions._fields', ['action' => null, 'colours' => $colours])
@endif
{{-- Edit dialogs, one per row. --}} @if ($isAdmin) @foreach ($actions as $action) @endforeach @endif
@endsection