{{--
Ändra mottagarlista body (#2957 slice 4c, card #3018). Included by receiverList/edit.
Expects: $receiver_list, $data (paginator of the list's receivers with pivot status and
complaints_count), $receiverStats and $blacklistedReceivers (keyed by receiver id), $sendout
(true while a running or planned sendout uses the list), $filter, and optionally $sendouts.
Same routes, methods and field names as before:
- PUT receiverlist.update: name, comment, status (checked posts 0 = hidden list).
- DELETE receiverlist.destroy: "Ta bort listan", confirmed in a native dialog.
- GET receiverlist.edit: q, subscribed, itemsPerPage and statFilter[i][type|operator|quantity].
- DELETE receiverlist.destroy.receivers: receivers[], delete (1 = also delete the receivers),
all (1 = every receiver of the list matching the filter) and the active q and subscribed.
Selection, dialogs and filter rows: resources/assets/js/nuhet/receiver-lists.js.
Fixed on the way: a hidden list was re-shown on every save (its checkbox posted status=1);
the checkbox now always posts 0, as on Skapa mottagarlista.
--}}
@php
$private = old() ? old('status') === '0' : $receiver_list->status == 0;
$query = (string) request('q', '');
$subscribed = (string) request('subscribed', '0');
// Rows without a type or a value filter nothing (the old Vue form always sent one blank row).
$statFilters = array_values(array_filter((array) request('statFilter', []), fn ($row) => is_array($row)
&& (string) ($row['type'] ?? '') !== '' && (string) ($row['quantity'] ?? '') !== ''));
$filtered = $query !== '' || $subscribed !== '0' || $statFilters !== [] || request('hard_bounce') == 1;
$statFilterRows = $statFilters ?: [['type' => null, 'operator' => 'gt', 'quantity' => null]];
$total = $data->total();
$data->appends(array_merge(request()->query(), ['tab' => 'receivers']));
$activeTagTab = $activeTagTab ?? 'details';
$filterOpen = $subscribed !== '0' || $statFilters !== [] || request('hard_bounce') == 1;
@endphp