@extends('layouts.admin') @section('title', 'Existing Charging Points - EV Charging Network') @section('breadcrumb_title', 'Charging Points') @section('breadcrumb_sub_title', 'Existing Location') @section('page_title', 'Existing Charging Points Found') @section('content')
Existing Charging Points Found

We found {{ $chargingPointModels->count() }} charging point(s) within 50 meters of the specified location ({{ $latitude }}, {{ $longitude }}).

@foreach($chargingPointModels as $chargingPoint)
{{ $chargingPoint->name }}
Ref: {{ $chargingPoint->ref_no }}
Distance: {{ number_format(calculateDistance($latitude, $longitude, $chargingPoint->lattitude, $chargingPoint->longitude), 1) }}m

Status: @if($chargingPoint->status == 1) Verified @elseif($chargingPoint->status == 0) Under Review @elseif($chargingPoint->status == 4) Inactive @else Rejected @endif

@if($chargingPoint->description)

Description: {{ Str::limit($chargingPoint->description, 100) }}

@endif @if($chargingPoint->network)

Network: {{ $chargingPoint->network->name }}

@endif @if($chargingPoint->powerOutput)

Power Output: {{ $chargingPoint->powerOutput->name }}

@endif @if($chargingPoint->plugTypes->count() > 0)

Plug Types: @foreach($chargingPoint->plugTypes as $plugType) {{ $plugType->name }} ({{ $plugType->pivot->quantity }}) @if(!$loop->last), @endif @endforeach

@endif @if($chargingPoint->amenities->count() > 0)

Amenities: @foreach($chargingPoint->amenities as $amenity) {{ $amenity->name }} @if(!$loop->last), @endif @endforeach

@endif
@endforeach
@php function calculateDistance($lat1, $lon1, $lat2, $lon2) { $earthRadius = 6371000; // Earth's radius in meters $dLat = deg2rad($lat2 - $lat1); $dLon = deg2rad($lon2 - $lon1); $a = sin($dLat / 2) * sin($dLat / 2) + cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * sin($dLon / 2) * sin($dLon / 2); $c = 2 * atan2(sqrt($a), sqrt(1 - $a)); return $earthRadius * $c; } @endphp @endsection