diff --git a/CLAUDE.md b/CLAUDE.md index f6a9d3f..df51dc2 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -63,6 +63,6 @@ ## Entwicklung ## Verwaltungsoberfläche - Maßgeblich sind `docs/ux/verwaltung/14-verwaltungsstandard.md` (Design und Interaktion) und `15-umbauauftrag.md` (Auftrag, Nachweise). Keine neue allgemeine Designabstimmung verlangen. Einstieg für alle Agenten: `AGENTS.md`, `.cursor/rules/verwaltung-ux.mdc`. -- Gemeinsame Bausteine wiederverwenden statt neue Masken bauen: `resources/views/filament/verwaltung/` (`kopf`, `redaktion`, `texte`, `praesentation`, `einordnung`, `picker`, `bestaetigung`, `abgang`, `aufbau`, `bestand`) mit dem Trait `App\Filament\Support\ManagesEditorialSurface`. Listen nutzen `verwaltung/bestand` mit `ShowsBestand` (bzw. `ListsCompositions`, `ListsCatalog`) und den Eintrag ``, den auch der Picker verwendet; Katalogobjekte die Seite `catalog/objekt`. CMS: Seitenkopf `cms/seite-kopf` (Register, Kontexte „Abschnitt gestalten“ und „Konfigurieren“); Seiten und Menüs in der Webpräsenz (`App\Filament\Pages\Webpraesenz`, Menüs als Arbeitsstand mit einer Speicherhandlung). Der Picker liegt im Trait `ChoosesMedia` (Redaktion über `ManagesEditorialSurface`, CMS-Bilder über `ChoosesWebsiteImages`); keine eigenen Auswahllisten für Medien bauen. Redaktionelle Auswahlwerte (Materialart, Einordnung) nur über `App\Domain\Catalog\EditorialVocabulary` anbieten und prüfen (aktiv, zulässiger Kontext, vorhandene Zuordnungen erhalten); gepflegt werden sie unter „Redaktionelle Stammdaten“. Ersetzt eine Seite die Filament-Tabelle, muss sie den Dialogbereich ausgeben (in `bestand` enthalten), sonst öffnen „… anlegen“-Dialoge nicht. Gestaltungswerte nur in `verwaltung/styles.blade.php` (Tokens `--vw-…`, dokumentiert in `docs/ux/verwaltung/tokens.md`). +- Gemeinsame Bausteine wiederverwenden statt neue Masken bauen: `resources/views/filament/verwaltung/` (`kopf`, `redaktion`, `texte`, `praesentation`, `einordnung`, `picker`, `bestaetigung`, `abgang`, `aufbau`, `bestand`) mit dem Trait `App\Filament\Support\ManagesEditorialSurface`. Listen nutzen `verwaltung/bestand` mit `ShowsBestand` (bzw. `ListsCompositions`, `ListsCatalog`) und den Eintrag ``, den auch der Picker verwendet; Katalogobjekte die Seite `catalog/objekt`. CMS: Seitenkopf `cms/seite-kopf` (Register, Kontexte „Abschnitt gestalten“ und „Konfigurieren“); Seiten und Menüs in der Webpräsenz (`App\Filament\Pages\Webpraesenz`, Menüs als Arbeitsstand mit einer Speicherhandlung). Der Picker liegt im Trait `ChoosesMedia` (Redaktion über `ManagesEditorialSurface`, CMS-Bilder über `ChoosesWebsiteImages`); keine eigenen Auswahllisten für Medien bauen. Redaktionelle Auswahlwerte (Materialart, Einordnung) nur über `App\Domain\Catalog\EditorialVocabulary` anbieten und prüfen (aktiv, zulässiger Kontext, vorhandene Zuordnungen erhalten); gepflegt werden sie unter „Redaktionelle Stammdaten“. Fachliche Säulen gibt es nur in der Säulenverwaltung (`pillars`); Zuordnung über `PillarService::assign`, nie über eine Dimension. Ersetzt eine Seite die Filament-Tabelle, muss sie den Dialogbereich ausgeben (in `bestand` enthalten), sonst öffnen „… anlegen“-Dialoge nicht. Gestaltungswerte nur in `verwaltung/styles.blade.php` (Tokens `--vw-…`, dokumentiert in `docs/ux/verwaltung/tokens.md`). - Die Redaktion ist ein Arbeitsstand: nur „Redaktion speichern“ schreibt Texte, Einordnung, Präsentationsmedien und Abweichungen. Kein verdecktes Mitspeichern aus anderen Dialogen, offene Eingaben bleiben beim Wechsel erhalten. - Jede UI-Änderung in der echten Anwendung prüfen (luf-test, breite und schmale Fenster, Tastatur) und mit Screenshots in `docs/ux/verwaltung/abnahme/` belegen. Stand der Abnahme: `abnahme/teil-a.md`, `abnahme/teil-b.md`, `abnahme/teil-c.md`, `abnahme/stammdaten.md`. diff --git a/app/Console/Commands/AdoptLegacyPillars.php b/app/Console/Commands/AdoptLegacyPillars.php new file mode 100644 index 0000000..f55abb7 --- /dev/null +++ b/app/Console/Commands/AdoptLegacyPillars.php @@ -0,0 +1,25 @@ +option('dry-run'); + $report = (new LegacyPillarAdoption)->run($dryRun); + + foreach (LegacyPillarAdoption::lines($report, $dryRun) as $line) { + $this->line($line); + } + + return $report['unresolved'] === [] ? self::SUCCESS : self::FAILURE; + } +} diff --git a/app/Domain/Catalog/Composition.php b/app/Domain/Catalog/Composition.php index f5e881a..0d5068a 100644 --- a/app/Domain/Catalog/Composition.php +++ b/app/Domain/Catalog/Composition.php @@ -4,6 +4,7 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; +use Illuminate\Database\Eloquent\Relations\BelongsToMany; use Illuminate\Database\Eloquent\Relations\HasMany; class Composition extends Model @@ -44,4 +45,13 @@ public function versions(): HasMany { return $this->hasMany(CompositionVersion::class); } + + /** + * Direkt zugeordnete fachliche Säulen (zentrale Säulenverwaltung). Die Säulen der enthaltenen Medien sind davon + * getrennt und werden zur Laufzeit abgeleitet (CatalogReading::memberPillars). + */ + public function pillars(): BelongsToMany + { + return $this->belongsToMany(Pillar::class)->orderBy('pillars.sort_order')->orderBy('pillars.name'); + } } diff --git a/app/Domain/Catalog/EditorialDimension.php b/app/Domain/Catalog/EditorialDimension.php index fe177f0..46157c8 100644 --- a/app/Domain/Catalog/EditorialDimension.php +++ b/app/Domain/Catalog/EditorialDimension.php @@ -20,20 +20,15 @@ public function values(): HasMany } /** - * Inhaltselemente pflegen Themen über die Säulen, nicht noch einmal über die Dimension. - * Module, Programme und Lizenzartikel haben keine Säulenauswahl und behalten die Dimension. + * Fachliche Säulen werden für alle Objektarten über die zentrale Säulenverwaltung gewählt (`pillars`), nie über + * eine Dimension. Die alte Dimension „Fachliche Säule“ bleibt nur als Verlauf in der Datenbank und wird nirgends + * mehr angeboten, geändert oder gefiltert. * * @return Collection */ public static function forSubject(Model $subject): Collection { - $query = static::query()->with('values')->orderBy('label'); - - if ($subject instanceof ContentElement) { - $query->where('slug', '!=', self::PILLAR_SLUG); - } - - return $query->get(); + return static::query()->with('values')->where('slug', '!=', self::PILLAR_SLUG)->orderBy('label')->get(); } /** diff --git a/app/Domain/Catalog/EditorialDimensionValue.php b/app/Domain/Catalog/EditorialDimensionValue.php index e646517..008c5f3 100644 --- a/app/Domain/Catalog/EditorialDimensionValue.php +++ b/app/Domain/Catalog/EditorialDimensionValue.php @@ -7,7 +7,7 @@ class EditorialDimensionValue extends Model { - protected $fillable = ['editorial_dimension_id', 'slug', 'label', 'sort_order', 'is_active']; + protected $fillable = ['editorial_dimension_id', 'pillar_id', 'slug', 'label', 'sort_order', 'is_active']; protected function casts(): array { diff --git a/app/Domain/Catalog/EditorialVocabulary.php b/app/Domain/Catalog/EditorialVocabulary.php index efd7dea..9aa6a5b 100644 --- a/app/Domain/Catalog/EditorialVocabulary.php +++ b/app/Domain/Catalog/EditorialVocabulary.php @@ -181,13 +181,13 @@ public function dimensionGroups(Model $subject, array $assignedIds): array * @param list $selectedIds * @return list}> */ - public function dimensionFilterGroups(array $selectedIds = [], bool $withPillars = true): array + public function dimensionFilterGroups(array $selectedIds = []): array { $used = DB::table('identity_dimension_values')->distinct()->pluck('editorial_dimension_value_id')->map(fn ($id): int => (int) $id)->all(); $groups = []; foreach (EditorialDimension::query()->with('values')->orderBy('label')->get() as $dimension) { - if (! $withPillars && $dimension->slug === EditorialDimension::PILLAR_SLUG) { + if ($dimension->slug === EditorialDimension::PILLAR_SLUG) { continue; } @@ -217,7 +217,7 @@ public function dimensionFilterGroups(array $selectedIds = [], bool $withPillars */ public function memberFilterDimensions(array $selectedIds = []): Collection { - $dimensions = EditorialDimension::query()->with('values')->orderBy('label')->get(); + $dimensions = EditorialDimension::query()->with('values')->where('slug', '!=', EditorialDimension::PILLAR_SLUG)->orderBy('label')->get(); foreach ($dimensions as $dimension) { $dimension->setRelation('values', $dimension->values diff --git a/app/Domain/Catalog/LegacyPillarAdoption.php b/app/Domain/Catalog/LegacyPillarAdoption.php new file mode 100644 index 0000000..e232d7f --- /dev/null +++ b/app/Domain/Catalog/LegacyPillarAdoption.php @@ -0,0 +1,270 @@ + */ + private const TARGETS = [ + 'composition' => ['table' => 'composition_pillar', 'column' => 'composition_id', 'subjects' => 'compositions'], + 'license_article' => ['table' => 'license_article_pillar', 'column' => 'license_article_id', 'subjects' => 'license_articles'], + ]; + + /** + * @return array{ + * mapping: list>, + * unresolved: list>, + * copied: array, + * already: array, + * before: array, + * after: array, + * mirror: array + * } + */ + public function run(bool $dryRun = false): array + { + $report = [ + 'mapping' => [], + 'unresolved' => [], + 'copied' => ['composition' => 0, 'license_article' => 0], + 'already' => ['composition' => 0, 'license_article' => 0], + 'before' => $this->counts(), + 'after' => [], + 'mirror' => ['element_rows' => 0, 'missing_in_pivot' => 0, 'only_in_pivot' => 0], + ]; + + $dimension = DB::table('editorial_dimensions')->where('slug', 'saeule')->first(); + + if ($dimension === null) { + $report['after'] = $report['before']; + + return $report; + } + + $resolved = []; + + foreach (DB::table('editorial_dimension_values')->where('editorial_dimension_id', $dimension->id)->orderBy('id')->get() as $value) { + $pillar = $this->pillarFor($value); + + if (is_string($pillar)) { + $report['unresolved'][] = ['art' => 'Wert', 'wert_id' => (int) $value->id, 'wert' => $value->label, 'kennung' => $value->slug, 'grund' => $pillar]; + $report['mapping'][] = ['wert_id' => (int) $value->id, 'wert' => $value->label, 'saeule_id' => null, 'status' => 'offen']; + + continue; + } + + $resolved[(int) $value->id] = (int) $pillar->id; + $status = $value->pillar_id === null ? 'zugeordnet' : 'bereits zugeordnet'; + $hint = $value->label !== $pillar->name ? 'über Kennung zugeordnet, Bezeichnung weicht ab („'.$pillar->name.'“)' : null; + $report['mapping'][] = ['wert_id' => (int) $value->id, 'wert' => $value->label, 'saeule_id' => (int) $pillar->id, 'saeule' => $pillar->name, 'status' => $status, 'hinweis' => $hint]; + + if ($value->pillar_id === null && ! $dryRun) { + DB::table('editorial_dimension_values')->where('id', $value->id)->update(['pillar_id' => $pillar->id]); + } + } + + $subjectTypes = $this->subjectTypes(); + + foreach (DB::table('identity_dimension_values') + ->whereIn('editorial_dimension_value_id', DB::table('editorial_dimension_values')->where('editorial_dimension_id', $dimension->id)->select('id')) + ->orderBy('id')->get() as $row) { + $valueId = (int) $row->editorial_dimension_value_id; + $label = DB::table('editorial_dimension_values')->where('id', $valueId)->value('label'); + $target = $subjectTypes[$row->subject_type] ?? null; + + if ($target === 'content_element') { + $report['mirror']['element_rows']++; + + continue; + } + + $where = ['art' => 'Zuordnung', 'zuordnung_id' => (int) $row->id, 'wert_id' => $valueId, 'wert' => $label, 'objektart' => $row->subject_type, 'objekt_id' => (int) $row->subject_id, 'herkunft' => $row->origin]; + + if ($target === null) { + $report['unresolved'][] = $where + ['grund' => 'unbekannte Objektart']; + + continue; + } + + if ($row->origin !== 'direkt') { + $report['unresolved'][] = $where + ['grund' => 'abgeleitete Zuordnung (wird nicht als direkte übernommen)']; + + continue; + } + + if (! isset($resolved[$valueId])) { + $report['unresolved'][] = $where + ['grund' => 'Wert ohne belastbare Säule']; + + continue; + } + + $config = self::TARGETS[$target]; + + if (! DB::table($config['subjects'])->where('id', $row->subject_id)->exists()) { + $report['unresolved'][] = $where + ['grund' => 'Objekt nicht mehr vorhanden']; + + continue; + } + + $present = DB::table($config['table'])->where($config['column'], $row->subject_id)->where('pillar_id', $resolved[$valueId])->exists(); + + if ($present) { + $report['already'][$target]++; + + continue; + } + + if (! $dryRun) { + DB::table($config['table'])->insertOrIgnore([$config['column'] => $row->subject_id, 'pillar_id' => $resolved[$valueId]]); + } + + $report['copied'][$target]++; + } + + $report['mirror'] = array_merge($report['mirror'], $this->mirrorDivergence($dimension->id, $resolved)); + $report['after'] = $dryRun ? $report['before'] : $this->counts(); + + return $report; + } + + /** + * @param array $report + * @return list + */ + public static function lines(array $report, bool $dryRun = false): array + { + $names = ['composition' => 'Module und Programme', 'license_article' => 'Lizenzartikel']; + $lines = [$dryRun ? 'Probelauf, es wird nichts geschrieben.' : 'Übernahme abgeschlossen.', '']; + + foreach ($report['mapping'] as $row) { + $lines[] = sprintf('Wert %d „%s“ → %s%s', $row['wert_id'], $row['wert'], $row['saeule_id'] === null ? 'keine Säule (offen)' : 'Säule '.$row['saeule_id'].' „'.($row['saeule'] ?? '').'“ ('.$row['status'].')', ! empty($row['hinweis']) ? ' – '.$row['hinweis'] : ''); + } + + $lines[] = ''; + + foreach ($names as $key => $label) { + $lines[] = sprintf('%s: %d übernommen, %d bereits vorhanden, Zuordnungen vorher %d, nachher %d', $label, $report['copied'][$key], $report['already'][$key], $report['before'][$key], $report['after'][$key]); + } + + $lines[] = sprintf('Medien (nur Information): %d gespiegelte Zeilen, %d nicht mehr in der Medienzuordnung, %d nur dort. Maßgeblich bleibt die Medienzuordnung.', $report['mirror']['element_rows'], $report['mirror']['missing_in_pivot'], $report['mirror']['only_in_pivot']); + + if ($report['unresolved'] === []) { + $lines[] = 'Keine ungeklärten Fälle.'; + } else { + $lines[] = ''; + $lines[] = 'Ungeklärt, bitte entscheiden (nichts wurde geändert):'; + + foreach ($report['unresolved'] as $row) { + $lines[] = '- '.json_encode($row, JSON_UNESCAPED_UNICODE); + } + } + + return $lines; + } + + /** + * Die Säule zu einem alten Wert, oder der Grund, warum es keine belastbare gibt. + */ + private function pillarFor(object $value): object|string + { + if (preg_match('/^pfeiler-(\d+)$/', (string) $value->slug, $match) !== 1) { + return 'Kennung ist nicht „pfeiler-“, keine belastbare Verknüpfung'; + } + + $pillar = DB::table('pillars')->where('id', (int) $match[1])->first(); + + if ($pillar === null) { + return 'Die Säule zur Kennung existiert nicht mehr'; + } + + if ($value->pillar_id !== null && (int) $value->pillar_id !== (int) $pillar->id) { + return 'Gespeicherte Verknüpfung (Säule '.$value->pillar_id.') und Kennung (Säule '.$pillar->id.') widersprechen sich'; + } + + if ($pillar->created_at !== null && $value->created_at !== null && $pillar->created_at > $value->created_at) { + return 'Die Säule ist jünger als der Wert; die Kennung kann nicht aus ihr entstanden sein'; + } + + return $pillar; + } + + /** + * @return array Objektart wie gespeichert => Ziel + */ + private function subjectTypes(): array + { + $types = []; + + foreach ([ + 'composition' => [Composition::class], + 'license_article' => [LicenseArticle::class], + 'content_element' => [ContentElement::class], + ] as $target => $classes) { + foreach ($classes as $class) { + $types[$class] = $target; + $types[(new $class)->getMorphClass()] = $target; + } + } + + return $types; + } + + /** + * @return array + */ + private function counts(): array + { + return [ + 'composition' => DB::table('composition_pillar')->count(), + 'license_article' => DB::table('license_article_pillar')->count(), + ]; + } + + /** + * @param array $resolved + * @return array{missing_in_pivot: int, only_in_pivot: int} + */ + private function mirrorDivergence(int $dimensionId, array $resolved): array + { + $mirrored = []; + + foreach (DB::table('identity_dimension_values') + ->whereIn('subject_type', array_unique([ContentElement::class, (new ContentElement)->getMorphClass()])) + ->whereIn('editorial_dimension_value_id', array_keys($resolved) ?: [0]) + ->get() as $row) { + $mirrored[$row->subject_id.':'.$resolved[(int) $row->editorial_dimension_value_id]] = true; + } + + $pivot = []; + + foreach (DB::table('content_element_pillar')->get() as $row) { + $pivot[$row->content_element_id.':'.$row->pillar_id] = true; + } + + return [ + 'missing_in_pivot' => count(array_diff_key($mirrored, $pivot)), + 'only_in_pivot' => count(array_diff_key($pivot, $mirrored)), + ]; + } +} diff --git a/app/Domain/Catalog/LicenseArticle.php b/app/Domain/Catalog/LicenseArticle.php index 8116e63..197093f 100644 --- a/app/Domain/Catalog/LicenseArticle.php +++ b/app/Domain/Catalog/LicenseArticle.php @@ -4,6 +4,7 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; +use Illuminate\Database\Eloquent\Relations\BelongsToMany; use Illuminate\Database\Eloquent\Relations\HasMany; class LicenseArticle extends Model @@ -49,4 +50,10 @@ public function editorialContentKind(): BelongsTo { return $this->belongsTo(EditorialContentKind::class); } + + /** Direkt zugeordnete fachliche Säulen (zentrale Säulenverwaltung). */ + public function pillars(): BelongsToMany + { + return $this->belongsToMany(Pillar::class)->orderBy('pillars.sort_order')->orderBy('pillars.name'); + } } diff --git a/app/Domain/Catalog/Offer.php b/app/Domain/Catalog/Offer.php index 41f38d8..360d492 100644 --- a/app/Domain/Catalog/Offer.php +++ b/app/Domain/Catalog/Offer.php @@ -3,14 +3,29 @@ namespace App\Domain\Catalog; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\HasMany; class Offer extends Model { protected $fillable = [ 'name', + 'composition_id', + 'option_label', ]; + /** Komposition, deren öffentliche Seite die Produktseite dieser Lizenzoption ist. */ + public function composition(): BelongsTo + { + return $this->belongsTo(Composition::class); + } + + /** Bezeichnung der Option auf der Produktseite. */ + public function optionName(): string + { + return filled($this->option_label) ? (string) $this->option_label : (string) $this->name; + } + public function versions(): HasMany { return $this->hasMany(OfferVersion::class); diff --git a/app/Domain/Catalog/OfferService.php b/app/Domain/Catalog/OfferService.php index a8f913b..a245cbb 100644 --- a/app/Domain/Catalog/OfferService.php +++ b/app/Domain/Catalog/OfferService.php @@ -22,6 +22,23 @@ public function currentActiveVersion(Offer $offer): OfferVersion return $version; } + /** + * Die aktive, als Kauf angebotene Fassung mit Preis; sonst null (nicht kaufbar, zurückgezogen oder kostenlos). + */ + public function purchasableVersion(Offer $offer): ?OfferVersion + { + $version = $offer->versions() + ->where('status', OfferStatus::Aktiv) + ->orderByDesc('number') + ->first(); + + if ($version === null || $version->grant_kind !== 'kauf' || $version->price_cents === null) { + return null; + } + + return $version; + } + /** * @param array $capabilities * @param array $options @@ -138,6 +155,40 @@ public function activate(Offer $offer, array $lines, array $attributes = []): Of }); } + /** + * Zieht die Option aus dem Verkauf zurück: Die aktive Fassung wird beendet und bleibt gespeichert. Bereits + * begründete Berechtigungen und Bestellungen ändern sich nicht; offene Warenkörbe zeigen die Position als + * zurückgezogen und blockieren den Abschluss, bis der Käufer sie entfernt. + */ + public function end(Offer $offer): OfferVersion + { + return DB::transaction(function () use ($offer): OfferVersion { + $offer = Offer::query()->lockForUpdate()->findOrFail($offer->id); + $version = $this->currentActiveVersion($offer); + $version->status = OfferStatus::Beendet; + $version->save(); + + return $version; + }); + } + + /** + * Produktzuordnung der Option: Die Komposition bestimmt die öffentliche Produktseite und die Alternativgruppe, + * die Bezeichnung benennt die Option auf dieser Seite. Beides sind keine bindenden Konditionen. + */ + public function assignProduct(Offer $offer, ?int $compositionId, ?string $optionLabel): Offer + { + if ($compositionId !== null) { + Composition::query()->findOrFail($compositionId); + } + + $offer->composition_id = $compositionId; + $offer->option_label = filled($optionLabel) ? trim((string) $optionLabel) : null; + $offer->save(); + + return $offer; + } + /** * @return list */ diff --git a/app/Domain/Catalog/Pillar.php b/app/Domain/Catalog/Pillar.php index 91e4998..a408713 100644 --- a/app/Domain/Catalog/Pillar.php +++ b/app/Domain/Catalog/Pillar.php @@ -34,6 +34,16 @@ public function pages(): BelongsToMany return $this->belongsToMany(Page::class); } + public function compositions(): BelongsToMany + { + return $this->belongsToMany(Composition::class); + } + + public function licenseArticles(): BelongsToMany + { + return $this->belongsToMany(LicenseArticle::class); + } + /** * @param Builder $query * @return Builder diff --git a/app/Domain/Catalog/PillarFilterCompat.php b/app/Domain/Catalog/PillarFilterCompat.php new file mode 100644 index 0000000..d1814d2 --- /dev/null +++ b/app/Domain/Catalog/PillarFilterCompat.php @@ -0,0 +1,31 @@ +join('editorial_dimensions', 'editorial_dimensions.id', '=', 'editorial_dimension_values.editorial_dimension_id') + ->where('editorial_dimension_values.id', $valueId) + ->where('editorial_dimensions.slug', EditorialDimension::PILLAR_SLUG) + ->first(['editorial_dimension_values.pillar_id']); + + if ($row === null) { + return false; + } + + return $row->pillar_id === null ? null : (int) $row->pillar_id; + } +} diff --git a/app/Domain/Catalog/PillarService.php b/app/Domain/Catalog/PillarService.php index c8f14df..7b44a56 100644 --- a/app/Domain/Catalog/PillarService.php +++ b/app/Domain/Catalog/PillarService.php @@ -40,19 +40,55 @@ public function present(Pillar $pillar, string $name, string $slug, ?string $sum public function delete(Pillar $pillar): void { - if ($pillar->elements()->exists() || $pillar->pages()->exists()) { - throw new DomainRuleException('Eine Säule mit zugeordneten Medien oder Seiten wird nicht gelöscht.'); + $usage = $this->usage($pillar); + + if (array_sum($usage) > 0) { + throw new DomainRuleException('Eine Säule mit zugeordneten Objekten wird nicht gelöscht ('.$this->usageText($usage).'). Ordnen Sie sie zuerst anders zu.'); } $pillar->delete(); } /** - * @param list $pillarIds + * Zuordnungen je Objektart: Medien, Module und Programme, Lizenzartikel, Seiten. + * + * @return array{medien: int, zusammenstellungen: int, lizenzartikel: int, seiten: int} */ - public function assign(ContentElement $element, array $pillarIds): void + public function usage(Pillar $pillar): array { - $element->pillars()->sync($this->ids($pillarIds)); + return [ + 'medien' => $pillar->elements()->count(), + 'zusammenstellungen' => $pillar->compositions()->count(), + 'lizenzartikel' => $pillar->licenseArticles()->count(), + 'seiten' => $pillar->pages()->count(), + ]; + } + + /** + * @param array{medien: int, zusammenstellungen: int, lizenzartikel: int, seiten: int} $usage + */ + public function usageText(array $usage): string + { + $parts = []; + + foreach (['medien' => ['Medium', 'Medien'], 'zusammenstellungen' => ['Modul oder Programm', 'Module und Programme'], 'lizenzartikel' => ['Lizenzartikel', 'Lizenzartikel'], 'seiten' => ['Seite', 'Seiten']] as $key => [$one, $many]) { + if ($usage[$key] > 0) { + $parts[] = $usage[$key].' '.($usage[$key] === 1 ? $one : $many); + } + } + + return $parts === [] ? 'nirgends zugeordnet' : implode(', ', $parts); + } + + /** + * Ordnet einem Medium, Modul, Programm, Lizenzartikel oder einer Seite Säulen zu. Alle Objektarten verwenden + * dieselbe zentrale Säule und dieselbe Speicherregel; die Zuordnung ersetzt die bisherige vollständig. + * + * @param list $pillarIds + */ + public function assign(ContentElement|Composition|LicenseArticle|Page $subject, array $pillarIds): void + { + $subject->pillars()->sync($this->ids($pillarIds)); } /** @@ -60,7 +96,7 @@ public function assign(ContentElement $element, array $pillarIds): void */ public function assignPages(Page $page, array $pillarIds): void { - $page->pillars()->sync($this->ids($pillarIds)); + $this->assign($page, $pillarIds); } /** diff --git a/app/Domain/Cms/Catalog/CardSubject.php b/app/Domain/Cms/Catalog/CardSubject.php index 902a185..d75a52f 100644 --- a/app/Domain/Cms/Catalog/CardSubject.php +++ b/app/Domain/Cms/Catalog/CardSubject.php @@ -15,6 +15,8 @@ * Redaktionsvorschau (Route editorial.card, nur für angemeldete Redaktion); öffentlich nie ausgegeben, weil es * keine Freigabe für die Website hat. * - missing: was für eine vollständige Karte fehlt, als Hinweis nur in der Redaktionsvorschau. + * - texts: die zentralen Texte des Fachobjekts, aus denen die Karte einen wählen kann (teaser, summary, description). + * summary bleibt der Text der Vorgabe („Automatisch“); texts wird nur gelesen, wenn die Redaktion einen wählt. */ final readonly class CardSubject { @@ -36,24 +38,39 @@ public function __construct( public ?string $previewImage = null, public array $missing = [], public ?string $style = null, + public array $texts = [], ) {} public function withText(?string $title, ?string $summary): self { - return new self( - title: $title ?? $this->title, - summary: $summary ?? $this->summary, - kind: $this->kind, - badge: $this->badge, - meta: $this->meta, - url: $this->url, - public: $this->public, - notice: $this->notice, - visual: $this->visual, - visualLabel: $this->visualLabel, - previewImage: $this->previewImage, - missing: $this->missing, - style: $this->style, - ); + return $this->copy(['title' => $title ?? $this->title, 'summary' => $summary ?? $this->summary]); + } + + /** + * Text der Karte aus einem zentralen Text des Fachobjekts. Ist er nicht gepflegt, bleibt die Karte ohne Text + * (kein stiller Ersatz aus einem anderen Feld); in der Redaktionsvorschau steht dann ein Hinweis. + */ + public function withTextChoice(string $field, string $missingHint): self + { + if (! array_key_exists($field, $this->texts)) { + return $this; + } + + $text = $this->texts[$field]; + $missing = array_values(array_filter($this->missing, fn (string $hint): bool => ! str_contains($hint, 'Kurzbeschreibung'))); + + if ($text === null) { + $missing[] = $missingHint; + } + + return $this->copy(['summary' => $text, 'missing' => $missing]); + } + + /** + * @param array $changes + */ + private function copy(array $changes): self + { + return new self(...array_merge(get_object_vars($this), $changes)); } } diff --git a/app/Domain/Cms/Catalog/PublicCatalogReader.php b/app/Domain/Cms/Catalog/PublicCatalogReader.php index dd0ab05..f1b18b9 100644 --- a/app/Domain/Cms/Catalog/PublicCatalogReader.php +++ b/app/Domain/Cms/Catalog/PublicCatalogReader.php @@ -265,6 +265,13 @@ public function subject(mixed $id, bool $includeNonPublic): ?CardSubject $profile = app(EditorialProfileReader::class)->read($composition, 'kachel'); $summary = $profile->value('teaser') ?: $profile->value('summary'); $goal = filled($version?->learning_goal) ? trim((string) $version->learning_goal) : null; + // Zentrale Texte, aus denen die Redaktion den Kartentext wählen kann (Zielgruppe „Öffentliche Kachel“). + $texts = [ + 'teaser' => $profile->value('teaser'), + 'summary' => $profile->value('summary'), + 'description' => $profile->value('description'), + 'goal' => $goal, + ]; $missing = []; if ($summary === null) { @@ -313,6 +320,7 @@ public function subject(mixed $id, bool $includeNonPublic): ?CardSubject visualLabel: $kind, previewImage: $includeNonPublic ? ThumbnailRef::url('editorial.card', 'komposition', (int) $composition->id, $composition->thumbnail_path) : null, missing: $missing, + texts: $texts, ); } diff --git a/app/Domain/Cms/Catalog/PublicMaterialReader.php b/app/Domain/Cms/Catalog/PublicMaterialReader.php index 4e6b8fc..49780f9 100644 --- a/app/Domain/Cms/Catalog/PublicMaterialReader.php +++ b/app/Domain/Cms/Catalog/PublicMaterialReader.php @@ -8,11 +8,13 @@ use App\Domain\Catalog\EditorialProfileReader; use App\Domain\Catalog\StructureNode; use App\Domain\Media\ThumbnailRef; +use App\Domain\Media\WebsiteMedia; /** * Lesesicht „Medien und Materialien“ für Premium-Karten (Website-CMS-Zielarchitektur 6.2). * - * Auswahl in der Redaktion: jedes nicht archivierte Inhaltselement mit mindestens einer nicht gesperrten Fassung. + * Auswahl in der Redaktion: jedes nicht archivierte Inhaltselement mit mindestens einer nicht gesperrten Fassung, dazu + * jeder Film, der nur aus einer Website-Datei besteht (Medium ohne Inhaltsfassung, z. B. ein Teaser). * * Öffentliche Sichtbarkeit (Übergangsregel, solange öffentliche Fachobjektprofile nach ADR-29 fehlen): * Ein Medium hat keine eigene öffentliche Seite. Öffentlich genannt wird es heute nur als Bestandteil der gezeigten @@ -20,10 +22,17 @@ * öffentlich, mit Verweis auf diese Programmseite, und nur mit bereitgestellter Fassung. Traineranleitungen erscheinen * nie öffentlich (vertraulich für Trainerinnen und Trainer). * - * Öffentlich gelesen werden Anzeigetitel (sonst Arbeitstitel), Kurzbeschreibung, Inhaltsart und Ausgabeart. Nie: - * Beschreibung, Einsatzhinweis, Lizenzvermerk, Dateien, Lehrtexte, Ausgabeadressen. Das Vorschaubild (Filmstandbild) - * der Bibliothek ist nicht für die Website freigegeben; es erscheint nur in der Redaktionsvorschau. - * Eine Karte spielt nichts ab, bietet keinen Download und gibt kein Medium frei. + * Ein Film nur mit Website-Datei hat weder Fassung noch Programm. Er erscheint öffentlich, sobald seine Website-Datei + * für die Website freigegeben ist (die Freigabe ist die ausdrückliche Entscheidung der Redaktion), ohne Verweis auf + * eine Programmseite und damit ohne Aktion. Ohne Freigabe bleibt er auf die Redaktionsvorschau beschränkt. + * + * Öffentlich gelesen werden Anzeigetitel (sonst Arbeitstitel), Inhaltsart und Ausgabeart sowie einer der Texte + * Teaser, Kurzbeschreibung oder ausführliche Beschreibung. Welcher Text erscheint, entscheidet die Redaktion je Karte + * (Einstellung „Text der Karte“); ohne Wahl gilt die Kurzbeschreibung, sonst der Teaser. Die ausführliche Beschreibung + * erscheint nur, wenn die Redaktion sie ausdrücklich wählt. Nie: Einsatzhinweis, Lizenzvermerk, Dateien, Lehrtexte, + * Ausgabeadressen. Das Vorschaubild der Bibliothek ist nicht für die Website freigegeben; es erscheint nur in der + * Redaktionsvorschau und kann in der Karte ausdrücklich als Website-Bild übernommen werden (FilmStill). + * Eine Karte spielt höchstens den für die Website freigegebenen Trailer ab (CardClip), bietet keinen Download und gibt kein Medium frei. */ class PublicMaterialReader { @@ -41,14 +50,36 @@ public function __construct( public function isSelectable(ContentElement $element): bool { return $element->archived_at === null - && $element->versions()->where('status', '!=', ContentVersionStatus::Gesperrt->value)->exists(); + && ($element->versions()->where('status', '!=', ContentVersionStatus::Gesperrt->value)->exists() + || $this->isWebsiteOnlyFilm($element)); + } + + /** + * Ein Film ohne jede Inhaltsfassung, der nur die Website-Datei (`teaser/…`) hat, zum Beispiel ein Teaser. Er kann + * auf der Medienkarte gewählt werden; was daraus öffentlich wird, bestimmt allein die Freigabe der Datei. + */ + public function isWebsiteOnlyFilm(ContentElement $element): bool + { + return $element->output_class === 'film' + && filled($element->preview_path) + && ! $element->versions()->exists(); } public function isReady(ContentElement $element): bool { + if ($this->isWebsiteOnlyFilm($element)) { + return $this->isWebsiteReleased($element); + } + return $element->versions()->where('status', ContentVersionStatus::Bereit->value)->exists(); } + /** Die Website-Datei des Films ist freigegeben und wird tatsächlich ausgeliefert (WebsiteMedia). */ + private function isWebsiteReleased(ContentElement $element): bool + { + return app(WebsiteMedia::class)->present($element)?->kind === 'film'; + } + /** * Öffentliches Programm, in dessen gezeigter Fassung das Element vorkommt, sonst null. * @@ -64,7 +95,7 @@ public function isPublic(ContentElement $element): bool return $this->isSelectable($element) && $this->isReady($element) && ! in_array($element->editorialContentKind?->slug, self::CONFIDENTIAL_KINDS, true) - && $this->publicProgramFor($element) !== null; + && ($this->publicProgramFor($element) !== null || $this->isWebsiteOnlyFilm($element)); } /** @@ -77,7 +108,13 @@ public function search(?string $term, int $limit = 25): array $candidates = ContentElement::query() ->with('editorialContentKind') ->whereNull('archived_at') - ->whereHas('versions', fn ($query) => $query->where('status', '!=', ContentVersionStatus::Gesperrt->value)) + ->where(fn ($selectable) => $selectable + ->whereHas('versions', fn ($query) => $query->where('status', '!=', ContentVersionStatus::Gesperrt->value)) + ->orWhere(fn ($websiteOnly) => $websiteOnly + ->where('output_class', 'film') + ->whereNotNull('preview_path') + ->where('preview_path', '!=', '') + ->whereDoesntHave('versions'))) ->when($term !== '', function ($query) use ($term): void { $like = '%'.mb_strtolower($term).'%'; $query->where(fn ($inner) => $inner @@ -124,7 +161,7 @@ public function subject(mixed $id, bool $includeNonPublic, array $draft = []): ? $shown = clone $element; - foreach (['working_title', 'display_title', 'summary', 'thumbnail_path', 'thumbnail_alt'] as $field) { + foreach (['working_title', 'display_title', 'teaser', 'summary', 'description', 'thumbnail_path', 'thumbnail_alt'] as $field) { if (! array_key_exists($field, $draft)) { continue; } @@ -146,17 +183,30 @@ public function subject(mixed $id, bool $includeNonPublic, array $draft = []): ? $summary = trim((string) $shown->teaser); } + $texts = []; + + foreach (['teaser', 'summary', 'description'] as $field) { + $own = filled($shown->getAttribute($field)) ? trim((string) $shown->getAttribute($field)) : null; + + if (! array_key_exists($field, $draft) && $profile->origin($field) === 'variante') { + $own = $profile->value($field); + } + + $texts[$field] = $own; + } + $title = (string) ($shown->display_title ?: $shown->working_title); if (! array_key_exists('display_title', $draft) && $profile->origin('display_title') === 'variante') { $title = (string) $profile->value('display_title'); } + $websiteOnly = $this->isWebsiteOnlyFilm($element); $meta = [$output]; if ($program !== null) { $meta[] = 'Im Programm „'.$program['title'].'“'; } - if ($film) { + if ($film && ! $websiteOnly) { $meta[] = 'Vollständiger Film nur mit Lizenz im Mitgliederbereich'; } @@ -184,6 +234,7 @@ public function subject(mixed $id, bool $includeNonPublic, array $draft = []): ? previewImage: $previewImage, missing: $missing, style: $film ? 'media' : 'material', + texts: $texts, ); } @@ -204,7 +255,11 @@ public function visibilityNote(ContentElement $element): string if ($this->isPublic($element)) { $program = $this->publicProgramFor($element); - return 'Öffentlich nur als Teil der Programmseite „'.($program['title'] ?? '').'“. Die Mediendatei wird dabei nicht ausgeliefert.'; + if ($program === null) { + return 'Öffentlich mit der für die Website freigegebenen Datei, ohne Verweis auf eine Programmseite. Die Originaldatei wird nie ausgeliefert.'; + } + + return 'Öffentlich nur als Teil der Programmseite „'.$program['title'].'“. Die Mediendatei wird dabei nicht ausgeliefert.'; } return $this->notice($element, $this->publicProgramFor($element)); @@ -217,6 +272,7 @@ private function notice(ContentElement $element, ?array $program): string { $reason = match (true) { in_array($element->editorialContentKind?->slug, self::CONFIDENTIAL_KINDS, true) => 'Traineranleitungen erscheinen nie öffentlich.', + $this->isWebsiteOnlyFilm($element) => 'Die Website-Datei ist nicht für die Website freigegeben (Medium öffnen → Reiter „Website“ → freigeben).', ! $this->isReady($element) => 'Das Medium hat noch keine bereitgestellte Fassung.', $program === null => 'Das Medium gehört zu keinem öffentlich gezeigten Programm. Medien haben noch keine eigene öffentliche Freigabe (öffentliches Profil, ADR-29).', default => 'Das Medium ist nicht öffentlich.', @@ -227,9 +283,14 @@ private function notice(ContentElement $element, ?array $program): string private function optionLabel(ContentElement $element): string { - $visibility = $this->isPublic($element) - ? 'öffentlich über Programmseite' - : ($this->isReady($element) ? 'nur Redaktionsvorschau' : 'Entwurf, nur Redaktionsvorschau'); + $visibility = match (true) { + $this->isWebsiteOnlyFilm($element) => $this->isPublic($element) + ? 'öffentlich mit Website-Datei' + : 'Website-Datei nicht freigegeben, nur Redaktionsvorschau', + $this->isPublic($element) => 'öffentlich über Programmseite', + $this->isReady($element) => 'nur Redaktionsvorschau', + default => 'Entwurf, nur Redaktionsvorschau', + }; $kind = $element->editorialContentKind?->label ?: self::outputLabel((string) $element->output_class); return (string) ($element->display_title ?: $element->working_title).' · '.$kind.' · '.$visibility; diff --git a/app/Domain/Cms/Widgets/Support/CardClip.php b/app/Domain/Cms/Widgets/Support/CardClip.php new file mode 100644 index 0000000..d2abeb2 --- /dev/null +++ b/app/Domain/Cms/Widgets/Support/CardClip.php @@ -0,0 +1,98 @@ +with(['role', 'element']) + ->where('subject_type', $subject->getMorphClass()) + ->where('subject_id', $subject->getKey()) + ->whereHas('role', fn ($query) => $query->whereIn('slug', self::ROLES)) + ->orderBy('position') + ->orderBy('id') + ->get() + ->sortBy(fn (PresentationAssignment $row): int => (int) array_search($row->role?->slug, self::ROLES, true)) + ->values(); + + $unreleased = null; + + foreach ($assigned as $assignment) { + $element = $assignment->element; + + if (! $element instanceof ContentElement || $element->archived_at !== null || $element->output_class !== 'film') { + continue; + } + + $present = $this->media->present($element); + + if ($present !== null && $present->kind === 'film') { + return $this->found($present->url, $present->title, $assignment->role?->slug === 'trailer' ? 'trailer' : 'vorschauclip'); + } + + $unreleased ??= $element; + } + + if ($subject instanceof ContentElement && $subject->output_class === 'film') { + $own = $this->media->present($subject); + + if ($own !== null && $own->kind === 'film') { + return $this->found($own->url, $own->title, 'teaser'); + } + } + + if (! $preview) { + return $this->none(); + } + + if ($unreleased instanceof ContentElement) { + $title = (string) ($unreleased->display_title ?: $unreleased->working_title); + + return $this->none('Der Trailer „'.$title.'“ ist nicht für die Website freigegeben; öffentlich bleibt es beim Kartenbild (Medium öffnen → Reiter „Website“ → freigeben).'); + } + + return $this->none(null, 'Kein Trailer zugeordnet; die Karte zeigt nur das Bild (Rolle „Trailer“ in der Präsentation des Mediums).'); + } + + /** + * @return array{url: string|null, title: string, source: string, notice: string|null, hint: string|null} + */ + private function found(string $url, string $title, string $source): array + { + return ['url' => $url, 'title' => $title, 'source' => $source, 'notice' => null, 'hint' => null]; + } + + /** + * @return array{url: string|null, title: string, source: string, notice: string|null, hint: string|null} + */ + private function none(?string $notice = null, ?string $hint = null): array + { + return ['url' => null, 'title' => '', 'source' => 'none', 'notice' => $notice, 'hint' => $hint]; + } +} diff --git a/app/Domain/Cms/Widgets/Support/HeroVideo.php b/app/Domain/Cms/Widgets/Support/HeroVideo.php new file mode 100644 index 0000000..dcdf85a --- /dev/null +++ b/app/Domain/Cms/Widgets/Support/HeroVideo.php @@ -0,0 +1,137 @@ + + */ + public function options(?string $term, int $limit = 25): array + { + $term = trim((string) $term); + + $candidates = ContentElement::query() + ->with('editorialContentKind') + ->where('output_class', 'film') + ->whereNull('archived_at') + ->when($term !== '', function ($query) use ($term): void { + $like = '%'.mb_strtolower($term).'%'; + $query->where(fn ($inner) => $inner + ->whereRaw('LOWER(working_title) LIKE ?', [$like]) + ->orWhereRaw('LOWER(COALESCE(display_title, \'\')) LIKE ?', [$like])); + }) + ->orderBy('working_title') + ->limit($limit * 2) + ->get(); + + $options = []; + + foreach ($candidates as $element) { + if (! $this->allowed($element)) { + continue; + } + + $options[$element->id] = $this->label($element); + + if (count($options) >= $limit) { + break; + } + } + + return $options; + } + + public function labelFor(mixed $id): ?string + { + $element = is_numeric($id) ? ContentElement::query()->with('editorialContentKind')->find((int) $id) : null; + + return $element instanceof ContentElement ? $this->label($element) : null; + } + + /** + * Prüft die gewählte Kennung. Gibt die Kennung zurück oder null, wenn keine gewählt ist oder die Wahl ungültig ist. + */ + public function clean(mixed $value, WidgetErrors $errors, string $key = 'refs.video'): ?int + { + if ($value === null || $value === '' || $value === false) { + return null; + } + + $element = is_numeric($value) ? ContentElement::query()->with('editorialContentKind')->find((int) $value) : null; + + if (! $element instanceof ContentElement || ! $this->allowed($element)) { + $errors->add($key, 'Bitte einen Film aus dem Medienmanager wählen (nicht archiviert, nicht gesperrt, keine Traineranleitung).'); + + return null; + } + + return $element->id; + } + + /** + * @return array{url: string|null, title: string, notice: string|null} + */ + public function resolve(mixed $id, bool $preview): array + { + $element = is_numeric($id) ? ContentElement::query()->with('editorialContentKind')->find((int) $id) : null; + + if (! $element instanceof ContentElement) { + return ['url' => null, 'title' => '', 'notice' => null]; + } + + $title = (string) ($element->display_title ?: $element->working_title); + + if (! $this->allowed($element)) { + return ['url' => null, 'title' => $title, 'notice' => $preview ? 'Das gewählte Medium „'.$title.'“ ist archiviert oder gesperrt; es erscheint kein Video.' : null]; + } + + $clip = $this->clips->for($element, $preview); + + if ($clip['url'] !== null) { + return ['url' => $clip['url'], 'title' => $clip['title'] !== '' ? $clip['title'] : $title, 'notice' => null]; + } + + return [ + 'url' => null, + 'title' => $title, + 'notice' => $preview + ? 'Für „'.$title.'“ gibt es kein für die Website freigegebenes Video (Trailer, Vorschauclip oder freigegebene Website-Datei des Mediums); öffentlich bleibt es beim Foto. Freigabe: Medium öffnen → Reiter „Website“.' + : null, + ]; + } + + /** Ein Film, der nicht archiviert, nicht gesperrt und keine Traineranleitung ist. */ + private function allowed(ContentElement $element): bool + { + return $element->output_class === 'film' + && $this->materials->isSelectable($element) + && ! in_array($element->editorialContentKind?->slug, PublicMaterialReader::CONFIDENTIAL_KINDS, true); + } + + private function label(ContentElement $element): string + { + $state = $this->clips->for($element, false)['url'] !== null ? 'Video freigegeben' : 'noch kein freigegebenes Video'; + + return (string) ($element->display_title ?: $element->working_title).' · '.$state; + } +} diff --git a/app/Domain/Cms/Widgets/Support/WebsiteImage.php b/app/Domain/Cms/Widgets/Support/WebsiteImage.php index 61b5a15..08cbb06 100644 --- a/app/Domain/Cms/Widgets/Support/WebsiteImage.php +++ b/app/Domain/Cms/Widgets/Support/WebsiteImage.php @@ -127,6 +127,10 @@ public function url(mixed $value, bool $preview = false): ?string $legacy = self::normalize($value); + if (is_string($legacy) && WebsiteMediaAlias::isRetired($legacy)) { + return null; + } + return is_string($legacy) ? PublicMedia::url($legacy) : null; } @@ -175,6 +179,10 @@ public function status(mixed $value): ?array $id = $this->elementId($value); + if ($id === null && WebsiteMediaAlias::isRetired($value)) { + return ['public' => false, 'state' => 'missing', 'title' => basename((string) $value), 'note' => 'Das Medium wurde gelöscht.', 'thumb' => null, 'manageUrl' => null]; + } + if ($id === null) { return [ 'public' => true, diff --git a/app/Domain/Cms/Widgets/Types/HeroWidget.php b/app/Domain/Cms/Widgets/Types/HeroWidget.php index ad02d15..344c074 100644 --- a/app/Domain/Cms/Widgets/Types/HeroWidget.php +++ b/app/Domain/Cms/Widgets/Types/HeroWidget.php @@ -3,12 +3,14 @@ namespace App\Domain\Cms\Widgets\Types; use App\Domain\Cms\Widgets\RenderContext; +use App\Domain\Cms\Widgets\Support\HeroVideo; use App\Domain\Cms\Widgets\Support\ImageRefFields; use App\Domain\Cms\Widgets\Support\PremiumFields; use App\Domain\Cms\Widgets\Support\PublicMedia; use App\Domain\Cms\Widgets\Support\WebsiteImage; use App\Domain\Cms\Widgets\WidgetErrors; use App\Domain\Cms\Widgets\WidgetType; +use Filament\Forms\Components\Select; use Filament\Forms\Components\Textarea; use Filament\Forms\Components\TextInput; use Filament\Schemas\Components\Group; @@ -20,6 +22,10 @@ * Containerbreite), Label, Überschriftenebene, Bildfokus in Prozent, Akzent, zwei Schaltflächen. * Die data-Schlüssel der Version 1 (heading, text, cta_*, alt) bleiben unverändert, damit ältere Revisionen und ein * Code-Rollback darstellbar bleiben. + * + * Optional ein Video (refs.video, ein Film aus dem Medienmanager): In der Variante „Foto mit Textfläche“ läuft ein + * stummer, für die Website freigegebener Clip auf der Fläche des Fotos (HeroVideo, resources/js/hero-video.js). Neuer + * Schlüssel ohne Versionssprung; ältere Revisionen ohne `video` bleiben unverändert darstellbar. */ class HeroWidget extends WidgetType { @@ -109,10 +115,18 @@ public function settings(): array ]; } + public function settingGroups(): array + { + return [ + 'Aussehen' => ['accent'], + 'Seitenstruktur' => ['heading_level'], + ]; + } + public function settingLabels(): array { return [ - 'heading_level' => ['Überschriftenebene', 'Der erste Einstieg einer Seite ist immer die Hauptüberschrift (H1).'], + 'heading_level' => ['Überschriftenebene', 'Betrifft nur die Gliederung für Suchmaschinen und Hilfstechnik, nicht das Aussehen. Der erste Einstieg einer Seite ist immer die Hauptüberschrift (H1).'], 'accent' => ['Markenakzent', 'Freigegebene Akzente aus dem Brand-UI-Kit. Vorgabe: gelbe Unterstreichung.'], ]; } @@ -152,7 +166,7 @@ public function dataRules(): array public function refRules(): array { - return ImageRefFields::rules(); + return ImageRefFields::rules() + ['video' => ['nullable']]; } public function dataFields(): array @@ -169,7 +183,19 @@ public function dataFields(): array public function refFields(): array { - return ImageRefFields::fields(live: true); + return [...ImageRefFields::fields(live: true), $this->videoField()]; + } + + private function videoField(): Select + { + return Select::make('video') + ->label('Video (optional)') + ->helperText('Ein Film aus dem Medienmanager. Läuft stumm auf der Fläche des Fotos, nur in der Variante „Foto mit Textfläche“ und nur, wenn ein Trailer, Vorschauclip oder die Website-Datei des Films für die Website freigegeben ist. Das Foto bleibt als Rückfall, bei „reduzierte Bewegung“ und im Datensparmodus startet das Video nur auf Wunsch. Die Auswahl gibt nichts frei.') + ->live() + ->searchable() + ->getSearchResultsUsing(fn (?string $search): array => app(HeroVideo::class)->options($search)) + ->getOptionLabelUsing(fn (mixed $value): ?string => app(HeroVideo::class)->labelFor($value)) + ->options(fn (): array => app(HeroVideo::class)->options(null)); } public function editorSchema(): array @@ -192,6 +218,8 @@ public function mediaSchema(): array public function clean(array $data, array $refs, WidgetErrors $errors): array { $refs = ImageRefFields::clean($refs, $errors); + $video = app(HeroVideo::class)->clean($refs['video'] ?? null, $errors); + $video === null ? $refs = array_diff_key($refs, ['video' => true]) : $refs['video'] = $video; $data['heading'] = trim((string) ($data['heading'] ?? '')); $data['text'] = filled($data['text'] ?? null) ? trim((string) $data['text']) : null; $data = PremiumFields::clean($data, $errors, $refs['image'] !== null); @@ -205,8 +233,15 @@ public function resolve(array $widget, RenderContext $context): array $images = app(WebsiteImage::class); $image = $widget['refs']['image'] ?? null; + $video = app(HeroVideo::class)->resolve($widget['refs']['video'] ?? null, $context->preview); + $photoSplit = ($widget['variant'] ?? 'photo_split') !== 'editorial_solid'; + + if (! $photoSplit && $video['title'] !== '') { + $video = ['url' => null, 'title' => $video['title'], 'notice' => $context->preview ? 'Das Video erscheint nur in der Variante „Foto mit Textfläche“; die Markenfläche zeigt kein Video.' : null]; + } return [ + 'video' => $video, 'imageUrl' => $images->url($image, $context->preview), 'imageAlt' => $images->alt($image, $widget['data']['alt'] ?? null), 'imageNotice' => $context->preview ? $images->previewNotice($image) : null, diff --git a/app/Domain/Cms/Widgets/Types/ImageTextWidget.php b/app/Domain/Cms/Widgets/Types/ImageTextWidget.php index f26ef3f..e94ab78 100644 --- a/app/Domain/Cms/Widgets/Types/ImageTextWidget.php +++ b/app/Domain/Cms/Widgets/Types/ImageTextWidget.php @@ -117,11 +117,19 @@ public function settings(): array ]; } + public function settingGroups(): array + { + return [ + 'Aussehen' => ['surface'], + 'Seitenstruktur' => ['heading_level'], + ]; + } + public function settingLabels(): array { return [ 'surface' => ['Hintergrund des Widgets', 'Unabhängig vom Abschnittshintergrund. „Ohne eigene Fläche“ übernimmt den Abschnitt.'], - 'heading_level' => ['Überschriftenebene', 'Steht das Widget als erstes auf der Seite, ist die Überschrift immer H1.'], + 'heading_level' => ['Überschriftenebene', 'Betrifft nur die Gliederung für Suchmaschinen und Hilfstechnik, nicht das Aussehen. Steht das Widget als erstes auf der Seite, ist die Überschrift immer H1.'], ]; } diff --git a/app/Domain/Cms/Widgets/Types/MediaCardWidget.php b/app/Domain/Cms/Widgets/Types/MediaCardWidget.php index 39851d6..6d810d5 100644 --- a/app/Domain/Cms/Widgets/Types/MediaCardWidget.php +++ b/app/Domain/Cms/Widgets/Types/MediaCardWidget.php @@ -7,12 +7,17 @@ use App\Domain\Cms\Catalog\CardSubject; use App\Domain\Cms\Catalog\PublicMaterialReader; use App\Domain\Cms\Widgets\RenderContext; +use App\Domain\Media\FilmStill; +use App\Domain\Media\ThumbnailRef; +use Filament\Forms\Components\ViewField; +use Filament\Schemas\Components\Utilities\Get; +use Illuminate\Database\Eloquent\Model; /** * Medien- und Materialkarte (Kit v1.7 „media“): ein Inhaltselement mit Anzeigetitel, Kurzbeschreibung, Inhaltsart und * Ausgabeart. Filme erscheinen als Medienkarte (grüne Aktion, Filmtafel ohne freigegebenes Bild), Dokumente und andere * Materialien als Materialkarte (Materialsymbol). Öffentlich nur nach den Regeln von PublicMaterialReader; die Aktion - * führt auf die öffentliche Programmseite. Die Karte spielt nichts ab, bietet keinen Download und gibt kein Medium frei. + * führt auf die öffentliche Programmseite. Die Karte spielt höchstens den für die Website freigegebenen Trailer ab (CardClip), bietet keinen Download und gibt kein Medium frei. */ class MediaCardWidget extends PremiumCardWidget { @@ -28,7 +33,7 @@ public function label(): string public function description(): string { - return 'Karte zu einem Film oder Material aus der Bibliothek; Titel und Art kommen aus den Fachdaten, kein Abspielen, kein Download.'; + return 'Karte zu einem Film oder Material aus der Bibliothek; Titel und Art kommen aus den Fachdaten, Trailer nur wenn freigegeben, kein Download.'; } public function icon(): string @@ -53,7 +58,7 @@ protected function refLabel(): string protected function refHelp(): string { - return 'Wählbar sind alle nicht archivierten, nicht gesperrten Filme und Materialien. Öffentlich erscheint die Karte nur mit bereitgestellter Fassung und wenn der Inhalt zu einem öffentlich gezeigten Programm gehört; Traineranleitungen nie. Titel und Kurzbeschreibung pflegen Sie im Medium.'; + return 'Wählbar sind alle nicht archivierten, nicht gesperrten Filme und Materialien. Öffentlich erscheint die Karte nur mit bereitgestellter Fassung und wenn der Inhalt zu einem öffentlich gezeigten Programm gehört; ein Film nur mit Website-Datei (zum Beispiel ein Teaser) erscheint, sobald diese Datei für die Website freigegeben ist. Traineranleitungen nie. Titel, Teaser, Kurzbeschreibung und Beschreibung pflegen Sie im Medium; welcher Text auf der Karte erscheint, wählen Sie unter „Darstellung“.'; } protected function searchSubjects(?string $term): array @@ -90,6 +95,80 @@ protected function cardStyle(): string return 'media'; } + /** + * Bei einem Film: das Vorschaubild des Films oder eine Stelle des Films als Kartenbild übernehmen. Das Bild wird + * einmal als Bild-Medium abgelegt (FilmStill) und wie jedes andere Bild ausgewählt; die Karte liest nur diese Datei. + */ + protected function imageSourceFields(): array + { + return [ + ViewField::make('_filmbild') + ->label('Bild aus dem Film') + ->view('filament.cms.filmbild-feld') + ->dehydrated(false) + ->visible(fn (Get $get): bool => $this->filmFor($get('element')) !== null) + ->viewData(fn (Get $get): array => $this->filmFieldData($this->filmFor($get('element')))), + ]; + } + + /** + * Anzeigedaten des Felds „Bild aus dem Film“. Die Stelle kommt aus der bereitgestellten Fassung, bei einem Film + * nur mit Website-Datei aus dieser (Route content.website-frame). + * + * @return array + */ + protected function filmFieldData(?ContentElement $film): array + { + $stills = app(FilmStill::class); + $version = $film instanceof ContentElement ? $stills->version($film) : null; + + return [ + 'film' => $film, + 'filmTitle' => $film instanceof ContentElement ? (string) ($film->display_title ?: $film->working_title) : '', + 'filmVersionId' => $version?->id, + 'filmWebsiteFrameUrl' => $film instanceof ContentElement && $version === null && $stills->websiteFile($film) !== null + ? route('content.website-frame', ['element' => $film]) + : null, + 'filmHasThumbnail' => $film instanceof ContentElement && is_string($film->thumbnail_path) && $film->thumbnail_path !== '', + 'filmThumbnailUrl' => $film instanceof ContentElement ? ThumbnailRef::url('editorial.card', 'element', (int) $film->id, $film->thumbnail_path) : null, + 'filmStartSecond' => $film instanceof ContentElement ? ($stills->thumbnailSecond($film) ?? '0') : '0', + ]; + } + + private function filmFor(mixed $id): ?ContentElement + { + $element = is_numeric($id) ? ContentElement::query()->with('editorialContentKind')->find((int) $id) : null; + + return $element instanceof ContentElement && app(FilmStill::class)->refusal($element) === null ? $element : null; + } + + protected function subjectNoun(): string + { + return 'Medium'; + } + + protected function textChoices(): array + { + return [ + 'auto' => 'Automatisch (Kurzbeschreibung, sonst Teaser)', + 'teaser' => 'Teaser', + 'summary' => 'Kurzbeschreibung', + 'description' => 'Ausführliche Beschreibung (erscheint öffentlich)', + ]; + } + + protected function supportsClip(): bool + { + return true; + } + + protected function clipSubject(mixed $id): ?Model + { + $element = is_numeric($id) ? ContentElement::query()->find((int) $id) : null; + + return $element instanceof ContentElement ? $element : null; + } + protected function centralCoverId(mixed $id): ?int { $element = is_numeric($id) ? ContentElement::query()->find((int) $id) : null; diff --git a/app/Domain/Cms/Widgets/Types/PremiumCardWidget.php b/app/Domain/Cms/Widgets/Types/PremiumCardWidget.php index d6fc682..aeabedb 100644 --- a/app/Domain/Cms/Widgets/Types/PremiumCardWidget.php +++ b/app/Domain/Cms/Widgets/Types/PremiumCardWidget.php @@ -4,16 +4,19 @@ use App\Domain\Cms\Catalog\CardSubject; use App\Domain\Cms\Widgets\RenderContext; +use App\Domain\Cms\Widgets\Support\CardClip; use App\Domain\Cms\Widgets\Support\ImageRefFields; use App\Domain\Cms\Widgets\Support\PremiumFields; use App\Domain\Cms\Widgets\Support\PublicMedia; use App\Domain\Cms\Widgets\Support\WebsiteImage; use App\Domain\Cms\Widgets\WidgetErrors; use App\Domain\Cms\Widgets\WidgetType; +use Filament\Forms\Components\Field; use Filament\Forms\Components\Select; use Filament\Forms\Components\TextInput; use Filament\Schemas\Components\Group; use Filament\Schemas\Components\Utilities\Get; +use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Str; /** @@ -56,6 +59,56 @@ abstract protected function defaultActionLabel(): string; /** Gestaltungsvariante des Kits: editorial, media oder catalog. */ abstract protected function cardStyle(): string; + /** + * Weitere Wege zum Kartenbild im Reiter „Medien“, zum Beispiel ein Bild aus dem Film. Standard: keine. + * + * @return list + */ + protected function imageSourceFields(): array + { + return []; + } + + /** + * Fachobjekt, dessen Trailer die Karte beim Überfahren oder Antippen abspielt (Medium, Programm, Modul). + * Null: diese Karte hat keinen Clip (Thema). Der Clip kommt aus der Präsentation des Objekts (CardClip). + */ + protected function clipSubject(mixed $id): ?Model + { + return null; + } + + /** + * Zentrale Texte des Fachobjekts, aus denen die Redaktion den Kartentext wählen kann: Wert => Bezeichnung. + * Leer: keine Wahl (die Karte nimmt den Text ihrer Vorgabe). Mit Wahl gilt „auto“ als Vorgabe. + * + * @return array + */ + protected function textChoices(): array + { + return []; + } + + /** Was die Redaktion bearbeitet, um einen Text zu pflegen („Medium“, „Programm oder Modul“); für Hinweise. */ + protected function subjectNoun(): string + { + return 'Objekt'; + } + + /** Hinweis der Redaktionsvorschau, wenn der gewählte zentrale Text nicht gepflegt ist. */ + private function missingTextHint(string $field): string + { + $noun = $this->subjectNoun(); + + return match ($field) { + 'teaser' => 'Kein Teaser gepflegt ('.$noun.' bearbeiten → Teaser).', + 'summary' => 'Keine Kurzbeschreibung gepflegt ('.$noun.' bearbeiten → Kurzbeschreibung).', + 'description' => 'Keine ausführliche Beschreibung gepflegt ('.$noun.' bearbeiten → Beschreibung).', + 'goal' => 'Kein Lernziel gepflegt ('.$noun.' bearbeiten → Lernziel der Fassung).', + default => '', + }; + } + public function view(): string { return 'widgets.premium_card'; @@ -110,7 +163,9 @@ public function optionIcons(): array public function settings(): array { - return [ + $choices = $this->textChoices(); + + return ($choices === [] ? [] : ['text_source' => $choices]) + ($this->supportsClip() ? ['clip' => ['yes' => 'Abspielen', 'no' => 'Nicht abspielen'], 'show_body' => self::SHOW] : []) + [ 'format' => ['landscape' => 'Querformat 16:9', 'square' => 'Quadrat 1:1', 'portrait' => 'Hochformat 3:4'], 'fit' => ['cover' => 'Ausschnitt füllt die Fläche', 'contain' => 'Ganzes Bild zeigen (Dokument, Poster)'], 'heading_level' => ['h3' => 'H3', 'h2' => 'H2', 'h4' => 'H4'], @@ -121,16 +176,34 @@ public function settings(): array ]; } + public function settingGroups(): array + { + return [ + 'Bild und Video' => ['format', 'fit', 'clip'], + 'Texte auf der Karte' => ['show_body', 'text_source', 'show_summary', 'show_kind', 'show_meta', 'show_action'], + 'Seitenstruktur' => ['heading_level'], + ]; + } + + public function settingHiddenWhen(): array + { + // „Texte auf der Karte: Ausblenden“ macht die Einzelschalter wirkungslos; sie bleiben gespeichert, aber unsichtbar. + return array_fill_keys(['text_source', 'show_summary', 'show_kind', 'show_meta', 'show_action'], ['show_body', 'no']); + } + public function settingLabels(): array { return [ - 'format' => ['Bildformat', 'Vorgabe: Querformat 16:9. Gilt auch neben dem Text; das Motiv wird nicht nachträglich hochkant beschnitten.'], - 'fit' => ['Bilddarstellung', 'Vorgabe: Ausschnitt. „Ganzes Bild“ zeigt Dokumente und Poster vollständig auf ruhiger Fläche.'], - 'heading_level' => ['Überschriftenebene', 'Vorgabe: H3, passend unter einer Abschnittsüberschrift (H2).'], - 'show_summary' => ['Kurzbeschreibung', 'Aus den Fachdaten. Vorgabe: anzeigen.'], - 'show_kind' => ['Art oder Label', 'Zum Beispiel „Thema“ oder „Merkblatt“. Vorgabe: anzeigen.'], - 'show_meta' => ['Zusatzangaben', 'Aus den Fachdaten, zum Beispiel Ausgabeart oder Programmzugehörigkeit. Vorgabe: anzeigen.'], - 'show_action' => ['Aktion', 'Verweis auf die öffentliche Seite des Fachobjekts, falls es eine gibt. Vorgabe: anzeigen.'], + 'format' => ['Bildformat', 'Seitenverhältnis des Bildes oder Videos. Vorgabe: Querformat 16:9. Gilt auch neben dem Text; das Motiv wird nicht nachträglich hochkant beschnitten.'], + 'fit' => ['Bildausschnitt', 'Ausschnitt füllt die ganze Fläche; „Ganzes Bild“ zeigt Dokumente und Poster vollständig auf ruhiger Fläche. Vorgabe: Ausschnitt.'], + 'clip' => ['Trailer auf der Karte', 'Spielt den freigegebenen Trailer als stumme Vorschau, solange die Maus auf der Karte steht; ein Klick oder Tipp auf das Bild oder die kleine Schaltfläche (auch per Tastatur) spielt ihn mit Ton. Gewählt wird der Trailer (sonst der Vorschauclip) in der Präsentation des Objekts, bei einem Film ersatzweise sein freigegebener Teaser. Ohne freigegebenen Clip bleibt das Kartenbild. Vorgabe: Abspielen.'], + 'show_body' => ['Texte auf der Karte', 'Hauptschalter für alle Texte neben dem Bild. „Ausblenden“ zeigt nur Bild und Video, ohne Titel, Beschreibung, Art, Zusatzangaben und Schaltfläche; die Einzelschalter darunter verschwinden dann. Für Hilfstechnik bleibt der Titel unsichtbar erhalten. Sinnvoll, wenn das Video allein erklärt. Vorgabe: Anzeigen.'], + 'text_source' => ['Quelle der Beschreibung', 'Welche Angabe aus der Redaktion als Beschreibung erscheint. Vorgabe: Automatisch. Der Text erscheint öffentlich, wenn die Karte öffentlich ist; ist er nicht gepflegt, bleibt die Karte ohne Beschreibung.'], + 'show_summary' => ['Beschreibung', 'Der Beschreibungstext unter dem Titel, aus den Fachdaten. Vorgabe: Anzeigen.'], + 'show_kind' => ['Art-Label', 'Kleines Label über dem Titel, zum Beispiel „Thema“ oder „Merkblatt“. Vorgabe: Anzeigen.'], + 'show_meta' => ['Zusatzangaben', 'Angaben aus den Fachdaten, zum Beispiel Ausgabeart oder Programmzugehörigkeit. Vorgabe: Anzeigen.'], + 'show_action' => ['Schaltfläche', 'Verweis auf die öffentliche Seite des Fachobjekts, falls es eine gibt. Vorgabe: Anzeigen.'], + 'heading_level' => ['Überschriftenebene', 'Betrifft nur die Gliederung für Suchmaschinen und Hilfstechnik, nicht das Aussehen. Vorgabe: H3, passend unter einer Abschnittsüberschrift (H2).'], ]; } @@ -195,13 +268,13 @@ public function editorSchema(): array ->hintColor(fn (?string $state): string => filled($state) ? 'warning' : 'gray') ->helperText('Leer übernimmt den Anzeigenamen des Fachobjekts. Eine Eintragung gilt nur für diese Karte und ändert die Quelle nicht.'), TextInput::make('summary') - ->label('Teaser nur für diese Karte') + ->label('Text nur für diese Karte') ->maxLength(500) ->live(onBlur: true) - ->placeholder(fn (Get $get): string => $this->centralText($get('../refs.'.$this->refKey()), 'summary') ?? 'Zentraler Teaser oder Kurzbeschreibung') + ->placeholder(fn (Get $get): string => $this->centralText($get('../refs.'.$this->refKey()), 'summary', $get('../settings.text_source')) ?? 'Zentraler Text aus der Redaktion') ->hint(fn (?string $state): string => filled($state) ? 'Eigene Angabe für diese Karte' : 'Aus der Redaktion') ->hintColor(fn (?string $state): string => filled($state) ? 'warning' : 'gray') - ->helperText('Leer übernimmt Teaser oder Kurzbeschreibung. Lehrinhalt, Rechte und Preise bleiben unberührt.'), + ->helperText('Leer übernimmt den Text, den „Text der Karte“ (Darstellung) wählt. Lehrinhalt, Rechte und Preise bleiben unberührt.'), ])->statePath('data'), ]; } @@ -211,7 +284,7 @@ public function mediaSchema(): array [, , $alt, $focusX, $focusY] = $this->dataFields(); return [ - Group::make(ImageRefFields::fields('Kartenbild', live: true))->statePath('refs'), + Group::make([...ImageRefFields::fields('Kartenbild', live: true), ...$this->imageSourceFields()])->statePath('refs'), Group::make([$alt, $focusX, $focusY])->statePath('data'), ]; } @@ -248,6 +321,12 @@ public function resolve(array $widget, RenderContext $context): array $data = $widget['data']; $subject = $this->subject($widget['refs'][$this->refKey()] ?? null, $context); + $textSource = $option('text_source', 'auto'); + + if ($subject instanceof CardSubject && $textSource !== 'auto' && isset($this->textChoices()[$textSource])) { + $subject = $subject->withTextChoice($textSource, $this->missingTextHint($textSource)); + } + $heading = filled($data['heading'] ?? null) ? trim((string) $data['heading']) : null; $lead = filled($data['summary'] ?? null) ? trim((string) $data['summary']) : null; @@ -258,8 +337,16 @@ public function resolve(array $widget, RenderContext $context): array $storedImage = WebsiteImage::normalize($widget['refs']['image'] ?? null); $imageRef = $storedImage ?? $this->centralCoverId($widget['refs'][$this->refKey()] ?? null); + $clip = null; + + if ($this->supportsClip() && $option('clip', 'yes') === 'yes' && $subject instanceof CardSubject) { + $owner = $this->clipSubject($widget['refs'][$this->refKey()] ?? null); + $clip = $owner instanceof Model ? app(CardClip::class)->for($owner, $context->preview) : null; + } + return [ 'subject' => $subject, + 'clip' => $clip, 'cardStyle' => $subject?->style ?? $this->cardStyle(), 'imageUrl' => app(WebsiteImage::class)->url($imageRef, $context->preview), 'alt' => app(WebsiteImage::class)->alt($imageRef, $data['alt'] ?? null), @@ -277,6 +364,7 @@ public function resolve(array $widget, RenderContext $context): array 'actionLabel' => filled($data['action_label'] ?? null) ? (string) $data['action_label'] : $this->defaultActionLabel(), 'note' => filled($data['note'] ?? null) ? (string) $data['note'] : null, 'stacked' => $widget['variant'] === 'stacked', + 'bare' => $this->supportsClip() && $option('show_body', 'yes') === 'no', ]; } @@ -299,10 +387,15 @@ protected function centralCoverId(mixed $id): ?int return null; } + protected function supportsClip(): bool + { + return false; + } + /** * Zentraler Anzeigename oder Teaser des gewählten Objekts (Redaktionsstand) für Platzhalter im Editor. */ - private function centralText(mixed $id, string $field): ?string + private function centralText(mixed $id, string $field, mixed $textSource = null): ?string { if (blank($id)) { return null; @@ -314,6 +407,10 @@ private function centralText(mixed $id, string $field): ?string return null; } + if ($subject instanceof CardSubject && is_string($textSource) && isset($this->textChoices()[$textSource]) && $textSource !== 'auto') { + $subject = $subject->withTextChoice($textSource, $this->missingTextHint($textSource)); + } + $text = $subject?->{$field}; return is_string($text) && trim($text) !== '' ? Str::limit(trim($text), 120) : null; diff --git a/app/Domain/Cms/Widgets/Types/ProgramCardWidget.php b/app/Domain/Cms/Widgets/Types/ProgramCardWidget.php index 89dd33c..1ae6faa 100644 --- a/app/Domain/Cms/Widgets/Types/ProgramCardWidget.php +++ b/app/Domain/Cms/Widgets/Types/ProgramCardWidget.php @@ -7,6 +7,11 @@ use App\Domain\Cms\Catalog\CardSubject; use App\Domain\Cms\Catalog\PublicCatalogReader; use App\Domain\Cms\Widgets\RenderContext; +use App\Domain\Media\CompositionStill; +use App\Domain\Media\ThumbnailRef; +use Filament\Forms\Components\ViewField; +use Filament\Schemas\Components\Utilities\Get; +use Illuminate\Database\Eloquent\Model; /** * Modul- und Programmkarte (Kit v1.7 „catalog“): ein Programm oder Modul über PublicCatalogReader, dieselbe @@ -41,6 +46,59 @@ public function schematic(): array return [[2, 2, 56, 32, 'line'], [5, 5, 22, 26, 'ink'], [8, 24, 10, 2, 'accent'], [31, 8, 10, 2, 'line'], [31, 13, 22, 4, 'ink'], [31, 25, 14, 5, 'ink']]; } + /** + * Das Vorschaubild des Programms oder Moduls als Kartenbild übernehmen. Es wird einmal als Bild-Medium abgelegt + * (CompositionStill) und wie jedes andere Bild ausgewählt; die Karte liest nur diese Datei. + */ + protected function imageSourceFields(): array + { + return [ + ViewField::make('_programmbild') + ->label('Bild aus dem Programm oder Modul') + ->view('filament.cms.kompositionsbild-feld') + ->dehydrated(false) + ->visible(fn (Get $get): bool => $this->compositionFor($get('composition')) !== null) + ->viewData(function (Get $get): array { + $composition = $this->compositionFor($get('composition')); + + return [ + 'composition' => $composition, + 'compositionTitle' => $composition instanceof Composition ? (string) ($composition->display_title ?: $composition->designation) : '', + 'compositionThumbnailUrl' => $composition instanceof Composition && app(CompositionStill::class)->hasThumbnail($composition) + ? ThumbnailRef::url('editorial.card', 'komposition', (int) $composition->id, $composition->thumbnail_path) + : null, + ]; + }), + ]; + } + + private function compositionFor(mixed $id): ?Composition + { + $composition = is_numeric($id) ? Composition::query()->with('editorialContentKind')->find((int) $id) : null; + + return $composition instanceof Composition && app(PublicCatalogReader::class)->isCardSelectable($composition) ? $composition : null; + } + + protected function subjectNoun(): string + { + return 'Programm oder Modul'; + } + + /** + * Wählbare Texte: die zentralen Texte des Programms oder Moduls und das Lernziel der Fassung. „Automatisch“ bleibt + * wie bisher: Teaser, sonst Kurzbeschreibung, sonst Lernziel. Die ausführliche Beschreibung erscheint nur auf Wahl. + */ + protected function textChoices(): array + { + return [ + 'auto' => 'Automatisch (Teaser, sonst Kurzbeschreibung, sonst Lernziel)', + 'teaser' => 'Teaser', + 'summary' => 'Kurzbeschreibung', + 'description' => 'Ausführliche Beschreibung (erscheint öffentlich)', + 'goal' => 'Lernziel der Fassung', + ]; + } + public function settings(): array { // Die Art (Programm oder Modul) bleibt immer sichtbar; sie lässt sich nicht ausblenden. @@ -99,6 +157,18 @@ protected function cardStyle(): string return 'catalog'; } + protected function supportsClip(): bool + { + return true; + } + + protected function clipSubject(mixed $id): ?Model + { + $composition = is_numeric($id) ? Composition::query()->find((int) $id) : null; + + return $composition instanceof Composition ? $composition : null; + } + protected function centralCoverId(mixed $id): ?int { $composition = is_numeric($id) ? Composition::query()->find((int) $id) : null; diff --git a/app/Domain/Cms/Widgets/WidgetType.php b/app/Domain/Cms/Widgets/WidgetType.php index 20bded9..af84b32 100644 --- a/app/Domain/Cms/Widgets/WidgetType.php +++ b/app/Domain/Cms/Widgets/WidgetType.php @@ -194,6 +194,29 @@ public function settingLabels(): array return []; } + /** + * Gliederung der Einstellungen im Reiter „Darstellung“: Gruppentitel => Schlüssel der Einstellungen in der + * Reihenfolge der Anzeige. Variante und Höhe stehen immer in der ersten Gruppe „Aufbau“. Einstellungen ohne + * Gruppe erscheinen unter „Weitere Einstellungen“, so geht keine verloren. + * + * @return array> + */ + public function settingGroups(): array + { + return []; + } + + /** + * Einstellungen, die im Editor ausgeblendet werden, solange eine andere Einstellung einen bestimmten Wert hat: + * Schlüssel => [steuernde Einstellung, Wert, bei dem ausgeblendet wird]. Die Werte bleiben dabei erhalten. + * + * @return array + */ + public function settingHiddenWhen(): array + { + return []; + } + /** * Alle zulässigen Einstellungen einschließlich der gemeinsamen Höhe. Registry-Prüfung, Editor und Darstellung * verwenden ausschließlich diese Zusammenführung. diff --git a/app/Domain/Commerce/Cart.php b/app/Domain/Commerce/Cart.php new file mode 100644 index 0000000..7b75717 --- /dev/null +++ b/app/Domain/Commerce/Cart.php @@ -0,0 +1,244 @@ + + */ + public function items(): array + { + return (array) session()->get(self::KEY, []); + } + + public function count(): int + { + return count($this->items()); + } + + public function has(Offer $offer): bool + { + return isset($this->items()[$offer->id]); + } + + /** + * Die bereits enthaltene Alternative derselben Produktseite, falls vorhanden. + */ + public function alternativeTo(Offer $offer): ?Offer + { + if ($offer->composition_id === null) { + return null; + } + + $ids = array_diff(array_keys($this->items()), [$offer->id]); + + return $ids === [] ? null : Offer::query() + ->whereIn('id', $ids) + ->where('composition_id', $offer->composition_id) + ->first(); + } + + public function add(Offer $offer): string + { + $version = $this->purchasable($offer); + + if ($version === null) { + return self::UNAVAILABLE; + } + + if ($this->has($offer)) { + return self::PRESENT; + } + + if ($this->alternativeTo($offer) !== null) { + return self::ALTERNATIVE; + } + + $this->put($offer, $version); + + return self::ADDED; + } + + /** + * Ausdrücklicher Wechsel: die Alternative wird durch die gewählte Option ersetzt. + */ + public function switchTo(Offer $offer): bool + { + $version = $this->purchasable($offer); + + if ($version === null) { + return false; + } + + $alternative = $this->alternativeTo($offer); + + if ($alternative !== null) { + $this->remove($alternative); + } + + $this->put($offer, $version); + + return true; + } + + public function remove(Offer $offer): void + { + $items = $this->items(); + unset($items[$offer->id]); + session()->put(self::KEY, $items); + } + + /** + * Der Käufer übernimmt Preis und Fassung, die der Shop jetzt zeigt. + */ + public function acceptCurrent(Offer $offer): void + { + $version = $this->purchasable($offer); + + if ($version !== null && $this->has($offer)) { + $this->put($offer, $version); + } + } + + public function clear(): void + { + session()->forget(self::KEY); + } + + /** + * Serverseitige Prüfung: aktuelle Fassung, Preis, Kaufbarkeit, passende Inhaberart, vorhandene Rechte. + */ + public function review(?User $user = null, ?int $holderPartyId = null): CartReview + { + $offers = Offer::query() + ->whereIn('id', array_keys($this->items())) + ->with('composition') + ->get() + ->keyBy('id'); + $versions = []; + + foreach ($this->items() as $offerId => $item) { + $offer = $offers->get($offerId); + + if ($offer !== null) { + $versions[$offerId] = $this->purchasable($offer); + } + } + + $holder = $user === null ? null : $this->holderFor($user, $holderPartyId, $versions); + $lines = []; + + foreach ($this->items() as $offerId => $item) { + $offer = $offers->get($offerId); + + if ($offer === null) { + continue; + } + + $version = $versions[$offerId] ?? null; + $seen = (int) $item['price_cents']; + + if ($version === null) { + $lines[] = new CartLine($offer, null, CartLine::WITHDRAWN, $seen, null, + 'Diese Option ist nicht mehr erhältlich. Entferne sie, um mit den übrigen Positionen fortzufahren.'); + + continue; + } + + $current = (int) $version->price_cents; + + if ($holder !== null && ! $this->suitsHolder($version, $holder)) { + $lines[] = new CartLine($offer, $version, CartLine::WRONG_HOLDER, $seen, $current, + $version->holder_kind === 'organisation' + ? 'Diese Option ist für Organisationen. Bestelle als Verein oder entferne sie.' + : 'Diese Option ist für Privatpersonen. Bestelle als Privatperson oder entferne sie.'); + + continue; + } + + if ($holder !== null && $this->ownership->covers($holder, $version)) { + $lines[] = new CartLine($offer, $version, CartLine::OWNED, $seen, $current); + + continue; + } + + if ($current !== $seen) { + $lines[] = new CartLine($offer, $version, CartLine::PRICE_CHANGED, $seen, $current); + } elseif ((int) $item['version_id'] !== $version->id) { + $lines[] = new CartLine($offer, $version, CartLine::TERMS_CHANGED, $seen, $current, + 'Die Bedingungen dieser Option wurden aktualisiert. Bitte prüfe die Übersicht.'); + } else { + $lines[] = new CartLine($offer, $version, CartLine::OK, $seen, $current); + } + } + + return new CartReview($lines, $holder); + } + + /** + * Die aktive, als Kauf angebotene Fassung der Option; sonst null (nicht kaufbar oder zurückgezogen). + */ + public function purchasable(Offer $offer): ?OfferVersion + { + return $this->offers->purchasableVersion($offer); + } + + private function put(Offer $offer, OfferVersion $version): void + { + $items = $this->items(); + $items[$offer->id] = ['version_id' => $version->id, 'price_cents' => (int) $version->price_cents]; + session()->put(self::KEY, $items); + } + + /** + * @param array $versions + */ + private function holderFor(User $user, ?int $partyId, array $versions): ?Party + { + $onlyOrganisations = $versions !== [] && collect($versions) + ->filter() + ->every(fn (OfferVersion $version): bool => $version->holder_kind === 'organisation'); + + try { + return $this->holders->resolve($user, $partyId, $onlyOrganisations); + } catch (DomainRuleException) { + return null; + } + } + + private function suitsHolder(OfferVersion $version, Party $holder): bool + { + return ($version->holder_kind === 'organisation') === ($holder->type === PartyType::Organisation); + } +} diff --git a/app/Domain/Commerce/CartLine.php b/app/Domain/Commerce/CartLine.php new file mode 100644 index 0000000..ac3457a --- /dev/null +++ b/app/Domain/Commerce/CartLine.php @@ -0,0 +1,54 @@ +state, [self::OK, self::PRICE_CHANGED, self::TERMS_CHANGED], true); + } + + /** Verhindert den Abschluss, bis der Käufer die Position selbst entfernt oder den Inhaber wechselt. */ + public function blocks(): bool + { + return in_array($this->state, [self::WITHDRAWN, self::WRONG_HOLDER], true); + } + + public function title(): string + { + $composition = $this->offer->composition; + + return $composition !== null + ? (string) ($composition->display_title ?: $composition->designation) + : (string) $this->offer->name; + } +} diff --git a/app/Domain/Commerce/CartReview.php b/app/Domain/Commerce/CartReview.php new file mode 100644 index 0000000..e2e0ca5 --- /dev/null +++ b/app/Domain/Commerce/CartReview.php @@ -0,0 +1,65 @@ + $lines + */ + public function __construct( + public readonly array $lines, + public readonly ?Party $holder, + ) {} + + /** @return list */ + public function orderable(): array + { + return array_values(array_filter($this->lines, fn (CartLine $line): bool => $line->orderable())); + } + + public function totalCents(): int + { + return array_sum(array_map(fn (CartLine $line): int => (int) $line->currentPriceCents, $this->orderable())); + } + + public function blocked(): bool + { + foreach ($this->lines as $line) { + if ($line->blocks()) { + return true; + } + } + + return false; + } + + public function empty(): bool + { + return $this->orderable() === []; + } + + public function canOrder(): bool + { + return $this->holder !== null && ! $this->blocked() && ! $this->empty(); + } + + public function digest(): string + { + $parts = []; + + foreach ($this->lines as $line) { + $parts[] = $line->offer->id.':'.($line->version?->id ?? 0).':'.$line->currentPriceCents.':'.$line->state; + } + + sort($parts); + + return hash('sha256', ($this->holder?->id ?? 0).'|'.implode(',', $parts)); + } +} diff --git a/app/Domain/Commerce/Checkout.php b/app/Domain/Commerce/Checkout.php index 6084070..902d131 100644 --- a/app/Domain/Commerce/Checkout.php +++ b/app/Domain/Commerce/Checkout.php @@ -5,11 +5,13 @@ use App\Domain\Catalog\DomainRuleException; use App\Domain\Catalog\Offer; use App\Domain\Catalog\OfferService; +use App\Domain\Catalog\OfferVersion; use App\Domain\Entitlement\Acquisition; use App\Domain\Entitlement\AcquisitionType; use App\Domain\Entitlement\GrantIssuer; use App\Domain\Entitlement\GrantStatus; use App\Domain\Identity\AccountStatus; +use App\Domain\Identity\Party; use App\Mail\OrderConfirmed; use App\Models\User; use Illuminate\Support\Facades\DB; @@ -20,13 +22,15 @@ class Checkout public function __construct( private readonly GrantIssuer $grants, private readonly OfferService $offers, + private readonly OrderHolders $holders, ) {} + /** + * Einzelkauf einer Option als Person (bestehender Weg, ohne Warenkorb). + */ public function place(User $user, Offer $offer): Order { - if ($user->status !== AccountStatus::Aktiv || $user->party_id === null) { - throw new DomainRuleException('Nur ein aktives Mitglied kann kaufen.'); - } + $this->assertActive($user); $version = $this->offers->currentActiveVersion($offer); @@ -38,20 +42,78 @@ public function place(User $user, Offer $offer): Order throw new DomainRuleException('Der Kauf braucht einen Preis an der Angebotsfassung.'); } - return DB::transaction(function () use ($user, $offer, $version): Order { - $order = Order::query()->create([ - 'user_id' => $user->id, - 'party_id' => $user->party_id, - 'status' => 'offen', - 'holder_kind' => 'person', - ]); + $holder = $this->holders->resolve($user, null); + + return DB::transaction(fn (): Order => $this->createOrder($user, $holder, [[$offer, $version]])); + } + + /** + * Bestellung aus dem Warenkorb, erst nach serverseitiger Prüfung. Die Prüfsumme bindet die Bestellung an die + * Übersicht, die der Käufer gesehen hat: Hat sich Preis, Fassung oder Bedingung seither geändert, entsteht keine + * Bestellung und der Käufer sieht zuerst die aktualisierte Übersicht. Positionen, deren Umfang der Inhaber bereits + * mit denselben Rechten besitzt, erzeugen keine Bestellposition. + */ + public function placeFromCart(User $user, Cart $cart, ?int $holderPartyId, string $digest): Order + { + $this->assertActive($user); + + $order = DB::transaction(function () use ($user, $cart, $holderPartyId, $digest): Order { + // Optionen sperren, damit eine gleichzeitige Aktivierung die Prüfung nicht unterläuft. + Offer::query()->whereIn('id', array_keys($cart->items()))->orderBy('id')->lockForUpdate()->get(); + $review = $cart->review($user, $holderPartyId); + + if ($review->holder === null) { + throw new DomainRuleException('Für diesen Lizenzinhaber ist das Konto nicht bestellberechtigt.'); + } + + if (! hash_equals($review->digest(), $digest)) { + throw new StaleOverview('Die Übersicht hat sich geändert. Bitte prüfe die aktualisierte Bestellübersicht.'); + } + + if ($review->blocked()) { + throw new DomainRuleException('Entferne zuerst die Positionen, die nicht bestellt werden können.'); + } + + if ($review->empty()) { + throw new DomainRuleException('Es gibt nichts zu bestellen. Alle Positionen sind bereits erworben.'); + } + + $pairs = array_map(fn (CartLine $line): array => [$line->offer, $line->version], $review->orderable()); + + return $this->createOrder($user, $review->holder, $pairs); + }); + + $cart->clear(); + + return $order; + } + + /** + * @param list $pairs + */ + private function createOrder(User $user, Party $holder, array $pairs): Order + { + $order = Order::query()->create([ + 'user_id' => $user->id, + 'party_id' => $holder->id, + 'status' => 'offen', + 'holder_kind' => $holder->type->value, + 'total_cents' => array_sum(array_map(fn (array $pair): int => (int) $pair[1]->price_cents, $pairs)), + 'currency' => 'EUR', + ]); + + foreach ($pairs as [$offer, $version]) { $line = $order->lines()->create([ 'offer_version_id' => $version->id, 'offer_name' => $offer->name, 'price_cents' => $version->price_cents, + 'currency' => 'EUR', 'term_rule' => $version->term_rule, 'update_promise' => $version->update_promise, 'holder_kind' => $version->holder_kind, + 'tax_class' => $version->tax_class, + 'grant_kind' => $version->grant_kind, + 'holder_party_id' => $holder->id, ]); $version->load('resolvedScopes.rights'); @@ -66,14 +128,39 @@ public function place(User $user, Offer $offer): Order ], ]); } + } - return $order->load('lines.scopeItems'); - }); + return $order->load('lines.scopeItems'); } + /** + * Freischaltung nach bestätigter Testzahlung: alle Bestellpositionen aus ihrem festgehaltenen Umfang, in einer + * Transaktion. Wiederholte Bestätigung ist wirkungslos; ein Fehler hinterlässt weder Zahlung noch Rechte. + */ public function confirmTestPayment(Order $order, string $reference): Order { $this->assertTestDriver(); + + return $this->settle($order, 'test', $reference); + } + + /** + * Zahlung eines Anbieters (Stripe): wie die Testzahlung, aber erst nach Prüfung von Betrag und Währung gegen die + * Bestellung. Wiederholte Meldungen sind wirkungslos. + */ + public function confirmProviderPayment(Order $order, string $provider, string $reference, int $amountCents, string $currency): Order + { + $expected = (int) ($order->total_cents ?? $order->lines()->sum('price_cents')); + + if ($amountCents !== $expected || strtoupper($currency) !== strtoupper((string) ($order->currency ?? 'EUR'))) { + throw new DomainRuleException('Der gezahlte Betrag weicht von der Bestellung ab.'); + } + + return $this->settle($order, $provider, $reference); + } + + private function settle(Order $order, string $provider, string $reference): Order + { $reference = trim($reference); if ($reference === '') { @@ -81,7 +168,7 @@ public function confirmTestPayment(Order $order, string $reference): Order } $paidNow = false; - $order = DB::transaction(function () use ($order, $reference, &$paidNow): Order { + $order = DB::transaction(function () use ($order, $provider, $reference, &$paidNow): Order { $order = Order::query()->lockForUpdate()->findOrFail($order->id); if ($order->status === 'bezahlt') { @@ -92,22 +179,20 @@ public function confirmTestPayment(Order $order, string $reference): Order throw new DomainRuleException('Diese Bestellung nimmt keine Zahlung mehr an.'); } - $order->payments()->create([ - 'provider' => 'test', - 'status' => 'bestaetigt', - 'provider_reference' => $reference, - ]); + // Eine bei Stripe angelegte offene Zahlung mit derselben Referenz wird bestätigt statt doppelt geführt. + $order->payments()->updateOrCreate( + ['provider_reference' => $reference], + ['provider' => $provider, 'status' => 'bestaetigt'], + ); $order->status = 'bezahlt'; $order->save(); $paidNow = true; - $line = $order->lines()->firstOrFail(); - $this->grants->issue( - $order->user, - $line->offerVersion, - AcquisitionType::Bestellposition, - 'order_line', - $line->id, - ); + $actor = User::query()->findOrFail($order->user_id); + + foreach ($order->lines()->orderBy('id')->get() as $line) { + $holder = Party::query()->findOrFail($line->holder_party_id ?? $order->party_id); + $this->grants->issueFromOrderLine($line, $holder, $actor); + } return $order->load('lines', 'payments'); }); @@ -142,6 +227,10 @@ public function failTestPayment(Order $order, string $reference): Order }); } + /** + * Vollerstattung: widerruft die Berechtigungen aller Positionen dieser Bestellung. Andere Erwerbsquellen + * (kostenlose Vergabe, frühere Käufe) bleiben unberührt. + */ public function refund(Order $order, string $reason): Order { $reason = trim($reason); @@ -157,15 +246,14 @@ public function refund(Order $order, string $reason): Order throw new DomainRuleException('Nur eine bezahlte Bestellung kann erstattet werden.'); } - $line = $order->lines()->firstOrFail(); - $acquisition = Acquisition::query()->where([ - 'type' => AcquisitionType::Bestellposition, - 'reference_type' => 'order_line', - 'reference_id' => $line->id, - ])->first(); + foreach ($order->lines()->orderBy('id')->get() as $line) { + $acquisition = Acquisition::query()->where([ + 'type' => AcquisitionType::Bestellposition, + 'reference_type' => 'order_line', + 'reference_id' => $line->id, + ])->first(); - if ($acquisition !== null) { - foreach ($acquisition->grants as $grant) { + foreach ($acquisition?->grants ?? [] as $grant) { if ($grant->status === GrantStatus::Aktiv) { $grant->status = GrantStatus::Widerrufen; $grant->status_reason = $reason; @@ -182,6 +270,13 @@ public function refund(Order $order, string $reason): Order }); } + private function assertActive(User $user): void + { + if ($user->status !== AccountStatus::Aktiv || $user->party_id === null) { + throw new DomainRuleException('Nur ein aktives Mitglied kann kaufen.'); + } + } + private function assertTestDriver(): void { if (app()->isProduction() || config('services.payment.driver') !== 'test') { diff --git a/app/Domain/Commerce/Money.php b/app/Domain/Commerce/Money.php new file mode 100644 index 0000000..39d4584 --- /dev/null +++ b/app/Domain/Commerce/Money.php @@ -0,0 +1,56 @@ + self::MAX_CENTS) { + throw new DomainRuleException('Der Preis ist zu hoch. Zulässig sind höchstens '.self::format(self::MAX_CENTS).'.'); + } + + return $cents; + } +} diff --git a/app/Domain/Commerce/Order.php b/app/Domain/Commerce/Order.php index 50d8254..c6ef61d 100644 --- a/app/Domain/Commerce/Order.php +++ b/app/Domain/Commerce/Order.php @@ -15,6 +15,8 @@ class Order extends Model 'party_id', 'status', 'holder_kind', + 'total_cents', + 'currency', ]; public function user(): BelongsTo diff --git a/app/Domain/Commerce/OrderHolders.php b/app/Domain/Commerce/OrderHolders.php new file mode 100644 index 0000000..6d2a372 --- /dev/null +++ b/app/Domain/Commerce/OrderHolders.php @@ -0,0 +1,75 @@ + + */ + public function for(User $user): Collection + { + $holders = collect(); + + if ($user->party_id !== null) { + $person = Party::query()->find($user->party_id); + + if ($person !== null) { + $holders->push($person); + } + } + + $organisations = Membership::query() + ->active() + ->where('user_id', $user->id) + ->where('may_order', true) + ->with('organisation') + ->orderBy('id') + ->get() + ->map(fn (Membership $membership): ?Party => $membership->organisation) + ->filter(fn (?Party $party): bool => $party !== null && $party->type === PartyType::Organisation); + + return $holders->concat($organisations)->values(); + } + + /** + * Der gewählte Inhaber; ohne Wahl die Person, bei Angeboten nur für Organisationen die erste Organisation. + */ + public function resolve(User $user, ?int $partyId, bool $preferOrganisation = false): Party + { + $holders = $this->for($user); + + if ($partyId !== null) { + $chosen = $holders->first(fn (Party $party): bool => $party->id === $partyId); + + if ($chosen === null) { + throw new DomainRuleException('Für diesen Lizenzinhaber ist das Konto nicht bestellberechtigt.'); + } + + return $chosen; + } + + if ($preferOrganisation) { + $organisation = $holders->first(fn (Party $party): bool => $party->type === PartyType::Organisation); + + if ($organisation !== null) { + return $organisation; + } + } + + $person = $holders->first(fn (Party $party): bool => $party->type === PartyType::Person); + + return $person ?? throw new DomainRuleException('Nur ein aktives Mitglied kann kaufen.'); + } +} diff --git a/app/Domain/Commerce/OrderLine.php b/app/Domain/Commerce/OrderLine.php index 13e4a18..f37479c 100644 --- a/app/Domain/Commerce/OrderLine.php +++ b/app/Domain/Commerce/OrderLine.php @@ -3,6 +3,7 @@ namespace App\Domain\Commerce; use App\Domain\Catalog\OfferVersion; +use App\Domain\Identity\Party; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\HasMany; @@ -17,6 +18,10 @@ class OrderLine extends Model 'term_rule', 'update_promise', 'holder_kind', + 'currency', + 'tax_class', + 'grant_kind', + 'holder_party_id', ]; public function order(): BelongsTo @@ -24,6 +29,11 @@ public function order(): BelongsTo return $this->belongsTo(Order::class); } + public function holder(): BelongsTo + { + return $this->belongsTo(Party::class, 'holder_party_id'); + } + public function offerVersion(): BelongsTo { return $this->belongsTo(OfferVersion::class); diff --git a/app/Domain/Commerce/OwnershipCheck.php b/app/Domain/Commerce/OwnershipCheck.php new file mode 100644 index 0000000..04e211c --- /dev/null +++ b/app/Domain/Commerce/OwnershipCheck.php @@ -0,0 +1,94 @@ +needed($version); + + if ($needed === []) { + return false; + } + + $now = now(); + $byAcquisition = Grant::query() + ->where('status', GrantStatus::Aktiv) + ->whereHas('acquisition', fn ($query) => $query->where('party_id', $holder->id)) + ->get() + ->filter(fn (Grant $grant): bool => ($grant->valid_from === null || ! $grant->valid_from->greaterThan($now)) + && ($grant->valid_until === null || $grant->valid_until->greaterThan($now))) + ->groupBy('acquisition_id'); + + foreach ($byAcquisition as $grants) { + $have = []; + + foreach ($grants as $grant) { + $have[$grant->license_article_id.'|'.$this->fingerprint($grant->rights_snapshot ?? [])] = true; + } + + if (array_diff_key($needed, $have) === []) { + return true; + } + } + + return false; + } + + /** + * @return array + */ + private function needed(OfferVersion $version): array + { + $needed = []; + $version->loadMissing('resolvedScopes.rights'); + + foreach ($version->resolvedScopes as $scope) { + $needed[$scope->license_article_id.'|'.$this->fingerprint([ + 'purpose' => $scope->rights->purpose, + 'capabilities' => $scope->rights->capabilities, + 'options' => $scope->rights->options ?? [], + ])] = true; + } + + return $needed; + } + + /** + * Reihenfolge von Schlüsseln und Aktionen spielt keine Rolle. + * + * @param array $rights + */ + private function fingerprint(array $rights): string + { + $capabilities = []; + + foreach ((array) ($rights['capabilities'] ?? []) as $class => $actions) { + $actions = array_values(array_unique((array) $actions)); + sort($actions); + $capabilities[(string) $class] = $actions; + } + + ksort($capabilities); + $options = (array) ($rights['options'] ?? []); + ksort($options); + + return md5(json_encode([ + 'purpose' => (string) ($rights['purpose'] ?? ''), + 'capabilities' => $capabilities, + 'options' => $options, + ], JSON_THROW_ON_ERROR)); + } +} diff --git a/app/Domain/Commerce/ProductOptions.php b/app/Domain/Commerce/ProductOptions.php new file mode 100644 index 0000000..dbff0d5 --- /dev/null +++ b/app/Domain/Commerce/ProductOptions.php @@ -0,0 +1,139 @@ +> + */ + public function forComposition(Composition $composition): array + { + $options = []; + + foreach (Offer::query()->where('composition_id', $composition->id)->orderBy('id')->get() as $offer) { + $version = $this->offers->purchasableVersion($offer); + + if ($version !== null) { + $options[] = $this->describe($offer, $version); + } + } + + return $options; + } + + /** + * Zeilen für Shop-Suche und Kacheln: je Komposition die günstigste Option. + * + * @return array + */ + public function summaries(): array + { + $summary = []; + + foreach (Offer::query()->whereNotNull('composition_id')->orderBy('id')->get() as $offer) { + $version = $this->offers->purchasableVersion($offer); + + if ($version === null) { + continue; + } + + $current = $summary[$offer->composition_id] ?? ['from_cents' => PHP_INT_MAX, 'count' => 0]; + $summary[$offer->composition_id] = [ + 'from_cents' => min($current['from_cents'], (int) $version->price_cents), + 'count' => $current['count'] + 1, + ]; + } + + return $summary; + } + + /** + * @return array + */ + public function describe(Offer $offer, OfferVersion $version): array + { + $version->loadMissing('resolvedScopes.article', 'resolvedScopes.rights'); + $scope = []; + + foreach ($version->resolvedScopes as $item) { + $faehigkeiten = CatalogLabels::faehigkeiten($item->rights?->capabilities); + $scope[] = [ + 'article' => $this->articleTitle($item->article), + 'purpose' => CatalogLabels::zweck($item->rights?->purpose), + 'rights' => $faehigkeiten, + ]; + } + + return [ + 'offer' => $offer, + 'version' => $version, + 'name' => $offer->optionName(), + 'price_cents' => (int) $version->price_cents, + 'price' => Money::format((int) $version->price_cents), + 'for' => $version->holder_kind === 'organisation' ? 'Organisationen und Vereine' : 'Privatpersonen', + 'holder_kind' => $version->holder_kind, + 'term' => self::termLabel($version), + 'scope' => $scope, + ]; + } + + public static function termLabel(OfferVersion $version): string + { + return match ($version->term_rule) { + 'dauerhaft' => 'Dauerhaft nutzbar', + 'befristet' => 'Befristet', + 'solange_angebot_aktiv' => 'Solange das Angebot aktiv ist', + 'periodisch' => 'Laufend, periodisch', + default => (string) $version->term_rule, + }; + } + + public function articleTitle(?LicenseArticle $article): string + { + if ($article === null) { + return '–'; + } + + return $this->articleName($article) ?: (string) $article->code; + } + + /** + * Name wie in der Redaktion: eigener Name, sonst der Name des Inhalts (Anzeigename, Arbeitstitel oder + * Bezeichnung), sonst der eigene Arbeitstitel; leer, wenn nichts davon vorhanden ist. + */ + public function articleName(LicenseArticle $article): string + { + $profile = app(EditorialProfileReader::class)->read($article, 'detail'); + $source = $profile->source; + $candidates = [ + $profile->value('display_title'), + $article->working_title, + $source?->getAttribute('working_title'), + $source?->getAttribute('designation'), + ]; + + foreach ($candidates as $candidate) { + if (filled($candidate)) { + return trim((string) $candidate); + } + } + + return ''; + } +} diff --git a/app/Domain/Commerce/Shop.php b/app/Domain/Commerce/Shop.php new file mode 100644 index 0000000..93c7070 --- /dev/null +++ b/app/Domain/Commerce/Shop.php @@ -0,0 +1,27 @@ +isProduction() && in_array(self::driver(), ['test', 'stripe'], true); + } + + /** Stripe-Kasse (Etappe 1: nur Testmodus, nie in Produktion). */ + public static function stripe(): bool + { + return ! app()->isProduction() && self::driver() === 'stripe'; + } +} diff --git a/app/Domain/Commerce/StaleOverview.php b/app/Domain/Commerce/StaleOverview.php new file mode 100644 index 0000000..7b40fa0 --- /dev/null +++ b/app/Domain/Commerce/StaleOverview.php @@ -0,0 +1,11 @@ +assertSandbox(); + $order->loadMissing('lines', 'user'); + $taxRate = $this->taxRate(); + + if ($order->status !== 'offen') { + throw new DomainRuleException('Diese Bestellung nimmt keine Zahlung mehr an.'); + } + + $open = $this->reusableSession($order); + + if ($open !== null) { + return $open; + } + + $attempt = $order->payments()->where('provider', 'stripe')->count() + 1; + $params = [ + 'mode' => 'payment', + 'client_reference_id' => (string) $order->id, + 'customer_email' => $order->user->email, + 'locale' => 'de', + 'success_url' => route('member.order', $order).'?zahlung=zurueck', + 'cancel_url' => route('member.order', $order).'?zahlung=abbruch', + 'metadata' => ['order_id' => (string) $order->id], + 'payment_intent_data' => ['metadata' => ['order_id' => (string) $order->id]], + ]; + + foreach ($order->lines->values() as $index => $line) { + $params['line_items'][$index] = [ + 'quantity' => 1, + 'price_data' => [ + 'currency' => strtolower((string) ($line->currency ?? $order->currency ?? 'EUR')), + 'unit_amount' => (int) $line->price_cents, + 'product_data' => ['name' => filled($line->offer_name) ? (string) $line->offer_name : 'Lizenz'], + ], + ]; + + if ($taxRate !== null) { + $params['line_items'][$index]['tax_rates'] = [$taxRate]; + } + } + + $response = $this->request() + ->withHeaders(['Idempotency-Key' => $this->idempotencyKey($order, $attempt, $params)]) + ->post('/v1/checkout/sessions', $params); + + $this->assertOk($response, 'angelegt'); + $id = (string) $response->json('id'); + $url = (string) $response->json('url'); + + if ($id === '' || $url === '') { + throw new DomainRuleException('Stripe hat keine Kasse geliefert. Bitte versuche es später noch einmal.'); + } + + $order->payments()->create(['provider' => 'stripe', 'status' => 'offen', 'provider_reference' => $id]); + + return ['id' => $id, 'url' => $url]; + } + + public function assertSandbox(): void + { + $secret = (string) config('services.stripe.secret'); + + if (app()->isProduction()) { + throw new DomainRuleException('Stripe ist in Produktion nicht freigegeben.'); + } + + if ($secret === '') { + throw new DomainRuleException('Stripe ist nicht eingerichtet: Der Schlüssel fehlt.'); + } + + if (! str_starts_with($secret, 'sk_test_') && ! str_starts_with($secret, 'rk_test_')) { + throw new DomainRuleException('Etappe 1 erlaubt nur den Stripe-Testmodus (Schlüssel sk_test_).'); + } + } + + /** + * Stripe bindet einen Schlüssel an die Parameter der ersten Anfrage und lehnt dieselbe Kennung mit anderen + * Parametern ab. Der Schlüssel enthält deshalb einen Fingerabdruck der Parameter und die Minute: Ein + * doppelter Klick bleibt wirkungslos, eine geänderte Anfrage oder ein Neuversuch nach einer Korrektur nicht. + * + * @param array $params + */ + private function idempotencyKey(Order $order, int $attempt, array $params): string + { + $fingerprint = substr(sha1(json_encode([$params, now()->format('YmdHi')], JSON_THROW_ON_ERROR)), 0, 12); + + return 'luf-order-'.$order->id.'-'.$attempt.'-'.$fingerprint; + } + + /** Konfigurierter Steuersatz oder null; eine ungültige ID wird abgewiesen, statt geraten zu werden. */ + private function taxRate(): ?string + { + $id = trim((string) config('services.stripe.tax_rate')); + + if ($id === '') { + return null; + } + + if (! preg_match('/^txr_[A-Za-z0-9]+$/', $id)) { + throw new DomainRuleException('Die Steuersatz-ID für Stripe ist ungültig (erwartet txr_...).'); + } + + return $id; + } + + /** + * @return array{id: string, url: string}|null + */ + private function reusableSession(Order $order): ?array + { + $payment = $order->payments()->where('provider', 'stripe')->where('status', 'offen')->latest('id')->first(); + + if ($payment === null) { + return null; + } + + try { + $response = $this->request()->get('/v1/checkout/sessions/'.$payment->provider_reference); + } catch (ConnectionException) { + return null; + } + + if ($response->successful() && $response->json('status') === 'open' && filled($response->json('url'))) { + return ['id' => (string) $payment->provider_reference, 'url' => (string) $response->json('url')]; + } + + return null; + } + + private function request(): PendingRequest + { + return Http::baseUrl(rtrim((string) config('services.stripe.api_base'), '/')) + ->withToken((string) config('services.stripe.secret')) + ->asForm() + ->acceptJson() + ->timeout(15); + } + + private function assertOk(Response $response, string $what): void + { + if ($response->successful()) { + return; + } + + // Statuscode, Fehlertyp, Code, betroffener Parameter und Begründung von Stripe, damit die Ursache lesbar ist. + // Nie Schlüssel oder Kundendaten; die Begründung wird gekürzt. + Log::warning('Stripe-Anfrage fehlgeschlagen', [ + 'status' => $response->status(), + 'type' => $response->json('error.type'), + 'code' => $response->json('error.code'), + 'param' => $response->json('error.param'), + 'message' => mb_substr((string) $response->json('error.message'), 0, 300), + ]); + + throw new DomainRuleException('Die Zahlung konnte bei Stripe nicht '.$what.' werden. Bitte versuche es später noch einmal.'); + } +} diff --git a/app/Domain/Commerce/Stripe/StripeSignature.php b/app/Domain/Commerce/Stripe/StripeSignature.php new file mode 100644 index 0000000..b65961b --- /dev/null +++ b/app/Domain/Commerce/Stripe/StripeSignature.php @@ -0,0 +1,59 @@ +getTimestamp()) - $timestamp) > self::TOLERANCE_SECONDS) { + throw new DomainRuleException('Die Meldung ist zu alt.'); + } + } +} diff --git a/app/Domain/Entitlement/Acquisition.php b/app/Domain/Entitlement/Acquisition.php index aaae9cf..1d36e7a 100644 --- a/app/Domain/Entitlement/Acquisition.php +++ b/app/Domain/Entitlement/Acquisition.php @@ -19,6 +19,7 @@ class Acquisition extends Model 'reference_type', 'reference_id', 'conditions', + 'acting_user_id', ]; protected function casts(): array diff --git a/app/Domain/Entitlement/DecideAccess.php b/app/Domain/Entitlement/DecideAccess.php index d93cb12..e078f72 100644 --- a/app/Domain/Entitlement/DecideAccess.php +++ b/app/Domain/Entitlement/DecideAccess.php @@ -47,7 +47,7 @@ public function __invoke( $candidates = Grant::query() ->where('license_article_id', $article->id) ->where('status', GrantStatus::Aktiv) - ->whereHas('acquisition', fn ($query) => $query->where('party_id', $user->party_id)) + ->usableBy($user) ->get() ->filter(function (Grant $grant) use ($now): bool { if ($grant->valid_from !== null && $grant->valid_from->greaterThan($now)) { diff --git a/app/Domain/Entitlement/Grant.php b/app/Domain/Entitlement/Grant.php index 18a418e..6d6b111 100644 --- a/app/Domain/Entitlement/Grant.php +++ b/app/Domain/Entitlement/Grant.php @@ -5,6 +5,9 @@ use App\Domain\Catalog\ArticleRelease; use App\Domain\Catalog\LicenseArticle; use App\Domain\Catalog\RightsProfileVersion; +use App\Domain\Identity\Membership; +use App\Models\User; +use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; @@ -32,6 +35,32 @@ protected function casts(): array ]; } + /** + * Berechtigungen, die ein Konto nutzen darf (zentrale Regel für Entscheidung, Bibliothek und Vorschaubilder): + * - persönliche Erwerbe: Inhaber ist die Person des Kontos; + * - Erwerbe einer Organisation: nur das auslösende Konto und nur, solange seine Mitgliedschaft mit + * Bestellberechtigung besteht (Etappe 1, Domänenmodell 04; Sitzpools folgen mit A4). + * + * @param Builder $query + * @return Builder + */ + public function scopeUsableBy(Builder $query, User $user): Builder + { + return $query->whereHas('acquisition', function (Builder $acquisition) use ($user): void { + $acquisition->where(function (Builder $either) use ($user): void { + $either->where('party_id', $user->party_id) + ->orWhere(function (Builder $organisation) use ($user): void { + $organisation->where('acting_user_id', $user->id) + ->whereIn('party_id', Membership::query() + ->active() + ->where('user_id', $user->id) + ->where('may_order', true) + ->select('party_id')); + }); + }); + }); + } + public function acquisition(): BelongsTo { return $this->belongsTo(Acquisition::class); diff --git a/app/Domain/Entitlement/GrantIssuer.php b/app/Domain/Entitlement/GrantIssuer.php index 46d6ff7..f0f3ccd 100644 --- a/app/Domain/Entitlement/GrantIssuer.php +++ b/app/Domain/Entitlement/GrantIssuer.php @@ -7,6 +7,8 @@ use App\Domain\Catalog\OfferService; use App\Domain\Catalog\OfferStatus; use App\Domain\Catalog\OfferVersion; +use App\Domain\Commerce\OrderLine; +use App\Domain\Identity\Party; use App\Models\User; use Illuminate\Support\Facades\DB; @@ -69,6 +71,56 @@ public function grantManually(User $user, Offer $offer, User $actor, string $rea }); } + /** + * Freischaltung einer bezahlten Bestellposition aus deren festgehaltenem Umfang (Umfangskopie und Bedingungen der + * Position, nicht aus der Angebotsfassung). Inhaber ist der Lizenzinhaber der Position, das auslösende Konto wird + * am Erwerb festgehalten. Wiederholsicher: je Bestellposition genau ein Erwerb. + */ + public function issueFromOrderLine(OrderLine $line, Party $holder, User $actor): Acquisition + { + return DB::transaction(function () use ($line, $holder, $actor): Acquisition { + $existing = Acquisition::query()->where([ + 'party_id' => $holder->id, + 'type' => AcquisitionType::Bestellposition, + 'reference_type' => 'order_line', + 'reference_id' => $line->id, + ])->first(); + + if ($existing !== null) { + return $existing->load('grants'); + } + + $acquisition = Acquisition::query()->create([ + 'party_id' => $holder->id, + 'type' => AcquisitionType::Bestellposition, + 'reference_type' => 'order_line', + 'reference_id' => $line->id, + 'acting_user_id' => $actor->id, + 'conditions' => [ + 'term_rule' => $line->term_rule, + 'update_promise' => $line->update_promise, + 'holder_kind' => $line->holder_kind, + 'offer_version_id' => $line->offer_version_id, + ], + ]); + + $line->loadMissing('scopeItems.article'); + + foreach ($line->scopeItems as $item) { + $acquisition->grants()->create([ + 'license_article_id' => $item->license_article_id, + 'rights_profile_version_id' => $item->rights_profile_version_id, + 'rights_snapshot' => $item->rights_snapshot, + 'release_at_grant_id' => $item->article?->current_release_id, + 'status' => GrantStatus::Aktiv, + 'valid_from' => now(), + ]); + } + + return $acquisition->load('grants'); + }); + } + public function issue( User $user, OfferVersion $version, diff --git a/app/Domain/Identity/Membership.php b/app/Domain/Identity/Membership.php new file mode 100644 index 0000000..7766e69 --- /dev/null +++ b/app/Domain/Identity/Membership.php @@ -0,0 +1,52 @@ + 'boolean', + 'valid_from' => 'date', + 'valid_until' => 'date', + ]; + } + + public function user(): BelongsTo + { + return $this->belongsTo(User::class); + } + + public function organisation(): BelongsTo + { + return $this->belongsTo(Party::class, 'party_id'); + } + + /** Mitgliedschaften, die heute gelten. */ + public function scopeActive(Builder $query): Builder + { + return $query + ->where(fn (Builder $inner) => $inner->whereNull('valid_from')->orWhereDate('valid_from', '<=', now())) + ->where(fn (Builder $inner) => $inner->whereNull('valid_until')->orWhereDate('valid_until', '>=', now())); + } +} diff --git a/app/Domain/Media/CompositionStill.php b/app/Domain/Media/CompositionStill.php new file mode 100644 index 0000000..2b3d239 --- /dev/null +++ b/app/Domain/Media/CompositionStill.php @@ -0,0 +1,100 @@ +archived_at !== null) { + return 'Das Programm oder Modul ist archiviert.'; + } + + return null; + } + + public function hasThumbnail(Composition $composition): bool + { + $path = $composition->thumbnail_path; + + return is_string($path) && str_starts_with($path, 'vorschau/') && ! str_contains($path, '..') + && Storage::disk('media_derived')->exists($path); + } + + public function fromThumbnail(Composition $composition, ?User $actor = null): ContentElement + { + $this->reused = false; + $refusal = $this->refusal($composition); + + if ($refusal !== null) { + throw new DomainRuleException($refusal); + } + + if (! $this->hasThumbnail($composition)) { + throw new DomainRuleException('Dieses Programm oder Modul hat noch kein Vorschaubild. Setzen Sie es im Redaktionsmanager.'); + } + + $bytes = Storage::disk('media_derived')->get((string) $composition->thumbnail_path); + + if (! is_string($bytes) || $bytes === '') { + throw new DomainRuleException('Das Vorschaubild ließ sich nicht lesen.'); + } + + $key = 'file:'.hash('sha256', $bytes); + $existing = $this->existing($composition, $key); + + if ($existing instanceof ContentElement) { + $this->reused = true; + + return $existing; + } + + $title = (string) ($composition->display_title ?: $composition->designation); + $path = 'cms/titelbild-'.$composition->id.'-'.Str::lower(Str::random(8)).'.jpg'; + Storage::disk('cms_incoming')->put($path, $bytes); + + $still = $this->intake->acceptImage($path, 'Titelbild: '.$title, null, 'Titelbild zu „'.$title.'“', $actor); + + try { + CompositionStillSource::query()->updateOrCreate( + ['composition_id' => $composition->id, 'source_key' => $key], + ['still_element_id' => $still->id, 'actor_id' => $actor?->id], + ); + } catch (QueryException) { + return $this->existing($composition, $key) ?? $still; + } + + return $still; + } + + private function existing(Composition $composition, string $key): ?ContentElement + { + $source = CompositionStillSource::query()->with('still')->where('composition_id', $composition->id)->where('source_key', $key)->first(); + $still = $source?->still; + + // Ein archiviertes oder bei der Verarbeitung gescheitertes Bild wird nicht wiederverwendet. + return $still instanceof ContentElement && $still->archived_at === null && ! filled($still->thumbnail_error) ? $still : null; + } +} diff --git a/app/Domain/Media/CompositionStillSource.php b/app/Domain/Media/CompositionStillSource.php new file mode 100644 index 0000000..e6a2786 --- /dev/null +++ b/app/Domain/Media/CompositionStillSource.php @@ -0,0 +1,26 @@ +belongsTo(Composition::class); + } + + public function still(): BelongsTo + { + return $this->belongsTo(ContentElement::class, 'still_element_id'); + } +} diff --git a/app/Domain/Media/FilmStill.php b/app/Domain/Media/FilmStill.php new file mode 100644 index 0000000..51d1437 --- /dev/null +++ b/app/Domain/Media/FilmStill.php @@ -0,0 +1,257 @@ +output_class !== 'film') { + return 'Nur aus einem Film lässt sich ein Bild übernehmen.'; + } + + if ($film->archived_at !== null) { + return 'Der Film ist archiviert.'; + } + + $slug = $film->editorialContentKind?->slug; + + if (in_array($slug, PublicMaterialReader::CONFIDENTIAL_KINDS, true)) { + return 'Aus Traineranleitungen werden keine Bilder für die Website übernommen.'; + } + + return null; + } + + /** Die bereitgestellte Fassung, aus der Stellen gezogen werden (die höchste). */ + public function version(ContentElement $film): ?ContentElementVersion + { + return $film->versions() + ->where('status', ContentVersionStatus::Bereit->value) + ->orderByDesc('number') + ->first(); + } + + /** + * Die Website-Datei, aus der Stellen gezogen werden, wenn es keine bereitgestellte Fassung gibt (Film nur mit + * Website-Datei). Sonst null. + */ + public function websiteFile(ContentElement $film): ?string + { + $path = $film->preview_path; + + if ($this->version($film) instanceof ContentElementVersion + || ! is_string($path) || $path === '' || str_contains($path, '..') || ! str_starts_with($path, 'teaser/') + || ! Storage::disk('media_derived')->exists($path)) { + return null; + } + + return $path; + } + + /** Sekunde der Stelle, aus der das aktuelle Vorschaubild des Films stammt, sonst null. */ + public function thumbnailSecond(ContentElement $film): ?string + { + $source = $film->thumbnail_source; + + return is_string($source) && preg_match('/^frame:\d+@([\d.]+)$/', $source, $match) === 1 ? $match[1] : null; + } + + public function fromSecond(ContentElement $film, float $seconds, ?User $actor = null): ContentElement + { + $this->reused = false; + $this->guard($film); + + if ($seconds < 0 || $seconds > 7200) { + throw new DomainRuleException('Die Zeitposition liegt außerhalb des Films.'); + } + + $version = $this->version($film); + + if (! $version instanceof ContentElementVersion) { + if ($this->websiteFile($film) !== null) { + return $this->fromWebsiteFrame($film, $seconds, $actor); + } + + throw new DomainRuleException('Der Film hat weder eine bereitgestellte Fassung noch eine Website-Datei.'); + } + + return $this->fromFrame($film, $version, $seconds, $actor); + } + + public function fromThumbnail(ContentElement $film, ?User $actor = null): ContentElement + { + $this->reused = false; + $this->guard($film); + + // Stammt das Vorschaubild aus einer Filmstelle, wird dieselbe Stelle in voller Auflösung gezogen. + $second = $this->thumbnailSecond($film); + + if ($second !== null && preg_match('/^frame:(\d+)@/', (string) $film->thumbnail_source, $match) === 1) { + $version = ContentElementVersion::query()->find((int) $match[1]); + + if ($version instanceof ContentElementVersion + && (int) $version->content_element_id === (int) $film->id + && $version->status !== ContentVersionStatus::Gesperrt) { + try { + return $this->fromFrame($film, $version, (float) $second, $actor); + } catch (DomainRuleException) { + // Die Stelle lässt sich nicht mehr ziehen: das gespeicherte Vorschaubild selbst übernehmen. + } + } + } + + $path = $film->thumbnail_path; + + if (! is_string($path) || ! str_starts_with($path, 'vorschau/') || str_contains($path, '..') || ! Storage::disk('media_derived')->exists($path)) { + throw new DomainRuleException('Dieser Film hat noch kein Vorschaubild. Setzen Sie es im Medienmanager oder wählen Sie eine Stelle.'); + } + + $bytes = Storage::disk('media_derived')->get($path); + + if (! is_string($bytes) || $bytes === '') { + throw new DomainRuleException('Das Vorschaubild ließ sich nicht lesen.'); + } + + $key = 'file:'.hash('sha256', $bytes); + $existing = $this->existing($film, $key); + + if ($existing instanceof ContentElement) { + $this->reused = true; + + return $existing; + } + + return $this->store($film, $key, $bytes, 'Vorschaubild', $actor); + } + + private function fromFrame(ContentElement $film, ContentElementVersion $version, float $seconds, ?User $actor): ContentElement + { + $second = $this->secondText($seconds); + $key = 'frame:'.$version->id.'@'.$second; + $existing = $this->existing($film, $key); + + if ($existing instanceof ContentElement) { + $this->reused = true; + + return $existing; + } + + $bytes = $this->deriver->frameJpeg($version, (float) $second, self::WIDTH, original: true); + + if (! is_string($bytes)) { + throw new DomainRuleException('Aus dieser Filmstelle ließ sich kein Bild erzeugen.'); + } + + return $this->store($film, $key, $bytes, 'Fassung '.$version->number.', '.str_replace('.', ',', $second).' s', $actor); + } + + private function fromWebsiteFrame(ContentElement $film, float $seconds, ?User $actor): ContentElement + { + $second = $this->secondText($seconds); + $key = 'frame:0@'.$second; + $existing = $this->existing($film, $key); + + if ($existing instanceof ContentElement) { + $this->reused = true; + + return $existing; + } + + $bytes = $this->deriver->websiteFileJpeg($film, (float) $second, self::WIDTH); + + if (! is_string($bytes)) { + throw new DomainRuleException('Aus dieser Stelle der Website-Datei ließ sich kein Bild erzeugen.'); + } + + return $this->store($film, $key, $bytes, 'Website-Datei, '.str_replace('.', ',', $second).' s', $actor); + } + + private function guard(ContentElement $film): void + { + $refusal = $this->refusal($film); + + if ($refusal !== null) { + throw new DomainRuleException($refusal); + } + } + + private function existing(ContentElement $film, string $key): ?ContentElement + { + $source = FilmStillSource::query()->with('still')->where('film_element_id', $film->id)->where('source_key', $key)->first(); + $still = $source?->still; + + // Ein archiviertes oder an der Verarbeitung gescheitertes Bild wird nicht wiederverwendet; die Stelle kann neu + // übernommen werden (store() ordnet dann das neue Bild zu). + return $still instanceof ContentElement && $still->archived_at === null && ! filled($still->thumbnail_error) ? $still : null; + } + + private function store(ContentElement $film, string $key, string $bytes, string $label, ?User $actor): ContentElement + { + $title = (string) ($film->display_title ?: $film->working_title); + $path = 'cms/standbild-'.$film->id.'-'.Str::lower(Str::random(8)).'.jpg'; + Storage::disk('cms_incoming')->put($path, $bytes); + + $still = $this->intake->acceptImage( + $path, + 'Standbild: '.$title.' ('.$label.')', + filled($film->website_credit) ? (string) $film->website_credit : null, + 'Szene aus dem Film „'.$title.'“', + $actor, + ); + + try { + FilmStillSource::query()->updateOrCreate( + ['film_element_id' => $film->id, 'source_key' => $key], + ['still_element_id' => $still->id, 'actor_id' => $actor?->id], + ); + } catch (QueryException) { + // Gleichzeitige Übernahme derselben Stelle: das zuerst angelegte Bild gilt. + return $this->existing($film, $key) ?? $still; + } + + return $still; + } + + private function secondText(float $seconds): string + { + $text = number_format(max(0, min(7200, $seconds)), 3, '.', ''); + + return rtrim(rtrim($text, '0'), '.') ?: '0'; + } +} diff --git a/app/Domain/Media/FilmStillSource.php b/app/Domain/Media/FilmStillSource.php new file mode 100644 index 0000000..fb8a559 --- /dev/null +++ b/app/Domain/Media/FilmStillSource.php @@ -0,0 +1,26 @@ +belongsTo(ContentElement::class, 'film_element_id'); + } + + public function still(): BelongsTo + { + return $this->belongsTo(ContentElement::class, 'still_element_id'); + } +} diff --git a/app/Domain/Media/PresentationFile.php b/app/Domain/Media/PresentationFile.php index 8c5e592..2a42fec 100644 --- a/app/Domain/Media/PresentationFile.php +++ b/app/Domain/Media/PresentationFile.php @@ -4,39 +4,72 @@ use App\Domain\Catalog\ContentElement; use App\Domain\Catalog\DomainRuleException; +use App\Jobs\StorePresentationFile; use Illuminate\Support\Facades\Storage; /** - * Legt die technische Ableitung eines Präsentationsmediums an der Medienidentität ab. - * Es entsteht keine Inhaltsfassung, keine Freigabe und keine Berechtigung. + * Legt die technische Ableitung eines Präsentationsmediums (Website-Datei) an der Medienidentität ab. + * Es entsteht keine Inhaltsfassung, keine Freigabe und keine Berechtigung. Eine vorhandene Inhaltsfassung bleibt + * unverändert und geschützt; die Website-Datei ist eine eigene, bewusst gewählte Datei daneben. + * + * Der Web-Prozess hat `derived/` nur lesend. Er prüft deshalb nur und gibt das Kopieren an die Warteschlange + * (`StorePresentationFile`, ruft `place()` auf). */ class PresentationFile { - public function store(ContentElement $element, string $incoming): void + /** + * Dateiendungen, die ein Browser auf der Website abspielen kann. + * + * @var array> + */ + public const EXTENSIONS = [ + 'bild' => ['jpg', 'jpeg', 'png', 'webp', 'gif'], + 'audio' => ['mp3', 'm4a', 'ogg'], + 'film' => ['mp4', 'webm'], + ]; + + /** + * Prüft die Datei im Eingang, ohne etwas zu verändern. Wirft eine verständliche Regelverletzung. + */ + public function validate(string $outputClass, string $incoming): void { - if (! in_array($element->output_class, ['bild', 'film', 'audio'], true)) { + if (! isset(self::EXTENSIONS[$outputClass])) { throw new DomainRuleException('Eine Präsentationsdatei ist ein Bild, ein Film oder ein Hörstück.'); } - if ($element->versions()->exists()) { - throw new DomainRuleException('Dieses Medium hat bereits eine Inhaltsfassung. Die Präsentationsdatei ersetzt sie nicht.'); + $extension = strtolower(pathinfo($incoming, PATHINFO_EXTENSION)); + + if (! in_array($extension, self::EXTENSIONS[$outputClass], true)) { + throw new DomainRuleException(sprintf( + 'Für die Website geht nur %s. Eine %s-Datei kann der Browser nicht direkt abspielen; wandle sie vorher um oder lade sie ohne „Eigenständiges Präsentationsmedium“ hoch.', + $this->formats($outputClass), + $extension === '' ? 'Datei ohne Endung' : '.'.$extension, + )); } if (! $this->readable($incoming)) { throw new DomainRuleException('Die Datei liegt nicht im Eingang.'); } + } + + public function store(ContentElement $element, string $incoming): void + { + $this->validate((string) $element->output_class, $incoming); + + $element->thumbnail_error = null; + $element->save(); + + StorePresentationFile::dispatch($element->id, $incoming); + } + + /** + * Kopiert die Datei nach `derived/`. Läuft nur in der Warteschlange, die dort schreiben darf. + */ + public function place(ContentElement $element, string $incoming): void + { + $this->validate((string) $element->output_class, $incoming); $extension = strtolower(pathinfo($incoming, PATHINFO_EXTENSION)); - $allowed = match ($element->output_class) { - 'bild' => ['jpg', 'jpeg', 'png', 'webp', 'gif'], - 'audio' => ['mp3', 'm4a', 'ogg'], - default => ['mp4', 'webm'], - }; - - if (! in_array($extension, $allowed, true)) { - throw new DomainRuleException('Diese Datei ist keine freigebbare Ableitung. Es wird keine Inhaltsfassung angelegt.'); - } - $prefix = $element->output_class === 'bild' ? 'vorschau' : 'teaser'; $target = $prefix.'/'.$element->id.'/datei.'.$extension; $stream = Storage::disk('cms_incoming')->readStream($incoming); @@ -46,11 +79,15 @@ public function store(ContentElement $element, string $incoming): void } try { - Storage::disk('media_derived')->writeStream($target, $stream); + $written = Storage::disk('media_derived')->writeStream($target, $stream); } finally { fclose($stream); } + if ($written === false) { + throw new DomainRuleException('Die Datei ließ sich nicht ablegen.'); + } + if ($element->output_class === 'bild') { $element->thumbnail_path = $target; $element->thumbnail_source = 'eigen'; @@ -58,7 +95,18 @@ public function store(ContentElement $element, string $incoming): void $element->preview_path = $target; } + $element->thumbnail_error = null; $element->save(); + Storage::disk('cms_incoming')->delete($incoming); + } + + public function formats(string $outputClass): string + { + return match ($outputClass) { + 'bild' => 'JPG, PNG, WebP oder GIF', + 'audio' => 'MP3, M4A oder OGG', + default => 'MP4 (H.264) oder WebM', + }; } private function readable(string $path): bool diff --git a/app/Domain/Media/ThumbnailDeriver.php b/app/Domain/Media/ThumbnailDeriver.php index 6db8103..2e4a998 100644 --- a/app/Domain/Media/ThumbnailDeriver.php +++ b/app/Domain/Media/ThumbnailDeriver.php @@ -87,6 +87,27 @@ public function forElementFrame(ContentElement $element, ContentElementVersion $ $this->rememberElement($element, 'frame:'.$version->id.'@'.$this->secondText($seconds)); } + /** + * Vorschaubild aus einer Stelle der Website-Datei. Die Herkunft steht als `frame:0@{Sekunde}`; die 0 steht für die + * Website-Datei (es gibt keine Fassung), alle Leser der Herkunft kommen damit zurecht. + */ + public function forElementWebsiteFrame(ContentElement $element, float $seconds): void + { + $bytes = $this->jpegAtWebsiteFile($element, $seconds); + + if (! is_string($bytes)) { + $this->fail($element, 'Aus dieser Filmstelle ließ sich kein Vorschaubild erzeugen.'); + + return; + } + + $name = 'element-'.$element->id; + $path = 'vorschau/'.$name.'.jpg'; + Storage::disk('media_derived')->put($path, $bytes); + $this->still($element, Storage::disk('media_derived'), $path, $name); + $this->rememberElement($element, 'frame:0@'.$this->secondText($seconds)); + } + public function forCompositionUpload(Composition $composition, string $incoming): void { if (! str_starts_with($incoming, 'vorschau/') || str_contains($incoming, '..')) { @@ -138,8 +159,20 @@ public function forCompositionFrame(Composition $composition, ContentElementVers $this->rememberChoice($composition, 'frame:'.$version->id.'@'.$this->secondText($seconds)); } - public function frameInput(ContentElementVersion $version): ?string + /** + * Datei, aus der ein Bild gezogen wird. Vorgabe: die kleine Filmstufe (schnell, für die Vorschau). Mit $original + * zuerst die Mediendatei selbst, damit ein übernommenes Standbild nicht aus der kleinen Stufe hochgerechnet wird. + */ + public function frameInput(ContentElementVersion $version, bool $original = false): ?string { + if ($original) { + $master = is_array($version->metadata) ? ($version->metadata['file'] ?? null) : null; + + if ($this->readableDerived($master, 'inhalte/')) { + return $master; + } + } + $proxy = MediaRendition::query() ->where('content_element_version_id', $version->id) ->where('role', 'variant') @@ -155,15 +188,55 @@ public function frameInput(ContentElementVersion $version): ?string return $this->readableDerived($file, 'inhalte/') ? $file : null; } + /** + * Einzelbild einer Filmstelle als JPEG, 640 px breit aus der kleinen Stufe (Vorschau im Editor und Vorschaubild). + */ public function jpegAtVersion(ContentElementVersion $version, float $seconds): ?string + { + return $this->frameJpeg($version, $seconds); + } + + /** + * Einzelbild einer Filmstelle als JPEG. Ein übernommenes Standbild (FilmStill) wird mit $width und $original aus der + * Mediendatei gezogen statt aus der kleinen Stufe und dabei nie über die Breite der Quelle hinaus vergrößert. + */ + public function frameJpeg(ContentElementVersion $version, float $seconds, int $width = 640, bool $original = false): ?string { if ($seconds < 0 || $seconds > 7200) { return null; } - $file = $this->frameInput($version); + $file = $this->frameInput($version, $original); - if ($file === null) { + return $file === null ? null : $this->jpegFromFile($file, $seconds, $width); + } + + /** + * Einzelbild aus der Website-Datei eines Films (`teaser/`), für Medien ohne Inhaltsfassung. + */ + public function jpegAtWebsiteFile(ContentElement $element, float $seconds): ?string + { + return $this->websiteFileJpeg($element, $seconds, 640); + } + + /** + * Einzelbild aus der Website-Datei in der gewünschten Breite, nie über die Breite der Datei hinaus (Standbild für + * die Medienkarte, FilmStill). + */ + public function websiteFileJpeg(ContentElement $element, float $seconds, int $width): ?string + { + $file = $element->preview_path; + + if ($element->output_class !== 'film' || ! $this->readableDerived($file, 'teaser/')) { + return null; + } + + return $this->jpegFromFile($file, $seconds, $width); + } + + private function jpegFromFile(string $file, float $seconds, int $width): ?string + { + if ($seconds < 0 || $seconds > 7200) { return null; } @@ -186,7 +259,7 @@ public function jpegAtVersion(ContentElementVersion $version, float $seconds): ? '-frames:v', '1', '-vf', - 'scale=640:-2', + $width === 640 ? 'scale=640:-2' : 'scale=min('.max(160, min(2400, $width)).'\,iw):-2', '-f', 'image2pipe', '-vcodec', diff --git a/app/Domain/Media/WebsiteMediaAlias.php b/app/Domain/Media/WebsiteMediaAlias.php index 6d9adca..38880e2 100644 --- a/app/Domain/Media/WebsiteMediaAlias.php +++ b/app/Domain/Media/WebsiteMediaAlias.php @@ -37,6 +37,16 @@ public static function effectiveFor(mixed $path): ?self return $alias instanceof self && $alias->everReleased() ? $alias : null; } + /** + * Früherer Pfad, dessen übernommenes Medium inzwischen gelöscht wurde. Die Datei unter cms/ bleibt liegen, wird aber + * weder ausgeliefert noch als Bild gezeigt: Das Löschen des Mediums gilt auch für die frühere Adresse. + */ + public static function isRetired(mixed $path): bool + { + return is_string($path) && $path !== '' + && self::query()->where('legacy_path', $path)->whereNull('content_element_id')->exists(); + } + public function everReleased(): bool { $element = $this->element; diff --git a/app/Domain/Media/WebsiteRelease.php b/app/Domain/Media/WebsiteRelease.php index 34ece54..fb9eccb 100644 --- a/app/Domain/Media/WebsiteRelease.php +++ b/app/Domain/Media/WebsiteRelease.php @@ -44,7 +44,7 @@ public function refusal(ContentElement $element): ?string } if ($this->derivedPath($element) === null) { - return 'Für die Website fehlt eine freigebbare Ableitung. Beim Bild ist das das Vorschaubild. Film und Hörstück ohne Inhaltsfassung nutzen die Datei am Medium unter teaser/. Ein Film mit Inhaltsfassung nutzt die Teaserfassung seiner bereitgestellten Fassung. Die Originaldatei bleibt geschützt.'; + return 'Für die Website fehlt eine freigebbare Datei. Beim Bild ist das das Vorschaubild. Bei Film und Hörstück lädst du unter „Website-Freigabe“ eine Website-Datei hoch (Film als MP4 oder WebM); die geschützte Originaldatei bleibt unberührt.'; } return null; diff --git a/app/Filament/Resources/Bundles/Pages/ViewBundle.php b/app/Filament/Resources/Bundles/Pages/ViewBundle.php index 1a4100e..f16e5e5 100644 --- a/app/Filament/Resources/Bundles/Pages/ViewBundle.php +++ b/app/Filament/Resources/Bundles/Pages/ViewBundle.php @@ -11,6 +11,7 @@ use App\Filament\Resources\Bundles\BundleResource; use App\Filament\Support\CatalogOptions; use App\Filament\Support\CatalogReading; +use App\Filament\Support\PublicationReadiness; use App\Filament\Support\ReportsDomainRules; use Filament\Actions\Action; use Filament\Forms\Components\CheckboxList; @@ -90,7 +91,8 @@ public function publishAction(): Action ->modalSubmitActionLabel(fn (): string => 'Fassung '.$this->nextNumber().' veröffentlichen') ->fillForm(fn (): array => $this->formFromPublished()) ->schema([ - CheckboxList::make('articles')->label('Lizenzartikel')->options(fn (): array => CatalogOptions::articles()), + CheckboxList::make('articles')->label('Lizenzartikel')->options(fn (): array => app(PublicationReadiness::class)->articleOptions()) + ->helperText('Artikel ohne Stand lassen sich aufnehmen, aber erst verkaufen, wenn sie einen Inhalt haben.'), CheckboxList::make('bundles')->label('Enthaltene Pakete') ->options(function (): array { $options = CatalogOptions::bundles(); @@ -115,7 +117,12 @@ public function publishAction(): Action $version = app(BundleService::class)->publish($bundle, $items); - return 'Fassung '.$version->number.' ist veröffentlicht.'; + $bundle->unsetRelations(); + $readiness = app(PublicationReadiness::class)->forBundle($bundle->refresh()); + + return 'Fassung '.$version->number.' ist veröffentlicht.'.($readiness['naechster'] !== null + ? ' Nächster Schritt: '.$readiness['naechster']['titel'].'.' + : ''); }, 'Die Paketfassung ist veröffentlicht.'); $this->getRecord()->unsetRelations(); $this->getRecord()->refresh(); @@ -164,6 +171,7 @@ private function paketDaten(): array 'art' => 'primary', ]], ], + 'voraussetzungen' => app(PublicationReadiness::class)->forBundle($bundle), 'haupt' => [ [ 'titel' => 'Bestandteile', diff --git a/app/Filament/Resources/Compositions/Pages/EditComposition.php b/app/Filament/Resources/Compositions/Pages/EditComposition.php index 5fe04cf..31d4f0c 100644 --- a/app/Filament/Resources/Compositions/Pages/EditComposition.php +++ b/app/Filament/Resources/Compositions/Pages/EditComposition.php @@ -22,6 +22,7 @@ use App\Domain\Cms\Catalog\PublicCatalogReader; use App\Domain\Cms\Widgets\RenderContext; use App\Filament\Resources\ContentElements\ContentElementResource; +use App\Filament\Support\AssignsPillars; use App\Filament\Support\EditorialCatalog; use App\Filament\Support\ManagesEditorialSurface; use App\Filament\Support\MediumForm; @@ -43,6 +44,7 @@ abstract class EditComposition extends EditRecord { + use AssignsPillars; use ManagesEditorialSurface; use WithFileUploads; @@ -398,11 +400,15 @@ public function redaktionTexteHinweis(): string */ public function einordnungGruppen(): array { - return array_map(fn (array $group): array => [ + $groups = array_map(fn (array $group): array => [ 'legend' => $group['label'], 'model' => 'dimensionIds', 'values' => $group['values'], ], $this->dimensionGroups()); + + $pillars = $this->pillarGroup(); + + return $pillars === null ? $groups : [$pillars, ...$groups]; } /** @@ -466,7 +472,7 @@ public function einordnungUnsaved(): bool sort($stored); sort($current); - return $stored !== $current; + return $stored !== $current || $this->pillarsUnsaved($record); } public function openText(): void @@ -1654,6 +1660,7 @@ protected function fillRedaktion(): void ->pluck('editorial_dimension_value_id') ->map(fn (mixed $id): string => (string) (int) $id) ->all(); + $this->loadPillarIds($composition); } /** @@ -1913,6 +1920,7 @@ protected function persistRedaktion(): bool 'description' => $this->description, ], $this->actor()); $this->syncDimensions($record, array_map(intval(...), $this->dimensionIds)); + $this->persistPillarIds($record); $record->refresh(); $this->getRecord()->setRawAttributes($record->getAttributes()); diff --git a/app/Filament/Resources/ContentElements/Pages/ListContentElements.php b/app/Filament/Resources/ContentElements/Pages/ListContentElements.php index 4cbde8c..a2d0056 100644 --- a/app/Filament/Resources/ContentElements/Pages/ListContentElements.php +++ b/app/Filament/Resources/ContentElements/Pages/ListContentElements.php @@ -3,6 +3,7 @@ namespace App\Filament\Resources\ContentElements\Pages; use App\Domain\Catalog\EditorialVocabulary; +use App\Domain\Catalog\PillarFilterCompat; use App\Filament\Resources\ContentElements\ContentElementResource; use App\Filament\Support\Bestand; use App\Filament\Support\MediaLibrary; @@ -39,6 +40,9 @@ class ListContentElements extends ListRecords #[Url(as: 'freigabe', except: '')] public string $freigabe = ''; + #[Url(as: 'schutz', except: '')] + public string $schutz = ''; + #[Url(as: 'entwurf', except: '')] public string $entwurf = ''; @@ -84,7 +88,7 @@ public function content(Schema $schema): Schema protected function bestandFilterEigenschaften(): array { - return ['suche', 'art', 'freigabe', 'entwurf', 'fassung', 'nutzung', 'saeule', 'inhaltsart', 'einordnung', 'verarbeitung', 'archiv']; + return ['suche', 'art', 'schutz', 'freigabe', 'entwurf', 'fassung', 'nutzung', 'saeule', 'inhaltsart', 'einordnung', 'verarbeitung', 'archiv']; } public function showingList(): bool @@ -137,6 +141,7 @@ public function filtersActive(): bool return trim($this->suche) !== '' || $this->art !== '' || $this->freigabe !== '' + || $this->schutz !== '' || $this->entwurf !== '' || $this->fassung !== '' || $this->nutzung !== '' @@ -152,6 +157,7 @@ public function resetFilters(): void $this->suche = ''; $this->art = ''; $this->freigabe = ''; + $this->schutz = ''; $this->entwurf = ''; $this->fassung = ''; $this->nutzung = ''; @@ -170,6 +176,11 @@ public function resetFilters(): void */ public function bestand(): array { + // Alte Adressen mit einem Säulenwert der Einordnung gelten für die zentrale Säule. + if (ctype_digit($this->einordnung) && $this->saeule === '' && is_int($pillar = PillarFilterCompat::pillarOfLegacyValue((int) $this->einordnung))) { + [$this->saeule, $this->einordnung] = [(string) $pillar, '']; + } + $optionen = fn (array $liste, string $wert, string $label): array => collect($liste) ->mapWithKeys(fn (array $eintrag): array => [(string) $eintrag[$wert] => $eintrag[$label]]) ->all(); @@ -194,11 +205,12 @@ public function bestand(): array 'suche' => ['eigenschaft' => 'suche', 'label' => 'Suche', 'platzhalter' => 'Titel, Beschreibung oder Suchbegriff'], 'filter' => [ ['eigenschaft' => 'art', 'label' => 'Technische Art', 'vorgabe' => '', 'alle' => 'Alle Arten', 'optionen' => $optionen($this->typeOptions(), 'value', 'label')], + ['eigenschaft' => 'schutz', 'label' => 'Schutz', 'vorgabe' => '', 'alle' => 'Alle Medien', 'optionen' => ['geschuetzt' => 'Geschützte Medien', 'oeffentlich' => 'Öffentliche Medien', 'website' => 'Auf der Website frei']], ['eigenschaft' => 'freigabe', 'label' => 'Freigabe', 'vorgabe' => '', 'alle' => 'Alle Freigaben', 'optionen' => ['freigegeben' => 'Freigegebene Fassung', 'entwurf' => 'Nur offener Entwurf', 'ohne' => 'Keine freigegebene Fassung']], ['eigenschaft' => 'nutzung', 'label' => 'Verwendung', 'vorgabe' => '', 'alle' => 'Verwendung egal', 'optionen' => ['verwendet' => 'Verwendet', 'unbenutzt' => 'Nicht verwendet']], ], 'weitere' => $weitere, - 'hinweis' => 'Freigabe meint die Fassung des Mediums, nicht die Website und keinen Zugriff. Materialart und Einordnung sind die redaktionelle Klassifikation; Verwendung zeigt, wo das Medium tatsächlich eingebunden ist. Deaktivierte und archivierte Medien bleiben über „Weitere Filter“ auffindbar.', + 'hinweis' => 'Freigabe meint die Fassung des Mediums, nicht die Website und keinen Zugriff. Geschützte Medien haben eine Inhaltsfassung und laufen über Lizenzen. Öffentliche Medien sind eigenständige Präsentationsmedien ohne Fassung für die Website; ob sie freigegeben sind, zeigt die Kennzeichnung an der Zeile. Materialart und Einordnung sind die redaktionelle Klassifikation; Verwendung zeigt, wo das Medium tatsächlich eingebunden ist. Deaktivierte und archivierte Medien bleiben über „Weitere Filter“ auffindbar.', 'zeilen' => array_map($this->zeile(...), $this->cards()), 'einheit' => ['Medium', 'Medien'], 'leer' => ['titel' => 'Noch keine Medien', 'text' => 'Mit „Medium anlegen“ oben lädst du eine Datei hoch oder schreibst einen Text.'], @@ -212,13 +224,19 @@ public function bestand(): array */ private function zeile(array $card): array { - $chips = [['label' => $card['stand'], 'ton' => match ($card['standTone']) { + $chips = [['label' => $card['presentation'] ? 'Präsentationsmedium, ohne Inhaltsfassung' : $card['stand'], 'ton' => match ($card['standTone']) { 'ready' => 'gut', 'draft' => 'offen', 'blocked' => 'achtung', default => 'leise', }]]; + if ($card['websiteReleased']) { + $chips[] = ['label' => 'Für die Website freigegeben', 'ton' => 'gut']; + } elseif ($card['presentation']) { + $chips[] = ['label' => 'Nicht für die Website freigegeben', 'ton' => 'offen']; + } + foreach ([['draftNote', 'offen'], ['blockedNote', 'achtung'], ['processing', 'offen'], ['versionLabel', 'leise']] as [$feld, $ton]) { if (filled($card[$feld] ?? null)) { $chips[] = ['label' => (string) $card[$feld], 'ton' => $ton]; @@ -266,6 +284,7 @@ private function libraryFilters(): array 'suche' => $this->suche, 'art' => $this->art, 'freigabe' => $this->freigabe, + 'schutz' => $this->schutz, 'entwurf' => $this->entwurf, 'fassung' => $this->fassung, 'nutzung' => $this->nutzung, diff --git a/app/Filament/Resources/ContentElements/Pages/ViewContentElement.php b/app/Filament/Resources/ContentElements/Pages/ViewContentElement.php index 1d648a5..0a3f203 100644 --- a/app/Filament/Resources/ContentElements/Pages/ViewContentElement.php +++ b/app/Filament/Resources/ContentElements/Pages/ViewContentElement.php @@ -17,6 +17,7 @@ use App\Domain\Cms\Catalog\PublicMaterialReader; use App\Domain\Cms\WebsiteImageUsage; use App\Domain\Cms\Widgets\RenderContext; +use App\Domain\Media\PresentationFile; use App\Domain\Media\ThumbnailRef; use App\Domain\Media\WebsiteMedia; use App\Domain\Media\WebsiteRelease; @@ -92,6 +93,9 @@ class ViewContentElement extends ViewRecord public string $websiteFeedback = ''; + /** Gewählte Website-Datei für Film oder Hörstück (ungeschützt, getrennt von der Inhaltsfassung). */ + public mixed $websiteUpload = null; + public int|string|null $kindId = null; /** @var list */ @@ -262,8 +266,9 @@ public function adoptFrame(): void /** @var ContentElement $element */ $element = $this->getRecord(); $shown = $this->shownVersion(); + $fromWebsiteFile = ! $shown instanceof ContentElementVersion && $this->hasWebsiteFilm($element); - if (! $shown instanceof ContentElementVersion || $element->output_class !== 'film') { + if ((! $shown instanceof ContentElementVersion && ! $fromWebsiteFile) || $element->output_class !== 'film') { $this->pictureFeedback = 'Für dieses Medium gibt es keine Filmstelle.'; return; @@ -286,7 +291,9 @@ public function adoptFrame(): void $this->keepAlt($element); $element->thumbnail_error = null; $element->save(); - DeriveThumbnail::dispatch('element', $element->id, null, null, $shown->id, $seconds); + $fromWebsiteFile + ? DeriveThumbnail::dispatch('element', $element->id, null, null, null, $seconds, true) + : DeriveThumbnail::dispatch('element', $element->id, null, null, $shown->id, $seconds); $element->refresh(); $this->pictureFeedback = $element->thumbnail_error ?: 'Das Vorschaubild ist gespeichert. Die Fassung bleibt unverändert.'; @@ -361,10 +368,24 @@ public function useOwnImage(): void ?: 'Das Vorschaubild ist gespeichert. Die Fassung bleibt unverändert.'; } + /** Ein Film ohne Inhaltsfassung, aber mit Website-Datei: die Filmstelle kommt aus dieser Datei. */ + public function hasWebsiteFilm(?ContentElement $element = null): bool + { + $element ??= $this->getRecord(); + + return $element->output_class === 'film' + && filled($element->preview_path) + && ! $element->versions()->exists(); + } + public function framePreviewUrl(): ?string { $shown = $this->shownVersion(); + if (! $shown instanceof ContentElementVersion && $this->hasWebsiteFilm() && is_numeric($this->frameSecond) && trim($this->frameSecond) !== '') { + return route('content.website-frame', ['element' => $this->getRecord(), 'sekunde' => $this->frameSecond]); + } + if (! $shown instanceof ContentElementVersion || ! is_numeric($this->frameSecond) || trim($this->frameSecond) === '') { return null; } @@ -844,6 +865,61 @@ public function releaseForWebsite(): void $element->refresh(); } + /** + * Legt die Datei ab, die auf der Website laufen soll (zum Beispiel ein Trailer). Die geschützte Inhaltsfassung + * bleibt unberührt; öffentlich wird die Datei erst mit der Website-Freigabe. + */ + public function storeWebsiteFile(): void + { + abort_unless(ContentElementResource::editor(), 403); + + /** @var ContentElement $element */ + $element = $this->getRecord(); + + if (! in_array($element->output_class, ['film', 'audio'], true)) { + $this->websiteFeedback = 'Eine Website-Datei gibt es nur für Filme und Hörstücke.'; + + return; + } + + if (! $this->websiteUpload instanceof TemporaryUploadedFile) { + $this->websiteFeedback = 'Wähle zuerst eine Datei.'; + + return; + } + + $files = app(PresentationFile::class); + $extension = strtolower($this->websiteUpload->getClientOriginalExtension()); + + if (! in_array($extension, PresentationFile::EXTENSIONS[$element->output_class], true)) { + $this->websiteFeedback = 'Für die Website geht nur '.$files->formats($element->output_class).'. Eine .'.$extension.'-Datei kann der Browser nicht direkt abspielen.'; + + return; + } + + $path = $this->websiteUpload->storeAs('inhalte', 'web-'.bin2hex(random_bytes(6)).'.'.$extension, 'cms_incoming'); + $this->websiteUpload = null; + + if (! is_string($path)) { + $this->websiteFeedback = 'Die Datei wurde nicht übernommen.'; + + return; + } + + try { + $files->store($element, $path); + } catch (DomainRuleException $e) { + $this->websiteFeedback = $e->getMessage(); + + return; + } + + $element->refresh(); + $this->websiteFeedback = filled($element->thumbnail_error) + ? (string) $element->thumbnail_error + : 'Die Website-Datei ist übernommen. Sie ist erst nach „Für die Website freigeben“ öffentlich. Ein bereits freigegebenes Medium zeigt danach die neue Datei.'; + } + public function withdrawWebsite(): void { abort_unless(ContentElementResource::editor(), 403); diff --git a/app/Filament/Resources/LicenseArticles/LicenseArticleResource.php b/app/Filament/Resources/LicenseArticles/LicenseArticleResource.php index 5508c6f..5dd7d39 100644 --- a/app/Filament/Resources/LicenseArticles/LicenseArticleResource.php +++ b/app/Filament/Resources/LicenseArticles/LicenseArticleResource.php @@ -7,6 +7,7 @@ use App\Filament\Resources\LicenseArticles\Pages\ListLicenseArticles; use App\Filament\Resources\LicenseArticles\Pages\ViewLicenseArticle; use App\Filament\Support\CatalogReading; +use App\Filament\Support\PublicationReadiness; use App\Models\User; use Filament\Facades\Filament; use Filament\Resources\Resource; @@ -57,6 +58,7 @@ public static function infolist(Schema $schema): Schema ->viewData(fn (LicenseArticle $record): array => [ 'stand' => app(CatalogReading::class)->articleStand($record), 'kontext' => app(CatalogReading::class)->articleContext($record), + 'voraussetzungen' => app(PublicationReadiness::class)->forArticle($record), ]) ->columnSpanFull(), ]); diff --git a/app/Filament/Resources/LicenseArticles/Pages/ViewLicenseArticle.php b/app/Filament/Resources/LicenseArticles/Pages/ViewLicenseArticle.php index 9c17df4..ae4f7ab 100644 --- a/app/Filament/Resources/LicenseArticles/Pages/ViewLicenseArticle.php +++ b/app/Filament/Resources/LicenseArticles/Pages/ViewLicenseArticle.php @@ -16,6 +16,7 @@ use App\Domain\Catalog\LicenseArticle; use App\Filament\Resources\ContentElements\ContentElementResource; use App\Filament\Resources\LicenseArticles\LicenseArticleResource; +use App\Filament\Support\AssignsPillars; use App\Filament\Support\CatalogOptions; use App\Filament\Support\EditorialCatalog; use App\Filament\Support\ManagesEditorialSurface; @@ -30,6 +31,7 @@ class ViewLicenseArticle extends ViewRecord { + use AssignsPillars; use ManagesEditorialSurface; use ReportsDomainRules; @@ -115,6 +117,7 @@ protected function saveRedaktionTexte(): bool ], auth()->user()); app(IdentityDimension::class)->replaceOffered($article, array_map(intval(...), $this->dimensionIds)); + $this->persistPillarIds($article); $article->refresh(); $this->fillLicenseEditorial(); @@ -159,7 +162,7 @@ public function einordnungUnsaved(): bool sort($stored); sort($current); - return $stored !== $current; + return $stored !== $current || $this->pillarsUnsaved($article); } /** @@ -270,11 +273,15 @@ public function einordnungArt(): array */ public function einordnungGruppen(): array { - return array_map(fn (array $group): array => [ + $groups = array_map(fn (array $group): array => [ 'legend' => $group['label'], 'model' => 'dimensionIds', 'values' => $group['values'], ], $this->licenseDimensionGroups()); + + $pillars = $this->pillarGroup(); + + return $pillars === null ? $groups : [$pillars, ...$groups]; } private function sourceTitle(Model $source): string @@ -312,6 +319,7 @@ private function fillLicenseEditorial(): void ->where('origin', 'direkt') ->pluck('editorial_dimension_value_id') ->all(); + $this->loadPillarIds($article); } protected function getHeaderActions(): array @@ -322,12 +330,28 @@ protected function getHeaderActions(): array public function releaseAction(): Action { return Action::make('release') - ->label('Stand veröffentlichen') + ->label(fn (): string => $this->isFirstStand() ? 'Inhalt festlegen' : 'Neuen Stand veröffentlichen') + ->modalHeading(fn (): string => $this->isFirstStand() ? 'Inhalt festlegen: ersten Stand veröffentlichen' : 'Neuen Stand veröffentlichen') + ->modalDescription(fn (): string => $this->isFirstStand() + ? 'Der Stand legt fest, welche Inhalte dieser Lizenzartikel lizenziert: der gewählte Inhalt samt allem, was er enthält. Er ist danach unveränderlich. Pakete und Angebote können den Artikel danach verwenden; verkauft wird er erst über ein Angebot.' + : 'Ein neuer Stand ersetzt den aktuellen für künftige Ausgaben. Bestehende Käufer erhalten ihn im Rahmen ihrer Lizenz; frühere Stände bleiben gespeichert.') + ->modalSubmitActionLabel('Stand veröffentlichen') + ->fillForm(fn (): array => $this->isFirstStand() ? ['classification' => 'Erster Stand dieses Lizenzartikels.'] : []) ->schema([ - Select::make('root')->label('Wurzel')->options(fn (): array => CatalogOptions::readyTargets())->required(), - Textarea::make('classification')->label('Einordnung')->required() - ->helperText('Warum dies derselbe Lizenzartikel bleibt und kein neues Produkt ist.'), - TextInput::make('change_note')->label('Änderungshinweis'), + Select::make('root')->label('Freigegebener Inhalt') + ->options(fn (): array => CatalogOptions::assignmentTargets()) + ->searchable() + ->required() + ->helperText(fn (): string => CatalogOptions::assignmentTargets() === [] + ? 'Es gibt noch keinen freigegebenen Inhalt. Gib zuerst ein Medium, Modul oder Programm frei.' + : 'Medien, Module und Programme mit freigegebener Fassung. Bei Modulen und Programmen gehört alles Enthaltene zum Stand.'), + Textarea::make('classification')->label('Einordnung') + ->required(fn (): bool => ! $this->isFirstStand()) + ->helperText(fn (): string => $this->isFirstStand() + ? 'Beim ersten Stand genügt der vorgegebene Text.' + : 'Warum dies derselbe Lizenzartikel bleibt und kein neues Produkt ist.'), + TextInput::make('change_note')->label('Änderungshinweis') + ->visible(fn (): bool => ! $this->isFirstStand()), ]) ->action(function (array $data): void { $this->report(function () use ($data): string { @@ -340,7 +364,7 @@ public function releaseAction(): Action $release = app(ArticleService::class)->publishRelease( $article, $root, - $data['classification'], + (string) ($data['classification'] ?? 'Erster Stand dieses Lizenzartikels.'), $data['change_note'] ?? null, ); $report = $release->impact_report ?? []; @@ -375,6 +399,11 @@ public function withdrawAction(): Action }); } + private function isFirstStand(): bool + { + return ! $this->getRecord()->releases()->exists(); + } + private function refreshRecord(): void { $this->getRecord()->unsetRelations(); diff --git a/app/Filament/Resources/Offers/Pages/ListOffers.php b/app/Filament/Resources/Offers/Pages/ListOffers.php index 59bd3df..b4b58ab 100644 --- a/app/Filament/Resources/Offers/Pages/ListOffers.php +++ b/app/Filament/Resources/Offers/Pages/ListOffers.php @@ -64,6 +64,7 @@ protected function catalogRows(): array if ($active !== null) { $chips[] = ['label' => 'Fassung '.$active->number.' aktiv', 'ton' => 'gut']; $chips[] = ['label' => CatalogLabels::vergabe($active), 'ton' => 'neutral']; + $chips[] = ['label' => $active->holder_kind === 'organisation' ? 'Für Organisationen' : 'Für Privatpersonen', 'ton' => 'neutral']; $zustand[] = 'aktiv'; $text = $active->lines->map(fn ($line): string => ($line->article !== null ? 'Lizenzartikel '.$line->article->code diff --git a/app/Filament/Resources/Offers/Pages/ViewOffer.php b/app/Filament/Resources/Offers/Pages/ViewOffer.php index 4c39779..54a03ae 100644 --- a/app/Filament/Resources/Offers/Pages/ViewOffer.php +++ b/app/Filament/Resources/Offers/Pages/ViewOffer.php @@ -2,8 +2,11 @@ namespace App\Filament\Resources\Offers\Pages; +use App\Domain\Catalog\BundleService; use App\Domain\Catalog\BundleVersion; +use App\Domain\Catalog\Composition; use App\Domain\Catalog\CompositionVersion; +use App\Domain\Catalog\DomainRuleException; use App\Domain\Catalog\LicenseArticle; use App\Domain\Catalog\Offer; use App\Domain\Catalog\OfferService; @@ -11,9 +14,13 @@ use App\Domain\Catalog\OfferVersion; use App\Domain\Catalog\RightsProfileVersion; use App\Domain\Catalog\StatusValue; +use App\Domain\Cms\Catalog\PublicCatalogReader; +use App\Domain\Commerce\Money; +use App\Domain\Commerce\ProductOptions; use App\Filament\Resources\Offers\OfferResource; use App\Filament\Support\CatalogLabels; use App\Filament\Support\CatalogOptions; +use App\Filament\Support\PublicationReadiness; use App\Filament\Support\ReportsDomainRules; use Filament\Actions\Action; use Filament\Forms\Components\Repeater; @@ -25,6 +32,7 @@ use Filament\Schemas\Schema; use Filament\Support\Enums\Width; use Illuminate\Contracts\Support\Htmlable; +use Illuminate\Support\Facades\DB; /** * Angebot im gemeinsamen Rahmen. Anlegen und Ändern nutzen dieselbe Maske (FACH-20): „Fassung aktivieren“ legt die @@ -91,22 +99,34 @@ public function activateAction(): Action return Action::make('activate') ->label(fn (): string => $this->activeVersion() !== null ? 'Geänderte Fassung aktivieren' : 'Fassung aktivieren') ->modalHeading(fn (): string => $this->activeVersion() !== null - ? 'Angebot ändern: Fassung '.$this->nextNumber().' aktivieren' - : 'Erste Fassung aktivieren') + ? 'Option „'.$this->getRecord()->optionName().'“ ändern: Fassung '.$this->nextNumber().' aktivieren' + : 'Option „'.$this->getRecord()->optionName().'“: erste Fassung aktivieren') ->modalDescription(fn (): string => ($active = $this->activeVersion()) !== null - ? 'Die Maske ist mit Fassung '.$active->number.' vorbelegt; Inhaberart, Laufzeitregel und Steuerklasse werden übernommen. Beim Aktivieren wird Fassung '.$active->number.' beendet und bleibt unverändert gespeichert; neue Erwerbe nutzen Fassung '.$this->nextNumber().'. Bereits begründete Berechtigungen ändern sich dadurch nicht.' - : 'Positionen, Vergabe und Preis bilden die erste Fassung. Nach dem Aktivieren ist sie unveränderlich; Änderungen ergeben eine weitere Fassung.') + ? 'Betroffen ist nur die Option „'.$this->getRecord()->optionName().'“'.$this->productPageSuffix().'. Die Maske ist mit Fassung '.$active->number.' vorbelegt. Erst „Fassung '.$this->nextNumber().' aktivieren“ schaltet die Änderung öffentlich (auch Bezeichnung und Produktseite, sie erzeugen ebenfalls eine neue Fassung und zeigen offenen Warenkörben „Bedingungen aktualisiert“): Fassung '.$active->number.' wird beendet und bleibt gespeichert, neue Käufe nutzen Fassung '.$this->nextNumber().'. Bereits begründete Berechtigungen und Bestellungen ändern sich nicht. Andere Optionen derselben Produktseite bleiben unverändert kaufbar. „Abbrechen“ verwirft die Eingaben.' + : 'Positionen, Vergabe, Eignung und Preis bilden die erste Fassung dieser Option. Erst das Aktivieren macht sie öffentlich; danach ist sie unveränderlich, Änderungen ergeben eine weitere Fassung.') ->modalSubmitActionLabel(fn (): string => 'Fassung '.$this->nextNumber().' aktivieren') ->modalWidth('4xl') ->fillForm(fn (): array => $this->formFromActive()) ->schema([ + TextInput::make('option_label')->label('Bezeichnung der Option') + ->helperText('So heißt die Option auf der Produktseite, zum Beispiel „Einzellizenz für Privatpersonen“. Sie ist keine bindende Bedingung, wird aber wie die übrigen Angaben erst mit „Fassung aktivieren“ übernommen.') + ->maxLength(120), + Select::make('composition_id')->label('Produktseite') + ->options(fn (): array => $this->productPages()) + ->searchable() + ->helperText('Optionen derselben Produktseite sind Alternativen; im Warenkorb liegt nur eine davon. Die Beschreibung der Seite wird zentral an der Komposition gepflegt. Die Zuordnung wird mit „Fassung aktivieren“ übernommen.'), + Select::make('holder_kind')->label('Geeignet für')->options([ + 'person' => 'Privatpersonen', + 'organisation' => 'Organisationen und Vereine', + ])->required() + ->helperText('Wähle die Eignung passend zu den Rechten: Organisationslizenzen brauchen institutionelle Rechte. Das System erzwingt diese Kopplung nicht.'), Select::make('grant_kind')->label('Vergabe')->options([ 'kauf' => 'Kauf', 'auf_abruf' => 'Auf Abruf', 'bei_registrierung' => 'Bei Registrierung', ])->required(), - TextInput::make('price_cents')->label('Preis in Cent')->numeric() - ->helperText('Nur bei einem Kauf. 500 bedeutet 5,00 €.'), + TextInput::make('price_euro')->label('Preis in Euro')->suffix('€') + ->helperText('Nur bei einem Kauf, zum Beispiel 49,00.'), Select::make('composition_version_id')->label('Programmfassung, die abgedeckt sein muss') ->options(function (): array { return CompositionVersion::query() @@ -124,9 +144,12 @@ public function activateAction(): Action 'article' => 'Lizenzartikel', 'bundle' => 'Paketfassung', ])->required()->live(), - Select::make('article_id')->label('Artikel')->options(fn (): array => CatalogOptions::articles()) + Select::make('article_id')->label('Artikel')->options(fn (): array => app(PublicationReadiness::class)->articleOptions()) + ->searchable() + ->helperText('Nur Artikel mit veröffentlichtem Stand lassen sich verkaufen. Artikel ohne Stand sind gekennzeichnet.') ->visible(fn (Get $get): bool => $get('kind') === 'article'), - Select::make('bundle_version_id')->label('Paketfassung')->options(fn (): array => CatalogOptions::bundleVersions()) + Select::make('bundle_version_id')->label('Paketfassung')->options(fn (): array => app(PublicationReadiness::class)->bundleVersionOptions()) + ->searchable() ->visible(fn (Get $get): bool => $get('kind') === 'bundle'), Select::make('rights_id')->label('Rechte')->options(fn (): array => CatalogOptions::rights())->required(), ])->minItems(1)->addActionLabel('Position hinzufügen'), @@ -147,29 +170,117 @@ public function activateAction(): Action ]; } - // Bedingungen, die die Maske nicht zeigt, bleiben bei einer Änderung die der aktiven Fassung; ohne - // aktive Fassung gilt wie bisher die Vorgabe (Personen, dauerhaft). + // Voraussetzung: Jeder Artikel der Positionen hat einen veröffentlichten Stand, sonst erhielten Käufer nichts. + $articleIds = []; + + foreach ($lines as $line) { + $target = $line['target']; + array_push($articleIds, ...($target instanceof BundleVersion ? app(BundleService::class)->articleIds($target) : [$target->id])); + } + + $unusable = app(PublicationReadiness::class)->unusableArticles($articleIds); + + if ($unusable !== []) { + throw new DomainRuleException(app(PublicationReadiness::class)->unusableMessage($unusable, 'das Angebot aktivierst')); + } + + // Bedingungen, die die Maske nicht zeigt, bleiben bei einer Änderung die der aktiven Fassung. $active = $this->activeVersion(); - $kept = $active === null ? ['holder_kind' => 'person'] : [ - 'holder_kind' => $active->holder_kind, + $kept = $active === null ? [] : [ 'term_rule' => $active->term_rule, 'tax_class' => $active->tax_class, 'dynamic' => (bool) $active->dynamic, ]; - $version = app(OfferService::class)->activate($offer, $lines, [ - ...$kept, - 'grant_kind' => $data['grant_kind'], - 'price_cents' => $data['price_cents'] === null || $data['price_cents'] === '' ? null : (int) $data['price_cents'], - 'composition_version_id' => filled($data['composition_version_id'] ?? null) ? (int) $data['composition_version_id'] : null, - ]); + $price = Money::parse($data['price_euro'] ?? null); - return 'Fassung '.$version->number.' ist aktiv.'; + if ($data['grant_kind'] === 'kauf' && ($price === null || $price <= 0)) { + throw new DomainRuleException('Ein Kauf braucht einen Preis über 0,00 €.'); + } + + $service = app(OfferService::class); + $version = DB::transaction(function () use ($service, $offer, $data, $lines, $kept, $price) { + $service->assignProduct( + $offer, + filled($data['composition_id'] ?? null) ? (int) $data['composition_id'] : null, + $data['option_label'] ?? null, + ); + + return $service->activate($offer, $lines, [ + ...$kept, + 'holder_kind' => $data['holder_kind'], + 'grant_kind' => $data['grant_kind'], + 'price_cents' => $price, + 'composition_version_id' => filled($data['composition_version_id'] ?? null) ? (int) $data['composition_version_id'] : null, + ]); + }); + + $offer->unsetRelations(); + $readiness = app(PublicationReadiness::class)->forOffer($offer->refresh()); + + return 'Fassung '.$version->number.' ist aktiv.'.($readiness['bereit'] + ? ' Die Option ist öffentlich kaufbar und im Shop auffindbar.' + : ' Noch nicht im Shop kaufbar. Nächster Schritt: '.$readiness['naechster']['titel'].'.'); }, 'Die Angebotsfassung ist aktiv.'); $this->getRecord()->unsetRelations(); $this->getRecord()->refresh(); }); } + /** + * Option aus dem Verkauf nehmen: nur die aktive Fassung dieser Option wird beendet. + */ + public function endAction(): Action + { + return Action::make('end') + ->label('Aus dem Verkauf nehmen') + ->color('danger') + ->requiresConfirmation() + ->modalHeading(fn (): string => 'Option „'.$this->getRecord()->optionName().'“ aus dem Verkauf nehmen?') + ->modalDescription(fn (): string => 'Betroffen ist nur die Option „'.$this->getRecord()->optionName().'“'.$this->productPageSuffix().'. Die aktive Fassung wird beendet und bleibt gespeichert. Die Option ist danach nicht mehr kaufbar; in vorhandenen Warenkörben bleibt sie mit Hinweis sichtbar und blockiert den Abschluss, bis der Käufer sie entfernt. Bestehende Berechtigungen und Bestellungen ändern sich nicht. Andere Optionen derselben Produktseite bleiben kaufbar.') + ->modalSubmitActionLabel('Aus dem Verkauf nehmen') + ->visible(fn (): bool => $this->activeVersion() !== null) + ->action(function (): void { + $this->report(function (): string { + $version = app(OfferService::class)->end($this->getRecord()); + + return 'Fassung '.$version->number.' ist beendet. Die Option ist nicht mehr kaufbar.'; + }, 'Die Option ist aus dem Verkauf genommen.'); + $this->getRecord()->unsetRelations(); + $this->getRecord()->refresh(); + }); + } + + /** „ der Produktseite „Titel““ oder leer, wenn die Option noch keiner Produktseite zugeordnet ist. */ + private function productPageSuffix(): string + { + $page = $this->getRecord()->composition; + + return $page === null ? '' : ' der Produktseite „'.($page->display_title ?: $page->designation).'“'; + } + + /** + * Produktseiten, die als Ziel wählbar sind: Kompositionen mit Bezeichnung und Art. + * + * @return array + */ + private function productPages(): array + { + $catalog = app(PublicCatalogReader::class); + + return Composition::query() + ->with('editorialContentKind') + ->whereNull('archived_at') + ->orderBy('designation') + ->get() + ->sortBy(fn (Composition $composition): int => $catalog->shownVersion($composition) !== null ? 0 : 1) + ->mapWithKeys(fn (Composition $composition): array => [ + $composition->id => ($composition->display_title ?: $composition->designation) + .' ('.($composition->editorialContentKind?->label ?? 'Zusammenstellung').')' + .($catalog->shownVersion($composition) !== null ? ' · im Shop auffindbar' : ' · nicht öffentlich, im Shop nicht auffindbar'), + ]) + ->all(); + } + /** * Vorbelegung aus der aktiven Fassung; ohne aktive Fassung eine leere Position. * @@ -178,14 +289,19 @@ public function activateAction(): Action private function formFromActive(): array { $active = $this->activeVersion(); + /** @var Offer $offer */ + $offer = $this->getRecord(); + $option = ['option_label' => $offer->option_label, 'composition_id' => $offer->composition_id]; if ($active === null) { - return ['grant_kind' => 'kauf', 'lines' => [['kind' => 'article']]]; + return [...$option, 'holder_kind' => 'person', 'grant_kind' => 'kauf', 'lines' => [['kind' => 'article']]]; } return [ + ...$option, + 'holder_kind' => $active->holder_kind, 'grant_kind' => $active->grant_kind, - 'price_cents' => $active->price_cents, + 'price_euro' => $active->price_cents === null ? null : number_format($active->price_cents / 100, 2, ',', ''), 'lines' => $active->lines->sortBy('position')->map(fn ($line): array => [ 'kind' => $line->license_article_id !== null ? 'article' : 'bundle', 'article_id' => $line->license_article_id, @@ -220,13 +336,22 @@ private function angebotDaten(): array 'status' => $active !== null ? ['text' => 'Fassung '.$active->number.' aktiv · '.$vergabe, 'ton' => 'gut'] : ['text' => 'Noch keine aktive Fassung. Ein Angebot ohne aktive Fassung kann niemand erwerben.', 'ton' => 'offen'], - 'aktionen' => [[ - 'label' => $active !== null ? 'Geänderte Fassung aktivieren' : 'Fassung aktivieren', - 'wire' => "mountAction('activate')", - 'art' => 'primary', - ]], + 'aktionen' => [ + [ + 'label' => $active !== null ? 'Geänderte Fassung aktivieren' : 'Fassung aktivieren', + 'wire' => "mountAction('activate')", + 'art' => 'primary', + ], + ...($active !== null ? [[ + 'label' => 'Aus dem Verkauf nehmen', + 'wire' => "mountAction('end')", + 'art' => 'line', + ]] : []), + ], ], + 'voraussetzungen' => app(PublicationReadiness::class)->forOffer($offer), 'haupt' => [ + ...($active !== null ? [$this->optionAbschnitt($offer, $active)] : []), [ 'titel' => 'Positionen', 'zusatz' => $active !== null ? 'Fassung '.$active->number : null, @@ -261,6 +386,37 @@ private function angebotDaten(): array ]; } + /** + * Die Option auf einen Blick: Preis in Euro, Eignung, Rechte, zugrunde liegender Inhalt, Status und Produktseite. + * + * @return array + */ + private function optionAbschnitt(Offer $offer, OfferVersion $active): array + { + $option = app(ProductOptions::class)->describe($offer, $active); + $inhalt = collect($option['scope'])->pluck('article')->unique()->implode(', '); + $rechte = collect($option['scope']) + ->map(fn (array $item): string => $item['purpose'].($item['rights'] === [] ? '' : ': '.implode(', ', $item['rights']))) + ->unique() + ->implode('; '); + $seite = $offer->composition; + $kaufbar = app(OfferService::class)->purchasableVersion($offer) !== null; + + return [ + 'titel' => 'Die Option auf einen Blick', + 'zusatz' => 'Fassung '.$active->number, + 'hilfe' => 'So erscheint die Option auf der öffentlichen Produktseite und im Warenkorb. Die Angaben dieser Fassung sind unveränderlich.', + 'zeilen' => [ + ['text' => 'Preis: '.$option['price'], 'neben' => $active->grant_kind === 'kauf' ? 'Kauf mit Testzahlung' : CatalogLabels::vergabe($active)], + ['text' => 'Geeignet für: '.$option['for'], 'neben' => $option['term']], + ['text' => 'Rechte: '.($rechte !== '' ? $rechte : 'keine'), 'neben' => null], + ['text' => 'Zugrunde liegender Inhalt: '.($inhalt !== '' ? $inhalt : '–'), 'neben' => null], + ['text' => 'Status: '.($kaufbar ? 'Öffentlich kaufbar' : 'Nicht als Kauf angeboten'), 'neben' => $kaufbar ? 'Aktive Fassung '.$active->number : null], + ['text' => 'Produktseite: '.($seite !== null ? ($seite->display_title ?: $seite->designation) : 'noch nicht zugeordnet'), 'neben' => $seite !== null ? 'Option „'.$offer->optionName().'“' : 'Mit „Geänderte Fassung aktivieren“ zuordnen.'], + ], + ]; + } + /** * Aufgelöster Leistungsumfang in lesbaren Fähigkeiten (dieselben Bezeichnungen wie beim Rechteprofil). * diff --git a/app/Filament/Resources/Pillars/Pages/ListPillars.php b/app/Filament/Resources/Pillars/Pages/ListPillars.php index 80122d7..3142257 100644 --- a/app/Filament/Resources/Pillars/Pages/ListPillars.php +++ b/app/Filament/Resources/Pillars/Pages/ListPillars.php @@ -22,7 +22,7 @@ class ListPillars extends ListRecords public function getSubheading(): string|Htmlable|null { - return 'Die fachlichen Säulen des Materials. Eine veröffentlichte Säule ist ein Themenbereich der Website. Ein Medium und eine Seite können mehreren Säulen zugeordnet sein.'; + return 'Die fachlichen Säulen des Materials. Eine veröffentlichte Säule ist ein Themenbereich der Website. Medien, Module, Programme, Lizenzartikel und Seiten können mehreren Säulen zugeordnet sein. Hier ist die einzige Pflegestelle der Säulen.'; } protected function getHeaderActions(): array @@ -50,11 +50,28 @@ protected function getHeaderActions(): array ]; } + /** + * Zuordnungen aller Objektarten; ohne Zuordnung wie bisher „0 Medien“. + */ + private function usageLabel(PillarService $service, Pillar $pillar): string + { + $usage = [ + 'medien' => (int) $pillar->elements_count, + 'zusammenstellungen' => (int) $pillar->compositions_count, + 'lizenzartikel' => (int) $pillar->license_articles_count, + 'seiten' => (int) $pillar->pages_count, + ]; + + return array_sum($usage) === 0 ? '0 Medien' : $service->usageText($usage); + } + protected function catalogRows(): array { $rows = []; - foreach (Pillar::query()->withCount('elements')->orderBy('sort_order')->orderBy('name')->get() as $pillar) { + $service = app(PillarService::class); + + foreach (Pillar::query()->withCount(['elements', 'compositions', 'licenseArticles', 'pages'])->orderBy('sort_order')->orderBy('name')->get() as $pillar) { $public = $pillar->published_at !== null; $url = PillarResource::getUrl('edit', ['record' => $pillar]); $rows[] = [ @@ -66,7 +83,7 @@ protected function catalogRows(): array 'url' => $url, 'chips' => [ $public ? ['label' => 'Auf der Website veröffentlicht', 'ton' => 'gut'] : ['label' => 'Intern', 'ton' => 'leise'], - ['label' => $pillar->elements_count === 1 ? '1 Medium' : $pillar->elements_count.' Medien', 'ton' => 'neutral'], + ['label' => $this->usageLabel($service, $pillar), 'ton' => 'neutral'], ], 'zustand' => [$public ? 'oeffentlich' : 'intern'], 'aktionen' => [['label' => 'Bearbeiten', 'href' => $url, 'icon' => 'stift']], diff --git a/app/Filament/Support/AssignsPillars.php b/app/Filament/Support/AssignsPillars.php new file mode 100644 index 0000000..aca17f0 --- /dev/null +++ b/app/Filament/Support/AssignsPillars.php @@ -0,0 +1,53 @@ + */ + public array $pillarIds = []; + + /** + * @return array{legend: string, model: string, values: list}|null + */ + public function pillarGroup(): ?array + { + $values = Pillar::query()->orderBy('sort_order')->orderBy('name')->get(['id', 'name']) + ->map(fn (Pillar $pillar): array => ['id' => (int) $pillar->id, 'label' => (string) $pillar->name]) + ->all(); + + return $values === [] ? null : ['legend' => 'Fachliche Säulen', 'model' => 'pillarIds', 'values' => $values]; + } + + protected function loadPillarIds(Composition|LicenseArticle $subject): void + { + $this->pillarIds = $subject->pillars()->pluck('pillars.id')->map(fn (mixed $id): string => (string) (int) $id)->all(); + } + + protected function persistPillarIds(Composition|LicenseArticle $subject): void + { + app(PillarService::class)->assign($subject, array_map(intval(...), $this->pillarIds)); + } + + protected function pillarsUnsaved(Composition|LicenseArticle $subject): bool + { + $stored = $subject->pillars()->pluck('pillars.id')->map(fn (mixed $id): int => (int) $id)->all(); + $current = array_map(intval(...), $this->pillarIds); + sort($stored); + sort($current); + + return $stored !== $current; + } +} diff --git a/app/Filament/Support/ChoosesMedia.php b/app/Filament/Support/ChoosesMedia.php index c8c0820..47bd4d2 100644 --- a/app/Filament/Support/ChoosesMedia.php +++ b/app/Filament/Support/ChoosesMedia.php @@ -5,6 +5,7 @@ use App\Domain\Catalog\ContentElement; use App\Domain\Catalog\ContentElementVersion; use App\Domain\Catalog\EditorialVocabulary; +use App\Domain\Catalog\Pillar; use App\Domain\Cms\Catalog\PublicMaterialReader; use App\Domain\Cms\Widgets\Support\WebsiteImage; use App\Http\Controllers\ContentPreviewController; @@ -27,6 +28,9 @@ trait ChoosesMedia public string $pickerDimension = ''; + /** Filter „Fachliche Säule“ (Kennung der Säule aus der zentralen Säulenverwaltung). */ + public string $pickerSaeule = ''; + /** Filter „Fachliche Materialart“ (Kennung), gleiche Regel wie Medieneditor und Medienfilter. */ public string $pickerMaterialart = ''; @@ -108,6 +112,8 @@ public function pickerResult(): array $this->pickerKind, $this->pickerDimension, $this->pickerExceptId(), + false, + ctype_digit($this->pickerSaeule) ? (int) $this->pickerSaeule : 0, )); } @@ -204,6 +210,7 @@ protected function resetPicker(string $purpose): void $this->pickerOpen = true; $this->pickerQuery = ''; $this->pickerDimension = ''; + $this->pickerSaeule = ''; $this->pickerMaterialart = ''; $this->pickerInspected = ''; $this->pickerSelected = ''; @@ -239,6 +246,17 @@ private function filterByMaterialart(array $result): array return $result; } + /** + * Säulen für den Picker-Filter, in der Reihenfolge der Säulenverwaltung. + * + * @return array + */ + public function pickerSaeulen(): array + { + return Pillar::query()->orderBy('sort_order')->orderBy('name')->pluck('name', 'id') + ->mapWithKeys(fn (string $name, int|string $id): array => [(string) $id => $name])->all(); + } + /** * Einordnungsfilter des Pickers: dieselbe Filterregel wie Medien- und Kompositionslisten (verwendete inaktive Werte * bleiben auffindbar, ein gewählter Filter bleibt sichtbar). diff --git a/app/Filament/Support/ChoosesWebsiteImages.php b/app/Filament/Support/ChoosesWebsiteImages.php index 790f088..b4c9742 100644 --- a/app/Filament/Support/ChoosesWebsiteImages.php +++ b/app/Filament/Support/ChoosesWebsiteImages.php @@ -2,8 +2,14 @@ namespace App\Filament\Support; +use App\Domain\Catalog\Composition; use App\Domain\Catalog\ContentElement; +use App\Domain\Catalog\DomainRuleException; use App\Domain\Cms\Widgets\Support\WebsiteImage; +use App\Domain\Media\CompositionStill; +use App\Domain\Media\FilmStill; +use App\Domain\Media\WebsiteMedia; +use App\Filament\Resources\ContentElements\ContentElementResource; use Filament\Notifications\Notification; /** @@ -31,6 +37,128 @@ public function openWebsiteImagePicker(string $pfad): void $this->forceRenderForPicker(); } + /** + * Medien- und Materialkarte: das Vorschaubild des Films als Bild für die Website übernehmen. Es entsteht ein Bild + * im Medienmanager (einmal gespeichert), das im Bildfeld ausgewählt wird. Die Datei des Films bleibt geschützt. + */ + public function adoptFilmThumbnail(string $pfad, int $elementId): void + { + $this->adoptFilmStill($pfad, $elementId, fn (FilmStill $stills, ContentElement $film): ContentElement => $stills->fromThumbnail($film, auth('staff')->user())); + } + + /** + * Medien- und Materialkarte: eine Stelle des Films wählen und als Bild für die Website übernehmen. + */ + public function adoptFilmFrame(string $pfad, int $elementId, string $sekunde): void + { + if (! is_numeric($sekunde)) { + Notification::make()->danger()->title('Bitte eine Zeitposition in Sekunden angeben.')->send(); + + return; + } + + $this->adoptFilmStill($pfad, $elementId, fn (FilmStill $stills, ContentElement $film): ContentElement => $stills->fromSecond($film, (float) $sekunde, auth('staff')->user())); + } + + /** + * Programm- und Modulkarte: das Vorschaubild des Programms oder Moduls als Bild für die Website übernehmen + * (Bild-Medium im Medienmanager, einmal kopiert). + */ + public function adoptCompositionThumbnail(string $pfad, int $compositionId): void + { + abort_unless(ContentElementResource::editor(), 403); + + if ($this->imageTargetIsInvalid($pfad)) { + return; + } + + $composition = Composition::query()->find($compositionId); + + if (! $composition instanceof Composition) { + return; + } + + $stills = app(CompositionStill::class); + + try { + $still = $stills->fromThumbnail($composition, auth('staff')->user()); + } catch (DomainRuleException $exception) { + Notification::make()->danger()->title($exception->getMessage())->send(); + + return; + } + + data_set($this, $pfad, $still->id); + $this->announceAdoptedStill($still, $stills->reused, 'Dieses Vorschaubild war schon übernommen.'); + } + + /** + * @param callable(FilmStill, ContentElement): ContentElement $make + */ + private function adoptFilmStill(string $pfad, int $elementId, callable $make): void + { + abort_unless(ContentElementResource::editor(), 403); + + if ($this->imageTargetIsInvalid($pfad)) { + return; + } + + $film = ContentElement::query()->with('editorialContentKind')->find($elementId); + + if (! $film instanceof ContentElement) { + return; + } + + $stills = app(FilmStill::class); + + try { + $still = $make($stills, $film); + } catch (DomainRuleException $exception) { + Notification::make()->danger()->title($exception->getMessage())->send(); + + return; + } + + data_set($this, $pfad, $still->id); + $this->announceAdoptedStill($still, $stills->reused, 'Diese Stelle war schon übernommen.'); + } + + /** Nur das Bildfeld eines Widgets oder Abschnitts ist ein zulässiges Ziel (…image). */ + private function imageTargetIsInvalid(string $pfad): bool + { + return preg_match('/^(data|mountedActions\.\d+\.data)(\.[A-Za-z0-9_-]+)+\.image$/', $pfad) !== 1; + } + + /** + * Meldung nach dem tatsächlichen Stand des Bildes: neu angelegt, schon vorhanden und freigegeben, wird verarbeitet + * oder Website-Freigabe zurückgenommen (bleibt zurückgenommen). + */ + private function announceAdoptedStill(ContentElement $still, bool $reused, string $reusedText): void + { + $title = ($still->display_title ?: $still->working_title); + + if (! $reused) { + Notification::make() + ->success() + ->title('Im Medienmanager angelegt: „'.$title.'“') + ->body('Das Bild ist als Kartenbild ausgewählt. Nach der Verarbeitung wird es für die Website freigegeben; dort lässt sich die Freigabe auch zurücknehmen.') + ->send(); + + return; + } + + if (app(WebsiteMedia::class)->present($still) !== null) { + Notification::make()->success()->title('Bereits im Medienmanager: „'.$title.'“')->body($reusedText.' Das Bild ist als Kartenbild ausgewählt.')->send(); + } elseif (blank($still->thumbnail_path) && blank($still->thumbnail_error)) { + Notification::make()->success()->title('Bereits im Medienmanager: „'.$title.'“')->body('Das Bild wird noch verarbeitet und danach für die Website freigegeben.')->send(); + } else { + Notification::make()->warning()->title('Bild ausgewählt, aber nicht für die Website freigegeben: „'.$title.'“') + ->body($reusedText.' Die Website-Freigabe wurde zurückgenommen. Das Bild erscheint öffentlich erst wieder, wenn sie im Medienmanager (Reiter „Website“) erneut gegeben wird.') + ->persistent() + ->send(); + } + } + /** * Filament rendert bei offenen Aktionsdialogen nur den Dialogteil neu; der Picker liegt darüber und braucht die * ganze Seite. diff --git a/app/Filament/Support/EditorialCatalog.php b/app/Filament/Support/EditorialCatalog.php index a01872a..36ef686 100644 --- a/app/Filament/Support/EditorialCatalog.php +++ b/app/Filament/Support/EditorialCatalog.php @@ -272,7 +272,7 @@ public function search(string $query, string $scope, int $exceptCompositionId): /** * @return array{items: list>, more: bool} */ - public function browse(string $query, string $kind, string $dimension, int $exceptCompositionId, bool $elementsOnly = false): array + public function browse(string $query, string $kind, string $dimension, int $exceptCompositionId, bool $elementsOnly = false, int $pillarId = 0): array { $query = trim($query); $like = '%'.str_replace(['%', '_'], ['', ''], $query).'%'; @@ -284,8 +284,8 @@ public function browse(string $query, string $kind, string $dimension, int $exce $latestElements = ContentElementVersion::query() ->selectRaw('MAX(id)') ->whereIn('status', [ContentVersionStatus::Bereit, ContentVersionStatus::Entwurf]) - ->whereHas('element', function ($builder) use ($query, $like, $kind, $dimensionId): void { - $this->constrainElement($builder, $query, $like, $kind, $dimensionId); + ->whereHas('element', function ($builder) use ($query, $like, $kind, $dimensionId, $pillarId): void { + $this->constrainElement($builder, $query, $like, $kind, $dimensionId, $pillarId); }) ->groupBy('content_element_id'); $elements = ContentElementVersion::query() @@ -309,7 +309,7 @@ public function browse(string $query, string $kind, string $dimension, int $exce ->selectRaw('MAX(id)') ->where('status', ContentVersionStatus::Bereit) ->where('composition_id', '!=', $exceptCompositionId) - ->whereHas('composition', function ($builder) use ($query, $like, $kind, $dimensionId): void { + ->whereHas('composition', function ($builder) use ($query, $like, $kind, $dimensionId, $pillarId): void { if ($kind === 'modul') { $builder->where('kind', CompositionKind::Uebung); } @@ -318,6 +318,10 @@ public function browse(string $query, string $kind, string $dimension, int $exce $builder->whereIn('id', $this->dimensionSubjectIds(Composition::class, $dimensionId)); } + if ($pillarId > 0) { + $builder->whereIn('id', $this->pillarSubjectIds(Composition::class, $pillarId)); + } + if ($query === '') { return; } @@ -370,6 +374,10 @@ public function browse(string $query, string $kind, string $dimension, int $exce continue; } + if ($pillarId > 0 && ! in_array($composition->id, $this->pillarSubjectIds(Composition::class, $pillarId), true)) { + continue; + } + $title = $this->compositionTitle($composition); if ($query !== '' && ! str_contains(mb_strtolower($title.' '.(string) ($composition->summary ?? '')), mb_strtolower($query))) { @@ -564,7 +572,7 @@ private function withVisibility(array $rows): array /** * @param Builder $builder */ - private function constrainElement($builder, string $query, string $like, string $kind, int $dimensionId): void + private function constrainElement($builder, string $query, string $like, string $kind, int $dimensionId, int $pillarId = 0): void { $outputs = match ($kind) { 'film' => ['film'], @@ -583,6 +591,10 @@ private function constrainElement($builder, string $query, string $like, string $builder->whereIn('id', $this->dimensionSubjectIds(ContentElement::class, $dimensionId)); } + if ($pillarId > 0) { + $builder->whereIn('id', $this->pillarSubjectIds(ContentElement::class, $pillarId)); + } + if ($query === '') { return; } @@ -597,6 +609,22 @@ private function constrainElement($builder, string $query, string $like, string }); } + /** + * Direkt einer Säule zugeordnete Medien oder Module und Programme (zentrale Säulenverwaltung). + * + * @param class-string $class + * @return list + */ + private function pillarSubjectIds(string $class, int $pillarId): array + { + [$table, $column] = $class === Composition::class + ? ['composition_pillar', 'composition_id'] + : ['content_element_pillar', 'content_element_id']; + + return DB::table($table)->where('pillar_id', $pillarId)->pluck($column) + ->map(fn (mixed $id): int => (int) $id)->all(); + } + /** * @param class-string $class * @return list diff --git a/app/Filament/Support/ListsCompositions.php b/app/Filament/Support/ListsCompositions.php index bf4345c..54fb114 100644 --- a/app/Filament/Support/ListsCompositions.php +++ b/app/Filament/Support/ListsCompositions.php @@ -7,9 +7,12 @@ use App\Domain\Catalog\ContentVersionStatus; use App\Domain\Catalog\EditorialVocabulary; use App\Domain\Catalog\IdentityDimensionValue; +use App\Domain\Catalog\Pillar; +use App\Domain\Catalog\PillarFilterCompat; use App\Filament\Resources\ContentElements\ContentElementResource; use Filament\Actions\Action; use Filament\Forms\Components\TextInput; +use Illuminate\Support\Facades\DB; use Livewire\Attributes\Url; /** @@ -29,6 +32,10 @@ trait ListsCompositions #[Url] public string $pillar = ''; + /** Fachliche Säule (zentrale Säulenverwaltung), direkt zugeordnet. */ + #[Url(as: 'saeule', except: '')] + public string $saeule = ''; + #[Url] public string $visibility = 'alle'; @@ -39,7 +46,7 @@ protected function fixedKind(): ?CompositionKind protected function bestandFilterEigenschaften(): array { - return ['query', 'kindFilter', 'pillar', 'visibility']; + return ['query', 'kindFilter', 'pillar', 'saeule', 'visibility']; } public function resetFilters(): void @@ -47,13 +54,14 @@ public function resetFilters(): void $this->query = ''; $this->kindFilter = 'alle'; $this->pillar = ''; + $this->saeule = ''; $this->visibility = 'alle'; $this->bestandGrenze = Bestand::SCHRITT; } public function hasActiveFilters(): bool { - return trim($this->query) !== '' || $this->kindFilter !== 'alle' || $this->pillar !== '' || $this->visibility !== 'alle'; + return trim($this->query) !== '' || $this->kindFilter !== 'alle' || $this->pillar !== '' || $this->saeule !== '' || $this->visibility !== 'alle'; } /** @@ -61,6 +69,7 @@ public function hasActiveFilters(): bool */ public function bestand(): array { + $this->normalizeLegacyPillarFilter(); $fixed = $this->fixedKind(); $einheit = match ($fixed) { CompositionKind::Kurs => ['Programm', 'Programme'], @@ -90,9 +99,14 @@ public function bestand(): array 'eigenschaft' => 'visibility', 'label' => 'Stand', 'vorgabe' => 'alle', 'optionen' => ['alle' => 'Jeder Stand', 'bibliothek' => 'In der Mitgliederbibliothek', 'verborgen' => 'Nicht in der Mitgliederbibliothek', 'entwurf' => 'Noch ohne Fassung'], ]], - 'weitere' => $gruppen === [] ? [] : [[ - 'eigenschaft' => 'pillar', 'label' => 'Fachliche Einordnung', 'vorgabe' => '', 'alle' => 'Alle Einordnungen', 'gruppen' => $gruppen, - ]], + 'weitere' => [ + ...($this->pillarOptions() === [] ? [] : [[ + 'eigenschaft' => 'saeule', 'label' => 'Fachliche Säule', 'vorgabe' => '', 'alle' => 'Alle Säulen', 'optionen' => $this->pillarOptions(), + ]]), + ...($gruppen === [] ? [] : [[ + 'eigenschaft' => 'pillar', 'label' => 'Fachliche Einordnung', 'vorgabe' => '', 'alle' => 'Alle Einordnungen', 'gruppen' => $gruppen, + ]]), + ], 'zeilen' => $this->entries(), 'einheit' => $einheit, 'leer' => [ @@ -124,7 +138,9 @@ public function entries(): array $needle = mb_strtolower(trim($this->query)); $catalog = app(EditorialCatalog::class); $offered = $catalog->offeredCompositionIds(); + $this->normalizeLegacyPillarFilter(); $pillarIds = $this->pillar === '' ? null : $this->pillarSubjects((int) $this->pillar); + $saeuleIds = ctype_digit($this->saeule) && $this->saeule !== '' ? $this->saeuleSubjects((int) $this->saeule) : null; $fixed = $this->fixedKind(); $kinds = $fixed !== null ? [$fixed] : match ($this->kindFilter) { 'programm' => [CompositionKind::Kurs], @@ -149,6 +165,10 @@ public function entries(): array continue; } + if ($saeuleIds !== null && ! in_array($composition->id, $saeuleIds, true)) { + continue; + } + $stand = $catalog->stand($composition); if (! $this->matchesVisibility($stand)) { @@ -249,6 +269,36 @@ private function coverMembers(Composition $composition): array return $members; } + /** + * Alte Adressen mit einem Säulenwert der Einordnung (`?pillar=…`) gelten für die zentrale Säule. + */ + private function normalizeLegacyPillarFilter(): void + { + if (ctype_digit($this->pillar) && $this->pillar !== '' && $this->saeule === '' && is_int($pillar = PillarFilterCompat::pillarOfLegacyValue((int) $this->pillar))) { + [$this->saeule, $this->pillar] = [(string) $pillar, '']; + } + } + + /** + * @return array + */ + private function pillarOptions(): array + { + return Pillar::query()->orderBy('sort_order')->orderBy('name')->pluck('name', 'id') + ->mapWithKeys(fn (string $name, int|string $id): array => [(string) $id => $name])->all(); + } + + /** + * Direkt zugeordnete Module und Programme einer Säule. Die Säulen der enthaltenen Medien zählen hier nicht. + * + * @return list + */ + private function saeuleSubjects(int $pillarId): array + { + return DB::table('composition_pillar')->where('pillar_id', $pillarId)->pluck('composition_id') + ->map(fn (mixed $id): int => (int) $id)->all(); + } + /** * @return list */ diff --git a/app/Filament/Support/MediaLibrary.php b/app/Filament/Support/MediaLibrary.php index 044645b..73b3240 100644 --- a/app/Filament/Support/MediaLibrary.php +++ b/app/Filament/Support/MediaLibrary.php @@ -11,6 +11,7 @@ use App\Domain\Catalog\EditorialVocabulary; use App\Domain\Catalog\IdentityDimensionValue; use App\Domain\Catalog\Pillar; +use App\Domain\Catalog\PillarFilterCompat; use App\Domain\Catalog\ReleaseContent; use App\Domain\Media\ThumbnailRef; use App\Filament\Resources\ContentElements\ContentElementResource; @@ -132,15 +133,23 @@ public function cards(array $filters, bool $canEdit): array */ private function normalize(array $filters): array { + $saeule = ctype_digit($filters['saeule'] ?? '') ? $filters['saeule'] : ''; + $einordnung = ctype_digit($filters['einordnung'] ?? '') ? $filters['einordnung'] : ''; + + if ($einordnung !== '' && $saeule === '' && is_int($pillar = PillarFilterCompat::pillarOfLegacyValue((int) $einordnung))) { + [$saeule, $einordnung] = [(string) $pillar, '']; + } + return [ 'suche' => trim($filters['suche'] ?? ''), 'art' => $this->choice($filters['art'] ?? '', ['film', 'text', 'document', 'bild', 'audio']), 'freigabe' => $this->choice($filters['freigabe'] ?? '', ['freigegeben', 'entwurf', 'ohne']), + 'schutz' => $this->choice($filters['schutz'] ?? '', ['geschuetzt', 'oeffentlich', 'website']), 'entwurf' => $this->choice($filters['entwurf'] ?? '', ['offen', 'keiner']), 'fassung' => $this->choice($filters['fassung'] ?? '', ['mit', 'nur']), 'nutzung' => $this->choice($filters['nutzung'] ?? '', ['verwendet', 'unbenutzt']), - 'saeule' => ctype_digit($filters['saeule'] ?? '') ? $filters['saeule'] : '', - 'einordnung' => ctype_digit($filters['einordnung'] ?? '') ? $filters['einordnung'] : '', + 'saeule' => $saeule, + 'einordnung' => $einordnung, 'inhaltsart' => ctype_digit($filters['inhaltsart'] ?? '') ? $filters['inhaltsart'] : '', 'verarbeitung' => $this->choice($filters['verarbeitung'] ?? '', ['fehler', 'uebernahme']), 'archiv' => $this->choice($filters['archiv'] ?? '', ['aktiv', 'archiviert', 'alle'], 'aktiv'), @@ -375,6 +384,20 @@ private function matches(ContentElement $element, array $portrait, array $uses, return false; } + $presentation = $this->isPresentationMedium($element, $portrait['versionCount']); + + if ($filters['schutz'] === 'geschuetzt' && $presentation) { + return false; + } + + if ($filters['schutz'] === 'oeffentlich' && ! $presentation) { + return false; + } + + if ($filters['schutz'] === 'website' && $element->website_released_at === null) { + return false; + } + if ($filters['freigabe'] === 'freigegeben' && $portrait['ready'] === null) { return false; } @@ -436,6 +459,15 @@ private function matches(ContentElement $element, array $portrait, array $uses, return true; } + /** + * Eigenständiges Präsentationsmedium: Bild, Film oder Hörstück ohne Inhaltsfassung. Es ist für die Website + * bestimmt und nicht lizenziert; alles mit einer Inhaltsfassung gilt als geschützt. + */ + private function isPresentationMedium(ContentElement $element, int $versionCount): bool + { + return $versionCount === 0 && in_array($element->output_class, ['bild', 'film', 'audio'], true); + } + private function matchesArt(ContentElement $element, string $art): bool { if ($art === '') { @@ -490,6 +522,8 @@ private function card(ContentElement $element, array $portrait, array $uses, arr 'image' => ThumbnailRef::url('editorial.card', 'element', $element->id, $element->thumbnail_path), 'imageAlt' => trim((string) ($element->thumbnail_alt ?: $element->working_title)), 'imageNote' => $this->imageNote($element), + 'presentation' => $this->isPresentationMedium($element, $portrait['versionCount']), + 'websiteReleased' => $element->website_released_at !== null, 'stand' => $portrait['stand'], 'standTone' => $portrait['standTone'], 'draftNote' => $portrait['draftNote'], diff --git a/app/Filament/Support/MediumForm.php b/app/Filament/Support/MediumForm.php index 1d9581d..6032be8 100644 --- a/app/Filament/Support/MediumForm.php +++ b/app/Filament/Support/MediumForm.php @@ -43,7 +43,7 @@ public static function fields(bool $creating, ?ContentElement $element = null): ->required(fn ($get): bool => filled($get('shape')) && $get('shape') !== 'text'); $fields[] = Checkbox::make('without_version') ->label('Eigenständiges Präsentationsmedium') - ->helperText('Bild, Film oder Hörstück ohne fachliche Inhaltsfassung. Die Datei bleibt eine technische Ableitung am Medium. Sie wird nicht lizenziert und nicht automatisch für die Website freigegeben.') + ->helperText('Bild, Film oder Hörstück ohne fachliche Inhaltsfassung, zum Beispiel ein Trailer, der ungeschützt auf der Website laufen soll. Der Film muss dafür MP4 (H.264) oder WebM sein. Er wird nicht lizenziert und erst nach „Für die Website freigeben“ öffentlich.') ->visible(fn ($get): bool => in_array($get('shape'), ['film', 'audio', 'bild'], true)); } elseif ($element?->output_class === 'text') { $fields[] = Textarea::make('body')->label('Text')->rows(8)->required(); @@ -94,20 +94,10 @@ public static function create(array $data, bool $hold): ContentElement { $service = app(ContentService::class); [$kind, $output] = self::shape($data['shape'] ?? null); - $element = $service->createElement($kind, $output, (string) $data['working_title']); - self::remember($element, $data); + $incoming = null; - if ($output === 'text') { - $body = trim((string) ($data['body'] ?? '')); - - if ($body === '') { - throw new DomainRuleException('Der Text braucht einen Inhalt.'); - } - - $hold - ? $service->draftElementVersion($element, $body) - : $service->publishElementVersion($element, $body); - } else { + if ($output !== 'text') { + // Alles prüfen, bevor etwas angelegt wird: Eine abgelehnte Datei darf kein leeres Medium hinterlassen. $incoming = IncomingFile::store($data['incoming'] ?? null); if ($incoming === null) { @@ -126,6 +116,25 @@ public static function create(array $data, bool $hold): ContentElement throw new DomainRuleException('Diese Datei passt nicht zur gewählten Art.'); } + if (! empty($data['without_version']) && in_array($output, ['bild', 'film', 'audio'], true)) { + app(PresentationFile::class)->validate($output, $incoming); + } + } + + $element = $service->createElement($kind, $output, (string) $data['working_title']); + self::remember($element, $data); + + if ($output === 'text') { + $body = trim((string) ($data['body'] ?? '')); + + if ($body === '') { + throw new DomainRuleException('Der Text braucht einen Inhalt.'); + } + + $hold + ? $service->draftElementVersion($element, $body) + : $service->publishElementVersion($element, $body); + } else { if (! empty($data['without_version']) && in_array($output, ['bild', 'film', 'audio'], true)) { app(PresentationFile::class)->store($element, $incoming); } else { diff --git a/app/Filament/Support/PublicationReadiness.php b/app/Filament/Support/PublicationReadiness.php new file mode 100644 index 0000000..94c5953 --- /dev/null +++ b/app/Filament/Support/PublicationReadiness.php @@ -0,0 +1,320 @@ + erledigt|offen|optional, 'aktion' => ['label', 'wire'|'href']|null] + * Ergebnis: ['schritte', 'bereit' (alle Pflichtschritte erledigt), 'naechster' (Text des ersten offenen Pflichtschritts)]. + */ +class PublicationReadiness +{ + public function __construct( + private readonly BundleService $bundles, + private readonly OfferService $offers, + private readonly PublicCatalogReader $catalog, + ) {} + + /** Ein Artikel ist verwendbar, wenn sein aktueller Stand veröffentlicht ist. */ + public function articleUsable(LicenseArticle $article): bool + { + $release = $article->currentRelease; + + return $release instanceof ArticleRelease && StatusValue::of($release->status) === ReleaseStatus::Veroeffentlicht->value; + } + + /** Anzeige in Auswahllisten: Name, Kennung und Stand statt der bloßen Kennung. */ + public function articleLabel(LicenseArticle $article): string + { + $title = $this->articleName($article); + $name = $title !== '' ? $title.' ('.$article->code.')' : (string) $article->code; + $release = $article->currentRelease; + + if ($this->articleUsable($article)) { + return $name.' · Stand '.$release->number; + } + + return $name.' · '.($release === null ? 'noch ohne Stand, nicht verwendbar' : 'Stand gesperrt, nicht verwendbar'); + } + + /** Name wie in der Redaktion: eigener Name oder Name des Inhalts, sonst der Arbeitstitel; leer ohne beides. */ + public function articleName(LicenseArticle $article): string + { + return app(ProductOptions::class)->articleName($article); + } + + /** + * @return array + */ + public function articleOptions(): array + { + $options = []; + + foreach (LicenseArticle::query()->with('currentRelease')->orderBy('code')->get() as $article) { + $options[$article->id] = $this->articleLabel($article); + } + + return $options; + } + + /** + * Veröffentlichte Paketfassungen mit ihren Artikeln, damit die Auswahl zeigt, was verkauft wird. + * + * @return array + */ + public function bundleVersionOptions(): array + { + $options = []; + + foreach (BundleVersion::query()->where('status', BundleStatus::Veroeffentlicht)->with('bundle')->orderBy('id')->get() as $version) { + try { + $codes = LicenseArticle::query()->whereIn('id', $this->bundles->articleIds($version))->orderBy('code')->pluck('code')->all(); + } catch (DomainRuleException) { + $codes = []; + } + + $options[$version->id] = $version->bundle->name.' · Fassung '.$version->number.' ('.($codes === [] ? 'ohne Artikel' : implode(', ', $codes)).')'; + } + + return $options; + } + + /** + * Artikel einer Auswahl, die keinen verwendbaren Stand haben. + * + * @param list $articleIds + * @return list + */ + public function unusableArticles(array $articleIds): array + { + return LicenseArticle::query()->with('currentRelease')->whereIn('id', array_unique($articleIds))->orderBy('code')->get() + ->reject(fn (LicenseArticle $article): bool => $this->articleUsable($article)) + ->values() + ->all(); + } + + /** + * @param list $articles + */ + public function unusableMessage(array $articles, string $zweck): string + { + $namen = implode(', ', array_map(fn (LicenseArticle $article): string => '„'.($this->articleName($article) ?: $article->code).'“ ('.$article->code.')', $articles)); + + return (count($articles) === 1 ? 'Der Lizenzartikel ' : 'Die Lizenzartikel ').$namen + .(count($articles) === 1 ? ' hat' : ' haben') + .' noch keinen veröffentlichten Stand und vergibt'.(count($articles) === 1 ? '' : ' keine').' keine Inhalte. ' + .'Lege zuerst am Artikel mit „Inhalt festlegen“ den Inhalt fest, bevor du '.$zweck.'.'; + } + + /** + * @return array + */ + public function forArticle(LicenseArticle $article): array + { + $article->loadMissing('currentRelease'); + $usable = $this->articleUsable($article); + $release = $article->currentRelease; + $inUse = $this->articleInUse($article); + + return $this->result([ + [ + 'titel' => 'Inhalt festlegen', + 'text' => $usable + ? 'Stand '.$release->number.' ist veröffentlicht und bestimmt, welche Inhalte der Artikel lizenziert.' + : 'Der Artikel lizenziert noch nichts. Wähle den freigegebenen Inhalt (Medium, Modul oder Programm), den er umfassen soll.', + 'stand' => $usable ? 'erledigt' : 'offen', + 'aktion' => $usable ? null : ['label' => 'Inhalt festlegen', 'wire' => "mountAction('release')"], + ], + [ + 'titel' => 'Name und Beschreibung', + 'text' => $this->articleName($article) !== '' + ? 'Der Name „'.$this->articleName($article).'“ erscheint in Paketen, Angeboten, im Shop und in der Bibliothek.' + : 'Ohne Name erscheint die Kennung „'.$article->code.'“. Name, Teaser und Beschreibung pflegst du in der Redaktion.', + 'stand' => $this->articleName($article) !== '' ? 'erledigt' : 'optional', + 'aktion' => $this->articleName($article) !== '' ? null : ['label' => 'Redaktion bearbeiten', 'wire' => "openRedaktion('texte')"], + ], + [ + 'titel' => 'In einem Paket oder Angebot verwenden', + 'text' => $inUse + ? 'Der Artikel ist in einem Paket oder Angebot enthalten.' + : 'Verkauft wird der Artikel erst über ein Angebot, allein oder in einem Paket.', + 'stand' => $inUse ? 'erledigt' : 'offen', + 'aktion' => $inUse ? null : ['label' => 'Angebote öffnen', 'href' => OfferResource::getUrl('index')], + 'pflicht' => false, + ], + ]); + } + + /** + * @return array + */ + public function forBundle(Bundle $bundle): array + { + $published = $bundle->versions()->where('status', BundleStatus::Veroeffentlicht)->orderByDesc('number')->first(); + $missing = []; + + if ($published instanceof BundleVersion) { + try { + $missing = $this->unusableArticles($this->bundles->articleIds($published)); + } catch (DomainRuleException) { + $missing = []; + } + } + + $offered = $published instanceof BundleVersion && $this->bundleOffered($bundle); + + return $this->result([ + [ + 'titel' => 'Bestandteile festlegen', + 'text' => $published instanceof BundleVersion + ? 'Fassung '.$published->number.' ist veröffentlicht und unveränderlich.' + : 'Wähle die Lizenzartikel und Pakete, die zusammen verkauft werden, und veröffentliche die Fassung.', + 'stand' => $published instanceof BundleVersion ? 'erledigt' : 'offen', + 'aktion' => $published instanceof BundleVersion ? null : ['label' => 'Bestandteile festlegen', 'wire' => "mountAction('publish')"], + ], + [ + 'titel' => 'Jeder enthaltene Artikel hat einen Inhalt', + 'text' => ! $published instanceof BundleVersion + ? 'Wird geprüft, sobald die Bestandteile feststehen.' + : ($missing === [] + ? 'Alle enthaltenen Artikel haben einen veröffentlichten Stand.' + : 'Ohne Stand und damit ohne Inhalt: '.implode(', ', array_map(fn (LicenseArticle $article): string => (string) $article->code, $missing)).'. Ein Angebot lässt sich erst aktivieren, wenn jeder Artikel einen Stand hat.'), + 'stand' => $published instanceof BundleVersion && $missing === [] ? 'erledigt' : 'offen', + 'aktion' => $missing === [] ? null : ['label' => 'Artikel „'.$missing[0]->code.'“ öffnen', 'href' => LicenseArticleResource::getUrl('view', ['record' => $missing[0]])], + ], + [ + 'titel' => 'Angebot mit Preis und Rechten', + 'text' => $offered + ? 'Ein aktives Angebot verkauft dieses Paket.' + : 'Verkauft wird das Paket erst über ein Angebot. Dort wählst du die Paketfassung, die Rechte und den Preis.', + 'stand' => $offered ? 'erledigt' : 'offen', + 'aktion' => $offered ? null : ['label' => 'Angebote öffnen', 'href' => OfferResource::getUrl('index')], + 'pflicht' => false, + ], + ]); + } + + /** + * @return array + */ + public function forOffer(Offer $offer): array + { + $active = $offer->versions()->where('status', 'aktiv')->orderByDesc('number')->first(); + $hasActive = $active instanceof OfferVersion; + $articleIds = $hasActive ? $active->resolvedScopes()->pluck('license_article_id')->map(fn ($id): int => (int) $id)->all() : []; + $missing = $this->unusableArticles($articleIds); + $buyable = $hasActive && $this->offers->purchasableVersion($offer) !== null; + $page = $offer->composition; + $shown = $page !== null && $this->catalog->shownVersion($page) !== null; + $pageName = $page !== null ? (string) ($page->display_title ?: $page->designation) : ''; + $activate = ['label' => $hasActive ? 'Geänderte Fassung aktivieren' : 'Angebot konfigurieren', 'wire' => "mountAction('activate')"]; + + return $this->result([ + [ + 'titel' => 'Artikel oder Paket, Rechte, Preis und Vergabe festlegen', + 'text' => $hasActive + ? 'Fassung '.$active->number.' ist aktiv.' + : 'Wähle, was verkauft wird (Lizenzartikel oder Paketfassung), welche Nutzungsrechte dazugehören, für wen es gilt und was es kostet. Erst „Fassung aktivieren“ macht das Angebot gültig.', + 'stand' => $hasActive ? 'erledigt' : 'offen', + 'aktion' => $hasActive ? null : $activate, + ], + [ + 'titel' => 'Inhalt vorhanden', + 'text' => ! $hasActive + ? 'Wird geprüft, sobald die Fassung aktiv ist.' + : ($missing === [] + ? 'Jeder enthaltene Lizenzartikel hat einen veröffentlichten Stand.' + : 'Ohne Stand und damit ohne Inhalt: '.implode(', ', array_map(fn (LicenseArticle $article): string => (string) $article->code, $missing)).'. Käufer würden nichts erhalten.'), + 'stand' => $hasActive && $missing === [] ? 'erledigt' : 'offen', + 'aktion' => $missing === [] ? null : ['label' => 'Artikel „'.$missing[0]->code.'“ öffnen', 'href' => LicenseArticleResource::getUrl('view', ['record' => $missing[0]])], + ], + [ + 'titel' => 'Als Kauf mit Preis angeboten', + 'text' => $buyable + ? 'Die aktive Fassung ist ein Kauf zu '.Money::format((int) $active->price_cents).'.' + : ($hasActive ? 'Die aktive Fassung ist kein Kauf mit Preis (Vergabe: '.CatalogLabels::vergabe($active).'). Im Shop erscheinen nur Käufe.' : 'Wird mit der Fassung festgelegt.'), + 'stand' => $buyable ? 'erledigt' : 'offen', + 'aktion' => $buyable ? null : ($hasActive ? $activate : null), + ], + [ + 'titel' => 'Produktseite zuordnen', + 'text' => $page !== null + ? 'Zugeordnet: „'.$pageName.'“. Optionen derselben Produktseite sind Alternativen im Warenkorb.' + : 'Der Shop zeigt ein Angebot auf der Seite eines Programms. Wähle in der Maske die Produktseite. Ein Paket braucht eine eigene Produktseite, sonst ist es Alternative zu den Einzelangeboten dieser Seite.', + 'stand' => $page !== null ? 'erledigt' : 'offen', + 'aktion' => $page !== null ? null : $activate, + ], + [ + 'titel' => 'Produktseite öffentlich', + 'text' => $page === null + ? 'Wird geprüft, sobald eine Produktseite zugeordnet ist.' + : ($shown + ? 'Das Programm ist zur Anzeige freigegeben. Das Angebot erscheint in der Shop-Suche und auf der Produktseite.' + : 'Das Programm „'.$pageName.'“ ist nicht zur Anzeige freigegeben oder kein Programm. Das Angebot ist dort nicht auffindbar.'), + 'stand' => $shown ? 'erledigt' : 'offen', + 'aktion' => $page === null || $shown ? null : ['label' => 'Programm öffnen', 'href' => EditorialCatalog::editUrl($page)], + ], + ]); + } + + /** + * @param list> $schritte + * @return array + */ + private function result(array $schritte): array + { + $schritte = array_map(fn (array $schritt): array => ['pflicht' => true, 'aktion' => null, ...$schritt], $schritte); + $naechster = null; + + foreach ($schritte as $schritt) { + if ($schritt['pflicht'] && $schritt['stand'] === 'offen') { + $naechster = $schritt; + break; + } + } + + return [ + 'schritte' => $schritte, + 'bereit' => $naechster === null, + 'naechster' => $naechster, + ]; + } + + private function articleInUse(LicenseArticle $article): bool + { + return DB::table('offer_lines')->where('license_article_id', $article->id)->exists() + || DB::table('bundle_items')->where('license_article_id', $article->id)->exists(); + } + + private function bundleOffered(Bundle $bundle): bool + { + return DB::table('offer_lines') + ->join('offer_versions', 'offer_versions.id', '=', 'offer_lines.offer_version_id') + ->join('bundle_versions', 'bundle_versions.id', '=', 'offer_lines.bundle_version_id') + ->where('bundle_versions.bundle_id', $bundle->id) + ->where('offer_versions.status', 'aktiv') + ->exists(); + } +} diff --git a/app/Filament/Support/WidgetEditor.php b/app/Filament/Support/WidgetEditor.php index 7254bf4..cb0388e 100644 --- a/app/Filament/Support/WidgetEditor.php +++ b/app/Filament/Support/WidgetEditor.php @@ -16,6 +16,7 @@ use Filament\Forms\Components\ToggleButtons; use Filament\Notifications\Notification; use Filament\Schemas\Components\Grid; +use Filament\Schemas\Components\Group; use Filament\Schemas\Components\Section; use Filament\Schemas\Components\Tabs; use Filament\Schemas\Components\Tabs\Tab; @@ -120,45 +121,92 @@ public static function slotBuilder(string $name = 'widget'): Builder ->columnSpanFull(); } + /** + * Erklärung als kleines (i) neben der Bezeichnung: erscheint beim Überfahren und beim Fokussieren. + */ + private static function withInfo(ToggleButtons|Select $component, ?string $help): ToggleButtons|Select + { + return filled($help) + ? $component->hintIcon('heroicon-m-information-circle', tooltip: $help)->hintColor('gray') + : $component; + } + public static function block(WidgetType $type): Block { $icons = $type->optionIcons(); $display = []; + // Aufbau: Anordnung (Variante) und gemeinsame Höhe. Erklärungen stehen im (i) neben der Bezeichnung. + $layout = []; if (count($type->variants()) > 1) { - $display[] = ToggleButtons::make('variant') - ->label('Darstellung') + $layout[] = self::withInfo(ToggleButtons::make('variant') + ->label('Anordnung') ->options($type->variants()) ->icons($icons['variant'] ?? []) ->default($type->defaultVariant()) ->inline() ->required() - ->live(); + ->live(), 'Wie Bild und Text zueinander stehen. Bei wenig Platz stellt sich jede Anordnung selbständig um; die gespeicherte Seite bleibt erhalten.'); } - $settings = []; + $options = $type->settingOptions(); $labels = $type->settingLabels(); - foreach ($type->settingOptions() as $key => $options) { + $hiddenWhen = $type->settingHiddenWhen(); + + $field = function (string $key) use ($options, $labels, $type, $icons, $hiddenWhen): Select|ToggleButtons { + $help = $labels[$key][1] ?? null; // Gemeinsame Höhe (ADR-38): immer als sichtbare Auswahl mit Vorgabe, nie als freie Eingabe. - $settings[] = $key === 'height' + $component = $key === 'height' ? ToggleButtons::make('height') ->label('Höhe') - ->helperText('Gestaltungsparameter, keine Begrenzung: Längere Inhalte erhalten immer den nötigen Platz.') - ->options($options) + ->options($options['height']) ->icons($icons['height'] ?? []) ->default($type->defaultHeight()) ->inline() ->live() : Select::make($key) ->label($labels[$key][0] ?? Str::headline($key)) - ->helperText($labels[$key][1] ?? null) ->placeholder('Vorgabe der Darstellung') - ->options($options) + ->options($options[$key]) ->live(); + + if ($key === 'height') { + $help = 'Gestaltungsparameter, keine Begrenzung: Längere Inhalte erhalten immer den nötigen Platz.'; + } + + if (isset($hiddenWhen[$key])) { + [$controller, $value] = $hiddenWhen[$key]; + // Ausgeblendete Werte bleiben gespeichert, damit ein späteres Einblenden nichts zurücksetzt. + $component->hidden(fn (Get $get): bool => ($get($controller) ?? null) === $value)->dehydratedWhenHidden(); + } + + return self::withInfo($component, $help); + }; + + if (isset($options['height'])) { + $layout[] = Group::make([$field('height')])->statePath('settings'); } - if ($settings !== []) { - $display[] = Grid::make(['default' => 1, 'md' => 2])->schema($settings)->statePath('settings'); + if ($layout !== []) { + $display[] = Section::make('Aufbau')->compact()->schema($layout); + } + + $grouped = []; + foreach ($type->settingGroups() as $title => $keys) { + $keys = array_values(array_filter($keys, fn (string $key): bool => isset($options[$key]) && $key !== 'height')); + $grouped = [...$grouped, ...$keys]; + if ($keys !== []) { + $display[] = Section::make($title)->compact()->schema([ + Grid::make(['default' => 1, 'md' => 2])->schema(array_map($field, $keys))->statePath('settings'), + ]); + } + } + + $rest = array_values(array_filter(array_keys($options), fn (string $key): bool => $key !== 'height' && ! in_array($key, $grouped, true))); + if ($rest !== []) { + $display[] = Section::make($grouped === [] && $layout === [] ? 'Einstellungen' : 'Weitere Einstellungen')->compact()->schema([ + Grid::make(['default' => 1, 'md' => 2])->schema(array_map($field, $rest))->statePath('settings'), + ]); } $variantField = count($type->variants()) > 1 ? [] : [Hidden::make('variant')->default($type->defaultVariant())]; diff --git a/app/Http/Controllers/Auth/EmailVerificationController.php b/app/Http/Controllers/Auth/EmailVerificationController.php index 8e6e93e..68d77bb 100644 --- a/app/Http/Controllers/Auth/EmailVerificationController.php +++ b/app/Http/Controllers/Auth/EmailVerificationController.php @@ -25,7 +25,8 @@ public function verify(EmailVerificationRequest $request): RedirectResponse $request->fulfill(); app(GrantIssuer::class)->grantRegistrationOffers($request->user()); - return redirect()->route('member.dashboard'); + // Wer aus dem Warenkorb kam, kehrt nach der Bestätigung zur Kasse zurück (gespeichertes Ziel der Sitzung). + return redirect()->intended(route('member.dashboard')); } public function send(Request $request): RedirectResponse diff --git a/app/Http/Controllers/CartController.php b/app/Http/Controllers/CartController.php new file mode 100644 index 0000000..51efd3e --- /dev/null +++ b/app/Http/Controllers/CartController.php @@ -0,0 +1,88 @@ +user(); + $review = $cart->review($user, $request->integer('bestellen_als') ?: null); + + return view('shop.cart', [ + 'review' => $review, + 'holders' => $user === null ? collect() : $holders->for($user), + ]); + } + + public function add(Offer $offer, Cart $cart, PublicCatalogReader $catalog): RedirectResponse + { + $page = $offer->composition; + $result = $page !== null && $catalog->shownVersion($page) !== null + ? $cart->add($offer) + : Cart::UNAVAILABLE; + $back = $this->productPage($offer); + + return match ($result) { + Cart::ADDED => $back->with('status', 'Die Option liegt im Warenkorb.'), + Cart::PRESENT => $back->with('status', 'Diese Option liegt bereits im Warenkorb. Sie erscheint nur einmal.'), + Cart::ALTERNATIVE => $back->with('shop.switch', $offer->id), + default => $back->withErrors(['shop' => 'Diese Option ist gerade nicht erhältlich.']), + }; + } + + /** + * Ausdrücklicher Wechsel zwischen Alternativoptionen derselben Produktseite. + */ + public function switch(Offer $offer, Cart $cart): RedirectResponse + { + if (! $cart->switchTo($offer)) { + return $this->productPage($offer)->withErrors(['shop' => 'Diese Option ist gerade nicht erhältlich.']); + } + + return redirect()->route('cart')->with('status', 'Die Option wurde gewechselt.'); + } + + public function remove(Offer $offer, Cart $cart): RedirectResponse + { + $cart->remove($offer); + + return redirect()->route('cart')->with('status', 'Die Position ist entfernt.'); + } + + /** + * Der Käufer übernimmt den aktuell gezeigten Preis und die aktuellen Bedingungen einer Position. + */ + public function accept(Offer $offer, Cart $cart): RedirectResponse + { + $seen = $cart->items()[$offer->id]['price_cents'] ?? null; + $cart->acceptCurrent($offer); + $price = $cart->purchasable($offer)?->price_cents; + + return redirect()->route('cart')->with('status', match (true) { + $price === null => 'Die Option ist nicht mehr erhältlich.', + $seen !== null && (int) $seen !== (int) $price => 'Der aktuelle Preis von '.Money::format($price).' ist übernommen.', + default => 'Die aktuellen Bedingungen sind übernommen.', + }); + } + + private function productPage(Offer $offer): RedirectResponse + { + return $offer->composition_id !== null + ? redirect()->route('public.program', $offer->composition_id) + : redirect()->route('cart'); + } +} diff --git a/app/Http/Controllers/Concerns/ServesByteRanges.php b/app/Http/Controllers/Concerns/ServesByteRanges.php new file mode 100644 index 0000000..0c7eab9 --- /dev/null +++ b/app/Http/Controllers/Concerns/ServesByteRanges.php @@ -0,0 +1,94 @@ + 'inline', + 'X-Content-Type-Options' => 'nosniff', + 'Accept-Ranges' => 'bytes', + ]; + $range = $request->header('Range'); + + if (! is_string($range) || ! $ranged) { + return Storage::disk($diskName)->response($path, null, $headers); + } + + $disk = Storage::disk($diskName); + $size = (int) $disk->size($path); + $bounds = $this->bounds($range, $size); + + if ($bounds === null) { + return response()->stream(fn () => null, 416, $headers + ['Content-Range' => 'bytes */'.$size]); + } + + [$start, $end] = $bounds; + $length = $end - $start + 1; + $stream = $disk->readStream($path); + abort_if(! is_resource($stream), 404); + + return response()->stream(function () use ($stream, $start, $length): void { + fseek($stream, $start); + $left = $length; + + while ($left > 0 && ! feof($stream)) { + $chunk = fread($stream, min(self::CHUNK, $left)); + + if ($chunk === false || $chunk === '') { + break; + } + + echo $chunk; + $left -= strlen($chunk); + } + + fclose($stream); + }, 206, $headers + [ + 'Content-Type' => (string) ($disk->mimeType($path) ?: 'application/octet-stream'), + 'Content-Length' => (string) $length, + 'Content-Range' => 'bytes '.$start.'-'.$end.'/'.$size, + ]); + } + + /** + * Erster Bereich aus „bytes=a-b“, „bytes=a-“ oder „bytes=-n“; null, wenn er nicht erfüllbar ist. + * + * @return array{0: int, 1: int}|null + */ + private function bounds(string $header, int $size): ?array + { + if ($size < 1 || preg_match('/^bytes=(\d*)-(\d*)(?:,.*)?$/', trim($header), $match) !== 1) { + return null; + } + + [, $from, $to] = $match; + + if ($from === '' && $to === '') { + return null; + } + + if ($from === '') { + $suffix = min((int) $to, $size); + + return $suffix < 1 ? null : [$size - $suffix, $size - 1]; + } + + $start = (int) $from; + $end = $to === '' ? $size - 1 : min((int) $to, $size - 1); + + return $start > $end || $start >= $size ? null : [$start, $end]; + } +} diff --git a/app/Http/Controllers/ContentPreviewController.php b/app/Http/Controllers/ContentPreviewController.php index 913e219..d60c109 100644 --- a/app/Http/Controllers/ContentPreviewController.php +++ b/app/Http/Controllers/ContentPreviewController.php @@ -2,12 +2,16 @@ namespace App\Http\Controllers; +use App\Domain\Catalog\ContentElement; use App\Domain\Catalog\ContentElementVersion; use App\Domain\Identity\StaffRole; use App\Domain\Media\FilmPlayback; use App\Domain\Media\HlsPlaylist; use App\Domain\Media\MediaRendition; +use App\Domain\Media\ThumbnailDeriver; +use App\Http\Controllers\Concerns\ServesByteRanges; use App\Models\User; +use Illuminate\Http\Request; use Illuminate\Http\Response; use Illuminate\Support\Facades\Storage; use Illuminate\View\View; @@ -15,6 +19,27 @@ class ContentPreviewController extends Controller { + use ServesByteRanges; + + /** + * Die Website-Datei eines Films oder Hörstücks, damit die Redaktion sie vor der Freigabe ansehen kann. Nur für + * angemeldete Redakteure; öffentlich ist erst die freigegebene Kopie (`website.media`). + */ + public function websiteFile(Request $request, ContentElement $element): StreamedResponse + { + $this->authorizeStaff(); + $path = $element->preview_path; + + abort_unless( + is_string($path) && str_starts_with($path, 'teaser/') && ! str_contains($path, '..') + && in_array($element->output_class, ['film', 'audio'], true) + && Storage::disk('media_derived')->exists($path), + 404, + ); + + return $this->respondWithRanges($request, 'media_derived', $path, true); + } + public function show(ContentElementVersion $version): View { $this->authorizeStaff(); @@ -38,6 +63,24 @@ public function file(ContentElementVersion $version): StreamedResponse ]); } + /** + * Einzelbild einer Stelle der Website-Datei, zur Auswahl des Vorschaubilds. + */ + public function websiteFrame(Request $request, ContentElement $element, ThumbnailDeriver $deriver): Response + { + $this->authorizeStaff(); + $seconds = $request->query('sekunde'); + abort_unless(is_numeric($seconds), 404); + + $bytes = $deriver->jpegAtWebsiteFile($element, (float) $seconds); + abort_unless(is_string($bytes), 404); + + return response($bytes, 200, [ + 'Content-Type' => 'image/jpeg', + 'Cache-Control' => 'private, no-store', + ]); + } + public function fileUrl(ContentElementVersion $version): ?string { return $this->storedPath($version) === null ? null : route('content.file', $version); diff --git a/app/Http/Controllers/Member/CheckoutController.php b/app/Http/Controllers/Member/CheckoutController.php index fa70926..9eae73c 100644 --- a/app/Http/Controllers/Member/CheckoutController.php +++ b/app/Http/Controllers/Member/CheckoutController.php @@ -5,8 +5,13 @@ use App\Domain\Catalog\DomainRuleException; use App\Domain\Catalog\Offer; use App\Domain\Catalog\OfferStatus; +use App\Domain\Commerce\Cart; use App\Domain\Commerce\Checkout; use App\Domain\Commerce\Order; +use App\Domain\Commerce\OrderHolders; +use App\Domain\Commerce\Shop; +use App\Domain\Commerce\StaleOverview; +use App\Domain\Commerce\Stripe\StripeGateway; use App\Domain\Entitlement\GrantIssuer; use App\Http\Controllers\Controller; use Illuminate\Http\RedirectResponse; @@ -48,17 +53,74 @@ public function place(Request $request, Offer $offer, Checkout $checkout): Redir return redirect()->route('member.order', $order); } + /** + * Bestellübersicht: zeigt die geprüften Positionen mit dem Inhaber, für den bestellt wird. + */ + public function checkout(Request $request, Cart $cart, OrderHolders $holders): View|RedirectResponse + { + if ($cart->count() === 0) { + return redirect()->route('cart'); + } + + $review = $cart->review($request->user(), $request->integer('bestellen_als') ?: null); + + return view('shop.checkout', [ + 'review' => $review, + 'holders' => $holders->for($request->user()), + ]); + } + + /** + * Legt die Bestellung an, aber nur, wenn die serverseitige Prüfung zur gezeigten Übersicht passt. + */ + public function placeOrder(Request $request, Cart $cart, Checkout $checkout): RedirectResponse + { + $data = $request->validate([ + 'digest' => ['required', 'string'], + 'bestellen_als' => ['nullable', 'integer'], + ]); + $holderId = isset($data['bestellen_als']) ? (int) $data['bestellen_als'] : null; + $back = redirect()->route('checkout', array_filter(['bestellen_als' => $holderId])); + + try { + $order = $checkout->placeFromCart($request->user(), $cart, $holderId, $data['digest']); + } catch (StaleOverview $exception) { + return $back->withErrors(['checkout' => $exception->getMessage()]); + } catch (DomainRuleException $exception) { + return $back->withErrors(['checkout' => $exception->getMessage()]); + } + + return redirect()->route('member.order', $order)->with('status', 'Die Bestellung ist angelegt. Bestätige jetzt die Testzahlung.'); + } + public function show(Request $request, Order $order): View { abort_unless($order->user_id === $request->user()->id, 403); - $order->load('lines.offerVersion.offer', 'payments'); + $order->load('lines.offerVersion.offer', 'lines.holder', 'payments', 'party', 'user'); return view('member.order', [ 'order' => $order, 'testPayment' => ! app()->isProduction() && config('services.payment.driver') === 'test', + 'stripePayment' => Shop::stripe(), + 'zahlung' => $request->query('zahlung'), ]); } + /** Leitet zur Stripe-Kasse (Testmodus). Freigeschaltet wird erst durch die signierte Meldung von Stripe. */ + public function pay(Request $request, Order $order, StripeGateway $stripe): RedirectResponse + { + abort_unless($order->user_id === $request->user()->id, 403); + abort_unless(Shop::stripe(), 404); + + try { + $session = $stripe->checkoutFor($order); + } catch (DomainRuleException $exception) { + return back()->withErrors(['payment' => $exception->getMessage()]); + } + + return redirect()->away($session['url']); + } + public function confirm(Request $request, Order $order, Checkout $checkout): RedirectResponse { abort_unless($order->user_id === $request->user()->id, 403); diff --git a/app/Http/Controllers/Member/LibraryController.php b/app/Http/Controllers/Member/LibraryController.php index 147fe63..ab608b8 100644 --- a/app/Http/Controllers/Member/LibraryController.php +++ b/app/Http/Controllers/Member/LibraryController.php @@ -9,6 +9,8 @@ use App\Domain\Catalog\EditorialVocabulary; use App\Domain\Catalog\IdentityDimension; use App\Domain\Catalog\LicenseArticle; +use App\Domain\Catalog\Pillar; +use App\Domain\Catalog\PillarFilterCompat; use App\Domain\Entitlement\DecideAccess; use App\Domain\Entitlement\Grant; use App\Domain\Entitlement\GrantStatus; @@ -20,8 +22,10 @@ use App\Http\CourseOutline; use App\Http\LibraryCatalog; use App\Http\SignedLink; +use Illuminate\Database\Eloquent\Model; use Illuminate\Http\Request; use Illuminate\Http\Response; +use Illuminate\Support\Collection; use Illuminate\Support\Facades\Storage; use Illuminate\View\View; use Symfony\Component\HttpFoundation\StreamedResponse; @@ -35,8 +39,21 @@ public function index(Request $request, ?string $sicht = null): View $query = trim((string) $request->query('q', '')); $nutzung = (string) $request->query('nutzung', ''); $dimensionIds = array_values(array_filter(array_map(intval(...), (array) $request->query('dimension', [])))); + $saeuleIds = array_values(array_filter(array_map(intval(...), (array) $request->query('saeule', [])))); $dimensions = app(IdentityDimension::class); + // Alte Adressen: Säulen waren ein Wert der Einordnung. Mit belastbarer Verknüpfung gilt der Filter der Säule. + foreach ($dimensionIds as $index => $valueId) { + if (is_int($pillarId = PillarFilterCompat::pillarOfLegacyValue($valueId))) { + $saeuleIds[] = $pillarId; + unset($dimensionIds[$index]); + } + } + + $dimensionIds = array_values($dimensionIds); + $saeuleIds = array_values(array_unique($saeuleIds)); + $pillarOptions = $this->visiblePillars($catalog, $saeuleIds); + foreach (['programs', 'modules'] as $shelf) { if ($query !== '') { $catalog[$shelf] = array_values(array_filter( @@ -50,6 +67,12 @@ public function index(Request $request, ?string $sicht = null): View fn (array $card): bool => $dimensions->matches($card['composition'], $dimensionIds), )); } + if ($saeuleIds !== []) { + $catalog[$shelf] = array_values(array_filter( + $catalog[$shelf], + fn (array $card): bool => $this->hasPillar($card['composition'], $saeuleIds), + )); + } if (in_array($nutzung, ['nutzbar', 'teilweise', 'nicht enthalten'], true)) { $catalog[$shelf] = array_values(array_filter( $catalog[$shelf], @@ -79,6 +102,13 @@ function (array $card) use ($dimensions, $dimensionIds): bool { )); } + if ($saeuleIds !== []) { + $catalog['materials'] = array_values(array_filter( + $catalog['materials'], + fn (array $card): bool => $this->hasPillar($this->materialSubject($card), $saeuleIds), + )); + } + if ($nutzung === 'teilweise' || $nutzung === 'nicht enthalten') { $catalog['materials'] = []; } @@ -89,11 +119,65 @@ function (array $card) use ($dimensions, $dimensionIds): bool { 'sicht' => $sicht, 'nutzung' => $nutzung, 'dimensionIds' => $dimensionIds, + 'saeuleIds' => $saeuleIds, + 'filterPillars' => $pillarOptions, 'filterDimensions' => app(EditorialVocabulary::class)->memberFilterDimensions(array_map(intval(...), $dimensionIds)), 'libraryEmpty' => $untouched, ]); } + /** + * Subjekt eines Materialkarte: Programm oder Modul, Medium oder der Artikel selbst. + * + * @param array $card + */ + private function materialSubject(array $card): Model + { + $release = $card['article']->currentRelease; + + return $release?->rootCompositionVersion?->composition + ?? $release?->rootElementVersion?->element + ?? $card['article']; + } + + /** + * Direkte Säulenzuordnung des Objekts selbst; die Säulen enthaltener Medien zählen hier nicht. + * + * @param list $pillarIds + */ + private function hasPillar(Model $subject, array $pillarIds): bool + { + return $subject->pillars()->whereIn('pillars.id', $pillarIds)->exists(); + } + + /** + * Säulen für den Filter: nur solche, die ein sichtbares Objekt der Bibliothek tatsächlich trägt, und eine bereits + * gewählte. So erscheinen neue oder interne Säulen ohne Zuordnung nicht in der Bibliothek. + * + * @param array $catalog + * @param list $selected + * @return Collection + */ + private function visiblePillars(array $catalog, array $selected) + { + $used = []; + + foreach (array_merge($catalog['programs'], $catalog['modules']) as $card) { + foreach ($card['composition']->pillars()->pluck('pillars.id') as $id) { + $used[(int) $id] = true; + } + } + + foreach ($catalog['materials'] as $card) { + foreach ($this->materialSubject($card)->pillars()->pluck('pillars.id') as $id) { + $used[(int) $id] = true; + } + } + + return Pillar::query()->whereIn('id', array_values(array_unique([...array_keys($used), ...$selected]))) + ->orderBy('sort_order')->orderBy('name')->get(); + } + public function programs(Request $request): View { return $this->index($request, 'programme'); @@ -382,7 +466,7 @@ private function grantQuery(Request $request) { return Grant::query() ->where('status', GrantStatus::Aktiv) - ->whereHas('acquisition', fn ($query) => $query->where('party_id', $request->user()->party_id)) + ->usableBy($request->user()) ->with('article.currentRelease') ->orderBy('id'); } diff --git a/app/Http/Controllers/PublicCatalogController.php b/app/Http/Controllers/PublicCatalogController.php index 5cd36b4..b746bf9 100644 --- a/app/Http/Controllers/PublicCatalogController.php +++ b/app/Http/Controllers/PublicCatalogController.php @@ -5,6 +5,9 @@ use App\Domain\Catalog\Composition; use App\Domain\Catalog\CompositionStructureReader; use App\Domain\Cms\Catalog\PublicCatalogReader; +use App\Domain\Commerce\Cart; +use App\Domain\Commerce\ProductOptions; +use App\Domain\Commerce\Shop; use Illuminate\View\View; class PublicCatalogController extends Controller @@ -14,7 +17,7 @@ public function index(PublicCatalogReader $catalog): View return view('public.programs', ['programs' => $catalog->publicPrograms()]); } - public function program(Composition $composition, PublicCatalogReader $catalog): View + public function program(Composition $composition, PublicCatalogReader $catalog, ProductOptions $products, Cart $cart): View { $version = $catalog->shownVersion($composition); abort_if($version === null, 404); @@ -23,6 +26,9 @@ public function program(Composition $composition, PublicCatalogReader $catalog): 'composition' => $composition, 'version' => $version, 'nodes' => app(CompositionStructureReader::class)->tree($version), + 'options' => Shop::enabled() ? $products->forComposition($composition) : [], + 'cart' => $cart, + 'switchTo' => session('shop.switch'), ]); } } diff --git a/app/Http/Controllers/PublicMediaController.php b/app/Http/Controllers/PublicMediaController.php index 7004511..df0523e 100644 --- a/app/Http/Controllers/PublicMediaController.php +++ b/app/Http/Controllers/PublicMediaController.php @@ -14,6 +14,8 @@ public function show(string $path, WebsiteMedia $media): StreamedResponse abort_if(str_contains($path, '..') || ! str_starts_with($path, 'cms/'), 404); // Ein in den Medienmanager übernommenes Bild folgt dessen Website-Freigabe, auch unter der früheren Adresse. + abort_if(WebsiteMediaAlias::isRetired($path), 404); + $alias = WebsiteMediaAlias::effectiveFor($path); abort_if($alias !== null && $media->present($alias->content_element_id) === null, 404); diff --git a/app/Http/Controllers/ShopController.php b/app/Http/Controllers/ShopController.php new file mode 100644 index 0000000..dadab27 --- /dev/null +++ b/app/Http/Controllers/ShopController.php @@ -0,0 +1,50 @@ +query('suche', '')); + $summaries = $products->summaries(); + $cards = []; + + foreach (Composition::query()->whereIn('id', array_keys($summaries))->orderBy('designation')->get() as $composition) { + $version = $catalog->shownVersion($composition); + + if ($version === null) { + continue; + } + + $title = (string) ($composition->display_title ?: $composition->designation); + $haystack = mb_strtolower($title.' '.$composition->teaser.' '.$composition->summary.' '.$composition->search_terms); + + if ($term !== '' && ! str_contains($haystack, mb_strtolower($term))) { + continue; + } + + $summary = $summaries[$composition->id]; + $cards[] = [ + 'composition' => $composition, + 'title' => $title, + 'teaser' => (string) ($composition->teaser ?: $composition->summary), + 'from' => Money::format($summary['from_cents']), + 'count' => $summary['count'], + ]; + } + + return view('shop.index', ['cards' => $cards, 'term' => $term]); + } +} diff --git a/app/Http/Controllers/StripeWebhookController.php b/app/Http/Controllers/StripeWebhookController.php new file mode 100644 index 0000000..b18fd0b --- /dev/null +++ b/app/Http/Controllers/StripeWebhookController.php @@ -0,0 +1,114 @@ +getContent(); + + try { + $signature->verify($payload, $request->header('Stripe-Signature')); + } catch (DomainRuleException $exception) { + Log::warning('Stripe-Meldung abgewiesen', ['grund' => $exception->getMessage()]); + + return response()->json(['error' => 'Ungültige Signatur.'], 400); + } + + $event = json_decode($payload, true); + + if (! is_array($event) || ! isset($event['type'])) { + return response()->json(['error' => 'Ungültige Nutzlast.'], 400); + } + + $session = (array) ($event['data']['object'] ?? []); + + return match ($event['type']) { + 'checkout.session.completed', 'checkout.session.async_payment_succeeded' => $this->paid($session, $checkout), + 'checkout.session.expired', 'checkout.session.async_payment_failed' => $this->notPaid($session, (string) $event['type']), + default => response()->json(['received' => true, 'handled' => false]), + }; + } + + /** + * @param array $session + */ + private function paid(array $session, Checkout $checkout): JsonResponse + { + if (($session['payment_status'] ?? null) !== 'paid') { + return response()->json(['received' => true, 'handled' => false]); + } + + $order = $this->orderOf($session); + $reference = (string) ($session['id'] ?? ''); + + if ($order === null || $reference === '') { + Log::warning('Stripe-Zahlung ohne zugehörige Bestellung', ['session' => $reference]); + + return response()->json(['received' => true, 'handled' => false]); + } + + try { + $checkout->confirmProviderPayment( + $order, + 'stripe', + $reference, + (int) ($session['amount_total'] ?? -1), + (string) ($session['currency'] ?? ''), + ); + } catch (DomainRuleException $exception) { + // Dauerhafter Fehler (Betragsabweichung, Bestellung nicht mehr offen): nichts freischalten, Zahlung zur + // Prüfung festhalten und 200 antworten, damit Stripe nicht endlos wiederholt. + Log::warning('Stripe-Zahlung nicht übernommen', ['order' => $order->id, 'session' => $reference, 'grund' => $exception->getMessage()]); + $order->payments()->updateOrCreate(['provider_reference' => $reference], ['provider' => 'stripe', 'status' => 'zu_pruefen']); + + return response()->json(['received' => true, 'handled' => false]); + } + + return response()->json(['received' => true, 'handled' => true]); + } + + /** + * @param array $session + */ + private function notPaid(array $session, string $type): JsonResponse + { + $payment = Payment::query()->where('provider', 'stripe')->where('provider_reference', (string) ($session['id'] ?? ''))->first(); + + // Die Bestellung bleibt offen und lässt sich erneut bezahlen; nur diese Kasse gilt nicht mehr. + if ($payment !== null && $payment->status === 'offen') { + $payment->status = $type === 'checkout.session.expired' ? 'abgelaufen' : 'fehlgeschlagen'; + $payment->save(); + } + + return response()->json(['received' => true, 'handled' => $payment !== null]); + } + + /** + * @param array $session + */ + private function orderOf(array $session): ?Order + { + $id = $session['client_reference_id'] ?? ($session['metadata']['order_id'] ?? null); + + return is_numeric($id) ? Order::query()->find((int) $id) : null; + } +} diff --git a/app/Http/Controllers/WebsiteMediaController.php b/app/Http/Controllers/WebsiteMediaController.php index 2cbb199..df85a7c 100644 --- a/app/Http/Controllers/WebsiteMediaController.php +++ b/app/Http/Controllers/WebsiteMediaController.php @@ -4,12 +4,15 @@ use App\Domain\Catalog\ContentElement; use App\Domain\Media\WebsiteMedia; -use Illuminate\Support\Facades\Storage; +use App\Http\Controllers\Concerns\ServesByteRanges; +use Illuminate\Http\Request; use Symfony\Component\HttpFoundation\StreamedResponse; class WebsiteMediaController extends Controller { - public function show(ContentElement $element, WebsiteMedia $media): StreamedResponse + use ServesByteRanges; + + public function show(Request $request, ContentElement $element, WebsiteMedia $media): StreamedResponse { $presentation = $media->present($element); abort_if($presentation === null, 404); @@ -17,9 +20,6 @@ public function show(ContentElement $element, WebsiteMedia $media): StreamedResp $path = $element->website_public_path; abort_if(! is_string($path), 404); - return Storage::disk('media_public')->response($path, null, [ - 'Content-Disposition' => 'inline', - 'X-Content-Type-Options' => 'nosniff', - ]); + return $this->respondWithRanges($request, 'media_public', $path, $presentation->kind !== 'bild'); } } diff --git a/app/Http/LibraryCatalog.php b/app/Http/LibraryCatalog.php index c7e7163..203af59 100644 --- a/app/Http/LibraryCatalog.php +++ b/app/Http/LibraryCatalog.php @@ -266,7 +266,7 @@ private function grants(User $user): Collection { return Grant::query() ->where('status', GrantStatus::Aktiv) - ->whereHas('acquisition', fn ($query) => $query->where('party_id', $user->party_id)) + ->usableBy($user) ->with([ 'article.currentRelease.rootCompositionVersion.composition.editorialContentKind', 'article.currentRelease.rootElementVersion.element.editorialContentKind', diff --git a/app/Http/Middleware/EnsureShopEnabled.php b/app/Http/Middleware/EnsureShopEnabled.php new file mode 100644 index 0000000..ce59774 --- /dev/null +++ b/app/Http/Middleware/EnsureShopEnabled.php @@ -0,0 +1,21 @@ +websiteFile && $this->atSecond !== null) { + $deriver->forElementWebsiteFrame($element, $this->atSecond); + + return; + } + if ($this->versionId !== null && $this->atSecond !== null) { $version = ContentElementVersion::query()->find($this->versionId); diff --git a/app/Jobs/StorePresentationFile.php b/app/Jobs/StorePresentationFile.php new file mode 100644 index 0000000..ffd20d9 --- /dev/null +++ b/app/Jobs/StorePresentationFile.php @@ -0,0 +1,61 @@ +find($this->elementId); + + if (! $element instanceof ContentElement) { + return; + } + + try { + $file->place($element, $this->incoming); + + // Ein schon freigegebenes Medium zeigt sonst weiter die alte öffentliche Kopie. + if ($element->website_released_at !== null) { + PublishWebsiteMedia::dispatch($element->id, 'release'); + } + } catch (DomainRuleException $e) { + $this->remember($element, $e->getMessage()); + } + } + + public function failed(\Throwable $e): void + { + $element = ContentElement::query()->find($this->elementId); + + if ($element instanceof ContentElement) { + $this->remember($element, 'Die Datei ließ sich nicht übernehmen: '.Str::limit($e->getMessage(), 120)); + } + } + + private function remember(ContentElement $element, string $message): void + { + $element->thumbnail_error = $message; + $element->save(); + } +} diff --git a/bootstrap/app.php b/bootstrap/app.php index 82e1084..c3bad40 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -17,6 +17,8 @@ ) ->withMiddleware(function (Middleware $middleware): void { $middleware->trustProxies(at: '*'); + // Stripe sendet ohne Sitzung und CSRF-Token; die Signatur der Meldung ersetzt beides. + $middleware->validateCsrfTokens(except: ['stripe/webhook']); $middleware->prepend(UseStaffSessionCookie::class); $middleware->prepend(UseRequestRootUrl::class); $middleware->prepend(IgnoreEmptyForwardedHeaders::class); diff --git a/config/cms.php b/config/cms.php index 937e1a0..05abcc3 100644 --- a/config/cms.php +++ b/config/cms.php @@ -42,8 +42,8 @@ ], /* - | Vorbereiteter Warenkorbzugang in der Kopfzeile. Der Warenkorb ist Teil des kommerziellen Anwendungssystems - | und noch nicht umgesetzt; solange enabled false ist, erscheint kein Warenkorbsymbol. + | Früher vorbereiteter Warenkorbzugang. Seit Etappe 1 folgt der Eintrag in der Kopfzeile dem Shop + | (App\Domain\Commerce\Shop::enabled: Testzahlung, nie in Produktion). Diese Werte werden nicht mehr gelesen. */ 'cart' => [ 'enabled' => (bool) env('LUF_CART_ENABLED', false), diff --git a/config/services.php b/config/services.php index 1346f70..b6b02f4 100644 --- a/config/services.php +++ b/config/services.php @@ -29,9 +29,19 @@ ], 'payment' => [ + // test: Testweg ohne Anbieter. stripe: Stripe-Kasse, in Etappe 1 nur mit Testschlüsseln (sk_test_). 'driver' => env('PAYMENT_DRIVER', 'test'), ], + 'stripe' => [ + 'secret' => env('STRIPE_SECRET'), + 'webhook_secret' => env('STRIPE_WEBHOOK_SECRET'), + // Optional: ID eines in Stripe angelegten Steuersatzes (txr_...), der jeder Position mitgegeben wird. + // Er muss im Preis enthalten (inklusiv) sein, sonst weicht der gezahlte Betrag von der Bestellung ab. + 'tax_rate' => env('STRIPE_TAX_RATE_ID'), + 'api_base' => env('STRIPE_API_BASE', 'https://api.stripe.com'), + ], + 'slack' => [ 'notifications' => [ 'bot_user_oauth_token' => env('SLACK_BOT_USER_OAUTH_TOKEN'), diff --git a/database/migrations/2026_11_21_100000_unify_pillar_assignments.php b/database/migrations/2026_11_21_100000_unify_pillar_assignments.php new file mode 100644 index 0000000..b1376c1 --- /dev/null +++ b/database/migrations/2026_11_21_100000_unify_pillar_assignments.php @@ -0,0 +1,59 @@ +foreignId('composition_id')->constrained()->cascadeOnDelete(); + $table->foreignId('pillar_id')->constrained()->restrictOnDelete(); + $table->primary(['composition_id', 'pillar_id']); + }); + + Schema::create('license_article_pillar', function (Blueprint $table) { + $table->foreignId('license_article_id')->constrained()->cascadeOnDelete(); + $table->foreignId('pillar_id')->constrained()->restrictOnDelete(); + $table->primary(['license_article_id', 'pillar_id']); + }); + + Schema::table('editorial_dimension_values', function (Blueprint $table) { + $table->foreignId('pillar_id')->nullable()->after('editorial_dimension_id')->constrained('pillars')->nullOnDelete(); + }); + + $report = (new LegacyPillarAdoption)->run(); + + foreach (LegacyPillarAdoption::lines($report) as $line) { + if ($line !== '') { + Log::info('Säulenübernahme: '.$line); + } + } + + if ($report['unresolved'] !== []) { + Log::warning('Säulenübernahme: '.count($report['unresolved']).' Fälle ungeklärt; „php artisan luf:saeulen-uebernehmen --dry-run“ listet sie.'); + } + } + + public function down(): void + { + Schema::table('editorial_dimension_values', function (Blueprint $table) { + $table->dropConstrainedForeignId('pillar_id'); + }); + + Schema::dropIfExists('license_article_pillar'); + Schema::dropIfExists('composition_pillar'); + } +}; diff --git a/database/migrations/2026_11_21_120000_create_film_still_sources.php b/database/migrations/2026_11_21_120000_create_film_still_sources.php new file mode 100644 index 0000000..9d49c01 --- /dev/null +++ b/database/migrations/2026_11_21_120000_create_film_still_sources.php @@ -0,0 +1,32 @@ +id(); + $table->foreignId('film_element_id')->constrained('content_elements')->restrictOnDelete(); + $table->foreignId('still_element_id')->constrained('content_elements')->restrictOnDelete(); + $table->string('source_key', 120); + $table->unsignedBigInteger('actor_id')->nullable(); + $table->timestamps(); + + $table->unique(['film_element_id', 'source_key']); + }); + } + + public function down(): void + { + Schema::dropIfExists('film_still_sources'); + } +}; diff --git a/database/migrations/2026_11_21_130000_add_shop_foundation.php b/database/migrations/2026_11_21_130000_add_shop_foundation.php new file mode 100644 index 0000000..4332feb --- /dev/null +++ b/database/migrations/2026_11_21_130000_add_shop_foundation.php @@ -0,0 +1,82 @@ +foreignId('composition_id')->nullable()->constrained('compositions')->nullOnDelete(); + $table->string('option_label')->nullable(); + }); + + Schema::create('memberships', function (Blueprint $table) { + $table->id(); + $table->foreignId('user_id')->constrained()->cascadeOnDelete(); + $table->foreignId('party_id')->constrained()->restrictOnDelete(); + $table->string('role')->default('mitglied'); + $table->boolean('may_order')->default(false); + $table->date('valid_from')->nullable(); + $table->date('valid_until')->nullable(); + $table->timestamps(); + + $table->unique(['user_id', 'party_id']); + }); + + Schema::table('acquisitions', function (Blueprint $table) { + $table->foreignId('acting_user_id')->nullable()->constrained('users')->nullOnDelete(); + }); + + Schema::table('orders', function (Blueprint $table) { + $table->unsignedInteger('total_cents')->nullable(); + $table->string('currency', 3)->default('EUR'); + }); + + Schema::table('order_lines', function (Blueprint $table) { + $table->string('currency', 3)->default('EUR'); + $table->string('tax_class')->nullable(); + $table->string('grant_kind')->nullable(); + $table->foreignId('holder_party_id')->nullable()->constrained('parties')->restrictOnDelete(); + }); + + // Bestehende Bestellungen: Summe und Inhaber der Position aus den vorhandenen Angaben. + foreach (DB::table('orders')->get() as $order) { + DB::table('orders')->where('id', $order->id)->update([ + 'total_cents' => (int) DB::table('order_lines')->where('order_id', $order->id)->sum('price_cents'), + ]); + DB::table('order_lines')->where('order_id', $order->id)->update(['holder_party_id' => $order->party_id]); + } + } + + public function down(): void + { + Schema::table('order_lines', function (Blueprint $table) { + $table->dropConstrainedForeignId('holder_party_id'); + $table->dropColumn(['currency', 'tax_class', 'grant_kind']); + }); + Schema::table('orders', function (Blueprint $table) { + $table->dropColumn(['total_cents', 'currency']); + }); + Schema::table('acquisitions', function (Blueprint $table) { + $table->dropConstrainedForeignId('acting_user_id'); + }); + Schema::dropIfExists('memberships'); + Schema::table('offers', function (Blueprint $table) { + $table->dropConstrainedForeignId('composition_id'); + $table->dropColumn('option_label'); + }); + } +}; diff --git a/database/migrations/2026_11_21_130000_allow_deleting_media_with_stills_and_aliases.php b/database/migrations/2026_11_21_130000_allow_deleting_media_with_stills_and_aliases.php new file mode 100644 index 0000000..41792f8 --- /dev/null +++ b/database/migrations/2026_11_21_130000_allow_deleting_media_with_stills_and_aliases.php @@ -0,0 +1,44 @@ +dropForeign(['still_element_id']); + }); + Schema::table('film_still_sources', function (Blueprint $table) { + $table->foreign('still_element_id')->references('id')->on('content_elements')->cascadeOnDelete(); + }); + + Schema::table('website_media_aliases', function (Blueprint $table) { + $table->dropForeign(['content_element_id']); + }); + Schema::table('website_media_aliases', function (Blueprint $table) { + $table->unsignedBigInteger('content_element_id')->nullable()->change(); + }); + Schema::table('website_media_aliases', function (Blueprint $table) { + $table->foreign('content_element_id')->references('id')->on('content_elements')->nullOnDelete(); + }); + } + + public function down(): void + { + // Bewusst leer: Die gelockerten Fremdschlüssel schaden älterem Code nicht, und leere Zuordnungen + // (gelöschte Medien) ließen sich nicht in den strengeren Zustand zurückführen. + } +}; diff --git a/database/migrations/2026_11_21_140000_create_composition_still_sources.php b/database/migrations/2026_11_21_140000_create_composition_still_sources.php new file mode 100644 index 0000000..d2acbbd --- /dev/null +++ b/database/migrations/2026_11_21_140000_create_composition_still_sources.php @@ -0,0 +1,32 @@ +id(); + $table->foreignId('composition_id')->constrained('compositions')->cascadeOnDelete(); + $table->foreignId('still_element_id')->constrained('content_elements')->cascadeOnDelete(); + $table->string('source_key', 120); + $table->unsignedBigInteger('actor_id')->nullable(); + $table->timestamps(); + + $table->unique(['composition_id', 'source_key']); + }); + } + + public function down(): void + { + Schema::dropIfExists('composition_still_sources'); + } +}; diff --git a/database/seeders/ShopDemoSeeder.php b/database/seeders/ShopDemoSeeder.php new file mode 100644 index 0000000..1879933 --- /dev/null +++ b/database/seeders/ShopDemoSeeder.php @@ -0,0 +1,189 @@ +isProduction() || LicenseArticle::query()->where('code', 'shop-konflikte')->exists()) { + return; + } + + $content = app(ContentService::class); + $articles = app(ArticleService::class); + $bundles = app(BundleService::class); + $offers = app(OfferService::class); + $this->password = app()->runningUnitTests() + ? self::PASSWORD + : (getenv('LUF_DEMO_PASSWORD') ?: Str::random(24)); + $editor = $this->account('Demo Redaktion', 'shop-demo-redaktion@example.test'); + + [$konflikteVersion, $konflikteArticle] = $this->program( + $content, $articles, $editor, 'shop-konflikte', 'Konflikte im Training', + 'Wie Trainerinnen und Trainer Konflikte in der Gruppe ruhig und klar begleiten.', + 'Ein Film, ein Arbeitsblatt und eine Anleitung für sechs Trainingseinheiten.', + 'Konflikte erkennen, benennen und gemeinsam lösen.', + ); + [$grenzenVersion, $grenzenArticle] = $this->program( + $content, $articles, $editor, 'shop-grenzen', 'Grenzen setzen im Verein', + 'Sicher auftreten, Grenzen vermitteln und Kinder stärken.', + 'Film und Begleitmaterial für einen Übungsabend zu Grenzen und Respekt.', + 'Grenzen verständlich vermitteln.', + ); + [$starterVersion, $starterArticle] = $this->program( + $content, $articles, $editor, 'shop-starter', 'Starterpaket für neue Trainer', + 'Das Einstiegspaket mit beiden Programmen und einer Einführung für neue Trainerinnen und Trainer.', + 'Zusätzlich zu beiden Programmen enthält das Paket eine Einführung ins Konzept.', + 'Das Konzept kennenlernen.', + ); + + $privat = $offers->createRightsProfile('Privatlizenz ehrenamtlich', 'ehrenamtlich', [ + 'film' => ['streamen', 'laden'], + 'pdf' => ['ansehen', 'laden'], + ]); + $verein = $offers->createRightsProfile('Vereinslizenz institutionell', 'institutionell', [ + 'film' => ['streamen', 'laden'], + 'pdf' => ['ansehen', 'laden'], + ]); + + $this->offer($offers, 'Konflikte im Training: Privatlizenz', 'Privatlizenz', $konflikteVersion, [$konflikteArticle, $privat], 4900, 'person'); + $this->offer($offers, 'Konflikte im Training: Vereinslizenz', 'Mehrfachlizenz für Vereine', $konflikteVersion, [$konflikteArticle, $verein], 14900, 'organisation'); + $this->offer($offers, 'Grenzen setzen: Privatlizenz', 'Privatlizenz', $grenzenVersion, [$grenzenArticle, $privat], 2900, 'person'); + + $bundle = $bundles->create('Starterpaket'); + $starter = $bundles->publish($bundle, [$konflikteArticle->fresh(), $grenzenArticle->fresh(), $starterArticle->fresh()]); + $paket = $offers->create('Starterpaket: Privatlizenz'); + $offers->activate($paket, [['target' => $starter, 'rights' => $privat]], ['grant_kind' => 'kauf', 'price_cents' => 5900, 'holder_kind' => 'person']); + $offers->assignProduct($paket, $starterVersion->composition_id, 'Starterpaket (zwei Programme und Einführung)'); + + $tina = $this->account('Tina Trainerin', 'tina.trainerin@example.test'); + $vera = $this->account('Vera Vorstand', 'vera.vorstand@example.test'); + $max = $this->account('Max Mitglied', 'max.mitglied@example.test'); + $club = Party::query()->firstOrCreate( + ['type' => PartyType::Organisation, 'display_name' => 'Testverein Musterstadt e. V.'], + ); + Membership::query()->firstOrCreate(['user_id' => $vera->id, 'party_id' => $club->id], ['role' => 'org_admin', 'may_order' => true]); + Membership::query()->firstOrCreate(['user_id' => $max->id, 'party_id' => $club->id], ['role' => 'mitglied', 'may_order' => false]); + unset($tina); + + if (! app()->runningUnitTests()) { + $this->command?->info('Testkonten angelegt (tina.trainerin, vera.vorstand, max.mitglied und shop-demo-redaktion bei example.test). Passwort: '.($this->password)); + } + } + + /** + * Zwei Dateien (Film, Begleitmaterial) als Platzhalter im Speicher, ein Programm als Komposition mit + * Anzeigefreigabe und ein Lizenzartikel dazu. + * + * @return array{0: CompositionVersion, 1: LicenseArticle} + */ + private function program( + ContentService $content, + ArticleService $articles, + User $editor, + string $code, + string $title, + string $teaser, + string $summary, + string $goal, + ): array { + $disk = Storage::disk('media_derived'); + $disk->put('inhalte/'.$code.'/film.mp4', 'Platzhalter für den Film '.$title); + $disk->put('inhalte/'.$code.'/begleitmaterial.pdf', "%PDF-1.4\n% Platzhalter für das Begleitmaterial ".$title."\n%%EOF\n"); + + $film = $content->publishElementVersion( + $content->createElement('film', 'film', 'Film '.$title), + null, + ['file' => 'inhalte/'.$code.'/film.mp4'], + ); + $sheet = $content->publishElementVersion( + $content->createElement('pdf', 'pdf', 'Begleitmaterial '.$title), + null, + ['file' => 'inhalte/'.$code.'/begleitmaterial.pdf'], + ); + $composition = $content->createComposition($title); + $composition->editorial_content_kind_id = EditorialContentKind::query()->where('slug', 'programm')->value('id'); + $composition->display_title = $title; + $composition->teaser = $teaser; + $composition->summary = $summary; + $composition->save(); + $version = $content->publishComposition( + $composition, + [['role' => 'Film', 'target' => $film], ['role' => 'Begleitmaterial', 'target' => $sheet]], + null, + null, + ['learning_goal' => $goal], + ); + app(CompositionDisplayRelease::class)->release($version, $editor); + + $article = $articles->create($code, 'Testkauf'); + $article->working_title = $title; + $article->display_title = $title; + $article->save(); + $articles->publishRelease($article, $version, 'Programm für den Testkauf.'); + + return [$version, $article->fresh()]; + } + + /** + * @param array{0: LicenseArticle, 1: RightsProfileVersion} $line + */ + private function offer(OfferService $offers, string $name, string $label, CompositionVersion $version, array $line, int $cents, string $holder): Offer + { + $offer = $offers->create($name); + $offers->activate($offer, [['target' => $line[0], 'rights' => $line[1]]], [ + 'grant_kind' => 'kauf', + 'price_cents' => $cents, + 'holder_kind' => $holder, + ]); + $offers->assignProduct($offer, $version->composition_id, $label); + + return $offer; + } + + private function account(string $name, string $email): User + { + $existing = User::query()->where('email', $email)->first(); + + if ($existing !== null) { + return $existing; + } + + $user = app(RegisterAccount::class)->register($name, $email, (string) $this->password, true); + $user->forceFill(['email_verified_at' => now(), 'status' => AccountStatus::Aktiv])->save(); + + return $user; + } +} diff --git a/deploy/luf.env.example b/deploy/luf.env.example index 7ed4df9..45161db 100644 --- a/deploy/luf.env.example +++ b/deploy/luf.env.example @@ -27,7 +27,11 @@ MAIL_MAILER=log MAIL_FROM_ADDRESS="noreply@example.invalid" MAIL_FROM_NAME="${APP_NAME}" -# test bleibt der lokale Testweg. Ein echter Zahlungsdienst ist noch nicht festgelegt. +# test: lokaler Testweg ohne Anbieter. stripe: Stripe-Kasse, in Etappe 1 nur mit Testschlüsseln und nie in Produktion. +# Die Schlüssel stehen nur in /etc/luf/.env auf dem Server, nie im Repo. PAYMENT_DRIVER=test +# STRIPE_SECRET=sk_test_... (Entwickler > API-Schlüssel, Testmodus) +# STRIPE_WEBHOOK_SECRET=whsec_... (Entwickler > Webhooks > Endpunkt > Signiergeheimnis) +# STRIPE_TAX_RATE_ID=txr_... (optional: in Stripe angelegter, im Preis enthaltener Steuersatz) # Medienpfade setzt Compose auf den Host-Mount (/srv/luf//media/...). Hier nichts eintragen. diff --git a/docs/Brand-UI-Kit/02_design_tokens/tokens.css b/docs/Brand-UI-Kit/02_design_tokens/tokens.css new file mode 100644 index 0000000..c73c6e5 --- /dev/null +++ b/docs/Brand-UI-Kit/02_design_tokens/tokens.css @@ -0,0 +1,25 @@ +/* Lara & Felix – draft brand tokens; source imagery sampled 2026-11-15. + Do not treat these color values or fonts as final without approval. */ +:root { + --lf-navy: #032551; + --lf-navy-deep: #01244C; + --lf-green: #5B8625; + --lf-green-deep: #3B7B09; + --lf-yellow: #FCD10A; + --lf-cream: #F7F6F2; + --lf-white: #FFFFFF; + --lf-surface: #F9FAF7; + --lf-ink: #15243A; + --lf-muted: #5D6A78; + --lf-border: #DDE5E3; + --lf-focus: #1769AA; + --lf-error: #B92F38; + --lf-radius-sm: 8px; + --lf-radius-md: 14px; + --lf-radius-lg: 22px; + --lf-radius-pill: 999px; + --lf-shadow-card: 0 12px 30px rgb(3 37 81 / .07); + --lf-max-container: 1180px; + --lf-font-ui: "Nunito Sans", "Segoe UI", system-ui, sans-serif; + --lf-font-display: "Nunito", "Trebuchet MS", system-ui, sans-serif; +} diff --git a/docs/Brand-UI-Kit/02_design_tokens/tokens.json b/docs/Brand-UI-Kit/02_design_tokens/tokens.json new file mode 100644 index 0000000..22f1cf1 --- /dev/null +++ b/docs/Brand-UI-Kit/02_design_tokens/tokens.json @@ -0,0 +1,147 @@ +{ + "$schema": "https://design-tokens.github.io/community-group/format/", + "status": "working draft, needs formal brand approval", + "source": "sampled colors from uploaded title/denkpause, with supporting UI tokens chosen for accessibility", + "color": { + "navy": { + "$type": "color", + "$value": "#032551" + }, + "navy_deep": { + "$type": "color", + "$value": "#01244C" + }, + "green": { + "$type": "color", + "$value": "#5B8625" + }, + "green_deep": { + "$type": "color", + "$value": "#3B7B09" + }, + "yellow": { + "$type": "color", + "$value": "#FCD10A" + }, + "cream": { + "$type": "color", + "$value": "#F7F6F2" + }, + "white": { + "$type": "color", + "$value": "#FFFFFF" + }, + "surface": { + "$type": "color", + "$value": "#F9FAF7" + }, + "ink": { + "$type": "color", + "$value": "#15243A" + }, + "muted": { + "$type": "color", + "$value": "#5D6A78" + }, + "border": { + "$type": "color", + "$value": "#DDE5E3" + }, + "focus": { + "$type": "color", + "$value": "#1769AA" + }, + "error": { + "$type": "color", + "$value": "#B92F38" + } + }, + "radius": { + "sm": { + "$type": "dimension", + "$value": "8px" + }, + "md": { + "$type": "dimension", + "$value": "14px" + }, + "lg": { + "$type": "dimension", + "$value": "22px" + }, + "pill": { + "$type": "dimension", + "$value": "999px" + } + }, + "space": { + "1": { + "$type": "dimension", + "$value": "4px" + }, + "2": { + "$type": "dimension", + "$value": "8px" + }, + "3": { + "$type": "dimension", + "$value": "12px" + }, + "4": { + "$type": "dimension", + "$value": "16px" + }, + "5": { + "$type": "dimension", + "$value": "20px" + }, + "6": { + "$type": "dimension", + "$value": "24px" + }, + "7": { + "$type": "dimension", + "$value": "28px" + }, + "8": { + "$type": "dimension", + "$value": "32px" + }, + "9": { + "$type": "dimension", + "$value": "36px" + }, + "10": { + "$type": "dimension", + "$value": "40px" + }, + "11": { + "$type": "dimension", + "$value": "44px" + }, + "12": { + "$type": "dimension", + "$value": "48px" + }, + "13": { + "$type": "dimension", + "$value": "52px" + }, + "14": { + "$type": "dimension", + "$value": "56px" + }, + "15": { + "$type": "dimension", + "$value": "60px" + }, + "16": { + "$type": "dimension", + "$value": "64px" + } + }, + "typography": { + "display": "Rounded friendly display – select licensed font", + "body": "Highly readable sans – select licensed font" + } +} \ No newline at end of file diff --git a/docs/Brand-UI-Kit/03_svg_entwuerfe/favicon-monogram-entwurf.svg b/docs/Brand-UI-Kit/03_svg_entwuerfe/favicon-monogram-entwurf.svg new file mode 100644 index 0000000..2b754cd --- /dev/null +++ b/docs/Brand-UI-Kit/03_svg_entwuerfe/favicon-monogram-entwurf.svg @@ -0,0 +1 @@ +F \ No newline at end of file diff --git a/docs/Brand-UI-Kit/03_svg_entwuerfe/pause-hand.svg b/docs/Brand-UI-Kit/03_svg_entwuerfe/pause-hand.svg new file mode 100644 index 0000000..38fb5c6 --- /dev/null +++ b/docs/Brand-UI-Kit/03_svg_entwuerfe/pause-hand.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/Brand-UI-Kit/03_svg_entwuerfe/thought-bubble-outline.svg b/docs/Brand-UI-Kit/03_svg_entwuerfe/thought-bubble-outline.svg new file mode 100644 index 0000000..0646c8c --- /dev/null +++ b/docs/Brand-UI-Kit/03_svg_entwuerfe/thought-bubble-outline.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/Brand-UI-Kit/03_svg_entwuerfe/yellow-rays.svg b/docs/Brand-UI-Kit/03_svg_entwuerfe/yellow-rays.svg new file mode 100644 index 0000000..331f5c1 --- /dev/null +++ b/docs/Brand-UI-Kit/03_svg_entwuerfe/yellow-rays.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/Brand-UI-Kit/03_svg_entwuerfe/yellow-underline.svg b/docs/Brand-UI-Kit/03_svg_entwuerfe/yellow-underline.svg new file mode 100644 index 0000000..f048559 --- /dev/null +++ b/docs/Brand-UI-Kit/03_svg_entwuerfe/yellow-underline.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/Brand-UI-Kit/06_cursor_uebergabe/ANWEISUNG.md b/docs/Brand-UI-Kit/06_cursor_uebergabe/ANWEISUNG.md new file mode 100644 index 0000000..a163a6c --- /dev/null +++ b/docs/Brand-UI-Kit/06_cursor_uebergabe/ANWEISUNG.md @@ -0,0 +1,13 @@ +# Cursor-Übergabe: Brand & UI Kit + +**Noch nicht umsetzen, bevor der funktionale MVP praktisch überprüft und korrigiert wurde.** + +1. Lies `docs/prinzipien/design-prinzipien.md` und `docs/prinzipien/seo-und-content-prinzipien.md` sowie `CLAUDE.md`. +2. Nutze das Brand & UI Kit v1.0 als **Entwurfs- und Vergleichsmaterial**, nicht als unhinterfragte, finale Markenfreigabe. +3. Inventarisiere zuerst den tatsächlichen Stand des bestehenden Laravel/Filament-Frontends und der Originalmedien. +4. Mache mit den originalen Lara-&-Felix-Assets und einem ruhigen Erwachsenen-UI-Design konkrete Layoutvarianten. Die Denkpause wird gezielt didaktisch eingesetzt. +5. Übernehme nur explizit freigegebene Logo-, Typografie- und Farbvarianten. Markenfarben im Kit sind abgeleitete Vorschläge. +6. Bewahre die fachlich bestehende CMS-/Katalog-/Lizenzstruktur. Die statischen HTML-Screens sind keine technische Architekturvorgabe. +7. Alle öffentlichen Produkt- und SEO-Texte kommen aus dem echten Katalog/CMS; keine Demo-Preise, keine KI-erfundenen Filme, keine erfundenen Wirkungsversprechen. +8. Validierung: Screenshots in 390/768/1440 px, Tastatur, Kontrast, Reduced Motion, LCP/CLS, Auth-/Berechtigungsregressionen. +9. Kein Produktionsdeployment ohne die in `CLAUDE.md` vorgesehene Freigabe. diff --git a/docs/Brand-UI-Kit/06_cursor_uebergabe/design-prinzipien_vorlage_nutzer_2026-11-15.md b/docs/Brand-UI-Kit/06_cursor_uebergabe/design-prinzipien_vorlage_nutzer_2026-11-15.md new file mode 100644 index 0000000..76c8c86 --- /dev/null +++ b/docs/Brand-UI-Kit/06_cursor_uebergabe/design-prinzipien_vorlage_nutzer_2026-11-15.md @@ -0,0 +1,386 @@ +\# Lara \& Felix – Verbindliche Design- und UX-Anforderungen + + + +\## 1. Designqualität ist ein gleichrangiges Projektziel + + + +Die Benutzeroberfläche von Lara \& Felix muss gestalterisch, funktional und technisch dem Niveau einer hochwertigen, professionell entwickelten digitalen Plattform entsprechen. + + + +\*\*Ein gewöhnliches, erkennbar KI-generiertes Standardtemplate ist ausdrücklich nicht akzeptabel.\*\* + + + +Die Plattform muss eine eigenständige visuelle Identität besitzen, die konsistent über Marketing-Webseite, Anmeldung, Mitgliederbereich, Katalog, Bibliothek und Kursplayer umgesetzt wird. + + + +Designqualität ist ein verbindliches Abnahmekriterium und darf nicht zugunsten einer schnelleren rein funktionalen Implementierung entfallen. + + + +\## 2. Gestalterische Richtung + + + +Entwickle ein zeitgemäßes Premium-Design mit folgenden Eigenschaften: + + + +\- Eigenständige, wiedererkennbare Markenidentität + +\- Hochwertige Editorial-Typografie mit differenzierter Schriftgrößenhierarchie + +\- Bewusst gestaltete, teilweise asymmetrische Layouts + +\- Großzügige, aber funktional eingesetzte Weißräume + +\- Präzise abgestimmte Farben und Kontraste + +\- Hochwertige Bild- und Videointegration + +\- Professionelle, dezente Mikroanimationen + +\- Ausgefeilte Hover-, Fokus-, Lade- und Übergangszustände + +\- Konsistentes Erscheinungsbild über alle Bereiche + +\- Sehr gute Bedienbarkeit auf Smartphone, Tablet und Desktop + + + +Die Bildsprache soll selbstbewusst, freundlich, vertrauenswürdig und authentisch sein. + + + +Die Plattform richtet sich an erwachsene Trainer und pädagogische Fachkräfte. Das Design darf modern und emotional sein, soll aber nicht kindlich, verspielt oder sensationsorientiert wirken. + + + +Gewaltprävention ist ein ernsthaftes Bildungsthema. Vermeide dramatisierende Darstellungen von Gewalt oder Angst. + + + +\## 3. Austauschbares KI-Design ausdrücklich vermeiden + + + +Vermeide insbesondere: + + + +\- Beliebige Blau-Violett-Verläufe als dominantes Standardmotiv + +\- Austauschbare Hero-Sektionen mit generischen Marketingfloskeln + +\- Endlose Reihen identischer abgerundeter Karten + +\- Beliebige Stockfotos ohne inhaltlichen Bezug + +\- Dekorative Glaseffekte ohne funktionalen Nutzen + +\- Übertriebene Schatten und Leuchteffekte + +\- Belanglose, inflationär eingesetzte Icons + +\- Unnötige Animationen, die die Nutzung verlangsamen + +\- Generische SaaS-Dashboards ohne Bezug zum Lern- und Trainingskontext + +\- Einheitliche Standardlayouts auf jeder Seite + + + +Wichtig: Diese Stilmittel sind nicht grundsätzlich verboten. Sie sollen nur eingesetzt werden, wenn sie eine nachvollziehbare gestalterische Funktion erfüllen. + + + +\*\*Bevorzuge eine bewusst komponierte und differenzierte Gestaltung gegenüber einer Aneinanderreihung vorgefertigter UI-Komponenten.\*\* + + + +\## 4. Professionelles Designsystem + + + +Lege früh ein wiederverwendbares Designsystem an. + + + +Es soll enthalten: + + + +\- Farbpalette mit semantischen Design-Tokens + +\- Typografiesystem + +\- Abstands- und Rastersystem + +\- Responsive Layoutregeln + +\- Schaltflächen und Links + +\- Formulare und Eingabefelder + +\- Navigationselemente + +\- Karten, Listen und Inhaltsvorschauen + +\- Statusanzeigen und Rückmeldungen + +\- Modale Dialoge + +\- Lade-, Leer- und Fehlerzustände + +\- Animationen und Übergänge + + + +Dieses Designsystem gilt für die öffentliche Webseite und den Mitgliederbereich. + + + +Die interne Filament-Administration darf funktionaler gestaltet sein, soll aber eine saubere und konsistente Bedienung aufweisen. + + + +Nutze bestehende Komponentenbibliotheken, wo sie helfen. Die sichtbare Produktoberfläche darf dennoch nicht wie eine unveränderte Komponentenbibliothek aussehen. + + + +\## 5. Marketing-Webseite + + + +Die öffentliche Startseite soll wie der Auftritt einer eigenständigen, hochwertigen Bildungsmarke wirken. + + + +Besondere Aufmerksamkeit verdienen: + + + +\- Der erste sichtbare Bildschirmbereich + +\- Die visuelle Einführung in das Konzept + +\- Die Präsentation von Filmen und Materialien + +\- Die Erklärung des didaktischen Ansatzes + +\- Die Darstellung von Zielgruppen + +\- Übersichtliche Handlungsaufrufe + +\- Der Übergang zur Anmeldung beziehungsweise zum Mitgliederbereich + + + +Nutze die tatsächlich vorhandenen Lara-\&-Felix-Filme und ihre Bildwelt als Grundlage für die spätere Markenkommunikation, sofern passende freigegebene Assets verfügbar sind. + + + +Keine erfundenen Kundenbewertungen, Partnerlogos, Qualifikationen oder Wirkungsversprechen. + + + +\## 6. Mitgliederbereich + + + +Der Mitgliederbereich muss sich wie ein eigenständiges, hochwertiges digitales Produkt anfühlen. + + + +Die Oberfläche soll: + + + +\- Eine besonders übersichtliche Bibliothek bieten + +\- Filme, Übungen und Materialien visuell klar unterscheiden + +\- Unterschiedliche Inhaltsarten und Pakete verständlich darstellen + +\- Berechtigungen nachvollziehbar anzeigen + +\- Eine ausgezeichnete Suche und Orientierung ermöglichen + +\- Auch bei umfangreichen Inhaltsbeständen übersichtlich bleiben + +\- Einen besonders sorgfältig gestalteten Kursplayer besitzen + + + +Der Mitgliederbereich darf nicht einfach eine umbenannte Filament-Administrationsoberfläche sein. + + + +\## 7. Interaktionen und Feinschliff + + + +Implementiere durchdachte Mikrointeraktionen und visuelle Rückmeldungen. + + + +Dazu gehören beispielsweise: + + + +\- Konsistente Hover- und Fokuszustände + +\- Sanfte, gezielte Übergänge + +\- Verständliche Ladezustände + +\- Hochwertige leere Bibliotheksansichten + +\- Klare Erfolgsmeldungen und Fehlermeldungen + +\- Sinnvolle Tastaturinteraktionen + +\- Gute Formularvalidierung + +\- Keine unnötigen Layoutsprünge + + + +Animationen müssen bei aktivierter Einstellung `prefers-reduced-motion` entsprechend reduziert werden. + + + +\## 8. Zugänglichkeit und Performance + + + +Gestalterische Qualität darf nicht auf Kosten der Zugänglichkeit oder Geschwindigkeit entstehen. + + + +Richte dich nach WCAG 2.2 AA. + + + +Prüfe insbesondere: + + + +\- Kontraste + +\- Tastaturbedienbarkeit + +\- Sichtbare Fokuszustände + +\- Semantische Struktur + +\- Verständliche Formulare + +\- Responsives Verhalten + +\- Untertitel und Bedienelemente des Players + + + +Orientiere dich bei der Performance an den Core Web Vitals. + + + +Optimiere große Bilder und Videos, vermeide unnötiges JavaScript und achte auf stabile Layouts. + + + +\## 9. Verbindliche visuelle Qualitätssicherung + + + +\*\*Technisch erfolgreiche Tests allein reichen für den Abschluss einer Benutzeroberfläche nicht aus.\*\* + + + +Führe nach der Implementierung jedes wesentlichen Bildschirmbereichs eine visuelle Kontrolle durch. + + + +Prüfe mindestens: + + + +\- Desktop bei etwa 1440 Pixeln Breite + +\- Tablet bei etwa 768 Pixeln Breite + +\- Smartphone bei etwa 390 Pixeln Breite + + + +Kontrolliere gerenderte Screenshots beziehungsweise die tatsächliche Browserdarstellung, soweit die Entwicklungsumgebung dies ermöglicht. + + + +Achte auf: + + + +\- Typografische Qualität + +\- Ausgewogene Layouts + +\- Lesbarkeit + +\- Konsistente Abstände + +\- Bildzuschnitte + +\- Navigationsverhalten + +\- Interaktionszustände + +\- Visuelle Hierarchie + +\- Responsives Verhalten + + + +Beseitige erkennbare gestalterische Schwächen eigenständig. + + + +Behaupte keine visuelle Prüfung, wenn die Seite nicht tatsächlich gerendert und betrachtet wurde. + + + +\## 10. Umsetzung ohne zusätzliche Planungs-Gates + + + +Erarbeite vor der Gestaltung ein kompaktes visuelles Konzept und ein Designsystem. + + + +Setze dieses anschließend unmittelbar in der Anwendung um. + + + +\*\*Kein zusätzlicher Freigabe-Stopp für reine Designkonzepte.\*\* + + + +Die erste fachliche Abnahme erfolgt anhand der tatsächlich implementierten Marketing-Webseite und des Mitgliederbereichs. + + + +Überarbeite die Oberflächen eigenständig, bis sowohl die funktionalen als auch die gestalterischen Qualitätsziele erfüllt sind. + + + +Ein optisch generisches, offensichtlich unfertiges Frontend erfüllt den Entwicklungsauftrag nicht. + + + +\*\*Ziel ist eine individuelle, hochwertige, moderne und langfristig erweiterbare digitale Marke – nicht nur eine funktionierende Laravel-Anwendung.\*\* + diff --git a/docs/Brand-UI-Kit/07_branding_freigabe/01_webmarke_header_spezifikation_v1.1.md b/docs/Brand-UI-Kit/07_branding_freigabe/01_webmarke_header_spezifikation_v1.1.md new file mode 100644 index 0000000..4d9ee57 --- /dev/null +++ b/docs/Brand-UI-Kit/07_branding_freigabe/01_webmarke_header_spezifikation_v1.1.md @@ -0,0 +1,85 @@ +# Lara & Felix – Webmarke und globaler Header | Designfreigabe-Vorlage v1.1 + +**Datum:** 18.11.2026 +**Status:** Zur fachlichen/visuellen Freigabe vorgeschlagen; keine automatische Markenfreigabe. +**Basis:** Brand & UI Kit v1.0, Originalmotive, `design-prinzipien.md`, bestehendes CMS. + +## A. Gesicherter Bestand + +- Die sechs Bilder unter `01_originale/` sind Quellen/Referenzen und unverändert; ihre Freigabe zur öffentlichen Verwendung ist im Quellenmanifest nicht bestätigt. +- Die eigentliche Lara-&-Felix-Wortmarke ist in Titel-/Outro-Motiven enthalten, aber **nicht als isolierte, offiziell freigegebene Logo-Datei** vorhanden. +- Die SVG-Datei `favicon-monogram-entwurf.svg` ist ausdrücklich **kein** freigegebenes Logo. +- `02_design_tokens/` enthält Arbeitswerte, keine formal freigegebene Markenpalette. +- Der visuelle Homepage-Entwurf ist eine Gestaltungsreferenz. Der statische HTML-Prototyp ist keine Produktionsarchitektur. + +## B. Weblogo: vorgeschlagene freizugebende Varianten + +**W1 – Primäre farbige Wortmarke** +- Originalwirkung der Lara-&-Felix-Wortmarke mit grüner Zeile „Stark im Alltag“ und gezieltem gelbem Akzent erhalten. +- Für helle Headerflächen; als sauberes, separat exportiertes Asset, bevorzugt SVG **nur bei originalgetreuer Freigabe**, alternativ hochauflösendes transparentes PNG/WebP. +- Keine Neuschöpfung oder freie KI-Nachzeichnung. Im Originalmotiv enthaltene Hintergründe nicht als Logo-Hintergrund mit ausschneiden. + +**W2 – Kompaktvariante für Sticky-/Mobile-Header** +- Gleiche Markenidentität, aber kleinere Mindestabmessungen und geprüfte Lesbarkeit. +- Vorzug: identische Wortmarke mit korrekten Proportionen. Nur wenn diese in kleinen Größen unlesbar ist, eine gesondert freizugebende vereinfachte Variante. +- Kein neues L&F-Monogramm ohne Freigabe. + +**W3 – Negativ-/Footer-Variante** +- Auf Navy kontrastreich, markentreu und aus demselben Original abgeleitet; nicht pauschal invertieren, wenn gelbe/grüne Details dadurch verändert werden. + +### Noch zu entscheiden +- Gibt es eine separierte Original-Logodatei aus dem Filmprojekt? +- Wird die Trennung der Wortmarke aus dem Titelbild als **originalgetreue Asset-Aufbereitung** freigegeben? +- Welche Varianten W1/W2/W3 sind nach Sichtprüfung verbindlich? + +## C. Stabiler Header: funktionale Spezifikation + +1. **Ein globaler Header für alle öffentlichen CMS-Seiten**, keine separaten pro-Seite-Header. +2. Header-Inhalt orientiert sich an **demselben horizontalen Markenraster auf jeder Seite**; seine Nutzbreite bleibt unabhängig von Seitentitel, Navigationseintrag und Scrollbar stabil. +3. **Desktop initial:** sichtbare originale Wortmarke links; CMS-Navigation als mittlere Funktionszone; Konto-/später Warenkorb-Aktionen rechts. Keine ungeplanten Umbrüche der Navigation. +4. **Desktop kompakt/sticky:** geringere definierte Höhe; Wortmarke proportional kleiner; Navigation und Aktionen stabil. Zustandswechsel allein scrollabhängig, ohne Layoutsprung des Inhalts; CSS/JS technisch mit reservierter Headerfläche oder vergleichbarem stabilen Mechanismus. +5. **Mobil:** kompakter Top-Header mit Wortmarke, Menü und Mitgliedszugang. Öffentlich keine Bottom-Navigation. Hauptmenü als zugängliches Overlay/Drawer. +6. **Kein seitenabhängiges „Wackeln“:** identische Logo-x-Position und definierte Headerhöhe je Zustand; aktive Nav-Markierung belegt keinen zusätzlichen Platz und ändert keine Breite. +7. **Barrierefreiheit:** Tastatur-/Fokusbedienung, korrekte aria-Zustände, ausreichende Touchflächen, Kontrast, `prefers-reduced-motion`. +8. **Browserabnahme:** Wechsel zwischen Start-, Themen-, kurzer und langer Seite bei 390/768/1440/1920 px und Browserzoom 100 %; kontrollierter Scrolltest, Prüfung auf Layoutverschiebungen. + +## D. Globale Seitenbreiten + +- Hintergründe: **Full Bleed** bis zum Fensterrand möglich. +- **Breit** für Hero und Editorial-Bilder: vorläufig maximal etwa 1440 px. +- **Standard** für gemischte Inhaltsabschnitte: vorläufig etwa 1200 px. +- **Lesebereich** für lange Texte: etwa 720–800 px. +- Definierte responsive Seitenränder und gemeinsame zentral gepflegte Tokens, nicht pro Seite CSS-Sonderfälle. +- Die CMS-Einstellungen „Schmal“, „Standard“, „Breit“, „Vollbreite“ müssen diese Semantik tatsächlich abbilden; keine fixierten Pixeldimensionen für alle Bildschirmgrößen. +- Werte sind **Abnahmevorschläge**; Endwerte anhand echter Seite und vorhandener Marke testen. + +## E. Wiederkehrende Markensignaturen + +- Gelbe Unterstreichungen und kurze Signalstrahlen aus `03_svg_entwuerfe/` als **optionale** grafische Mittel; nicht als dekoratives Dauerrauschen. +- Grüner Akzent für Themen/CTA nach Kontrastprüfung. +- Denkpause-Hand und Denkblase **nur** im passenden didaktischen Kontext. +- Keine neuen Pflanzenmotive oder fremde Markenwelt; Originalfiguren nur nach Freigabe. + +## F. Freigabematrix + +| Gegenstand | Status | Nächster Prüfschritt | +|---|---|---| +| Wortmarke aus Originalmotiven | Quelle vorhanden, isoliertes Asset fehlt | Originalgetreue Extraktion/Export vorführen | +| Mobile Kompaktmarke | Konzeptioneller Vorschlag | Visueller Vergleich bei Zielgrößen | +| Footer-Negativmarke | Konzeptioneller Vorschlag | Kontrast-/Originaltreue-Test | +| Navy/Grün/Gelb/Creme | Token-Entwürfe | Markenfarben explizit abnehmen | +| Nunito/Nunito Sans | Schriftvorschläge | Lesbarkeit, Lizenz, lokale Bereitstellung prüfen | +| Header normal/kompakt | Funktional beschlossen, Gestaltung offen | Zwei Zustände mit Originalmarke im Browser prüfen | +| Seitenbreiten | Semantisches Konzept beschlossen, Zahlen vorläufig | 390/768/1440/1920 px prüfen | +| Gelbe Signaturen | SVG-Entwurf | Dosierung und Einsatzbeispiele freigeben | + +## G. Grenzen zur laufenden CMS-Implementierung + +- Die vorhandene Widget-Registry und das Abschnitts-/Slot-Modell bleiben maßgeblich. +- Header und Footer sind **globale Layoutkomponenten**, keine frei kopierten CMS-Widgets. +- Die öffentliche Seitennavigation bleibt CMS-gesteuert, die Mitgliederbibliothek behält eine eigene fachliche Navigation. +- Diese Spezifikation gibt keine öffentlichen Medien, Firmenangaben, Produkte, Lizenzen oder Kurse frei. + +## H. Empfohlene nächste Designabnahme + +**Erst** zwei bis drei echte Headerzustände mit Original- bzw. nachvollziehbar vorläufiger Wortmarke sichtbar machen (Desktop initial, Desktop sticky, Mobil); dabei Logo-Originaltreue, Breitenraster und Stabilität prüfen. Danach Hero- und Karten-Familien im selben Markensystem ausarbeiten. Keine erneute CMS-Architekturarbeit. diff --git a/docs/Brand-UI-Kit/07_branding_freigabe/README.md b/docs/Brand-UI-Kit/07_branding_freigabe/README.md new file mode 100644 index 0000000..fdd27cb --- /dev/null +++ b/docs/Brand-UI-Kit/07_branding_freigabe/README.md @@ -0,0 +1,3 @@ +# Brand & UI Kit – Ergänzung v1.1 + +Diese Ergänzung enthält eine **Freigabevorlage** zu Weblogo und globalem Header. Die Originaldateien des v1.0-Kits sind unverändert übernommen. Das Dokument ist kein Nachweis einer formalen Markenfreigabe. diff --git a/docs/Brand-UI-Kit/08_freigegebene_logovarianten/README.md b/docs/Brand-UI-Kit/08_freigegebene_logovarianten/README.md new file mode 100644 index 0000000..9d27799 --- /dev/null +++ b/docs/Brand-UI-Kit/08_freigegebene_logovarianten/README.md @@ -0,0 +1,10 @@ +# Freigegebene Logo-Gestaltungsrichtung – Stand 18.11.2026 + +Die Freigabe im Chat betrifft die zuletzt dargestellte Wortmarken-Gestaltung. Hier liegen zwei **Rastergrößen** derselben Wortmarke: `standard` für großflächige Darstellung und `kompakt` für kleinere Einbindungen. Schriftgestaltung und Layout bleiben unverändert. + +- `logo_lara_felix_standard.png`: volle Auflösung, Bildfassung der freigegebenen Darstellung. +- `logo_lara_felix_kompakt.png`: proportional verkleinerte Variante, keine neu gezeichnete Schrift. + +**Technischer Vorbehalt:** Diese Dateien enthalten den ursprünglich generierten **dunklen Hintergrund**. Sie sind keine freigestellten transparenten Logos oder Vektordateien und dürfen nicht als solche bezeichnet werden. Für einen hellen Website-Header ist die freigestellte Fassung weiterhin herzustellen und gesondert visuell zu prüfen. Die beiden Dateien sind verwertbare Original-Referenzbilder für die Design-Umsetzung, nicht bereits finale transparente Weblogos. + +Die SVG-Strahlen und die gelbe Unterstreichung unter `03_svg_entwuerfe/` bleiben eigenständige Grafikressourcen. Keine nachträgliche Neuzeichnung als Logo. diff --git a/docs/Brand-UI-Kit/08_freigegebene_logovarianten/logo_lara_felix_kompakt.png b/docs/Brand-UI-Kit/08_freigegebene_logovarianten/logo_lara_felix_kompakt.png new file mode 100644 index 0000000..d7beb8e Binary files /dev/null and b/docs/Brand-UI-Kit/08_freigegebene_logovarianten/logo_lara_felix_kompakt.png differ diff --git a/docs/Brand-UI-Kit/08_freigegebene_logovarianten/logo_lara_felix_standard.png b/docs/Brand-UI-Kit/08_freigegebene_logovarianten/logo_lara_felix_standard.png new file mode 100644 index 0000000..3640560 Binary files /dev/null and b/docs/Brand-UI-Kit/08_freigegebene_logovarianten/logo_lara_felix_standard.png differ diff --git a/docs/Brand-UI-Kit/09_hero_widget/README.md b/docs/Brand-UI-Kit/09_hero_widget/README.md new file mode 100644 index 0000000..94476e9 --- /dev/null +++ b/docs/Brand-UI-Kit/09_hero_widget/README.md @@ -0,0 +1,21 @@ +# Lara & Felix – Hero-Widget v1.3 (Design-Arbeitsstand) + +## Direkt ansehen +`09_hero_widget/preview/index.html` im Browser öffnen. Diese Vorschau ist interaktiv: Titel, Text, Buttontexte, Variante und Bildfokus ändern sich unmittelbar. Die beiden Buttons führen absichtlich nur zu einem Demo-Anker. + +## Enthalten +- `assets/lara-felix-park-original.png`: **unverändert übernommene Kling-Datei**, Figuren nicht neu generiert. +- `assets/lara-felix-park-hero.webp`: effiziente 1:1-Konvertierung derselben Aufnahme. +- `assets/yellow-rays.svg`, `yellow-underline.svg`: unveränderte Entwurfsassets aus dem Brand-Kit. +- `components/lf-hero.css`: isolierte responsive Komponente. +- `components/widget-contract.json`: vorgeschlagene CMS-Felder/Varianten. +- `preview/index.html`: eigenständige HTML-Demo mit veränderbaren Eingaben. + +## CMS-Integration +Die vorhandene zentrale Widget-Registry soll die Felder nach `components/widget-contract.json` abbilden. HTML-Preview ist **kein zweiter Editor** und kein Ersatz der bestehenden Blade-Komponente. Text serverseitig escapen; URL-Schema prüfen; nur öffentlich freigegebene Medien als Bildquelle nutzen. Die vorhandene Laravel-/Filament-Speicherung und Medienberechtigungen beibehalten. + +## Freigabestatus +**Vorlage/Designvorschlag**, nicht fachlich bzw. produktiv freigegeben. Das Kling-Motiv wurde vom Nutzer bereitgestellt; eine eigenständige öffentliche Asset-Freigabe ist nicht automatisch vorausgesetzt. Demo-Texte und Links sind Platzhalter. Die Figuren wurden beim Bau dieses Pakets nicht verändert. + +## Responsive Verhalten +Ab 850px Bild als große Hintergrundfläche, Texte vor hellem Verlauf links. Auf schmalen Screens Bild oberhalb der Textfläche, mit steuerbarer Objektposition; keine über das Bild gerenderte Überschrift. diff --git a/docs/Brand-UI-Kit/09_hero_widget/assets/lara-felix-park-hero.webp b/docs/Brand-UI-Kit/09_hero_widget/assets/lara-felix-park-hero.webp new file mode 100644 index 0000000..96f3dc3 Binary files /dev/null and b/docs/Brand-UI-Kit/09_hero_widget/assets/lara-felix-park-hero.webp differ diff --git a/docs/Brand-UI-Kit/09_hero_widget/assets/yellow-rays.svg b/docs/Brand-UI-Kit/09_hero_widget/assets/yellow-rays.svg new file mode 100644 index 0000000..331f5c1 --- /dev/null +++ b/docs/Brand-UI-Kit/09_hero_widget/assets/yellow-rays.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/Brand-UI-Kit/09_hero_widget/assets/yellow-underline.svg b/docs/Brand-UI-Kit/09_hero_widget/assets/yellow-underline.svg new file mode 100644 index 0000000..f048559 --- /dev/null +++ b/docs/Brand-UI-Kit/09_hero_widget/assets/yellow-underline.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/Brand-UI-Kit/09_hero_widget/components/lf-hero.css b/docs/Brand-UI-Kit/09_hero_widget/components/lf-hero.css new file mode 100644 index 0000000..a748305 --- /dev/null +++ b/docs/Brand-UI-Kit/09_hero_widget/components/lf-hero.css @@ -0,0 +1,9 @@ +/* Lara & Felix brand hero v1.3: standalone CSS, scoped to lf-hero. */ +.lf-hero{--lf-navy:#032551;--lf-green:#3B7B09;--lf-yellow:#FCD10A;--lf-cream:#F7F6F2;isolation:isolate;position:relative;overflow:hidden;border-radius:clamp(1rem,2.5vw,1.75rem);min-height:clamp(430px,43vw,650px);display:grid;align-items:center;background:var(--lf-cream);font-family:Nunito,'Trebuchet MS',system-ui,sans-serif;color:var(--lf-navy)} +.lf-hero *{box-sizing:border-box}.lf-hero__photo{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;object-position:68% center;z-index:-2}.lf-hero__photo[data-focus="right"]{object-position:80% center}.lf-hero__photo[data-focus="center-right"]{object-position:68% center}.lf-hero__photo[data-focus="center-left"]{object-position:35% center}.lf-hero__photo[data-focus="center"]{object-position:center} +.lf-hero--photo-split::before{content:'';position:absolute;inset:0;z-index:-1;background:linear-gradient(90deg,rgba(250,249,243,.99) 0%,rgba(250,249,243,.97) 25%,rgba(250,249,243,.8) 39%,rgba(250,249,243,.20) 56%,rgba(250,249,243,0) 68%)} +.lf-hero--editorial-solid{background:var(--lf-navy);color:white;min-height:350px}.lf-hero--editorial-solid .lf-hero__photo{display:none}.lf-hero--editorial-solid::before{content:'';position:absolute;width:55%;aspect-ratio:1;right:-25%;bottom:-75%;background:var(--lf-green);border-radius:50%;opacity:.75;z-index:-1} +.lf-hero__inner{width:min(100%,1440px);margin:auto;padding:clamp(2rem,5vw,5rem);padding-block:clamp(3rem,6vw,5.5rem)}.lf-hero__copy{max-width:min(620px,57%)}.lf-hero__eyebrow{display:inline-block;padding:.35em .75em;border-radius:999px;background:#dff0c0;color:#17370b;font-weight:800;font-size:clamp(.8rem,.95vw,1rem)}.lf-hero__title{margin:.22em 0 .28em;font-size:clamp(2.5rem,4.8vw,5.25rem);line-height:1.05;letter-spacing:-.035em;font-weight:900;text-wrap:balance}.lf-hero__title-accent{width:clamp(110px,19vw,245px);height:7px;background:var(--lf-yellow);border-radius:90% 30% 45% 25%;transform:rotate(-1deg);margin-bottom:1.5rem}.lf-hero__description{max-width:56ch;font-size:clamp(1.05rem,1.45vw,1.35rem);line-height:1.48;margin:0 0 2rem}.lf-hero__actions{display:flex;gap:.8rem;flex-wrap:wrap}.lf-hero__button{display:inline-flex;align-items:center;justify-content:center;min-height:48px;padding:.8rem 1.25rem;border-radius:999px;text-decoration:none;font-weight:800;line-height:1.2;transition:transform .15s ease,background .15s ease;box-shadow:none}.lf-hero__button:hover{transform:translateY(-2px)}.lf-hero__button:focus-visible{outline:3px solid #1769aa;outline-offset:3px}.lf-hero__button--primary{background:var(--lf-green);color:#fff}.lf-hero__button--secondary{background:rgba(255,255,255,.92);color:var(--lf-navy);border:2px solid var(--lf-navy)}.lf-hero--editorial-solid .lf-hero__button--secondary{border-color:white}.lf-hero__bottom{position:absolute;inset:auto 0 0;height:17px;background:linear-gradient(105deg,var(--lf-yellow) 0%,var(--lf-yellow) 22%,var(--lf-green) 72%);clip-path:polygon(0 45%,30% 90%,65% 75%,100% 0,100% 100%,0 100%)} +@media(max-width:850px){.lf-hero{min-height:unset;display:block}.lf-hero__photo{position:relative;display:block;width:100%;height:clamp(260px,53vw,440px);object-position:72% center}.lf-hero--photo-split::before{display:none}.lf-hero__inner{padding:2rem 1.5rem 2.8rem}.lf-hero__copy{max-width:100%}.lf-hero__title{font-size:clamp(2.15rem,7vw,3.6rem)}.lf-hero__description{font-size:1.05rem}.lf-hero--editorial-solid .lf-hero__copy{max-width:650px}} +@media(max-width:420px){.lf-hero__photo{height:300px;object-position:72% center}.lf-hero__actions{display:grid;grid-template-columns:1fr}.lf-hero__button{width:100%}.lf-hero__inner{padding-inline:1.25rem}} +@media(prefers-reduced-motion:reduce){.lf-hero__button{transition:none}.lf-hero__button:hover{transform:none}} diff --git a/docs/Brand-UI-Kit/09_hero_widget/components/widget-contract.json b/docs/Brand-UI-Kit/09_hero_widget/components/widget-contract.json new file mode 100644 index 0000000..a08b62e --- /dev/null +++ b/docs/Brand-UI-Kit/09_hero_widget/components/widget-contract.json @@ -0,0 +1,85 @@ +{ + "id": "lf-brand-hero", + "version": 1, + "status": "design candidate; not yet final code approval", + "purpose": "CMS-wiederverwendbarer Marken-Hero; Darstellung und Inhalt getrennt", + "layout_role": "single widget, full 4/4 slot recommended, minimum container width 320px", + "variants": [ + "photo-split", + "editorial-solid" + ], + "fields": { + "eyebrow": { + "type": "string", + "optional": true + }, + "title": { + "type": "string", + "required": true + }, + "description": { + "type": "text", + "optional": true + }, + "image": { + "type": "public_media_reference", + "optional": true, + "note": "Use approved public images, never member-restricted media" + }, + "image_alt": { + "type": "string", + "optional": true, + "note": "Meaningful if content image; alt empty if decorative" + }, + "image_focal_point": { + "type": "enum", + "values": [ + "center", + "center-right", + "right", + "center-left" + ], + "default": "center-right" + }, + "variant": { + "type": "enum", + "values": [ + "photo-split", + "editorial-solid" + ], + "default": "photo-split" + }, + "primary_cta": { + "type": "link", + "optional": true, + "fields": [ + "label", + "url" + ] + }, + "secondary_cta": { + "type": "link", + "optional": true, + "fields": [ + "label", + "url" + ] + }, + "accent": { + "type": "enum", + "values": [ + "underline", + "rays", + "none" + ], + "default": "underline" + } + }, + "security": [ + "use public media authorization logic", + "escape textual fields by default", + "validate destinations and block unsafe URL schemes", + "no fake purchasable products or rights" + ], + "integration": "Map fields to existing central Widget Registry; no separate schema or media database" +} \ No newline at end of file diff --git a/docs/Brand-UI-Kit/09_hero_widget/preview/index.html b/docs/Brand-UI-Kit/09_hero_widget/preview/index.html new file mode 100644 index 0000000..be9b212 --- /dev/null +++ b/docs/Brand-UI-Kit/09_hero_widget/preview/index.html @@ -0,0 +1 @@ +Lara & Felix – Hero Komponenten-Vorschau

Lara & Felix – konfigurierbarer Hero (Arbeitsstand)

Echtes Kling-Motiv unverändert verwendet. Text, CTA, Hintergrundvariante und Bildfokus sind unabhängig vom Bild editierbar. Dies ist ein statischer Demonstrator, noch keine Laravel-/Filament-Implementierung.

Lara und Felix stehen gemeinsam in einem Park
Lara & Felix · Stark im Alltag

Kinder stark im Alltag

Alltagsnahe Filme, Übungen und didaktische Materialien für die Präventionsarbeit mit Kindern.

Demo-Links sind absichtlich nicht mit realen Zielseiten verbunden. Bildrechte und öffentliche Freigabe im CMS prüfen. Auf Mobilgeräten wird das Foto oberhalb des Textes gezeigt, damit Gesichter nicht durch eine Textüberlagerung verdeckt werden.

\ No newline at end of file diff --git a/docs/Brand-UI-Kit/10_bild_text_widget/README.md b/docs/Brand-UI-Kit/10_bild_text_widget/README.md new file mode 100644 index 0000000..7421678 --- /dev/null +++ b/docs/Brand-UI-Kit/10_bild_text_widget/README.md @@ -0,0 +1,11 @@ +# Lara & Felix – Bild & Text (Designentwurf v1.4) + +Öffne `preview/index.html`. Die Vorschau funktioniert lokal ohne Server. + +**Lieferumfang:** HTML-Demo, separates CSS, Original-Kling-Bild als WebP, JSON-Feldvertrag. + +**Varianten:** Bild links/rechts; creme/transparente/Navy-Fläche; responsive Aufteilung anhand Slotbreite. + +**Status:** Gestalterischer Arbeitsstand, noch nicht vom Auftraggeber freigegeben und nicht in Laravel/Filament integriert. Text ist Demonstrationsinhalt, keine abgestimmte Website-Redaktion. + +**Integration:** An bestehende CMS-Widget-Registry anschließen; vorhandene Medienauswahl nutzen. Kein neues Datenmodell. Widget-Klasse, Formularfelder und Blade-View müssen im Repository passend angelegt werden. Originales Foto bleibt als eigenständiges Bild erhalten. diff --git a/docs/Brand-UI-Kit/10_bild_text_widget/assets/lara-felix-park.webp b/docs/Brand-UI-Kit/10_bild_text_widget/assets/lara-felix-park.webp new file mode 100644 index 0000000..e5fd719 Binary files /dev/null and b/docs/Brand-UI-Kit/10_bild_text_widget/assets/lara-felix-park.webp differ diff --git a/docs/Brand-UI-Kit/10_bild_text_widget/assets/yellow-underline.svg b/docs/Brand-UI-Kit/10_bild_text_widget/assets/yellow-underline.svg new file mode 100644 index 0000000..f048559 --- /dev/null +++ b/docs/Brand-UI-Kit/10_bild_text_widget/assets/yellow-underline.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/Brand-UI-Kit/10_bild_text_widget/components/lf-bild-text.css b/docs/Brand-UI-Kit/10_bild_text_widget/components/lf-bild-text.css new file mode 100644 index 0000000..69889f5 --- /dev/null +++ b/docs/Brand-UI-Kit/10_bild_text_widget/components/lf-bild-text.css @@ -0,0 +1,54 @@ +/* Lara & Felix | Bild-und-Text-Widget | Design-Arbeitsstand v1.4 */ +:root{ + --lf-navy:#032551; --lf-green:#3B7B09; --lf-yellow:#FCD10A; --lf-cream:#F7F6F2; + --lf-ink:#032551; --lf-muted:#46556B; --lf-radius:24px; + --lf-font: "Nunito Sans", "Arial", system-ui, sans-serif; +} +.lf-bt-host{container-type:inline-size;container-name:lf-bildtext;width:100%;} +.lf-bt{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.04fr);gap:clamp(24px,4vw,76px);align-items:center; + min-width:0;color:var(--lf-navy);border-radius:28px;padding:clamp(22px,4.4vw,72px);background:var(--lf-cream); + font-family:var(--lf-font);isolation:isolate;overflow:hidden;} +.lf-bt--clear{background:transparent;} +.lf-bt--navy{background:var(--lf-navy);color:#fff;} +.lf-bt--navy .lf-bt__text{color:#f3f6fa;} +.lf-bt--navy .lf-bt__eyebrow{color:#fdf4b7;} +.lf-bt--image-left .lf-bt__media{order:-1;} +.lf-bt__copy{min-width:0;max-width:640px;} +.lf-bt__eyebrow{display:inline-flex;align-items:center;gap:9px;color:#295b08;font-weight:850; + letter-spacing:.095em;font-size:clamp(11px,.95vw,13px);text-transform:uppercase;margin-bottom:20px;} +.lf-bt__eyebrow:before{content:"";display:block;width:25px;height:4px;background:var(--lf-yellow);border-radius:99px;} +.lf-bt__headline{font-size:clamp(32px,3.2vw,56px);line-height:1.1;letter-spacing:-.035em;font-weight:850; + margin:0 0 23px;max-width:660px;} +.lf-bt__accent{width:112px;height:7px;background:var(--lf-yellow);border-radius:90% 40% 80% 40%;margin: -8px 0 26px 3px;transform:rotate(-1deg);} +.lf-bt__text{font-size:clamp(16px,1.12vw,20px);line-height:1.65;margin:0 0 30px;color:var(--lf-muted);max-width:580px;} +.lf-bt__actions{display:flex;align-items:center;gap:12px;flex-wrap:wrap;} +.lf-bt__button{display:inline-flex;align-items:center;gap:13px;padding:13px 22px;background:var(--lf-green);color:white; + border:2px solid var(--lf-green);font-weight:800;text-decoration:none;border-radius:100px;min-height:50px;font-size:15px; + transition:transform .12s ease,background .12s ease;} +.lf-bt__button:hover{background:#285a06;transform:translateY(-1px)} +.lf-bt__button:focus-visible{outline:3px solid var(--lf-yellow);outline-offset:4px;} +.lf-bt__button--secondary{background:transparent;color:inherit;border-color:currentColor;} +.lf-bt__button--secondary:hover{background:rgba(255,255,255,.09)} +.lf-bt__media{position:relative;min-width:0;align-self:stretch;display:flex;align-items:stretch;} +.lf-bt__photo{display:block;width:100%;height:100%;min-height:365px;max-height:650px;object-fit:cover;object-position:var(--lf-object-position,64% center); + border-radius:22px;box-shadow:0 20px 42px rgba(3,37,81,.12);position:relative;z-index:1;} +.lf-bt__media:before{content:"";position:absolute;inset:auto -13px -13px 28px;height:55%;background:#8ab848; + border-radius:25px;z-index:0;transform:rotate(1.8deg);} +.lf-bt--navy .lf-bt__media:before{background:var(--lf-yellow);} +.lf-bt__media-label{position:absolute;z-index:2;left:20px;bottom:20px;background:#fff;color:var(--lf-navy); + padding:9px 14px;border-radius:14px;font-size:13px;font-weight:850;box-shadow:0 8px 24px rgba(3,37,81,.15);} +@container lf-bildtext (max-width: 780px){ + .lf-bt{grid-template-columns:1fr;padding:clamp(20px,4vw,36px);gap:25px;border-radius:19px;} + .lf-bt__media,.lf-bt--image-left .lf-bt__media{order:-1;} + .lf-bt__photo{min-height:0;aspect-ratio:1.45 / 1;max-height:430px;} + .lf-bt__headline{font-size:clamp(28px,5.7cqw,42px);margin-bottom:17px;} + .lf-bt__text{font-size:16px;} + .lf-bt__media:before{inset:auto -8px -8px 25px;} +} +@container lf-bildtext (max-width: 450px){ + .lf-bt__photo{aspect-ratio:1.45 / 1;object-position:right center;} + .lf-bt__actions{display:grid;} + .lf-bt__button{justify-content:center;width:100%;box-sizing:border-box;} + .lf-bt__media-label{font-size:11px;left:10px;bottom:10px;} +} +@media (prefers-reduced-motion:reduce){.lf-bt__button{transition:none}.lf-bt__button:hover{transform:none}} diff --git a/docs/Brand-UI-Kit/10_bild_text_widget/components/widget-contract.json b/docs/Brand-UI-Kit/10_bild_text_widget/components/widget-contract.json new file mode 100644 index 0000000..2a17e18 --- /dev/null +++ b/docs/Brand-UI-Kit/10_bild_text_widget/components/widget-contract.json @@ -0,0 +1,60 @@ +{ + "widget_id": "lf-editorial-bild-text", + "version": 1, + "status": "design-draft, not integrated with Laravel", + "layout_scope": "one CMS widget slot, width-responsive through container queries", + "fields": { + "eyebrow": { + "type": "string", + "optional": true + }, + "headline": { + "type": "string", + "required": true + }, + "body": { + "type": "richtext", + "required": true + }, + "image_reference": { + "type": "public-media-reference", + "required": true + }, + "image_alt": { + "type": "string", + "required": true + }, + "image_focus": { + "type": "focal_point", + "optional": true + }, + "primary_cta": { + "type": "internal-link+label", + "optional": true + }, + "secondary_cta": { + "type": "internal-link+label", + "optional": true + } + }, + "variant_fields": { + "image_side": [ + "left", + "right" + ], + "surface": [ + "cream", + "clear", + "navy" + ] + }, + "assets": { + "demo_image": "assets/lara-felix-park.webp", + "accent": "assets/yellow-underline.svg" + }, + "notes": [ + "Uses publicly permitted images only in public version; protection must be checked in Laravel", + "Front-end markup and CSS are a portable preview, not a Filament widget implementation", + "No content copied into separate program/module model" + ] +} \ No newline at end of file diff --git a/docs/Brand-UI-Kit/10_bild_text_widget/preview/desktop.png b/docs/Brand-UI-Kit/10_bild_text_widget/preview/desktop.png new file mode 100644 index 0000000..d6996dd Binary files /dev/null and b/docs/Brand-UI-Kit/10_bild_text_widget/preview/desktop.png differ diff --git a/docs/Brand-UI-Kit/10_bild_text_widget/preview/index.html b/docs/Brand-UI-Kit/10_bild_text_widget/preview/index.html new file mode 100644 index 0000000..e075258 --- /dev/null +++ b/docs/Brand-UI-Kit/10_bild_text_widget/preview/index.html @@ -0,0 +1,39 @@ + +Lara & Felix – Bild & Text | Komponenten-Vorschau + + +
Lara & Felix · Bild & Text + + +
+

Variante A · Redaktionelle Bild-Text-Komposition

Ändere oben die Optionen. Bild, Text, Button und Farbfläche sind getrennte Elemente.

+
+
+
Lara & Felix · Unser Ansatz +

Geschichten, die Kinder zum Mitdenken bringen.

+

Die Filme zeigen Situationen aus dem Alltag. Trainerinnen und Trainer können sie mit Gesprächen, Übungen und weiteren Materialien in ihrer Präventionsarbeit einsetzen.

+
+
Lara und Felix stehen gemeinsam im Park +Originales Kling-Motiv
+

Variante B · Markenfläche, Bild links

Zweite Gestaltung mit identischer Komponentenstruktur und anderer Varianteneinstellung.

+
+
Für Kursleitende & Einrichtungen +

Anschaulich. Alltagstauglich. Gemeinsam besprechen.

+

Eine Filmsequenz kann den Einstieg in ein Gespräch bilden. Die passenden Übungen und Begleitmaterialien werden in den Trainingsmodulen zusammengestellt.

+
+
Lara und Felix im Park
+
\ No newline at end of file diff --git a/docs/Brand-UI-Kit/10_bild_text_widget/preview/mobil.png b/docs/Brand-UI-Kit/10_bild_text_widget/preview/mobil.png new file mode 100644 index 0000000..d91a055 Binary files /dev/null and b/docs/Brand-UI-Kit/10_bild_text_widget/preview/mobil.png differ diff --git a/docs/Brand-UI-Kit/11_bild_text_widget_v1.5/CHANGELOG.md b/docs/Brand-UI-Kit/11_bild_text_widget_v1.5/CHANGELOG.md new file mode 100644 index 0000000..a32be66 --- /dev/null +++ b/docs/Brand-UI-Kit/11_bild_text_widget_v1.5/CHANGELOG.md @@ -0,0 +1,11 @@ +# Erweiterungsverlauf + +## v1.5.0 — 18.11.2026 + +- Additives Unterverzeichnis `11_bild_text_widget_v1.5/`; **kein Überschreiben oder Ersetzen** der v1.0–v1.4-Dateien. +- Layoutprofil 1–4 logische Rastereinheiten, Slot-/Mindestbreiten und benannte CSS-Containergrenze. +- Höhen `compact`, `normal`, `spacious`, kein Abschneiden längerer Texte. +- Bildfokus wird auch mobil nicht mehr durch einen CSS-Wert erzwungen. +- Reusable Blade-/CSS-Code, optionale CTA-Links und überprüfbare Konfigurationsbeispiele. +- Desktop-/Tablet-/Mobilvorschau mit originaler Kling-Bildwelt aus v1.4. +- Kein Repository, kein Deployment und keine formale Freigabe behauptet. diff --git a/docs/Brand-UI-Kit/11_bild_text_widget_v1.5/README.md b/docs/Brand-UI-Kit/11_bild_text_widget_v1.5/README.md new file mode 100644 index 0000000..cbeed73 --- /dev/null +++ b/docs/Brand-UI-Kit/11_bild_text_widget_v1.5/README.md @@ -0,0 +1,33 @@ +# Lara & Felix – Bild & Text v1.5 (Add-on zu v1.4) + +**Status:** Technischer/gestalterischer Implementierungskandidat, **keine Betreiber- oder Produktionsfreigabe**. Die bisherige v1.4 ist unverändert im Archiv enthalten. + +## Sofort ansehen + +- `preview/index.html` — interaktive, lokale Vorschau: 1–4 Rastereinheiten, reale Containerbreite, Bildseite, Fläche, Höhe und Bildfokus. +- `preview/matrix.html` — vier nach Containerbreite gestaffelte Muster. +- `preview/*.png` — statische Layoutvisualisierungen (1440/768/390 px) aus den unveränderten Bildassets; **keine echten Browser-Screenshots**. + +## Sofort wiederverwenden + +- `components/lf-bild-text.v1.5.css` — isoliertes CSS mit benannten Container-Queries und bestehenden Kit-Tokens, bei Laravel über Vite/Tailwind 4 importieren. +- `laravel/resources/views/components/lf/bild-text.blade.php` — echte HTML-Elemente für Text, Bild, Links. +- `laravel/app/Support/LfBildTextPayload.php` — URL-/Enum-/Bildfokus-Prüfungen, sicherer Plain-Text-Fallback. +- `laravel/examples/block-instance.json` — keine neue Datenbank, nur Beispiel einer CMS-Instanz. +- `docs/widget-contract.v2.json` und `docs/layout-profile.json` — konfigurierbare, dokumentierte Eigenschaften. + +**Wichtig:** Die Blade-Ansicht benötigt von der existierenden CMS-Registry das **bereits überprüfte, öffentlich verwendbare** Bild samt URL/Abmessungen. Sie greift nicht selbst auf Medien-/Lizenzdaten zu und ersetzt weder Registry noch Medienpicker. Richtext wird nur als kontrolliert bereinigtes `HtmlString` formatiert gerendert; sonst sicher als einfacher Text. Das ist Absicht: unkontrolliertes HTML darf nicht in den Seitenrenderer gelangen. + +## Varianten / Raster + +1, 2, 3 oder 4 logische Einheiten werden vom vorhandenen Abschnittsraster zugeteilt — die Komponente belegt dabei **immer genau einen Widget-Slot**. Ob sie horizontal oder vertikal rendert, hängt **ausschließlich** davon ab, ob ihr tatsächlicher Container mindestens 840 px breit ist. Bei schmalen Slots wird das Foto oberhalb des Texts angezeigt. **Mindestbreite:** 240 px (empfohlen 280 px). Die CMS-Rasterregeln und Slotzuweisung werden nicht verändert. + +Höhen: `compact`, `normal` (v1.4-Standard), `spacious`. **Keine feste Gesamthöhe**: Text und Buttons werden niemals abgeschnitten. Flächen: `cream`, `clear`, `navy`. Bildposition: `left`/`right` ab 840 px; schmal bleibt Bild oben. Konfigurierbarer Fokus: `x,y` von 0 bis 100 % und über alle Breiten wirksam. + +## Medien / Quellenidentität + +Es werden **keine neuen Kinderfiguren** erzeugt. Für die lokale Demo wird ausschließlich `../10_bild_text_widget/assets/lara-felix-park.webp` (bestehende Ableitung) benutzt; das unveränderte originale PNG verbleibt unter `09_hero_widget/assets/lara-felix-park-original.png`. Siehe `docs/asset-manifest.json` mit Prüfsummen. Die internen Figurenreferenzen unter `01_originale/` bleiben privat und werden nicht in Demos genutzt. **Öffentliche Verwendungsfreigabe ist noch separat zu prüfen.** + +## Integration & Abnahme + +`docs/integration-und-abnahme.md` enthält den Einbauablauf und unverfälschten Status. ADR-28 (Editorentscheidung) und ADR-30 (Widget-Registry-Architektur) sind noch nicht durch dieses Add-on entschieden. Für tatsächliche Repo-Integration muss der real vorhandene BlockRegistry-Code geprüft werden; hier liegt nur das Kit, **kein Laravel-Repository**, vor. diff --git a/docs/Brand-UI-Kit/11_bild_text_widget_v1.5/components/lf-bild-text.v1.5.css b/docs/Brand-UI-Kit/11_bild_text_widget_v1.5/components/lf-bild-text.v1.5.css new file mode 100644 index 0000000..b7f3dca --- /dev/null +++ b/docs/Brand-UI-Kit/11_bild_text_widget_v1.5/components/lf-bild-text.v1.5.css @@ -0,0 +1,113 @@ +/* Lara & Felix · Bild & Text v1.5 — additive Erweiterung von v1.4. + Scoped classes, keine fremden globalen Resets oder neuen Markenwerte. + Responsivität nach *tatsächlicher Widget-Containerbreite*. */ +.lf-bt-host { + container: lf-bt / inline-size; + inline-size:100%; min-inline-size:0; max-inline-size:100%; +} +.lf-bt-host, .lf-bt-host * { box-sizing:border-box; } +.lf-bt { + --bt-navy:var(--lf-navy, #032551); + --bt-green:var(--lf-green-deep, #3B7B09); + --bt-yellow:var(--lf-yellow, #FCD10A); + --bt-cream:var(--lf-cream, #F7F6F2); + --bt-muted:var(--lf-muted, #46556B); + --bt-focus-x:60%; --bt-focus-y:50%; + display:grid; grid-template-columns:minmax(0,1fr); + gap:clamp(1.05rem,3.3cqi,2.2rem); + align-items:center; padding:clamp(1rem,3.6cqi,3.8rem); + border-radius:clamp(1rem,1.8cqi,1.65rem); + min-inline-size:0; max-inline-size:100%; overflow:hidden; + background:var(--bt-cream); color:var(--bt-navy); + font-family:var(--lf-font-ui, 'Nunito Sans', 'Segoe UI', system-ui, sans-serif); + font-size:1rem; line-height:1.6; +} +.lf-bt--clear { background:transparent; } +.lf-bt--navy { background:var(--bt-navy); color:#fff; } +.lf-bt__copy { min-inline-size:0; max-inline-size:43rem; } +.lf-bt__eyebrow { + display:inline-flex;align-items:center;gap:.65rem; + color:#295B08; font-size:clamp(.7rem,1.5cqi,.82rem); + font-weight:800; line-height:1.45; letter-spacing:.095em; text-transform:uppercase; + margin:0 0 clamp(.65rem,1.9cqi,1.2rem); +} +.lf-bt__eyebrow::before { + content:''; display:block; inline-size:1.45rem; block-size:.25rem; + background:var(--bt-yellow);border-radius:999px;flex:0 0 auto; +} +.lf-bt--navy .lf-bt__eyebrow { color:#FFF2B0; } +.lf-bt__headline { + font-size:clamp(1.58rem,4.8cqi,3.38rem); + line-height:1.13; letter-spacing:-.032em; font-weight:850; + margin:0; text-wrap:balance; overflow-wrap:break-word; +} +.lf-bt__accent { + display:block; inline-size:clamp(4.8rem,13cqi,7rem); block-size:.39rem; + margin:clamp(.65rem,1.8cqi,1.2rem) 0 clamp(.85rem,2.3cqi,1.45rem) .12rem; + background:var(--bt-yellow); border-radius:90% 35% 75% 40%; transform:rotate(-1deg); +} +.lf-bt__body { color:var(--bt-muted); font-size:clamp(.96rem,1.65cqi,1.12rem);line-height:1.7;overflow-wrap:anywhere; } +.lf-bt__body > :first-child {margin-block-start:0} +.lf-bt__body > :last-child {margin-block-end:0} +.lf-bt__body p {margin:0 0 .85em} +.lf-bt__body ul,.lf-bt__body ol {padding-inline-start:1.35em; margin:.5em 0} +.lf-bt__body a {color:inherit;text-decoration:underline;text-underline-offset:.15em} +.lf-bt--navy .lf-bt__body {color:#F0F4F9} +.lf-bt__actions {display:flex;align-items:center;gap:.75rem;flex-wrap:wrap;margin-block-start:clamp(1.1rem,2.5cqi,1.8rem)} +.lf-bt__button { + display:inline-flex;align-items:center;justify-content:center;gap:.7rem; + padding:.76rem 1.2rem; min-block-size:3rem; border-radius:999px; + border:2px solid var(--bt-green);background:var(--bt-green);color:#fff; + font-weight:800;font-size:.91rem;line-height:1.25;text-decoration:none;text-align:center; + transition:transform .14s ease, background-color .14s ease; +} +.lf-bt__button:visited {color:#fff} +.lf-bt__button:hover {background:#285A06;transform:translateY(-1px)} +.lf-bt__button:focus-visible, .lf-bt__body a:focus-visible {outline:3px solid var(--bt-yellow);outline-offset:4px} +.lf-bt__button--secondary {color:inherit;background:transparent;border-color:currentColor} +.lf-bt__button--secondary:visited {color:inherit} +.lf-bt__button--secondary:hover {background:rgba(3,37,81,.05)} +.lf-bt--navy .lf-bt__button--secondary:hover {background:rgba(255,255,255,.1)} +.lf-bt__media { + position:relative; display:flex; min-inline-size:0; align-self:stretch; + order:-1; isolation:isolate; +} +.lf-bt__media::before { + content:''; position:absolute;inset:auto -.5rem -.5rem 1.35rem; + block-size:55%;border-radius:1.2rem;background:#8AB848; + transform:rotate(1.6deg);z-index:-1; +} +.lf-bt--navy .lf-bt__media::before {background:var(--bt-yellow)} +.lf-bt__image { + display:block;inline-size:100%;block-size:auto;aspect-ratio:16/10; + object-fit:cover;object-position:var(--bt-focus-x) var(--bt-focus-y); + border-radius:clamp(.85rem,1.8cqi,1.3rem); + box-shadow:0 13px 34px rgb(3 37 81 / .12); +} +/* Höhe heißt Bildproportion/Innenraum. TEXT BLEIBT VOLLSTÄNDIG. */ +.lf-bt--height-compact {gap:clamp(.85rem,2.4cqi,1.6rem)} +.lf-bt--height-compact .lf-bt__image {aspect-ratio:16/9} +.lf-bt--height-compact .lf-bt__actions {margin-block-start:1rem} +.lf-bt--height-spacious {gap:clamp(1.35rem,4.4cqi,3rem)} +.lf-bt--height-spacious .lf-bt__image {aspect-ratio:4/3} +@container lf-bt (min-width: 840px) { + .lf-bt {grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:clamp(1.9rem,4.2cqi,4.5rem)} + .lf-bt__media {order:0;align-self:stretch;min-block-size:0} + .lf-bt--image-left .lf-bt__media {order:-1} + .lf-bt__image {block-size:100%;min-block-size:19rem;max-block-size:36rem;aspect-ratio:4/3} + .lf-bt--height-compact .lf-bt__image {min-block-size:15rem;max-block-size:26rem;aspect-ratio:3/2} + .lf-bt--height-spacious .lf-bt__image {min-block-size:24rem;max-block-size:41rem;aspect-ratio:1/1} + .lf-bt--height-compact {padding-block:clamp(1.5rem,3cqi,3rem)} + .lf-bt--height-spacious {padding-block:clamp(2.2rem,5cqi,5rem)} +} +@container lf-bt (max-width: 420px) { + .lf-bt__actions {display:grid;grid-template-columns:minmax(0,1fr)} + .lf-bt__button {inline-size:100%;white-space:normal} + .lf-bt__headline {font-size:clamp(1.48rem,7.5cqi,2rem)} + .lf-bt__body {font-size:.96rem} + .lf-bt__eyebrow {letter-spacing:.045em} +} +@media (prefers-reduced-motion:reduce) { + .lf-bt__button {transition:none} + .lf-bt__button:hover {transform:none} +} diff --git a/docs/Brand-UI-Kit/11_bild_text_widget_v1.5/docs/PRUEFBERICHT.md b/docs/Brand-UI-Kit/11_bild_text_widget_v1.5/docs/PRUEFBERICHT.md new file mode 100644 index 0000000..ed790e9 --- /dev/null +++ b/docs/Brand-UI-Kit/11_bild_text_widget_v1.5/docs/PRUEFBERICHT.md @@ -0,0 +1,21 @@ +# Prüfbericht v1.5 · 18.11.2026 + +**Prüfbereich:** Additives Komponentenpaket, keine produktive CMS-Instanz. + +| Prüfschritt | Befund | +|---|---| +| Unversehrtheit des v1.4-Archivs | 56 von 56 ursprünglichen Dateien binär verglichen, unverändert | +| Vorhandene Kling-Fotodateien | Original-PNG und vorhandene WebP-Datei unverändert; SHA-256 dokumentiert | +| Neue JSON-Dateien | 4 Dateien erfolgreich syntaktisch geparst | +| Komponenten-CSS | 39 top-level Regeln mit tinycss2 geparst, keine Parserfehler | +| PHP-Helper | PHP 8.4 `php -l` erfolgreich; direkte Fälle für URL-Sicherheit, Fokusgrenzen und HTML-Text-Fallback erfolgreich | +| Blade-Template | liegt vor; keine Kompilierung im echten Laravel-Projekt durchgeführt | +| Interactive HTML | im Kit enthalten; keine erfolgreiche Browserausführung in dieser Umgebung | +| Desktop/Tablet/Smartphone PNG | als **statische Layoutvisualisierung mit unverändertem Foto** erstellt, manuell betrachtet; **keine echten DOM-/Browser-Screenshots** | +| Laravel Registry/Filament | nicht geprüft, da reales Repository nicht vorliegt | +| Tastatur, WCAG-Audit, Geräte | im echten Browser nach Integration prüfen | +| Marken-/öffentliche Bildfreigabe | nicht durch das technische Kit erteilt | + +**Hinweis zur Browserprüfung:** Versuche, die lokale HTML-Vorschau aus Chromium/Playwright zu öffnen, wurden durch eine Administrationssperre (`ERR_BLOCKED_BY_ADMINISTRATOR`) verhindert. Auch ein alternativer Headless-Aufruf lieferte keine Aufnahme. Aus diesem Grund sind weder Viewport-E2E-Nachweise noch Pixelübereinstimmung behauptet. + +**Ergebnis:** prüfbarer **Implementierungskandidat**, keine CMS-/Produktionsfreigabe. diff --git a/docs/Brand-UI-Kit/11_bild_text_widget_v1.5/docs/asset-manifest.json b/docs/Brand-UI-Kit/11_bild_text_widget_v1.5/docs/asset-manifest.json new file mode 100644 index 0000000..e5d09c2 --- /dev/null +++ b/docs/Brand-UI-Kit/11_bild_text_widget_v1.5/docs/asset-manifest.json @@ -0,0 +1,14 @@ +{ + "status": "all existing files referenced; no character generation; public release unverified", + "original": { + "path": "09_hero_widget/assets/lara-felix-park-original.png", + "sha256": "dbcb393be9904592c2d8b206b66840c69f42f499be78238869123822892a2f54", + "unchanged": true + }, + "web_preview_derivative": { + "path": "10_bild_text_widget/assets/lara-felix-park.webp", + "sha256": "bddb10c456b08005f5cb2d647426c89e29711f66bdcf9b78cea6a0edf0f47c38", + "unchanged": true + }, + "internal_characters": "01_originale/*referenz*: not used in public previews" +} diff --git a/docs/Brand-UI-Kit/11_bild_text_widget_v1.5/docs/integration-und-abnahme.md b/docs/Brand-UI-Kit/11_bild_text_widget_v1.5/docs/integration-und-abnahme.md new file mode 100644 index 0000000..deaf2d0 --- /dev/null +++ b/docs/Brand-UI-Kit/11_bild_text_widget_v1.5/docs/integration-und-abnahme.md @@ -0,0 +1,42 @@ +# Integration, Tests und Freigabe – Bild & Text v1.5 + +## Geltung: Komponente vs. bestehendes CMS + +- **Aus v1.4 übernommen:** visueller Aufbau, Fotomotiv, Bereichskennzeile, Unterstreichung, CTA, Bild links/rechts, Creme/Transparent/Navy, Bildfokus. +- **v1.5 neu:** Höhe compact/normal/spacious, Einheitenprofil 1–4, nachvollziehbare Containergrenze (840 px), sichere Linkbehandlung, Blade-Ansicht und Beispielvertrag. Bildfokus wird auch bei engen Slots respektiert; v1.4 überschrieb ihn unter 450 px. +- **Nicht entschieden:** Änderung der zentralen Registry-API, Medienauswahl, neues CMS-Feldschema, dauerhaftes Referenzformat, Seiten-/Abschnittsregeln. ADR-28 und ADR-30 bleiben in der Projektführung zu prüfen. + +## Einbau ohne parallelen Datenbestand + +1. Im bestehenden Laravel-Projekt die CSS-Datei nach `resources/css/components/` kopieren und **einmal** in die bereits verwendete Tailwind-4-/Vite-Datei importieren. +2. PHP-Hilfsklasse in `app/Support/` und Blade-Komponente in `resources/views/components/lf/` übernehmen. +3. Die **existierende** zentrale Widget-Registry um die Art `lf-editorial-bild-text` erweitern **oder** den bestehenden Bild-Text-Typ gezielt um einen Renderer ergänzen; genaue API nur nach Repo-Sichtung festlegen. `v1.4`-Felder bleiben per Leseadapter erhalten, keine Bestandsrevision überschreiben. +4. Bild-ID über bestehenden Medienpicker wählen; **vor öffentlichem Rendern** die ausdrückliche Medienfreigabe prüfen, dann URL/`srcset`/Abmessungen liefern. Keine internen Referenzporträts freigeben. +5. CMS-Richtext mit **vorhandenem erlaubtem Sanitizer** bereinigen und als `Illuminate\Support\HtmlString` an die Blade-Ansicht übergeben. Ohne Sanitizer gibt die Komponente lediglich sicheren Text aus. Keine unkontrollierten ` diff --git a/docs/Brand-UI-Kit/11_bild_text_widget_v1.5/preview/matrix.html b/docs/Brand-UI-Kit/11_bild_text_widget_v1.5/preview/matrix.html new file mode 100644 index 0000000..5ec45a1 --- /dev/null +++ b/docs/Brand-UI-Kit/11_bild_text_widget_v1.5/preview/matrix.html @@ -0,0 +1,59 @@ + + +Lara & Felix · Bild & Text v1.5 · Vorschau + + + + +
L&F
Lara & Felix v1.5 · visuelle Vergleichsübersicht
4 Rasterprofile · 3 Höhen
+

Ein Widget. Vier Containerbreiten.

Die Rastereinheiten sind Empfehlungen; die Darstellung folgt der tatsächlich verfügbaren Slotbreite.

+
1 RastereinheitKleine Randspalte · Bild oben270px
+
+

Lara & Felix · Unser Ansatz

+

Geschichten, die Kinder zum Mitdenken bringen.

+

Alltagsszenen regen zum Nachdenken an. Praktische Übungen und Materialien unterstützen Trainerinnen und Trainer in der gemeinsamen Arbeit mit Kindern.

+
+
Lara und Felix stehen zusammen in einem sonnigen Park
+
2 RastereinheitenMittlerer Inhalt · Bild oben590px
+
+

Lara & Felix · Unser Ansatz

+

Geschichten, die Kinder zum Mitdenken bringen.

+

Alltagsszenen regen zum Nachdenken an. Praktische Übungen und Materialien unterstützen Trainerinnen und Trainer in der gemeinsamen Arbeit mit Kindern.

+
+
Lara und Felix stehen zusammen in einem sonnigen Park
+
3 RastereinheitenGroßer Inhalt · zweispaltig890px
+
+

Lara & Felix · Unser Ansatz

+

Geschichten, die Kinder zum Mitdenken bringen.

+

Alltagsszenen regen zum Nachdenken an. Praktische Übungen und Materialien unterstützen Trainerinnen und Trainer in der gemeinsamen Arbeit mit Kindern.

+
+
Lara und Felix stehen zusammen in einem sonnigen Park
+
4 RastereinheitenAbschnittsbreite · zweispaltig1240px
+
+

Lara & Felix · Unser Ansatz

+

Geschichten, die Kinder zum Mitdenken bringen.

+

Alltagsszenen regen zum Nachdenken an. Praktische Übungen und Materialien unterstützen Trainerinnen und Trainer in der gemeinsamen Arbeit mit Kindern.

+
+
Lara und Felix stehen zusammen in einem sonnigen Park
+
diff --git a/docs/Brand-UI-Kit/11_bild_text_widget_v1.5/preview/mobil-390.png b/docs/Brand-UI-Kit/11_bild_text_widget_v1.5/preview/mobil-390.png new file mode 100644 index 0000000..a3c72da Binary files /dev/null and b/docs/Brand-UI-Kit/11_bild_text_widget_v1.5/preview/mobil-390.png differ diff --git a/docs/Brand-UI-Kit/11_bild_text_widget_v1.5/preview/responsive-uebersicht.png b/docs/Brand-UI-Kit/11_bild_text_widget_v1.5/preview/responsive-uebersicht.png new file mode 100644 index 0000000..2b0731b Binary files /dev/null and b/docs/Brand-UI-Kit/11_bild_text_widget_v1.5/preview/responsive-uebersicht.png differ diff --git a/docs/Brand-UI-Kit/11_bild_text_widget_v1.5/preview/tablet-768.png b/docs/Brand-UI-Kit/11_bild_text_widget_v1.5/preview/tablet-768.png new file mode 100644 index 0000000..ca62980 Binary files /dev/null and b/docs/Brand-UI-Kit/11_bild_text_widget_v1.5/preview/tablet-768.png differ diff --git a/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/CHANGELOG.md b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/CHANGELOG.md new file mode 100644 index 0000000..e2cdb8b --- /dev/null +++ b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/CHANGELOG.md @@ -0,0 +1,6 @@ +# Versionshistorie + +- **v1.3:** Hero-Markenwelt, Variantenauswahl und Fokuseinstellungen (unverändert im Ordner `09_hero_widget`). +- **v1.4:** Bild-&-Text-Gestaltung (unverändert im Ordner `10_bild_text_widget`). +- **v1.5:** Blade-Fassung, Höhenparameter, Containerbreiten-Grundregel und Integrationsskizze (unverändert im Ordner `11_bild_text_widget_v1.5`). +- **v1.6 (18.11.2026):** Ergänzung nur unter `12_premium_widgets_adaptiv_v1.6/`: Hero-Höhen `compact/normal/large` auf breiten Containern; Bild-&-Text-Kompaktlayout für mittlere Realbreiten (insbesondere zwei Einheiten); browsergerenderte Vorschauen und Text-/CTA-Overflow-Stresstests. Keine Schema-/CMS-Entscheidung und keine geänderten Markenbilder. diff --git a/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/README.md b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/README.md new file mode 100644 index 0000000..7449463 --- /dev/null +++ b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/README.md @@ -0,0 +1,23 @@ +# Lara & Felix · adaptive Premium-Widgets v1.6 + +**Additive Erweiterung:** Vorhandene Ordner 01–11 aus Kit v1.5 bleiben bytegenau erhalten. Neue Dateien liegen nur unter `12_premium_widgets_adaptiv_v1.6/`. + +**Designfortführung:** Hero aus v1.3 und Bild & Text aus v1.4/v1.5; freigegebene Gestaltungsrichtung, keine neue Markenwelt, keine neuen Figuren. Original-Kling-PNG und vorhandene WebP-Ableitung werden unverändert referenziert. Figurenreferenz-Collagen werden nicht veröffentlicht. + +## Was neu ist + +- **Hero:** eine breite Premiumkomposition mit drei wählbaren Mindesthöhen `compact` (400 px), `normal` (512 px) und `large` (640 px). Nur 3–4 Rastereinheiten vorgesehen, empfohlen ab 860 px realer Containerbreite. Bei schmalerem Container ausschließlich Sicherheitsumbruch. Kein Clipping bei längeren Inhalten. +- **Bild & Text:** Unterstützt 1–4 Rastereinheiten. Ein Container mit **540–899 px** (typischerweise 2 Einheiten) verwendet automatisch einen flachen Bildstreifen und kompaktere Innenabstände. Ab 900 px wird zweispaltig, darunter mobil gestapelt. Drei vorhandene Höhenvarianten `compact`, `normal`, `spacious` bleiben erhalten. +- **Beide:** Text und CTAs sind eigenständige HTML-Elemente, wachsen nach Bedarf, umbrechen statt abgeschnitten zu werden. Keine feste Gesamthöhe, keine `line-clamp`-Texte. Alle Entscheidungen erfolgen über `@container` und reale `inline-size`, nicht anhand des CMS-Spans. + +## Direkt prüfen + +`preview/index.html` → interaktiver Demonstrator mit Widget, Breite, Höhe, Oberfläche und Text-Stresstest. Weitere Browser-Matrizen: `preview/bild-text-matrix.html` und `preview/hero-matrix.html`. Screenshots aus Chromium mit inline eingebundenen **unveränderten** Quellbild-Bytes: `preview/screenshots/`. Technischer QA-Bericht: `docs/qa-browser.json`. + +## Einbau + +`laravel/resources/views/components/lf/{hero,bild-text}.blade.php`, `laravel/resources/css/components/*.css` und `laravel/app/Support/LfBildTextPayload.php`. Die vorhandene zentrale Widget-Registry bleibt unangetastet; Installationsregeln siehe `laravel/examples/registry-adapter.hinweise.md`. Neue CSS-Dateien **ersetzen** die entsprechenden früheren Stylesheets beim Einbau; nicht gleichzeitig laden. + +## Status + +**Design:** Anpassungsentwurf zur UX-Abnahme. **Komponenten:** statisch in Chromium geprüft, nicht im Ziel-Laravel ausgeführt. **CMS-Integration:** offen. **Produktivfreigabe:** nein. Öffentliche Bildverwendung ist unabhängig vom vorhandenen Bildbestand freizugeben. diff --git a/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/components/lf-bild-text.v1.6.css b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/components/lf-bild-text.v1.6.css new file mode 100644 index 0000000..90fbe62 --- /dev/null +++ b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/components/lf-bild-text.v1.6.css @@ -0,0 +1,90 @@ +/* Lara & Felix – Bild & Text v1.6; replaces v1.5 CSS at integration, not alongside it. + The layout reacts to container WIDTH, not CMS span count. Source artwork unchanged. */ +.lf-bt-host { container: lf-bt / inline-size; inline-size:100%;min-inline-size:0;max-inline-size:100%; } +.lf-bt-host,.lf-bt-host *{box-sizing:border-box} +.lf-bt{ + --bt-navy:var(--lf-navy,#032551);--bt-green:var(--lf-green-deep,#3B7B09); + --bt-yellow:var(--lf-yellow,#FCD10A);--bt-cream:var(--lf-cream,#F7F6F2); + --bt-muted:var(--lf-muted,#46556B);--bt-focus-x:64%;--bt-focus-y:43%; + display:grid;grid-template-columns:minmax(0,1fr);align-items:start; + gap:clamp(.9rem,2.65cqi,2rem);padding:clamp(1rem,2.8cqi,3.25rem); + border-radius:clamp(1rem,1.8cqi,1.65rem); + min-inline-size:0;max-inline-size:100%; + background:var(--bt-cream);color:var(--bt-navy); + font:400 1rem/1.6 var(--lf-font-ui,'Nunito Sans','Segoe UI',system-ui,sans-serif); + overflow-wrap:break-word; +} +.lf-bt--clear{background:transparent}.lf-bt--navy{background:var(--bt-navy);color:#fff} +.lf-bt__copy{min-inline-size:0;max-inline-size:49rem;align-self:center} +.lf-bt__eyebrow{display:flex;align-items:center;gap:.6rem;margin:0 0 .8rem; + color:#295B08;font-size:.73rem;line-height:1.45;font-weight:800;letter-spacing:.065em;text-transform:uppercase;overflow-wrap:anywhere} +.lf-bt__eyebrow::before{content:'';inline-size:1.35rem;block-size:.25rem;flex:0 0 auto;background:var(--bt-yellow);border-radius:999px} +.lf-bt--navy .lf-bt__eyebrow{color:#FFF2B0} +.lf-bt__headline{font-size:clamp(1.55rem,4.5cqi,3.35rem);line-height:1.14;letter-spacing:-.03em; + font-weight:850;margin:0;overflow-wrap:anywhere;text-wrap:balance} +.lf-bt__accent{display:block;inline-size:clamp(4.6rem,12cqi,7rem);block-size:.36rem; + margin:clamp(.55rem,1.7cqi,1rem) 0 clamp(.8rem,2.3cqi,1.25rem) .12rem; + background:var(--bt-yellow);border-radius:90% 35% 75% 40%;transform:rotate(-1deg)} +.lf-bt__body{color:var(--bt-muted);font-size:clamp(.97rem,1.45cqi,1.12rem);line-height:1.62;overflow-wrap:anywhere} +.lf-bt__body>:first-child{margin-block-start:0}.lf-bt__body>:last-child{margin-block-end:0} +.lf-bt__body p{margin:0 0 .9em}.lf-bt__body ul,.lf-bt__body ol{padding-inline-start:1.35em;margin:.6em 0} +.lf-bt__body a{color:inherit;text-decoration:underline;text-underline-offset:.15em} +.lf-bt--navy .lf-bt__body{color:#F0F4F9} +.lf-bt__actions{display:flex;align-items:stretch;gap:.65rem;flex-wrap:wrap; + margin-block-start:clamp(1rem,2cqi,1.5rem);min-inline-size:0} +.lf-bt__button{display:inline-flex;align-items:center;justify-content:center;gap:.5rem; + max-inline-size:100%;min-inline-size:0;min-block-size:2.95rem;padding:.7rem 1rem; + background:var(--bt-green);border:2px solid var(--bt-green);color:#fff; + border-radius:999px;text-decoration:none;text-align:center;font-size:.89rem;font-weight:800; + line-height:1.33;overflow-wrap:anywhere;white-space:normal;transition:background-color .14s ease,transform .14s ease} +.lf-bt__button:visited{color:#fff}.lf-bt__button:hover{background:#285A06;transform:translateY(-1px)} +.lf-bt__button--secondary{background:transparent;border-color:currentColor;color:inherit} +.lf-bt__button--secondary:visited{color:inherit}.lf-bt__button--secondary:hover{background:rgb(3 37 81 / .06)} +.lf-bt--navy .lf-bt__button--secondary:hover{background:rgb(255 255 255 / .12)} +.lf-bt__button:focus-visible,.lf-bt__body a:focus-visible{outline:3px solid var(--lf-focus,#1769AA);outline-offset:3px} +.lf-bt__media{position:relative;display:block;min-inline-size:0;order:-1;isolation:isolate} +.lf-bt__media::before{content:'';position:absolute;inset:auto -.42rem -.45rem 1rem; + block-size:53%;border-radius:1.1rem;background:#8AB848;transform:rotate(1.5deg);z-index:-1} +.lf-bt--navy .lf-bt__media::before{background:var(--bt-yellow)} +.lf-bt__image{display:block;inline-size:100%;block-size:auto;aspect-ratio:16/10; + object-fit:cover;object-position:var(--bt-focus-x) var(--bt-focus-y); + border-radius:clamp(.78rem,1.8cqi,1.3rem);box-shadow:0 10px 28px rgb(3 37 81 / .11)} +.lf-bt--height-compact .lf-bt__image{aspect-ratio:16/9} +.lf-bt--height-spacious .lf-bt__image{aspect-ratio:4/3} +.lf-bt--height-compact{gap:clamp(.75rem,2cqi,1.45rem)} +.lf-bt--height-spacious{gap:clamp(1.15rem,3.4cqi,2.7rem)} +.lf-bt--without-image{grid-template-columns:minmax(0,1fr)} +/* Narrow slots: full text and links, no forced block height. */ +@container lf-bt (max-width: 539.99px){ + .lf-bt__actions{display:grid;grid-template-columns:minmax(0,1fr)} + .lf-bt__button{inline-size:100%} + .lf-bt__headline{font-size:clamp(1.42rem,6.8cqi,2.2rem)} + .lf-bt__eyebrow{letter-spacing:.03em} +} +/* Mid-size real container (usually 2 CMS units): compact editorial picture band, not a squeezed 2-col. + Only media proportions / spacings change; text is never clamped or hidden. */ +@container lf-bt (min-width: 540px) and (max-width: 899.99px){ + .lf-bt{gap:clamp(.8rem,1.6cqi,1.2rem);padding:clamp(1.1rem,2.4cqi,1.65rem)} + .lf-bt__media{inline-size:100%} + .lf-bt__image{aspect-ratio:2.15/1} + .lf-bt--height-compact .lf-bt__image{aspect-ratio:2.5/1} + .lf-bt--height-spacious .lf-bt__image{aspect-ratio:1.8/1} + .lf-bt__headline{font-size:clamp(1.65rem,3.6cqi,2.28rem)} + .lf-bt__body{font-size:1.01rem;line-height:1.59} + .lf-bt__actions{margin-block-start:.95rem} + .lf-bt__button{flex:1 1 13rem} +} +/* Wide container: original two-column premium editorial composition. */ +@container lf-bt (min-width: 900px){ + .lf-bt{grid-template-columns:minmax(0,1.02fr) minmax(0,.98fr); + align-items:center;gap:clamp(1.8rem,4cqi,4.5rem);padding:clamp(1.8rem,4cqi,4.5rem)} + .lf-bt__media{order:0;align-self:stretch} + .lf-bt--image-left .lf-bt__media{order:-1} + .lf-bt__image{block-size:100%;min-block-size:18rem;max-block-size:none;aspect-ratio:4/3} + .lf-bt--height-compact .lf-bt__image{min-block-size:14rem;aspect-ratio:3/2} + .lf-bt--height-spacious .lf-bt__image{min-block-size:24rem;aspect-ratio:1/1} + .lf-bt--height-compact{padding-block:clamp(1.25rem,2.8cqi,2.6rem)} + .lf-bt--height-spacious{padding-block:clamp(2.15rem,4.5cqi,4.75rem)} + .lf-bt--without-image{grid-template-columns:minmax(0,1fr)} +} +@media(prefers-reduced-motion:reduce){.lf-bt__button{transition:none}.lf-bt__button:hover{transform:none}} diff --git a/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/components/lf-hero.v1.6.css b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/components/lf-hero.v1.6.css new file mode 100644 index 0000000..71341fd --- /dev/null +++ b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/components/lf-hero.v1.6.css @@ -0,0 +1,70 @@ +/* Lara & Felix Hero v1.6 – non-destructive update of v1.3 visuals. + CMS assigns 3 or 4 units; this component reads resulting real container width. + Height presets are MINIMUM heights, never clipping text or CTAs. */ +.lf-hero-host{container:lf-hero/inline-size;inline-size:100%;min-inline-size:0;max-inline-size:100%} +.lf-hero-host,.lf-hero-host *{box-sizing:border-box} +.lf-hero{ + --lf-hero-navy:var(--lf-navy,#032551);--lf-hero-green:var(--lf-green-deep,#3B7B09); + --lf-hero-yellow:var(--lf-yellow,#FCD10A);--lf-hero-cream:var(--lf-cream,#F7F6F2); + --lf-hero-focus-x:68%;--lf-hero-focus-y:50%; + isolation:isolate;position:relative;display:grid;align-items:center;min-inline-size:0; + min-block-size:32rem;max-inline-size:100%;border-radius:clamp(1rem,1.9cqi,1.75rem); + background:var(--lf-hero-cream);color:var(--lf-hero-navy); + font-family:var(--lf-font-display,'Nunito','Trebuchet MS',system-ui,sans-serif) +} +.lf-hero--height-compact{min-block-size:25rem} +.lf-hero--height-normal{min-block-size:32rem} +.lf-hero--height-large{min-block-size:40rem} +.lf-hero__photo{position:absolute;inset:0;inline-size:100%;block-size:100%;object-fit:cover; + object-position:var(--lf-hero-focus-x) var(--lf-hero-focus-y);z-index:-2;border-radius:inherit} +.lf-hero--photo-split::before{content:'';position:absolute;inset:0;z-index:-1;border-radius:inherit; + background:linear-gradient(90deg,rgba(250,249,243,.99) 0%,rgba(250,249,243,.98) 28%,rgba(250,249,243,.85) 41%,rgba(250,249,243,.12) 69%,transparent 80%)} +.lf-hero--editorial-solid{background:var(--lf-hero-navy);color:white} +.lf-hero--editorial-solid .lf-hero__photo{display:none} +.lf-hero--editorial-solid::before{content:'';position:absolute;inset:auto -7% -50% auto;inline-size:40%;aspect-ratio:1; + background:var(--lf-hero-green);border-radius:50%;opacity:.8;z-index:-1} +.lf-hero__inner{inline-size:100%;max-inline-size:1440px;margin-inline:auto;padding:clamp(1.8rem,4.3cqi,5rem); + padding-block:clamp(2.1rem,5cqi,5rem);min-inline-size:0} +.lf-hero__copy{max-inline-size:min(660px,58%);min-inline-size:0} +.lf-hero--editorial-solid .lf-hero__copy{max-inline-size:760px} +.lf-hero__eyebrow{display:inline-block;margin:0;padding:.35em .75em;border-radius:999px;background:#DFF0C0; + color:#17370B;font-weight:800;font-size:clamp(.78rem,1.25cqi,.95rem);overflow-wrap:anywhere} +.lf-hero__title{margin:.25em 0 .25em;font-size:clamp(2.1rem,5.4cqi,4.9rem);line-height:1.06; + letter-spacing:-.035em;font-weight:900;text-wrap:balance;overflow-wrap:anywhere} +.lf-hero__title-accent{inline-size:clamp(6rem,15cqi,15rem);block-size:.42rem;margin:0 0 clamp(1.1rem,2cqi,1.5rem); + background:var(--lf-hero-yellow);border-radius:90% 30% 45% 25%;transform:rotate(-1deg)} +.lf-hero__description{max-inline-size:56ch;margin:0 0 clamp(1.25rem,2.1cqi,2rem); + font-family:var(--lf-font-ui,'Nunito Sans','Segoe UI',system-ui,sans-serif); + font-size:clamp(1.05rem,1.7cqi,1.3rem);line-height:1.5;overflow-wrap:anywhere} +.lf-hero__actions{display:flex;gap:.75rem;flex-wrap:wrap;align-items:stretch;min-inline-size:0} +.lf-hero__button{display:inline-flex;align-items:center;justify-content:center;min-inline-size:0;max-inline-size:100%; + min-block-size:3rem;padding:.77rem 1.2rem;border:2px solid transparent;border-radius:999px; + font:800 .96rem/1.28 var(--lf-font-ui,'Nunito Sans',system-ui,sans-serif); + text-decoration:none;text-align:center;white-space:normal;overflow-wrap:anywhere;transition:transform .15s ease,background-color .15s ease} +.lf-hero__button:hover{transform:translateY(-1px)} +.lf-hero__button:focus-visible{outline:3px solid var(--lf-focus,#1769AA);outline-offset:3px} +.lf-hero__button--primary{background:var(--lf-hero-green);color:#fff} +.lf-hero__button--primary:visited{color:#fff}.lf-hero__button--primary:hover{background:#285A06} +.lf-hero__button--secondary{background:rgba(255,255,255,.95);color:var(--lf-hero-navy);border-color:var(--lf-hero-navy)} +.lf-hero__button--secondary:visited{color:var(--lf-hero-navy)} +.lf-hero__bottom{position:absolute;inset:auto 0 0;block-size:15px;border-radius:0 0 1.5rem 1.5rem; + background:linear-gradient(105deg,var(--lf-hero-yellow) 0%,var(--lf-hero-yellow) 22%,var(--lf-hero-green) 72%); + clip-path:polygon(0 45%,30% 90%,65% 75%,100% 0,100% 100%,0 100%);pointer-events:none} +/* Safety fallback ONLY when a CSS container turns out physically too narrow; + not an additional author-selectable Hero design. */ +@container lf-hero (max-width: 859.99px){ + .lf-hero{display:block;min-block-size:0} + .lf-hero__photo{position:relative;display:block;block-size:auto;aspect-ratio:16/9; + border-radius:inherit;object-position:var(--lf-hero-focus-x) var(--lf-hero-focus-y)} + .lf-hero--photo-split::before{display:none} + .lf-hero__inner{padding:clamp(1.2rem,3.5cqi,2rem);padding-block-end:2.4rem} + .lf-hero__copy{max-inline-size:100%} + .lf-hero__title{font-size:clamp(2rem,5.5cqi,3.1rem)} + .lf-hero__description{font-size:1.07rem} + .lf-hero--editorial-solid .lf-hero__copy{max-inline-size:100%} +} +@container lf-hero (max-width: 440px){ + .lf-hero__actions{display:grid;grid-template-columns:minmax(0,1fr)} + .lf-hero__button{inline-size:100%} +} +@media(prefers-reduced-motion:reduce){.lf-hero__button{transition:none}.lf-hero__button:hover{transform:none}} diff --git a/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/docs/PRUEFBERICHT.md b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/docs/PRUEFBERICHT.md new file mode 100644 index 0000000..d7296b7 --- /dev/null +++ b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/docs/PRUEFBERICHT.md @@ -0,0 +1,15 @@ +# Prüfbericht – Premium-Widgets v1.6 + +**Stand:** 18.11.2026 · **Status:** Komponentenkandidat für UX-Abnahme, nicht produktiv freigegeben + +- Bestand: **77 Dateien** aus dem vollständigen v1.5-Paket bytegenau per SHA-256 verglichen und beibehalten; die neue Implementierung liegt ausschließlich im zusätzlichen v1.6-Ordner. +- Bildquellen: unverändertes Original-Kling-PNG und bereits vorhandene WebP-Ableitung; keine KI-Neugenerierung. SHA-256: `asset-integrity.json`. +- **Chromium-Rendering:** reale Browser-Renders über `page.set_content()` mit inlined CSS und inlined Bytes der bestehenden WebP-Datei, weil direkte lokale URL-Navigation in der Umgebung blockiert ist. Keine gezeichneten Ersatzscreenshots. +- **Breiten:** 18 kombinierte Text-/CTA-Stresstests (Bild & Text 240–1180 px, Hero 740–1180 px) ohne horizontalen Scroll-Überlauf oder abgeschnittene Texte/Schaltflächen. Testdaten: `qa-stress-breiten.json`. +- **Designfälle:** 10 visuelle / geometrische Komponententests inklusive Bild & Text bei 320/590/860/1180 px und Hero in kompakt, normal, groß, langem Text. Alle bestanden. Screenshots unter `../preview/screenshots/`. +- Interaktive HTML-Demo: Wechsel zwischen Hero und Bild & Text, tatsächlicher Breite, Höhe, Oberfläche und Langtext in Chromium ausgelöst; Vorschau sichtbar. Testdaten: `qa-browser.json`. +- Portable Hilfsklasse mit PHP-Syntaxprüfung geprüft; Blade-Dateien statisch betrachtet, **nicht in einem laufenden Laravel-/Filament-Projekt gerendert oder gegen die bestehende Registry getestet**. + +**Weiter offen:** UX-Freigabe für Bildausschnitt/Proportionen; Repositoriumsabgleich mit realem `BlockRegistry`-Interface; öffentliches Medienrecht; echte Editor-/Frontend-Parität und End-to-End-Tests; CMS/Architekturentscheidungen ADR-28 und ADR-30. + +**Referenzbasis:** Vorhandenes Kit v1.3–v1.5, `design-prinzipien.md` §§4–6 und 13, Projektkompass (17.11.2026), `12_Entscheidungsprotokoll_ADR.md` (17.11.2026). diff --git a/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/docs/asset-integrity.json b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/docs/asset-integrity.json new file mode 100644 index 0000000..a5dc9e8 --- /dev/null +++ b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/docs/asset-integrity.json @@ -0,0 +1,9 @@ +{ + "previous_files_verified_unchanged": 77, + "source_kit": "v1.5 full ZIP", + "assets_sha256": { + "09_hero_widget/assets/lara-felix-park-original.png": "dbcb393be9904592c2d8b206b66840c69f42f499be78238869123822892a2f54", + "09_hero_widget/assets/lara-felix-park-hero.webp": "b6c5d59074cdce51065b35bc78cbd632c5245536728e5d3021c78b46dbd6c115", + "10_bild_text_widget/assets/lara-felix-park.webp": "bddb10c456b08005f5cb2d647426c89e29711f66bdcf9b78cea6a0edf0f47c38" + } +} \ No newline at end of file diff --git a/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/docs/layout-profiles.json b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/docs/layout-profiles.json new file mode 100644 index 0000000..8d0af6c --- /dev/null +++ b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/docs/layout-profiles.json @@ -0,0 +1,74 @@ +{ + "kit_version": "1.6.0", + "status": "Design- und Implementierungskandidaten; keine produktive CMS-Freigabe", + "shared_section_rules": { + "max_logical_units": 4, + "max_widgets_per_slot": 1, + "layout_basis": "Tatsächliche Containerbreite nach Slotzuweisung, nicht Anzahl Rastereinheiten", + "container_query_unit": "inline-size", + "auto_height": true, + "overflow": "Keine feste Gesamthöhe, kein line-clamp, kein text-overflow:ellipsis. Bildausschnitt darf mit object-fit:cover zugeschnitten werden." + }, + "widgets": { + "lf-brand-hero": { + "design_source": "09_hero_widget v1.3 – bestehender Marken-Hero, keine neuen Figuren", + "supported_spans": [3,4], + "recommended_real_min_width_px": 860, + "narrow_behavior": "Unter 860 px ausschließlich technischer Sicherheitsumbruch; keine zusätzliche auswählbare schmale Hero-Variante", + "layout": "photo-split oder editorial-solid aus dem bisherigen Kit", + "height_variants": { + "compact": "min-height 400 px bei breitem Container", + "normal": "min-height 512 px bei breitem Container", + "large": "min-height 640 px bei breitem Container" + }, + "height_note": "Minimum, nie feste Höhe; Inhalt darf jede Variante vertikal vergrößern", + "full_section_behavior": "Kann einen breiten Slot füllen; darf nicht andere Slots verdecken oder zusätzliche Slots reservieren", + "config": { + "variant": ["photo-split", "editorial-solid"], + "height": ["compact", "normal", "large"], + "heading_level": ["h1", "h2", "h3"], + "image_focus": "{x:0..100,y:0..100}", + "eyebrow": "Text", + "title": "Text, verpflichtend", + "description": "Text", + "image": "bestehende freigegebene öffentliche Medienreferenz", + "image_alt": "Text/Leer nur bei dekorativem Motiv", + "primary_cta": "{label,url}, optional", + "secondary_cta": "{label,url}, optional" + } + }, + "lf-editorial-bild-text": { + "design_source": "10_bild_text_widget v1.4 + 11_bild_text_widget_v1.5", + "supported_spans": [1,2,3,4], + "technical_real_min_width_px": 240, + "recommended_real_min_width_px": 280, + "breakpoint_policy": { + "under_540_px": "vertikal, normales Seitenverhältnis, CTAs untereinander", + "540_to_899_px": "kompakter redaktioneller Bildstreifen oberhalb des vollständigen Inhalts; Buttons umbrechen, ohne zu kürzen", + "from_900_px": "breites Bild/Text-Zweispaltenlayout, Bild links/rechts" + }, + "height_variants": { + "compact": "flacheres Bild, engere Abstände", + "normal": "Standardbild und Standardabstand", + "spacious": "höherer Bildanteil und großzügigerer Abstand" + }, + "height_note": "Nur Bildproportionen und Innenabstände, niemals feste Kartenhöhe", + "full_section_behavior": false, + "config": { + "surface": ["cream","clear","navy"], + "image_side": ["left","right"], + "height": ["compact","normal","spacious"], + "heading_level": ["h1","h2","h3"], + "image_focus": "{x:0..100,y:0..100}", + "eyebrow": "Text", + "headline": "Text, verpflichtend", + "body": "sanitisierter Richtext oder reiner Text", + "image": "freigegebene öffentliche Medienreferenz", + "image_alt": "Text/Leer nur bei dekorativem Motiv", + "primary_cta": "{label,url}, optional", + "secondary_cta": "{label,url}, optional" + } + } + }, + "integration_rule": "Keine Änderungen an der Struktur der bestehenden zentralen Widget-Registry oder an den Seiten-/Katalog-/Medien-Datenmodellen. Adapter erst nach Repository-Sichtung." +} diff --git a/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/docs/qa-browser.json b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/docs/qa-browser.json new file mode 100644 index 0000000..2cb61a5 --- /dev/null +++ b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/docs/qa-browser.json @@ -0,0 +1,422 @@ +[ + { + "hostWidth": 320, + "hostHeight": 586.375, + "innerWidth": 320, + "innerHeight": 586.375, + "scrollWidth": 320, + "clientWidth": 320, + "scrollHeight": 586, + "clientHeight": 586, + "copyBounds": { + "bottom": 2736.765625, + "top": 2356.390625, + "left": 58, + "right": 346 + }, + "cardBottom": 2752.765625, + "buttons": [ + { + "text": "Konzept kennenlernen", + "visible": true, + "bounds": { + "left": 58, + "right": 346, + "top": 2632, + "bottom": 2679.1875 + } + }, + { + "text": "Themen ansehen", + "visible": true, + "bounds": { + "left": 58, + "right": 346, + "top": 2689.578125, + "bottom": 2736.765625 + } + } + ], + "id": "bt-320", + "file": "bild-text-matrix.html", + "pass": true + }, + { + "hostWidth": 590, + "hostHeight": 528.59375, + "innerWidth": 590, + "innerHeight": 528.59375, + "scrollWidth": 590, + "clientWidth": 590, + "scrollHeight": 529, + "clientHeight": 529, + "copyBounds": { + "bottom": 731.09375, + "top": 472.40625, + "left": 59.59375, + "right": 614.40625 + }, + "cardBottom": 748.6875, + "buttons": [ + { + "text": "Konzept kennenlernen", + "visible": true, + "bounds": { + "left": 59.59375, + "right": 331.796875, + "top": 683.90625, + "bottom": 731.09375 + } + }, + { + "text": "Themen ansehen", + "visible": true, + "bounds": { + "left": 342.1875, + "right": 614.40625, + "top": 683.90625, + "bottom": 731.09375 + } + } + ], + "id": "bt-590", + "file": "bild-text-matrix.html", + "pass": true + }, + { + "hostWidth": 590, + "hostHeight": 601.40625, + "innerWidth": 590, + "innerHeight": 601.40625, + "scrollWidth": 590, + "clientWidth": 590, + "scrollHeight": 601, + "clientHeight": 601, + "copyBounds": { + "bottom": 1445.5, + "top": 1114, + "left": 59.59375, + "right": 614.40625 + }, + "cardBottom": 1463.09375, + "buttons": [ + { + "text": "Das Trainingskonzept und alle Materialien kennenlernen", + "visible": true, + "bounds": { + "left": 59.59375, + "right": 331.796875, + "top": 1381.28125, + "bottom": 1445.5 + } + }, + { + "text": "Praxisbeispiele und Themenbereiche ansehen", + "visible": true, + "bounds": { + "left": 342.1875, + "right": 614.40625, + "top": 1381.28125, + "bottom": 1445.5 + } + } + ], + "id": "bt-stress", + "file": "bild-text-matrix.html", + "pass": true + }, + { + "hostWidth": 860, + "hostHeight": 654.703125, + "innerWidth": 860, + "innerHeight": 654.703125, + "scrollWidth": 860, + "clientWidth": 860, + "scrollHeight": 655, + "clientHeight": 655, + "copyBounds": { + "bottom": 3487.84375, + "top": 3268.953125, + "left": 62.625, + "right": 846.625 + }, + "cardBottom": 3508.46875, + "buttons": [ + { + "text": "Konzept kennenlernen", + "visible": true, + "bounds": { + "left": 62.625, + "right": 449.421875, + "top": 3440.65625, + "bottom": 3487.84375 + } + }, + { + "text": "Themen ansehen", + "visible": true, + "bounds": { + "left": 459.8125, + "right": 846.625, + "top": 3440.65625, + "bottom": 3487.84375 + } + } + ], + "id": "bt-860", + "file": "bild-text-matrix.html", + "pass": true + }, + { + "hostWidth": 1180, + "hostHeight": 501.296875, + "innerWidth": 1180, + "innerHeight": 501.296875, + "scrollWidth": 1180, + "clientWidth": 1180, + "scrollHeight": 501, + "clientHeight": 501, + "copyBounds": { + "bottom": 2018.203125, + "top": 1611.28125, + "left": 89.1875, + "right": 618.78125 + }, + "cardBottom": 2065.390625, + "buttons": [ + { + "text": "Konzept kennenlernen", + "visible": true, + "bounds": { + "left": 89.1875, + "right": 289.578125, + "top": 1971.015625, + "bottom": 2018.203125 + } + }, + { + "text": "Themen ansehen", + "visible": true, + "bounds": { + "left": 299.96875, + "right": 459.546875, + "top": 1971.015625, + "bottom": 2018.203125 + } + } + ], + "id": "bt-1180", + "file": "bild-text-matrix.html", + "pass": true + }, + { + "hostWidth": 980, + "hostHeight": 408.484375, + "innerWidth": 980, + "innerHeight": 408.484375, + "scrollWidth": 980, + "clientWidth": 980, + "scrollHeight": 408, + "clientHeight": 408, + "copyBounds": { + "bottom": -1128.421875, + "top": -1438.90625, + "left": 84.125, + "right": 603.65625 + }, + "cardBottom": -1079.421875, + "buttons": [ + { + "text": "Konzept kennenlernen", + "visible": true, + "bounds": { + "left": 84.125, + "right": 303.875, + "top": -1176.703125, + "bottom": -1128.421875 + } + }, + { + "text": "Programme ansehen", + "visible": true, + "bounds": { + "left": 315.875, + "right": 520.25, + "top": -1176.703125, + "bottom": -1128.421875 + } + } + ], + "id": "hero-c", + "file": "hero-matrix.html", + "pass": true + }, + { + "hostWidth": 1180, + "hostHeight": 512, + "innerWidth": 1180, + "innerHeight": 512, + "scrollWidth": 1180, + "clientWidth": 1180, + "scrollHeight": 512, + "clientHeight": 512, + "copyBounds": { + "bottom": -541.09375, + "top": -903.765625, + "left": 92.734375, + "right": 718.28125 + }, + "cardBottom": -466.421875, + "buttons": [ + { + "text": "Konzept kennenlernen", + "visible": true, + "bounds": { + "left": 92.734375, + "right": 312.484375, + "top": -589.375, + "bottom": -541.09375 + } + }, + { + "text": "Programme ansehen", + "visible": true, + "bounds": { + "left": 324.484375, + "right": 528.859375, + "top": -589.375, + "bottom": -541.09375 + } + } + ], + "id": "hero-n", + "file": "hero-matrix.html", + "pass": true + }, + { + "hostWidth": 1180, + "hostHeight": 640, + "innerWidth": 1180, + "innerHeight": 640, + "scrollWidth": 1180, + "clientWidth": 1180, + "scrollHeight": 640, + "clientHeight": 640, + "copyBounds": { + "bottom": 135.90625, + "top": -226.765625, + "left": 92.734375, + "right": 718.28125 + }, + "cardBottom": 274.578125, + "buttons": [ + { + "text": "Konzept kennenlernen", + "visible": true, + "bounds": { + "left": 92.734375, + "right": 312.484375, + "top": 87.625, + "bottom": 135.90625 + } + }, + { + "text": "Programme ansehen", + "visible": true, + "bounds": { + "left": 324.484375, + "right": 528.859375, + "top": 87.625, + "bottom": 135.90625 + } + } + ], + "id": "hero-l", + "file": "hero-matrix.html", + "pass": true + }, + { + "hostWidth": 980, + "hostHeight": 637.046875, + "innerWidth": 980, + "innerHeight": 637.046875, + "scrollWidth": 980, + "clientWidth": 980, + "scrollHeight": 637, + "clientHeight": 637, + "copyBounds": { + "bottom": 963.625, + "top": 424.578125, + "left": 84.125, + "right": 603.65625 + }, + "cardBottom": 1012.625, + "buttons": [ + { + "text": "Das gesamte Trainingskonzept kennenlernen", + "visible": true, + "bounds": { + "left": 84.125, + "right": 479.359375, + "top": 855.0625, + "bottom": 903.34375 + } + }, + { + "text": "Programme und Themenbereiche im Überblick", + "visible": true, + "bounds": { + "left": 84.125, + "right": 490, + "top": 915.34375, + "bottom": 963.625 + } + } + ], + "id": "hero-long", + "file": "hero-matrix.html", + "pass": true + }, + { + "hostWidth": 590, + "hostHeight": 528.59375, + "innerWidth": 590, + "innerHeight": 528.59375, + "scrollWidth": 590, + "clientWidth": 590, + "scrollHeight": 529, + "clientHeight": 529, + "copyBounds": { + "bottom": 784.59375, + "top": 525.90625, + "left": 462.59375, + "right": 1017.40625 + }, + "cardBottom": 802.1875, + "buttons": [ + { + "text": "Konzept kennenlernen", + "visible": true, + "bounds": { + "left": 462.59375, + "right": 734.796875, + "top": 737.40625, + "bottom": 784.59375 + } + }, + { + "text": "Programme ansehen", + "visible": true, + "bounds": { + "left": 745.1875, + "right": 1017.40625, + "top": 737.40625, + "bottom": 784.59375 + } + } + ], + "id": "bt-live", + "file": "index.html", + "pass": true + } +] \ No newline at end of file diff --git a/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/docs/qa-stress-breiten.json b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/docs/qa-stress-breiten.json new file mode 100644 index 0000000..6da26a2 --- /dev/null +++ b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/docs/qa-stress-breiten.json @@ -0,0 +1,290 @@ +[ + { + "widget": "bt", + "requested_width_px": 240, + "status": "pass", + "w": 240, + "h": 847.765625, + "sw": 240, + "cw": 240, + "sh": 848, + "ch": 848, + "allLinksInside": true, + "textsInside": true, + "copyBottom": 1105.359375, + "cardBottom": 1121.359375, + "gridColumns": "208px" + }, + { + "widget": "bt", + "requested_width_px": 280, + "status": "pass", + "w": 280, + "h": 790.359375, + "sw": 280, + "cw": 280, + "sh": 790, + "ch": 790, + "allLinksInside": true, + "textsInside": true, + "copyBottom": 1047.953125, + "cardBottom": 1063.953125, + "gridColumns": "248px" + }, + { + "widget": "bt", + "requested_width_px": 320, + "status": "pass", + "w": 320, + "h": 717.03125, + "sw": 320, + "cw": 320, + "sh": 717, + "ch": 717, + "allLinksInside": true, + "textsInside": true, + "copyBottom": 974.625, + "cardBottom": 990.625, + "gridColumns": "288px" + }, + { + "widget": "bt", + "requested_width_px": 390, + "status": "pass", + "w": 390, + "h": 734, + "sw": 390, + "cw": 390, + "sh": 734, + "ch": 734, + "allLinksInside": true, + "textsInside": true, + "copyBottom": 991.59375, + "cardBottom": 1007.59375, + "gridColumns": "358px" + }, + { + "widget": "bt", + "requested_width_px": 539, + "status": "pass", + "w": 539, + "h": 777.328125, + "sw": 539, + "cw": 539, + "sh": 777, + "ch": 777, + "allLinksInside": true, + "textsInside": true, + "copyBottom": 1034.921875, + "cardBottom": 1050.921875, + "gridColumns": "507px" + }, + { + "widget": "bt", + "requested_width_px": 540, + "status": "pass", + "w": 540, + "h": 658.8125, + "sw": 540, + "cw": 540, + "sh": 659, + "ch": 659, + "allLinksInside": true, + "textsInside": true, + "copyBottom": 914.8125, + "cardBottom": 932.40625, + "gridColumns": "504.812px" + }, + { + "widget": "bt", + "requested_width_px": 590, + "status": "pass", + "w": 590, + "h": 594.640625, + "sw": 590, + "cw": 590, + "sh": 595, + "ch": 595, + "allLinksInside": true, + "textsInside": true, + "copyBottom": 850.640625, + "cardBottom": 868.234375, + "gridColumns": "554.812px" + }, + { + "widget": "bt", + "requested_width_px": 700, + "status": "pass", + "w": 700, + "h": 643.046875, + "sw": 700, + "cw": 700, + "sh": 643, + "ch": 643, + "allLinksInside": true, + "textsInside": true, + "copyBottom": 899.046875, + "cardBottom": 916.640625, + "gridColumns": "664.812px" + }, + { + "widget": "bt", + "requested_width_px": 899, + "status": "pass", + "w": 899, + "h": 712.015625, + "sw": 899, + "cw": 899, + "sh": 712, + "ch": 712, + "allLinksInside": true, + "textsInside": true, + "copyBottom": 964.046875, + "cardBottom": 985.609375, + "gridColumns": "855.875px" + }, + { + "widget": "bt", + "requested_width_px": 900, + "status": "pass", + "w": 900, + "h": 562.609375, + "sw": 900, + "cw": 900, + "sh": 563, + "ch": 563, + "allLinksInside": true, + "textsInside": true, + "copyBottom": 811.015625, + "cardBottom": 836.203125, + "gridColumns": "403.906px 388.094px" + }, + { + "widget": "bt", + "requested_width_px": 980, + "status": "pass", + "w": 980, + "h": 737.140625, + "sw": 980, + "cw": 980, + "sh": 737, + "ch": 737, + "allLinksInside": true, + "textsInside": true, + "copyBottom": 983.296875, + "cardBottom": 1010.734375, + "gridColumns": "439.828px 422.609px" + }, + { + "widget": "bt", + "requested_width_px": 1180, + "status": "pass", + "w": 1180, + "h": 789.65625, + "sw": 1180, + "cw": 1180, + "sh": 790, + "ch": 790, + "allLinksInside": true, + "textsInside": true, + "copyBottom": 1030.21875, + "cardBottom": 1063.25, + "gridColumns": "529.594px 508.828px" + }, + { + "widget": "hero", + "requested_width_px": 740, + "status": "pass", + "w": 740, + "h": 863.359375, + "sw": 740, + "cw": 740, + "sh": 863, + "ch": 863, + "allLinksInside": true, + "textsInside": true, + "copyBottom": 1098.5625, + "cardBottom": 1136.953125, + "gridColumns": "none" + }, + { + "widget": "hero", + "requested_width_px": 859, + "status": "pass", + "w": 859, + "h": 958.53125, + "sw": 859, + "cw": 859, + "sh": 959, + "ch": 959, + "allLinksInside": true, + "textsInside": true, + "copyBottom": 1193.734375, + "cardBottom": 1232.125, + "gridColumns": "none" + }, + { + "widget": "hero", + "requested_width_px": 860, + "status": "pass", + "w": 860, + "h": 959.296875, + "sw": 860, + "cw": 860, + "sh": 959, + "ch": 959, + "allLinksInside": true, + "textsInside": true, + "copyBottom": 1194.5, + "cardBottom": 1232.890625, + "gridColumns": "none" + }, + { + "widget": "hero", + "requested_width_px": 900, + "status": "pass", + "w": 900, + "h": 642.65625, + "sw": 900, + "cw": 900, + "sh": 643, + "ch": 643, + "allLinksInside": true, + "textsInside": true, + "copyBottom": 871.25, + "cardBottom": 916.25, + "gridColumns": "900px" + }, + { + "widget": "hero", + "requested_width_px": 980, + "status": "pass", + "w": 980, + "h": 676.359375, + "sw": 980, + "cw": 980, + "sh": 676, + "ch": 676, + "allLinksInside": true, + "textsInside": true, + "copyBottom": 900.953125, + "cardBottom": 949.953125, + "gridColumns": "980px" + }, + { + "widget": "hero", + "requested_width_px": 1180, + "status": "pass", + "w": 1180, + "h": 743.546875, + "sw": 1180, + "cw": 1180, + "sh": 744, + "ch": 744, + "allLinksInside": true, + "textsInside": true, + "copyBottom": 958.140625, + "cardBottom": 1017.140625, + "gridColumns": "1180px" + } +] \ No newline at end of file diff --git a/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/laravel/app/Support/LfBildTextPayload.php b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/laravel/app/Support/LfBildTextPayload.php new file mode 100644 index 0000000..c9c5a62 --- /dev/null +++ b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/laravel/app/Support/LfBildTextPayload.php @@ -0,0 +1,73 @@ + is_numeric($x) ? max(0, min(100, (float) $x)) : 64, + 'y' => is_numeric($y) ? max(0, min(100, (float) $y)) : 50, + ]; + } + + /** These links are redactional CTAs, never raw HTML/JavaScript. */ + public static function safeUrl(mixed $raw): ?string + { + if (! is_string($raw)) { + return null; + } + $url = trim($raw); + if ($url === '' || preg_match('/[\x00-\x1F\x7F\\\\]/u', $url)) { + return null; + } + if (str_starts_with($url, '/') && ! str_starts_with($url, '//')) { + return $url; + } + if (preg_match('/^#[A-Za-z0-9_-]+$/D', $url)) { + return $url; + } + if (str_starts_with(strtolower($url), 'https://') && filter_var($url, FILTER_VALIDATE_URL)) { + return $url; + } + + return null; + } + + public static function cta(mixed $raw): ?array + { + if (! is_array($raw)) { + return null; + } + $label = isset($raw['label']) && is_string($raw['label']) ? trim($raw['label']) : ''; + $url = self::safeUrl($raw['url'] ?? null); + + return $label !== '' && $url ? ['label' => $label, 'url' => $url] : null; + } + + /** Safe readable fallback, if the host app has not supplied sanitized HtmlString. */ + public static function plainTextFromHtml(string $raw): string + { + $withBreaks = preg_replace('~|~i', "\n", $raw) ?? $raw; + $plain = trim(html_entity_decode(strip_tags($withBreaks), ENT_QUOTES | ENT_HTML5, 'UTF-8')); + + return $plain; + } +} diff --git a/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/laravel/examples/bild-text-block.json b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/laravel/examples/bild-text-block.json new file mode 100644 index 0000000..4a55e67 --- /dev/null +++ b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/laravel/examples/bild-text-block.json @@ -0,0 +1,6 @@ +{ + "type": "lf-editorial-bild-text", + "settings": {"height":"compact","surface":"cream","image_side":"right","heading_level":"h2","image_focus":{"x":64,"y":36}}, + "data": {"eyebrow":"Unser Ansatz","headline":"Geschichten zum Mitdenken und Mitmachen","body":"Alltagsszenen eröffnen Gespräche über sichere Entscheidungen. Übungen vertiefen das Thema.","image_alt":"Lara und Felix stehen im Park","primary_cta":{"label":"Konzept kennenlernen","url":"/konzept"},"secondary_cta":{"label":"Themen ansehen","url":"/themen"}}, + "refs": {"image_reference":"REPLACE-WITH-EXISTING-PUBLIC-MEDIA-REFERENCE"} +} diff --git a/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/laravel/examples/hero-block.json b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/laravel/examples/hero-block.json new file mode 100644 index 0000000..614492e --- /dev/null +++ b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/laravel/examples/hero-block.json @@ -0,0 +1,6 @@ +{ + "type": "lf-brand-hero", + "settings": {"variant":"photo-split","height":"compact","heading_level":"h1","image_focus":{"x":68,"y":50}}, + "data": {"eyebrow":"Lara & Felix · Stark im Alltag","title":"Kinder stark im Alltag","description":"Alltagsnahe Geschichten, praktische Übungen und Materialien für Fachkräfte.","image_alt":"Lara und Felix in einer Parkanlage","primary_cta":{"label":"Konzept kennenlernen","url":"/konzept"},"secondary_cta":{"label":"Programme ansehen","url":"/programme"}}, + "refs": {"image_reference":"REPLACE-WITH-EXISTING-PUBLIC-MEDIA-REFERENCE"} +} diff --git a/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/laravel/examples/registry-adapter.hinweise.md b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/laravel/examples/registry-adapter.hinweise.md new file mode 100644 index 0000000..88d09c2 --- /dev/null +++ b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/laravel/examples/registry-adapter.hinweise.md @@ -0,0 +1,27 @@ +# Adapter an die zentrale CMS-Widget-Registry (keine zweite Registry) + +Die vorhandene Laravel-/Filament-Registry (im Projektkonzept `BlockRegistry` genannt) bleibt führend. Das ZIP enthält **kein Repository**, deshalb wird keine tatsächliche Signatur und keine direkte Datenmigration behauptet. + +1. Die bestehenden Renderer für `lf-brand-hero` bzw. `lf-editorial-bild-text` gezielt auf die Views `components.lf.hero` und `components.lf.bild-text` mappen, ohne bestehende Kennungen / Seitenrevisionen umzuschreiben. +2. Für Hero im bestehenden Variantenschema das **optionale** `settings.height` mit Standard `normal` ergänzen. `variant`, `image_focal_point` und Textfelder aus v1.3 unangetastet lassen; gegebenenfalls Lesenamen adaptieren. Für Bild & Text `height` aus v1.5 weiterführen; vorhandene Daten bleiben gültig. +3. Weiterhin **eine** öffentliche Medien-ID an das vorhandene Medien-/Freigabesystem geben. Erst nach Prüfung des öffentlichen Verwendungsrechts als aufgelöste `image`-Ressource an den Renderer übergeben. +4. `data.body` (Bild & Text) nur aus dem bestehenden, bereits gereinigten CMS-Richtext als `Illuminate\\Support\\HtmlString` einliefern; sonst sichere Textdarstellung. CTA-URL-Validierung übernimmt die vorhandene Hilfsklasse. +5. Die beiden v1.6-CSS-Dateien einmalig per bestehendem Tailwind-4-/Vite-Einstiegspunkt laden. **Nicht parallel zu den alten `lf-hero.css` / `lf-bild-text.v1.5.css` laden** (gleichlautende CSS-Klassen). +6. Editor-/Vorschau und öffentliche Website müssen dasselbe Blade-Template verwenden. Keine neue DOM-Kopie oder neue Widget-Tabellen. +7. Slots werden weiter vom bestehenden Abschnittsraster zugeteilt (höchstens vier Einheiten, ein Widget je Slot). Unterstützte Einheiten als Validator-/UI-Hinweis aus `docs/layout-profiles.json` lesen; konkrete Registry-Vertragsfassung und Fehlermeldung sind mit dem Architektur-Chat abzustimmen. + +**Dateieinbindung – Beispiel (nach tatsächlicher Projektprüfung):** + +```css +@import "./components/lf-hero.v1.6.css"; +@import "./components/lf-bild-text.v1.6.css"; +``` + +**Blade-View-Schnittstelle – Beispiel:** + +```blade + + +``` + +Nicht beauftragt/entschieden: neues Registry-Schema, Medienreferenzmodell, neue CMS-Abschnitte, globaler Mindestcontainer-Validator, neue Produkte oder Lizenzmodelle (ADR-28/30 weiterhin offen). diff --git a/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/laravel/resources/css/components/lf-bild-text.v1.6.css b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/laravel/resources/css/components/lf-bild-text.v1.6.css new file mode 100644 index 0000000..90fbe62 --- /dev/null +++ b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/laravel/resources/css/components/lf-bild-text.v1.6.css @@ -0,0 +1,90 @@ +/* Lara & Felix – Bild & Text v1.6; replaces v1.5 CSS at integration, not alongside it. + The layout reacts to container WIDTH, not CMS span count. Source artwork unchanged. */ +.lf-bt-host { container: lf-bt / inline-size; inline-size:100%;min-inline-size:0;max-inline-size:100%; } +.lf-bt-host,.lf-bt-host *{box-sizing:border-box} +.lf-bt{ + --bt-navy:var(--lf-navy,#032551);--bt-green:var(--lf-green-deep,#3B7B09); + --bt-yellow:var(--lf-yellow,#FCD10A);--bt-cream:var(--lf-cream,#F7F6F2); + --bt-muted:var(--lf-muted,#46556B);--bt-focus-x:64%;--bt-focus-y:43%; + display:grid;grid-template-columns:minmax(0,1fr);align-items:start; + gap:clamp(.9rem,2.65cqi,2rem);padding:clamp(1rem,2.8cqi,3.25rem); + border-radius:clamp(1rem,1.8cqi,1.65rem); + min-inline-size:0;max-inline-size:100%; + background:var(--bt-cream);color:var(--bt-navy); + font:400 1rem/1.6 var(--lf-font-ui,'Nunito Sans','Segoe UI',system-ui,sans-serif); + overflow-wrap:break-word; +} +.lf-bt--clear{background:transparent}.lf-bt--navy{background:var(--bt-navy);color:#fff} +.lf-bt__copy{min-inline-size:0;max-inline-size:49rem;align-self:center} +.lf-bt__eyebrow{display:flex;align-items:center;gap:.6rem;margin:0 0 .8rem; + color:#295B08;font-size:.73rem;line-height:1.45;font-weight:800;letter-spacing:.065em;text-transform:uppercase;overflow-wrap:anywhere} +.lf-bt__eyebrow::before{content:'';inline-size:1.35rem;block-size:.25rem;flex:0 0 auto;background:var(--bt-yellow);border-radius:999px} +.lf-bt--navy .lf-bt__eyebrow{color:#FFF2B0} +.lf-bt__headline{font-size:clamp(1.55rem,4.5cqi,3.35rem);line-height:1.14;letter-spacing:-.03em; + font-weight:850;margin:0;overflow-wrap:anywhere;text-wrap:balance} +.lf-bt__accent{display:block;inline-size:clamp(4.6rem,12cqi,7rem);block-size:.36rem; + margin:clamp(.55rem,1.7cqi,1rem) 0 clamp(.8rem,2.3cqi,1.25rem) .12rem; + background:var(--bt-yellow);border-radius:90% 35% 75% 40%;transform:rotate(-1deg)} +.lf-bt__body{color:var(--bt-muted);font-size:clamp(.97rem,1.45cqi,1.12rem);line-height:1.62;overflow-wrap:anywhere} +.lf-bt__body>:first-child{margin-block-start:0}.lf-bt__body>:last-child{margin-block-end:0} +.lf-bt__body p{margin:0 0 .9em}.lf-bt__body ul,.lf-bt__body ol{padding-inline-start:1.35em;margin:.6em 0} +.lf-bt__body a{color:inherit;text-decoration:underline;text-underline-offset:.15em} +.lf-bt--navy .lf-bt__body{color:#F0F4F9} +.lf-bt__actions{display:flex;align-items:stretch;gap:.65rem;flex-wrap:wrap; + margin-block-start:clamp(1rem,2cqi,1.5rem);min-inline-size:0} +.lf-bt__button{display:inline-flex;align-items:center;justify-content:center;gap:.5rem; + max-inline-size:100%;min-inline-size:0;min-block-size:2.95rem;padding:.7rem 1rem; + background:var(--bt-green);border:2px solid var(--bt-green);color:#fff; + border-radius:999px;text-decoration:none;text-align:center;font-size:.89rem;font-weight:800; + line-height:1.33;overflow-wrap:anywhere;white-space:normal;transition:background-color .14s ease,transform .14s ease} +.lf-bt__button:visited{color:#fff}.lf-bt__button:hover{background:#285A06;transform:translateY(-1px)} +.lf-bt__button--secondary{background:transparent;border-color:currentColor;color:inherit} +.lf-bt__button--secondary:visited{color:inherit}.lf-bt__button--secondary:hover{background:rgb(3 37 81 / .06)} +.lf-bt--navy .lf-bt__button--secondary:hover{background:rgb(255 255 255 / .12)} +.lf-bt__button:focus-visible,.lf-bt__body a:focus-visible{outline:3px solid var(--lf-focus,#1769AA);outline-offset:3px} +.lf-bt__media{position:relative;display:block;min-inline-size:0;order:-1;isolation:isolate} +.lf-bt__media::before{content:'';position:absolute;inset:auto -.42rem -.45rem 1rem; + block-size:53%;border-radius:1.1rem;background:#8AB848;transform:rotate(1.5deg);z-index:-1} +.lf-bt--navy .lf-bt__media::before{background:var(--bt-yellow)} +.lf-bt__image{display:block;inline-size:100%;block-size:auto;aspect-ratio:16/10; + object-fit:cover;object-position:var(--bt-focus-x) var(--bt-focus-y); + border-radius:clamp(.78rem,1.8cqi,1.3rem);box-shadow:0 10px 28px rgb(3 37 81 / .11)} +.lf-bt--height-compact .lf-bt__image{aspect-ratio:16/9} +.lf-bt--height-spacious .lf-bt__image{aspect-ratio:4/3} +.lf-bt--height-compact{gap:clamp(.75rem,2cqi,1.45rem)} +.lf-bt--height-spacious{gap:clamp(1.15rem,3.4cqi,2.7rem)} +.lf-bt--without-image{grid-template-columns:minmax(0,1fr)} +/* Narrow slots: full text and links, no forced block height. */ +@container lf-bt (max-width: 539.99px){ + .lf-bt__actions{display:grid;grid-template-columns:minmax(0,1fr)} + .lf-bt__button{inline-size:100%} + .lf-bt__headline{font-size:clamp(1.42rem,6.8cqi,2.2rem)} + .lf-bt__eyebrow{letter-spacing:.03em} +} +/* Mid-size real container (usually 2 CMS units): compact editorial picture band, not a squeezed 2-col. + Only media proportions / spacings change; text is never clamped or hidden. */ +@container lf-bt (min-width: 540px) and (max-width: 899.99px){ + .lf-bt{gap:clamp(.8rem,1.6cqi,1.2rem);padding:clamp(1.1rem,2.4cqi,1.65rem)} + .lf-bt__media{inline-size:100%} + .lf-bt__image{aspect-ratio:2.15/1} + .lf-bt--height-compact .lf-bt__image{aspect-ratio:2.5/1} + .lf-bt--height-spacious .lf-bt__image{aspect-ratio:1.8/1} + .lf-bt__headline{font-size:clamp(1.65rem,3.6cqi,2.28rem)} + .lf-bt__body{font-size:1.01rem;line-height:1.59} + .lf-bt__actions{margin-block-start:.95rem} + .lf-bt__button{flex:1 1 13rem} +} +/* Wide container: original two-column premium editorial composition. */ +@container lf-bt (min-width: 900px){ + .lf-bt{grid-template-columns:minmax(0,1.02fr) minmax(0,.98fr); + align-items:center;gap:clamp(1.8rem,4cqi,4.5rem);padding:clamp(1.8rem,4cqi,4.5rem)} + .lf-bt__media{order:0;align-self:stretch} + .lf-bt--image-left .lf-bt__media{order:-1} + .lf-bt__image{block-size:100%;min-block-size:18rem;max-block-size:none;aspect-ratio:4/3} + .lf-bt--height-compact .lf-bt__image{min-block-size:14rem;aspect-ratio:3/2} + .lf-bt--height-spacious .lf-bt__image{min-block-size:24rem;aspect-ratio:1/1} + .lf-bt--height-compact{padding-block:clamp(1.25rem,2.8cqi,2.6rem)} + .lf-bt--height-spacious{padding-block:clamp(2.15rem,4.5cqi,4.75rem)} + .lf-bt--without-image{grid-template-columns:minmax(0,1fr)} +} +@media(prefers-reduced-motion:reduce){.lf-bt__button{transition:none}.lf-bt__button:hover{transform:none}} diff --git a/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/laravel/resources/css/components/lf-hero.v1.6.css b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/laravel/resources/css/components/lf-hero.v1.6.css new file mode 100644 index 0000000..71341fd --- /dev/null +++ b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/laravel/resources/css/components/lf-hero.v1.6.css @@ -0,0 +1,70 @@ +/* Lara & Felix Hero v1.6 – non-destructive update of v1.3 visuals. + CMS assigns 3 or 4 units; this component reads resulting real container width. + Height presets are MINIMUM heights, never clipping text or CTAs. */ +.lf-hero-host{container:lf-hero/inline-size;inline-size:100%;min-inline-size:0;max-inline-size:100%} +.lf-hero-host,.lf-hero-host *{box-sizing:border-box} +.lf-hero{ + --lf-hero-navy:var(--lf-navy,#032551);--lf-hero-green:var(--lf-green-deep,#3B7B09); + --lf-hero-yellow:var(--lf-yellow,#FCD10A);--lf-hero-cream:var(--lf-cream,#F7F6F2); + --lf-hero-focus-x:68%;--lf-hero-focus-y:50%; + isolation:isolate;position:relative;display:grid;align-items:center;min-inline-size:0; + min-block-size:32rem;max-inline-size:100%;border-radius:clamp(1rem,1.9cqi,1.75rem); + background:var(--lf-hero-cream);color:var(--lf-hero-navy); + font-family:var(--lf-font-display,'Nunito','Trebuchet MS',system-ui,sans-serif) +} +.lf-hero--height-compact{min-block-size:25rem} +.lf-hero--height-normal{min-block-size:32rem} +.lf-hero--height-large{min-block-size:40rem} +.lf-hero__photo{position:absolute;inset:0;inline-size:100%;block-size:100%;object-fit:cover; + object-position:var(--lf-hero-focus-x) var(--lf-hero-focus-y);z-index:-2;border-radius:inherit} +.lf-hero--photo-split::before{content:'';position:absolute;inset:0;z-index:-1;border-radius:inherit; + background:linear-gradient(90deg,rgba(250,249,243,.99) 0%,rgba(250,249,243,.98) 28%,rgba(250,249,243,.85) 41%,rgba(250,249,243,.12) 69%,transparent 80%)} +.lf-hero--editorial-solid{background:var(--lf-hero-navy);color:white} +.lf-hero--editorial-solid .lf-hero__photo{display:none} +.lf-hero--editorial-solid::before{content:'';position:absolute;inset:auto -7% -50% auto;inline-size:40%;aspect-ratio:1; + background:var(--lf-hero-green);border-radius:50%;opacity:.8;z-index:-1} +.lf-hero__inner{inline-size:100%;max-inline-size:1440px;margin-inline:auto;padding:clamp(1.8rem,4.3cqi,5rem); + padding-block:clamp(2.1rem,5cqi,5rem);min-inline-size:0} +.lf-hero__copy{max-inline-size:min(660px,58%);min-inline-size:0} +.lf-hero--editorial-solid .lf-hero__copy{max-inline-size:760px} +.lf-hero__eyebrow{display:inline-block;margin:0;padding:.35em .75em;border-radius:999px;background:#DFF0C0; + color:#17370B;font-weight:800;font-size:clamp(.78rem,1.25cqi,.95rem);overflow-wrap:anywhere} +.lf-hero__title{margin:.25em 0 .25em;font-size:clamp(2.1rem,5.4cqi,4.9rem);line-height:1.06; + letter-spacing:-.035em;font-weight:900;text-wrap:balance;overflow-wrap:anywhere} +.lf-hero__title-accent{inline-size:clamp(6rem,15cqi,15rem);block-size:.42rem;margin:0 0 clamp(1.1rem,2cqi,1.5rem); + background:var(--lf-hero-yellow);border-radius:90% 30% 45% 25%;transform:rotate(-1deg)} +.lf-hero__description{max-inline-size:56ch;margin:0 0 clamp(1.25rem,2.1cqi,2rem); + font-family:var(--lf-font-ui,'Nunito Sans','Segoe UI',system-ui,sans-serif); + font-size:clamp(1.05rem,1.7cqi,1.3rem);line-height:1.5;overflow-wrap:anywhere} +.lf-hero__actions{display:flex;gap:.75rem;flex-wrap:wrap;align-items:stretch;min-inline-size:0} +.lf-hero__button{display:inline-flex;align-items:center;justify-content:center;min-inline-size:0;max-inline-size:100%; + min-block-size:3rem;padding:.77rem 1.2rem;border:2px solid transparent;border-radius:999px; + font:800 .96rem/1.28 var(--lf-font-ui,'Nunito Sans',system-ui,sans-serif); + text-decoration:none;text-align:center;white-space:normal;overflow-wrap:anywhere;transition:transform .15s ease,background-color .15s ease} +.lf-hero__button:hover{transform:translateY(-1px)} +.lf-hero__button:focus-visible{outline:3px solid var(--lf-focus,#1769AA);outline-offset:3px} +.lf-hero__button--primary{background:var(--lf-hero-green);color:#fff} +.lf-hero__button--primary:visited{color:#fff}.lf-hero__button--primary:hover{background:#285A06} +.lf-hero__button--secondary{background:rgba(255,255,255,.95);color:var(--lf-hero-navy);border-color:var(--lf-hero-navy)} +.lf-hero__button--secondary:visited{color:var(--lf-hero-navy)} +.lf-hero__bottom{position:absolute;inset:auto 0 0;block-size:15px;border-radius:0 0 1.5rem 1.5rem; + background:linear-gradient(105deg,var(--lf-hero-yellow) 0%,var(--lf-hero-yellow) 22%,var(--lf-hero-green) 72%); + clip-path:polygon(0 45%,30% 90%,65% 75%,100% 0,100% 100%,0 100%);pointer-events:none} +/* Safety fallback ONLY when a CSS container turns out physically too narrow; + not an additional author-selectable Hero design. */ +@container lf-hero (max-width: 859.99px){ + .lf-hero{display:block;min-block-size:0} + .lf-hero__photo{position:relative;display:block;block-size:auto;aspect-ratio:16/9; + border-radius:inherit;object-position:var(--lf-hero-focus-x) var(--lf-hero-focus-y)} + .lf-hero--photo-split::before{display:none} + .lf-hero__inner{padding:clamp(1.2rem,3.5cqi,2rem);padding-block-end:2.4rem} + .lf-hero__copy{max-inline-size:100%} + .lf-hero__title{font-size:clamp(2rem,5.5cqi,3.1rem)} + .lf-hero__description{font-size:1.07rem} + .lf-hero--editorial-solid .lf-hero__copy{max-inline-size:100%} +} +@container lf-hero (max-width: 440px){ + .lf-hero__actions{display:grid;grid-template-columns:minmax(0,1fr)} + .lf-hero__button{inline-size:100%} +} +@media(prefers-reduced-motion:reduce){.lf-hero__button{transition:none}.lf-hero__button:hover{transform:none}} diff --git a/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/laravel/resources/views/components/lf/bild-text.blade.php b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/laravel/resources/views/components/lf/bild-text.blade.php new file mode 100644 index 0000000..4079b2c --- /dev/null +++ b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/laravel/resources/views/components/lf/bild-text.blade.php @@ -0,0 +1,58 @@ +{{-- Lara & Felix v1.5. The calling CMS registry resolves a public, permitted image. + No media upload, entitlement decision or second content store here. --}} +@props(['data' => [], 'settings' => [], 'image' => []]) +@php + $surface = \App\Support\LfBildTextPayload::oneOf($settings['surface'] ?? null, ['cream','clear','navy'], 'cream'); + $side = \App\Support\LfBildTextPayload::oneOf($settings['image_side'] ?? null, ['left','right'], 'right'); + $height = \App\Support\LfBildTextPayload::oneOf($settings['height'] ?? null, ['compact','normal','spacious'], 'normal'); + $heading = \App\Support\LfBildTextPayload::oneOf($settings['heading_level'] ?? null, ['h1','h2','h3'], 'h2'); + $focus = \App\Support\LfBildTextPayload::focus($settings['image_focus'] ?? $data['image_focus'] ?? null); + $mainCta = \App\Support\LfBildTextPayload::cta($data['primary_cta'] ?? null); + $otherCta = \App\Support\LfBildTextPayload::cta($data['secondary_cta'] ?? null); + $headline = (string) ($data['headline'] ?? ''); + $eyebrow = (string) ($data['eyebrow'] ?? ''); + $body = $data['body'] ?? ''; + $isSanitized = $body instanceof \Illuminate\Support\HtmlString; + $src = (string)($image['src'] ?? ''); + $alt = (string)($data['image_alt'] ?? ''); + $srcset = (string)($image['srcset'] ?? ''); + $sizes = (string)($image['sizes'] ?? '(min-width: 1200px) 45vw, 100vw'); + $imageWidth = max(1, (int)($image['width'] ?? 2048)); + $imageHeight = max(1, (int)($image['height'] ?? 1156)); +@endphp +
class(['lf-bt-host']) }}> +
+
+ @if (trim($eyebrow) !== '')

{{ $eyebrow }}

@endif + @if ($heading === 'h1') +

{{ $headline }}

+ @elseif ($heading === 'h3') +

{{ $headline }}

+ @else +

{{ $headline }}

+ @endif + +
+ @if ($isSanitized) + {!! $body !!} + @else +

{!! nl2br(e(\App\Support\LfBildTextPayload::plainTextFromHtml((string)$body))) !!}

+ @endif +
+ @if ($mainCta || $otherCta) +
+ @if ($mainCta){{ $mainCta['label'] }} @endif + @if ($otherCta){{ $otherCta['label'] }}@endif +
+ @endif +
+ @if ($src !== '') +
+ {{ $alt }} +
+ @endif +
+
diff --git a/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/laravel/resources/views/components/lf/hero.blade.php b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/laravel/resources/views/components/lf/hero.blade.php new file mode 100644 index 0000000..7640e46 --- /dev/null +++ b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/laravel/resources/views/components/lf/hero.blade.php @@ -0,0 +1,52 @@ +@props(['data' => [], 'settings' => [], 'image' => []]) +@php + // Component-only contract. Widget registry and media approval stay in existing CMS. + $variant = \App\Support\LfBildTextPayload::oneOf($settings['variant'] ?? $data['variant'] ?? null, ['photo-split', 'editorial-solid'], 'photo-split'); + $height = \App\Support\LfBildTextPayload::oneOf($settings['height'] ?? null, ['compact', 'normal', 'large'], 'normal'); + $heading = \App\Support\LfBildTextPayload::oneOf($settings['heading_level'] ?? null, ['h1', 'h2', 'h3'], 'h1'); + $legacyFocus = $settings['image_focal_point'] ?? $data['image_focal_point'] ?? 'center-right'; + $focusAliases = [ + 'center' => ['x' => 50, 'y' => 50], + 'center-right' => ['x' => 68, 'y' => 50], + 'right' => ['x' => 80, 'y' => 50], + 'center-left' => ['x' => 35, 'y' => 50], + ]; + $focus = \App\Support\LfBildTextPayload::focus( + $settings['image_focus'] ?? $data['image_focus'] ?? ($focusAliases[$legacyFocus] ?? $focusAliases['center-right']) + ); + $primary = \App\Support\LfBildTextPayload::cta($data['primary_cta'] ?? null); + $secondary = \App\Support\LfBildTextPayload::cta($data['secondary_cta'] ?? null); + $src = (string)($image['src'] ?? ''); + $alt = (string)($data['image_alt'] ?? ''); + $headline = (string)($data['title'] ?? ''); + $description = (string)($data['description'] ?? ''); + $eyebrow = (string)($data['eyebrow'] ?? ''); +@endphp +
class(['lf-hero-host']) }}> +
+ @if ($variant === 'photo-split' && $src !== '') + {{ $alt }} + @endif +
+
+ @if (trim($eyebrow) !== '')

{{ $eyebrow }}

@endif + @if ($heading === 'h1')

{{ $headline }}

+ @elseif ($heading === 'h3')

{{ $headline }}

+ @else

{{ $headline }}

@endif + + @if (trim($description) !== '')

{{ $description }}

@endif + @if ($primary || $secondary) +
+ @if ($primary){{ $primary['label'] }}@endif + @if ($secondary){{ $secondary['label'] }}@endif +
+ @endif +
+
+ +
+
diff --git a/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/bild-text-matrix.html b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/bild-text-matrix.html new file mode 100644 index 0000000..0274ab9 --- /dev/null +++ b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/bild-text-matrix.html @@ -0,0 +1,10 @@ +Lara & Felix · Bild & Text QA

Bild & Text · adaptive Layoutmatrix

Gerenderte Originalkomponente in CSS-Containern unterschiedlicher tatsächlicher Breite.

+

Prüffokus: zwei Rastereinheiten – 590 px Container

Vollständige Inhalte, kompakter Bildstreifen, beide CTAs sichtbar

Lara & Felix · Unser Ansatz

Geschichten, die Kinder zum Mitdenken bringen.

Alltagsszenen eröffnen Gespräche über persönliche Grenzen und sichere Entscheidungen. Trainerinnen und Trainer vertiefen die Themen mit passenden Übungen und Begleitmaterialien.

Lara und Felix stehen gemeinsam im Park
+

Stresstest: lange Überschrift, lange Buttons, 590 px

Lara & Felix · Unser Ansatz

Gemeinsam alltagsnahe Handlungsmöglichkeiten mit Kindern erarbeiten – ohne jemanden zu überfordern

In dieser längeren Beschreibung erläutern wir mehrere unterschiedliche pädagogische Einsatzmöglichkeiten. Kein Text wird künstlich gekürzt; die Fläche wächst mit dem Inhalt und alle Links bleiben erreichbar. Auch bei sehr langen Formulierungen muss die Lesbarkeit erhalten bleiben.

Lara und Felix stehen gemeinsam im Park
+

Breit: vier Einheiten – 1180 px

Lara & Felix · Unser Ansatz

Geschichten, die Kinder zum Mitdenken bringen.

Alltagsszenen eröffnen Gespräche über persönliche Grenzen und sichere Entscheidungen. Trainerinnen und Trainer vertiefen die Themen mit passenden Übungen und Begleitmaterialien.

Lara und Felix stehen gemeinsam im Park
+

Schmaler Slot: 320 px

Lara & Felix · Unser Ansatz

Geschichten, die Kinder zum Mitdenken bringen.

Alltagsszenen eröffnen Gespräche über persönliche Grenzen und sichere Entscheidungen. Trainerinnen und Trainer vertiefen die Themen mit passenden Übungen und Begleitmaterialien.

Lara und Felix stehen gemeinsam im Park
+

Breite 860 px (fällt noch in die kompakte Staffel)

Lara & Felix · Unser Ansatz

Geschichten, die Kinder zum Mitdenken bringen.

Alltagsszenen eröffnen Gespräche über persönliche Grenzen und sichere Entscheidungen. Trainerinnen und Trainer vertiefen die Themen mit passenden Übungen und Begleitmaterialien.

Lara und Felix stehen gemeinsam im Park
+
Browser-QA · Bilder sind unveränderte Originalableitungen, keine Ersatzfiguren.
\ No newline at end of file diff --git a/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/hero-matrix.html b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/hero-matrix.html new file mode 100644 index 0000000..33c050a --- /dev/null +++ b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/hero-matrix.html @@ -0,0 +1,9 @@ +Lara & Felix · Hero QA

Hero · drei Höhen für breite Raster

Ein Layout, drei Mindesthöhen; vollständige Texte und CTAs.

+

Kompakt · 980 px (3 Einheiten)

Lara und Felix in einer grünen Parkanlage

Lara & Felix · Stark im Alltag

Kinder stark im Alltag

Alltagsnahe Geschichten, praktische Übungen und zusammenpassende Materialien für Trainerinnen, Trainer und pädagogische Fachkräfte.

+

Normal · 1180 px (4 Einheiten)

Lara und Felix in einer grünen Parkanlage

Lara & Felix · Stark im Alltag

Kinder stark im Alltag

Alltagsnahe Geschichten, praktische Übungen und zusammenpassende Materialien für Trainerinnen, Trainer und pädagogische Fachkräfte.

+

Groß · 1180 px (4 Einheiten)

Lara und Felix in einer grünen Parkanlage

Lara & Felix · Stark im Alltag

Kinder stark im Alltag

Alltagsnahe Geschichten, praktische Übungen und zusammenpassende Materialien für Trainerinnen, Trainer und pädagogische Fachkräfte.

+

Stresstest · kompakt, lange Texte und Links

Lara und Felix in einer grünen Parkanlage

Lara & Felix · Stark im Alltag

Selbstbehauptung und Prävention nachhaltig in den Kursalltag integrieren

Alltagsnahe Geschichten, praktische Übungen und zusammenpassende Materialien für Trainerinnen, Trainer und pädagogische Fachkräfte.

+
Hero nur für 3/4 Rastereinheiten; schmale Darstellung allein technischer Überlaufschutz.
\ No newline at end of file diff --git a/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/index.html b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/index.html new file mode 100644 index 0000000..a545ff9 --- /dev/null +++ b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/index.html @@ -0,0 +1,15 @@ +Lara & Felix – Premium-Widgets v1.6 (interaktiv)

Premium-Widgets · adaptive Kompaktvarianten v1.6

Originales Lara-&-Felix-Kling-Motiv, getrennte Texte/Buttons, CSS Container Queries. Keine Website-Screenshots.

Lara & Felix · Unser Ansatz

Geschichten, die Kinder zum Mitdenken bringen.

Alltagsszenen eröffnen Gespräche über persönliche Grenzen und sichere Entscheidungen. Trainerinnen und Trainer vertiefen die Themen mit passenden Übungen und Begleitmaterialien.

Lara und Felix stehen gemeinsam im Park

Hero: nur für breite Slotzuweisung (3–4 logische Einheiten); bei unter 860 px greift ausschließlich ein technischer Sicherheitsumbruch, keine weitere Hero-Variante.

Vorschau nutzt relative Originaldateien aus dem unverändert übernommenen Kit. Demo-Links ohne Kauf-/Lizenzaussagen.
\ No newline at end of file diff --git a/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/screenshots/bild-text-2-einheiten-komponente.png b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/screenshots/bild-text-2-einheiten-komponente.png new file mode 100644 index 0000000..0af7816 Binary files /dev/null and b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/screenshots/bild-text-2-einheiten-komponente.png differ diff --git a/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/screenshots/bild-text-2-einheiten-lange-texte.png b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/screenshots/bild-text-2-einheiten-lange-texte.png new file mode 100644 index 0000000..d4c7388 Binary files /dev/null and b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/screenshots/bild-text-2-einheiten-lange-texte.png differ diff --git a/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/screenshots/bild-text-2-einheiten.png b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/screenshots/bild-text-2-einheiten.png new file mode 100644 index 0000000..c0ca305 Binary files /dev/null and b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/screenshots/bild-text-2-einheiten.png differ diff --git a/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/screenshots/bild-text-breit.png b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/screenshots/bild-text-breit.png new file mode 100644 index 0000000..d5334cd Binary files /dev/null and b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/screenshots/bild-text-breit.png differ diff --git a/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/screenshots/bild-text-compact-590.png b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/screenshots/bild-text-compact-590.png new file mode 100644 index 0000000..3ac32a8 Binary files /dev/null and b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/screenshots/bild-text-compact-590.png differ diff --git a/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/screenshots/bild-text-einheit.png b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/screenshots/bild-text-einheit.png new file mode 100644 index 0000000..dbc357a Binary files /dev/null and b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/screenshots/bild-text-einheit.png differ diff --git a/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/screenshots/bild-text-large-590.png b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/screenshots/bild-text-large-590.png new file mode 100644 index 0000000..2bfcc30 Binary files /dev/null and b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/screenshots/bild-text-large-590.png differ diff --git a/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/screenshots/bild-text-normal-590.png b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/screenshots/bild-text-normal-590.png new file mode 100644 index 0000000..5b50081 Binary files /dev/null and b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/screenshots/bild-text-normal-590.png differ diff --git a/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/screenshots/hero-compact-1180.png b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/screenshots/hero-compact-1180.png new file mode 100644 index 0000000..1fa4d72 Binary files /dev/null and b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/screenshots/hero-compact-1180.png differ diff --git a/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/screenshots/hero-gross.png b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/screenshots/hero-gross.png new file mode 100644 index 0000000..ca8c3a7 Binary files /dev/null and b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/screenshots/hero-gross.png differ diff --git a/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/screenshots/hero-kompakt-komponente.png b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/screenshots/hero-kompakt-komponente.png new file mode 100644 index 0000000..05d8c23 Binary files /dev/null and b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/screenshots/hero-kompakt-komponente.png differ diff --git a/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/screenshots/hero-kompakt.png b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/screenshots/hero-kompakt.png new file mode 100644 index 0000000..24f0fbc Binary files /dev/null and b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/screenshots/hero-kompakt.png differ diff --git a/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/screenshots/hero-large-1180.png b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/screenshots/hero-large-1180.png new file mode 100644 index 0000000..ffb74b5 Binary files /dev/null and b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/screenshots/hero-large-1180.png differ diff --git a/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/screenshots/hero-normal-1180.png b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/screenshots/hero-normal-1180.png new file mode 100644 index 0000000..f230bd8 Binary files /dev/null and b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/screenshots/hero-normal-1180.png differ diff --git a/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/screenshots/hero-normal.png b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/screenshots/hero-normal.png new file mode 100644 index 0000000..e5a9881 Binary files /dev/null and b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/screenshots/hero-normal.png differ diff --git a/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/screenshots/mobil-390-simulation.png b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/screenshots/mobil-390-simulation.png new file mode 100644 index 0000000..714179c Binary files /dev/null and b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/screenshots/mobil-390-simulation.png differ diff --git a/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/screenshots/mobil-390-viewport.png b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/screenshots/mobil-390-viewport.png new file mode 100644 index 0000000..5cbe595 Binary files /dev/null and b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/screenshots/mobil-390-viewport.png differ diff --git a/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/standalone.html b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/standalone.html new file mode 100644 index 0000000..2ea176f --- /dev/null +++ b/docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6/preview/standalone.html @@ -0,0 +1,179 @@ +Lara & Felix – Premium-Widgets v1.6 (interaktiv)

Premium-Widgets · adaptive Kompaktvarianten v1.6

Originales Lara-&-Felix-Kling-Motiv, getrennte Texte/Buttons, CSS Container Queries. Keine Website-Screenshots.

Lara & Felix · Unser Ansatz

Geschichten, die Kinder zum Mitdenken bringen.

Alltagsszenen eröffnen Gespräche über persönliche Grenzen und sichere Entscheidungen. Trainerinnen und Trainer vertiefen die Themen mit passenden Übungen und Begleitmaterialien.

Lara und Felix stehen gemeinsam im Park

Hero: nur für breite Slotzuweisung (3–4 logische Einheiten); bei unter 860 px greift ausschließlich ein technischer Sicherheitsumbruch, keine weitere Hero-Variante.

Vorschau nutzt relative Originaldateien aus dem unverändert übernommenen Kit. Demo-Links ohne Kauf-/Lizenzaussagen.
\ No newline at end of file diff --git a/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/CHANGELOG.md b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/CHANGELOG.md new file mode 100644 index 0000000..9310fdf --- /dev/null +++ b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/CHANGELOG.md @@ -0,0 +1,9 @@ +# v1.7.0-draft.1 – 18.11.2026 + +- Gemeinsame Premium-Kartenbasis mit drei Gestaltungssignaturen. +- Eigenständiger Blade-Renderer und optionaler Zeilenraster-Wrapper. +- Anpassung anhand der tatsächlichen Containerbreite; automatische Inhaltshöhe. +- Optionale Gleichhöhe je Rasterzeile, Formate, Fokus und vollständige Bilddarstellung. +- Offline-Vorschau mit konkreten Varianten und interaktiven Prüffällen. +- Design-Konfiguration und Herkunftsnachweis vorhandener Assets. +- Status: Entwurf zur visuellen Freigabe. Keine fachlichen Datenmodelle oder bestehenden Kit-Dateien geändert. diff --git a/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/README.md b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/README.md new file mode 100644 index 0000000..4e08e6b --- /dev/null +++ b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/README.md @@ -0,0 +1,68 @@ +# Premium-Kartenfamilie v1.7 – Entwurf zur Freigabe + +Datum: 18.11.2026. Grundlage: bestehendes Brand- & UI-Kit v1.6 und die Bedeutungswerte des aktuellen Repository-Stands. + +**Alle drei Varianten sind zur visuellen Freigabe vorgeschlagen. Keine Variante ist verbindlich oder produktiv freigegeben.** + +## Ansehen + +`preview/index.html` im Browser öffnen. Die Vorschau arbeitet offline und enthält drei Varianten, ein Vierer-Raster (1 + 1 + 2 und 2 + 2), einen Breitenregler, optionale gleiche Zeilenhöhen, Bilddarstellung und Sonderfälle. Die Aktionen öffnen einen ausdrücklich als Vorschau gekennzeichneten Dialog; es werden keine fachlichen Zielseiten erfunden. + +- **Themenkarte:** Foto und ruhige Textverlinkung mit gelbem Akzent. +- **Medien-/Materialkarte:** Typ-Badge, geordnetes Metadatenband, grüne Aktion. +- **Modul-/Programmkarte:** Navy-Tafel auch ohne Bild, eindeutiges Artlabel und Navy-Aktion. Originalfoto ist optional. + +## Wiederverwenden + +`components/lf-premium-card.css` in den bestehenden CSS-Build aufnehmen. Die beiden Blade-Dateien aus `laravel/resources/views/components/lf/` nach `resources/views/components/lf/` übernehmen, **erst nach Freigabe und gezielter Integrationsbeauftragung**. Die Vorschau selbst benötigt weder Build noch neue Pakete. + +```blade + + + + +``` + +Die Beispielvariablen sind aufgelöste **Darstellungswerte**, kein neues Schema. Die Pfade/URLs und das Asset-Ziel sind vom aufrufenden Projekt bereitzustellen. Beim Einbau in das vorhandene CMS-Raster nur die Karte verwenden; keinen zweiten Vierer-Raster-Container in jeden Slot einsetzen. Dort bestimmt das vorhandene Abschnittsraster die Hostbreite und bei Bedarf die Zeilenhöhe. Die Hostklasse und der Kartennamensraum sind unabhängig von bestehenden `card-*`-/`catalog-card-*`-Klassen. + +Die vollständigen Eingaben und Designparameter stehen in `docs/design-config.json`. Das CSS ist die einzige Komponenten-Stylesheet-Quelle; es wird nicht zusätzlich als auseinanderlaufende Kopie unter `laravel/` geführt. + +## Breite, Höhe und Bilder + +- Die tatsächliche Kartenbreite entscheidet: unter 520 px gestapelt, ab 520 px Bild/Tafel neben Text. Dies ist ein zur Abnahme vorgeschlagener Komponentenwert, keine neue CMS-Rasterentscheidung. +- Technische Mindestbreite 240 px, empfohlen ab 280 px. Es gibt keine auswählbaren Designs für jede logische Spanbreite. +- Inhalte wachsen vollständig. Gleiche Höhen sind auf Rasterebene optional und gelten je tatsächlicher Zeile. Ein langer Text verlängert bei Gleichhöhe seine Zeile, ohne andere Zeilen zu beeinflussen. +- `format`: `landscape` (16:9), `square` (1:1), `portrait` (3:4). Bei `cover` darf der Bildausschnitt dem Layout folgen. `contain` zeigt das vollständige Motiv, auch im breiten Layout, ohne Verzerrung. Originaldateien werden nicht bearbeitet. +- Ohne Bild, Beschreibung, Metadaten, Hinweis oder Aktion entfällt der jeweilige Bereich. Bei `catalog` bleibt ohne Foto eine vollständig typografische Art-Tafel. +- Die Karte besitzt eine eigene helle Fläche und lesbare, lokal zugeordnete Bedeutungswerte; sie kann dadurch auch in dunklen Abschnitten stehen. Eine zusätzliche dunkle Kartenvariante ist nicht Teil dieser Fassung. + +## Fachliche Grenze + +Themen, Medien, Materialien, Module und Programme bleiben in ihren bestehenden Fachobjekten. Der Aufrufer liefert Texte, zulässige Bild-URLs und freigegebene Aktionen aus diesen Objekten. Ein gemeinsamer visueller Renderer vereint keine Datenmodelle, speichert keine Fachdaten und entscheidet keine Sichtbarkeit, Lizenz oder Medienberechtigung. Keine Änderungen an Registry, Migrationen, Filament oder laufenden Widgets. + +Die Karte bietet bewusst nur einen expliziten Link: keine verschachtelten Links, keine gestreckte klickbare Fläche über beliebigen Zusatzinhalten. Metadaten sind keine neu eingeführten Felder an einem Fachobjekt. `kind` muss bei Katalogeinträgen die tatsächliche Art (Modul oder Programm) benennen. Im Beispiel sind Umfänge und Laufzeiten ausdrücklich erfundene Demonstrationswerte. + +## Bestand und Freigabe + +`assets/` enthält ausschließlich bytegleiche Kopien vorhandener Originalmotive, des vorhandenen Logos und der vorhandenen gelben Unterstreichung. `docs/asset-integrity.json` dokumentiert Quellen und SHA-256. Keine neuen Figuren, keine neue Markenidentität und keine Bildbearbeitung. Die vorhandenen Originale und Kit-Versionen werden nicht überschrieben. + +Die Vorschau verwendet die bisherigen Farbwerte und Markenakzente. Historische Statusangaben in älteren Kit-Dokumenten werden damit weder überschrieben noch nachträglich zur Freigabe erklärt. + +Zur Entscheidung stehen die drei Kartensignaturen, die Bild-/Text-Balance bei ein und zwei Einheiten sowie die optionale Gleichhöhe. Nach ausdrücklicher visueller Freigabe können die angenommenen Varianten im Kit als freigegeben dokumentiert werden. Integration in die Anwendung erfolgt separat. diff --git a/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/assets/logo-standard.png b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/assets/logo-standard.png new file mode 100644 index 0000000..3640560 Binary files /dev/null and b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/assets/logo-standard.png differ diff --git a/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/assets/yellow-underline.svg b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/assets/yellow-underline.svg new file mode 100644 index 0000000..f048559 --- /dev/null +++ b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/assets/yellow-underline.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/components/lf-premium-card.css b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/components/lf-premium-card.css new file mode 100644 index 0000000..6b6e2ce --- /dev/null +++ b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/components/lf-premium-card.css @@ -0,0 +1,98 @@ +/* Lara & Felix · Premium-Karten v1.7 · ENTWURF ZUR FREIGABE. + Eine Darstellungskomponente; keine fachlichen Entitäten oder Berechtigungen. */ +.lf-pc-host, .lf-pc-host *, .lf-pc-grid { box-sizing: border-box; } +.lf-pc-host { container: lf-pc / inline-size; min-inline-size: 0; inline-size: 100%; display: flex; flex-direction: column; } +.lf-pc { + /* Die Karte besitzt ihre eigene helle Fläche, auch in dunklen Abschnitten. */ + --color-heading: var(--lf-navy, #032551); + --color-text: var(--lf-ink, #15243a); + --color-text-muted: var(--lf-ink-muted, #3e4c5c); + --color-surface-raised: var(--lf-white, #fff); + --color-surface-subtle: var(--lf-cream, #f7f6f2); + --color-border: var(--lf-line, #d5ddd6); + --color-action: var(--lf-green-deep, #3b7b09); + --color-action-hover: #2f6407; + --color-action-text: var(--lf-white, #fff); + --color-focus: var(--lf-focus, #1769aa); + --pc-heading: var(--color-heading, var(--lf-navy, #032551)); + --pc-text: var(--color-text, #15243a); + --pc-muted: var(--color-text-muted, #3e4c5c); + --pc-surface: var(--color-surface-raised, #fff); + --pc-subtle: var(--color-surface-subtle, var(--lf-cream, #f7f6f2)); + --pc-border: var(--color-border, #d5ddd6); + --pc-action: var(--color-action, var(--lf-green-deep, #3b7b09)); + --pc-action-text: var(--color-action-text, #fff); + --pc-accent: var(--color-accent, var(--lf-yellow, #fcd10a)); + --pc-focus: var(--color-focus, #1769aa); + --pc-ratio: 16 / 10; + display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; + flex: 1; min-inline-size: 0; color: var(--pc-text); background: var(--pc-surface); + border: 1px solid var(--pc-border); border-radius: var(--radius-panel, 22px); + box-shadow: var(--shadow-raised, 0 10px 28px rgb(3 37 81 / 8%)); + font: 400 1rem/1.55 var(--font-reading, var(--lf-font-ui, 'Segoe UI', system-ui, sans-serif)); + overflow-wrap: anywhere; +} +.lf-pc__visual { position: relative; min-inline-size: 0; align-self: start; margin: 10px 10px 0; } +.lf-pc__image { display: block; inline-size: 100%; block-size: auto; aspect-ratio: var(--pc-ratio); + object-fit: cover; object-position: var(--pc-focus-x, 66%) var(--pc-focus-y, 45%); border-radius: 14px; background: var(--pc-subtle); } +.lf-pc--square { --pc-ratio: 1 / 1; } +.lf-pc--portrait { --pc-ratio: 3 / 4; } +.lf-pc--landscape { --pc-ratio: 16 / 9; } +.lf-pc--contain .lf-pc__image { object-fit: contain; padding: 8px; } +.lf-pc__badge { position: absolute; inset: 12px auto auto 12px; max-inline-size: calc(100% - 24px); + padding: 5px 10px; border-radius: 999px; color: var(--lf-navy, #032551); background: var(--lf-white, #fff); + font-size: .75rem; font-weight: 750; line-height: 1.45; } +.lf-pc__body { display: flex; flex-direction: column; align-items: start; min-inline-size: 0; + padding: clamp(20px, 4.5cqi, 32px); gap: 12px; } +.lf-pc__kind { margin: 0; color: var(--pc-action); font-size: .75rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; } +.lf-pc__title { margin: 0; color: var(--pc-heading); font: 800 clamp(1.35rem, 4.6cqi, 1.75rem)/1.18 var(--font-display, var(--lf-font-display, 'Trebuchet MS', sans-serif)); letter-spacing: -.025em; text-wrap: balance; } +.lf-pc__summary { margin: 0; color: var(--pc-muted); } +.lf-pc__meta { display: flex; flex-wrap: wrap; gap: 6px 14px; list-style: none; padding: 0; margin: 0; color: var(--pc-muted); font-size: .875rem; } +.lf-pc__meta li { min-inline-size: 0; } +.lf-pc__footer { margin-block-start: auto; padding-block-start: 10px; inline-size: 100%; display: flex; flex-direction: column; gap: 12px; align-items: start; } +.lf-pc__note { color: var(--pc-muted); font-size: .8125rem; margin: 0; } +.lf-pc__cta { display: inline-flex; align-items: center; justify-content: center; min-block-size: 44px; + max-inline-size: 100%; padding: 10px 18px; border: 1px solid transparent; border-radius: 999px; + background: var(--pc-action); color: var(--pc-action-text); font-weight: 750; font-size: .9375rem; line-height: 1.4; + text-decoration: none; text-align: center; white-space: normal; transition: background-color .15s ease; } +.lf-pc__cta:visited { color: var(--pc-action-text); } +.lf-pc__cta:hover { background: var(--color-action-hover, #2f6407); } +.lf-pc__cta:focus-visible { outline: 3px solid var(--pc-focus); outline-offset: 4px; } +/* Redaktionell: ruhige Textverlinkung und gelber Original-Markenakzent. */ +.lf-pc--editorial .lf-pc__cta { padding-inline: 0; background: transparent; color: var(--pc-heading); border-radius: 4px; text-align: start; text-decoration: underline; text-decoration-color: var(--pc-accent); text-decoration-thickness: 3px; text-underline-offset: 7px; } +.lf-pc--editorial .lf-pc__cta:hover { text-decoration-color: currentColor; } +/* Medien/Material: Metadatenband und konkrete, vom Aufrufer bestimmte Aktion. */ +.lf-pc--media .lf-pc__meta { padding-block: 10px; inline-size: 100%; border-block: 1px solid var(--pc-border); } +/* Modul/Programm: Navy-Tafel mit vorhandenem Asset, auch ohne Foto vollständig. */ +.lf-pc__panel { display: flex; flex-direction: column; justify-content: space-between; gap: 20px; min-block-size: 140px; + margin: 10px 10px 0; padding: 24px; border-radius: 14px; background: var(--lf-navy, #032551); color: var(--lf-white, #fff); } +.lf-pc__panel-label { font: 800 1.6rem/1.15 var(--font-display, 'Trebuchet MS', sans-serif); } +.lf-pc__panel-accent { inline-size: 72px; block-size: auto; } +.lf-pc--catalog .lf-pc__kind { color: var(--pc-heading); } +.lf-pc--catalog .lf-pc__cta { background: var(--pc-heading); color: var(--pc-surface); } +.lf-pc--catalog .lf-pc__cta:hover { background: var(--lf-navy-deep, #01244c); } +.lf-pc--without-visual { grid-template-rows: 1fr; } +/* Alle Entscheidungen hängen an der einzelnen Karte, nie am Browser oder CMS-Span. */ +@container lf-pc (min-width: 520px) { + .lf-pc:not(.lf-pc--without-visual) { grid-template-columns: minmax(0, .42fr) minmax(0, .58fr); grid-template-rows: 1fr; } + .lf-pc__visual { margin: 10px 0 10px 10px; align-self: center; display: flex; } + /* Das gewählte Format bleibt erhalten. Kein erzwungener Hochkant-Ausschnitt + aus Originalmotiven, nur weil der zugehörige Text länger wird. */ + .lf-pc__image { block-size: auto; min-block-size: 0; aspect-ratio: var(--pc-ratio); } + .lf-pc__panel { margin: 10px 0 10px 10px; min-block-size: 220px; } + .lf-pc__body { padding: clamp(22px, 4cqi, 36px); } + .lf-pc__title { font-size: clamp(1.45rem, 3.4cqi, 2rem); } + /* Vollständige Dokumente/Poster behalten auch neben Text ihr gewähltes Format. */ + .lf-pc--contain .lf-pc__visual { align-items: center; background: var(--pc-subtle); border-radius: 14px; } + .lf-pc--contain .lf-pc__image { block-size: auto; min-block-size: 0; aspect-ratio: var(--pc-ratio); } +} +.lf-pc-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--grid-gap, 24px); align-items: start; padding: 0; margin: 0; list-style: none; } +.lf-pc-grid > .lf-pc-host { grid-column: span var(--pc-span, 1); } +.lf-pc-grid--equal { align-items: stretch; } +.lf-pc-grid--equal > .lf-pc-host { block-size: 100%; } +.lf-pc-span-1 { --pc-span: 1; }.lf-pc-span-2 { --pc-span: 2; }.lf-pc-span-3 { --pc-span: 3; }.lf-pc-span-4 { --pc-span: 4; } +/* Nur die Vorschau-/Integrationsrasterspalten reagieren auf den verfügbaren Abschnitt. */ +.lf-pc-section { container: lf-pc-section / inline-size; } +@container lf-pc-section (max-width: 959px) { .lf-pc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }.lf-pc-grid > .lf-pc-span-3, .lf-pc-grid > .lf-pc-span-4 { grid-column: span 2; } } +@container lf-pc-section (max-width: 559px) { .lf-pc-grid { grid-template-columns: minmax(0, 1fr); }.lf-pc-grid > .lf-pc-host { grid-column: 1; } } +@media (prefers-reduced-motion: reduce) { .lf-pc__cta { transition: none; } } diff --git a/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/design-qa.md b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/design-qa.md new file mode 100644 index 0000000..5428cd4 --- /dev/null +++ b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/design-qa.md @@ -0,0 +1,19 @@ +# Design QA · v1.7-Kartenkandidat + +final result: passed + +Dies ist die interne Sichtprüfung des Entwurfs, keine gestalterische Freigabe durch Lars. + +Referenz: vorhandenes v1.6-Kit (Navy, Grün, Gelb, Creme; helle Flächen, Rundungen, Originalmotive, Text-/Aktionshierarchie) und bestehende Komponenten/Bedeutungswerte im Repository. Die neue Kartenfamilie ist eine Weiterentwicklung, kein pixelgenauer Nachbau des Bild-&-Text-Widgets. + +Geprüfte Browserbilder: `desktop-1440.png`, `drei-varianten-desktop.png`, `drei-varianten-mobil.png`, `editorial-590.png`, `raster-2-2.png` und `sonderfaelle.png` unter `preview/screenshots/`. + +- Gemeinsame Flächen, Rundungen und Schrift-/Abstandshierarchie sind konsistent. +- Die drei Varianten unterscheiden sich sichtbar durch Textaktion, Metadatenband und Navy-Tafel. +- Parkmotiv und Denkpause verwenden die vorhandenen Originalassets. Der zunächst ungünstige schmale Bildzuschnitt bei breiten Karten wurde korrigiert; das Bildformat folgt jetzt der gewählten Konfiguration statt der Texthöhe. +- Desktop- und Mobilbilder zeigen vollständige Titel, Texte und Aktionen. Bild- und Textbereiche bleiben technisch getrennt. +- Gleiche Zeilenhöhe richtet Kartenenden und Aktionen aus. Natürliche Höhen, lange Texte und fehlende optionale Inhalte wurden zusätzlich technisch geprüft. +- Dokumentmotive können vollständig eingepasst werden. Die sichtbaren freien Flächen bei abweichendem Bildformat sind beabsichtigt; das Original wird nicht verzerrt oder bearbeitet. +- Sichtbarer Tastaturfokus und Mindesthöhe 44 px für Aktionen sind vorhanden. + +Offener fachlicher Schritt: visuelle Abnahme der Kartenbasis und jeder der drei Varianten. Vorher keine Kennzeichnung als verbindlich. diff --git a/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/docs/FREIGABE.md b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/docs/FREIGABE.md new file mode 100644 index 0000000..9db63ca --- /dev/null +++ b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/docs/FREIGABE.md @@ -0,0 +1,12 @@ +# Gestalterische Freigabe + +| Gegenstand | Status | +|---|---| +| Gemeinsame Kartenbasis | Zur visuellen Freigabe | +| Redaktionelle Themenkarte | Zur visuellen Freigabe | +| Medien- und Materialkarte | Zur visuellen Freigabe | +| Modul- und Programmkarte | Zur visuellen Freigabe | +| Container-Schwelle 520 px | Abnahmevorschlag | +| Einbau in bestehende Widgets/Registry | Nicht Bestandteil dieses Entwurfs | + +Keine Freigabe wird aus der Dateierstellung oder einer technischen Prüfung abgeleitet. Eine bestätigte Entscheidung wird hier mit Datum und Umfang nachgeführt; abgelehnte Entwürfe bleiben nachvollziehbar versioniert. Bisherige Kit-Versionen bleiben erhalten. diff --git a/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/docs/PRUEFBERICHT.md b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/docs/PRUEFBERICHT.md new file mode 100644 index 0000000..424e7ad --- /dev/null +++ b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/docs/PRUEFBERICHT.md @@ -0,0 +1,30 @@ +# Prüfung des v1.7-Kandidaten + +Stand: 18.11.2026. Technische Prüfung bestanden; **gestalterische Freigabe weiterhin offen**. + +## Durchgeführt + +- **30 isolierte Blade-Prüfungen:** drei Varianten, optionale Bereiche, sichere Auszeichnung, ungekürzte lange Texte, Design-Defaults, Fokusbegrenzung, gültige/ungültige Ziele und optionaler Gleichhöhen-Wrapper. Ohne App-Boot, Datenbank oder Netzaufrufe. Einzelheiten: `qa-blade.json`. +- **88 Chromium-Prüfungen:** alle drei Varianten bei 240, 280, 320, 390, 519, 520, 590, 768, 900 und 1180 px Containerbreite; Seitenbreiten 320/390/768/1440 px; Gleichhöhe und natürliche Höhen; lange ungetrennte Überschriften und Aktionen; drei Bildformate jeweils mit `cover`/`contain`; Dialogaktion und Escape; Tastaturfokus; Reflow bei 720 CSS-px. Kein gemessener horizontaler Inhaltsüberlauf und keine JavaScript-Fehler. Einzelheiten: `qa-browser.json`. +- **16 echte Browserbilder** unter `preview/screenshots/`: Desktop, Mobil, drei Varianten, Vierer-Raster, Sonderfälle und einzelne Karten bei 280/590/900 px. +- **Visuelle Sichtprüfung:** Übersicht, mobile Varianten, Raster 2 + 2 und Sonderfälle angesehen. Ein ungünstiger Hochkantzuschnitt des Parkmotivs im breiten Layout wurde behoben. Bildformate bleiben jetzt unabhängig von der Texthöhe erhalten. +- **Asset-Herkunft:** fünf vorhandene Dateien beim ersten Lauf bytegleich aus dem Kit kopiert und per SHA-256 geprüft. Die Prüfsummen stehen in `asset-integrity.json`. + +## Reproduzieren + +Aus dem Repository-Stamm: + +```text +php docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/tests/render.php +python docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/tests/browser.py +``` + +Die Blade-Prüfung verwendet die vorhandenen Composer-Abhängigkeiten. Für die Browserprüfung wird eine bereits lokal installierte Playwright-/Chromium-Umgebung benötigt. Keine Pakete wurden für dieses Kit installiert. Der Browserlauf liest lokale Dateien ohne Webserver und aktualisiert nur die Bilder/Prüfprotokolle dieses Entwurfs. + +## Grenzen + +- Keine behauptete Integration in die laufende Anwendung. Keine bestehende Widget-, Datenbank-, Filament- oder Berechtigungslogik geändert oder getestet. +- Browserprüfung mit lokalem Chromium; keine zusätzliche Safari-/Firefox-Prüfung. Keine vollständige Barrierefreiheitszertifizierung. +- Die Systemschriften der Offline-Vorschau ersetzen keine visuelle Endprüfung mit den endgültigen Projektschriften. +- Die 200%-Prüfung erfolgt als äquivalenter Reflow bei halbierter CSS-Breite, nicht als nativer Zoom-Test. +- Der Repository-Stand änderte sich während der Arbeit außerhalb dieser Bearbeitung; zuvor vorhandene unversionierte Kit-Quellordner waren anschließend entfernt. Die bereits geprüften Originalkopien wurden bewahrt. Es wurde keine Wiederherstellung oder Überschreibung der ursprünglichen Quellordner vorgenommen. diff --git a/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/docs/asset-integrity.json b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/docs/asset-integrity.json new file mode 100644 index 0000000..2ede395 --- /dev/null +++ b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/docs/asset-integrity.json @@ -0,0 +1,37 @@ +[ + { + "file": "assets/park-original.png", + "source": "09_hero_widget/assets/lara-felix-park-original.png", + "sha256": "dbcb393be9904592c2d8b206b66840c69f42f499be78238869123822892a2f54", + "unchanged": true, + "source_note": "Beim ersten Lauf bytegleich aus dem Repository kopiert. Ursprungsordner wurde parallel außerhalb dieser Arbeit entfernt." + }, + { + "file": "assets/denkpause-original.png", + "source": "01_originale/denkpause_original.png", + "sha256": "d364b1bea183ce0e7383bea2950a2cdbb0e6a0b89a94e302e7812ac19f7b1c5d", + "unchanged": true, + "source_note": "Beim ersten Lauf bytegleich aus dem Repository kopiert. Ursprungsordner wurde parallel außerhalb dieser Arbeit entfernt." + }, + { + "file": "assets/titel-original.png", + "source": "01_originale/titel_original.png", + "sha256": "a6b3131d12fa16802e5097f6101d161d555e6ee2da61add2e6498dc649909e0e", + "unchanged": true, + "source_note": "Beim ersten Lauf bytegleich aus dem Repository kopiert. Ursprungsordner wurde parallel außerhalb dieser Arbeit entfernt." + }, + { + "file": "assets/yellow-underline.svg", + "source": "03_svg_entwuerfe/yellow-underline.svg", + "sha256": "3c3846ab1994a965d3bfee6b7377c19bcf5da343f8f3589b26de90ee7f357e52", + "unchanged": true, + "source_note": "Beim ersten Lauf bytegleich aus dem Repository kopiert. Ursprungsordner wurde parallel außerhalb dieser Arbeit entfernt." + }, + { + "file": "assets/logo-standard.png", + "source": "08_freigegebene_logovarianten/logo_lara_felix_standard.png", + "sha256": "323ad690e6bd5d9e534bfbc8c239fbd9b8dedf0f95084c4d92530d257f7355d7", + "unchanged": true, + "source_note": "Beim ersten Lauf bytegleich aus dem Repository kopiert. Ursprungsordner wurde parallel außerhalb dieser Arbeit entfernt." + } +] diff --git a/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/docs/design-config.json b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/docs/design-config.json new file mode 100644 index 0000000..e52c429 --- /dev/null +++ b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/docs/design-config.json @@ -0,0 +1,55 @@ +{ + "kit_version": "1.7.0-draft.1", + "status": "Entwurf zur visuellen Freigabe", + "approval": { "editorial": "pending", "media": "pending", "catalog": "pending" }, + "component": "lf.premium-card", + "responsibility": "Nur Präsentation; kein fachliches Datenmodell, keine neue Widget-Familie in der Registry", + "variants": { + "editorial": { "label": "Redaktionelle Themenkarte", "signature": "Foto, Themenlabel, ruhige Textaktion mit gelber Unterstreichung" }, + "media": { "label": "Medien- und Materialkarte", "signature": "Optionales Typ-Badge, Metadatenband, grüner Handlungsbereich" }, + "catalog": { "label": "Modul- und Programmkarte", "signature": "Navy-Tafel ohne Bild, optional Originalfoto, Navy-Aktion; Art explizit benennen" } + }, + "layout": { + "supported_logical_spans": [1, 2, 3, 4], + "technical_min_width_px": 240, + "recommended_min_width_px": 280, + "basis": "Tatsächliche inline-size des einzelnen Kartenhosts", + "stacked_below_px": 520, + "side_by_side_from_px": 520, + "side_by_side_ratio": [42, 58], + "section_grid": "Maximal vier Spalten; Beispielraster unter 960 px zwei, unter 560 px eine. Im CMS entscheidet das bestehende Abschnittsraster.", + "height": "Automatisch, keine feste Höhe, kein line-clamp", + "equal_height": "Optional auf Rasterebene, je tatsächlicher Zeile. Alle Karten wachsen bis zur höchsten Karte; Footer am unteren Rand. Keine globale Gleichhöhe über mehrere Zeilen.", + "no_image": "Thema/Medium ohne reservierten Bildbereich; Modul/Programm mit typografischer Navy-Tafel", + "missing_optional_content": "Label, Kurztext, Metadaten, Hinweis und Aktion entfallen ohne Leerzeilen. Keine Aktion ohne gültiges Ziel und Label. Titel erforderlich." + }, + "design_props": { + "variant": ["editorial", "media", "catalog"], + "format": ["landscape", "square", "portrait"], + "fit": ["cover", "contain"], + "headingLevel": ["h2", "h3", "h4"], + "image.focus_x": "0..100, Standard 66", + "image.focus_y": "0..100, Standard 45", + "equalHeight": "Boolean am Raster, Standard false" + }, + "presentation_inputs": { + "title": "Pflicht, reiner Text aus maßgeblichem Fachobjekt", + "kind": "Optionales Klartextlabel; Modul und Programm bleiben unterscheidbar", + "summary": "Optionaler reiner Text, kein ungeprüftes HTML", + "meta": "Optionale Liste reiner Anzeigetexte, leere Einträge werden entfernt", + "note": "Optionaler erklärender Text; keine aus der Darstellung abgeleitete Berechtigung", + "image": "Optional: bereits aufgelöstes src, alt, width, height, focus_x, focus_y, badge", + "action": "Optional: bereits autorisiertes url und label. Kein automatischer Download/Player aus der Variante.", + "accentSrc": "Optionaler öffentlicher Pfad zum vorhandenen gelben Unterstreichungs-Asset" + }, + "tokens": { + "source": "Bestehende Markenwerte und Bedeutungswerte aus resources/css/tokens.css und Kit 02_design_tokens", + "navy": "#032551", + "green_action": "#3B7B09", + "yellow_accent": "#FCD10A", + "cream": "#F7F6F2", + "panel_radius_px": 22, + "image_radius_px": 14, + "font_policy": "Vorhandene --font-display / --font-reading verwenden; Offline-Vorschau mit System-Fallback, keine neuen Fonts oder Netzaufrufe" + } +} diff --git a/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/docs/examples.json b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/docs/examples.json new file mode 100644 index 0000000..c79292b --- /dev/null +++ b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/docs/examples.json @@ -0,0 +1,40 @@ +[ + { + "variant": "editorial", + "kind": "Themenwelt", + "title": "Gefühle verstehen. Grenzen stärken.", + "summary": "Geschichten und Impulse, die Kinder ins Gespräch bringen – und Trainerinnen und Trainer im Alltag begleiten.", + "meta": [ + "Wissen & Praxis" + ], + "image": "park-original.png", + "alt": "Lara und Felix stehen nebeneinander im Park.", + "action": "Thema entdecken" + }, + { + "variant": "media", + "kind": "Film & Begleitmaterial", + "title": "Eine Pause, die stark macht.", + "summary": "Gemeinsam innehalten, die Situation betrachten und über gute nächste Schritte sprechen.", + "meta": [ + "Film · 3 Min.", + "Begleitmaterial · PDF" + ], + "image": "denkpause-original.png", + "alt": "Originalmotiv aus dem Film: Denkpause.", + "badge": "Film", + "action": "Material ansehen", + "note": "Für die nächste Kursstunde." + }, + { + "variant": "catalog", + "kind": "Programm", + "title": "Schritt für Schritt zu mehr Selbstvertrauen.", + "summary": "Ein roter Faden für die Kursgestaltung. Zusammenhängende Themen geben Orientierung für die gemeinsame Arbeit.", + "meta": [ + "4 Module", + "Für die Kursplanung" + ], + "action": "Programm kennenlernen" + } +] diff --git a/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/docs/qa-blade.json b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/docs/qa-blade.json new file mode 100644 index 0000000..faa38c3 --- /dev/null +++ b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/docs/qa-blade.json @@ -0,0 +1,125 @@ +{ + "status": "passed", + "checks": [ + { + "check": "Variante editorial", + "passed": true + }, + { + "check": "Keine leere Aktion: editorial", + "passed": true + }, + { + "check": "Keine leeren Metadaten: editorial", + "passed": true + }, + { + "check": "Ohne Bild: editorial", + "passed": true + }, + { + "check": "Variante media", + "passed": true + }, + { + "check": "Keine leere Aktion: media", + "passed": true + }, + { + "check": "Keine leeren Metadaten: media", + "passed": true + }, + { + "check": "Ohne Bild: media", + "passed": true + }, + { + "check": "Variante catalog", + "passed": true + }, + { + "check": "Keine leere Aktion: catalog", + "passed": true + }, + { + "check": "Keine leeren Metadaten: catalog", + "passed": true + }, + { + "check": "Ohne Bild: catalog", + "passed": true + }, + { + "check": "Titel escaped", + "passed": true + }, + { + "check": "Beschreibung escaped", + "passed": true + }, + { + "check": "Bild-Alt escaped", + "passed": true + }, + { + "check": "Unsicheres Ziel verworfen: \"javascript:alert(1)\"", + "passed": true + }, + { + "check": "Unsicheres Ziel verworfen: \"data:text\\/html,test\"", + "passed": true + }, + { + "check": "Unsicheres Ziel verworfen: \"\\/\\/evil.example\\/path\"", + "passed": true + }, + { + "check": "Unsicheres Ziel verworfen: \"\\/\\\\evil.example\"", + "passed": true + }, + { + "check": "Unsicheres Ziel verworfen: \"\\/safe\\nunsafe\"", + "passed": true + }, + { + "check": "Unsicheres Ziel verworfen: \"https:\\/\\/example.com\\/has space\"", + "passed": true + }, + { + "check": "Zulässiges Ziel: /themen/test", + "passed": true + }, + { + "check": "Zulässiges Ziel: #abschnitt", + "passed": true + }, + { + "check": "Zulässiges Ziel: https://example.com/path?ok=1", + "passed": true + }, + { + "check": "Zulässiges Ziel: http://example.com/path", + "passed": true + }, + { + "check": "Leere/ungültige Metadaten entfernt", + "passed": true + }, + { + "check": "Designwerte auf sichere Defaults begrenzt", + "passed": true + }, + { + "check": "Bildfokus begrenzt", + "passed": true + }, + { + "check": "Lange Titel, Texte und Aktionen ungekürzt", + "passed": true + }, + { + "check": "Optionaler Gleichhöhen-Wrapper", + "passed": true + } + ] +} diff --git a/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/docs/qa-browser.json b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/docs/qa-browser.json new file mode 100644 index 0000000..7781a46 --- /dev/null +++ b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/docs/qa-browser.json @@ -0,0 +1,673 @@ +{ + "status": "passed", + "checks": [ + { + "check": "Drei konkrete Varianten", + "passed": true, + "detail": null + }, + { + "check": "Alle Originalassets geladen", + "passed": true, + "detail": null + }, + { + "check": "Optionale Gleichhöhe je Rasterzeile", + "passed": true, + "detail": [ + 517.75, + 517.75, + 517.75 + ] + }, + { + "check": "Natürliche unterschiedliche Inhaltshöhen", + "passed": true, + "detail": [ + 488.40625, + 517.75, + 319.796875 + ] + }, + { + "check": "Kartenaktion öffnet Vorschau-Dialog", + "passed": true, + "detail": null + }, + { + "check": "Dialog per Escape schließbar", + "passed": true, + "detail": null + }, + { + "check": "Kein Seitenüberlauf 320px", + "passed": true, + "detail": null + }, + { + "check": "Kein Seitenüberlauf 390px", + "passed": true, + "detail": null + }, + { + "check": "Kein Seitenüberlauf 768px", + "passed": true, + "detail": null + }, + { + "check": "Kein Seitenüberlauf 1440px", + "passed": true, + "detail": null + }, + { + "check": "editorial: vollständige Inhalte bei 240px", + "passed": true, + "detail": { + "width": 240, + "height": 491.828125, + "horizontal": false, + "overflow": [], + "clipped": [] + } + }, + { + "check": "editorial: Containeranordnung bei 240px", + "passed": true, + "detail": null + }, + { + "check": "editorial: vollständige Inhalte bei 280px", + "passed": true, + "detail": { + "width": 280, + "height": 489.53125, + "horizontal": false, + "overflow": [], + "clipped": [] + } + }, + { + "check": "editorial: Containeranordnung bei 280px", + "passed": true, + "detail": null + }, + { + "check": "editorial: vollständige Inhalte bei 320px", + "passed": true, + "detail": { + "width": 320, + "height": 512.03125, + "horizontal": false, + "overflow": [], + "clipped": [] + } + }, + { + "check": "editorial: Containeranordnung bei 320px", + "passed": true, + "detail": null + }, + { + "check": "editorial: vollständige Inhalte bei 390px", + "passed": true, + "detail": { + "width": 390, + "height": 526.609375, + "horizontal": false, + "overflow": [], + "clipped": [] + } + }, + { + "check": "editorial: Containeranordnung bei 390px", + "passed": true, + "detail": null + }, + { + "check": "editorial: vollständige Inhalte bei 519px", + "passed": true, + "detail": { + "width": 519, + "height": 558.296875, + "horizontal": false, + "overflow": [], + "clipped": [] + } + }, + { + "check": "editorial: Containeranordnung bei 519px", + "passed": true, + "detail": null + }, + { + "check": "editorial: vollständige Inhalte bei 520px", + "passed": true, + "detail": { + "width": 520, + "height": 342.21875, + "horizontal": true, + "overflow": [], + "clipped": [] + } + }, + { + "check": "editorial: Containeranordnung bei 520px", + "passed": true, + "detail": null + }, + { + "check": "editorial: vollständige Inhalte bei 590px", + "passed": true, + "detail": { + "width": 590, + "height": 320.609375, + "horizontal": true, + "overflow": [], + "clipped": [] + } + }, + { + "check": "editorial: Containeranordnung bei 590px", + "passed": true, + "detail": null + }, + { + "check": "editorial: vollständige Inhalte bei 768px", + "passed": true, + "detail": { + "width": 768, + "height": 341.703125, + "horizontal": true, + "overflow": [], + "clipped": [] + } + }, + { + "check": "editorial: Containeranordnung bei 768px", + "passed": true, + "detail": null + }, + { + "check": "editorial: vollständige Inhalte bei 900px", + "passed": true, + "detail": { + "width": 900, + "height": 338.0625, + "horizontal": true, + "overflow": [], + "clipped": [] + } + }, + { + "check": "editorial: Containeranordnung bei 900px", + "passed": true, + "detail": null + }, + { + "check": "editorial: vollständige Inhalte bei 1180px", + "passed": true, + "detail": { + "width": 1180, + "height": 303.625, + "horizontal": true, + "overflow": [], + "clipped": [] + } + }, + { + "check": "editorial: Containeranordnung bei 1180px", + "passed": true, + "detail": null + }, + { + "check": "editorial: ungetrennte lange Inhalte bei 240px", + "passed": true, + "detail": [] + }, + { + "check": "media: vollständige Inhalte bei 240px", + "passed": true, + "detail": { + "width": 240, + "height": 548.859375, + "horizontal": false, + "overflow": [], + "clipped": [] + } + }, + { + "check": "media: Containeranordnung bei 240px", + "passed": true, + "detail": null + }, + { + "check": "media: vollständige Inhalte bei 280px", + "passed": true, + "detail": { + "width": 280, + "height": 518.875, + "horizontal": false, + "overflow": [], + "clipped": [] + } + }, + { + "check": "media: Containeranordnung bei 280px", + "passed": true, + "detail": null + }, + { + "check": "media: vollständige Inhalte bei 320px", + "passed": true, + "detail": { + "width": 320, + "height": 515.90625, + "horizontal": false, + "overflow": [], + "clipped": [] + } + }, + { + "check": "media: Containeranordnung bei 320px", + "passed": true, + "detail": null + }, + { + "check": "media: vollständige Inhalte bei 390px", + "passed": true, + "detail": { + "width": 390, + "height": 530.484375, + "horizontal": false, + "overflow": [], + "clipped": [] + } + }, + { + "check": "media: Containeranordnung bei 390px", + "passed": true, + "detail": null + }, + { + "check": "media: vollständige Inhalte bei 519px", + "passed": true, + "detail": { + "width": 519, + "height": 612.4375, + "horizontal": false, + "overflow": [], + "clipped": [] + } + }, + { + "check": "media: Containeranordnung bei 519px", + "passed": true, + "detail": null + }, + { + "check": "media: vollständige Inhalte bei 520px", + "passed": true, + "detail": { + "width": 520, + "height": 371.5625, + "horizontal": true, + "overflow": [], + "clipped": [] + } + }, + { + "check": "media: Containeranordnung bei 520px", + "passed": true, + "detail": null + }, + { + "check": "media: vollständige Inhalte bei 590px", + "passed": true, + "detail": { + "width": 590, + "height": 347.375, + "horizontal": true, + "overflow": [], + "clipped": [] + } + }, + { + "check": "media: Containeranordnung bei 590px", + "passed": true, + "detail": null + }, + { + "check": "media: vollständige Inhalte bei 768px", + "passed": true, + "detail": { + "width": 768, + "height": 340.25, + "horizontal": true, + "overflow": [], + "clipped": [] + } + }, + { + "check": "media: Containeranordnung bei 768px", + "passed": true, + "detail": null + }, + { + "check": "media: vollständige Inhalte bei 900px", + "passed": true, + "detail": { + "width": 900, + "height": 356.109375, + "horizontal": true, + "overflow": [], + "clipped": [] + } + }, + { + "check": "media: Containeranordnung bei 900px", + "passed": true, + "detail": null + }, + { + "check": "media: vollständige Inhalte bei 1180px", + "passed": true, + "detail": { + "width": 1180, + "height": 357.765625, + "horizontal": true, + "overflow": [], + "clipped": [] + } + }, + { + "check": "media: Containeranordnung bei 1180px", + "passed": true, + "detail": null + }, + { + "check": "media: ungetrennte lange Inhalte bei 240px", + "passed": true, + "detail": [] + }, + { + "check": "catalog: vollständige Inhalte bei 240px", + "passed": true, + "detail": { + "width": 240, + "height": 579.46875, + "horizontal": false, + "overflow": [], + "clipped": [] + } + }, + { + "check": "catalog: Containeranordnung bei 240px", + "passed": true, + "detail": null + }, + { + "check": "catalog: vollständige Inhalte bei 280px", + "passed": true, + "detail": { + "width": 280, + "height": 509.203125, + "horizontal": false, + "overflow": [], + "clipped": [] + } + }, + { + "check": "catalog: Containeranordnung bei 280px", + "passed": true, + "detail": null + }, + { + "check": "catalog: vollständige Inhalte bei 320px", + "passed": true, + "detail": { + "width": 320, + "height": 484.40625, + "horizontal": false, + "overflow": [], + "clipped": [] + } + }, + { + "check": "catalog: Containeranordnung bei 320px", + "passed": true, + "detail": null + }, + { + "check": "catalog: vollständige Inhalte bei 390px", + "passed": true, + "detail": { + "width": 390, + "height": 459.609375, + "horizontal": false, + "overflow": [], + "clipped": [] + } + }, + { + "check": "catalog: Containeranordnung bei 390px", + "passed": true, + "detail": null + }, + { + "check": "catalog: vollständige Inhalte bei 519px", + "passed": true, + "detail": { + "width": 519, + "height": 418.734375, + "horizontal": false, + "overflow": [], + "clipped": [] + } + }, + { + "check": "catalog: Containeranordnung bei 519px", + "passed": true, + "detail": null + }, + { + "check": "catalog: vollständige Inhalte bei 520px", + "passed": true, + "detail": { + "width": 520, + "height": 367.015625, + "horizontal": true, + "overflow": [], + "clipped": [] + } + }, + { + "check": "catalog: Containeranordnung bei 520px", + "passed": true, + "detail": null + }, + { + "check": "catalog: vollständige Inhalte bei 590px", + "passed": true, + "detail": { + "width": 590, + "height": 320.609375, + "horizontal": true, + "overflow": [], + "clipped": [] + } + }, + { + "check": "catalog: Containeranordnung bei 590px", + "passed": true, + "detail": null + }, + { + "check": "catalog: vollständige Inhalte bei 768px", + "passed": true, + "detail": { + "width": 768, + "height": 341.703125, + "horizontal": true, + "overflow": [], + "clipped": [] + } + }, + { + "check": "catalog: Containeranordnung bei 768px", + "passed": true, + "detail": null + }, + { + "check": "catalog: vollständige Inhalte bei 900px", + "passed": true, + "detail": { + "width": 900, + "height": 338.0625, + "horizontal": true, + "overflow": [], + "clipped": [] + } + }, + { + "check": "catalog: Containeranordnung bei 900px", + "passed": true, + "detail": null + }, + { + "check": "catalog: vollständige Inhalte bei 1180px", + "passed": true, + "detail": { + "width": 1180, + "height": 341.375, + "horizontal": true, + "overflow": [], + "clipped": [] + } + }, + { + "check": "catalog: Containeranordnung bei 1180px", + "passed": true, + "detail": null + }, + { + "check": "catalog: ungetrennte lange Inhalte bei 240px", + "passed": true, + "detail": [] + }, + { + "check": "Bildformat portrait, contain, 280px", + "passed": true, + "detail": { + "fit": "contain", + "overflow": false + } + }, + { + "check": "Bildformat square, contain, 280px", + "passed": true, + "detail": { + "fit": "contain", + "overflow": false + } + }, + { + "check": "Bildformat landscape, contain, 280px", + "passed": true, + "detail": { + "fit": "contain", + "overflow": false + } + }, + { + "check": "Bildformat portrait, cover, 280px", + "passed": true, + "detail": { + "fit": "cover", + "overflow": false + } + }, + { + "check": "Bildformat square, cover, 280px", + "passed": true, + "detail": { + "fit": "cover", + "overflow": false + } + }, + { + "check": "Bildformat landscape, cover, 280px", + "passed": true, + "detail": { + "fit": "cover", + "overflow": false + } + }, + { + "check": "Bildformat portrait, contain, 590px", + "passed": true, + "detail": { + "fit": "contain", + "overflow": false + } + }, + { + "check": "Bildformat square, contain, 590px", + "passed": true, + "detail": { + "fit": "contain", + "overflow": false + } + }, + { + "check": "Bildformat landscape, contain, 590px", + "passed": true, + "detail": { + "fit": "contain", + "overflow": false + } + }, + { + "check": "Bildformat portrait, cover, 590px", + "passed": true, + "detail": { + "fit": "cover", + "overflow": false + } + }, + { + "check": "Bildformat square, cover, 590px", + "passed": true, + "detail": { + "fit": "cover", + "overflow": false + } + }, + { + "check": "Bildformat landscape, cover, 590px", + "passed": true, + "detail": { + "fit": "cover", + "overflow": false + } + }, + { + "check": "Sichtbarer Tastaturfokus", + "passed": true, + "detail": { + "width": "3px", + "style": "solid" + } + }, + { + "check": "Reflow bei 720 CSS-px (1440px bei 200% Zoom)", + "passed": true, + "detail": null + }, + { + "check": "Keine JavaScript-Fehler", + "passed": true, + "detail": [] + } + ], + "errors": [] +} diff --git a/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/docs/repository-handoff.json b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/docs/repository-handoff.json new file mode 100644 index 0000000..4b7d2bd --- /dev/null +++ b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/docs/repository-handoff.json @@ -0,0 +1,8 @@ +{ + "date": "2026-11-18", + "target": "C:\\Dev\\Lara-und-felix.de\\docs\\Brand-UI-Kit\\13_premium_karten_v1.7_entwurf", + "status": "Entwurf zur visuellen Freigabe; nicht verbindlich", + "copied_files_verified_sha256": 39, + "existing_files_verified_unchanged": 15, + "integration": "Nur neuer Dokumentations-/Entwurfsordner; keine Änderung der Anwendung oder Registry" +} diff --git a/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/laravel/resources/views/components/lf/premium-card-grid.blade.php b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/laravel/resources/views/components/lf/premium-card-grid.blade.php new file mode 100644 index 0000000..c8cb6e7 --- /dev/null +++ b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/laravel/resources/views/components/lf/premium-card-grid.blade.php @@ -0,0 +1,8 @@ +{{-- Slot-Inhalt: je Karte x-lf.premium-card mit lf-pc-span-1 bis -4. + Das bestehende CMS-Raster kann die Hosts auch selbst anordnen. --}} +@props(['equalHeight' => false]) +
+
class(['lf-pc-grid', 'lf-pc-grid--equal' => $equalHeight]) }}> + {{ $slot }} +
+
diff --git a/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/laravel/resources/views/components/lf/premium-card.blade.php b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/laravel/resources/views/components/lf/premium-card.blade.php new file mode 100644 index 0000000..48f0fb1 --- /dev/null +++ b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/laravel/resources/views/components/lf/premium-card.blade.php @@ -0,0 +1,63 @@ +{{-- v1.7 ENTWURF: reine Präsentation. Medien, Module und Programme werden extern aufgelöst. + URLs müssen bereits freigegeben/autorisiert sein. Keine Berechtigungsentscheidung hier. --}} +@props([ + 'variant' => 'editorial', 'title' => '', 'summary' => '', 'kind' => '', + 'meta' => [], 'note' => '', 'image' => [], 'action' => [], + 'format' => 'landscape', 'fit' => 'cover', 'headingLevel' => 'h3', + 'accentSrc' => '', +]) +@php + $variant = in_array($variant, ['editorial', 'media', 'catalog'], true) ? $variant : 'editorial'; + $format = in_array($format, ['landscape', 'square', 'portrait'], true) ? $format : 'landscape'; + $fit = $fit === 'contain' ? 'contain' : 'cover'; + $headingLevel = in_array($headingLevel, ['h2', 'h3', 'h4'], true) ? $headingLevel : 'h3'; + // Zusätzlicher Schutz: nur lokale oder HTTP(S)-Ziele. Autorisierung bleibt beim Aufrufer. + $safeUrl = static function ($value): string { + if (! is_string($value)) return ''; + $value = trim($value); + if ($value === '' || preg_match('/[\x00-\x20\x7f\\\\]/', $value)) return ''; + if (str_starts_with($value, '//')) return ''; + if (str_starts_with($value, '/') || str_starts_with($value, '#')) return $value; + return filter_var($value, FILTER_VALIDATE_URL) && in_array(strtolower(parse_url($value, PHP_URL_SCHEME) ?? ''), ['http', 'https'], true) ? $value : ''; + }; + $src = $safeUrl($image['src'] ?? ''); + $accent = $safeUrl($accentSrc); + $url = $safeUrl($action['url'] ?? ''); + $label = trim((string) ($action['label'] ?? '')); + $hasAction = $url !== '' && $label !== ''; + $hasPanel = $variant === 'catalog' && $src === ''; + $kind = trim((string) $kind); + $meta = array_values(array_filter(array_map(static fn ($item) => is_scalar($item) ? trim((string) $item) : '', is_array($meta) ? $meta : []), static fn ($item) => $item !== '')); + $focusX = max(0, min(100, is_numeric($image['focus_x'] ?? null) ? (float) $image['focus_x'] : 66)); + $focusY = max(0, min(100, is_numeric($image['focus_y'] ?? null) ? (float) $image['focus_y'] : 45)); +@endphp +
class(['lf-pc-host']) }}> +
$src === '' && ! $hasPanel]) + style="--pc-focus-x:{{ $focusX }}%;--pc-focus-y:{{ $focusY }}%"> + @if ($src !== '') +
+ {{ $image['alt'] ?? '' }} + @if (trim((string) ($image['badge'] ?? '')) !== ''){{ $image['badge'] }}@endif +
+ @elseif ($hasPanel) + + @endif +
+ @if ($kind !== '')

{{ $kind }}

@endif + <{{ $headingLevel }} class="lf-pc__title">{{ $title }} + @if (trim((string) $summary) !== '')

{{ $summary }}

@endif + @if ($meta !== [])
    @foreach ($meta as $item)
  • {{ $item }}
  • @endforeach
@endif + @if ($hasAction || trim((string) $note) !== '') + + @endif +
+
+
diff --git a/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/preview/index.html b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/preview/index.html new file mode 100644 index 0000000..2fa3835 --- /dev/null +++ b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/preview/index.html @@ -0,0 +1,11 @@ + +Lara & Felix · Premium-Karten v1.7 · Entwurf +
Brand & UI Kit · v1.7
Entwurf zur Freigabe
+

Die Premium-Kartenfamilie

Eine Familie. Drei klare Aufgaben.

Themen entdecken, Medien nutzen, Programme verstehen. Eine gemeinsame Gestaltung mit einem eigenen Charakter für jede Aufgabe.

Gestaltungsvorschau · Alle Texte, Laufzeiten und Umfänge sind Beispieldaten. Keine Produkt- oder Veröffentlichungsfreigabe.

+ +
Lara und Felix stehen nebeneinander im Park.

Themenwelt

Gefühle verstehen. Grenzen stärken.

Geschichten und Impulse, die Kinder ins Gespräch bringen – und Trainerinnen und Trainer im Alltag begleiten.

  • Wissen & Praxis
Originalmotiv aus dem Film: Denkpause.Film

Film & Begleitmaterial

Eine Pause, die stark macht.

Gemeinsam innehalten, die Situation betrachten und über gute nächste Schritte sprechen.

  • Film · 3 Min.
  • Begleitmaterial · PDF

Programm

Schritt für Schritt zu mehr Selbstvertrauen.

Ein roter Faden für die Kursgestaltung. Zusammenhängende Themen geben Orientierung für die gemeinsame Arbeit.

  • 4 Module
  • Für die Kursplanung
+

Ein oder zwei Rastereinheiten.

Das Vierer-Raster ordnet die Karten an. Jede Karte entscheidet anhand ihrer eigenen Breite, ob Bild und Text untereinander oder nebeneinander stehen.

Raster: 1 + 1 + 2Volle Texte · flexible Höhe
Lara und Felix stehen nebeneinander im Park.

Themenwelt

Gefühle verstehen. Grenzen stärken.

Geschichten und Impulse, die Kinder ins Gespräch bringen – und Trainerinnen und Trainer im Alltag begleiten.

  • Wissen & Praxis
Originalmotiv aus dem Film: Denkpause.Film

Film & Begleitmaterial

Eine Pause, die stark macht.

Gemeinsam innehalten, die Situation betrachten und über gute nächste Schritte sprechen.

  • Film · 3 Min.
  • Begleitmaterial · PDF

Programm

Schritt für Schritt zu mehr Selbstvertrauen.

Ein roter Faden für die Kursgestaltung. Zusammenhängende Themen geben Orientierung für die gemeinsame Arbeit.

  • 4 Module
  • Für die Kursplanung
Raster: 2 + 2Thema und Modul
Lara und Felix stehen nebeneinander im Park.

Themenwelt

Gefühle verstehen. Grenzen stärken.

Geschichten und Impulse, die Kinder ins Gespräch bringen – und Trainerinnen und Trainer im Alltag begleiten.

  • Wissen & Praxis

Modul

Eigene Grenzen wahrnehmen und benennen.

Kinder lernen, auf ihr Gefühl zu hören und ihre Grenzen auszudrücken. Geschichten und Übungen begleiten das gemeinsame Lernen.

  • Für die gemeinsame Kursstunde
+

Die Breite bestimmt die Anordnung.

Bis 519 px gestapelt, ab 520 px mit Bild neben dem Text. Der gewählte Bildfokus bleibt erhalten; vollständiges Einpassen ist zusätzlich möglich.

Lara und Felix stehen nebeneinander im Park.

Themenwelt

Gefühle verstehen. Grenzen stärken.

Geschichten und Impulse, die Kinder ins Gespräch bringen – und Trainerinnen und Trainer im Alltag begleiten.

  • Wissen & Praxis
+

Auch ohne perfekte Inhalte vollständig.

Ohne Bild, mit vollständigem Motiv oder mit viel Text: keine abgeschnittenen Inhalte, keine erzwungene Gesamthöhe und keine leeren Metadatenzeilen.

Modul

Wenn Überschriften und Beschreibungen mehr Raum brauchen, wächst die Karte mit.

Auch ausführliche Texte werden vollständig dargestellt. Unterschiedliche Inhaltshöhen bleiben möglich. Ohne Aktion und Metadaten entstehen keine leeren Platzhalter; die Karte ist hier bewusst rein informativ.

+
V1.7 · Gestaltungskomponente zur Abnahme. Medien, Module und Programme bleiben getrennte Fachobjekte. Bestehende Kit-Versionen und Originalassets sind unverändert.
+

Kartenaktion

Diese Aktion gehört zur Gestaltungsvorschau. In der Anwendung führt sie zum freigegebenen Thema, Medium, Modul oder Programm. Zugriff und Ziel bestimmt das jeweilige Fachobjekt.

\ No newline at end of file diff --git a/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/preview/preview.css b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/preview/preview.css new file mode 100644 index 0000000..7f52ca2 --- /dev/null +++ b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/preview/preview.css @@ -0,0 +1,37 @@ +* { box-sizing: border-box; } +:root { --lf-navy:#032551; --lf-green-deep:#3b7b09; --lf-yellow:#fcd10a; --lf-cream:#f7f6f2; --lf-white:#fff; --lf-navy-deep:#01244c; --lf-ink:#15243a; --lf-ink-muted:#3e4c5c; --lf-line:#d5ddd6; --lf-focus:#1769aa; --lf-font-ui:'Segoe UI',system-ui,sans-serif; --lf-font-display:'Trebuchet MS','Segoe UI',sans-serif; --grid-gap:24px; } +body { margin:0; background:var(--lf-cream); color:var(--lf-navy); font:16px/1.6 var(--lf-font-ui); } +.preview-wrap { max-inline-size:1248px; margin:auto; padding-inline:32px; } +.preview-header { border-bottom:1px solid var(--lf-line); background:#fff; } +.preview-header .preview-wrap { display:flex; align-items:center; justify-content:space-between; gap:24px; min-height:104px; } +.preview-logo { width:176px; height:auto; display:block; } +.preview-status { font-size:12px; font-weight:700; letter-spacing:.05em; text-transform:uppercase; } +main { padding-block:48px 72px; } +.preview-eyebrow { color:var(--lf-green-deep); font-size:12px; text-transform:uppercase; letter-spacing:.13em; font-weight:800; margin:0 0 12px; } +h1 { font:800 clamp(2rem,4vw,3.35rem)/1.1 var(--lf-font-display); letter-spacing:-.035em; margin:0 0 20px; } +.preview-lede { max-width:760px; font-size:18px; color:var(--lf-ink-muted); margin:0 0 18px; } +.preview-accent { display:block; width:104px; height:auto; margin:0 0 26px; } +.preview-note { font-size:13px; color:var(--lf-ink-muted); } +.preview-nav { display:flex; flex-wrap:wrap; gap:12px 24px; margin-block:24px 34px; } +.preview-nav a { color:var(--lf-navy); text-underline-offset:5px; font-size:14px; font-weight:650; } +.preview-nav a:focus-visible, input:focus-visible, select:focus-visible, button:focus-visible { outline:3px solid #1769aa; outline-offset:4px; } +.preview-overview { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:24px; align-items:stretch; } +.preview-overview > .lf-pc-host { height:100%; } +.preview-section { margin-top:64px; scroll-margin-top:20px; } +.preview-section h2 { font:800 1.7rem/1.2 var(--lf-font-display); letter-spacing:-.025em; margin:0 0 12px; } +.preview-section > p { color:var(--lf-ink-muted); margin:0 0 24px; max-width:760px; } +.preview-control { display:flex; flex-wrap:wrap; align-items:center; gap:14px 24px; margin:20px 0; padding:18px 22px; border:1px solid var(--lf-line); border-radius:14px; background:white; } +.preview-control label { display:flex; align-items:center; gap:10px; font-size:14px; } +.preview-control input[type=range] { width:180px; accent-color:var(--lf-green-deep); } +.preview-control input[type=checkbox] { width:18px; height:18px; accent-color:var(--lf-green-deep); } +.preview-control select { font:inherit; padding:8px; border:1px solid var(--lf-line); border-radius:8px; background:white; } +#width-stage { width:590px; max-width:100%; } +.preview-annotation { display:flex; align-items:center; justify-content:space-between; gap:16px; font-size:13px; margin-bottom:12px; } +dialog { border:1px solid var(--lf-line); border-radius:22px; padding:32px; max-width:min(580px,calc(100% - 32px)); color:var(--lf-navy); } +dialog::backdrop { background:rgb(3 37 81 / .5); } +dialog h2 { margin-top:0; } +dialog button { cursor:pointer; padding:12px 20px; color:#fff; background:var(--lf-green-deep); border:0; border-radius:999px; font:700 1rem var(--lf-font-ui); min-height:44px; } +.preview-stress { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:24px; align-items:start; } +.preview-footer { margin-top:64px; padding-top:24px; border-top:1px solid var(--lf-line); font-size:13px; color:var(--lf-ink-muted); } +@media(max-width:800px) { .preview-wrap { padding-inline:24px; }.preview-overview,.preview-stress { grid-template-columns:1fr; }.preview-overview { max-width:590px; }.preview-header .preview-wrap { min-height:84px; }.preview-logo { width:144px; } } +@media(max-width:480px) { .preview-wrap { padding-inline:20px; }main { padding-top:32px; }.preview-header .preview-wrap { gap:14px; }.preview-status { font-size:10px; max-width:120px; }.preview-lede { font-size:16px; }.preview-section { margin-top:48px; }.preview-control { padding:16px; }.preview-control label { flex-wrap:wrap; } } diff --git a/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/preview/preview.js b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/preview/preview.js new file mode 100644 index 0000000..7f628a1 --- /dev/null +++ b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/preview/preview.js @@ -0,0 +1,19 @@ +const stage = document.querySelector('#width-stage'); +const slider = document.querySelector('#container-width'); +const output = document.querySelector('#width-output'); +slider.addEventListener('input', () => { stage.style.width = `${slider.value}px`; output.value = `${slider.value} px`; }); +document.querySelector('#equal-height').addEventListener('change', event => { + document.querySelector('#real-grid').classList.toggle('lf-pc-grid--equal', event.target.checked); +}); +document.querySelector('#image-fit').addEventListener('change', event => { + const card = stage.querySelector('.lf-pc'); + card.classList.toggle('lf-pc--contain', event.target.value === 'contain'); + card.classList.toggle('lf-pc--cover', event.target.value === 'cover'); +}); +const dialog = document.querySelector('#demo-detail'); +document.querySelectorAll('[data-demo]').forEach(link => link.addEventListener('click', event => { + event.preventDefault(); + dialog.querySelector('h2').textContent = link.closest('.lf-pc').querySelector('.lf-pc__title').textContent; + dialog.showModal(); +})); +dialog.querySelector('button').addEventListener('click', () => dialog.close()); diff --git a/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/preview/screenshots/catalog-280.png b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/preview/screenshots/catalog-280.png new file mode 100644 index 0000000..5b03ae5 Binary files /dev/null and b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/preview/screenshots/catalog-280.png differ diff --git a/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/preview/screenshots/catalog-590.png b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/preview/screenshots/catalog-590.png new file mode 100644 index 0000000..d94c068 Binary files /dev/null and b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/preview/screenshots/catalog-590.png differ diff --git a/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/preview/screenshots/catalog-900.png b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/preview/screenshots/catalog-900.png new file mode 100644 index 0000000..6c284fb Binary files /dev/null and b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/preview/screenshots/catalog-900.png differ diff --git a/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/preview/screenshots/desktop-1440.png b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/preview/screenshots/desktop-1440.png new file mode 100644 index 0000000..8a1dba8 Binary files /dev/null and b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/preview/screenshots/desktop-1440.png differ diff --git a/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/preview/screenshots/drei-varianten-desktop.png b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/preview/screenshots/drei-varianten-desktop.png new file mode 100644 index 0000000..3ca5899 Binary files /dev/null and b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/preview/screenshots/drei-varianten-desktop.png differ diff --git a/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/preview/screenshots/drei-varianten-mobil.png b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/preview/screenshots/drei-varianten-mobil.png new file mode 100644 index 0000000..7c7fcd8 Binary files /dev/null and b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/preview/screenshots/drei-varianten-mobil.png differ diff --git a/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/preview/screenshots/editorial-280.png b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/preview/screenshots/editorial-280.png new file mode 100644 index 0000000..33608dc Binary files /dev/null and b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/preview/screenshots/editorial-280.png differ diff --git a/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/preview/screenshots/editorial-590.png b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/preview/screenshots/editorial-590.png new file mode 100644 index 0000000..71f9690 Binary files /dev/null and b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/preview/screenshots/editorial-590.png differ diff --git a/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/preview/screenshots/editorial-900.png b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/preview/screenshots/editorial-900.png new file mode 100644 index 0000000..fcf0ffe Binary files /dev/null and b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/preview/screenshots/editorial-900.png differ diff --git a/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/preview/screenshots/media-280.png b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/preview/screenshots/media-280.png new file mode 100644 index 0000000..45f4b8b Binary files /dev/null and b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/preview/screenshots/media-280.png differ diff --git a/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/preview/screenshots/media-590.png b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/preview/screenshots/media-590.png new file mode 100644 index 0000000..6e97029 Binary files /dev/null and b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/preview/screenshots/media-590.png differ diff --git a/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/preview/screenshots/media-900.png b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/preview/screenshots/media-900.png new file mode 100644 index 0000000..2c48412 Binary files /dev/null and b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/preview/screenshots/media-900.png differ diff --git a/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/preview/screenshots/mobil-390.png b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/preview/screenshots/mobil-390.png new file mode 100644 index 0000000..0454a16 Binary files /dev/null and b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/preview/screenshots/mobil-390.png differ diff --git a/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/preview/screenshots/raster-1-1-2.png b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/preview/screenshots/raster-1-1-2.png new file mode 100644 index 0000000..f6674e0 Binary files /dev/null and b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/preview/screenshots/raster-1-1-2.png differ diff --git a/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/preview/screenshots/raster-2-2.png b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/preview/screenshots/raster-2-2.png new file mode 100644 index 0000000..fd71d28 Binary files /dev/null and b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/preview/screenshots/raster-2-2.png differ diff --git a/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/preview/screenshots/sonderfaelle.png b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/preview/screenshots/sonderfaelle.png new file mode 100644 index 0000000..5a5f3b0 Binary files /dev/null and b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/preview/screenshots/sonderfaelle.png differ diff --git a/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/tests/browser.py b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/tests/browser.py new file mode 100644 index 0000000..bae71a1 --- /dev/null +++ b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/tests/browser.py @@ -0,0 +1,96 @@ +"""Local rendering/geometry checks, explicitly authorized by the user. No server/network.""" +from pathlib import Path +import json +from playwright.sync_api import sync_playwright + +ROOT = Path(__file__).resolve().parents[1] +SHOTS = ROOT/'preview'/'screenshots' +SHOTS.mkdir(exist_ok=True) +checks = [] +errors = [] + +def check(ok, name, detail=None): + checks.append(dict(check=name, passed=bool(ok), detail=detail)) + if not ok: + (ROOT/'docs'/'qa-browser.json').write_text(json.dumps(dict(status='failed', checks=checks, errors=errors),indent=2,ensure_ascii=False),encoding='utf-8') + raise AssertionError(f'{name}: {detail}') + +with sync_playwright() as p: + candidates = sorted((Path.home()/'AppData/Local/ms-playwright').glob('chromium-*/chrome-win*/chrome.exe'), reverse=True) + browser = p.chromium.launch(headless=True, executable_path=str(candidates[0]) if candidates else None) + page = browser.new_page(viewport=dict(width=1440,height=1100), device_scale_factor=1) + page.on('pageerror', lambda error: errors.append(str(error))) + page.goto((ROOT/'preview'/'index.html').as_uri(), wait_until='load') + page.locator('img').evaluate_all('(images) => { images.forEach(i => i.loading = "eager"); }') + page.wait_for_function('[...document.images].every(i => i.complete && i.naturalWidth > 0)',timeout=15000) + check(page.locator('.preview-overview .lf-pc').count()==3,'Drei konkrete Varianten') + check(page.locator('img').evaluate_all('(images) => images.every(i => i.complete && i.naturalWidth > 0)'), 'Alle Originalassets geladen') + page.screenshot(path=str(SHOTS/'desktop-1440.png')) + page.locator('.preview-overview').screenshot(path=str(SHOTS/'drei-varianten-desktop.png')) + page.locator('#real-grid').screenshot(path=str(SHOTS/'raster-1-1-2.png')) + page.locator('#raster .lf-pc-section').nth(1).screenshot(path=str(SHOTS/'raster-2-2.png')) + page.locator('.preview-stress').screenshot(path=str(SHOTS/'sonderfaelle.png')) + heights=page.locator('#real-grid .lf-pc').evaluate_all('(cards)=>cards.map(c=>c.getBoundingClientRect().height)') + check(max(heights)-min(heights)<2, 'Optionale Gleichhöhe je Rasterzeile', heights) + page.locator('#equal-height').uncheck() + natural=page.locator('#real-grid .lf-pc').evaluate_all('(cards)=>cards.map(c=>c.getBoundingClientRect().height)') + check(max(natural)-min(natural)>10,'Natürliche unterschiedliche Inhaltshöhen',natural) + page.locator('#equal-height').check() + page.locator('.preview-overview .lf-pc__cta').first.click() + check(page.locator('#demo-detail').is_visible(),'Kartenaktion öffnet Vorschau-Dialog') + page.keyboard.press('Escape') + check(not page.locator('#demo-detail').is_visible(),'Dialog per Escape schließbar') + page.locator('.preview-nav a').first.focus() + for width in [320,390,768,1440]: + page.set_viewport_size(dict(width=width,height=1000)) + check(page.evaluate('document.documentElement.scrollWidth <= innerWidth'), f'Kein Seitenüberlauf {width}px') + if width==390: + page.screenshot(path=str(SHOTS/'mobil-390.png'),full_page=True) + page.locator('.preview-overview').screenshot(path=str(SHOTS/'drei-varianten-mobil.png')) + page.set_viewport_size(dict(width=1440,height=1100)) + # Save original card variants, then exercise each one in the same measurable host. + originals=page.locator('.preview-overview .lf-pc').evaluate_all('(cards)=>cards.map(c=>c.outerHTML)') + for variant, html in zip(['editorial','media','catalog'],originals): + page.locator('#width-stage .lf-pc-host').evaluate('(host, html)=>host.innerHTML=html',html) + for width in [240,280,320,390,519,520,590,768,900,1180]: + page.locator('#container-width').fill(str(width)) + page.locator('#container-width').dispatch_event('input') + info=page.locator('#width-stage .lf-pc').evaluate('''card=>{ + const r=card.getBoundingClientRect(); + const body=card.querySelector('.lf-pc__body').getBoundingClientRect(); + const visual=card.querySelector('.lf-pc__visual,.lf-pc__panel').getBoundingClientRect(); + return {width:r.width,height:r.height,horizontal:body.left>visual.left+20, + overflow:[...card.querySelectorAll('*')].filter(e=>e.clientWidth && e.scrollWidth>e.clientWidth+1).map(e=>e.className), + clipped:[...card.querySelectorAll('.lf-pc__title,.lf-pc__summary,.lf-pc__cta,.lf-pc__meta')].filter(e=>{let x=e.getBoundingClientRect();return x.leftr.right+1||x.bottom>r.bottom+1;}).map(e=>e.className)}; + }''') + check(not info['overflow'] and not info['clipped'],f'{variant}: vollständige Inhalte bei {width}px',info) + check(info['horizontal']==(width>=520),f'{variant}: Containeranordnung bei {width}px') + if width in [280,590,900]: page.locator('#width-stage').screenshot(path=str(SHOTS/f'{variant}-{width}.png')) + # Unbroken long strings and absent metadata/buttons. + page.locator('#width-stage .lf-pc__title').evaluate("e=>e.textContent='VollständigeLangeÜberschrift'.repeat(12)") + page.locator('#width-stage .lf-pc__cta').evaluate("e=>e.textContent='LangeMehrzeiligeHandlungsaufforderung'.repeat(8)") + page.locator('#container-width').fill('240') + page.locator('#container-width').dispatch_event('input') + overflow=page.locator('#width-stage .lf-pc').evaluate("c=>[...c.querySelectorAll('*')].filter(e=>e.clientWidth&&e.scrollWidth>e.clientWidth+1).map(e=>e.className)") + check(not overflow,f'{variant}: ungetrennte lange Inhalte bei 240px',overflow) + # Fit/format combinations at narrow and wide card widths. + page.locator('#width-stage .lf-pc-host').evaluate('(host, html)=>host.innerHTML=html',originals[0]) + for width in [280,590]: + page.locator('#container-width').fill(str(width));page.locator('#container-width').dispatch_event('input') + for fit in ['contain','cover']: + page.locator('#image-fit').select_option(fit) + for fmt in ['portrait','square','landscape']: + info=page.locator('#width-stage .lf-pc').evaluate('''(c,fmt)=>{c.classList.remove('lf-pc--portrait','lf-pc--square','lf-pc--landscape');c.classList.add('lf-pc--'+fmt);const img=c.querySelector('img');return {fit:getComputedStyle(img).objectFit,overflow:c.scrollWidth>c.clientWidth+1}}''',fmt) + check(info['fit']==fit and not info['overflow'],f'Bildformat {fmt}, {fit}, {width}px',info) + # Final fresh preview, keyboard focus, mobile screenshots and 200%-equivalent reflow. + page.reload(wait_until='load') + page.locator('.preview-overview .lf-pc__cta').first.focus() + focus=page.locator('.preview-overview .lf-pc__cta').first.evaluate("e=>({width:getComputedStyle(e).outlineWidth,style:getComputedStyle(e).outlineStyle})") + check(focus['style']!='none' and float(focus['width'].replace('px',''))>=3,'Sichtbarer Tastaturfokus',focus) + page.set_viewport_size(dict(width=720,height=1000)) + check(page.evaluate('document.documentElement.scrollWidth<=innerWidth'),'Reflow bei 720 CSS-px (1440px bei 200% Zoom)') + check(not errors,'Keine JavaScript-Fehler',errors) + browser.close() + +(ROOT/'docs'/'qa-browser.json').write_text(json.dumps(dict(status='passed',checks=checks,errors=errors),indent=2,ensure_ascii=False)+'\n',encoding='utf-8') +print(json.dumps(dict(status='passed',checks=len(checks),screenshots=len(list(SHOTS.glob('*.png')))))) diff --git a/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/tests/render.php b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/tests/render.php new file mode 100644 index 0000000..5009bed --- /dev/null +++ b/docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/tests/render.php @@ -0,0 +1,77 @@ +register('blade', fn () => new CompilerEngine($compiler, $files)); +$factory = new Factory($resolver, new FileViewFinder($files, [$root.'/laravel/resources/views']), new Dispatcher($container)); +$factory->setContainer($container); +$container->instance('view', $factory); +$container->instance(Illuminate\Contracts\View\Factory::class, $factory); +$container->instance('blade.compiler', $compiler); +$checks = []; +$render = fn (array $data) => $factory->make('components.lf.premium-card', array_merge(['attributes' => new ComponentAttributeBag], $data))->render(); +$check = static function (bool $ok, string $name) use (&$checks): void { + $checks[] = ['check' => $name, 'passed' => $ok]; + if (! $ok) { + throw new RuntimeException('Failed: '.$name); + } +}; + +try { + foreach (['editorial', 'media', 'catalog'] as $variant) { + $html = $render(['variant' => $variant, 'title' => 'Vollständiger Titel']); + $check(str_contains($html, 'lf-pc--'.$variant), 'Variante '.$variant); + $check(! str_contains($html, 'lf-pc__footer'), 'Keine leere Aktion: '.$variant); + $check(! str_contains($html, 'lf-pc__meta'), 'Keine leeren Metadaten: '.$variant); + $check(str_contains($html, 'lf-pc__panel') === ($variant === 'catalog'), 'Ohne Bild: '.$variant); + } + $html = $render(['title' => '', 'summary' => 'Text', 'kind' => '', 'image' => ['src' => '/approved.png', 'alt' => '" onerror="alert(1)'], 'action' => ['url' => '/thema', 'label' => 'Entdecken']]); + $check(! str_contains($html, '