S2a: purge legacy Form Builder PHP code and routes
This commit is contained in:
@@ -1,34 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Resources\Api\V1;
|
||||
|
||||
use App\Enums\RegistrationFieldType;
|
||||
use App\Models\PersonTag;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
final class PersonFieldValueResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
$field = $this->registrationFormField;
|
||||
|
||||
return [
|
||||
'field_slug' => $field?->slug,
|
||||
'field_label' => $field?->label,
|
||||
'field_type' => $field?->field_type?->value,
|
||||
'value' => $this->value,
|
||||
'selected_options' => $this->selected_options,
|
||||
'tag_names' => $this->when(
|
||||
$field?->field_type === RegistrationFieldType::TAG_PICKER && !empty($this->selected_options),
|
||||
function () {
|
||||
return PersonTag::whereIn('id', $this->selected_options ?? [])
|
||||
->pluck('name')
|
||||
->all();
|
||||
}
|
||||
),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -64,8 +64,6 @@ final class PersonResource extends JsonResource
|
||||
'added_by_user_id' => $this->pivot->added_by_user_id,
|
||||
]
|
||||
),
|
||||
'field_values' => PersonFieldValueResource::collection($this->whenLoaded('fieldValues')),
|
||||
'section_preferences' => PersonSectionPreferenceResource::collection($this->whenLoaded('sectionPreferences')),
|
||||
'tags' => $this->when(
|
||||
$this->user_id && $this->relationLoaded('user'),
|
||||
function () {
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Resources\Api\V1;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
final class PersonSectionPreferenceResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
$section = $this->whenLoaded('festivalSection');
|
||||
|
||||
return [
|
||||
'festival_section_id' => $this->festival_section_id,
|
||||
'priority' => $this->priority,
|
||||
'section_name' => $this->when(
|
||||
$this->relationLoaded('festivalSection'),
|
||||
fn () => $this->festivalSection?->name
|
||||
),
|
||||
'section_icon' => $this->when(
|
||||
$this->relationLoaded('festivalSection'),
|
||||
fn () => $this->festivalSection?->icon
|
||||
),
|
||||
'section_category' => $this->when(
|
||||
$this->relationLoaded('festivalSection'),
|
||||
fn () => $this->festivalSection?->category
|
||||
),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Resources\Api\V1;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
final class RegistrationFieldTemplateResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'organisation_id' => $this->organisation_id,
|
||||
'label' => $this->label,
|
||||
'slug' => $this->slug,
|
||||
'field_type' => $this->field_type->value,
|
||||
'options' => $this->options,
|
||||
'normalized_options' => $this->normalized_options,
|
||||
'tag_categories' => $this->tag_categories,
|
||||
'is_required' => $this->is_required,
|
||||
'is_filterable' => $this->is_filterable,
|
||||
'is_portal_visible' => $this->is_portal_visible,
|
||||
'is_admin_only' => $this->is_admin_only,
|
||||
'help_text' => $this->help_text,
|
||||
'sort_order' => $this->sort_order,
|
||||
'display_width' => $this->display_width->value,
|
||||
'is_system' => $this->is_system,
|
||||
'is_active' => $this->is_active,
|
||||
'created_at' => $this->created_at->toIso8601String(),
|
||||
'updated_at' => $this->updated_at->toIso8601String(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Resources\Api\V1;
|
||||
|
||||
use App\Enums\RegistrationFieldType;
|
||||
use App\Models\PersonTag;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
final class RegistrationFormFieldResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'event_id' => $this->event_id,
|
||||
'label' => $this->label,
|
||||
'slug' => $this->slug,
|
||||
'field_type' => $this->field_type->value,
|
||||
'options' => $this->options,
|
||||
'normalized_options' => $this->normalized_options,
|
||||
'tag_categories' => $this->tag_categories,
|
||||
'is_required' => $this->is_required,
|
||||
'is_portal_visible' => $this->is_portal_visible,
|
||||
'is_admin_only' => $this->is_admin_only,
|
||||
'is_filterable' => $this->is_filterable,
|
||||
'help_text' => $this->help_text,
|
||||
'sort_order' => $this->sort_order,
|
||||
'display_width' => $this->display_width->value,
|
||||
'created_at' => $this->created_at->toIso8601String(),
|
||||
'updated_at' => $this->updated_at->toIso8601String(),
|
||||
'available_tags' => $this->when(
|
||||
$this->field_type === RegistrationFieldType::TAG_PICKER,
|
||||
function () {
|
||||
$query = PersonTag::where('organisation_id', $this->event->organisation_id)
|
||||
->where('is_active', true);
|
||||
|
||||
if (!empty($this->tag_categories)) {
|
||||
$query->whereIn('category', $this->tag_categories);
|
||||
}
|
||||
|
||||
return PersonTagResource::collection($query->orderBy('category')->orderBy('sort_order')->get());
|
||||
}
|
||||
),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user