Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ abstract class EventSettingDomainObjectAbstract extends \HiEvents\DomainObjects\
final public const TICKET_DESIGN_SETTINGS = 'ticket_design_settings';
final public const ATTENDEE_DETAILS_COLLECTION_METHOD = 'attendee_details_collection_method';
final public const SHOW_MARKETING_OPT_IN = 'show_marketing_opt_in';
final public const HOMEPAGE_THEME_SETTINGS = 'homepage_theme_settings';

protected int $id;
protected int $event_id;
Expand Down Expand Up @@ -113,6 +114,7 @@ abstract class EventSettingDomainObjectAbstract extends \HiEvents\DomainObjects\
protected array|string|null $ticket_design_settings = null;
protected string $attendee_details_collection_method = 'PER_TICKET';
protected bool $show_marketing_opt_in = true;
protected array|string|null $homepage_theme_settings = null;

public function toArray(): array
{
Expand Down Expand Up @@ -168,6 +170,7 @@ public function toArray(): array
'ticket_design_settings' => $this->ticket_design_settings ?? null,
'attendee_details_collection_method' => $this->attendee_details_collection_method ?? null,
'show_marketing_opt_in' => $this->show_marketing_opt_in ?? null,
'homepage_theme_settings' => $this->homepage_theme_settings ?? null,
];
}

Expand Down Expand Up @@ -732,4 +735,15 @@ public function getShowMarketingOptIn(): bool
{
return $this->show_marketing_opt_in;
}

public function setHomepageThemeSettings(array|string|null $homepage_theme_settings): self
{
$this->homepage_theme_settings = $homepage_theme_settings;
return $this;
}

public function getHomepageThemeSettings(): array|string|null
{
return $this->homepage_theme_settings;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ abstract class ProductDomainObjectAbstract extends \HiEvents\DomainObjects\Abstr
final public const IS_HIDDEN = 'is_hidden';
final public const PRODUCT_TYPE = 'product_type';
final public const START_COLLAPSED = 'start_collapsed';
final public const IS_HIGHLIGHTED = 'is_highlighted';
final public const HIGHLIGHT_MESSAGE = 'highlight_message';

protected int $id;
protected int $event_id;
Expand All @@ -59,6 +61,8 @@ abstract class ProductDomainObjectAbstract extends \HiEvents\DomainObjects\Abstr
protected ?bool $is_hidden = false;
protected string $product_type = 'TICKET';
protected bool $start_collapsed = false;
protected bool $is_highlighted = false;
protected ?string $highlight_message = null;

public function toArray(): array
{
Expand Down Expand Up @@ -87,6 +91,8 @@ public function toArray(): array
'is_hidden' => $this->is_hidden ?? null,
'product_type' => $this->product_type ?? null,
'start_collapsed' => $this->start_collapsed ?? null,
'is_highlighted' => $this->is_highlighted ?? null,
'highlight_message' => $this->highlight_message ?? null,
];
}

Expand Down Expand Up @@ -353,4 +359,26 @@ public function getStartCollapsed(): bool
{
return $this->start_collapsed;
}

public function setIsHighlighted(bool $is_highlighted): self
{
$this->is_highlighted = $is_highlighted;
return $this;
}

public function getIsHighlighted(): bool
{
return $this->is_highlighted;
}

public function setHighlightMessage(?string $highlight_message): self
{
$this->highlight_message = $highlight_message;
return $this;
}

public function getHighlightMessage(): ?string
{
return $this->highlight_message;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,13 @@ public function rules(): array

// Marketing settings
'show_marketing_opt_in' => ['boolean'],

// Homepage theme settings
'homepage_theme_settings' => ['nullable', 'array'],
'homepage_theme_settings.accent' => ['nullable', 'string', ...RulesHelper::HEX_COLOR],
'homepage_theme_settings.background' => ['nullable', 'string', ...RulesHelper::HEX_COLOR],
'homepage_theme_settings.mode' => ['nullable', 'string', Rule::in(['light', 'dark'])],
'homepage_theme_settings.background_type' => ['nullable', 'string', Rule::in(HomepageBackgroundType::valuesArray())],
];
}

