pp-planer/routes/web.php
Thorsten Bus e33418f716 feat: song pre/postfix, settings overhaul, export & schedule fixes
Resolves a batch of bugs and feature requests across songs, services,
settings and export:

Songs & sections
- Every song now carries permanent, empty, locked PREFIX (COPYRIGHT) and
  POSTFIX (BLANK) sections, deduplicated on import; locked sections cannot
  be edited or deleted via UI or API.
- Song edit modal: explicit Speichern/Schließen with dirty-tracking,
  editable section headline (combobox + custom values), and a fix for the
  419 CSRF errors after CCLI "Importieren & Bearbeiten" (token read fresh
  per request).
- CCLI bookmarklet "Importieren & Bearbeiten" now opens the edit dialog.

Service schedule & arrangements
- Fixed assigned songs showing no sections (slides loaded for all
  arrangements, not just the default).
- Added "Song entfernen / neu zuordnen" to reassign an assigned song.
- Worship-leader arrangement is created/selected lazily when the
  arrangement dialog opens (only when not user-overridden); the leader is
  resolved from the "Lobpreis" agenda item, and manual create/clone names
  are prefixed with the leader name.

Navigation
- "/" redirects to the next upcoming service's edit page (or the list).
- Service titles link to the edit page.

Settings
- Renamed "Makro-Import"/"Label-Import" menu items; fixed drag-and-drop
  imports (were downloading the dropped file); added label-import hint;
  made the panel scrollable.
