Bugfixes & Model for participants

This commit is contained in:
2026-02-17 21:58:55 +01:00
parent fcf41c5d13
commit b1c333648a
14 changed files with 334 additions and 56 deletions

View File

@@ -67,12 +67,12 @@ return new class extends Migration
$table->dateTime('activation_token_expires_at')->nullable()->default(date('Y-m-d H:i:s', strtotime('+3 days')));
$table->boolean('active')->default(false);
$table->foreign('local_group')->references('slug')->on('tenants')->cascadeOnDelete()->cascadeOnUpdate();
$table->foreign('user_role_main')->references('slug')->on('user_roles')->cascadeOnDelete()->cascadeOnUpdate();
$table->foreign('user_role_local_group')->references('slug')->on('user_roles')->cascadeOnDelete()->cascadeOnUpdate();
$table->foreign('swimming_permission')->references('slug')->on('swimming_permissions')->cascadeOnDelete()->cascadeOnUpdate();
$table->foreign('eating_habits')->references('slug')->on('eating_habits')->cascadeOnDelete()->cascadeOnUpdate();
$table->foreign('first_aid_permission')->references('slug')->on('first_aid_permissions')->cascadeOnDelete()->cascadeOnUpdate();
$table->foreign('local_group')->references('slug')->on('tenants')->restrictOnDelete()->cascadeOnUpdate();
$table->foreign('user_role_main')->references('slug')->on('user_roles')->restrictOnDelete()->cascadeOnUpdate();
$table->foreign('user_role_local_group')->references('slug')->on('user_roles')->restrictOnDelete()->cascadeOnUpdate();
$table->foreign('swimming_permission')->references('slug')->on('swimming_permissions')->restrictOnDelete()->cascadeOnUpdate();
$table->foreign('eating_habits')->references('slug')->on('eating_habits')->restrictOnDelete()->cascadeOnUpdate();
$table->foreign('first_aid_permission')->references('slug')->on('first_aid_permissions')->restrictOnDelete()->cascadeOnUpdate();
$table->rememberToken();
$table->timestamps();

View File

@@ -26,15 +26,15 @@ return new class extends Migration {
$table->boolean('allow_new')->default(true);
$table->boolean('archived')->default(false);
$table->foreign('tenant')->references('slug')->on('tenants')->cascadeOnDelete()->cascadeOnUpdate();
$table->foreign('type')->references('slug')->on('cost_unit_types')->cascadeOnDelete()->cascadeOnUpdate();
$table->foreign('tenant')->references('slug')->on('tenants')->restrictOnDelete()->cascadeOnUpdate();
$table->foreign('type')->references('slug')->on('cost_unit_types')->restrictOnDelete()->cascadeOnUpdate();
$table->timestamps();
});
Schema::create('cost_unit_treasurers', function (Blueprint $table) {
$table->id();
$table->foreignId('cost_unit_id')->constrained('cost_units', 'id')->cascadeOnDelete()->cascadeOnUpdate();
$table->foreignId('user_id')->constrained('users', 'id')->cascadeOnDelete()->cascadeOnUpdate();
$table->foreignId('cost_unit_id')->constrained('cost_units', 'id')->restrictOnDelete()->cascadeOnUpdate();
$table->foreignId('user_id')->constrained('users', 'id')->restrictOnDelete()->cascadeOnUpdate();
$table->timestamps();
});
}

View File

