@php $devices = $devices ?? collect(); $templates = $templates ?? collect(); $flows = $flows ?? collect(); // Edit mode: AutoReplyController::create() loads $row when the // URL has ?id=N. The blade still renders the same defaults the // "new" path uses; the JS reads window.WA_AUTOREPLY_ROW on init // and re-applies the row's values (name, keyword chips, device // selection, match method, similarity, reply type, cooldown, // timeout, contents). On submit the JS detects row.id and // PATCHes /auto-reply/{id} instead of POSTing /auto-reply. $row = $row ?? null; $isEdit = (bool) $row; $editPayload = $row ? [ 'id' => $row->id, 'name' => (string) ($row->keyword ?? ''), // legacy: keyword field doubles as rule label 'keywords' => array_values(array_filter(array_map('trim', explode(',', (string) $row->keyword)))), 'device_id' => $row->device_id, 'matching_method' => $row->matching_method ?? 'fuzzy', 'fuzzy_similarity' => $row->fuzzy_similarity ?? 80, 'cooldown' => $row->cooldown, 'timeout' => $row->timeout, 'reply_type' => $row->reply_type ?? 'custom', 'flow_id' => $row->flow_id, 'target_contact_id' => $row->target_contact_id, 'target_catalog_id' => $row->target_catalog_id, 'message_type' => $row->message_type ?? 'text', 'contents' => $row->relationLoaded('contents') ? $row->contents ->map( fn($c) => [ 'content_type' => $c->content_type, 'content' => (string) $c->content, 'template_id' => $c->template_id, ], ) ->values() : [], ] : null; @endphp
Auto Reply / {{ $isEdit ? 'Edit · #' . $row->id : 'New' }}
{{ $isEdit ? 'Edit auto' : 'Create new auto' }} {{ __('reply') }}
{{ __('Draft / unsaved') }}
1 {{ __('Trigger') }}
2 {{ __('Schedule') }}
3 {{ __('Reply type') }}
4 {{ __('Compose') }}
5 {{ __('Review') }}
01 {{ __('Trigger') }} {{ __('required') }}
{{ __("Internal label only — customers don't see this.") }}
@if ($devices->count() > 1) {{-- Multi-device picker. Each ticked box becomes its own KeywordReply row on submit (server fans out via device_ids[] — see AutoReplyController::store). Lets one keyword fire on more than one paired number without recreating the rule per device. --}}
@foreach ($devices as $d) @endforeach
{{ __('Each ticked device gets its own row — toggle / delete each independently from the list later.') }}
@else @endif @if ($devices->isEmpty())
{{ __('No connected devices.') }} {{ __('Connect one →') }}
@endif
hi {{ __('hello') }} {{ __('hey') }}
{{ __('Press') }} {{ __('Enter') }} or , to add. Group similar phrases in one rule.
{{ __('Fuzzy catches typos like "pricng" → "pricing".') }}
{{ __('loose') }}{{ __('strict') }}
{{ __('Step') }} 1 of 5
{{-- Edit-mode payload. Empty/null when creating a fresh rule. The page-module JS reads this to pre-fill the multi-step form and switch the submit handler from POST to PATCH. --}} {{-- Step-4 flow picker: search-by-name filter + visual selection state. The radio inside each card carries the flow_id the form submits; this script only handles UX (hide/show, highlight, edit-mode pre-select). --}}