@php $d = $breakdown['irs_data']; $components = $breakdown['components']; $method = $breakdown['method']; $suggested = $breakdown['suggested']; $confidence = $breakdown['confidence'] ?? null; $needScore = $breakdown['need_score'] ?? null; $countryPts = $breakdown['country_pts'] ?? null; $directPts = $breakdown['direct_pts'] ?? null; $modifier = $d['activity_modifier'] ?? 0; $fmt = fn($v) => $v !== null ? '$' . number_format($v) : '—'; $pct = fn($v) => $v !== null ? $v . '%' : '—'; $source = strtoupper((string) ($charity->data_source ?? 'IRS')); $schedule = $source === 'CRA' ? 'Schedule 2' : 'Schedule F'; $methodCopy = match ($method) { 'regions_recipient_count' => 'Need score weighted by the number of recipients in each region (' . $schedule . ' Part III). Regions with more recipients pull the score toward their own median-income–based need.', 'regions_amount' => 'Need score weighted by the dollar amount sent to each region (' . $schedule . ' Parts II + III). Regions receiving more money have more influence.', 'country_codes' => 'Each country listed on ' . $schedule . ' weighted equally. Need per country = min(100, 50,000 ÷ median income).', 'ccew_equal_weight_country' => 'CCEW publishes no spend split by country, so each declared area of operation is weighted equally. Need per country = min(100, 50,000 ÷ median income).', 'foreign_no_geography' => 'Foreign activity flagged but no per-region or per-country data is reported — cannot assess recipient poverty. R3 is omitted from the composite.', 'domestic_only' => 'Domestic-only charity — out of AAA international-poverty scope. R3 is omitted from the composite.', 'not_applicable' => 'R3 not applicable.', default => 'Need score = min(100, 50,000 ÷ median income), then weighted by available data.', }; $regionRows = $d['region_details'] ?? []; $countryRows = $d['country_details'] ?? []; usort($regionRows, fn($a, $b) => $b['need_score'] <=> $a['need_score']); usort($countryRows, fn($a, $b) => $b['need_score'] <=> $a['need_score']); $hasRegions = !empty($regionRows); $hasCountries = !empty($countryRows); $omitted = in_array($method, ['foreign_no_geography', 'domestic_only', 'not_applicable'], true); $needBar = fn($v) => max(2, min(100, (float) $v)); // Re-derive direct-bonus sub-points for the breakdown display. $ratioPts = ($d['total_expenses'] ?? 0) > 0 ? round(min(15, ($d['grants_paid'] / $d['total_expenses']) * 15), 1) : 0; $indivPts = $d['grants_to_individuals'] ? 15 : 0; @endphp
{{ $methodCopy }}
@unless($omitted)Score = need × 70% + direct beneficiary bonus (up to 30) + activity-keyword modifier (−5 to +8). Lower median income → higher need → higher score.
@endunless| Component | Max | Earned | Calculation |
|---|---|---|---|
| {{ $c['label'] }} | {{ $c['max'] }} | {{ $c['earned'] === null ? 'N/A' : $c['earned'] }} | {{ $c['explanation'] }} |
| Region | Median Income | Amount | Recipients | Need Score |
|---|---|---|---|---|
| {{ $r['region'] }} | ${{ number_format($r['median_income']) }} | {{ ($r['amount'] ?? 0) > 0 ? $fmt((int) $r['amount']) : '—' }} | {{ ($r['recipients'] ?? 0) > 0 ? number_format($r['recipients']) : '—' }} |
|
| Country Code | Median Income | Need Score |
|---|---|---|
| {{ $r['code'] }} | ${{ number_format($r['median_income']) }} |
|
Country codes follow each regulator's convention (IRS Schedule F = FIPS; CCEW / CRA = ISO or full names). FIPS codes differ from ISO (e.g. UK = United Kingdom, IZ = Iraq, JA = Japan).
@if($method === 'foreign_no_geography') Foreign activities are flagged, but no per-region or per-country data was filed. R3 is omitted from the composite. @elseif($method === 'domestic_only') This organization does not report foreign activities — domestic-only, out of AAA scope. R3 is omitted from the composite. @else No recipient geography data available. @endif
| {{ $schedule }} Filed | {{ $d['schedule_f_filed'] ? 'Yes' : 'No' }} | |
| Foreign Activities Flag | {{ $d['foreign_activities'] ? 'Yes' : 'No' }} | |
| Foreign Expenditures | {{ $fmt($d['foreign_expenditures']) }} | |
| Grants Paid | {{ $fmt($d['grants_paid']) }} | {{ $pct($d['grant_ratio_pct']) }} of expenses |
| Grants to Individuals | {{ $d['grants_to_individuals'] ? 'Yes' : 'No' }} | |
| Total Expenses | {{ $fmt($d['total_expenses']) }} | |
| Country Codes |
@foreach($d['foreign_countries'] as $cc)
{{ $cc }}
@endforeach
|
|