@extends('layouts.admin') @section('title', 'Notification Templates') @section('page-title', 'Notification Templates') @section('content')
{{-- Header card --}}

Push Notification Templates

Manage the messages that are sent automatically to users' devices when key events occur. Use {name}, {plan}, {expires_at}, {days}, {email} as dynamic placeholders.

@if(session('success'))

{{ session('success') }}

@endif @if(session('error'))

{{ session('error') }}

@endif
{{-- Manual Broadcast --}}

Send Manual Notification

Broadcast a custom push notification to all or specific users.

@if(!$pushReady)

Firebase is not configured. Manual notifications cannot be sent until FCM is set up in Settings.

@endif
@csrf
@error('title')

{{ $message }}

@enderror
@error('image_url')

{{ $message }}

@enderror
@error('body')

{{ $message }}

@enderror
{{-- Target selection --}}
@error('target')

{{ $message }}

@enderror
{{-- User multi-select (shown only for "selected") --}}
@foreach($users as $user) @endforeach
@error('user_ids')

{{ $message }}

@enderror
{{-- Template cards --}} @foreach(\App\Models\NotificationTemplate::EVENTS as $event => $meta) @php $tpl = $templates[$event] ?? null; @endphp
{{-- Card header --}}
{{-- Enabled / disabled indicator --}} @if($tpl && $tpl->is_enabled) @else @endif

{{ $meta['label'] }}

{{ $meta['desc'] }}

@if($tpl)

{{ $event }}

@endif
@if($tpl) {{-- Toggle enabled/disabled --}}
@csrf
@endif {{-- Expand/collapse --}}
{{-- Preview strip (collapsed) --}} @if($tpl)

Title

{{ $tpl->title }}

Body

{{ $tpl->body }}

@endif {{-- Edit panel (expanded) --}}
@if($tpl)
@csrf @method('PUT')
@error('title')

{{ $message }}

@enderror
@error('image_url')

{{ $message }}

@enderror
@error('body')

{{ $message }}

@enderror
{{-- Available variables cheatsheet --}}

Available placeholders

@foreach(\App\Models\NotificationTemplate::VARIABLES as $var => $desc) {{ $var }} @endforeach
{{-- Test send --}} @if($devices->isNotEmpty())
@csrf
@endif
@else

This template has not been created yet. Run php artisan migrate to seed the default templates.

@endif
@endforeach
@endsection