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 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,9 @@
|
|||||||
@extends('layouts.app')
|
@extends('layouts.app')
|
||||||
|
|
||||||
|
@push('styles')
|
||||||
|
@mapstyles
|
||||||
|
@endpush
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
@if (Auth::user()->role_id >= 5)
|
@if (Auth::user()->role_id >= 5)
|
||||||
<div class="container-fluid" style="height:100%">
|
<div class="container-fluid" style="height:100%">
|
||||||
@@ -33,28 +37,27 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
@php
|
@php
|
||||||
$markers=array();
|
$mapMarkers = [];
|
||||||
|
|
||||||
foreach ($currentcontracts as $currentcontract) {
|
foreach ($currentcontracts as $currentcontract) {
|
||||||
$markers[] =
|
if ($currentcontract->location) {
|
||||||
[
|
$mapMarkers[] = [
|
||||||
'title' => $currentcontract->id,
|
'title' => $currentcontract->id,
|
||||||
'lat' => $currentcontract->location->getLat(),
|
'lat' => $currentcontract->location->getLat(),
|
||||||
'lng' => $currentcontract->location->getLng(),
|
'lng' => $currentcontract->location->getLng(),
|
||||||
'popup' => '<h3>' . $currentcontract->id . '</h3><p>' . $currentcontract->address .
|
'popup' => '<h3>' . $currentcontract->id . '</h3><p>' . $currentcontract->address .
|
||||||
'<br>' . $currentcontract->suppliers->company_name ?? null . '<br>' . ucfirst($currentcontract->categories->name ?? null) .
|
'<br>' . ($currentcontract->suppliers->company_name ?? '') . '<br>' . ucfirst($currentcontract->categories->name ?? '') .
|
||||||
'<br>' . $currentcontract->appointment . '<br>$' . $currentcontract->amount . '<br>' . ucfirst($currentcontract->status->name) .
|
'<br>' . $currentcontract->appointment . '<br>$' . $currentcontract->amount . '<br>' . ucfirst($currentcontract->status->name ?? '') .
|
||||||
'<br>' . $currentcontract->score . ' de 5</p>',
|
'<br>' . $currentcontract->score . ' de 5</p>',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
$markers_json = str_replace(":", " => " ,str_replace("}", "]", str_replace("{", "[", json_encode($markers))));
|
}
|
||||||
@endphp
|
@endphp
|
||||||
|
|
||||||
@map([
|
@map([
|
||||||
'lat' => 20.659698,
|
'lat' => 20.659698,
|
||||||
'lng' => -103.349609,
|
'lng' => -103.349609,
|
||||||
'zoom' => 12,
|
'zoom' => 12,
|
||||||
$markers_json
|
'markers' => $mapMarkers
|
||||||
])
|
])
|
||||||
|
|
||||||
<ul class="pagination">
|
<ul class="pagination">
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
@extends('layouts.app')
|
@extends('layouts.app')
|
||||||
|
|
||||||
|
@push('styles')
|
||||||
|
@mapstyles
|
||||||
|
@endpush
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
@if (Auth::user()->role_id >= 5)
|
@if (Auth::user()->role_id >= 5)
|
||||||
<div class="container-fluid" style="height:100%">
|
<div class="container-fluid" style="height:100%">
|
||||||
@@ -33,28 +37,27 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
@php
|
@php
|
||||||
$markers=array();
|
$mapMarkers = [];
|
||||||
|
|
||||||
foreach ($finishedcontracts as $finishedcontract) {
|
foreach ($finishedcontracts as $finishedcontract) {
|
||||||
$markers[] =
|
if ($finishedcontract->location) {
|
||||||
[
|
$mapMarkers[] = [
|
||||||
'title' => $finishedcontract->id,
|
'title' => $finishedcontract->id,
|
||||||
'lat' => $finishedcontract->location->getLat(),
|
'lat' => $finishedcontract->location->getLat(),
|
||||||
'lng' => $finishedcontract->location->getLng(),
|
'lng' => $finishedcontract->location->getLng(),
|
||||||
'popup' => '<h3>' . $finishedcontract->id . '</h3><p>' . $finishedcontract->address .
|
'popup' => '<h3>' . $finishedcontract->id . '</h3><p>' . $finishedcontract->address .
|
||||||
'<br>' . $finishedcontract->suppliers->company_name ?? null . '<br>' . ucfirst($finishedcontract->categories->name ?? null) .
|
'<br>' . ($finishedcontract->suppliers->company_name ?? '') . '<br>' . ucfirst($finishedcontract->categories->name ?? '') .
|
||||||
'<br>' . $finishedcontract->appointment . '<br>$' . $finishedcontract->amount . '<br>' . ucfirst($finishedcontract->status->name) .
|
'<br>' . $finishedcontract->appointment . '<br>$' . $finishedcontract->amount . '<br>' . ucfirst($finishedcontract->status->name ?? '') .
|
||||||
'<br>' . $finishedcontract->score . ' de 5</p>',
|
'<br>' . $finishedcontract->score . ' de 5</p>',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
$markers_json = str_replace(":", " => " ,str_replace("}", "]", str_replace("{", "[", json_encode($markers))));
|
}
|
||||||
@endphp
|
@endphp
|
||||||
|
|
||||||
@map([
|
@map([
|
||||||
'lat' => 20.659698,
|
'lat' => 20.659698,
|
||||||
'lng' => -103.349609,
|
'lng' => -103.349609,
|
||||||
'zoom' => 12,
|
'zoom' => 12,
|
||||||
$markers_json
|
'markers' => $mapMarkers
|
||||||
])
|
])
|
||||||
|
|
||||||
<ul class="pagination">
|
<ul class="pagination">
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<link href="{{ asset('css/app.css') }}" rel="stylesheet">
|
<link href="{{ asset('css/app.css') }}" rel="stylesheet">
|
||||||
<link href="{{ asset('css/bootstrap-tagsinput.css') }}" rel="stylesheet">
|
<link href="{{ asset('css/bootstrap-tagsinput.css') }}" rel="stylesheet">
|
||||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
|
||||||
@mapstyles
|
@stack('styles')
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app" style="height: 100%">
|
<div id="app" style="height: 100%">
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
@extends('layouts.app')
|
@extends('layouts.app')
|
||||||
|
|
||||||
|
@push('styles')
|
||||||
|
@mapstyles
|
||||||
|
@endpush
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
@if (Auth::user()->role_id >= 5)
|
@if (Auth::user()->role_id >= 5)
|
||||||
<div class="container-fluid" style="height:100%">
|
<div class="container-fluid" style="height:100%">
|
||||||
@@ -32,27 +36,26 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@php
|
@php
|
||||||
$markers=array();
|
$mapMarkers = [];
|
||||||
|
|
||||||
foreach ($postulations as $postulation) {
|
foreach ($postulations as $postulation) {
|
||||||
$markers[] =
|
if ($postulation->location) {
|
||||||
[
|
$mapMarkers[] = [
|
||||||
'title' => $postulation->id,
|
'title' => $postulation->id,
|
||||||
'lat' => $postulation->location->getLat(),
|
'lat' => $postulation->location->getLat(),
|
||||||
'lng' => $postulation->location->getLng(),
|
'lng' => $postulation->location->getLng(),
|
||||||
'popup' => '<h3>' . $postulation->id . '</h3><p>' . $postulation->address .
|
'popup' => '<h3>' . $postulation->id . '</h3><p>' . $postulation->address .
|
||||||
'<br>' . ucfirst($postulation->categories->name ?? null) .
|
'<br>' . ucfirst($postulation->categories->name ?? '') .
|
||||||
'<br>' . $postulation->appointment . '<br>' . $postulation->amount . '</p>',
|
'<br>' . $postulation->appointment . '<br>' . $postulation->amount . '</p>',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
$markers_json = str_replace(":", " => " ,str_replace("}", "]", str_replace("{", "[", json_encode($markers))));
|
}
|
||||||
@endphp
|
@endphp
|
||||||
|
|
||||||
@map([
|
@map([
|
||||||
'lat' => 20.659698,
|
'lat' => 20.659698,
|
||||||
'lng' => -103.349609,
|
'lng' => -103.349609,
|
||||||
'zoom' => 12,
|
'zoom' => 12,
|
||||||
$markers_json
|
'markers' => $mapMarkers
|
||||||
])
|
])
|
||||||
|
|
||||||
<ul class="pagination">
|
<ul class="pagination">
|
||||||
|
|||||||
Reference in New Issue
Block a user