LMIV-SNACKAUTOMAT/resources/views/admin/products/show.blade.php

280 lines
13 KiB
PHP

@extends('layouts.vending')
@section('title', $product->name)
@section('content')
<div class="max-w-4xl mx-auto px-4">
<div class="mb-8">
<div class="flex items-center space-x-4 mb-4">
<a href="{{ route('products.index') }}" class="text-blue-600 hover:text-blue-800">
Zurück zur Übersicht
</a>
</div>
<div class="flex justify-between items-start">
<div>
<h1 class="text-3xl font-bold text-gray-900">{{ $product->name }}</h1>
<p class="text-2xl font-semibold text-green-600 mt-2">{{ number_format($product->price, 2) }}</p>
</div>
<div class="flex space-x-3">
<a href="{{ route('products.edit', $product) }}"
class="inline-flex items-center px-4 py-2 border border-gray-300 text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50">
Bearbeiten
</a>
<form action="{{ route('products.destroy', $product) }}" method="POST" class="inline"
onsubmit="return confirm('Sind Sie sicher, dass Sie dieses Produkt löschen möchten?')">
@csrf
@method('DELETE')
<button type="submit"
class="inline-flex items-center px-4 py-2 border border-red-300 text-sm font-medium rounded-md text-red-700 bg-white hover:bg-red-50">
Löschen
</button>
</form>
</div>
</div>
</div>
<div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
<!-- Produktbild und Grundinfo -->
<div class="lg:col-span-1">
<div class="bg-white shadow rounded-lg p-6">
@if($product->image)
<img src="{{ asset('storage/' . $product->image) }}" alt="{{ $product->name }}"
class="w-full h-64 object-cover rounded-lg mb-4">
@else
<div class="w-full h-64 bg-gray-200 rounded-lg flex items-center justify-center mb-4">
<span class="text-gray-400">Kein Produktbild</span>
</div>
@endif
@if($product->description)
<div class="mb-4">
<h3 class="font-semibold text-gray-900 mb-2">Beschreibung</h3>
<p class="text-gray-600">{{ $product->description }}</p>
</div>
@endif
@if($product->barcode)
<div class="mb-4">
<h3 class="font-semibold text-gray-900 mb-2">Barcode</h3>
<p class="text-gray-600 font-mono">{{ $product->barcode }}</p>
</div>
@endif
</div>
</div>
<!-- LMIV-Informationen -->
<div class="lg:col-span-2 space-y-6">
@if($product->ingredients || $product->allergens)
<!-- Zutaten und Allergene -->
<div class="bg-white shadow rounded-lg p-6">
<h2 class="text-xl font-semibold text-gray-900 mb-4 border-b border-gray-200 pb-2">
Zutaten und Allergene
</h2>
@if($product->ingredients)
<div class="mb-4">
<h3 class="font-semibold text-gray-900 mb-2">Zutaten</h3>
<p class="text-gray-600">{{ $product->ingredients }}</p>
</div>
@endif
@if($product->allergens)
<div class="mb-4">
<h3 class="font-semibold text-gray-900 mb-2">Allergene und Unverträglichkeiten</h3>
<div class="bg-yellow-50 border border-yellow-200 rounded-lg p-3">
<p class="text-yellow-800">{{ $product->allergens }}</p>
</div>
</div>
@endif
</div>
@endif
@if($product->energy_kcal || $product->energy_kj || $product->fat || $product->carbohydrates || $product->protein || $product->salt)
<!-- Nährwertangaben -->
<div class="bg-white shadow rounded-lg p-6">
<h2 class="text-xl font-semibold text-gray-900 mb-4 border-b border-gray-200 pb-2">
Nährwertangaben pro 100g
</h2>
<div class="grid grid-cols-2 md:grid-cols-4 gap-4">
@if($product->energy_kcal)
<div class="text-center p-3 bg-gray-50 rounded-lg">
<div class="text-2xl font-bold text-gray-900">{{ $product->energy_kcal }}</div>
<div class="text-sm text-gray-600">kcal</div>
</div>
@endif
@if($product->energy_kj)
<div class="text-center p-3 bg-gray-50 rounded-lg">
<div class="text-2xl font-bold text-gray-900">{{ $product->energy_kj }}</div>
<div class="text-sm text-gray-600">kJ</div>
</div>
@endif
@if($product->fat)
<div class="text-center p-3 bg-gray-50 rounded-lg">
<div class="text-2xl font-bold text-gray-900">{{ $product->fat }}</div>
<div class="text-sm text-gray-600">g Fett</div>
</div>
@endif
@if($product->saturated_fat)
<div class="text-center p-3 bg-gray-50 rounded-lg">
<div class="text-2xl font-bold text-gray-900">{{ $product->saturated_fat }}</div>
<div class="text-sm text-gray-600">g gesättigte Fettsäuren</div>
</div>
@endif
@if($product->carbohydrates)
<div class="text-center p-3 bg-gray-50 rounded-lg">
<div class="text-2xl font-bold text-gray-900">{{ $product->carbohydrates }}</div>
<div class="text-sm text-gray-600">g Kohlenhydrate</div>
</div>
@endif
@if($product->sugar)
<div class="text-center p-3 bg-gray-50 rounded-lg">
<div class="text-2xl font-bold text-gray-900">{{ $product->sugar }}</div>
<div class="text-sm text-gray-600">g Zucker</div>
</div>
@endif
@if($product->protein)
<div class="text-center p-3 bg-gray-50 rounded-lg">
<div class="text-2xl font-bold text-gray-900">{{ $product->protein }}</div>
<div class="text-sm text-gray-600">g Eiweiß</div>
</div>
@endif
@if($product->salt)
<div class="text-center p-3 bg-gray-50 rounded-lg">
<div class="text-2xl font-bold text-gray-900">{{ $product->salt }}</div>
<div class="text-sm text-gray-600">g Salz</div>
</div>
@endif
</div>
</div>
@endif
@if($product->net_weight || $product->origin_country || $product->manufacturer || $product->distributor)
<!-- Produktinformationen -->
<div class="bg-white shadow rounded-lg p-6">
<h2 class="text-xl font-semibold text-gray-900 mb-4 border-b border-gray-200 pb-2">
Produktinformationen
</h2>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
@if($product->net_weight)
<div>
<h3 class="font-semibold text-gray-900 mb-1">Nettofüllmenge</h3>
<p class="text-gray-600">{{ $product->net_weight }}g</p>
</div>
@endif
@if($product->origin_country)
<div>
<h3 class="font-semibold text-gray-900 mb-1">Herkunftsland</h3>
<p class="text-gray-600">{{ $product->origin_country }}</p>
</div>
@endif
@if($product->manufacturer)
<div>
<h3 class="font-semibold text-gray-900 mb-1">Hersteller</h3>
<p class="text-gray-600">{{ $product->manufacturer }}</p>
</div>
@endif
@if($product->distributor)
<div>
<h3 class="font-semibold text-gray-900 mb-1">Vertreiber</h3>
<p class="text-gray-600">{{ $product->distributor }}</p>
</div>
@endif
</div>
</div>
@endif
@if($product->storage_instructions || $product->usage_instructions || $product->best_before_date || $product->lot_number)
<!-- Hinweise und Zusatzinformationen -->
<div class="bg-white shadow rounded-lg p-6">
<h2 class="text-xl font-semibold text-gray-900 mb-4 border-b border-gray-200 pb-2">
Hinweise und Zusatzinformationen
</h2>
<div class="space-y-4">
@if($product->storage_instructions)
<div>
<h3 class="font-semibold text-gray-900 mb-1">Aufbewahrungshinweise</h3>
<p class="text-gray-600">{{ $product->storage_instructions }}</p>
</div>
@endif
@if($product->usage_instructions)
<div>
<h3 class="font-semibold text-gray-900 mb-1">Verwendungshinweise</h3>
<p class="text-gray-600">{{ $product->usage_instructions }}</p>
</div>
@endif
@if($product->best_before_date)
<div>
<h3 class="font-semibold text-gray-900 mb-1">Mindesthaltbarkeitsdatum</h3>
<p class="text-gray-600">{{ $product->best_before_date->format('d.m.Y') }}</p>
</div>
@endif
@if($product->lot_number)
<div>
<h3 class="font-semibold text-gray-900 mb-1">Chargennummer</h3>
<p class="text-gray-600 font-mono">{{ $product->lot_number }}</p>
</div>
@endif
</div>
</div>
@endif
<!-- Slot-Zuordnungen -->
@if($product->slots->count() > 0)
<div class="bg-white shadow rounded-lg p-6">
<h2 class="text-xl font-semibold text-gray-900 mb-4 border-b border-gray-200 pb-2">
Verfügbar in folgenden Automaten
</h2>
<div class="space-y-3">
@foreach($product->slots->groupBy('vendingMachine.name') as $machineName => $slots)
<div class="bg-gray-50 rounded-lg p-4">
<h3 class="font-semibold text-gray-900 mb-2">{{ $machineName }}</h3>
<div class="flex flex-wrap gap-2">
@foreach($slots as $slot)
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800">
Slot {{ $slot->slot_number }}
@if($slot->pivot->stock_quantity)
({{ $slot->pivot->stock_quantity }} Stück)
@endif
</span>
@endforeach
</div>
</div>
@endforeach
</div>
</div>
@endif
<!-- Metadaten -->
<div class="bg-gray-50 rounded-lg p-6">
<h2 class="text-lg font-semibold text-gray-900 mb-4">Metadaten</h2>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4 text-sm text-gray-600">
<div>
<span class="font-medium">Erstellt:</span> {{ $product->created_at->format('d.m.Y H:i') }}
</div>
<div>
<span class="font-medium">Zuletzt bearbeitet:</span> {{ $product->updated_at->format('d.m.Y H:i') }}
</div>
</div>
</div>
</div>
</div>
</div>
@endsection