removed invitelayout resources
This commit is contained in:
@@ -1,141 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\InviteLayouts;
|
||||
|
||||
use App\Filament\Resources\InviteLayouts\Pages\CreateInviteLayout;
|
||||
use App\Filament\Resources\InviteLayouts\Pages\EditInviteLayout;
|
||||
use App\Filament\Resources\InviteLayouts\Pages\ListInviteLayouts;
|
||||
use App\Filament\Resources\InviteLayouts\Schemas\InviteLayoutForm;
|
||||
use App\Filament\Resources\InviteLayouts\Tables\InviteLayoutsTable;
|
||||
use App\Models\InviteLayout;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Str;
|
||||
use UnitEnum;
|
||||
|
||||
class InviteLayoutResource extends Resource
|
||||
{
|
||||
protected static ?string $model = InviteLayout::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedRectangleStack;
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = null;
|
||||
|
||||
protected static ?int $navigationSort = 8;
|
||||
|
||||
public static function getNavigationLabel(): string
|
||||
{
|
||||
return __('admin.nav.invite_layouts') ?? 'Layout-Vorlagen';
|
||||
}
|
||||
|
||||
public static function getNavigationGroup(): UnitEnum|string|null
|
||||
{
|
||||
return __('admin.nav.branding') ?? 'Branding & Assets';
|
||||
}
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return InviteLayoutForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return InviteLayoutsTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListInviteLayouts::route('/'),
|
||||
'create' => CreateInviteLayout::route('/create'),
|
||||
'edit' => EditInviteLayout::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function normalizePayload(array $data): array
|
||||
{
|
||||
$data['slug'] = Str::slug($data['slug'] ?? $data['name'] ?? 'layout');
|
||||
|
||||
$preview = $data['preview'] ?? [];
|
||||
$qrSize = Arr::get($preview, 'qr.size_px', Arr::get($preview, 'qr_size_px'));
|
||||
$svgWidth = Arr::get($preview, 'svg.width', Arr::get($preview, 'svg_width'));
|
||||
$svgHeight = Arr::get($preview, 'svg.height', Arr::get($preview, 'svg_height'));
|
||||
|
||||
$data['preview'] = array_filter([
|
||||
'background' => $preview['background'] ?? null,
|
||||
'background_gradient' => $preview['background_gradient'] ?? null,
|
||||
'accent' => $preview['accent'] ?? null,
|
||||
'secondary' => $preview['secondary'] ?? null,
|
||||
'text' => $preview['text'] ?? null,
|
||||
'badge' => $preview['badge'] ?? null,
|
||||
'qr' => array_filter([
|
||||
'size_px' => $qrSize !== null ? (int) $qrSize : null,
|
||||
]),
|
||||
'svg' => array_filter([
|
||||
'width' => $svgWidth !== null ? (int) $svgWidth : null,
|
||||
'height' => $svgHeight !== null ? (int) $svgHeight : null,
|
||||
]),
|
||||
], fn ($value) => $value !== null && (! is_array($value) || ! empty($value)));
|
||||
|
||||
if (empty($data['preview']['qr'])) {
|
||||
unset($data['preview']['qr']);
|
||||
}
|
||||
|
||||
if (empty($data['preview']['svg'])) {
|
||||
unset($data['preview']['svg']);
|
||||
}
|
||||
|
||||
$layoutOptions = $data['layout_options'] ?? [];
|
||||
$formats = $layoutOptions['formats'] ?? ['pdf', 'png'];
|
||||
if (is_string($formats)) {
|
||||
$formats = array_values(array_filter(array_map('trim', explode(',', $formats))));
|
||||
}
|
||||
$normalizedFormats = [];
|
||||
foreach ($formats ?: ['pdf', 'png'] as $format) {
|
||||
$value = strtolower((string) $format);
|
||||
if ($value === 'svg') {
|
||||
$value = 'png';
|
||||
}
|
||||
|
||||
if (in_array($value, ['pdf', 'png'], true) && ! in_array($value, $normalizedFormats, true)) {
|
||||
$normalizedFormats[] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
$layoutOptions['formats'] = $normalizedFormats ?: ['pdf', 'png'];
|
||||
|
||||
$data['layout_options'] = array_filter([
|
||||
'badge_label' => $layoutOptions['badge_label'] ?? null,
|
||||
'instructions_heading' => $layoutOptions['instructions_heading'] ?? null,
|
||||
'link_heading' => $layoutOptions['link_heading'] ?? null,
|
||||
'cta_label' => $layoutOptions['cta_label'] ?? null,
|
||||
'cta_caption' => $layoutOptions['cta_caption'] ?? null,
|
||||
'link_label' => $layoutOptions['link_label'] ?? null,
|
||||
'logo_url' => $layoutOptions['logo_url'] ?? null,
|
||||
'formats' => $layoutOptions['formats'],
|
||||
], fn ($value) => $value !== null && $value !== []);
|
||||
|
||||
if (empty($data['layout_options']['logo_url'])) {
|
||||
unset($data['layout_options']['logo_url']);
|
||||
}
|
||||
|
||||
$instructions = $data['instructions'] ?? [];
|
||||
if (is_array($instructions) && isset($instructions[0]) && is_array($instructions[0]) && array_key_exists('value', $instructions[0])) {
|
||||
$instructions = array_map(fn ($item) => $item['value'] ?? null, $instructions);
|
||||
}
|
||||
$data['instructions'] = array_values(array_filter(array_map(fn ($value) => is_string($value) ? trim($value) : null, $instructions)));
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\InviteLayouts\Pages;
|
||||
|
||||
use App\Filament\Resources\InviteLayouts\InviteLayoutResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class CreateInviteLayout extends CreateRecord
|
||||
{
|
||||
protected static string $resource = InviteLayoutResource::class;
|
||||
|
||||
protected function mutateFormDataBeforeCreate(array $data): array
|
||||
{
|
||||
$data = InviteLayoutResource::normalizePayload($data);
|
||||
$data['created_by'] = Auth::id();
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\InviteLayouts\Pages;
|
||||
|
||||
use App\Filament\Resources\InviteLayouts\InviteLayoutResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditInviteLayout extends EditRecord
|
||||
{
|
||||
protected static string $resource = InviteLayoutResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
|
||||
protected function mutateFormDataBeforeSave(array $data): array
|
||||
{
|
||||
return InviteLayoutResource::normalizePayload($data);
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\InviteLayouts\Pages;
|
||||
|
||||
use App\Filament\Resources\InviteLayouts\InviteLayoutResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListInviteLayouts extends ListRecords
|
||||
{
|
||||
protected static string $resource = InviteLayoutResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,158 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\InviteLayouts\Schemas;
|
||||
|
||||
use Filament\Forms\Components\ColorPicker;
|
||||
use Filament\Forms\Components\Repeater;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Schemas\Components\Section;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class InviteLayoutForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema->schema([
|
||||
Section::make('Grunddaten')
|
||||
->columns(2)
|
||||
->schema([
|
||||
TextInput::make('name')
|
||||
->label('Name')
|
||||
->required()
|
||||
->maxLength(255)
|
||||
->afterStateUpdated(fn (callable $set, $state) => $set('slug', Str::slug((string) $state ?? '')))
|
||||
->reactive(),
|
||||
TextInput::make('slug')
|
||||
->label('Slug')
|
||||
->required()
|
||||
->maxLength(191)
|
||||
->unique(ignoreRecord: true),
|
||||
TextInput::make('subtitle')
|
||||
->label('Unterzeile')
|
||||
->maxLength(255)
|
||||
->columnSpanFull(),
|
||||
Textarea::make('description')
|
||||
->label('Beschreibung')
|
||||
->rows(4)
|
||||
->columnSpanFull(),
|
||||
Toggle::make('is_active')
|
||||
->label('Aktiv')
|
||||
->default(true),
|
||||
]),
|
||||
|
||||
Section::make('Papier & Format')
|
||||
->columns(3)
|
||||
->schema([
|
||||
Select::make('paper')
|
||||
->label('Papierformat')
|
||||
->options([
|
||||
'a4' => 'A4 (210 × 297 mm)',
|
||||
'a5' => 'A5 (148 × 210 mm)',
|
||||
'a3' => 'A3 (297 × 420 mm)',
|
||||
'custom' => 'Benutzerdefiniert',
|
||||
])
|
||||
->default('a4'),
|
||||
Select::make('orientation')
|
||||
->label('Ausrichtung')
|
||||
->options([
|
||||
'portrait' => 'Hochformat',
|
||||
'landscape' => 'Querformat',
|
||||
])
|
||||
->default('portrait'),
|
||||
TextInput::make('layout_options.formats')
|
||||
->label('Formate (Komma getrennt)')
|
||||
->default('pdf,svg')
|
||||
->helperText('Bestimmt, welche Downloads angeboten werden.')
|
||||
->dehydrateStateUsing(fn ($state) => collect(explode(',', (string) $state))
|
||||
->map(fn ($value) => trim((string) $value))
|
||||
->filter()
|
||||
->values()
|
||||
->all())
|
||||
->afterStateHydrated(function (TextInput $component, $state) {
|
||||
if (is_array($state)) {
|
||||
$component->state(implode(',', $state));
|
||||
}
|
||||
}),
|
||||
]),
|
||||
|
||||
Section::make('Farben')
|
||||
->columns(5)
|
||||
->schema([
|
||||
ColorPicker::make('preview.background')
|
||||
->label('Hintergrund')
|
||||
->default('#F9FAFB'),
|
||||
ColorPicker::make('preview.accent')
|
||||
->label('Akzent')
|
||||
->default('#6366F1'),
|
||||
ColorPicker::make('preview.text')
|
||||
->label('Text')
|
||||
->default('#0F172A'),
|
||||
ColorPicker::make('preview.secondary')
|
||||
->label('Sekundär')
|
||||
->default('#CBD5F5'),
|
||||
ColorPicker::make('preview.badge')
|
||||
->label('Badge')
|
||||
->default('#2563EB'),
|
||||
TextInput::make('preview.qr.size_px')
|
||||
->label('QR-Größe (px)')
|
||||
->numeric()
|
||||
->default(320)
|
||||
->columnSpan(2),
|
||||
TextInput::make('preview.svg.width')
|
||||
->label('SVG Breite')
|
||||
->numeric()
|
||||
->default(1080),
|
||||
TextInput::make('preview.svg.height')
|
||||
->label('SVG Höhe')
|
||||
->numeric()
|
||||
->default(1520),
|
||||
]),
|
||||
|
||||
Section::make('Texte & Hinweise')
|
||||
->columns(2)
|
||||
->schema([
|
||||
TextInput::make('layout_options.badge_label')
|
||||
->label('Badge-Label')
|
||||
->default('Digitale Gästebox'),
|
||||
TextInput::make('layout_options.instructions_heading')
|
||||
->label('Anleitungstitel')
|
||||
->default("So funktioniert's"),
|
||||
TextInput::make('layout_options.link_heading')
|
||||
->label('Link-Titel')
|
||||
->default('Alternative zum Einscannen'),
|
||||
TextInput::make('layout_options.cta_label')
|
||||
->label('CTA Label')
|
||||
->default('Scan mich & starte direkt'),
|
||||
TextInput::make('layout_options.cta_caption')
|
||||
->label('CTA Untertitel')
|
||||
->default('Scan mich & starte direkt'),
|
||||
TextInput::make('layout_options.link_label')
|
||||
->label('Link Text (optional)')
|
||||
->helperText('Überschreibt den standardmäßigen Einladungslink.'),
|
||||
TextInput::make('layout_options.logo_url')
|
||||
->label('Logo URL')
|
||||
->columnSpanFull(),
|
||||
Repeater::make('instructions')
|
||||
->label('Hinweise')
|
||||
->maxItems(6)
|
||||
->schema([
|
||||
Textarea::make('value')
|
||||
->label('Hinweistext')
|
||||
->rows(2)
|
||||
->required()
|
||||
->maxLength(180),
|
||||
])
|
||||
->afterStateHydrated(function (Repeater $component, $state): void {
|
||||
if (is_array($state) && ! empty($state) && ! is_array(current($state))) {
|
||||
$component->state(array_map(fn ($value) => ['value' => $value], $state));
|
||||
}
|
||||
})
|
||||
->dehydrateStateUsing(fn ($state) => collect($state)->pluck('value')->filter()->values()->all()),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\InviteLayouts\Tables;
|
||||
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Tables\Columns\BadgeColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class InviteLayoutsTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('name')
|
||||
->label('Name')
|
||||
->searchable()
|
||||
->sortable(),
|
||||
TextColumn::make('slug')
|
||||
->label('Slug')
|
||||
->copyable()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
TextColumn::make('paper')
|
||||
->label('Papier')
|
||||
->sortable(),
|
||||
TextColumn::make('orientation')
|
||||
->label('Ausrichtung')
|
||||
->sortable(),
|
||||
BadgeColumn::make('is_active')
|
||||
->label('Status')
|
||||
->colors([
|
||||
'success' => fn ($state) => $state === true,
|
||||
'gray' => fn ($state) => $state === false,
|
||||
])
|
||||
->getStateUsing(fn ($record) => $record->is_active)
|
||||
->formatStateUsing(fn ($state) => $state ? 'Aktiv' : 'Inaktiv'),
|
||||
TextColumn::make('updated_at')
|
||||
->label('Aktualisiert')
|
||||
->dateTime('d.m.Y H:i')
|
||||
->sortable(),
|
||||
])
|
||||
->filters([
|
||||
SelectFilter::make('is_active')
|
||||
->label('Status')
|
||||
->options([
|
||||
'1' => 'Aktiv',
|
||||
'0' => 'Inaktiv',
|
||||
])
|
||||
->query(function ($query, $state) {
|
||||
if ($state === '1') {
|
||||
$query->where('is_active', true);
|
||||
} elseif ($state === '0') {
|
||||
$query->where('is_active', false);
|
||||
}
|
||||
}),
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
DeleteAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -244,22 +244,22 @@ class EventJoinTokenLayoutController extends Controller
|
||||
|
||||
private function buildAdvancedLayout(array $layout, $customization, string $qrPngDataUri, string $tokenUrl, string $eventName): ?array
|
||||
{
|
||||
if (! is_array($customization)) {
|
||||
$customization = is_array($customization) ? $customization : [];
|
||||
$hasLayoutElements = is_array($layout['elements'] ?? null) && ! empty($layout['elements']);
|
||||
$isAdvancedRequested = ($customization['mode'] ?? null) === 'advanced';
|
||||
|
||||
if (! $isAdvancedRequested && ! $hasLayoutElements) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (($customization['mode'] ?? null) !== 'advanced') {
|
||||
return null;
|
||||
}
|
||||
|
||||
$elements = $customization['elements'] ?? null;
|
||||
$elements = $customization['elements'] ?? ($layout['elements'] ?? null);
|
||||
|
||||
if (! is_array($elements) || empty($elements)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$width = (int) ($layout['svg']['width'] ?? 1080);
|
||||
$height = (int) ($layout['svg']['height'] ?? 1520);
|
||||
$width = (int) ($layout['canvas_width'] ?? $layout['svg']['width'] ?? 1080);
|
||||
$height = (int) ($layout['canvas_height'] ?? $layout['svg']['height'] ?? 1520);
|
||||
$accent = $layout['accent'] ?? '#6366F1';
|
||||
$text = $layout['text'] ?? '#0F172A';
|
||||
$secondary = $layout['secondary'] ?? '#1F2937';
|
||||
@@ -273,11 +273,11 @@ class EventJoinTokenLayoutController extends Controller
|
||||
$resolved = [];
|
||||
|
||||
foreach ($elements as $element) {
|
||||
if (! is_array($element) || empty($element['id']) || empty($element['type'])) {
|
||||
if (! is_array($element) || empty($element['id']) || (! isset($element['type']) && ! isset($element['role']))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$type = (string) $element['type'];
|
||||
$type = (string) ($element['role'] ?? $element['type']);
|
||||
$dimensions = $this->normalizeElementDimensions($type, $element, $width, $height);
|
||||
$content = $this->resolveElementContent($type, $customization, $layout, $eventName, $tokenUrl, $element['content'] ?? null);
|
||||
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class InviteLayout extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'slug',
|
||||
'name',
|
||||
'subtitle',
|
||||
'description',
|
||||
'paper',
|
||||
'orientation',
|
||||
'preview',
|
||||
'layout_options',
|
||||
'instructions',
|
||||
'is_active',
|
||||
'created_by',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'preview' => 'array',
|
||||
'layout_options' => 'array',
|
||||
'instructions' => 'array',
|
||||
'is_active' => 'bool',
|
||||
];
|
||||
|
||||
public function creator(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'created_by');
|
||||
}
|
||||
}
|
||||
@@ -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.';
|
||||
@@ -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'],
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('invite_layouts', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('slug')->unique();
|
||||
$table->string('name');
|
||||
$table->string('subtitle')->nullable();
|
||||
$table->text('description')->nullable();
|
||||
$table->string('paper')->default('a4');
|
||||
$table->string('orientation')->default('portrait');
|
||||
$table->json('preview')->nullable();
|
||||
$table->json('layout_options')->nullable();
|
||||
$table->json('instructions')->nullable();
|
||||
$table->boolean('is_active')->default(true);
|
||||
$table->unsignedBigInteger('created_by')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('created_by')->references('id')->on('users')->nullOnDelete();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('invite_layouts');
|
||||
}
|
||||
};
|
||||
@@ -1,77 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\InviteLayout;
|
||||
use App\Support\JoinTokenLayoutRegistry;
|
||||
use Illuminate\Database\Seeder;
|
||||
use ReflectionClass;
|
||||
|
||||
class InviteLayoutSeeder extends Seeder
|
||||
{
|
||||
public function run(): void
|
||||
{
|
||||
$reflection = new ReflectionClass(JoinTokenLayoutRegistry::class);
|
||||
$layoutsConst = $reflection->getReflectionConstant('LAYOUTS');
|
||||
$fallbackLayouts = $layoutsConst ? $layoutsConst->getValue() : [];
|
||||
$qrSizeOverrides = [
|
||||
'evergreen-vows' => 640,
|
||||
'midnight-gala' => 640,
|
||||
'garden-brunch' => 660,
|
||||
'sparkler-soiree' => 680,
|
||||
'confetti-bash' => 680,
|
||||
];
|
||||
$defaultQrSize = 640;
|
||||
$targetSvgWidth = 1240;
|
||||
$targetSvgHeight = 1754;
|
||||
|
||||
foreach ($fallbackLayouts as $layout) {
|
||||
$layoutId = $layout['id'] ?? null;
|
||||
$forcedQrSize = $qrSizeOverrides[$layoutId] ?? $defaultQrSize;
|
||||
$existingQrSize = (int) ($layout['qr']['size_px'] ?? $layout['qr_size_px'] ?? 0);
|
||||
$qrSize = max($existingQrSize, $forcedQrSize);
|
||||
|
||||
$existingSvgWidth = (int) ($layout['svg']['width'] ?? $layout['svg_width'] ?? 0);
|
||||
$existingSvgHeight = (int) ($layout['svg']['height'] ?? $layout['svg_height'] ?? 0);
|
||||
$svgWidth = max($existingSvgWidth, $targetSvgWidth);
|
||||
$svgHeight = max($existingSvgHeight, $targetSvgHeight);
|
||||
|
||||
$preview = [
|
||||
'background' => $layout['background'] ?? null,
|
||||
'background_gradient' => $layout['background_gradient'] ?? null,
|
||||
'accent' => $layout['accent'] ?? null,
|
||||
'secondary' => $layout['secondary'] ?? null,
|
||||
'text' => $layout['text'] ?? null,
|
||||
'badge' => $layout['badge'] ?? null,
|
||||
'qr' => ['size_px' => $qrSize],
|
||||
'svg' => ['width' => $svgWidth, 'height' => $svgHeight],
|
||||
];
|
||||
|
||||
$options = [
|
||||
'badge_label' => $layout['badge_label'] ?? 'Digitale Gästebox',
|
||||
'instructions_heading' => $layout['instructions_heading'] ?? "So funktioniert's",
|
||||
'link_heading' => $layout['link_heading'] ?? 'Alternative zum Einscannen',
|
||||
'cta_label' => $layout['cta_label'] ?? 'Scan mich & starte direkt',
|
||||
'cta_caption' => $layout['cta_caption'] ?? 'Scan mich & starte direkt',
|
||||
'link_label' => $layout['link_label'] ?? null,
|
||||
'logo_url' => $layout['logo_url'] ?? null,
|
||||
'formats' => $layout['formats'] ?? ['pdf', 'png'],
|
||||
];
|
||||
|
||||
InviteLayout::updateOrCreate(
|
||||
['slug' => $layout['id']],
|
||||
[
|
||||
'name' => $layout['name'],
|
||||
'subtitle' => $layout['subtitle'] ?? null,
|
||||
'description' => $layout['description'] ?? null,
|
||||
'paper' => $layout['paper'] ?? 'a4',
|
||||
'orientation' => $layout['orientation'] ?? 'portrait',
|
||||
'preview' => $preview,
|
||||
'layout_options' => $options,
|
||||
'instructions' => $layout['instructions'] ?? [],
|
||||
'is_active' => true,
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
790
public/vendor/livewire/livewire.esm.js
vendored
790
public/vendor/livewire/livewire.esm.js
vendored
File diff suppressed because it is too large
Load Diff
6
public/vendor/livewire/livewire.esm.js.map
vendored
6
public/vendor/livewire/livewire.esm.js.map
vendored
File diff suppressed because one or more lines are too long
542
public/vendor/livewire/livewire.js
vendored
542
public/vendor/livewire/livewire.js
vendored
File diff suppressed because it is too large
Load Diff
15
public/vendor/livewire/livewire.min.js
vendored
15
public/vendor/livewire/livewire.min.js
vendored
File diff suppressed because one or more lines are too long
6
public/vendor/livewire/livewire.min.js.map
vendored
6
public/vendor/livewire/livewire.min.js.map
vendored
File diff suppressed because one or more lines are too long
2
public/vendor/livewire/manifest.json
vendored
2
public/vendor/livewire/manifest.json
vendored
@@ -1,2 +1,2 @@
|
||||
|
||||
{"/livewire.js":"df3a17f2"}
|
||||
{"/livewire.js":"646f9d24"}
|
||||
|
||||
Reference in New Issue
Block a user