Menü-Editor, farbige Initialen, Seitenköpfe, Favoriten, Vorschaubilder
All checks were successful
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 2m55s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 2m44s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 3m25s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 3m39s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 3m47s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 3m51s
CI / PHP 8.4 / mysql:8.4 (pull_request) Successful in 3m16s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 3m25s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m10s

- Admin → Portal → Menü: Bereiche, Seiten (mit Unterseiten), Links und
  Gruppen mit Unterpunkten, sortierbar, je Rolle einschränkbar;
  Kopfzeile misst den Platz und legt Überzähliges unter „Mehr“
- Initialen in fester Farbe je Person, Abteilungsfarben im Organigramm
- PageHeader für alle Übersichtsseiten
- Dokumente: Favoriten (auch als Startseiten-Kachel), „Häufig genutzt“,
  Vorschaubilder (Bilder, erste PDF-Seite per pdf.js im Browser)
- Platzhalter beim Nachladen

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Friederich Loheide 2026-09-26 13:56:57 +00:00
parent 114811e6c5
commit dda250aaad
140 changed files with 1993 additions and 427 deletions

View file

@ -144,6 +144,51 @@ class DocumentsTest extends TestCase
$this->get("/dokumente/ordner/{$this->vertraege->id}")->assertInertia(fn (Assert $p) => $p->where('recent', [])->where('documents.0.folder_name', null));
}
public function test_favorites_downloads_and_popular_documents(): void
{
$this->uploadTo($this->personal, [UploadedFile::fake()->create('Urlaubsantrag.pdf', 5, 'application/pdf'), UploadedFile::fake()->create('Reisekosten.xlsx', 5)]);
[$antrag, $reise] = [Document::query()->where('title', 'Urlaubsantrag')->sole(), Document::query()->where('title', 'Reisekosten')->sole()];
$employee = User::factory()->create(['department' => 'Pflege']);
$this->actingAs($employee)->post("/dokumente/{$antrag->id}/favorit")->assertRedirect();
$this->post("/dokumente/{$antrag->id}/favorit"); // doppelt schadet nicht
$this->get($reise->downloadUrl())->assertOk();
$this->get($reise->downloadUrl())->assertOk();
$before = $reise->fresh()->updated_at;
$this->get($antrag->downloadUrl().'?vorschau=1')->assertOk()->assertHeader('Content-Security-Policy');
$this->assertSame(2, $reise->fresh()->downloads);
$this->assertSame(0, $antrag->fresh()->downloads, 'Vorschaubilder zählen nicht');
$this->assertEquals($before, $reise->fresh()->updated_at, 'Downloads sind keine Änderung');
$this->get('/dokumente')->assertInertia(fn (Assert $p) => $p
->where('favorites.0.title', 'Urlaubsantrag')
->where('favorites.0.favorite', true)
->where('favorites.0.preview_kind', 'pdf')
->where('popular.0.title', 'Reisekosten')
->where('popular.0.preview_url', null));
$this->get('/')->assertInertia(fn (Assert $p) => $p->where(
'widgets',
fn ($widgets) => collect($widgets)->firstWhere('key', 'documents.favorites')['props']['favorites'][0]['title'] === 'Urlaubsantrag'
));
$this->delete("/dokumente/{$antrag->id}/favorit");
$this->get('/dokumente')->assertInertia(fn (Assert $p) => $p->where('favorites', []));
// Ohne Sichtrecht kein Favorit.
Audiences::sync('document_folder', $this->personal->id, ['department' => ['Personal']]);
FolderTree::flush();
$this->post("/dokumente/{$antrag->id}/favorit")->assertNotFound();
}
public function test_previews_are_only_served_for_safe_types(): void
{
$this->uploadTo($this->personal, [UploadedFile::fake()->create('notiz.txt', 1, 'text/plain')]);
$this->get(Document::query()->sole()->downloadUrl().'?vorschau=1')->assertNotFound();
}
public function test_folders_can_only_be_deleted_when_empty(): void
{
$this->actingAs($this->hr)->delete("/dokumente/ordner/{$this->vertraege->id}")->assertRedirect(route('documents.folder', $this->personal));