{{-- ============================================================
Global Search results view — shown only while an active
search/filter is applied. Normal Account Closure page
content (below) is hidden while this is visible, and
restored once the search box + filters are cleared.
============================================================ --}}
Search Results
View
#
User Name
Subject
Assignee
Email Received Date
Status
Priority
Internal Thread
Action
View Form
Loading...
No results found.
Items per page:
Page 1 of 1
{{-- ============================================================
Normal Account Closure page content (unchanged) — hidden
while a search/filter is active above.
============================================================ --}}
Account Closure OTL Forms
@php
// ---- Process checks (step 2: FSA user, step 3: outstanding earnings) ----
// Run once for ALL rows (3 queries total) instead of once per row.
$__DB = \Illuminate\Support\Facades\DB::class;
$__uids = collect($data)->pluck('userID')->filter()->unique()->values()->all();
// Users that have fraud flags
$__flagged = $__DB::table('flag_comment')
->whereIn('uid', $__uids)
->whereIn('flagtype', ['FraudStrike', 'fraud_streaming'])
->distinct()->pluck('uid')->map(fn ($v) => (string) $v)->all();
// ...of those, the ones whose fraud flags are all cleared (=> fsacheck 'No')
$__cleared = $__DB::table('users')
->whereIn('uid', $__flagged)
->where('possible_fraud', 0)
->where('under_investigation', 0)
->where('paypal_issue', 0)
->where('indianpaypal', 0)
->where('fraud_streaming', 0)
->where(function ($q) { $q->whereNull('bank_transfer')->orWhere('bank_transfer', 0); })
->where('uk_vat_flag', 0)
->pluck('uid')->map(fn ($v) => (string) $v)->all();
// FSA users = flagged and not cleared (=> fsacheck 'Yes')
$__fsaUsers = array_values(array_diff($__flagged, $__cleared));
// Outstanding earnings per uid
$__outstanding = $__DB::table('user_account_report')
->whereIn('uid', $__uids)
->select('uid', 'outstand_amount')
->get()->groupBy('uid')
->map(fn ($rows) => (float) ($rows->first()->outstand_amount ?? 0))->all();
// Forms that have at least one Slack message (comm_slack) - one query for all rows
$__slackForms = $__DB::table('comm_slack')
->whereIn('form_id', collect($data)->pluck('form_id')->filter()->unique()->values()->all())
->pluck('form_id')->map(fn ($v) => (string) $v)->unique()->values()->all();
@endphp