@use('App\Models\CharityDocument') @props(['charity']) @php // Documents hang off (country_code, registration_number), so this is the // same set whichever tax-year row the page happens to be rendering. // publicUrl() is what decides between the charity's own server, a copy // held here, and a file only ever uploaded here — a row that points // nowhere yet is simply not shown. $documents = CharityDocument::forCharity($charity) ->get() ->filter(fn ($document) => $document->publicUrl() !== null); // Grouped in the order CharityDocument::TYPES declares, not the order the // rows came back in: annual reports are what a reader came for. $groups = collect(CharityDocument::TYPES) ->map(fn ($label, $type) => $documents->where('type', $type)->values()) ->filter(fn ($group) => $group->isNotEmpty()); $anyHeldHere = $documents->contains(fn ($document) => $document->isServedLocally()); @endphp @if ($groups->isNotEmpty())
@if ($anyHeldHere) Published by the charity itself. Where a copy is held on this site it is stored unchanged, so the link survives the original being moved or taken down — the original address is linked alongside it. @else Published by the charity itself and linked here unchanged — ARK AID does not host these files. @endif