feat: smart re-assignment with cancellation source tracking
Add cancelled_by, cancellation_source (organiser|volunteer|system), and cancelled_at columns to shift_assignments. Cancel flow now records who cancelled and why. Assign flow reactivates existing cancelled/rejected records instead of creating duplicates, preventing UNIQUE constraint violations. Assignable-persons endpoint returns previous_assignment data for contextual UI indicators. Frontend shows cancellation source labels, previous assignment history in assign dialog, and "Opnieuw toewijzen" buttons with volunteer-cancelled confirmation dialogs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('shift_assignments', function (Blueprint $table) {
|
||||
$table->ulid('cancelled_by')->nullable()->after('rejection_reason');
|
||||
$table->string('cancellation_source')->nullable()->after('cancelled_by');
|
||||
$table->timestamp('cancelled_at')->nullable()->after('cancellation_source');
|
||||
|
||||
$table->foreign('cancelled_by')->references('id')->on('users')->nullOnDelete();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('shift_assignments', function (Blueprint $table) {
|
||||
$table->dropForeign(['cancelled_by']);
|
||||
$table->dropColumn(['cancelled_by', 'cancellation_source', 'cancelled_at']);
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user