{{-- Sendout rows of Dina utskick (#2957 slice 3a, card #3017). Included by sendout/index only. Expects: $data (paginator of Sendout), $archived (whether archived sendouts are included). Row actions, same routes, methods and conditions as the old "Välj funktion" dropdown: - Statistik (sendout.show) once the sendout is stopped or aborted; visible button. - Ändra utskicket (sendout.edit) with sendoutEdit while the start is more than 36 h away; visible button when there is no Statistik button, otherwise in "Mer". - Förhandsgranska (newsletter.parse, new tab) when the newsletter is from the current editor; "Mer". - Arkivera / Flytta från arkivet (PATCH sendout.archive, which toggles) with sendoutEdit once the sendout is stopped or aborted; "Mer". - Stoppa utskick (DELETE sendout.destroy) while neither stopped nor aborted; "Mer", danger, confirmed in the native dialog below as the old SweetAlert did (without script support it submits directly). --}} @php $data->appends(request()->query()); $data->loadMissing('newsletter'); $shortDate = fn ($date) => \App\Support\DisplayDate::timestamp($date); $editorVersion = (float) config('editor.newsletter_version'); @endphp {{ __('sendout.index.columnSubject') }}{{ __('sendout.index.columnStart') }}{{ __('sendout.index.columnActions') }} @foreach ($data as $sendout) @php $canEdit = auth()->user()->can('sendoutEdit', $sendout); $ended = ! is_null($sendout->abort_time) || ! is_null($sendout->stop_time); $editable = $canEdit && $sendout->start_time->copy()->subHours(36) > now(); $preview = ! is_null($sendout->newsletter) && (float) $sendout->newsletter->version >= $editorVersion; $editInMenu = $editable && $ended; $hasMenu = $editInMenu || $preview || ($canEdit && $ended) || ! $ended; $word = $sendout->statusLabelKey(); @endphp {{ $sendout->subject }}@if ($word){{ __($word) }}@endif @if ($ended) {{ __('sendout.statsBtn') }} @elseif ($editable) {{ __('sendout.edit') }} @endif @if ($hasMenu) @if ($editInMenu) {{ __('sendout.edit') }} @endif @if ($preview) {{ __('newsletter.preview') }} @endif @if ($canEdit && $ended)
@csrf @method('PATCH') @if ($sendout->archive_time) @else @endif
@endif @unless ($ended)
@csrf @method('DELETE')
@endunless
@endif
@endforeach {{ __($archived ? 'sendout.index.countArchived' : 'sendout.index.countActive', ['count' => formatNumber($data->total())]) }}
@include('sendout.partials.stop-dialog')