diff --git a/resources/views/currentcontracts/map.blade.php b/resources/views/currentcontracts/map.blade.php index 3ae7908..50d6132 100755 --- a/resources/views/currentcontracts/map.blade.php +++ b/resources/views/currentcontracts/map.blade.php @@ -1,5 +1,9 @@ @extends('layouts.app') +@push('styles') + @mapstyles +@endpush + @section('content') @if (Auth::user()->role_id >= 5)
@@ -33,28 +37,27 @@
@php - $markers=array(); - + $mapMarkers = []; foreach ($currentcontracts as $currentcontract) { - $markers[] = - [ - 'title' => $currentcontract->id, - 'lat' => $currentcontract->location->getLat(), - 'lng' => $currentcontract->location->getLng(), - 'popup' => '

' . $currentcontract->id . '

' . $currentcontract->address . - '
' . $currentcontract->suppliers->company_name ?? null . '
' . ucfirst($currentcontract->categories->name ?? null) . - '
' . $currentcontract->appointment . '
$' . $currentcontract->amount . '
' . ucfirst($currentcontract->status->name) . - '
' . $currentcontract->score . ' de 5

', - ]; + if ($currentcontract->location) { + $mapMarkers[] = [ + 'title' => $currentcontract->id, + 'lat' => $currentcontract->location->getLat(), + 'lng' => $currentcontract->location->getLng(), + 'popup' => '

' . $currentcontract->id . '

' . $currentcontract->address . + '
' . ($currentcontract->suppliers->company_name ?? '') . '
' . ucfirst($currentcontract->categories->name ?? '') . + '
' . $currentcontract->appointment . '
$' . $currentcontract->amount . '
' . ucfirst($currentcontract->status->name ?? '') . + '
' . $currentcontract->score . ' de 5

', + ]; + } } - $markers_json = str_replace(":", " => " ,str_replace("}", "]", str_replace("{", "[", json_encode($markers)))); @endphp @map([ 'lat' => 20.659698, 'lng' => -103.349609, 'zoom' => 12, - $markers_json + 'markers' => $mapMarkers ])