@extends('layouts.app') @section('title', ($provider['name'] ?? 'Provider Details') . ' - Healthcare Directory') @section('meta_description') @if($provider) @php $providerName = $provider['name'] ?? 'this provider'; $providerType = strtolower($provider['organisationType'] ?? $provider['type'] ?? 'healthcare provider'); $providerCity = $provider['postalAddressTownCity'] ?? $provider['postalAddressCounty'] ?? ''; $providerRating = $provider['currentRatings']['overall']['rating'] ?? $provider['assessment'][0]['ratings']['overall'][0]['rating'] ?? null; $providerLocationsCount = count($provider['locationIds'] ?? $locations ?? []); $providerStatus = $provider['registrationStatus'] ?? 'Registered'; $desc = "CQC registration and performance profile for {$providerName}"; if ($providerCity) { $desc .= " in {$providerCity}"; } $desc .= " ({$providerType})."; if ($providerRating) { $desc .= " Rated '{$providerRating}' overall by inspectors."; } if ($providerLocationsCount > 0) { $desc .= " Manages {$providerLocationsCount} registered " . ($providerLocationsCount === 1 ? 'location' : 'locations') . "."; } $desc .= " Status: {$providerStatus}. View registered services, inspection reports, and CQC PDF downloads."; echo e($desc); @endphp @else Explore detailed registry info, registration status, and PDF reports for this CQC healthcare provider. @endif @endsection @section('content') @if(!empty($provider['onspdLatitude']) && !empty($provider['onspdLongitude'])) @endif
Back to Providers Directory @if(app()->environment('local', 'dev')) View Raw JSON (Dev) @endif
@if($error)

Error Loading Details

{{ $error }}

@endif @if($provider) @php // Official CQC Rating colors as solid background panels with white text $getRatingClass = function($rating) { return match(strtolower($rating ?? '')) { 'outstanding' => 'bg-[#8A1551] text-white border-transparent', 'good' => 'bg-[#00825F] text-white border-transparent', 'requires improvement' => 'bg-[#D47A00] text-white border-transparent', 'inadequate' => 'bg-[#B30000] text-white border-transparent', default => 'bg-[#50555C] text-white border-transparent' }; }; $overallRating = $provider['currentRatings']['overall']['rating'] ?? $provider['assessment'][0]['ratings']['overall'][0]['rating'] ?? null; $keyQuestionRatings = $provider['currentRatings']['overall']['keyQuestionRatings'] ?? $provider['assessment'][0]['ratings']['overall'][0]['keyQuestions'] ?? []; $inspectionDate = $provider['lastInspection']['date'] ?? $provider['assessment'][0]['ratings']['overall'][0]['commentaryDate'] ?? $provider['currentRatings']['overall']['reportDate'] ?? null; $publishedDate = $provider['lastReport']['publicationDate'] ?? $provider['assessment'][0]['ratings']['overall'][0]['commentaryDate'] ?? null; // Normalize assessmentServiceGroups list (handling singular/plural keys robustly) $groupsList = []; if (!empty($assessmentServiceGroups)) { if (isset($assessmentServiceGroups['assessmentServiceGroups'])) { $groupsList = $assessmentServiceGroups['assessmentServiceGroups']; } elseif (isset($assessmentServiceGroups['assessmentServiceGroup'])) { $groupsList = $assessmentServiceGroups['assessmentServiceGroup']; } elseif (is_array($assessmentServiceGroups)) { if (array_is_list($assessmentServiceGroups)) { $groupsList = $assessmentServiceGroups; } else { $groupsList = [$assessmentServiceGroups]; } } } @endphp
Provider ID: {{ $provider['providerId'] }} @if(!empty($provider['odsCode'])) ODS Code: {{ $provider['odsCode'] }} @endif {{ $provider['type'] ?? $provider['organisationType'] ?? 'Healthcare Provider' }}

{{ $provider['name'] }}

@if(!empty($provider['alsoKnownAs']))

Also known as: {{ $provider['alsoKnownAs'] }}

@endif
@if(!empty($provider['inspectionDirectorate'])) Directorate: {{ $provider['inspectionDirectorate'] }} @endif
@php $status = strtolower($provider['registrationStatus'] ?? 'Unknown'); $isRegistered = $status === 'registered'; $statusClass = $isRegistered ? 'bg-[#009639]/10 text-[#009639] ring-[#009639]/20' : 'bg-[#DA291C]/10 text-[#DA291C] ring-[#DA291C]/20'; @endphp {{ $provider['registrationStatus'] ?? 'Unknown Status' }} Registered: {{ isset($provider['registrationDate']) ? date('d M Y', strtotime($provider['registrationDate'])) : 'N/A' }} @if(!empty($provider['deregistrationDate'])) Deregistered: {{ date('d M Y', strtotime($provider['deregistrationDate'])) }} @endif
@if($overallRating)

