Compare commits

...
3 Commits
Author SHA1 Message Date
Nils Bonorden ed07d3ef70 zwischencommit 2025-10-28 21:51:43 +01:00
Nils Bonorden bdb62a6ce2 Bewerbungsformular update 2025-10-24 15:05:16 +02:00
Nils Bonorden 20558065ad Designanpassungen bewerbungsstatusFormunla 2025-10-24 13:52:49 +02:00
21 changed files with 931 additions and 198 deletions

No files matched your search

@@ -0,0 +1,58 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Models\BandApplication;
use App\Models\Bewerbung;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\StreamedResponse;
class BandApplicationAdminController extends Controller
{
// Einzelansicht einer Bewerbung
public function show(BandApplication $application)
{
$application->load(['band','bewerbung']);
return view('admin.applications.show', compact('application'));
}
// Status ändern (submitted, in_review, accepted, rejected)
public function updateStatus(Request $request, BandApplication $application)
{
$data = $request->validate([
'status' => ['required','in:submitted,in_review,accepted,rejected'],
]);
$application->update($data);
return back()->with('success', 'Status aktualisiert.');
}
// Optional: CSV-Export aller Bewerbungen einer Runde
// public function exportCsv(Bewerbung $bewerbung): StreamedResponse
// {
// $filename = 'applications_' . $bewerbung->slug . '.csv';
// $headers = [
// 'Content-Type' => 'text/csv',
// 'Content-Disposition' => 'attachment; filename="'.$filename.'"',
// ];
// $callback = function() use ($bewerbung) {
// $handle = fopen('php://output', 'w');
// fputcsv($handle, ['ID','Band','Email','Status','Datum','Demo','Nachricht']);
// foreach ($bewerbung->applications()->with('band')->cursor() as $app) {
// fputcsv($handle, [
// $app->id,
// optional($app->band)->name,
// optional($app->band)->email,
// $app->status,
// $app->created_at,
// $app->demo_link,
// preg_replace("/\r|\n/", " ", (string)$app->message),
// ]);
// }
// fclose($handle);
// };
// return response()->stream($callback, 200, $headers);
// }
}
@@ -0,0 +1,33 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Models\Bewerbung;
use Illuminate\Http\Request;
class BewerbungAdminController extends Controller
{
// Übersicht aller Runden
public function index(Request $request)
{
$bewerbungen = Bewerbung::query()
->withCount('applications')
->orderByDesc('start_at')
->orderBy('name')
->paginate(20);
return view('admin.bewerbungen.index', compact('bewerbungen'));
}
// Detailseite einer Runde mit Bewerbungs-Tabelle
public function show(Bewerbung $bewerbung)
{
$applications = $bewerbung->applications()
->with('band')
->latest()
->paginate(25);
return view('admin.bewerbungen.show', compact('bewerbung','applications'));
}
}
@@ -0,0 +1,95 @@
<?php
namespace App\Http\Controllers;
use App\Models\Band;
use App\Models\Bewerbung;
use App\Models\BandApplication;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Storage;
class BandApplicationController extends Controller
{
/**
* Speichert eine Bewerbung (Band-Stammdaten + Bewerbung zur Runde).
* Route: POST /bewerbung/{bewerbung:slug}/apply (name: band.apply)
*/
public function store(Request $request, Bewerbung $bewerbung)
{
// Validierung
$data = $request->validate([
// Band-Stammdaten
'band.name' => ['required','string','max:255'],
'band.email' => ['required','email','max:255'],
'band.phone' => ['nullable','string','max:100'],
'band.city' => ['nullable','string','max:255'],
'band.website' => ['nullable','url','max:255'],
'band.spotify' => ['nullable','url','max:255'],
'band.instagram' => ['nullable','url','max:255'],
'band.youtube' => ['nullable','url','max:255'],
'band.about' => ['nullable','string','max:5000'],
// Dateien optional
'band.tech_rider' => ['nullable','file','mimes:pdf','max:8192'],
'band.stage_plan' => ['nullable','file','mimes:pdf','max:8192'],
// Bewerbung
'message' => ['nullable','string','max:5000'],
'demo_link' => ['nullable','url','max:255'],
'privacy_ok' => ['accepted'], // muss angehakt sein
]);
$application = DB::transaction(function() use ($data, $request, $bewerbung) {
// 1) Band per E-Mail finden/neu anlegen
$band = Band::firstOrNew(['email' => $data['band']['email']]);
$band->fill([
'name' => $data['band']['name'],
'phone' => $data['band']['phone'] ?? null,
'city' => $data['band']['city'] ?? null,
'website' => $data['band']['website'] ?? null,
'spotify' => $data['band']['spotify'] ?? null,
'instagram' => $data['band']['instagram'] ?? null,
'youtube' => $data['band']['youtube'] ?? null,
'about' => $data['band']['about'] ?? null,
]);
if ($request->hasFile('band.tech_rider')) {
$band->tech_rider_path = $request->file('band.tech_rider')->store('bands/tech', 'public');
}
if ($request->hasFile('band.stage_plan')) {
$band->stage_plan_path = $request->file('band.stage_plan')->store('bands/stage', 'public');
}
$band->save();
// 2) Bewerbungs-Duplikate verhindern
$existing = BandApplication::where('band_id', $band->id)
->where('bewerbung_id', $bewerbung->id)
->first();
if ($existing) {
// Optional: Nachricht/Demolink aktualisieren
$existing->update([
'message' => $data['message'] ?? $existing->message,
'demo_link' => $data['demo_link'] ?? $existing->demo_link,
]);
return $existing;
}
// 3) Bewerbung anlegen
return BandApplication::create([
'band_id' => $band->id,
'bewerbung_id' => $bewerbung->id,
'status' => 'submitted',
'message' => $data['message'] ?? null,
'demo_link' => $data['demo_link'] ?? null,
'privacy_ok' => true,
]);
});
return redirect()
->route('bewerbung.show', $bewerbung) // oder ['bewerbung' => $bewerbung->slug]
->with('success', 'Danke! Eure Bewerbung ist eingegangen.');
}
}
+9 -80
View File
@@ -4,96 +4,25 @@ namespace App\Http\Controllers;
use App\Models\Bewerbung;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage;
class BewerbungController extends Controller
{
public function index()
{
$bewerbungen = Bewerbung::latest()->paginate(15);
$bewerbungen = Bewerbung::query()
->where('active', true)
->orderByDesc('start_at')
->get();
return view('bewerbung.index', compact('bewerbungen'));
}
public function create()
{
return view('bewerbung.create');
}
public function store(Request $request)
{
$data = $request->validate([
'name' => ['required','string','max:255'],
'text' => ['required','string','max:5000'],
'pic' => ['nullable','image','mimes:jpg,jpeg,png','max:4096'],
'bedingungen' => ['nullable','file','mimetypes:application/pdf','max:8192'],
'time' => ['nullable'],
'active' => ['nullable'],
'start_at' => ['nullable','date'],
'end_at' => ['nullable','date','after_or_equal:start_at'],
]);
if ($request->hasFile('pic')) {
$data['pic_path'] = $request->file('pic')->store('bewerbungen/pics', 'public');
}
if ($request->hasFile('bedingungen')) {
$data['bedingungen_path'] = $request->file('bedingungen')->store('bewerbungen/bedingungen', 'public');
}
$data['active'] = $request->boolean('active');
$data['time'] = $request->boolean('time');
$bewerbung = Bewerbung::create($data);
return redirect()->route('bewerbungen.show', $bewerbung)->with('success', 'Bewerbung erstellt.');
}
public function show(Bewerbung $bewerbung)
{
if (!$bewerbung->active) abort(404);
if ($bewerbung->start_at && $bewerbung->start_at->isFuture()) abort(404);
if ($bewerbung->end_at && $bewerbung->end_at->isPast()) abort(404);
return view('bewerbung.show', compact('bewerbung'));
}
public function edit(Bewerbung $bewerbung)
{
return view('bewerbung.edit', compact('bewerbung'));
}
public function update(Request $request, Bewerbung $bewerbung)
{
$data = $request->validate([
'name' => ['required','string','max:255'],
'text' => ['required','string','max:5000'],
'pic' => ['nullable','image','mimes:jpg,jpeg,png','max:4096'],
'bedingungen' => ['nullable','file','mimetypes:application/pdf','max:8192'],
'time' => ['nullable'],
'active' => ['nullable'],
'start_at' => ['nullable','date'],
'end_at' => ['nullable','date','after_or_equal:start_at'],
]);
if ($request->hasFile('pic')) {
if ($bewerbung->pic_path) Storage::disk('public')->delete($bewerbung->pic_path);
$data['pic_path'] = $request->file('pic')->store('bewerbungen/pics', 'public');
}
if ($request->hasFile('bedingungen')) {
if ($bewerbung->bedingungen_path) Storage::disk('public')->delete($bewerbung->bedingungen_path);
$data['bedingungen_path'] = $request->file('bedingungen')->store('bewerbungen/bedingungen', 'public');
}
$data['active'] = $request->boolean('active');
$data['time'] = $request->boolean('time');
$bewerbung->update($data);
return redirect()->route('bewerbungen.show', $bewerbung)->with('success', 'Bewerbung aktualisiert.');
}
public function destroy(Bewerbung $bewerbung)
{
if ($bewerbung->pic_path) Storage::disk('public')->delete($bewerbung->pic_path);
if ($bewerbung->bedingungen_path) Storage::disk('public')->delete($bewerbung->bedingungen_path);
$bewerbung->delete();
return redirect()->route('bewerbungen.index')->with('success', 'Bewerbung gelöscht.');
}
}
+30
View File
@@ -0,0 +1,30 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Band extends Model
{
use HasFactory;
protected $fillable = [
'name',
'email',
'phone',
'city',
'website',
'spotify',
'instagram',
'youtube',
'about',
'tech_rider_path',
'stage_plan_path',
];
public function applications()
{
return $this->hasMany(BandApplication::class);
}
}
+36
View File
@@ -0,0 +1,36 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class BandApplication extends Model
{
use HasFactory;
protected $fillable = [
'band_id',
'bewerbung_id',
'status', // submitted, in_review, accepted, rejected
'message',
'demo_link',
'privacy_ok',
];
protected $casts = [
'privacy_ok' => 'boolean',
'created_at' => 'datetime',
'updated_at' => 'datetime',
];
public function band()
{
return $this->belongsTo(Band::class);
}
public function bewerbung()
{
return $this->belongsTo(Bewerbung::class);
}
}
+11
View File
@@ -28,4 +28,15 @@ class Bewerbung extends Model
'start_at' => 'datetime',
'end_at' => 'datetime',
];
// app/Models/Bewerbung.php
public function applications()
{
return $this->hasMany(\App\Models\BandApplication::class, 'bewerbung_id');
}
public function getRouteKeyName()
{
return 'slug';
}
}
@@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
public function up(): void
{
Schema::create('bewerbungen', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('slug')->unique();
$table->text('text')->nullable();
$table->boolean('active')->default(false);
$table->boolean('time')->default(false);
$table->string('pdf_path')->nullable();
$table->string('pic_path')->nullable();
$table->string('bedingungen_path')->nullable();
$table->timestamp('start_at')->nullable();
$table->timestamp('end_at')->nullable();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('bewerbungen');
}
};
@@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
public function up(): void
{
Schema::create('bands', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('email')->unique();
$table->string('phone')->nullable();
$table->string('city')->nullable();
$table->string('website')->nullable();
$table->string('spotify')->nullable();
$table->string('instagram')->nullable();
$table->string('youtube')->nullable();
$table->text('about')->nullable();
$table->string('tech_rider_path')->nullable();
$table->string('stage_plan_path')->nullable();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('bands');
}
};
@@ -0,0 +1,27 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
public function up(): void
{
Schema::create('band_applications', function (Blueprint $table) {
$table->id();
$table->foreignId('band_id')->constrained('bands')->cascadeOnDelete();
$table->foreignId('bewerbung_id')->constrained('bewerbungen')->cascadeOnDelete();
$table->string('status')->default('submitted');
$table->text('message')->nullable();
$table->string('demo_link')->nullable();
$table->boolean('privacy_ok')->default(false);
$table->timestamps();
$table->unique(['band_id','bewerbung_id']);
});
}
public function down(): void
{
Schema::dropIfExists('band_applications');
}
};
+83
View File
@@ -0,0 +1,83 @@
/*! admin-live-filters.js — Vue 3 (CDN) */
(function() {
// Debounce helper
function debounce(fn, delay) {
let t; return function(...args) {
clearTimeout(t); t = setTimeout(() => fn.apply(this, args), delay);
};
}
// Mount for rounds list (index)
const elIndex = document.getElementById('admin-bewerbungen-index');
if (elIndex) {
const dataEl = document.getElementById('admin-bewerbungen-index-data');
const raw = dataEl ? JSON.parse(dataEl.textContent) : { items: [] };
const { createApp, computed, ref, watch } = Vue;
createApp({
setup() {
const q = ref('');
const activeOnly = ref(false);
const items = ref(raw.items || []);
const filtered = computed(() => {
const needle = q.value.trim().toLowerCase();
return items.value.filter(it => {
const text = ((it.name || '') + ' ' + (it.period || '')).toLowerCase();
const okText = !needle || text.includes(needle);
const okActive = !activeOnly.value || !!it.active;
return okText && okActive;
});
});
const clear = () => { q.value = ''; activeOnly.value = false; };
return { q, activeOnly, items, filtered, clear };
}
}).mount('#admin-bewerbungen-index');
}
// Mount for applications table (show)
const elShow = document.getElementById('admin-bewerbungen-show');
if (elShow) {
const dataEl = document.getElementById('admin-bewerbungen-show-data');
const raw = dataEl ? JSON.parse(dataEl.textContent) : { items: [] };
const { createApp, computed, ref } = Vue;
createApp({
setup() {
const q = ref('');
const status = ref('');
const dateFrom = ref('');
const dateTo = ref('');
const items = ref(raw.items || []);
const filtered = computed(() => {
const needle = q.value.trim().toLowerCase();
const from = dateFrom.value ? new Date(dateFrom.value + 'T00:00:00') : null;
const to = dateTo.value ? new Date(dateTo.value + 'T23:59:59') : null;
return items.value.filter(it => {
// text match
const text = ((it.band || '') + ' ' + (it.email || '')).toLowerCase();
const okText = !needle || text.includes(needle);
// status match
const okStatus = !status.value || it.status === status.value;
// date range match (created_at ISO string expected)
const t = it.created_at ? new Date(it.created_at) : null;
const okFrom = !from || (t && t >= from);
const okTo = !to || (t && t <= to);
return okText && okStatus && okFrom && okTo;
});
});
const reset = () => { q.value = ''; status.value=''; dateFrom.value=''; dateTo.value=''; };
return { q, status, dateFrom, dateTo, items, filtered, reset };
}
}).mount('#admin-bewerbungen-show');
}
})();
@@ -0,0 +1,82 @@
@extends('template')
@section('title','Admin · Bewerbung #'.$application->id)
@section('content')
@if(session('success'))
<div class="alert alert-success">{{ session('success') }}</div>
@endif
<div class="d-flex justify-content-between align-items-center mb-3">
<h1 class="h4 mb-0">Bewerbung #{{ $application->id }}</h1>
<a class="btn btn-outline-secondary btn-sm" href="{{ route('admin.bewerbungen.show', $application->bewerbung) }}">Zurück zur Runde</a>
</div>
<div class="row g-3">
<div class="col-lg-7">
<div class="card">
<div class="card-body">
<h5 class="card-title">Band</h5>
<div class="mb-2"><strong>Name:</strong> {{ optional($application->band)->name }}</div>
<div class="mb-2"><strong>E-Mail:</strong> {{ optional($application->band)->email }}</div>
@if(optional($application->band)->phone)
<div class="mb-2"><strong>Telefon:</strong> {{ $application->band->phone }}</div>
@endif
<div class="mb-2 d-flex flex-wrap gap-2">
@if(optional($application->band)->website)<a href="{{ $application->band->website }}" target="_blank" class="btn btn-sm btn-outline-secondary">Website</a>@endif
@if(optional($application->band)->spotify)<a href="{{ $application->band->spotify }}" target="_blank" class="btn btn-sm btn-outline-secondary">Spotify</a>@endif
@if(optional($application->band)->instagram)<a href="{{ $application->band->instagram }}" target="_blank" class="btn btn-sm btn-outline-secondary">Instagram</a>@endif
@if(optional($application->band)->youtube)<a href="{{ $application->band->youtube }}" target="_blank" class="btn btn-sm btn-outline-secondary">YouTube</a>@endif
@if(optional($application->band)->tech_rider_path)<a href="{{ Storage::disk('public')->url($application->band->tech_rider_path) }}" target="_blank" class="btn btn-sm btn-outline-secondary">Tech Rider</a>@endif
@if(optional($application->band)->stage_plan_path)<a href="{{ Storage::disk('public')->url($application->band->stage_plan_path) }}" target="_blank" class="btn btn-sm btn-outline-secondary">Stage Plan</a>@endif
</div>
@if(optional($application->band)->about)
<div class="mt-3">
<strong>Über die Band</strong>
<p class="mb-0">{{ $application->band->about }}</p>
</div>
@endif
</div>
</div>
</div>
<div class="col-lg-5">
<div class="card">
<div class="card-body">
<h5 class="card-title">Bewerbung</h5>
<div class="mb-2"><strong>Runde:</strong> {{ $application->bewerbung->name }}</div>
<div class="mb-2"><strong>Eingang:</strong> {{ $application->created_at->format('d.m.Y H:i') }}</div>
<div class="mb-2"><strong>Status:</strong> @include('components.status-badge', ['status' => $application->status])</div>
<form class="mt-2 d-flex gap-2" method="POST" action="{{ route('admin.applications.status', $application) }}">
@csrf
@method('PATCH')
<select name="status" class="form-select form-select-sm" style="max-width: 240px;">
@foreach(['submitted' => 'Eingereicht','in_review' => 'In Prüfung','accepted' => 'Zugesagt','rejected' => 'Abgesagt'] as $val => $label)
<option value="{{ $val }}" @selected(old('status', $application->status) === $val)>{{ $label }}</option>
@endforeach
</select>
<button class="btn btn-sm btn-primary">Speichern</button>
</form>
@if($errors->any())
<div class="alert alert-danger mt-3">
<ul class="mb-0">
@foreach($errors->all() as $e)
<li>{{ $e }}</li>
@endforeach
</ul>
</div>
@endif
</div>
</div>
</div>
</div>
<div class="card mt-3">
<div class="card-body">
<h5 class="card-title">Nachricht</h5>
<p class="mb-0" style="white-space: pre-wrap;">{{ $application->message }}</p>
@if($application->demo_link)
<p class="mt-2"><strong>Demo:</strong> <a href="{{ $application->demo_link }}" target="_blank">{{ $application->demo_link }}</a></p>
@endif
</div>
</div>
@endsection
@@ -0,0 +1,87 @@
@extends('template')
@section('title','Admin · Bewerbungsrunden')
@section('content')
<div class="d-flex justify-content-between align-items-center mb-3">
<h1 class="h4 mb-0">Bewerbungsrunden</h1>
</div>
{{-- Live-Filter UI (Vue) --}}
<div id="admin-bewerbungen-index" class="card mb-3">
<div class="card-body">
<div class="row g-2 align-items-center">
<div class="col-md-6">
<input type="search" class="form-control" placeholder="Suchen (Name/Zeitraum)..." v-model="q">
</div>
<div class="col-md-3">
<div class="form-check">
<input class="form-check-input" type="checkbox" id="activeOnly" v-model="activeOnly">
<label class="form-check-label" for="activeOnly">Nur aktive anzeigen</label>
</div>
</div>
<div class="col-md-3 text-md-end">
<button class="btn btn-sm btn-outline-secondary" @click="clear">Zurücksetzen</button>
</div>
</div>
</div>
</div>
<div class="table-responsive">
<table class="table table-hover align-middle">
<thead>
<tr>
<th>Name</th>
<th>Zeitraum</th>
<th>Aktiv</th>
<th class="text-end">Bewerbungen</th>
<th></th>
</tr>
</thead>
<tbody>
<template v-if="filtered.length">
<tr v-for="b in filtered" :key="b.id">
<td class="fw-semibold">@{{ b.name }}</td>
<td>@{{ b.period }}</td>
<td>
<span class="badge" :class="b.active ? 'text-bg-success' : 'text-bg-secondary'">
@{{ b.active ? 'aktiv' : 'inaktiv' }}
</span>
</td>
<td class="text-end">@{{ b.applications_count }}</td>
<td class="text-end">
<a class="btn btn-sm btn-outline-primary" :href="b.url">Öffnen</a>
</td>
</tr>
</template>
<tr v-else><td colspan="5" class="text-muted">Keine Treffer.</td></tr>
</tbody>
</table>
</div>
{{-- Original Laravel-Pagination ist ausgeblendet, da die Liste clientseitig gefiltert wird. --}}
{{-- {{ $bewerbungen->links() }} --}}
{{-- Serverdaten für Vue als JSON bereitstellen --}}
<script type="application/json" id="admin-bewerbungen-index-data">
@php
echo json_encode([
'items' => $bewerbungen->map(function($b){
return [
'id' => $b->id,
'name' => $b->name,
'period' => trim(($b->start_at ? $b->start_at->format('d.m.Y') : '') . ' – ' . ($b->end_at ? $b->end_at->format('d.m.Y') : '')),
'active' => (bool)$b->active,
'applications_count' => (int)($b->applications_count ?? 0),
'url' => route('admin.bewerbungen.show', $b),
];
})->values(),
], JSON_UNESCAPED_UNICODE);
@endphp
</script>
@endsection
@push('scripts')
{{-- Vue 3 CDN + App --}}
<script src="https://unpkg.com/vue@3/dist/vue.global.prod.js"></script>
<script src="/js/admin-live-filters.js"></script>
@endpush
@@ -0,0 +1,121 @@
@extends('template')
@section('title','Admin · Runde: ' . $bewerbung->name)
@section('content')
<div class="d-flex justify-content-between align-items-center mb-3">
<div>
<h1 class="h4 mb-0">Runde: {{ $bewerbung->name }}</h1>
<small class="text-muted">
@if($bewerbung->start_at) Start: {{ $bewerbung->start_at->format('d.m.Y') }} @endif
@if($bewerbung->end_at) · Ende: {{ $bewerbung->end_at->format('d.m.Y') }} @endif
· Status: @if($bewerbung->active)<span class="badge text-bg-success">aktiv</span>@else<span class="badge text-bg-secondary">inaktiv</span>@endif
</small>
</div>
<div class="d-flex gap-2">
<a class="btn btn-outline-secondary btn-sm" href="{{ route('admin.bewerbungen.index') }}">Zurück</a>
</div>
</div>
{{-- Live-Filter UI --}}
<div id="admin-bewerbungen-show" class="card mb-3">
<div class="card-body">
<div class="row g-2">
<div class="col-lg-4">
<input type="search" class="form-control" placeholder="Suchen (Band/E-Mail)..." v-model="q">
</div>
<div class="col-lg-3">
<select class="form-select" v-model="status">
<option value="">Alle Status</option>
<option value="submitted">Eingereicht</option>
<option value="in_review">In Prüfung</option>
<option value="accepted">Zugesagt</option>
<option value="rejected">Abgesagt</option>
</select>
</div>
<div class="col-lg-2">
<input type="date" class="form-control" v-model="dateFrom" placeholder="von">
</div>
<div class="col-lg-2">
<input type="date" class="form-control" v-model="dateTo" placeholder="bis">
</div>
<div class="col-lg-1 text-lg-end">
<button class="btn btn-outline-secondary w-100" @click="reset">Reset</button>
</div>
</div>
</div>
</div>
<div class="table-responsive">
<table class="table table-striped align-middle">
<thead>
<tr>
<th>#</th>
<th>Band</th>
<th>E-Mail</th>
<th>Status</th>
<th>Datum</th>
<th></th>
</tr>
</thead>
<tbody>
<template v-if="filtered.length">
<tr v-for="app in filtered" :key="app.id">
<td>@{{ app.id }}</td>
<td>@{{ app.band }}</td>
<td>@{{ app.email }}</td>
<td>
<span class="badge"
:class="{
'text-bg-secondary': app.status==='submitted',
'text-bg-warning': app.status==='in_review',
'text-bg-success': app.status==='accepted',
'text-bg-danger': app.status==='rejected'
}">
@{{ app.status_label }}
</span>
</td>
<td>@{{ app.created_label }}</td>
<td class="text-end">
<a class="btn btn-sm btn-outline-primary" :href="app.url">Öffnen</a>
</td>
</tr>
</template>
<tr v-else><td colspan="6" class="text-muted">Keine Treffer.</td></tr>
</tbody>
</table>
</div>
{{-- Serverseitige Pagination ausgeblendet, da wir clientseitig filtern. --}}
{{-- {{ $applications->links() }} --}}
{{-- Serverdaten als JSON --}}
<script type="application/json" id="admin-bewerbungen-show-data">
@php
echo json_encode([
'items' => $applications->map(function($app){
return [
'id' => $app->id,
'band' => optional($app->band)->name,
'email' => optional($app->band)->email,
'status' => $app->status,
'status_label' => match($app->status) {
'submitted' => 'Eingereicht',
'in_review' => 'In Prüfung',
'accepted' => 'Zugesagt',
'rejected' => 'Abgesagt',
default => $app->status,
},
'created_at' => optional($app->created_at)?->toIso8601String(),
'created_label' => optional($app->created_at)?->format('d.m.Y H:i'),
'url' => route('admin.applications.show', $app),
];
})->values(),
], JSON_UNESCAPED_UNICODE);
@endphp
</script>
@endsection
@push('scripts')
<script src="https://unpkg.com/vue@3/dist/vue.global.prod.js"></script>
<script src="/js/admin-live-filters.js"></script>
@endpush
+22 -22
View File
@@ -14,26 +14,7 @@
<label for="text" class="mb-2">Bewerbungstext*</label>
<textarea name="text" id="text" class="form-control mb-3" rows="6" required>{{ old('text', $bewerbung->text ?? '') }}</textarea>
<div class="form-check form-switch mb-3">
<input class="form-check-input" type="checkbox" role="switch" id="active" name="active" {{ old('active', $bewerbung->active ?? false) ? 'checked' : '' }}>
<label class="form-check-label" for="active">Aktiv</label>
</div>
<div class="form-check form-switch mb-3">
<input class="form-check-input" type="checkbox" role="switch" id="time" name="time" {{ old('time', $bewerbung->time ?? false) ? 'checked' : '' }}>
<label class="form-check-label" for="time">Mit Zeitraum</label>
</div>
<div class="row g-2">
<div class="col">
<label class="mb-2" for="start_at">Start</label>
<input type="datetime-local" id="start_at" name="start_at" class="form-control mb-3" value="{{ old('start_at', isset($bewerbung->start_at) ? $bewerbung->start_at->format('Y-m-d\TH:i') : '') }}">
</div>
<div class="col">
<label class="mb-2" for="end_at">Ende</label>
<input type="datetime-local" id="end_at" name="end_at" class="form-control mb-3" value="{{ old('end_at', isset($bewerbung->end_at) ? $bewerbung->end_at->format('Y-m-d\TH:i') : '') }}">
</div>
</div>
</div>
<div class="col-md-6 mt-3">
@@ -48,9 +29,28 @@
@isset($bewerbung->bedingungen_path)
<p>Aktuell: <a href="{{ Storage::url($bewerbung->bedingungen_path) }}" target="_blank">PDF ansehen</a></p>
@endisset
<div class="form-check form-switch mb-3">
<input class="form-check-input" type="checkbox" role="switch" id="active" name="active" {{ old('active', $bewerbung->active ?? true) ? 'checked' : '' }}>
<label class="form-check-label" for="active">Aktiv</label>
</div>
<div class="form-check form-switch mb-3">
<input class="form-check-input" type="checkbox" role="switch" id="time" name="time" {{ old('time', $bewerbung->time ?? false) ? 'checked' : '' }}>
<label class="form-check-label" for="time">Mit Zeitraum</label>
</div>
</div>
</div>
<div class="row g-2">
<div class="col-md-6 mt-3">
<label class="mb-2" for="start_at">Start</label>
<input type="datetime-local" id="start_at" name="start_at" class="form-control mb-3" value="{{ old('start_at', isset($bewerbung->start_at) ? $bewerbung->start_at->format('Y-m-d\TH:i') : '') }}">
</div>
<div class="col-md-6 mt-3">
<label class="mb-2" for="end_at">Ende</label>
<input type="datetime-local" id="end_at" name="end_at" class="form-control mb-3" value="{{ old('end_at', isset($bewerbung->end_at) ? $bewerbung->end_at->format('Y-m-d\TH:i') : '') }}">
</div>
</div>
@if ($errors->any())
<div class="alert alert-danger mt-3">
<ul class="mb-0">
@@ -61,7 +61,7 @@
</div>
@endif
<div class="mt-3">
<div class="mt-3 mb-3">
<a href="{{ route('bewerbungen.index') }}" class="btn btn-outline-secondary">Abbrechen</a>
<button class="btn btn-primary">Speichern</button>
</div>
+20 -54
View File
@@ -1,59 +1,25 @@
@extends('template')
@section('title', 'Bewerbungen')
@section('content')
<div class="container mt-4">
<div class="d-flex justify-content-between align-items-center mb-3">
<h1 class="h3">Bewerbungen</h1>
<a href="{{ route('bewerbungen.create') }}" class="btn btn-primary">Neu</a>
<h1 class="h3 mb-3">Aktive Bewerbungen</h1>
@if($bewerbungen->isEmpty())
<div class="alert alert-info">Derzeit sind keine aktiven Bewerbungen sichtbar.</div>
@else
<div class="list-group">
@foreach($bewerbungen as $b)
<a class="list-group-item list-group-item-action" href="{{ route('bewerbung.show', $b) }}">
<strong>{{ $b->name }}</strong>
@if($b->start_at || $b->end_at)
<small class="text-muted d-block">
@if($b->start_at) Start: {{ $b->start_at->format('d.m.Y') }} @endif
@if($b->end_at) – Ende: {{ $b->end_at->format('d.m.Y') }} @endif
</small>
@endif
<small class="d-block">{{ Str::limit($b->text, 160) }}</small>
</a>
@endforeach
</div>
@if(session('success'))
<div class="alert alert-success">{{ session('success') }}</div>
@endif
<table class="table table-striped align-middle">
<thead>
<tr>
<th>#</th>
<th>Name</th>
<th>Aktiv</th>
<th>Zeitraum</th>
<th>Erstellt</th>
<th class="text-end">Aktionen</th>
</tr>
</thead>
<tbody>
@forelse($bewerbungen as $b)
<tr>
<td>{{ $b->id }}</td>
<td>{{ $b->name }}</td>
<td>
<span class="badge {{ $b->active ? 'bg-success' : 'bg-secondary' }}">
{{ $b->active ? 'Ja' : 'Nein' }}
</span>
</td>
<td>
@if($b->start_at) {{ $b->start_at->format('d.m.Y H:i') }} @endif
@if($b->end_at) – {{ $b->end_at->format('d.m.Y H:i') }} @endif
</td>
<td>{{ optional($b->created_at)->format('d.m.Y H:i') }}</td>
<td class="text-end">
<a href="{{ route('bewerbungen.show', $b) }}" class="btn btn-sm btn-outline-secondary">Anzeigen</a>
<a href="{{ route('bewerbungen.edit', $b) }}" class="btn btn-sm btn-outline-primary">Bearbeiten</a>
<form action="{{ route('bewerbungen.destroy', $b) }}" method="POST" class="d-inline" onsubmit="return confirm('Wirklich löschen?');">
@csrf
@method('DELETE')
<button class="btn btn-sm btn-outline-danger">Löschen</button>
</form>
</td>
</tr>
@empty
<tr><td colspan="6">Keine Bewerbungen vorhanden.</td></tr>
@endforelse
</tbody>
</table>
{{ $bewerbungen->links() }}
</div>
@endif
@endsection
+110 -36
View File
@@ -1,44 +1,118 @@
@extends('template')
@section('title', $bewerbung->name)
@section('title', 'Bewerbung anzeigen')
@section('content')
<div class="container mt-4">
@if(session('success'))
<div class="alert alert-success">{{ session('success') }}</div>
@endif
@if(session('success'))
<div class="alert alert-success">{{ session('success') }}</div>
@endif
<div class="d-flex justify-content-between align-items-center mb-3">
<h1 class="h3 mb-0">{{ $bewerbung->name }}</h1>
<div>
<a href="{{ route('bewerbungen.edit', $bewerbung->id) }}" class="btn btn-sm btn-primary">Bearbeiten</a>
<a href="{{ route('bewerbungen.index') }}" class="btn btn-sm btn-outline-secondary">Zur Liste</a>
<div class="row g-4">
<div class="col-lg-7">
<h1 class="h3 mb-2">{{ $bewerbung->name }}</h1>
@if($bewerbung->pic_path ?? false)
<img class="img-fluid rounded mb-3" src="{{ Storage::disk('public')->url($bewerbung->pic_path) }}" alt="{{ $bewerbung->name }}">
@endif
<div class="mb-3" style="white-space: pre-wrap;">{{ $bewerbung->text }}</div>
@if($bewerbung->bedingungen_path ?? false)
<p class="mb-4">
<a href="{{ Storage::disk('public')->url($bewerbung->bedingungen_path) }}" target="_blank" class="btn btn-outline-secondary btn-sm">
Bewerbungsbedingungen (PDF)
</a>
</p>
@endif
@if ($errors->any())
<div class="alert alert-danger">
<strong>Bitte prüfen:</strong>
<ul class="mb-0">
@foreach ($errors->all() as $e)
<li>{{ $e }}</li>
@endforeach
</ul>
</div>
@endif
<form method="POST" action="{{ route('band.apply', $bewerbung) }}" enctype="multipart/form-data" class="mt-3">
@csrf
<h2 class="h5 mt-2 mb-3">Band</h2>
<div class="row g-3">
<div class="col-md-6">
<label class="form-label">Bandname*</label>
<input type="text" name="band[name]" class="form-control" value="{{ old('band.name') }}" required>
</div>
<div class="col-md-6">
<label class="form-label">E-Mail*</label>
<input type="email" name="band[email]" class="form-control" value="{{ old('band.email') }}" required>
</div>
<div class="col-md-6">
<label class="form-label">Telefon</label>
<input type="text" name="band[phone]" class="form-control" value="{{ old('band.phone') }}">
</div>
<div class="col-md-6">
<label class="form-label">Stadt</label>
<input type="text" name="band[city]" class="form-control" value="{{ old('band.city') }}">
</div>
<div class="col-md-6">
<label class="form-label">Website</label>
<input type="url" name="band[website]" class="form-control" value="{{ old('band.website') }}">
</div>
<div class="col-md-6">
<label class="form-label">Spotify</label>
<input type="url" name="band[spotify]" class="form-control" value="{{ old('band.spotify') }}">
</div>
<div class="col-md-6">
<label class="form-label">Instagram</label>
<input type="url" name="band[instagram]" class="form-control" value="{{ old('band.instagram') }}">
</div>
<div class="col-md-6">
<label class="form-label">YouTube</label>
<input type="url" name="band[youtube]" class="form-control" value="{{ old('band.youtube') }}">
</div>
<div class="col-12">
<label class="form-label">Über die Band</label>
<textarea name="band[about]" class="form-control" rows="4">{{ old('band.about') }}</textarea>
</div>
<div class="col-md-6">
<label class="form-label">Tech Rider (PDF)</label>
<input type="file" name="band[tech_rider]" class="form-control" accept="application/pdf">
</div>
<div class="col-md-6">
<label class="form-label">Stage Plan (PDF)</label>
<input type="file" name="band[stage_plan]" class="form-control" accept="application/pdf">
</div>
</div>
<h2 class="h5 mt-4 mb-3">Bewerbung</h2>
<div class="mb-3">
<label class="form-label">Nachricht / Motivation</label>
<textarea name="message" class="form-control" rows="4">{{ old('message') }}</textarea>
</div>
<div class="mb-3">
<label class="form-label">Demo-Link</label>
<input type="url" name="demo_link" class="form-control" value="{{ old('demo_link') }}">
</div>
<div class="form-check form-switch mb-4">
<input class="form-check-input" type="checkbox" id="privacy_ok" name="privacy_ok" {{ old('privacy_ok', true) ? 'checked' : '' }} required>
<label class="form-check-label" for="privacy_ok">
Ich stimme der Verarbeitung meiner Daten gemäß Datenschutzhinweis zu.
</label>
</div>
<button class="btn btn-primary">Jetzt bewerben</button>
</form>
</div>
<div class="col-lg-5">
<div class="card">
<div class="card-body">
<h5 class="card-title mb-3">Eckdaten</h5>
<ul class="list-unstyled mb-0">
@if($bewerbung->start_at)<li><strong>Start:</strong> {{ $bewerbung->start_at->format('d.m.Y') }}</li>@endif
@if($bewerbung->end_at)<li><strong>Ende:</strong> {{ $bewerbung->end_at->format('d.m.Y') }}</li>@endif
<li><strong>Status:</strong> {{ $bewerbung->active ? 'Aktiv' : 'Inaktiv' }}</li>
</ul>
</div>
</div>
</div>
<p><strong>Aktiv:</strong> {{ $bewerbung->active ? 'Ja' : 'Nein' }}</p>
<p><strong>Zeitraum:</strong>
@if($bewerbung->start_at) {{ $bewerbung->start_at->format('d.m.Y H:i') }} @endif
@if($bewerbung->end_at) – {{ $bewerbung->end_at->format('d.m.Y H:i') }} @endif
</p>
<div class="mb-3">
<strong>Text:</strong>
<div class="border rounded p-3 bg-light mt-1">{{ $bewerbung->text }}</div>
</div>
@if($bewerbung->pic_path)
<p><strong>Bild:</strong> <br>
<img src="{{ Storage::url($bewerbung->pic_path) }}" alt="" style="max-height:180px"></p>
@endif
@if($bewerbung->bedingungen_path)
<p><strong>Bewerbungsbedingungen:</strong> <a href="{{ Storage::url($bewerbung->bedingungen_path) }}" target="_blank">PDF öffnen</a></p>
@endif
<form action="{{ route('bewerbungen.destroy', $bewerbung) }}" method="POST" class="mt-4" onsubmit="return confirm('Wirklich löschen?');">
@csrf
@method('DELETE')
<button class="btn btn-outline-danger">Löschen</button>
</form>
</div>
@endsection
@@ -0,0 +1,10 @@
@php
$map = [
'submitted' => ['label' => 'Eingereicht', 'class' => 'text-bg-secondary'],
'in_review' => ['label' => 'In Prüfung', 'class' => 'text-bg-warning'],
'accepted' => ['label' => 'Zugesagt', 'class' => 'text-bg-success'],
'rejected' => ['label' => 'Abgesagt', 'class' => 'text-bg-danger'],
];
$cfg = $map[$status] ?? ['label' => $status, 'class' => 'text-bg-light'];
@endphp
<span class="badge {{ $cfg['class'] }}">{{ $cfg['label'] }}</span>
+23
View File
@@ -0,0 +1,23 @@
<?php
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\Admin\BewerbungAdminController;
use App\Http\Controllers\Admin\BandApplicationAdminController;
Route::middleware(['web']) // ggf. ['web','auth']
->prefix('admin/bewerbungen')
->name('admin.bewerbungen.')
->group(function () {
Route::get('/', [BewerbungAdminController::class, 'index'])->name('index');
Route::get('/{bewerbung:slug}', [BewerbungAdminController::class, 'show'])->name('show');
});
Route::middleware(['web']) // ggf. ['web','auth']
->prefix('admin/applications')
->name('admin.applications.')
->group(function () {
Route::get('/{application}', [BandApplicationAdminController::class, 'show'])->name('show');
Route::patch('/{application}/status', [BandApplicationAdminController::class, 'updateStatus'])->name('status');
// Optional: CSV-Export aller Bewerbungen einer Runde:
// Route::get('/export/{bewerbung:slug}', [BandApplicationAdminController::class, 'exportCsv'])->name('export');
});
+8
View File
@@ -0,0 +1,8 @@
<?php
use App\Http\Controllers\BewerbungController;
use App\Http\Controllers\BandApplicationController;
Route::get('/bewerbung', [BewerbungController::class, 'index'])->name('bewerbung.index');
Route::get('/bewerbung/{bewerbung:slug}', [BewerbungController::class, 'show'])->name('bewerbung.show');
Route::post('/bewerbung/{bewerbung:slug}/apply', [BandApplicationController::class, 'store'])->name('band.apply');
+5 -6
View File
@@ -5,7 +5,8 @@ use Illuminate\Support\Facades\Route;
use App\Http\Controllers\BandsController;
use App\Http\Controllers\BewerbungController;
require __DIR__ . '/admin_bewerbung.php';
require __DIR__ . '/bewerbung_routes.php';
Route::get('/', function () {
return view('wartung');
@@ -17,9 +18,7 @@ Route::get('/', function () {
Route::get('info', function() {
return view('info');
});
Route::get('bewerbung', function() {
return view('bewerbung');
});
//Route::get('bewerbung', function() { return view('bewerbung');});
Route::get('start', function() {
return view('start');
});
@@ -32,5 +31,5 @@ Route::get('kontakt', function() {
// Bewerbung CRUD
Route::resource('bewerbungen', BewerbungController::class)
->parameters(['bewerbungen' => 'bewerbung']); // ← erzwingt {bewerbung}
//Route::resource('bewerbungen', BewerbungController::class)
//->parameters(['bewerbungen' => 'bewerbung']); // ← erzwingt {bewerbung}