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
3 changes: 3 additions & 0 deletions backend/app/DomainObjects/Enums/ImageType.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ enum ImageType

// Event images
case EVENT_COVER;
case TICKET_LOGO;

// Organizer images
case ORGANIZER_LOGO;
Expand All @@ -24,6 +25,7 @@ public static function eventImageTypes(): array
{
return [
self::EVENT_COVER,
self::TICKET_LOGO,
];
}

Expand All @@ -47,6 +49,7 @@ public static function getMinimumDimensionsMap(ImageType $imageType): array
$map = [
self::GENERIC->name => [50, 50],
self::EVENT_COVER->name => [600, 50],
self::TICKET_LOGO->name => [100, 100],
self::ORGANIZER_LOGO->name => [100, 100],
self::ORGANIZER_COVER->name => [600, 50],
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ abstract class EventSettingDomainObjectAbstract extends \HiEvents\DomainObjects\
final public const ALLOW_ORDERS_AWAITING_OFFLINE_PAYMENT_TO_CHECK_IN = 'allow_orders_awaiting_offline_payment_to_check_in';
final public const INVOICE_PAYMENT_TERMS_DAYS = 'invoice_payment_terms_days';
final public const INVOICE_NOTES = 'invoice_notes';
final public const TICKET_DESIGN_SETTINGS = 'ticket_design_settings';

protected int $id;
protected int $event_id;
Expand Down Expand Up @@ -107,6 +108,7 @@ abstract class EventSettingDomainObjectAbstract extends \HiEvents\DomainObjects\
protected bool $allow_orders_awaiting_offline_payment_to_check_in = false;
protected ?int $invoice_payment_terms_days = null;
protected ?string $invoice_notes = null;
protected array|string|null $ticket_design_settings = null;

public function toArray(): array
{
Expand Down Expand Up @@ -159,6 +161,7 @@ public function toArray(): array
'allow_orders_awaiting_offline_payment_to_check_in' => $this->allow_orders_awaiting_offline_payment_to_check_in ?? null,
'invoice_payment_terms_days' => $this->invoice_payment_terms_days ?? null,
'invoice_notes' => $this->invoice_notes ?? null,
'ticket_design_settings' => $this->ticket_design_settings ?? null,
];
}

Expand Down Expand Up @@ -690,4 +693,15 @@ public function getInvoiceNotes(): ?string
{
return $this->invoice_notes;
}

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

public function getTicketDesignSettings(): array|string|null
{
return $this->ticket_design_settings;
}
}
2 changes: 2 additions & 0 deletions backend/app/Http/Actions/Events/GetEventAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace HiEvents\Http\Actions\Events;

use HiEvents\DomainObjects\EventDomainObject;
use HiEvents\DomainObjects\ImageDomainObject;
use HiEvents\DomainObjects\OrganizerDomainObject;
use HiEvents\DomainObjects\ProductCategoryDomainObject;
use HiEvents\DomainObjects\TaxAndFeesDomainObject;
Expand All @@ -31,6 +32,7 @@ public function __invoke(int $eventId): JsonResponse