Expand Down Expand Up @@ -124,6 +131,12 @@ public function messages(): array
'ticket_design_settings.accent_color' => $colorMessage,
'ticket_design_settings.footer_text.max' => __('The footer text may not be greater than 500 characters.'),
'ticket_design_settings.layout_type.in' => __('The layout type must be default or modern.'),

// Homepage theme settings messages
'homepage_theme_settings.accent' => $colorMessage,
'homepage_theme_settings.background' => $colorMessage,
'homepage_theme_settings.mode.in' => __('The mode must be light or dark.'),
'homepage_theme_settings.background_type.in' => __('The background type must be COLOR or MIRROR_COVER_IMAGE.'),
];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ public static function rules(): array

// Homepage
'homepage_visibility' => ['nullable', Rule::in(OrganizerHomepageVisibility::valuesArray())],
'homepage_background_color' => ['nullable', ...RulesHelper::HEX_COLOR],
'homepage_primary_color' => ['nullable', ...RulesHelper::HEX_COLOR],
'homepage_primary_text_color' => ['nullable', ...RulesHelper::HEX_COLOR],
'homepage_secondary_color' => ['nullable', ...RulesHelper::HEX_COLOR],
'homepage_secondary_text_color' => ['nullable', ...RulesHelper::HEX_COLOR],
'homepage_content_background_color' => ['nullable', ...RulesHelper::HEX_COLOR],
'homepage_background_type' => ['nullable', Rule::in(HomepageBackgroundType::valuesArray())],

// Homepage theme settings
'homepage_theme_settings' => ['nullable', 'array'],
'homepage_theme_settings.accent' => ['nullable', 'string', ...RulesHelper::HEX_COLOR],
'homepage_theme_settings.background' => ['nullable', 'string', ...RulesHelper::HEX_COLOR],
'homepage_theme_settings.mode' => ['nullable', 'string', Rule::in(['light', 'dark'])],
'homepage_theme_settings.background_type' => ['nullable', 'string', Rule::in(HomepageBackgroundType::valuesArray())],

// SEO
'seo_keywords' => ['sometimes', 'nullable', 'string', 'max:255'],
Expand Down
2 changes: 2 additions & 0 deletions backend/app/Http/Request/Product/UpsertProductRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ public function rules(): array
'product_type' => ['required', Rule::in(ProductType::valuesArray())],
'tax_and_fee_ids' => 'array',
'product_category_id' => ['required', 'integer'],
'is_highlighted' => 'boolean',
'highlight_message' => 'string|nullable|max:255',
];
}

Expand Down
1 change: 1 addition & 0 deletions backend/app/Models/EventSetting.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ protected function getCastMap(): array
'location_details' => 'array',
'payment_providers' => 'array',
'ticket_design_settings' => 'array',
'homepage_theme_settings' => 'array',
];
}
}
3 changes: 3 additions & 0 deletions backend/app/Resources/Event/EventSettingsResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ public function toArray($request): array

// Marketing settings
'show_marketing_opt_in' => $this->getShowMarketingOptIn(),

// Homepage theme settings
'homepage_theme_settings' => $this->getHomepageThemeSettings(),
];
}
}
3 changes: 3 additions & 0 deletions backend/app/Resources/Event/EventSettingsResourcePublic.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ public function toArray($request): array

// Marketing settings
'show_marketing_opt_in' => $this->getShowMarketingOptIn(),

// Homepage theme settings
'homepage_theme_settings' => $this->getHomepageThemeSettings(),
];
}
}
2 changes: 2 additions & 0 deletions backend/app/Resources/Product/ProductResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ public function toArray(Request $request): array
fn() => ProductPriceResource::collection($this->getProductPrices())
),
'product_category_id' => $this->getProductCategoryId(),
'is_highlighted' => $this->getIsHighlighted(),
'highlight_message' => $this->getHighlightMessage(),
];
}
}
2 changes: 2 additions & 0 deletions backend/app/Resources/Product/ProductResourcePublic.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ public function toArray(Request $request): array
'is_sold_out' => $this->isSoldOut(),
]),
'product_category_id' => $this->getProductCategoryId(),
'is_highlighted' => $this->getIsHighlighted(),
'highlight_message' => $this->getHighlightMessage(),
];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ public function __construct(

// Marketing settings
public readonly bool $show_marketing_opt_in = true,

// Homepage theme settings
public readonly ?array $homepage_theme_settings = null,
)
{
}
Expand Down Expand Up @@ -142,6 +145,15 @@ public static function createWithDefaults(

// Marketing defaults
show_marketing_opt_in: true,

// Homepage theme defaults (simplified 2-color + mode system)
homepage_theme_settings: [
'accent' => '#8b5cf6',
'background' => '#f5f3ff',
'mode' => 'light',
'background_type' => 'COLOR',
],
);
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ public function handle(PartialUpdateEventSettingsDTO $eventSettingsDTO): EventSe

