From 09a37c08a3a29f8663be719bcb7f4ba29622ab4f Mon Sep 17 00:00:00 2001 From: CarlosTorres Date: Mon, 19 Jan 2026 02:33:22 +0000 Subject: [PATCH] Fix map views for gonoware/laravel-maps compatibility - Add @push('styles') with @mapstyles to map views - Fix markers parameter format (pass as 'markers' array, not string) - Add null checks for location data - Add @stack('styles') to layout for conditional style loading Co-Authored-By: Claude Opus 4.5 --- .../views/currentcontracts/map.blade.php | 31 ++++++++++--------- .../views/finishedcontracts/map.blade.php | 31 ++++++++++--------- resources/views/layouts/app.blade.php | 2 +- resources/views/postulations/map.blade.php | 29 +++++++++-------- 4 files changed, 51 insertions(+), 42 deletions(-) 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 ])