fix handle error and add note for shippings receive approve and reject mutations

This commit is contained in:
2025-06-13 14:19:12 +07:00
parent b2bfd666a7
commit 2f5eff9e63
28 changed files with 13055 additions and 154 deletions

View File

@@ -0,0 +1,58 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddAdditionalNotesAndRejectionFieldsToMutationsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('mutations', function (Blueprint $table) {
// Rename existing notes to shipping_notes for clarity
$table->renameColumn('notes', 'shipping_notes');
// Add new note fields
$table->text('reception_notes')->nullable()->after('received_at')->comment('Catatan saat penerimaan mutasi');
$table->text('approval_notes')->nullable()->after('approved_at')->comment('Catatan saat persetujuan mutasi');
// Add rejection tracking fields
$table->foreignId('rejected_by')->nullable()->constrained('users')->after('rejection_reason');
$table->timestamp('rejected_at')->nullable()->after('rejected_by');
// Add cancellation tracking fields
$table->foreignId('cancelled_by')->nullable()->constrained('users')->after('rejected_at');
$table->timestamp('cancelled_at')->nullable()->after('cancelled_by');
$table->text('cancellation_reason')->nullable()->after('cancelled_at')->comment('Alasan pembatalan mutasi');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('mutations', function (Blueprint $table) {
// Remove new fields
$table->dropColumn([
'reception_notes',
'approval_notes',
'rejected_by',
'rejected_at',
'cancelled_by',
'cancelled_at',
'cancellation_reason'
]);
// Rename back to original
$table->renameColumn('shipping_notes', 'notes');
});
}
}