// Marketing settings
'show_marketing_opt_in' => $eventSettingsDTO->settings['show_marketing_opt_in'] ?? $existingSettings->getShowMarketingOptIn(),

// Homepage theme settings
'homepage_theme_settings' => array_key_exists('homepage_theme_settings', $eventSettingsDTO->settings)
? $eventSettingsDTO->settings['homepage_theme_settings']
: $existingSettings->getHomepageThemeSettings(),
]),
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ public function handle(UpdateEventSettingsDTO $settings): EventSettingDomainObje

// Marketing settings
'show_marketing_opt_in' => $settings->show_marketing_opt_in,

// Homepage theme settings
'homepage_theme_settings' => $settings->homepage_theme_settings,
],
where: [
'event_id' => $settings->event_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use HiEvents\DataTransferObjects\AddressDTO;
use HiEvents\DataTransferObjects\BaseDataObject;
use HiEvents\DomainObjects\Enums\AttendeeDetailsCollectionMethod;
use HiEvents\DomainObjects\Enums\HomepageBackgroundType;
use HiEvents\DomainObjects\Enums\OrganizerHomepageVisibility;
use Spatie\LaravelData\Attributes\MapInputName;
use Spatie\LaravelData\Attributes\WithCast;
Expand Down Expand Up @@ -57,15 +56,8 @@ public function __construct(
// Homepage settings
public readonly OrganizerHomepageVisibility|Optional|null $homepageVisibility,

public readonly string|Optional|null $homepageBackgroundColor,
public readonly string|Optional|null $homepageContentBackgroundColor,
public readonly string|Optional|null $homepagePrimaryColor,
public readonly string|Optional|null $homepagePrimaryTextColor,
public readonly string|Optional|null $homepageSecondaryColor,
public readonly string|Optional|null $homepageSecondaryTextColor,

#[WithCast(EnumCast::class, HomepageBackgroundType::class)]
public readonly HomepageBackgroundType|Optional|null $homepageBackgroundType,
// Simplified homepage theme settings
public readonly array|Optional|null $homepageThemeSettings,

// SEO
public readonly string|Optional|null $seoKeywords,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,7 @@ public function handle(PartialUpdateOrganizerSettingsDTO $dto): OrganizerSetting

'homepage_visibility' => $dto->getProvided('homepageVisibility', $organizerSettings->getHomepageVisibility()),

'homepage_theme_settings' => [
'homepage_background_color' => $dto->getProvided('homepageBackgroundColor', $organizerSettings->getHomepageThemeSetting('homepage_background_color')),
'homepage_content_background_color' => $dto->getProvided('homepageContentBackgroundColor', $organizerSettings->getHomepageThemeSetting('homepage_content_background_color')),
'homepage_primary_color' => $dto->getProvided('homepagePrimaryColor', $organizerSettings->getHomepageThemeSetting('homepage_primary_color')),
'homepage_primary_text_color' => $dto->getProvided('homepagePrimaryTextColor', $organizerSettings->getHomepageThemeSetting('homepage_primary_text_color')),
'homepage_secondary_color' => $dto->getProvided('homepageSecondaryColor', $organizerSettings->getHomepageThemeSetting('homepage_secondary_color')),
'homepage_secondary_text_color' => $dto->getProvided('homepageSecondaryTextColor', $organizerSettings->getHomepageThemeSetting('homepage_secondary_text_color')),
'homepage_background_type' => $dto->getProvided('homepageBackgroundType', $organizerSettings->getHomepageThemeSetting('homepage_background_type')),
],
'homepage_theme_settings' => $dto->getProvided('homepageThemeSettings', $organizerSettings->getHomepageThemeSettings()),

'seo_keywords' => $dto->getProvided('seoKeywords', $organizerSettings->getSeoKeywords()),
'seo_title' => $dto->getProvided('seoTitle', $organizerSettings->getSeoTitle()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ public function handle(UpsertProductDTO $productsData): ProductDomainObject
->setHideWhenSoldOut($productsData->hide_when_sold_out)
->setShowQuantityRemaining($productsData->show_quantity_remaining)
->setIsHiddenWithoutPromoCode($productsData->is_hidden_without_promo_code)
->setIsHighlighted($productsData->is_highlighted ?? false)
->setHighlightMessage($productsData->highlight_message)
->setProductPrices($productPrices)
->setEventId($productsData->event_id)
->setProductType($productsData->product_type->name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ public function __construct(
public readonly ?bool $is_hidden_without_promo_code = false,
public readonly ?array $tax_and_fee_ids = [],
public readonly ?int $product_id = null,
public readonly ?bool $is_highlighted = false,
public readonly ?string $highlight_message = null,
)
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ private function updateProduct(UpsertProductDTO $productsData, array $where): Pr
'is_hidden_without_promo_code' => $productsData->is_hidden_without_promo_code,
'product_type' => $productsData->product_type->name,
'product_category_id' => $productCategory->getId(),
'is_highlighted' => $productsData->is_highlighted ?? false,
'highlight_message' => $productsData->highlight_message,
],
where: $where
);
Expand Down
52 changes: 24 additions & 28 deletions backend/app/Services/Domain/Event/CreateEventService.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,37 +178,33 @@ private function createEventSettings(
}

$organizerSettings = $organizer->getOrganizerSettings();
$organizerThemeSettings = $organizerSettings->getHomepageThemeSettings() ?? [];

// Build the new homepage_theme_settings from organizer settings
$homepageThemeSettings = [
'accent' => $organizerThemeSettings['accent'] ?? '#8b5cf6',
'background' => $organizerThemeSettings['background'] ?? '#f5f3ff',
'mode' => $organizerThemeSettings['mode'] ?? 'light',
'background_type' => $eventCoverCreated
? HomepageBackgroundType::MIRROR_COVER_IMAGE->name
: ($organizerThemeSettings['background_type'] ?? HomepageBackgroundType::COLOR->name),
];

$this->eventSettingsRepository->create([
'event_id' => $event->getId(),
'homepage_background_color' => $organizerSettings->getHomepageThemeSetting(
'homepage_content_background_color',
'#ffffff'
),
'homepage_primary_text_color' => $organizerSettings->getHomepageThemeSetting(
'homepage_primary_text_color',
'#000000'
),
'homepage_primary_color' => $organizerSettings->getHomepageThemeSetting(
'homepage_primary_color',
'#7b5db8'
),
'homepage_secondary_text_color' => $organizerSettings->getHomepageThemeSetting(
'homepage_secondary_text_color',
'#ffffff'
),
'homepage_secondary_color' => $organizerSettings->getHomepageThemeSetting(
'homepage_secondary_color',
'#7a5eb9'
),
'homepage_body_background_color' => $organizerSettings->getHomepageThemeSetting(
'homepage_background_color',
'#ffffff'
),

'homepage_background_type' => $eventCoverCreated
? HomepageBackgroundType::MIRROR_COVER_IMAGE->name
: HomepageBackgroundType::COLOR->name,

// New theme settings JSON field
'homepage_theme_settings' => $homepageThemeSettings,

// Legacy fields for backward compatibility
'homepage_primary_color' => $homepageThemeSettings['accent'],
'homepage_body_background_color' => $homepageThemeSettings['background'],
'homepage_background_type' => $homepageThemeSettings['background_type'],
'homepage_background_color' => '#ffffff',
'homepage_primary_text_color' => '#000000',
'homepage_secondary_text_color' => '#ffffff',
'homepage_secondary_color' => $homepageThemeSettings['accent'],

'continue_button_text' => __('Continue'),
'support_email' => $organizer->getEmail(),

Expand Down
Loading
Loading