{{-- SMS sendout rows of SMS-utskick (#2957 slice 5a, card #3019). Included by sms/index only. Expects: $data (paginator of SMSSendout with sent_count), $archived (whether archived ones are included). Row actions, same routes, methods, fields and conditions as the old icon buttons: - Visa (sms-sendout.show); visible button. - Arkivera / Flytta från arkivet (PUT sms-sendout.archive, field "archive", which toggles) once the sendout is done or aborted (statusType 3 or 0); "Mer". - Avbryt (PUT sms-sendout.abort, field "abort") while scheduled or sending (statusType 1 or 2); "Mer", danger, confirmed in the native dialog below. Both endpoints answer JSON, so the script below sends the forms with fetch, as the old jQuery did, and shows the answer as a toast. --}} @php $data->appends(request()->query()); $scriptText = [ 'failed' => __('sms.nhList.actionFailed'), 'aborted' => __('sms.status.aborted'), 'archive' => __('sms.archive'), 'unarchive' => __('sms.nhList.unarchive'), 'archiveUrl' => route('sms-sendout.archive'), ]; $shortDate = fn ($date) => \App\Support\DisplayDate::timestamp($date); @endphp {{ __('sms.index.title') }}{{ __('sms.index.starttime') }}{{ __('sms.nhList.columnActions') }} @foreach ($data as $smsSendout) @php $type = $smsSendout->statusType(); $archivable = $type === 3 || $type === 0; $abortable = $type === 1 || $type === 2; @endphp {{ $smsSendout->name }}@include('sms.partials.status-pill'){{ __('sms.nhList.sentCount', ['count' => formatNumber($smsSendout->sent_count)]) }} {{ __('sms.nhList.open') }} @if ($archivable || $abortable) @if ($archivable) @csrf @method('PUT') @if ($smsSendout->archive_time) {{ __('sms.nhList.unarchive') }} @else {{ __('sms.archive') }} @endif @endif @if ($abortable) @csrf @method('PUT') {{ __('sms.abort') }} @endif @endif @endforeach {{ __($archived ? 'sms.nhList.countArchived' : 'sms.nhList.countActive', ['count' => formatNumber($data->total())]) }} {{ __('sms.nhList.abortTitle') }} {{ __('sms.nhList.abortText') }} {{ __('sms.nhList.abortCancel') }} {{ __('sms.nhList.abortConfirm') }} @push('scripts') @endpush
{{ __('sms.nhList.abortText') }}