@extends('dashboard.admin.layouts.master') @php $t = fn (string $key, array $replace = []) => trans('core.notification_settings.' . $key, $replace); $matrix = [ ['doctor', 'database', 'doctor_in_app'], ['admins', 'database', 'admins_in_app'], ['patient', 'database', 'patient_in_app'], ['patient', 'push', 'patient_push'], ['patient', 'text', 'patient_text'], ]; $checked = fn (string $event, string $audience, string $channel) => (bool) old( "events.$event.$audience.$channel", data_get($config, "events.$event.$audience.$channel", false) ); $offsets = old('offsets') ?? collect($config['reminders']['offsets'])->map(fn ($minutes) => $minutes % 60 === 0 ? ['value' => $minutes / 60, 'unit' => 'hours'] : ['value' => $minutes, 'unit' => 'minutes'])->all(); $placeholders = ':patient :doctor :clinic :branch :date :time :type :site'; @endphp @section('toolbar')

{{ $t('title') }}

{{ $t('intro') }}
@endsection @section('content')
@if (session('success'))
{{ session('success') }}
@endif @if ($errors->any())
@endif {{-- Which providers are live, so the admin knows what "WhatsApp/SMS" and "push" will actually use --}}
@foreach ($providers as $channel => $provider)
{{ $t('providers') }} · {{ $t('channels.' . $channel) }}
@if ($provider)
{{ $provider->name }}
@else
{{ $t('provider_none') }}
@endif
{{ $t('configure') }}
@endforeach
@csrf @method('PUT')
{{-- Events × who × channel --}}
@foreach ($matrix as [$audience, $channel, $label]) @endforeach @foreach ($defaults['events'] as $event => $audiences) @foreach ($matrix as [$audience, $channel, $label]) @endforeach @endforeach
{{ $t('event') }}{{ $t($label) }}
{{ $t('events.' . $event) }} @if (array_key_exists($channel, $audiences[$audience] ?? []))
@else — @endif
{{-- Reminders --}}
@foreach (count($offsets) ? $offsets : [['value' => 24, 'unit' => 'hours']] as $offset)
@endforeach
@foreach (\App\Services\Notifications\NotificationSettings::REMINDER_TYPES as $type) @endforeach
{{ $t('include_pending_hint') }}
{{-- WhatsApp / SMS texts --}}
@foreach (\App\Services\Notifications\NotificationSettings::TEXT_CHANNEL_OPTIONS as $option) @endforeach
{!! str_replace(':placeholders', '' . e($placeholders) . '', e($t('texts_hint', ['placeholders' => ':placeholders']))) !!}
{{ $t('template_hint') }}
@foreach ($textKeys as $key)

{{ $t('texts.' . $key) }}

@foreach (['ar' => 'العربية', 'en' => 'English'] as $locale => $language)
@endforeach
@endforeach
{{-- Test send + delivery log (not part of the saved form) --}}
{{ $t('server_note') }}

{{ $t('test_title') }}

{{ $t('log_title') }}

{{ $t('log_date') }} {{ $t('test_channel') }} {{ $t('log_to') }} {{ $t('log_type') }} {{ $t('log_status') }} {{ $t('log_error') }}
@endsection @section('js') {!! $validator !!} @endsection