- Nametag now uses a single MacroPicker; added song prefix/postfix label
  defaults (COPYRIGHT #24B34C / BLANK #000000); new "Export-Dateien" menu
  to upload prefix/postfix .pro files added to every export.

Export
- Filenames/playlist names are date-first ("YYYY-MM-DD <Title>").
- Keyvisual slide only for the first content-less item after real content;
  all other content-less items render as headlines.
- New "Vorschau herunterladen" for non-finalized services (filename and
  import name prefixed "Vorschau" with export timestamp).
- Uploaded prefix/postfix .pro files wrap every export.

Tests updated to the new behavior; full suite green (569 passed).
2026-06-01 08:56:20 +02:00

154 lines
9.4 KiB
PHP

<?php
use App\Http\Controllers\ApiLogController;
use App\Http\Controllers\AuthController;
use App\Http\Controllers\BookmarkletController;
use App\Http\Controllers\CcliPasteController;
use App\Http\Controllers\ExportProFileController;
use App\Http\Controllers\LabelImportController;
use App\Http\Controllers\MacroAssignmentController;
use App\Http\Controllers\MacroImportController;
use App\Http\Controllers\ServiceController;
use App\Http\Controllers\ServiceImageController;
use App\Http\Controllers\ServiceMacroOverrideController;
use App\Http\Controllers\SettingsController;
use App\Http\Controllers\SongPdfController;
use App\Http\Controllers\SongSectionController;
use App\Http\Controllers\SyncController;
use App\Http\Controllers\TranslationController;
use App\Models\Service;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Route;
use Inertia\Inertia;
Route::middleware('guest')->group(function () {
Route::get('/login', [AuthController::class, 'showLogin'])->name('login');
Route::get('/auth/churchtools', [AuthController::class, 'redirect'])->name('auth.churchtools');
Route::get('/auth/churchtools/callback', [AuthController::class, 'callback'])->name('auth.churchtools.callback');
});
if (app()->environment('local', 'testing')) {
Route::middleware('guest')->group(function () {
Route::post('/dev-login', function () {
$user = \App\Models\User::updateOrCreate(
['email' => 'test@local.dev'],
[
'name' => 'Test Benutzer',
'churchtools_id' => 99999,
'password' => '',
'avatar' => null,
'churchtools_groups' => [],
'churchtools_roles' => [],
]
);
Auth::login($user);
return redirect()->route('dashboard');
})->name('dev-login');
});
}
Route::post('/logout', [AuthController::class, 'logout'])
->middleware('auth')
->name('logout');
Route::get('/bookmarklets/ccli-import.js', [BookmarkletController::class, 'show'])->name('bookmarklets.ccli');
Route::middleware('auth')->group(function () {
Route::get('/', function () {
$service = Service::nextUpcoming()->first();
if ($service) {
return redirect()->route('services.edit', $service->id);
}
return redirect()->route('services.index');
});
Route::get('/dashboard', function () {
return Inertia::render('Dashboard');
})->name('dashboard');
Route::get('/services', [ServiceController::class, 'index'])->name('services.index');
Route::post('/services/{service}/finalize', [ServiceController::class, 'finalize'])->name('services.finalize');
Route::post('/services/{service}/reopen', [ServiceController::class, 'reopen'])->name('services.reopen');
Route::delete('/services/{service}', [ServiceController::class, 'destroy'])->name('services.destroy');
Route::get('/services/{service}/download', [ServiceController::class, 'download'])->name('services.download');
Route::get('/services/{service}/download-preview', [ServiceController::class, 'downloadPreview'])->name('services.download-preview');
Route::get('/services/{service}/download-bundle/{blockType}', [ServiceController::class, 'downloadBundle'])->name('services.download-bundle');
Route::get('/services/{service}/agenda-items/{agendaItem}/download', [ServiceController::class, 'downloadAgendaItem'])->name('services.agenda-item.download');
Route::get('/services/{service}/edit', [ServiceController::class, 'edit'])->name('services.edit');
Route::post('/services/{service}/key-visual', [ServiceImageController::class, 'storeKeyVisual'])->name('services.key-visual.store');
Route::post('/services/{service}/background', [ServiceImageController::class, 'storeBackground'])->name('services.background.store');
Route::patch('/services/{service}/name-overrides', [ServiceController::class, 'updateNameOverrides'])->name('services.name-overrides.update');
Route::get('/songs/{song}/translate', [TranslationController::class, 'page'])->name('songs.translate');
Route::get('/songs', function () {
return Inertia::render('Songs/Index');
})->name('songs.index');
Route::get('/songs/import-from-ccli-paste', [CcliPasteController::class, 'showImportPage'])
->name('songs.import-from-ccli-paste');
Route::get('/api-logs', [ApiLogController::class, 'index'])->name('api-logs.index');
Route::get('/api-logs/{log}/response-body', [ApiLogController::class, 'responseBody'])->name('api-logs.response-body');
Route::get('/settings', [SettingsController::class, 'index'])->name('settings.index');
Route::patch('/settings', [SettingsController::class, 'update'])->name('settings.update');
Route::post('/songs/{song}/arrangements', '\\App\\Http\\Controllers\\ArrangementController@store')->name('arrangements.store');
Route::post('/arrangements/{arrangement}/clone', '\\App\\Http\\Controllers\\ArrangementController@clone')->name('arrangements.clone');
Route::put('/arrangements/{arrangement}', '\\App\\Http\\Controllers\\ArrangementController@update')->name('arrangements.update');
Route::delete('/arrangements/{arrangement}', '\\App\\Http\\Controllers\\ArrangementController@destroy')->name('arrangements.destroy');
Route::post('/songs/{song}/sections', [SongSectionController::class, 'store'])->name('songs.sections.store');
Route::patch('/songs/{song}/sections/{section}', [SongSectionController::class, 'update'])->name('songs.sections.update');
Route::delete('/songs/{song}/sections/{section}', [SongSectionController::class, 'destroy'])->name('songs.sections.destroy');
Route::get('/songs/{song}/arrangements/{arrangement}/pdf', [SongPdfController::class, 'download'])->name('songs.pdf');
Route::get('/songs/{song}/arrangements/{arrangement}/preview', [SongPdfController::class, 'preview'])->name('songs.preview');
Route::post('/sync', [SyncController::class, 'sync'])->name('sync');
/*
|--------------------------------------------------------------------------
| Folien-Verwaltung
|--------------------------------------------------------------------------
*/
Route::post('/slides', '\\App\\Http\\Controllers\\SlideController@store')->name('slides.store');
Route::delete('/slides/bulk', '\\App\\Http\\Controllers\\SlideController@destroyBulk')->name('slides.bulk-destroy');
Route::post('/slides/reorder', '\\App\\Http\\Controllers\\SlideController@reorder')->name('slides.reorder');
Route::delete('/slides/{slide}', '\\App\\Http\\Controllers\\SlideController@destroy')->name('slides.destroy');
Route::patch('/slides/{slide}/expire-date', '\\App\\Http\\Controllers\\SlideController@updateExpireDate')->name('slides.update-expire-date');
/*
|--------------------------------------------------------------------------
| Makro- und Label-Import (ProPresenter)
|--------------------------------------------------------------------------
*/
Route::post('/settings/export-pro-files', [ExportProFileController::class, 'store'])->name('settings.export-pro-files.store');
Route::delete('/settings/export-pro-files/{exportProFile}', [ExportProFileController::class, 'destroy'])->name('settings.export-pro-files.destroy');
Route::post('/settings/macros/import', [MacroImportController::class, 'store'])->name('settings.macros.import');
Route::post('/settings/labels/import', [LabelImportController::class, 'store'])->name('settings.labels.import');
/*
|--------------------------------------------------------------------------
| Globale Makro-Zuweisungen
|--------------------------------------------------------------------------
*/
Route::get('/settings/macro-assignments', [MacroAssignmentController::class, 'index'])->name('settings.macro-assignments.index');
Route::post('/settings/macro-assignments/reorder', [MacroAssignmentController::class, 'reorder'])->name('settings.macro-assignments.reorder');
Route::post('/settings/macro-assignments', [MacroAssignmentController::class, 'store'])->name('settings.macro-assignments.store');
Route::patch('/settings/macro-assignments/{macroAssignment}', [MacroAssignmentController::class, 'update'])->name('settings.macro-assignments.update');
Route::delete('/settings/macro-assignments/{macroAssignment}', [MacroAssignmentController::class, 'destroy'])->name('settings.macro-assignments.destroy');
/*
|--------------------------------------------------------------------------
| Service-spezifische Makro-Overrides
|--------------------------------------------------------------------------
*/
Route::post('/services/{service}/macro-overrides', [ServiceMacroOverrideController::class, 'store'])->name('services.macro-overrides.store');
Route::delete('/services/{service}/macro-overrides', [ServiceMacroOverrideController::class, 'destroy'])->name('services.macro-overrides.destroy');
Route::post('/services/{service}/macro-assignments', [ServiceMacroOverrideController::class, 'storeAssignment'])->name('services.macro-assignments.store');
Route::patch('/services/{service}/macro-assignments/{serviceMacroAssignment}', [ServiceMacroOverrideController::class, 'updateAssignment'])->name('services.macro-assignments.update');
Route::delete('/services/{service}/macro-assignments/{serviceMacroAssignment}', [ServiceMacroOverrideController::class, 'destroyAssignment'])->name('services.macro-assignments.destroy');
});