@extends('admin.layouts.app') @section('title', ($isEdit ? __('admin.notification_center.edit_title') : __('admin.notification_center.new')) . ' โ€” ' . __('admin.brand.name')) @section('page_title', __('admin.notification_center.title')) @php $waLogo = ''; $channelDefs = ['email' => 'โœ‰๏ธ', 'sms' => '๐Ÿ“ฑ', 'whatsapp' => $waLogo]; $vars = array_keys(($templateVariables ?? [])); $waPlaceholders = old('whatsapp_placeholders', $notification->whatsapp_placeholders ?: []); if (! is_array($waPlaceholders) || count($waPlaceholders) === 0) { $waPlaceholders = ['', '', '']; } // Absolute public URL of the campaign's stored WhatsApp header image (an // upload or a pasted URL) โ€” null when it has none yet. $currentMedia = $notification->exists ? $notification->whatsappHeaderMediaUrl() : null; $action = $isEdit ? route('admin.notification-center.update', $notification) : route('admin.notification-center.store'); @endphp @push('styles') @endpush @section('content') {{ __('admin.notification_center.back') }} @include('admin.partials.flash') {{-- multipart: the WhatsApp header image is a real file upload. --}}
@csrf @if ($isEdit) @method('PATCH') @endif {{-- โ”€โ”€ Basics โ”€โ”€ --}}

{{ __('admin.notification_center.compose') }}

{{ __('admin.notification_center.fields.title_hint') }} @error('title') {{ $message }} @enderror
{{-- โ”€โ”€ Delivery mode (Phase 2: Send Now | Schedule) โ”€โ”€ --}}

{{ __('admin.notification_center.delivery_mode') }}

@error('scheduled_date') {{ $message }} @enderror
@error('scheduled_time') {{ $message }} @enderror
@error('timezone') {{ $message }} @enderror
@error('delivery_mode') {{ $message }} @enderror

{{ __('admin.notification_center.schedule_note') }}

{{-- โ”€โ”€ Audience: Campaign Groups (PLT-CAMPAIGNS-001-C) โ”€โ”€ Replaces the former "Selected Groups" investor-group checkbox grid. A Campaign Group is a saved RULE SET, so the audience is re-resolved at send time โ€” the count shown here is a live preview, never what gets dispatched. --}}

{{ __('admin.campaign_groups.title') }}

{{ __('admin.notification_center.campaign_groups_hint') }}

@if ($legacyGroups->isNotEmpty()) {{-- Historical audience, shown read-only so editing a pre-Campaign-Groups campaign never silently loses it. --}}
{{ __('admin.notification_center.legacy_audience') }} {{ $legacyGroups->pluck('name')->join('ุŒ ') }}

{{ __('admin.notification_center.legacy_audience_hint') }}

@endif
@forelse ($campaignGroups as $cg) @empty {{ __('admin.notification_center.no_campaign_groups') }} @endforelse
@error('campaign_group_ids') {{ $message }} @enderror @error('campaign_group_ids.*') {{ $message }} @enderror {{-- Authoritative combined audience โ€” resolved server-side --}}
{{ __('admin.notification_center.unique_recipients') }}

{{-- The audience is re-resolved at execution, so a scheduled campaign will not necessarily send to this number. --}}

{{ __('admin.notification_center.audience_may_change') }}

{{-- โ”€โ”€ Channels โ”€โ”€ --}}

{{ __('admin.notification_center.notification_channels') }}

{{ __('admin.notification_center.channels_hint') }}

@foreach ($channelDefs as $channel => $icon)
{{ __('admin.notification_center.channels.' . $channel) }}
{{ __('admin.notification_center.channels.' . $channel . '_hint') }}
@if ($channel === 'email')
@error('email_subject') {{ $message }} @enderror
@elseif ($channel === 'sms')
{{ __('admin.notification_center.sms_body_hint') }}
@elseif ($channel === 'whatsapp')
{{ __('admin.notification_center.whatsapp_hint') }} @error('whatsapp_template_id') {{ $message }} @enderror
{{ __('admin.labels.whatsapp_placeholders_hint') }}
{{-- Header image โ€” required by templates whose HEADER is an image/video/document. Upload a file OR paste a public URL; the upload wins. Without it WhatsApp rejects every recipient of such a template. --}}
{{ __('admin.notification_center.whatsapp_media_hint') }} @if ($currentMedia) @endif @error('whatsapp_media') {{ $message }} @enderror @error('whatsapp_media_url') {{ $message }} @enderror
@endif {{-- Server-side dispatch-equivalent preview (shared service). --}}
@endforeach
@error('channels') {{ $message }} @enderror {{-- โ”€โ”€ Placeholders โ”€โ”€ --}}

{{ __('admin.notification_center.template_variables') }}

{{ __('admin.notification_center.template_variables_hint') }}

@forelse ($vars as $key) @empty {{ __('admin.notification_center.no_variables') }} @endforelse
{{ __('admin.actions.cancel') }}
@endsection @push('scripts') @endpush