feat: registration form fields, section preferences, tag sync & schema updates
Implement EAV system for dynamic event-specific registration fields with organisation-level templates, person section preferences with priority ranking, and TagSyncService for deferred tag_picker sync. New tables: registration_field_templates, registration_form_fields, person_field_values, person_section_preferences. New columns: persons.remarks, events.registration_show_section_preferences, events.registration_show_availability. 58 tests, 126 assertions — all 432 tests pass (zero regressions). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -66,6 +66,8 @@ final class Event extends Model
|
||||
'registration_banner_url',
|
||||
'registration_welcome_text',
|
||||
'registration_logo_url',
|
||||
'registration_show_section_preferences',
|
||||
'registration_show_availability',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
@@ -76,6 +78,8 @@ final class Event extends Model
|
||||
'is_recurring' => 'boolean',
|
||||
'recurrence_exceptions' => 'array',
|
||||
'event_type' => 'string',
|
||||
'registration_show_section_preferences' => 'boolean',
|
||||
'registration_show_availability' => 'boolean',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -62,4 +62,9 @@ final class Organisation extends Model
|
||||
{
|
||||
return $this->hasMany(PersonTag::class);
|
||||
}
|
||||
|
||||
public function registrationFieldTemplates(): HasMany
|
||||
{
|
||||
return $this->hasMany(RegistrationFieldTemplate::class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ final class Person extends Model
|
||||
'status',
|
||||
'is_blacklisted',
|
||||
'admin_notes',
|
||||
'remarks',
|
||||
'custom_fields',
|
||||
];
|
||||
|
||||
@@ -94,6 +95,16 @@ final class Person extends Model
|
||||
return $this->hasMany(VolunteerAvailability::class);
|
||||
}
|
||||
|
||||
public function fieldValues(): HasMany
|
||||
{
|
||||
return $this->hasMany(PersonFieldValue::class);
|
||||
}
|
||||
|
||||
public function sectionPreferences(): HasMany
|
||||
{
|
||||
return $this->hasMany(PersonSectionPreference::class);
|
||||
}
|
||||
|
||||
public function identityMatches(): HasMany
|
||||
{
|
||||
return $this->hasMany(PersonIdentityMatch::class);
|
||||
|
||||
37
api/app/Models/PersonFieldValue.php
Normal file
37
api/app/Models/PersonFieldValue.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
final class PersonFieldValue extends Model
|
||||
{
|
||||
public $timestamps = false;
|
||||
|
||||
protected $fillable = [
|
||||
'person_id',
|
||||
'registration_form_field_id',
|
||||
'value',
|
||||
'selected_options',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'selected_options' => 'array',
|
||||
];
|
||||
}
|
||||
|
||||
public function person(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Person::class);
|
||||
}
|
||||
|
||||
public function registrationFormField(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(RegistrationFormField::class);
|
||||
}
|
||||
}
|
||||
36
api/app/Models/PersonSectionPreference.php
Normal file
36
api/app/Models/PersonSectionPreference.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
final class PersonSectionPreference extends Model
|
||||
{
|
||||
public $timestamps = false;
|
||||
|
||||
protected $fillable = [
|
||||
'person_id',
|
||||
'festival_section_id',
|
||||
'priority',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'priority' => 'integer',
|
||||
];
|
||||
}
|
||||
|
||||
public function person(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Person::class);
|
||||
}
|
||||
|
||||
public function festivalSection(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(FestivalSection::class);
|
||||
}
|
||||
}
|
||||
71
api/app/Models/RegistrationFieldTemplate.php
Normal file
71
api/app/Models/RegistrationFieldTemplate.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enums\RegistrationFieldType;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Concerns\HasUlids;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
final class RegistrationFieldTemplate extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use HasUlids;
|
||||
|
||||
protected $fillable = [
|
||||
'organisation_id',
|
||||
'label',
|
||||
'slug',
|
||||
'field_type',
|
||||
'options',
|
||||
'tag_category',
|
||||
'is_required',
|
||||
'is_filterable',
|
||||
'is_portal_visible',
|
||||
'is_admin_only',
|
||||
'section',
|
||||
'help_text',
|
||||
'sort_order',
|
||||
'is_system',
|
||||
'is_active',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'field_type' => RegistrationFieldType::class,
|
||||
'options' => 'array',
|
||||
'is_required' => 'boolean',
|
||||
'is_filterable' => 'boolean',
|
||||
'is_portal_visible' => 'boolean',
|
||||
'is_admin_only' => 'boolean',
|
||||
'sort_order' => 'integer',
|
||||
'is_system' => 'boolean',
|
||||
'is_active' => 'boolean',
|
||||
];
|
||||
}
|
||||
|
||||
public function organisation(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Organisation::class);
|
||||
}
|
||||
|
||||
public function scopeActive(Builder $query): Builder
|
||||
{
|
||||
return $query->where('is_active', true);
|
||||
}
|
||||
|
||||
public function scopeSystem(Builder $query): Builder
|
||||
{
|
||||
return $query->where('is_system', true);
|
||||
}
|
||||
|
||||
public function scopeOrdered(Builder $query): Builder
|
||||
{
|
||||
return $query->orderBy('sort_order');
|
||||
}
|
||||
}
|
||||
73
api/app/Models/RegistrationFormField.php
Normal file
73
api/app/Models/RegistrationFormField.php
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enums\RegistrationFieldType;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Concerns\HasUlids;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
final class RegistrationFormField extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use HasUlids;
|
||||
|
||||
protected $fillable = [
|
||||
'event_id',
|
||||
'label',
|
||||
'slug',
|
||||
'field_type',
|
||||
'options',
|
||||
'tag_category',
|
||||
'is_required',
|
||||
'is_portal_visible',
|
||||
'is_admin_only',
|
||||
'is_filterable',
|
||||
'section',
|
||||
'help_text',
|
||||
'sort_order',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'field_type' => RegistrationFieldType::class,
|
||||
'options' => 'array',
|
||||
'is_required' => 'boolean',
|
||||
'is_portal_visible' => 'boolean',
|
||||
'is_admin_only' => 'boolean',
|
||||
'is_filterable' => 'boolean',
|
||||
'sort_order' => 'integer',
|
||||
];
|
||||
}
|
||||
|
||||
public function event(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Event::class);
|
||||
}
|
||||
|
||||
public function personFieldValues(): HasMany
|
||||
{
|
||||
return $this->hasMany(PersonFieldValue::class, 'registration_form_field_id');
|
||||
}
|
||||
|
||||
public function isMultiValue(): bool
|
||||
{
|
||||
return $this->field_type->isMultiValue();
|
||||
}
|
||||
|
||||
public function scopeOrdered(Builder $query): Builder
|
||||
{
|
||||
return $query->orderBy('sort_order');
|
||||
}
|
||||
|
||||
public function scopePortalVisible(Builder $query): Builder
|
||||
{
|
||||
return $query->where('is_portal_visible', true)->where('is_admin_only', false);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user