Aggiungi campi per immagini e diametro del foro nel modello Articolo e nelle relative migrazioni; aggiorna i form e le viste per gestire i nuovi campi

This commit is contained in:
2026-05-18 16:23:12 +02:00
parent f3a1d816b7
commit 83412247a7
11 changed files with 373 additions and 33 deletions

View File

@@ -1,3 +1,4 @@
@use('Illuminate\Support\Facades\Storage')
<!DOCTYPE html>
<html lang="it">
<head>
@@ -5,13 +6,15 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{ $articolo->codice_articolo }} - HTT Locator</title>
<script src="https://cdn.tailwindcss.com"></script>
<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script>
<style>
.gradient-bg {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
[x-cloak] { display: none !important; }
</style>
</head>
<body class="bg-gray-100 min-h-screen">
<body class="bg-gray-100 min-h-screen" x-data="{ modalImg: null }">
<!-- Header -->
<header class="gradient-bg text-white py-4 px-4 shadow-lg">
<div class="max-w-lg mx-auto">
@@ -35,7 +38,7 @@
</div>
<!-- Ubicazione -->
<div class="bg-white rounded-2xl shadow-lg overflow-hidden mb-6">
<div class="bg-white rounded-2xl shadow-lg overflow-hidden mb-2">
<div class="px-4 py-3 bg-gray-50 border-b">
<h3 class="font-semibold text-gray-700 flex items-center">
<svg class="w-5 h-5 mr-2 text-blue-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
@@ -46,12 +49,26 @@
</h3>
</div>
<div class="divide-y">
@if($articolo->immagine_articolo)
<div class="flex justify-between items-center px-4 py-3">
<span class="text-gray-500 text-sm">Immagine</span>
<img src="{{ Storage::url($articolo->immagine_articolo) }}" alt="Immagine Articolo"
class="h-12 w-12 object-cover rounded cursor-pointer hover:opacity-80 transition-opacity"
@click="modalImg = '{{ Storage::url($articolo->immagine_articolo) }}'">
</div>
@endif
@if($articolo->ciclo)
<div class="flex justify-between items-center px-4 py-3">
<span class="text-gray-500 text-sm">Ciclo</span>
<span class="font-medium text-gray-900">{{ $articolo->ciclo }}</span>
</div>
@endif
@if($articolo->hole_diameter)
<div class="flex justify-between items-center px-4 py-3">
<span class="text-gray-500 text-sm">Hole Diameter</span>
<span class="font-medium text-gray-900">{{ $articolo->hole_diameter }}</span>
</div>
@endif
@if($articolo->diametro)
<div class="flex justify-between items-center px-4 py-3">
<span class="text-gray-500 text-sm">Diametro</span>
@@ -121,12 +138,28 @@
<span class="font-medium text-gray-900">{{ $articolo->max_thrust_a }}</span>
</div>
@endif
@if($articolo->immagine_thrust)
<div class="flex justify-between items-center px-4 py-3">
<span class="text-gray-500 text-sm">Immagine Thrust</span>
<img src="{{ Storage::url($articolo->immagine_thrust) }}" alt="Immagine Thrust"
class="h-12 w-12 object-cover rounded cursor-pointer hover:opacity-80 transition-opacity"
@click="modalImg = '{{ Storage::url($articolo->immagine_thrust) }}'">
</div>
@endif
@if($articolo->min_torque_a)
<div class="flex justify-between items-center px-4 py-3">
<span class="text-gray-500 text-sm">Min Torque (A)</span>
<span class="font-medium text-gray-900">{{ $articolo->min_torque_a }}</span>
</div>
@endif
@if($articolo->immagine_tourque)
<div class="flex justify-between items-center px-4 py-3">
<span class="text-gray-500 text-sm">Immagine Tourque</span>
<img src="{{ Storage::url($articolo->immagine_tourque) }}" alt="Immagine Tourque"
class="h-12 w-12 object-cover rounded cursor-pointer hover:opacity-80 transition-opacity"
@click="modalImg = '{{ Storage::url($articolo->immagine_tourque) }}'">
</div>
@endif
@if($articolo->quantita_fori)
<div class="flex justify-between items-center px-4 py-3">
<span class="text-gray-500 text-sm">Quantita Fori</span>
@@ -136,8 +169,13 @@
</div>
</div>
<!-- Footer Info -->
<div class="text-center text-gray-400 text-xs">
<p>Ultimo aggiornamento: {{ $articolo->updated_at->format('d/m/Y H:i') }}</p>
</div>
<!-- Scan New QR Button -->
<div class="mb-6">
<div class="mb-6 mt-3">
<a href="{{ route('scanner') }}" class="flex items-center justify-center gap-3 w-full bg-blue-600 hover:bg-blue-700 text-white font-semibold py-4 px-6 rounded-2xl shadow-lg transition-all">
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v1m6 11h2m-6 0h-2v4m0-11v3m0 0h.01M12 12h4.01M16 20h4M4 12h4m12 0h.01M5 8h2a1 1 0 001-1V5a1 1 0 00-1-1H5a1 1 0 00-1 1v2a1 1 0 001 1zm12 0h2a1 1 0 001-1V5a1 1 0 00-1-1h-2a1 1 0 00-1 1v2a1 1 0 001 1zM5 20h2a1 1 0 001-1v-2a1 1 0 00-1-1H5a1 1 0 00-1 1v2a1 1 0 001 1z"></path>
@@ -146,10 +184,25 @@
</a>
</div>
<!-- Footer Info -->
<div class="text-center text-gray-400 text-xs">
<p>Ultimo aggiornamento: {{ $articolo->updated_at->format('d/m/Y H:i') }}</p>
<!-- Back to Home Button (Mobile Only) -->
<div class="bottom-4 left-4 right-4 md:hidden">
<a href="/" class="flex items-center justify-center gap-3 w-full bg-gray-800 hover:bg-gray-900 text-white font-semibold py-3 px-6 rounded-full shadow-lg transition-all">
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 12l9-9m0 0l9 9m-9-9v18"></path>
</svg>
Torna alla Home
</a>
</div>
</main>
<!-- Image Modal -->
<div x-show="modalImg" x-cloak
class="fixed inset-0 bg-black/80 flex items-center justify-center z-50 p-4"
@click="modalImg = null"
@keydown.escape.window="modalImg = null">
<img :src="modalImg" @click.stop class="max-h-[90vh] max-w-full rounded-lg shadow-2xl">
</div>
</body>
</html>