Files
CarlosTorres 09a37c08a3 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>
2026-01-19 02:33:22 +00:00

68 lines
2.2 KiB
PHP
Executable File

@extends('layouts.app')
@push('styles')
@mapstyles
@endpush
@section('content')
@if (Auth::user()->role_id >= 5)
<div class="container-fluid" style="height:100%">
@include('sidebar')
<div style="width:90%; float: left; margin:1em 0 0 1em">
@else
<div class="container" style="margin:0 1em">
@endif
<div class="row">
<div class="col-sm-7">
<h3>Contratos actuales</h3>
</div>
<div class="col-sm-5">
<div class="pull-right">
{!! Form::open(['method'=>'GET','url'=>'currentcontracts','class'=>'navbar-form navbar-left','role'=>'search']) !!}
<div class="input-group">
<input class="form-control" id="search"
value="{{ request()->session()->get('search') }}"
placeholder="Buscar" name="search"
type="text" id="search"/>
<div class="input-group-btn">
<button type="submit" class="btn btn-primary">
<i class="fa fa-search" aria-hidden="true"></i>
</button>
</div>
</div>
{!! Form::close() !!}
</div>
</div>
</div>
@php
$mapMarkers = [];
foreach ($currentcontracts as $currentcontract) {
if ($currentcontract->location) {
$mapMarkers[] = [
'title' => $currentcontract->id,
'lat' => $currentcontract->location->getLat(),
'lng' => $currentcontract->location->getLng(),
'popup' => '<h3>' . $currentcontract->id . '</h3><p>' . $currentcontract->address .
'<br>' . ($currentcontract->suppliers->company_name ?? '') . '<br>' . ucfirst($currentcontract->categories->name ?? '') .
'<br>' . $currentcontract->appointment . '<br>$' . $currentcontract->amount . '<br>' . ucfirst($currentcontract->status->name ?? '') .
'<br>' . $currentcontract->score . ' de 5</p>',
];
}
}
@endphp
@map([
'lat' => 20.659698,
'lng' => -103.349609,
'zoom' => 12,
'markers' => $mapMarkers
])
<ul class="pagination">
{{ $currentcontracts->links() }}
</ul>
</div>
@endsection