LMIV-SNACKAUTOMAT/resources/views/admin/tenants/edit.blade.php

297 lines
15 KiB
PHP

@extends('layouts.vending')
@section('title', 'Mandant bearbeiten')
@section('content')
<div class="max-w-4xl mx-auto px-4">
<div class="mb-8">
<div class="flex items-center justify-between">
<div>
<h1 class="text-3xl font-bold text-gray-900">Mandant bearbeiten</h1>
<p class="text-gray-600 mt-2">Bearbeiten Sie die Mandanten-Informationen</p>
</div>
<a href="{{ route('admin.tenants.index') }}"
class="bg-gray-500 text-white px-4 py-2 rounded hover:bg-gray-600 transition-colors">
Zurück zur Übersicht
</a>
</div>
</div>
<div class="bg-white shadow rounded-lg p-6">
<form action="{{ route('admin.tenants.update', $tenant) }}" method="POST" enctype="multipart/form-data" class="space-y-6">
@csrf
@method('PUT')
<!-- Name -->
<div>
<label for="name" class="block text-sm font-medium text-gray-700 mb-2">
Name <span class="text-red-500">*</span>
</label>
<input type="text"
id="name"
name="name"
value="{{ old('name', $tenant->name) }}"
required
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 @error('name') border-red-500 @enderror">
@error('name')
<p class="text-red-500 text-sm mt-1">{{ $message }}</p>
@enderror
</div>
<!-- Beschreibung -->
<div>
<label for="description" class="block text-sm font-medium text-gray-700 mb-2">
Beschreibung
</label>
<textarea id="description"
name="description"
rows="3"
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 @error('description') border-red-500 @enderror">{{ old('description', $tenant->description) }}</textarea>
@error('description')
<p class="text-red-500 text-sm mt-1">{{ $message }}</p>
@enderror
</div>
<!-- Domain -->
<div>
<label for="domain" class="block text-sm font-medium text-gray-700 mb-2">
Domain
</label>
<input type="text"
id="domain"
name="domain"
value="{{ old('domain', $tenant->domain) }}"
placeholder="z.B. beispiel.de"
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 @error('domain') border-red-500 @enderror">
@error('domain')
<p class="text-red-500 text-sm mt-1">{{ $message }}</p>
@enderror
</div>
<!-- Public Slug -->
<div>
<label for="public_slug" class="block text-sm font-medium text-gray-700 mb-2">
Öffentlicher Slug für QR-Codes
</label>
<input type="text"
id="public_slug"
name="public_slug"
value="{{ old('public_slug', $tenant->public_slug) }}"
placeholder="z.B. firma1, kantinen-service"
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 @error('public_slug') border-red-500 @enderror">
<p class="text-gray-500 text-sm mt-1">Wird für QR-Code URLs verwendet: /{public_slug}/machine/automat1</p>
@error('public_slug')
<p class="text-red-500 text-sm mt-1">{{ $message }}</p>
@enderror
</div>
<!-- Logo -->
<div>
<label for="logo" class="block text-sm font-medium text-gray-700 mb-2">
Logo
</label>
@if($tenant->logo)
<div class="mb-4">
<p class="text-sm text-gray-600 mb-2">Aktuelles Logo:</p>
<img src="{{ asset('storage/' . $tenant->logo) }}"
alt="Logo von {{ $tenant->name }}"
class="w-20 h-20 object-cover rounded">
</div>
@endif
<input type="file"
id="logo"
name="logo"
accept="image/*"
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 @error('logo') border-red-500 @enderror">
<p class="text-gray-500 text-sm mt-1">Unterstützte Formate: JPG, PNG, GIF (max. 2MB)</p>
@error('logo')
<p class="text-red-500 text-sm mt-1">{{ $message }}</p>
@enderror
</div>
<!-- Status -->
<div>
<div class="flex items-center">
<input type="checkbox"
id="is_active"
name="is_active"
value="1"
{{ old('is_active', $tenant->is_active) ? 'checked' : '' }}
class="h-4 w-4 text-blue-600 border-gray-300 rounded focus:ring-blue-500">
<label for="is_active" class="ml-2 block text-sm text-gray-700">
Mandant ist aktiv
</label>
</div>
@error('is_active')
<p class="text-red-500 text-sm mt-1">{{ $message }}</p>
@enderror
</div>
<!-- Anzeige-Einstellungen -->
<div class="border-t pt-6">
<h3 class="text-lg font-medium text-gray-900 mb-4">Anzeige-Einstellungen</h3>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<div>
<div class="flex items-center">
<input type="checkbox"
id="show_prices"
name="show_prices"
value="1"
{{ old('show_prices', $tenant->show_prices) ? 'checked' : '' }}
class="h-4 w-4 text-blue-600 border-gray-300 rounded focus:ring-blue-500">
<label for="show_prices" class="ml-2 block text-sm text-gray-700">
Preise anzeigen
</label>
</div>
<p class="text-gray-500 text-xs mt-1">Produktpreise für Kunden sichtbar</p>
@error('show_prices')
<p class="text-red-500 text-sm mt-1">{{ $message }}</p>
@enderror
</div>
<div>
<div class="flex items-center">
<input type="checkbox"
id="show_stock"
name="show_stock"
value="1"
{{ old('show_stock', $tenant->show_stock) ? 'checked' : '' }}
class="h-4 w-4 text-blue-600 border-gray-300 rounded focus:ring-blue-500">
<label for="show_stock" class="ml-2 block text-sm text-gray-700">
Verfügbarkeit anzeigen
</label>
</div>
<p class="text-gray-500 text-xs mt-1">Bestandsinformationen für Kunden sichtbar</p>
@error('show_stock')
<p class="text-red-500 text-sm mt-1">{{ $message }}</p>
@enderror
</div>
</div>
</div>
<!-- Adressdaten -->
<div class="border-t pt-6">
<h3 class="text-lg font-medium text-gray-900 mb-4">Adressdaten</h3>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<div class="md:col-span-2">
<div class="grid grid-cols-3 gap-4">
<div class="col-span-2">
<label for="street" class="block text-sm font-medium text-gray-700 mb-2">
Straße
</label>
<input type="text"
id="street"
name="street"
value="{{ old('street', $tenant->street) }}"
placeholder="z.B. Musterstraße"
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 @error('street') border-red-500 @enderror">
@error('street')
<p class="text-red-500 text-sm mt-1">{{ $message }}</p>
@enderror
</div>
<div>
<label for="house_number" class="block text-sm font-medium text-gray-700 mb-2">
Hausnummer
</label>
<input type="text"
id="house_number"
name="house_number"
value="{{ old('house_number', $tenant->house_number) }}"
placeholder="z.B. 123a"
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 @error('house_number') border-red-500 @enderror">
@error('house_number')
<p class="text-red-500 text-sm mt-1">{{ $message }}</p>
@enderror
</div>
</div>
</div>
<div>
<label for="postal_code" class="block text-sm font-medium text-gray-700 mb-2">
PLZ
</label>
<input type="text"
id="postal_code"
name="postal_code"
value="{{ old('postal_code', $tenant->postal_code) }}"
placeholder="z.B. 12345"
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 @error('postal_code') border-red-500 @enderror">
@error('postal_code')
<p class="text-red-500 text-sm mt-1">{{ $message }}</p>
@enderror
</div>
<div>
<label for="city" class="block text-sm font-medium text-gray-700 mb-2">
Stadt
</label>
<input type="text"
id="city"
name="city"
value="{{ old('city', $tenant->city) }}"
placeholder="z.B. Musterstadt"
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 @error('city') border-red-500 @enderror">
@error('city')
<p class="text-red-500 text-sm mt-1">{{ $message }}</p>
@enderror
</div>
<div class="md:col-span-2">
<label for="country" class="block text-sm font-medium text-gray-700 mb-2">
Land
</label>
<input type="text"
id="country"
name="country"
value="{{ old('country', $tenant->country) }}"
placeholder="z.B. Deutschland"
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 @error('country') border-red-500 @enderror">
@error('country')
<p class="text-red-500 text-sm mt-1">{{ $message }}</p>
@enderror
</div>
</div>
</div>
<!-- Statistiken (nur anzeigen) -->
<div class="bg-gray-50 p-4 rounded-lg">
<h3 class="text-lg font-medium text-gray-900 mb-4">Mandanten-Statistiken</h3>
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
<div class="text-center">
<div class="text-2xl font-bold text-blue-600">{{ $tenant->users_count }}</div>
<div class="text-sm text-gray-600">Benutzer</div>
</div>
<div class="text-center">
<div class="text-2xl font-bold text-green-600">{{ $tenant->vending_machines_count }}</div>
<div class="text-sm text-gray-600">Automaten</div>
</div>
<div class="text-center">
<div class="text-2xl font-bold text-purple-600">{{ $tenant->products_count }}</div>
<div class="text-sm text-gray-600">Produkte</div>
</div>
</div>
</div>
<!-- Buttons -->
<div class="flex items-center justify-between pt-4 border-t">
<a href="{{ route('admin.tenants.index') }}"
class="bg-gray-500 text-white px-6 py-2 rounded hover:bg-gray-600 transition-colors">
Abbrechen
</a>
<div class="flex space-x-3">
<button type="submit"
class="bg-blue-600 text-white px-6 py-2 rounded hover:bg-blue-700 transition-colors">
Speichern
</button>
</div>
</div>
</form>
</div>
</div>
@endsection