removed invitelayout resources
This commit is contained in:
@@ -2,8 +2,6 @@
|
||||
|
||||
namespace App\Support;
|
||||
|
||||
use App\Models\InviteLayout;
|
||||
|
||||
class JoinTokenLayoutRegistry
|
||||
{
|
||||
private const DEFAULT_DESCRIPTION = 'Helft uns, diesen besonderen Tag mit euren schönen Momenten festzuhalten.';
|
||||
@@ -41,16 +39,16 @@ class JoinTokenLayoutRegistry
|
||||
'name' => 'Foldable Table Card (A5)',
|
||||
'subtitle' => 'Doppelseitige Tischkarte zum Falten – QR vorn & hinten.',
|
||||
'description' => self::DEFAULT_DESCRIPTION,
|
||||
'paper' => 'a4',
|
||||
'orientation' => 'landscape',
|
||||
'panel_mode' => 'double-mirror',
|
||||
'format_hint' => 'foldable-a5',
|
||||
'slots' => self::SLOTS_FOLDABLE,
|
||||
'container_padding_px' => 28,
|
||||
'background' => '#F8FAFC',
|
||||
'background_gradient' => [
|
||||
'angle' => 180,
|
||||
'stops' => ['#F8FAFC', '#EEF2FF', '#F8FAFC'],
|
||||
'paper' => 'a4',
|
||||
'orientation' => 'landscape',
|
||||
'panel_mode' => 'double-mirror',
|
||||
'format_hint' => 'foldable-a5',
|
||||
'slots' => self::SLOTS_FOLDABLE,
|
||||
'container_padding_px' => 28,
|
||||
'background' => '#F8FAFC',
|
||||
'background_gradient' => [
|
||||
'angle' => 180,
|
||||
'stops' => ['#F8FAFC', '#EEF2FF', '#F8FAFC'],
|
||||
],
|
||||
'text' => '#0F172A',
|
||||
'accent' => '#2563EB',
|
||||
@@ -70,16 +68,16 @@ class JoinTokenLayoutRegistry
|
||||
'id' => 'evergreen-vows',
|
||||
'name' => 'Evergreen Vows',
|
||||
'subtitle' => 'Romantische Einladung für Trauung & Empfang.',
|
||||
'description' => self::DEFAULT_DESCRIPTION,
|
||||
'paper' => 'a4',
|
||||
'orientation' => 'portrait',
|
||||
'format_hint' => 'poster-a4',
|
||||
'slots' => self::SLOTS_PORTRAIT,
|
||||
'background' => '#FBF7F2',
|
||||
'background_gradient' => [
|
||||
'angle' => 165,
|
||||
'stops' => ['#FBF7F2', '#FDECEF', '#F4F0FF'],
|
||||
],
|
||||
'description' => self::DEFAULT_DESCRIPTION,
|
||||
'paper' => 'a4',
|
||||
'orientation' => 'portrait',
|
||||
'format_hint' => 'poster-a4',
|
||||
'slots' => self::SLOTS_PORTRAIT,
|
||||
'background' => '#FBF7F2',
|
||||
'background_gradient' => [
|
||||
'angle' => 165,
|
||||
'stops' => ['#FBF7F2', '#FDECEF', '#F4F0FF'],
|
||||
],
|
||||
'text' => '#2C1A27',
|
||||
'accent' => '#B85C76',
|
||||
'secondary' => '#E7D6DC',
|
||||
@@ -98,16 +96,16 @@ class JoinTokenLayoutRegistry
|
||||
'id' => 'midnight-gala',
|
||||
'name' => 'Midnight Gala',
|
||||
'subtitle' => 'Eleganter Auftritt für Corporate Events & Galas.',
|
||||
'description' => self::DEFAULT_DESCRIPTION,
|
||||
'paper' => 'a4',
|
||||
'orientation' => 'portrait',
|
||||
'format_hint' => 'poster-a4',
|
||||
'slots' => self::SLOTS_PORTRAIT,
|
||||
'background' => '#0B132B',
|
||||
'background_gradient' => [
|
||||
'angle' => 200,
|
||||
'stops' => ['#0B132B', '#1C2541', '#274690'],
|
||||
],
|
||||
'description' => self::DEFAULT_DESCRIPTION,
|
||||
'paper' => 'a4',
|
||||
'orientation' => 'portrait',
|
||||
'format_hint' => 'poster-a4',
|
||||
'slots' => self::SLOTS_PORTRAIT,
|
||||
'background' => '#0B132B',
|
||||
'background_gradient' => [
|
||||
'angle' => 200,
|
||||
'stops' => ['#0B132B', '#1C2541', '#274690'],
|
||||
],
|
||||
'text' => '#F8FAFC',
|
||||
'accent' => '#F9C74F',
|
||||
'secondary' => '#4E5D8F',
|
||||
@@ -126,16 +124,16 @@ class JoinTokenLayoutRegistry
|
||||
'id' => 'garden-brunch',
|
||||
'name' => 'Garden Brunch',
|
||||
'subtitle' => 'Luftiges Layout für Tages-Events & Familienfeiern.',
|
||||
'description' => self::DEFAULT_DESCRIPTION,
|
||||
'paper' => 'a4',
|
||||
'orientation' => 'portrait',
|
||||
'format_hint' => 'poster-a4',
|
||||
'slots' => self::SLOTS_PORTRAIT,
|
||||
'background' => '#F6F9F4',
|
||||
'background_gradient' => [
|
||||
'angle' => 120,
|
||||
'stops' => ['#F6F9F4', '#EEF5E7', '#F8FAF0'],
|
||||
],
|
||||
'description' => self::DEFAULT_DESCRIPTION,
|
||||
'paper' => 'a4',
|
||||
'orientation' => 'portrait',
|
||||
'format_hint' => 'poster-a4',
|
||||
'slots' => self::SLOTS_PORTRAIT,
|
||||
'background' => '#F6F9F4',
|
||||
'background_gradient' => [
|
||||
'angle' => 120,
|
||||
'stops' => ['#F6F9F4', '#EEF5E7', '#F8FAF0'],
|
||||
],
|
||||
'text' => '#2F4030',
|
||||
'accent' => '#6BAA75',
|
||||
'secondary' => '#DDE9D8',
|
||||
@@ -154,16 +152,16 @@ class JoinTokenLayoutRegistry
|
||||
'id' => 'sparkler-soiree',
|
||||
'name' => 'Sparkler Soirée',
|
||||
'subtitle' => 'Abendliches Layout mit funkelndem Verlauf.',
|
||||
'description' => self::DEFAULT_DESCRIPTION,
|
||||
'paper' => 'a4',
|
||||
'orientation' => 'portrait',
|
||||
'format_hint' => 'poster-a4',
|
||||
'slots' => self::SLOTS_PORTRAIT,
|
||||
'background' => '#1B1A44',
|
||||
'background_gradient' => [
|
||||
'angle' => 205,
|
||||
'stops' => ['#1B1A44', '#42275A', '#734B8F'],
|
||||
],
|
||||
'description' => self::DEFAULT_DESCRIPTION,
|
||||
'paper' => 'a4',
|
||||
'orientation' => 'portrait',
|
||||
'format_hint' => 'poster-a4',
|
||||
'slots' => self::SLOTS_PORTRAIT,
|
||||
'background' => '#1B1A44',
|
||||
'background_gradient' => [
|
||||
'angle' => 205,
|
||||
'stops' => ['#1B1A44', '#42275A', '#734B8F'],
|
||||
],
|
||||
'text' => '#FDF7FF',
|
||||
'accent' => '#F9A826',
|
||||
'secondary' => '#DDB7FF',
|
||||
@@ -182,16 +180,16 @@ class JoinTokenLayoutRegistry
|
||||
'id' => 'confetti-bash',
|
||||
'name' => 'Confetti Bash',
|
||||
'subtitle' => 'Verspielter Look für Geburtstage & Jubiläen.',
|
||||
'description' => self::DEFAULT_DESCRIPTION,
|
||||
'paper' => 'a4',
|
||||
'orientation' => 'portrait',
|
||||
'format_hint' => 'poster-a4',
|
||||
'slots' => self::SLOTS_PORTRAIT,
|
||||
'background' => '#FFF9F0',
|
||||
'background_gradient' => [
|
||||
'angle' => 145,
|
||||
'stops' => ['#FFF9F0', '#FFEFEF', '#FFF5D6'],
|
||||
],
|
||||
'description' => self::DEFAULT_DESCRIPTION,
|
||||
'paper' => 'a4',
|
||||
'orientation' => 'portrait',
|
||||
'format_hint' => 'poster-a4',
|
||||
'slots' => self::SLOTS_PORTRAIT,
|
||||
'background' => '#FFF9F0',
|
||||
'background_gradient' => [
|
||||
'angle' => 145,
|
||||
'stops' => ['#FFF9F0', '#FFEFEF', '#FFF5D6'],
|
||||
],
|
||||
'text' => '#31291F',
|
||||
'accent' => '#FF6F61',
|
||||
'secondary' => '#F9D6A5',
|
||||
@@ -215,18 +213,6 @@ class JoinTokenLayoutRegistry
|
||||
*/
|
||||
public static function all(): array
|
||||
{
|
||||
$customLayouts = InviteLayout::query()
|
||||
->where('is_active', true)
|
||||
->orderBy('name')
|
||||
->get();
|
||||
|
||||
if ($customLayouts->isNotEmpty()) {
|
||||
return $customLayouts
|
||||
->map(fn (InviteLayout $layout) => self::normalize(self::fromModel($layout)))
|
||||
->values()
|
||||
->all();
|
||||
}
|
||||
|
||||
return array_values(array_map(fn ($layout) => self::normalize($layout), self::LAYOUTS));
|
||||
}
|
||||
|
||||
@@ -235,15 +221,6 @@ class JoinTokenLayoutRegistry
|
||||
*/
|
||||
public static function find(string $id): ?array
|
||||
{
|
||||
$custom = InviteLayout::query()
|
||||
->where('slug', $id)
|
||||
->where('is_active', true)
|
||||
->first();
|
||||
|
||||
if ($custom) {
|
||||
return self::normalize(self::fromModel($custom));
|
||||
}
|
||||
|
||||
$layout = self::LAYOUTS[$id] ?? null;
|
||||
|
||||
return $layout ? self::normalize($layout) : null;
|
||||
@@ -260,6 +237,8 @@ class JoinTokenLayoutRegistry
|
||||
'paper' => 'a4',
|
||||
'orientation' => 'portrait',
|
||||
'panel_mode' => null,
|
||||
'canvas_width' => null,
|
||||
'canvas_height' => null,
|
||||
'container_padding_px' => 48,
|
||||
'background' => '#F9FAFB',
|
||||
'text' => '#0F172A',
|
||||
@@ -287,6 +266,11 @@ class JoinTokenLayoutRegistry
|
||||
|
||||
$normalized = array_replace_recursive($defaults, $layout);
|
||||
|
||||
if (($normalized['canvas_width'] === null || $normalized['canvas_height'] === null) && isset($normalized['svg']['width'], $normalized['svg']['height'])) {
|
||||
$normalized['canvas_width'] = $normalized['canvas_width'] ?? $normalized['svg']['width'];
|
||||
$normalized['canvas_height'] = $normalized['canvas_height'] ?? $normalized['svg']['height'];
|
||||
}
|
||||
|
||||
$formats = $normalized['formats'] ?? ['pdf', 'png'];
|
||||
if (! is_array($formats)) {
|
||||
$formats = [$formats];
|
||||
@@ -319,47 +303,6 @@ class JoinTokenLayoutRegistry
|
||||
return self::SLOTS_FOLDABLE;
|
||||
}
|
||||
|
||||
private static function fromModel(InviteLayout $layout): array
|
||||
{
|
||||
$preview = $layout->preview ?? [];
|
||||
$options = $layout->layout_options ?? [];
|
||||
$instructions = $layout->instructions ?? [];
|
||||
$slots = $options['slots'] ?? null;
|
||||
|
||||
return array_filter([
|
||||
'id' => $layout->slug,
|
||||
'name' => $layout->name,
|
||||
'subtitle' => $layout->subtitle,
|
||||
'description' => $layout->description,
|
||||
'paper' => $layout->paper,
|
||||
'orientation' => $layout->orientation,
|
||||
'format_hint' => self::resolveFormatHint($layout->paper, $layout->orientation, $layout->panel_mode),
|
||||
'background' => $preview['background'] ?? null,
|
||||
'background_gradient' => $preview['background_gradient'] ?? null,
|
||||
'text' => $preview['text'] ?? null,
|
||||
'accent' => $preview['accent'] ?? null,
|
||||
'secondary' => $preview['secondary'] ?? null,
|
||||
'badge' => $preview['badge'] ?? null,
|
||||
'badge_label' => $options['badge_label'] ?? null,
|
||||
'instructions_heading' => $options['instructions_heading'] ?? null,
|
||||
'link_heading' => $options['link_heading'] ?? null,
|
||||
'cta_label' => $options['cta_label'] ?? null,
|
||||
'cta_caption' => $options['cta_caption'] ?? null,
|
||||
'link_label' => $options['link_label'] ?? null,
|
||||
'logo_url' => $options['logo_url'] ?? null,
|
||||
'slots' => is_array($slots) ? $slots : null,
|
||||
'qr' => array_filter([
|
||||
'size_px' => $preview['qr']['size_px'] ?? $options['qr']['size_px'] ?? $preview['qr_size_px'] ?? $options['qr_size_px'] ?? null,
|
||||
]),
|
||||
'svg' => array_filter([
|
||||
'width' => $preview['svg']['width'] ?? $options['svg']['width'] ?? $preview['svg_width'] ?? $options['svg_width'] ?? null,
|
||||
'height' => $preview['svg']['height'] ?? $options['svg']['height'] ?? $preview['svg_height'] ?? $options['svg_height'] ?? null,
|
||||
]),
|
||||
'formats' => $options['formats'] ?? ['pdf', 'png'],
|
||||
'instructions' => $instructions,
|
||||
], fn ($value) => $value !== null && $value !== []);
|
||||
}
|
||||
|
||||
private static function resolveFormatHint(?string $paper, ?string $orientation, ?string $panelMode): ?string
|
||||
{
|
||||
$paperVal = strtolower((string) $paper);
|
||||
@@ -397,6 +340,8 @@ class JoinTokenLayoutRegistry
|
||||
'orientation' => $layout['orientation'] ?? 'portrait',
|
||||
'panel_mode' => $layout['panel_mode'] ?? null,
|
||||
'format_hint' => $layout['format_hint'] ?? self::resolveFormatHint($layout['paper'] ?? null, $layout['orientation'] ?? null, $layout['panel_mode'] ?? null),
|
||||
'canvas_width' => $layout['canvas_width'] ?? ($layout['svg']['width'] ?? null),
|
||||
'canvas_height' => $layout['canvas_height'] ?? ($layout['svg']['height'] ?? null),
|
||||
'badge_label' => $layout['badge_label'] ?? null,
|
||||
'instructions_heading' => $layout['instructions_heading'] ?? null,
|
||||
'link_heading' => $layout['link_heading'] ?? null,
|
||||
@@ -404,6 +349,7 @@ class JoinTokenLayoutRegistry
|
||||
'cta_caption' => $layout['cta_caption'] ?? null,
|
||||
'instructions' => $layout['instructions'] ?? [],
|
||||
'slots' => $layout['slots'] ?? null,
|
||||
'elements' => $layout['elements'] ?? null,
|
||||
'preview' => [
|
||||
'background' => $layout['background'],
|
||||
'background_gradient' => $layout['background_gradient'],
|
||||
|
||||
Reference in New Issue
Block a user