Files
WebAPP/resources/views/admin/finances/edit.blade.php
Rhino 4eaf2368af Finanzverwaltung und Saison-System
Neues Einnahmen-/Ausgaben-Modul mit Kategorie-Filter, Monats-Charts und
Saison-basierter Filterung. Saison-Verwaltung im Admin-Bereich mit
Möglichkeit zum Wechsel der aktuellen Saison.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 23:48:20 +01:00

96 lines
5.9 KiB
PHP

<x-layouts.admin :title="__('admin.finance_edit')">
<h1 class="text-2xl font-bold mb-6">{{ __('admin.finance_edit') }}</h1>
<div class="bg-white rounded-lg shadow p-6 max-w-lg">
<form method="POST" action="{{ route('admin.finances.update', $finance) }}">
@csrf
@method('PUT')
{{-- Typ --}}
<div class="mb-4">
<label class="block text-sm font-medium text-gray-700 mb-2">{{ __('admin.finance_type') }} *</label>
<div class="flex gap-4">
<label class="flex items-center gap-2">
<input type="radio" name="type" value="income" {{ old('type', $finance->type->value) === 'income' ? 'checked' : '' }} class="text-green-600 focus:ring-green-500">
<span class="text-sm text-gray-700">{{ __('admin.finance_income') }}</span>
</label>
<label class="flex items-center gap-2">
<input type="radio" name="type" value="expense" {{ old('type', $finance->type->value) === 'expense' ? 'checked' : '' }} class="text-red-600 focus:ring-red-500">
<span class="text-sm text-gray-700">{{ __('admin.finance_expense') }}</span>
</label>
</div>
@error('type')<p class="mt-1 text-sm text-red-600">{{ $message }}</p>@enderror
</div>
{{-- Kategorie --}}
<div class="mb-4">
<label for="category" class="block text-sm font-medium text-gray-700 mb-1">{{ __('admin.finance_category') }} *</label>
<select name="category" id="category" required class="w-full px-3 py-2 border border-gray-300 rounded-md @error('category') border-red-500 @enderror">
<option value="">{{ __('admin.please_select') }}</option>
@foreach (\App\Enums\FinanceCategory::cases() as $cat)
<option value="{{ $cat->value }}" {{ old('category', $finance->category->value) === $cat->value ? 'selected' : '' }}>{{ $cat->label() }}</option>
@endforeach
</select>
@error('category')<p class="mt-1 text-sm text-red-600">{{ $message }}</p>@enderror
</div>
{{-- Titel --}}
<div class="mb-4">
<label for="title" class="block text-sm font-medium text-gray-700 mb-1">{{ __('admin.finance_title') }} *</label>
<input type="text" name="title" id="title" value="{{ old('title', $finance->title) }}" required maxlength="150"
class="w-full px-3 py-2 border border-gray-300 rounded-md @error('title') border-red-500 @enderror">
@error('title')<p class="mt-1 text-sm text-red-600">{{ $message }}</p>@enderror
</div>
{{-- Betrag + Datum --}}
<div class="grid grid-cols-2 gap-4 mb-4">
<div>
<label for="amount" class="block text-sm font-medium text-gray-700 mb-1">{{ __('admin.finance_amount') }} *</label>
<div class="relative">
<input type="number" name="amount" id="amount" value="{{ old('amount', number_format($finance->amount / 100, 2, '.', '')) }}" required step="0.01" min="0.01" max="999999.99"
class="w-full px-3 py-2 border border-gray-300 rounded-md pr-8 @error('amount') border-red-500 @enderror">
<span class="absolute right-3 top-2.5 text-sm text-gray-400"></span>
</div>
@error('amount')<p class="mt-1 text-sm text-red-600">{{ $message }}</p>@enderror
</div>
<div>
<label for="date" class="block text-sm font-medium text-gray-700 mb-1">{{ __('admin.finance_date') }} *</label>
<input type="date" name="date" id="date" value="{{ old('date', $finance->date->format('Y-m-d')) }}" required
class="w-full px-3 py-2 border border-gray-300 rounded-md @error('date') border-red-500 @enderror">
@error('date')<p class="mt-1 text-sm text-red-600">{{ $message }}</p>@enderror
</div>
</div>
{{-- Team --}}
<div class="mb-4">
<label for="team_id" class="block text-sm font-medium text-gray-700 mb-1">{{ __('ui.team') }}</label>
<select name="team_id" id="team_id" class="w-full px-3 py-2 border border-gray-300 rounded-md">
<option value="">{{ __('admin.finance_no_team') }}</option>
@foreach ($teams as $team)
<option value="{{ $team->id }}" {{ old('team_id', $finance->team_id) == $team->id ? 'selected' : '' }}>{{ $team->name }}</option>
@endforeach
</select>
@error('team_id')<p class="mt-1 text-sm text-red-600">{{ $message }}</p>@enderror
</div>
{{-- Notizen --}}
<div class="mb-4">
<label for="notes" class="block text-sm font-medium text-gray-700 mb-1">{{ __('admin.finance_notes') }}</label>
<textarea name="notes" id="notes" rows="2" maxlength="1000"
class="w-full px-3 py-2 border border-gray-300 rounded-md @error('notes') border-red-500 @enderror">{{ old('notes', $finance->notes) }}</textarea>
@error('notes')<p class="mt-1 text-sm text-red-600">{{ $message }}</p>@enderror
</div>
{{-- Buttons --}}
<div class="flex items-center gap-3">
<button type="submit" class="bg-blue-600 text-white px-4 py-2 rounded-md hover:bg-blue-700 text-sm font-medium">
{{ __('ui.save') }}
</button>
<a href="{{ route('admin.finances.index') }}" class="text-sm text-gray-600 hover:underline">
{{ __('ui.cancel') }}
</a>
</div>
</form>
</div>
</x-layouts.admin>