@extends('layouts.app') @section('title', ($location['name'] ?? 'Location Details') . (!empty($location['postalAddressTownCity']) ? ' - ' . $location['postalAddressTownCity'] : '')) @section('meta_description') @if ($location) @php $locationName = $location['name'] ?? 'this facility'; $locationType = strtolower($location['type'] ?? 'healthcare location'); $locationCity = $location['postalAddressTownCity'] ?? ($location['postalAddressCounty'] ?? ($location['localAuthority'] ?? '')); $locationRating = $location['currentRatings']['overall']['rating'] ?? ($location['assessment'][0]['ratings']['overall'][0]['rating'] ?? null); $locationBeds = $location['numberOfBeds'] ?? null; $locationStatus = $location['registrationStatus'] ?? 'Registered'; $desc = "CQC registration and performance profile for {$locationName}"; if ($locationCity) { $desc .= " in {$locationCity}"; } $desc .= " ({$locationType})."; if ($locationRating) { $desc .= " Rated '{$locationRating}' overall by inspectors."; } if ($locationBeds && $locationBeds > 0) { $desc .= " Features {$locationBeds} registered beds."; } $desc .= " Status: {$locationStatus}. View contact info, inspection history, and download PDF reports."; echo e($desc); @endphp @else Explore detailed registry info, registration status, ratings and PDF reports for this CQC location. @endif @endsection @section('content') @if (!empty($location['onspdLatitude']) && !empty($location['onspdLongitude'])) @endif
Back to Locations Directory @if (app()->environment('local', 'dev')) View Raw JSON (Dev) @endif
@if ($error)

Error Loading Details

{{ $error }}

@endif @if ($location) @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 = $location['currentRatings']['overall']['rating'] ?? ($location['assessment'][0]['ratings']['overall'][0]['rating'] ?? null); $keyQuestionRatings = $location['currentRatings']['overall']['keyQuestionRatings'] ?? ($location['assessment'][0]['ratings']['overall'][0]['keyQuestions'] ?? []); $inspectionDate = $location['lastInspection']['date'] ?? ($location['assessment'][0]['ratings']['overall'][0]['commentaryDate'] ?? ($location['currentRatings']['overall']['reportDate'] ?? null)); $publishedDate = $location['lastReport']['publicationDate'] ?? ($location['assessment'][0]['ratings']['overall'][0]['commentaryDate'] ?? null); // Normalize lists to always be arrays of records (handling nested structure variations) $groupsList = []; if (!empty($assessmentServiceGroups)) { if (isset($assessmentServiceGroups['assessmentServiceGroup'])) { $groupsList = $assessmentServiceGroups['assessmentServiceGroup']; } elseif (isset($assessmentServiceGroups['assessmentServiceGroups'])) { $groupsList = $assessmentServiceGroups['assessmentServiceGroups']; } elseif (is_array($assessmentServiceGroups)) { if (array_is_list($assessmentServiceGroups)) { $groupsList = $assessmentServiceGroups; } else { $groupsList = [$assessmentServiceGroups]; } } } $areasList = []; if (!empty($inspectionAreas)) { if (isset($inspectionAreas['inspectionAreas'])) { $areasList = $inspectionAreas['inspectionAreas']; } elseif (isset($inspectionAreas['inspectionArea'])) { $areasList = $inspectionAreas['inspectionArea']; } elseif (is_array($inspectionAreas)) { if (array_is_list($inspectionAreas)) { $areasList = $inspectionAreas; } else { $areasList = [$inspectionAreas]; } } } $providerAreasList = []; if (!empty($providerInspectionAreas)) { if (isset($providerInspectionAreas['providerInspectionAreas'])) { $providerAreasList = $providerInspectionAreas['providerInspectionAreas']; } elseif (isset($providerInspectionAreas['providerInspectionArea'])) { $providerAreasList = $providerInspectionAreas['providerInspectionArea']; } elseif (is_array($providerInspectionAreas)) { if (array_is_list($providerInspectionAreas)) { $providerAreasList = $providerInspectionAreas; } else { $providerAreasList = [$providerInspectionAreas]; } } } @endphp
Location ID: {{ $location['locationId'] }} @if (!empty($location['providerId'])) Parent Provider Profile @endif @if (!empty($location['odsCode'])) ODS: {{ $location['odsCode'] }} @endif {{ $location['type'] ?? 'Healthcare Location' }}

{{ $location['name'] }}

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

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

@endif @if (!empty($location['brandName']))

Part of brand: {{ $location['brandName'] }}

@endif @if (!empty($location['inspectionDirectorate']))
Directorate: {{ $location['inspectionDirectorate'] }}
@endif @if (!empty($location['locationTypes']))
@foreach ($location['locationTypes'] as $lt) {{ $lt['type'] ?? 'General Type' }} @endforeach
@endif
@php $status = strtolower($location['registrationStatus'] ?? 'Unknown'); $isRegistered = $status === 'registered'; $statusClass = $isRegistered ? 'bg-[#009639]/10 text-[#009639] ring-[#009639]/20' : 'bg-[#DA291C]/10 text-[#DA291C] ring-[#DA291C]/20'; @endphp {{ $location['registrationStatus'] ?? 'Unknown Status' }} Registered: {{ isset($location['registrationDate']) ? date('d M Y', strtotime($location['registrationDate'])) : 'N/A' }} @if (!empty($location['deregistrationDate'])) Deregistered: {{ date('d M Y', strtotime($location['deregistrationDate'])) }} @endif @if (strtolower($location['dormancy'] ?? '') === 'y') Temporarily Dormant @if (!empty($location['dormancyStartDate'])) Dormant since: {{ date('d M Y', strtotime($location['dormancyStartDate'])) }} @endif @if (!empty($location['dormancyEndDate'])) Dormancy ended: {{ date('d M Y', strtotime($location['dormancyEndDate'])) }} @endif @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
@endif

