@extends('layouts.admin') @section('title', __('admin.notifications')) @section('breadcrumb', __('admin.group.settings')) @section('content')
{{-- ---------------------------------------------------------- channels --}}
@include('admin.partials.grid-toolbar', [ 'action' => route('admin.notifications.index'), 'search' => $search, 'placeholder' => __('admin.search_channel'), 'count' => $channels->count(), 'addTarget' => 'create-channel', 'addLabel' => __('admin.new_channel'), 'filters' => [ [ 'name' => 'status', 'label' => __('admin.status'), 'value' => $status, 'options' => [ 'all' => __('admin.all'), 'active' => __('admin.active'), 'inactive' => __('admin.inactive'), ], ], [ 'name' => 'driver', 'label' => __('admin.driver'), 'value' => $driver, 'options' => ['all' => __('admin.all_drivers')] + $drivers, ], ], ])

{{ __('admin.support_alerts') }}

{{ __('admin.support_alerts_help') }}

@if ($supportChoice === 'off') {{ __('admin.support_off_help') }} @else {{ __('admin.support_always_inapp') }} {{ __('admin.support_alerts_limited') }} @endif @if (! $supportEmailAvailable) {{ __('admin.support_email_unavailable') }} @endif @if (! $supportSmsAvailable) {{ __('admin.support_sms_unavailable') }} @endif
@php($supportBothNames = collect([$supportEmailName, $supportSmsName])->filter()->implode(' + '))
@csrf @method('put')
@forelse ($channels as $channel) @php($modalId = 'edit-channel-'.$channel->id) @php($endpoint = $channel->configValue('endpoint')) @php($host = $endpoint ? parse_url($endpoint, PHP_URL_HOST) : null) @php($driver = $channel->driver) @php($emailTransport = $channel->configValue('transport') ?: config('mail.default', 'smtp')) @php($gateway = in_array($driver, ['sms_http', 'kurdisoft'], true) ? ($host ?: '—') : match ($driver) { 'twilio' => 'api.twilio.com', 'whatsapp' => 'graph.facebook.com', default => $channel->configValue('host') ?: __('admin.email'), }) @php($contactLabel = match ($driver) { 'kurdisoft' => __('admin.device_number'), 'twilio' => __('admin.from_number'), 'whatsapp' => __('admin.whatsapp_phone_id'), default => __('admin.sender'), }) @php($contactValue = $channel->configValue('sender') ?: $channel->configValue('from') ?: $channel->configValue('phone_id') ?: '—') @php($lastTest = $testResults->get($channel->code))
{{ mb_strtoupper(mb_substr($channel->name, 0, 2)) }}
{{ $channel->name }} {{ $channel->code }} · {{ $channel->driver_label }}
{{ $channel->is_active ? __('admin.active') : __('admin.inactive') }}
{{ __('admin.gateway') }} {{ $gateway }}
@if ($driver === 'email')
{{ __('admin.transport') }} {{ ucfirst($emailTransport) }}{{ $channel->configValue('encryption') ? ' · '.strtoupper($channel->configValue('encryption')) : '' }}
{{ __('admin.from_address') }} {{ $channel->configValue('from_address') ?: config('mail.from.address', '—') }}
{{ __('admin.subject') }} {{ $channel->configValue('subject') ?: '—' }}
@else @if ($driver !== 'sms_http')
{{ $contactLabel }} {{ $contactValue }}
@endif @if (in_array($driver, ['sms_http', 'kurdisoft'], true))
{{ __('admin.method') }} {{ $channel->configValue('method', 'POST') }}
@endif @endif
{{ __('admin.connection') }} @if ($lastTest) {{ $lastTest->status === 'sent' ? __('admin.connected') : __('admin.connection_failed') }} {{ $lastTest->created_at->format('d/m H:i') }} @else {{ __('admin.not_tested') }} @endif
{{ __('admin.admin_alerts') }} {{ count((array) $channel->configValue('admin_ids', [])) ?: '—' }}
@csrf
@csrf
@csrf @method('delete')
@csrf @method('put') @if ($errors->any() && old('_modal') === $modalId)
@foreach ($errors->all() as $error)
{{ $error }}
@endforeach
@endif @include('admin.notifications.channel-fields', ['channel' => $channel])
@php($testEmail = $channel->driver === 'email')
@csrf

{{ $testEmail ? __('admin.test_email_help') : __('admin.test_sms_help') }}

{{ __('admin.test_help') }}

@empty
{{ __('admin.no_results') }} {{ __('admin.no_results_help') }}
@endforelse
{{ __('admin.channel_usage') }}

{{ __('admin.channel_usage_help') }}

@csrf @if ($errors->any() && old('_modal') === 'create-channel')
@foreach ($errors->all() as $error)
{{ $error }}
@endforeach
@endif @include('admin.notifications.channel-fields', ['channel' => null])
{{-- --------------------------------------------------------- templates --}} {{-- --------------------------------------------------------------- logs --}}
@endsection @push('scripts') @endpush