Current Care Quality Commission (CQC) Ratings

Overall Rating {{ $overallRating }}
@if(!empty($inspectionDate))

Inspected: {{ date('d M Y', strtotime($inspectionDate)) }}

@endif @if(!empty($publishedDate))

Published: {{ date('d M Y', strtotime($publishedDate)) }}

@endif

Key Questions Assessment

@foreach($keyQuestionRatings as $kq)
{{ $kq['name'] }} {{ $kq['rating'] }}
@endforeach
@if(isset($provider['currentRatings']['overall']['useOfResources']))
Use of Resources Rating: {{ $provider['currentRatings']['overall']['useOfResources']['useOfResourcesRating'] }}
@endif
@endif

Administrative & Contact Details

Postal Address
{{ $provider['postalAddressLine1'] ?? '' }}
@if(!empty($provider['postalAddressLine2'])) {{ $provider['postalAddressLine2'] }}
settings @endif @if(!empty($provider['postalAddressTownCity'])) {{ $provider['postalAddressTownCity'] }}
@endif @if(!empty($provider['postalAddressCounty'])) {{ $provider['postalAddressCounty'] }}
@endif @if(!empty($provider['postalCode'])) {{ $provider['postalCode'] }} @endif
@if(!empty($provider['mainPhoneNumber'])) @endif
Website
@if(!empty($provider['website'])) @php $url = $provider['website']; if (!str_starts_with($url, 'http://') && !str_starts_with($url, 'https://')) { $url = 'https://' . $url; } @endphp {{ $provider['website'] }} @else N/A @endif
Geocoordinates & UPRN
@if(isset($provider['onspdLatitude']) && isset($provider['onspdLongitude'])) Lat: {{ $provider['onspdLatitude'] }}, Lng: {{ $provider['onspdLongitude'] }} @else N/A @endif @if(!empty($provider['uprn'])) UPRN: {{ $provider['uprn'] }} @endif
Constituency
{{ $provider['constituency'] ?? 'N/A' }}
Local Authority
{{ $provider['localAuthority'] ?? 'N/A' }}
@if(!empty($provider['region']))
Region
{{ $provider['region'] }}
@endif
Integrated Care Board (ICB)
{{ $provider['onspdIcbName'] ?? 'N/A' }} @if(!empty($provider['onspdIcbCode'])) ({{ $provider['onspdIcbCode'] }}) @endif
Ownership / Brand
{{ $provider['ownershipType'] ?? 'N/A' }} @if(!empty($provider['brandName'])) Brand: {{ $provider['brandName'] }} @endif
Last Provider Inspection
@if(!empty($provider['lastInspection']['date'])) {{ date('d M Y', strtotime($provider['lastInspection']['date'])) }} @else N/A @endif
@if(!empty($provider['companiesHouseNumber']))
Companies House Number
{{ $provider['companiesHouseNumber'] }}
@endif @if(!empty($provider['charityNumber']))
Registered Charity Number
{{ $provider['charityNumber'] }}
@endif @if(!empty($provider['contacts']))
Key Contacts / Partners
@foreach($provider['contacts'] as $contact)
{{ $contact['personTitle'] ?? '' }} {{ $contact['personGivenName'] ?? '' }} {{ $contact['personFamilyName'] ?? '' }} @if(!empty($contact['personRoles'])) {{ implode(', ', $contact['personRoles']) }} @endif
@endforeach
@endif
@if(!empty($provider['regulatedActivities']))

Regulated Activities

@foreach($provider['regulatedActivities'] as $activity)
{{ $activity['code'] }}

{{ $activity['name'] }}

@if(!empty($activity['nominatedIndividual']))
Nominated Individual {{ $activity['nominatedIndividual']['personTitle'] ?? '' }} {{ $activity['nominatedIndividual']['personGivenName'] ?? '' }} {{ $activity['nominatedIndividual']['personFamilyName'] ?? '' }}
@endif
@endforeach
@endif @if(!empty($provider['relationships']))

Predecessor Histories

@foreach($provider['relationships'] as $rel)

{{ $rel['relatedProviderName'] }}

ID: {{ $rel['relatedProviderId'] }}

{{ $rel['type'] ?? 'Related' }} @if(!empty($rel['reason']))

