{{-- resources/views/points/public_show.blade.php --}} @extends('layouts.base') @push('styles') @endpush @php $token = $p->serial ?? null; $favoriteIds = []; if (auth()->check()) { // Récupère les IDs de points favoris de l'utilisateur connecté $favoriteIds = auth()->user() ->favoritePoints() ->pluck('points.id') // ou ->pluck('point_id') selon ta relation ->all(); } $isVisible = $p->is_visible ?? false; @endphp @section('title', isset($p?->name) ? ($p->name . (isset($p->serial) ? ' — '.$p->serial : '')) : __('Waypoint')) @php use Illuminate\Support\Str; use Illuminate\Support\Facades\Storage; $pt = $p ?? $point ?? null; $point = $pt; $locale = app()->getLocale(); $readonly = (bool)($readonly ?? false); if (count($availablePins) < 2) $pt->pin_icon = 'green_pin.png'; $photos = $p->photos ?? collect(); $canShare = auth()->check() && (int)auth()->id() === (int)$pt->user_id; // Icône actuelle (nom de fichier) $currentPin = $point?->pin_icon ?: 'green_pin.png'; // Contexte /wp/{token} (token public) ? $isTokenMode = request()->routeIs('points.public') || Str::contains(url()->current(), '/wp/'); // URL POST de sauvegarde d’icône (⚠️ routes doivent exister) $pinPostUrl = $isTokenMode ? route('points.pin.update.token', ['locale' => $locale, 'token' => $point->serial]) : route('points.pin.update.id', ['locale' => $locale, 'point' => $point->id]); // Liste des fichiers pin (fallback si le contrôleur n’a pas fourni) $pins = ($pins ?? $availablePins ?? null) ?: [ 'red_pin.png','green_pin.png','blue_pin.png','yellow_pin.png','purple_pin.png','orange_pin.png' ]; // Normalise les points pour la carte (et construit pin_url) $mapPoints = collect($mapPoints ?? [])->map(function($mp){ $mp = is_array($mp) ? (object)$mp : $mp; $file = $mp->pin_icon ?? 'green_pin.png'; $mp->pin_url = $mp->pin_url ?? asset('assets/pins/'.$file).'?v='.now()->timestamp; $mp->latitude = (float)($mp->latitude ?? 0); $mp->longitude = (float)($mp->longitude ?? 0); return $mp; })->values()->all(); $fullAddress = ''; if ($pt) { $parts = [ $pt->address1 ?? null, $pt->address2 ?? null, $pt->postcode ?? null, $pt->city ?? null, $pt->country_isocode ?? null, ]; $fullAddress = trim(implode(' ', array_filter($parts, fn($v) => is_string($v) && $v !== ''))); } @endphp {{-- Bottom Nav --}} {{-- 'bottomInfo' => [ 'label' => __('More informations'), 'target' => '#waypoint-details', // un id dans la page ], --}} @include('partials.bottom_nav', [ 'bottomTabs' => [ [ 'icon' => "to_picto.svg", 'label' => __('Join'), 'drawer' => 'maps', // ouvre le tiroir "maps" ], $canShare ? [ 'icon' => "sharing_picto.svg", 'label' => __('Sharing'), 'drawer' => 'share', ] : [ 'icon' => "sharing_picto.svg", 'label' => __('Sharing'), 'href' => lr('login'), ], [ 'icon' => "myV_picto.svg", 'label' => __('My waypoints'), 'href' => lr('search'), 'primary' => false, ], ], ]) @section('head') {{-- Meta CSRF correcte --}} {{-- Leaflet CSS (une seule fois) --}} @endsection @section('content') @if(!$pt)
{{ $serialToken ?? '—' }}