Administrative & Contact Details

Address Details
{{ $location['postalAddressLine1'] ?? '' }}
@if (!empty($location['postalAddressLine2'])) {{ $location['postalAddressLine2'] }}
@endif @if (!empty($location['postalAddressTownCity'])) {{ $location['postalAddressTownCity'] }}
@endif @if (!empty($location['postalAddressCounty'])) {{ $location['postalAddressCounty'] }}
@endif @if (!empty($location['postalCode'])) {{ $location['postalCode'] }} @endif
Website
@if (!empty($location['website'])) @php $url = $location['website']; if ( !str_starts_with($url, 'http://') && !str_starts_with($url, 'https://') ) { $url = 'https://' . $url; } @endphp {{ $location['website'] }} @else N/A @endif
Main Phone Number
@if (!empty($location['mainPhoneNumber'])) {{ $location['mainPhoneNumber'] }} @else N/A @endif
Constituency
{{ $location['constituency'] ?? 'N/A' }}
Local Authority
{{ $location['localAuthority'] ?? 'N/A' }}
@if (!empty($location['region']))
Region
{{ $location['region'] }}
@endif @if (!empty($location['uprn']))
UPRN
{{ $location['uprn'] }}
@endif @if (!empty($location['providerId'])) @endif @if (!empty($location['onspdCcgName']) || !empty($location['odsCcgName']))
NHS CCG Coverage
{{ $location['onspdCcgName'] ?? $location['odsCcgName'] }} @if (!empty($location['onspdCcgCode']) || !empty($location['odsCcgCode'])) ({{ $location['onspdCcgCode'] ?? $location['odsCcgCode'] }}) @endif
@endif
Integrated Care Board (ICB)
{{ $location['onspdIcbName'] ?? 'N/A' }} @if (!empty($location['onspdIcbCode'])) ({{ $location['onspdIcbCode'] }}) @endif
Care Home Classification
{{ ($location['careHome'] ?? '') === 'Y' ? 'Yes (Care Home Facility)' : 'No' }}
Registered Beds Capacity
{{ $location['numberOfBeds'] ?? 0 }} beds
Last Inspection Date
@if (!empty($location['lastInspection']['date'])) {{ date('d M Y', strtotime($location['lastInspection']['date'])) }} @else N/A @endif
@if (!empty($location['registeredManagerAbsentDate']))
Manager Status
Registered Manager absent since {{ date('d M Y', strtotime($location['registeredManagerAbsentDate'])) }}
@endif
@if (!empty($location['regulatedActivities']))

Regulated Activities & Registered Managers

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

{{ $activity['name'] }}

@if (!empty($activity['contacts']))
Staff / Managers:
@foreach ($activity['contacts'] as $contact)
{{ $contact['personTitle'] ?? '' }} {{ $contact['personGivenName'] ?? '' }} {{ $contact['personFamilyName'] ?? '' }} @if (!empty($contact['personRoles'])) {{ implode(', ', $contact['personRoles']) }} @endif
@endforeach
@else

No nominated manager listed for this activity.

@endif
@endforeach
@endif @if (!empty($location['relationships']))

Predecessor Histories

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

{{ $rel['relatedLocationName'] }}

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

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

{{ $rel['reason'] }}

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

Location Map

Coordinates: {{ $location['onspdLatitude'] }}, {{ $location['onspdLongitude'] }}
@endif @if (!empty($location['gacServiceTypes']) || !empty($location['specialisms']))
@if (!empty($location['gacServiceTypes']))

Service Types

@foreach ($location['gacServiceTypes'] as $st) {{ $st['name'] }} @endforeach
@endif @if (!empty($location['specialisms']))

Specialisms

@foreach ($location['specialisms'] as $sp) {{ $sp['name'] }} @endforeach
@endif
@endif @if (!empty($location['inspectionCategories']))

Inspection Categories

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

Inspection Reports

@foreach ($location['reports'] as $rep) @if (!empty($rep['reportDate']))
{{ $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
@endif @endforeach
@endif
@if (!empty($groupsList) && count($groupsList) > 0)

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

@foreach ($groupsList as $group)
{{ $group['assessmentServiceId'] ?? 'Service Group' }} @if (isset($group['status'])) {{ $group['status'] }} @endif

{{ $group['assessmentServiceName'] ?? 'Unnamed Service' }}

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

Started: {{ date('d M Y', strtotime($group['startDate'])) }}

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

Active Inspection Areas {{ count($areasList) }} areas

@foreach ($areasList as $area)
ID: {{ $area['inspectionAreaId'] }}

{{ $area['inspectionAreaName'] }}

Status: {{ $area['status'] ?? 'Active' }}
@endforeach
@endif @if (!empty($providerAreasList) && count($providerAreasList) > 0)

Parent Provider Assessment Areas {{ count($providerAreasList) }} areas

@foreach ($providerAreasList as $pArea)
{{ $pArea['inspectionAreaId'] }}
@if (!empty($pArea['reports']))
Inspections: @foreach ($pArea['reports'] as $pRep)
Inspection: {{ $pRep['inspectionId'] ?? 'N/A' }} @if (!empty($pRep['reportLinkId'])) PDF Report @endif
@endforeach
@endif
@endforeach
@endif
@endif @endsection