{{ $rel['reason'] }}

@endif
@endforeach
@endif
@if(!empty($provider['onspdLatitude']) && !empty($provider['onspdLongitude']))

Provider Map

Coordinates: {{ $provider['onspdLatitude'] }}, {{ $provider['onspdLongitude'] }}
@endif

Registered Locations {{ !empty($locations) ? count($locations) : count($provider['locationIds'] ?? []) }} total

@php $hasFullLocations = !empty($locations) && is_array($locations) && count($locations) > 0; $displayLocations = $hasFullLocations ? $locations : ($provider['locationIds'] ?? []); @endphp @if(count($displayLocations) > 0)
@foreach($displayLocations as $loc) @php $isFullLoc = is_array($loc); $locId = $isFullLoc ? ($loc['locationId'] ?? $loc['organisationId'] ?? '') : $loc; $locName = $isFullLoc ? ($loc['locationName'] ?? $loc['name'] ?? null) : null; $locPostcode = $isFullLoc ? ($loc['postalCode'] ?? null) : null; @endphp
{{ $locId }} @if($locPostcode) {{ $locPostcode }} @endif
@if($locName)

{{ $locName }}

@else

Location Details ({{ $locId }})

@endif
@endforeach
@else
No registered locations
@endif
@if(!empty($provider['inspectionCategories']))

Inspection Categories

    @foreach($provider['inspectionCategories'] as $cat)
  • {{ $cat['code'] }} {{ $cat['name'] }} @if(($cat['primary'] ?? '') === 'true' || ($cat['primary'] ?? '') === 'Y') Primary @endif
  • @endforeach
@endif @if(!empty($provider['reports']))

Inspection Reports

@foreach($provider['reports'] as $rep)
{{ $rep['reportType'] ?? 'Report' }} Published {{ date('d M Y', strtotime($rep['reportDate'])) }}
@php $linkId = $rep['linkId'] ?? basename(explode('?', $rep['reportUri'])[0]); @endphp @if(!empty($linkId)) PDF @endif
@endforeach
@endif
@if(!empty($groupsList) && count($groupsList) > 0)

CQC Assessment Service Groups {{ count($groupsList) }} groups

@foreach($groupsList as $group)
{{ $group['domain'] ?? 'Service Domain' }} @if(isset($group['overallRating'])) {{ $group['overallRating'] }} @endif

{{ $group['name'] ?? $group['assessmentServiceGroup'] ?? 'Unnamed Group' }}

@if(!empty($group['description']))

{{ $group['description'] }}

@endif
@endforeach
@endif @if(!empty($locations) && is_array($locations) && count($locations) > 0)

Detailed Location Insights Profile data for registered facilities

@php $hasFullLocations = false; @endphp @foreach($locations as $loc) @php $locId = $loc['locationId'] ?? $loc['organisationId'] ?? 'Unknown'; $isPlaceholder = empty($loc['type']) && empty($loc['registrationStatus']); if (!$isPlaceholder) { $hasFullLocations = true; } @endphp @if(!$isPlaceholder)
ID: {{ $locId }} @if(!empty($loc['odsCode'])) ODS: {{ $loc['odsCode'] }} @endif @if(!empty($loc['type'])) {{ $loc['type'] }} @endif

{{ $loc['name'] ?? 'Unnamed Location' }}

Address

{{ $loc['postalAddressLine1'] ?? '' }}@if(!empty($loc['postalAddressLine2'])), {{ $loc['postalAddressLine2'] }}@endif
{{ $loc['postalAddressTownCity'] ?? '' }}@if(!empty($loc['postalAddressCounty'])), {{ $loc['postalAddressCounty'] }}@endif
{{ $loc['postalCode'] ?? '' }}

@php $locOverallRating = $loc['currentRatings']['overall']['rating'] ?? null; @endphp
CQC Rating @if($locOverallRating) {{ $locOverallRating }} @else Not Rated @endif
Status @php $locStatus = strtolower($loc['registrationStatus'] ?? 'unknown'); $isLocReg = $locStatus === 'registered'; $locStatusClass = $isLocReg ? 'bg-[#009639]/10 text-[#009639] border-[#009639]/20' : 'bg-[#DA291C]/10 text-[#DA291C] border-[#DA291C]/20'; @endphp {{ $loc['registrationStatus'] ?? 'Unknown' }}
Registered: {{ isset($loc['registrationDate']) ? date('d M Y', strtotime($loc['registrationDate'])) : 'N/A' }} View Profile
@endif @endforeach
@endif
@endif @endsection