@php $d = $breakdown['irs_data']; $components = $breakdown['components']; $suggested = $breakdown['suggested']; $identitySuggested = $breakdown['identity_suggested']; $integrityDefault = $breakdown['integrity_default'] ?? null; $matchedKws = $d['matched_keywords'] ?? []; $badge = fn($bool, $yes='Yes', $no='No') => '' .($bool ? $yes : $no).''; // Highlight keywords in a text string $highlight = function(string $text) use ($d): string { $allKws = array_column($d['matched_keywords'] ?? [], 'keyword'); if (empty($allKws)) return e($text); $pattern = '/\b(' . implode('|', array_map('preg_quote', $allKws)) . ')\b/i'; return preg_replace_callback($pattern, function($m) { return '' . e($m[0]) . ''; }, e($text)); }; $strongKws = array_filter($matchedKws, fn($k) => $k['weight'] === 2); $moderateKws = array_filter($matchedKws, fn($k) => $k['weight'] === 1); @endphp
{{-- Identity Section --}}
Identity
{{-- Name with keyword highlighting --}}
Organization Name
{!! $highlight($d['name'] ?? '') !!}
{{-- Mission --}} @if($d['mission'])
Mission
{!! $highlight($d['mission']) !!}
@endif {{-- Program descriptions --}} @foreach(['program_desc1','program_desc2','program_desc3'] as $i => $field) @if($d[$field])
Program {{ $i + 1 }}
{!! $highlight($d[$field]) !!}
@endif @endforeach {{-- Status badges --}}
501(c)(3): {!! $badge($d['is_501c3']) !!}
Schedule A filed: {!! $badge($d['schedule_a_filed']) !!}
Church-like entity: {!! $badge($d['is_church_like']) !!} (501c3 without Sched A)
{{-- Keyword matches --}} @if(count($matchedKws) > 0)
Keyword Matches
@foreach($matchedKws as $kw) @endforeach
Keyword Source Strength Points
{{ $kw['keyword'] }} {{ $kw['source'] }} {{ $kw['weight'] === 2 ? 'Strong' : 'Moderate' }} +{{ $kw['weight'] }}
@else
No religious keywords found in name, mission, or program descriptions.
@endif
{{-- Categories from regulator classification --}} @if(!empty($d['categories']))
Regulator Classification
@foreach((array) $d['categories'] as $cat) @php $isHit = in_array($cat, (array) ($d['category_hits'] ?? []), true); @endphp {{ $cat }} @endforeach
@endif {{-- Integrity Section --}}
Integrity (AAA R2-Integrity-C)
Manual review required — not auto-scored. Evaluate truthfulness of fundraising claims, "% to beneficiaries" statements, donation anchors, investment policy. While integrity is unset, the R2 total uses AAA's neutral 25/50 default (carries through to composite at low confidence). Enter a value in the integrity input to override.
{{-- Methodology callout --}}
Methodology
@foreach($components as $comp) @endforeach
Component Max Earned Notes
{{ $comp['label'] }} {{ $comp['max'] }} {{ $comp['earned'] === null ? 'N/A' : $comp['earned'] }} {{ $comp['explanation'] }}
Suggested Identity: {{ $identitySuggested }}/50
Suggested total (with 25 integrity default): {{ $suggested }}