Fix: Corrected JavaScript syntax in project-map Blade template (selectFeature and window.openViewer calls). Feat: Enhanced templates page with clearer button text and explanatory text for generic template creation.

This commit is contained in:
2026-05-11 23:27:14 +02:00
parent 7959d44211
commit 53df28068c
2 changed files with 7 additions and 4 deletions
@@ -252,7 +252,7 @@
]; ];
@endphp @endphp
(function() { (function() {
const data = !!json_encode($fc)!!; const data = @json($fc);
if (data && data.features && data.features.length > 0) { if (data && data.features && data.features.length > 0) {
const phaseLayer = L.geoJSON(data, { const phaseLayer = L.geoJSON(data, {
style: { color: '{{ $phase->color }}', weight: 3, opacity: 0.8, fillOpacity: 0.3 }, style: { color: '{{ $phase->color }}', weight: 3, opacity: 0.8, fillOpacity: 0.3 },
@@ -262,7 +262,7 @@
let content = `<b>${props.name || 'Elemento'}</b><br> let content = `<b>${props.name || 'Elemento'}</b><br>
{{ __("Progress") }}: ${props.progress || 0}%<br> {{ __("Progress") }}: ${props.progress || 0}%<br>
{{ __("Responsible") }}: ${props.responsible || '-'}<br> {{ __("Responsible") }}: ${props.responsible || '-'}<br>
<button class="btn btn-xs btn-primary mt-1" onclick="selectFeature(${featId})">✏️ Editar</button>`; <button class="btn btn-xs btn-primary mt-1" onclick="selectFeature(' + featId + ')">✏️ Editar</button>`;
layer.bindPopup(content); layer.bindPopup(content);
layer.on('click', function() { selectFeature(featId); }); layer.on('click', function() { selectFeature(featId); });
} }
@@ -348,7 +348,7 @@
m.forEach(marker => { m.forEach(marker => {
const popupContent = `<b>${marker.name}</b><br> const popupContent = `<b>${marker.name}</b><br>
<img src="${marker.image_url}" class="max-w-[200px] max-h-[150px] rounded cursor-pointer" <img src="${marker.image_url}" class="max-w-[200px] max-h-[150px] rounded cursor-pointer"
onclick="window.openViewer('${marker.image_url}', '${marker.image_name}')" />`; onclick="window.openViewer(' + marker.image_url + ', ' + marker.image_name + ')" />`;
L.marker([marker.lat, marker.lng], { icon: photoIcon }) L.marker([marker.lat, marker.lng], { icon: photoIcon })
.bindPopup(popupContent) .bindPopup(popupContent)
.addTo(imageMarkersLayer); .addTo(imageMarkersLayer);
+4 -1
View File
@@ -2,8 +2,11 @@
<div class="mb-6"> <div class="mb-6">
<button wire:click="$emit('showTemplateForm')" <button wire:click="$emit('showTemplateForm')"
class="btn btn-primary btn-lg"> class="btn btn-primary btn-lg">
Nuevo template + Nuevo template de inspección
</button> </button>
<p class="text-sm text-muted mb-4">
Crea templates genéricos que puedan usarse en cualquier fase del proyecto
</p>
</div> </div>
<livewire/template-manager :project="$project" /> <livewire/template-manager :project="$project" />
</x-app-layout> </x-app-layout>