Kimi chinh sua

This commit is contained in:
2026-04-24 08:58:53 +00:00
parent 91ff4a5e4d
commit 86216ef872
43 changed files with 2868 additions and 597 deletions

View File

@@ -0,0 +1,43 @@
<?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('customers', function (Blueprint $table) {
// Loại khách hàng
$table->string('type')->default('INDIVIDUAL'); // INDIVIDUAL, COMPANY
// Liên kết người đại diện (Self-referencing)
$table->uuid('representative_id')->nullable();
$table->foreign('representative_id')->references('id')->on('customers')->onDelete('set null');
// Thông tin định danh mở rộng
$table->string('tax_code')->nullable();
$table->date('id_issue_date')->nullable();
$table->string('id_issue_place')->nullable();
$table->string('title')->nullable(); // Ông/Bà
// Địa chỉ lưu cứng
$table->text('permanent_address')->nullable(); // Địa chỉ thường trú
$table->text('contact_address')->nullable(); // Địa chỉ liên hệ
// Số điện thoại phụ
$table->jsonb('secondary_phones')->nullable();
// Xóa cột address cũ nếu tồn tại (để tránh nhầm lẫn)
if (Schema::hasColumn('customers', 'address')) {
$table->dropColumn('address');
}
});
}
public function down(): void {
Schema::table('customers', function (Blueprint $table) {
$table->dropColumn(['type', 'representative_id', 'tax_code', 'id_issue_date', 'id_issue_place', 'title', 'permanent_address', 'contact_address', 'secondary_phones']);
$table->jsonb('address')->nullable();
});
}
};

View File

@@ -0,0 +1,38 @@
<?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('contracts', function (Blueprint $table) {
// Tài chính chi tiết tại thời điểm ký
$table->decimal('land_value', 15, 2)->default(0); // Giá trị QSDĐ
$table->decimal('foundation_value', 15, 2)->default(0); // Giá trị móng
$table->decimal('total_value_with_foundation', 15, 2)->default(0); // Tổng giá trị HĐMB
// Dữ liệu chiết khấu động
$table->jsonb('discount_details')->nullable();
// Các thông tin bổ sung từ Excel
$table->string('brokerage_name')->nullable(); // Môi giới
$table->date('sale_date')->nullable(); // Ngày bán
$table->date('hql_confirmation_date')->nullable(); // Ngày HQL XN
// Trạng thái thu hồi/lưu trữ
$table->integer('stored_contract_count')->default(0); // HĐ lưu
$table->text('filing_note')->nullable(); // Lưu hồ sơ
});
}
public function down(): void {
Schema::table('contracts', function (Blueprint $table) {
$table->dropColumn([
'land_value', 'foundation_value', 'total_value_with_foundation',
'discount_details', 'brokerage_name', 'sale_date',
'hql_confirmation_date', 'stored_contract_count', 'filing_note'
]);
});
}
};