@if($type === 'local_newsletter') {{ __('Sent to users based on their location preferences') }} @elseif($type === 'general_newsletter') {{ __('Sent to all subscribed users and organizations') }} @elseif($type === 'general_newsletter_only') {{ __('Sent to profiles subscribed to the General Newsletter but not to the Local Newsletter') }} @elseif($type === 'system_message') {{ __('System announcements and important notices') }} @else {{ __('Please select a mailing type to continue') }} @endif

{{ __('Add Posts') }}
@if(empty($selectedPosts))

{{ __('No posts selected yet') }}

@else
@foreach($selectedPosts as $index => $post)
{{ $post['order'] }}

{{ $post['title'] }}

Post ID: {{ $post['post_id'] }}

@if (in_array($post['post_id'], $limitedPollPostIds ?? []))

{{ __('This poll is only for some members. Recipients outside its audience will see it in the mailing but cannot take part.') }}

@endif
@if($index > 0) @endif @if($index < count($selectedPosts) - 1) @endif
@endforeach
@endif
@if(!empty($selectedPosts))

{{ __('Enter subject lines for each language based on your selected posts') }}

@foreach($availableLocales as $locale) @php $isRequired = in_array($locale, $requiredLocales); @endphp
{{ strtoupper($locale) }} ({{ $locale === 'en' ? 'English' : ($locale === 'nl' ? 'Nederlands' : ($locale === 'de' ? 'Deutsch' : ($locale === 'es' ? 'Español' : ($locale === 'fr' ? 'Français' : $locale)))) }}) @if($locale === timebank_config('base_language', 'en')) {{ __('Primary') }} @endif @if($isRequired) {{ __('Required') }} @else {{ __('Optional') }} @endif
@endforeach
@endif
@if($filterByProfileType)

{{ __('Select which profile types should receive this mailing. You can select multiple types.') }}

@if(count($selectedProfileTypes) > 0)
@foreach($selectedProfileTypes as $profileType) @switch($profileType) @case('User') {{ __('Users') }} @break @case('Organization') {{ __('Organizations') }} @break @case('Bank') {{ __('Banks') }} @break @case('Admin') {{ __('Admins') }} @break @endswitch @endforeach
@endif

{{ __('Tip: Hold Ctrl (Windows/Linux) or Cmd (Mac) while clicking to select multiple profile types') }}

@if(count($selectedProfileTypes) > 0)

{{ __('Filtering by :count profile type(s)', ['count' => count($selectedProfileTypes)]) }}

@endif
@endif
@if($filterByContacts)

{{ __('Only send to profiles that have transactions with the selected profile(s). The selected contacts will also be included.') }}

@if(count($selectedContactProfiles) > 0)
@foreach($selectedContactProfiles as $index => $contactProfile)
{{ $contactProfile['name'] }}
@php $contactMeta = implode(' · ', array_filter([$contactProfile['description'] ?? '', $contactProfile['location'] ?? ''])); @endphp @if($contactMeta)
{{ $contactMeta }}
@endif
@endforeach
@endif
@endif
@if($type === 'local_newsletter')
@if($filterByLocation)

{{ __('Select a location to filter recipients. Only profiles with their primary location in the selected area will receive this mailing.') }}

@if(count($selectedCountryIds) > 0 || count($selectedDivisionIds) > 0 || count($selectedCityIds) > 0 || count($selectedDistrictIds) > 0) @php $locationFilteredCount = collect($this->getCurrentRecipientCountsByLocale())->sum('count'); @endphp

{{ __('Estimated recipients with location filter: :count', ['count' => number_format($locationFilteredCount)]) }}

@endif
@endif
@endif
@if(empty($fallbackEligibleLocales))

{{ __('Select posts first to see available fallback languages.') }}

@else @foreach($fallbackEligibleLocales as $locale) @php $localeInfo = config('laravellocalization.supportedLocales.' . $locale); @endphp @endforeach @endif

{{ __('Estimated Recipients') }}

@if($type)