@@ -23,13 +23,13 @@ return new class extends Migration {
Schema::create('invoices', function (Blueprint $table) {
$table->id();
$table->string('tenant');
$table->foreignId('cost_unit_id')->constrained('cost_units', 'id')->cascadeOnDelete()->cascadeOnUpdate();
$table->foreignId('cost_unit_id')->constrained('cost_units', 'id')->restrictOnDelete()->cascadeOnUpdate();
$table->foreignId('user_id')->nullable()->constrained('users', 'id')->restrictOnDelete()->cascadeOnUpdate();
$table->string('invoice_number');
$table->string('status');
$table->string('type');
$table->string('type_other')->nullable();
$table->boolean('donation')->default(false);
$table->foreignId('user_id')->nullable()->constrained('users', 'id')->cascadeOnDelete()->cascadeOnUpdate();
$table->string('contact_name');
$table->string('contact_email')->nullable();
$table->string('contact_phone')->nullable();
@@ -43,16 +43,16 @@ return new class extends Migration {
$table->boolean('passengers')->nullable();
$table->boolean('transportation')->nullable();
$table->string('document_filename')->nullable();
$table->foreignId('approved_by')->nullable()->constrained('users', 'id')->cascadeOnDelete()->cascadeOnUpdate();
$table->foreignId('approved_by')->nullable()->constrained('users', 'id')->restrictOnDelete()->cascadeOnUpdate();
$table->dateTime('approved_at')->nullable();
$table->boolean('upload_required')->default(false);
$table->foreignId('denied_by')->nullable()->constrained('users', 'id')->cascadeOnDelete()->cascadeOnUpdate();
$table->foreignId('denied_by')->nullable()->constrained('users', 'id')->restrictOnDelete()->cascadeOnUpdate();
$table->dateTime('denied_at')->nullable();
$table->string('denied_reason')->nullable();
$table->foreign('tenant')->references('slug')->on('tenants')->cascadeOnDelete()->cascadeOnUpdate();
$table->foreign('type')->references('slug')->on('invoice_types')->cascadeOnDelete()->cascadeOnUpdate();
$table->foreign('status')->references('slug')->on('invoice_status')->cascadeOnDelete()->cascadeOnUpdate();
$table->foreign('tenant')->references('slug')->on('tenants')->restrictOnDelete()->cascadeOnUpdate();
$table->foreign('type')->references('slug')->on('invoice_types')->restrictOnDelete()->cascadeOnUpdate();
$table->foreign('status')->references('slug')->on('invoice_status')->restrictOnDelete()->cascadeOnUpdate();
$table->timestamps();
});

View File

@@ -11,6 +11,7 @@ return new class extends Migration {
{
Schema::create('cron_task_types', function (Blueprint $table) {
$table->string('slug')->primary();
$table->timestamps();
});

View File

@@ -30,14 +30,14 @@ return new class extends Migration {
$table->float('amount',2);
$table->timestamps();
$table->foreign('type')->references('slug')->on('participation_types')->cascadeOnDelete()->cascadeOnUpdate();
$table->foreign('tenant')->references('slug')->on('tenants')->cascadeOnDelete()->cascadeOnUpdate();
$table->foreign('type')->references('slug')->on('participation_types')->restrictOnDelete()->cascadeOnUpdate();
$table->foreign('tenant')->references('slug')->on('tenants')->restrictOnDelete()->cascadeOnUpdate();
});
Schema::create('events', function (Blueprint $table) {
$table->id();
$table->string('tenant');
$table->foreignId('cost_unit_id')->nullable()->constrained('cost_units', 'id')->cascadeOnDelete()->cascadeOnUpdate();
$table->foreignId('cost_unit_id')->nullable()->constrained('cost_units', 'id')->restrictOnDelete()->cascadeOnUpdate();
$table->string('name');
$table->string('location');
@@ -67,21 +67,21 @@ return new class extends Migration {
$table->boolean('archived')->default(false);
$table->timestamps();
$table->foreign('tenant')->references('slug')->on('tenants')->cascadeOnDelete()->cascadeOnUpdate();
$table->foreign('participation_fee_type')->references('slug')->on('participation_fee_types')->cascadeOnDelete()->cascadeOnUpdate();
$table->foreign('tenant')->references('slug')->on('tenants')->restrictOnDelete()->cascadeOnUpdate();
$table->foreign('participation_fee_type')->references('slug')->on('participation_fee_types')->restrictOnDelete()->cascadeOnUpdate();
});
Schema::create('event_allowed_eating_habits', function (Blueprint $table) {
$table->id();
$table->foreignId('event_id')->constrained('events', 'id')->cascadeOnDelete()->cascadeOnUpdate();
$table->foreignId('eating_habit_id')->constrained('eating_habits', 'id')->cascadeOnDelete()->cascadeOnUpdate();
$table->foreignId('event_id')->constrained('events', 'id')->restrictOnDelete()->cascadeOnUpdate();
$table->foreignId('eating_habit_id')->constrained('eating_habits', 'id')->restrictOnDelete()->cascadeOnUpdate();
$table->timestamps();
});
Schema::create('event_managers', function (Blueprint $table) {
$table->id();
$table->foreignId('event_id')->constrained('events', 'id')->cascadeOnDelete()->cascadeOnUpdate();
$table->string('user_id')->constrained('users', 'id')->cascadeOnDelete()->cascadeOnUpdate();
$table->foreignId('event_id')->constrained('events', 'id')->restrictOnDelete()->cascadeOnUpdate();
$table->string('user_id')->constrained('users', 'id')->restrictOnDelete()->cascadeOnUpdate();
$table->timestamps();
});

View File

@@ -11,8 +11,8 @@ return new class extends Migration {
{
Schema::create('event_local_groups', function (Blueprint $table) {
$table->id();
$table->foreignId('event_id')->constrained('events', 'id')->cascadeOnDelete()->cascadeOnUpdate();
$table->foreignId('local_group_id')->constrained('tenants', 'id')->cascadeOnDelete()->cascadeOnUpdate();
$table->foreignId('event_id')->constrained('events', 'id')->restrictOnDelete()->cascadeOnUpdate();
$table->foreignId('local_group_id')->constrained('tenants', 'id')->restrictOnDelete()->cascadeOnUpdate();
$table->timestamps();
});
}

View File

@@ -0,0 +1,86 @@
<?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('efz_status', function (Blueprint $table) {
$table->string('slug')->primary();
$table->string('name');
$table->timestamps();
});
Schema::create('event_participants', function (Blueprint $table) {
$table->id();
$table->string('tenant');
$table->foreignId('event_id')->constrained('events', 'id')->cascadeOnDelete()->cascadeOnUpdate();
$table->foreignId('user_id')->nullable()->constrained('users', 'id')->cascadeOnDelete()->cascadeOnUpdate();
$table->string('firstname');
$table->string('lastname');
$table->string('nickname')->nullable();
$table->string('participation_type');
$table->string('local_group');
$table->dateTime('birthday');
$table->string('address_1');
$table->string('address_2');
$table->string('postcode');
$table->string('city');
$table->string('email_1');
$table->string('phone_1');
$table->string('email_2')->nullable();
$table->string('phone_2')->nullable();
$table->string('contact_person')->nullable();
$table->string('allergies')->nullable();
$table->string('intolerances')->nullable();
$table->string('eating_habits')->nullable();
$table->string('swimming_permission')->nullable();
$table->string('first_aid_permission')->nullable();
$table->boolean('foto_socialmedia')->default(false);
$table->boolean('foto_print')->default(false);
$table->boolean('foto_webseite')->default(false);
$table->boolean('foto_partner')->default(false);
$table->boolean('foto_intern')->default(false);
$table->dateTime('arrival_date');
$table->dateTime('departure_date');
$table->integer('arrival_eating');
$table->integer('departure_eating');
$table->longText('notes')->nullable();
$table->float('amount', 2);
$table->float('amount_paid',0)->default(0);
$table->string('efz_status');
$table->timestamps();
$table->dateTime('unregistered_at')->nullable();
$table->foreign('swimming_permission')->references('slug')->on('swimming_permissions')->restrictOnDelete()->cascadeOnUpdate();
$table->foreign('eating_habits')->references('slug')->on('eating_habits')->restrictOnDelete()->cascadeOnUpdate();
$table->foreign('first_aid_permission')->references('slug')->on('first_aid_permissions')->restrictOnDelete()->cascadeOnUpdate();
$table->foreign('tenant')->references('slug')->on('tenants')->restrictOnDelete()->cascadeOnUpdate();
$table->foreign('local_group')->references('slug')->on('tenants')->restrictOnDelete()->cascadeOnUpdate();
$table->foreign('participation_type')->references('slug')->on('participation_types')->restrictOnDelete()->cascadeOnUpdate();
$table->foreign('efz_status')->references('slug')->on('efz_status')->restrictOnDelete()->cascadeOnUpdate();
});
}
public function down(): void
{
Schema::dropIfExists('event_participants');
Schema::dropIfExists('efz_status');
}
};