LMIV-SNACKAUTOMAT/resources/views/admin/slots/create.blade.php

109 lines
5.8 KiB
PHP

@extends('layouts.vending')
@section('title', 'Neuer Slot')
@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('slots.index') }}" class="text-blue-600 hover:text-blue-800">
Zurück zur Übersicht
</a>
</div>
<h1 class="text-3xl font-bold text-gray-900">Neuen Slot erstellen</h1>
<p class="text-gray-600 mt-2">Produktfach für einen Automaten erstellen</p>
</div>
<form action="{{ route('slots.store') }}" method="POST" class="space-y-8">
@csrf
<!-- Grundinformationen -->
<div class="bg-white shadow rounded-lg p-6">
<h2 class="text-xl font-semibold text-gray-900 mb-6 border-b border-gray-200 pb-2">
Slot-Konfiguration
</h2>
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<div>
<label for="vending_machine_id" class="block text-sm font-medium text-gray-700 mb-2">
Automat *
</label>
<select id="vending_machine_id" name="vending_machine_id" required
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-purple-500 @error('vending_machine_id') border-red-500 @enderror">
<option value="">Automat auswählen</option>
@foreach($vendingMachines as $machine)
<option value="{{ $machine->id }}" {{ old('vending_machine_id') == $machine->id ? 'selected' : '' }}>
{{ $machine->name }} ({{ $machine->location }})
</option>
@endforeach
</select>
@error('vending_machine_id')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<div>
<label for="slot_number" class="block text-sm font-medium text-gray-700 mb-2">
Slot-Nummer *
</label>
<input type="text" id="slot_number" name="slot_number" value="{{ old('slot_number') }}" required
placeholder="z.B. 10, 11, A1, B2"
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-purple-500 @error('slot_number') border-red-500 @enderror">
@error('slot_number')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
<p class="text-xs text-gray-500 mt-1">Eindeutige Nummer für diesen Slot im Automaten</p>
</div>
<div>
<label for="position" class="block text-sm font-medium text-gray-700 mb-2">
Position
</label>
<input type="text" id="position" name="position" value="{{ old('position') }}"
placeholder="z.B. Reihe 2, Spalte 1 oder Oben Links"
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-purple-500 @error('position') border-red-500 @enderror">
@error('position')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
<p class="text-xs text-gray-500 mt-1">Beschreibung der Position im Automaten (maximal 100 Zeichen)</p>
</div>
<div>
<label for="capacity" class="block text-sm font-medium text-gray-700 mb-2">
Kapazität *
</label>
<input type="number" id="capacity" name="capacity" value="{{ old('capacity', 10) }}" min="1" max="50" required
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-purple-500 @error('capacity') border-red-500 @enderror">
@error('capacity')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
<p class="text-xs text-gray-500 mt-1">Maximale Anzahl Produkte in diesem Slot (1-50)</p>
</div>
<div class="md:col-span-2">
<label class="flex items-center">
<input type="checkbox" name="is_active" id="is_active" value="1"
class="h-4 w-4 text-purple-600 focus:ring-purple-500 border-gray-300 rounded"
{{ old('is_active', true) ? 'checked' : '' }}>
<span class="ml-2 text-sm text-gray-700">Slot ist aktiv</span>
</label>
<p class="text-xs text-gray-500 mt-1">Nur aktive Slots können Produkte enthalten</p>
</div>
</div>
</div>
<!-- Aktionsbuttons -->
<div class="flex justify-between items-center bg-gray-50 px-6 py-4 rounded-lg">
<a href="{{ route('slots.index') }}"
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">
Abbrechen
</a>
<button type="submit"
class="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md text-white bg-purple-600 hover:bg-purple-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-purple-500">
Slot erstellen
</button>
</div>
</form>
</div>
@endsection