$event = $this->eventRepository
->loadRelation(new Relationship(domainObject: OrganizerDomainObject::class, name: 'organizer'))
->loadRelation(new Relationship(ImageDomainObject::class))
->loadRelation(
new Relationship(ProductCategoryDomainObject::class, [
new Relationship(ProductDomainObject::class, [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace HiEvents\Http\Actions\Events\Images;

use HiEvents\DomainObjects\Enums\ImageType;
use HiEvents\DomainObjects\EventDomainObject;
use HiEvents\Http\Actions\BaseAction;
use HiEvents\Repository\Interfaces\ImageRepositoryInterface;
Expand All @@ -22,7 +21,6 @@ public function __invoke(int $eventId): JsonResponse
$images = $this->imageRepository->findWhere([
'entity_id' => $eventId,
'entity_type' => EventDomainObject::class,
'type' => ImageType::EVENT_COVER->name,
]);

return $this->resourceResponse(ImageResource::class, $images);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@ public function rules(): array
'invoice_tax_details' => ['nullable', 'string'],
'invoice_notes' => ['nullable', 'string'],
'invoice_payment_terms_days' => ['nullable', 'integer', 'gte:0', 'lte:1000'],

// Ticket design settings
'ticket_design_settings' => ['nullable', 'array'],
'ticket_design_settings.accent_color' => ['nullable', 'string', ...RulesHelper::HEX_COLOR],
'ticket_design_settings.logo_image_id' => ['nullable', 'integer'],
'ticket_design_settings.footer_text' => ['nullable', 'string', 'max:500'],
'ticket_design_settings.layout_type' => ['nullable', 'string', Rule::in(['default', 'modern'])],
'ticket_design_settings.enabled' => ['boolean'],
];
}

Expand Down Expand Up @@ -106,6 +114,11 @@ public function messages(): array
'organization_name.required_if' => __('The organization name is required when invoicing is enabled.'),
'organization_address.required_if' => __('The organization address is required when invoicing is enabled.'),
'invoice_start_number.min' => __('The invoice start number must be at least 1.'),

// Ticket design messages
'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.'),
];
}
}
1 change: 1 addition & 0 deletions backend/app/Models/EventSetting.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ protected function getCastMap(): array
return [
'location_details' => 'array',
'payment_providers' => 'array',
'ticket_design_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 @@ -47,6 +47,9 @@ public function toArray($request): array
'price_display_mode' => $this->getPriceDisplayMode(),
'hide_getting_started_page' => $this->getHideGettingStartedPage(),

// Ticket design settings
'ticket_design_settings' => $this->getTicketDesignSettings(),

// Payment settings
'payment_providers' => $this->getPaymentProviders(),
'offline_payment_instructions' => $this->getOfflinePaymentInstructions(),
Expand Down
3 changes: 3 additions & 0 deletions backend/app/Resources/Event/EventSettingsResourcePublic.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ public function toArray($request): array
'location_details' => $this->getLocationDetails(),
'is_online_event' => $this->getIsOnlineEvent(),

// Ticket design settings
'ticket_design_settings' => $this->getTicketDesignSettings(),

// SEO settings
'seo_title' => $this->getSeoTitle(),
'seo_description' => $this->getSeoDescription(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use HiEvents\DomainObjects\EventSettingDomainObject;
use HiEvents\DomainObjects\OrderDomainObject;
use HiEvents\DomainObjects\OrderItemDomainObject;
use HiEvents\DomainObjects\OrganizerDomainObject;
use HiEvents\DomainObjects\Status\AttendeeStatus;
use HiEvents\Exceptions\ResourceConflictException;
Expand Down Expand Up @@ -32,7 +33,9 @@ public function __construct(
public function handle(ResendAttendeeTicketDTO $resendAttendeeProductDTO): void
{
$attendee = $this->attendeeRepository
->loadRelation(new Relationship(OrderDomainObject::class, name: 'order'))
->loadRelation(new Relationship(OrderDomainObject::class, nested: [
new Relationship(OrderItemDomainObject::class),
], name: 'order'))
->findFirstWhere([
'id' => $resendAttendeeProductDTO->attendeeId,
'event_id' => $resendAttendeeProductDTO->eventId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ public function __construct(
public readonly ?string $invoice_tax_details = null,
public readonly ?string $invoice_notes = null,
public readonly ?int $invoice_payment_terms_days = null,

// Ticket design settings
public readonly ?array $ticket_design_settings = null,
)
{
}
Expand Down Expand Up @@ -121,6 +124,15 @@ public static function createWithDefaults(
invoice_tax_details: null,
invoice_notes: null,
invoice_payment_terms_days: null,

// Ticket design defaults
ticket_design_settings: [
'accent_color' => '#333333',
'logo_image_id' => null,
'footer_text' => null,
'layout_type' => 'classic',
'enabled' => true,
],
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
use HiEvents\Services\Application\Handlers\EventSettings\DTO\UpdateEventSettingsDTO;
use Throwable;

readonly class PartialUpdateEventSettingsHandler
class PartialUpdateEventSettingsHandler
{
public function __construct(
private UpdateEventSettingsHandler $eventSettingsHandler,
private EventSettingsRepositoryInterface $eventSettingsRepository,
private readonly UpdateEventSettingsHandler $eventSettingsHandler,
private readonly EventSettingsRepositoryInterface $eventSettingsRepository,
)
{
}
Expand Down Expand Up @@ -116,7 +116,12 @@ public function handle(PartialUpdateEventSettingsDTO $eventSettingsDTO): EventSe
: $existingSettings->getInvoiceNotes(),
'invoice_payment_terms_days' => array_key_exists('invoice_payment_terms_days', $eventSettingsDTO->settings)
? $eventSettingsDTO->settings['invoice_payment_terms_days']
: $existingSettings->getInvoicePaymentTermsDays()
: $existingSettings->getInvoicePaymentTermsDays(),

// Ticket design settings
'ticket_design_settings' => array_key_exists('ticket_design_settings', $eventSettingsDTO->settings)
? $eventSettingsDTO->settings['ticket_design_settings']
: $existingSettings->getTicketDesignSettings()
]),
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ public function handle(UpdateEventSettingsDTO $settings): EventSettingDomainObje
'invoice_tax_details' => $this->purifier->purify($settings->invoice_tax_details),
'invoice_notes' => $this->purifier->purify($settings->invoice_notes),
'invoice_payment_terms_days' => $settings->invoice_payment_terms_days,

// Ticket design settings
'ticket_design_settings' => $settings->ticket_design_settings,
],
where: [
'event_id' => $settings->event_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class CreateImageHandler
ImageType::ORGANIZER_LOGO,
ImageType::ORGANIZER_COVER,
ImageType::EVENT_COVER,
ImageType::TICKET_LOGO,
];

public function __construct(
Expand Down
3 changes: 3 additions & 0 deletions backend/app/Services/Domain/Event/CreateEventImageService.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
use Illuminate\Http\UploadedFile;
use Throwable;

/**
* @deprecated use CreateImageAction
*/
class CreateEventImageService
{
public function __construct(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?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::table('event_settings', function (Blueprint $table) {
$table->jsonb('ticket_design_settings')->nullable();
});
}

/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('event_settings', function (Blueprint $table) {
$table->dropColumn('ticket_design_settings');
});
}
};
4 changes: 2 additions & 2 deletions frontend/src/components/common/AttendeeDetails/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Anchor} from "@mantine/core";
import {Attendee} from "../../../types.ts";
import {Attendee, Product} from "../../../types.ts";
import classes from "./AttendeeDetails.module.scss";
import {t} from "@lingui/macro";
import {getAttendeeProductTitle} from "../../../utilites/products.ts";
Expand Down Expand Up @@ -37,7 +37,7 @@ export const AttendeeDetails = ({attendee}: { attendee: Attendee }) => {
{t`Product`}
</div>
<div className={classes.amount}>
{getAttendeeProductTitle(attendee)}
{getAttendeeProductTitle(attendee, attendee.product as Product)}
</div>
</div>
<div className={classes.block}>
Expand Down
Loading
Loading