{{-- Utskick för samtycke form (DESIGN.md Page patterns 3; #2957 slice 3d, card #3017). Posts the same fields as the old form to sendout.consent: subject, start_time, sender_profile, language (se|en), content (TinyMCE HTML, bold and italic) and receiverList[] plus _token. SendoutController::consent() stores start_time as posted, so sendout-form.js writes it as "Y-m-d H:i:s" like the old datetimepicker did. The receivers step, the sender and time step, the summary and the dialog are shared with Skapa utskick (sendout/partials/nh-*.blade.php). The second form after the main one posts content and lang into the preview iframe, as before. --}} {{-- Shared data ($company, $senders, $lists, $checked, $scheduled, $i18n and more) comes from App\Support\SendoutFormData::forConsent(). --}} @php // The old select defaulted to the company's main language when that is "se" or "en", else to the first option. $languages = ['se' => 'languageSe', 'en' => 'languageEn']; $wantedLanguage = (string) (old('language') ?: $company->main_language_id); $selectedLanguage = array_key_exists($wantedLanguage, $languages) ? $wantedLanguage : 'se'; // The old consent form made no monthly limit check before sending. $emailLimit = null; $initialStep = $errors->has('subject') || $errors->has('content') || $errors->has('language') ? 'letter' : ($errors->has('receiverList') || $errors->has('receiverList.*') ? 'receivers' : ($errors->has('sender_profile') || $errors->has('start_time') ? 'sender' : 'letter')); @endphp
@csrf
@include('sendout.partials.nh-noscript')

{{ __('sendout.consent.letterStep') }}

{{ __('sendout.consent.letterHint') }}

{{ __('sendout.consent.languageQuestion') }}

@foreach ($languages as $code => $key) @endforeach
@error('language')

{{ $message }}

@enderror

{{ __('sendout.consent.previewTitle') }}

{{ __('sendout.consent.previewHint') }}

@include('sendout.partials.nh-receivers-step', ['step' => 2, 'text' => [ 'hint' => __('taggingSendout.consent.receiversHint'), 'listCount' => __('sendout.consent.listCount'), 'listNobody' => __('taggingSendout.consent.listNobody'), 'totalSkipped' => __('taggingSendout.consent.totalSkipped'), ]]) @include('sendout.partials.nh-sender-step', ['step' => 3])
@include('sendout.partials.nh-summary', [ 'items' => [ 'subject' => [__('sendout.consent.sumSubject'), old('subject') ?: null], 'receivers' => [__('sendout.create.sumReceivers'), $checked->isEmpty() ? null : ($audienceCounts === null ? __('taggingSendout.count.unavailable') : __($checked->count() === 1 ? 'taggingSendout.create.receiversValueOne' : 'taggingSendout.create.receiversValue', ['count' => formatNumber($checkedCount), 'lists' => $checked->count()]))], 'sender' => [__('sendout.create.sumSender'), optional($senders->firstWhere('id', $selectedSender))->name], 'when' => [__('sendout.create.sumWhen'), $scheduled ? null : __('sendout.create.asap')], ], 'testUrl' => null, 'stopHint' => __('sendout.consent.stopHint'), ])
@include('sendout.partials.nh-confirm-dialog') {{-- Posts the text and language into the preview iframe (NewsletterController::consentTemplate), as the old hidden form did. --}}