@extends('admin.layouts.app')
@section('title', __('admin.automations.edit_title') . ' — ' . $automation->displayName())
@section('page_title', __('admin.automations.edit_title'))
@php
use App\Models\Automation;
$selectedChannels = old('channels', $automation->channels ?: []);
$isReminder = $automation->type === Automation::TYPE_REMINDER;
// `creation` automations (committee_created — automations #9 + #10)
// fire IMMEDIATELY via the event listener
// App\Listeners\DispatchCommitteeCreationAutomations, so a delay
// setting would be ignored. The form hides the "Execute After
// Registration" field for them and shows a small info line instead.
$isCreation = $automation->type === Automation::TYPE_CREATION;
/* Channel accordion — the SAME four channels as the Actions
(label option-edit) screen: email, SMS, WhatsApp, in-app
notification. Order matches the dispatch order in
AutomationNotificationService. */
/* Channel-row icons. WhatsApp uses its real brand glyph (green); the
rest stay as emoji — same set the Actions option-edit screen uses. */
$waLogo = '';
$channelDefs = [
'email' => '✉️',
'sms' => '📱',
'whatsapp' => $waLogo,
'notification' => '🔔',
];
// Chip palette source. AutomationController::edit() is the
// authoritative scope filter — it already drops rejection_only +
// committee_attendance_only + investor_committee_only +
// startup_committee_only based on the automation's audience and
// trigger. Whatever lands in $templateVariables is by definition
// visible for THIS automation, so we just pass the keys through
// without re-filtering. (The legacy view-side filter was stricter
// than the controller and silently hid the new committee_*_slots
// placeholders.)
$vars = array_keys(($templateVariables ?? []));
/* WhatsApp positional placeholders. Seed with three empty slots when
none are stored so the grid (matching the Actions screen) opens
with something to fill rather than an empty void. */
$waPlaceholders = old('whatsapp_placeholders', $automation->whatsapp_placeholders ?: []);
if (! is_array($waPlaceholders) || count($waPlaceholders) === 0) {
$waPlaceholders = ['', '', ''];
}
@endphp
@push('styles')
@endpush
@section('content')