{{ __('messages.mailings.recipients_info.' . $type) }} @if($filterByLocation && (count($selectedCountryIds) > 0 || count($selectedDivisionIds) > 0 || count($selectedCityIds) > 0 || count($selectedDistrictIds) > 0))
{{ __('messages.mailings.recipients_info.location_filtering_active') }} @endif

@else

{{ __('messages.mailings.recipients_info.no_type_selected') }}

@endif @if($type) @php $currentRecipientCount = collect($this->getCurrentRecipientCountsByLocale())->where('has_content', true)->sum('count'); @endphp @if($currentRecipientCount > 0)

{{ __('Current estimated recipients: :count', ['count' => number_format($currentRecipientCount)]) }}

@endif @else

{{ __('Current estimated recipients: 0') }}

@endif @if($type)

{{ __('Recipients by Language & Content') }}

@php $rowsByLocaleLocation = $this->getCurrentRecipientCountsByLocaleAndLocation(); @endphp @if(count($rowsByLocaleLocation) > 0) @php $prevLocale = null; $fallbackLanguageName = \App\Models\Language::where('lang_code', $fallbackLocale)->value('name') ?? strtoupper($fallbackLocale); @endphp @foreach($rowsByLocaleLocation as $row) @php $isFirstForLocale = $row['locale'] !== $prevLocale; $prevLocale = $row['locale']; $language = $isFirstForLocale ? \App\Models\Language::where('lang_code', $row['locale'])->first() : null; $flag = $language ? $language->flag : '🏳️'; $languageName = $language ? $language->name : strtoupper($row['locale']); $nativePosts = $row['content_blocks'] - ($row['fallback_posts'] ?? 0); $fallbackPosts = $row['fallback_posts'] ?? 0; $missingPosts = $row['missing_posts'] ?? 0; @endphp {{-- Col 1: Language — only on first row for this locale --}} {{-- Col 2: Posts — only on first row for this locale --}} {{-- Col 3: Location --}} {{-- Col 4: Recipients --}} @endforeach
{{ __('Language') }} {{ __('Posts') }} {{ __('Location') }} {{ __('Recipients') }}
@if($isFirstForLocale) {{ $flag }} {{ $languageName }} @endif @if($isFirstForLocale) @if($nativePosts > 0) {{ $nativePosts }} {{ __('native') }} @endif @if($fallbackPosts > 0) {{ $fallbackPosts }} {{ __('fallback in') }} {{ $fallbackLanguageName }} @endif @if($missingPosts > 0) {{ $missingPosts }} {{ __('skipped') }} @endif @if($nativePosts === 0 && $fallbackPosts === 0) {{ __('No content') }} @endif @endif {{ $row['location'] ?: __('Unknown') }} {{ number_format($row['count']) }}
@php $totalRecipients = collect($rowsByLocaleLocation)->sum('count'); $skippedRecipients = collect($rowsByLocaleLocation)->where('has_content', false)->sum('count'); $incompleteRecipients = collect($rowsByLocaleLocation)->where('has_content', true)->where('all_posts', false)->sum('count'); $suppressedCount = $this->getCurrentSuppressedCount(); @endphp
{{ __('Total recipients:') }} {{ number_format($totalRecipients) }}
@if($suppressedCount > 0)
{{ __('Skipped (hard bounce):') }} {{ number_format($suppressedCount) }}
@endif {{-- Recipients skipped entirely (zero posts) --}} @if($skippedRecipients > 0) @if($fallbackLocale)

{{ __('Some recipients will not receive the mailing because no content exists in their language or the fallback language.') }}

@else

{{ __(':count recipient(s) will be skipped — no content in their language.', ['count' => number_format($skippedRecipients)]) }}

{{ __('Set a fallback language above to include them.') }}

@endif @endif {{-- Recipients who get the mailing but miss some posts --}} @if($incompleteRecipients > 0 && !$fallbackLocale)

{{ __(':count recipient(s) will not receive all posts — some are missing a translation in their language.', ['count' => number_format($incompleteRecipients)]) }}

{{ __('Set a fallback language above to include the missing posts.') }}

@endif
@else

{{ __('No recipients found for this mailing type.') }}

@endif
@endif