chore: update document approval workflow and bug fixes
This commit is contained in:
@@ -0,0 +1,105 @@
|
||||
<?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::create('contractors', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('company_name');
|
||||
$table->string('contact_person');
|
||||
$table->string('email')->unique();
|
||||
$table->string('phone')->nullable();
|
||||
$table->string('specialization')->nullable(); // e.g., electrical, plumbing, structural
|
||||
$table->text('address')->nullable();
|
||||
$table->string('tax_id')->nullable();
|
||||
$table->string('payment_terms')->default('net_30'); // net_15, net_30, net_60
|
||||
$table->decimal('rating', 3, 1)->default(0); // 0-5 rating
|
||||
$table->string('status')->default('active'); // active, inactive, blacklisted
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('contractor_equipment', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('contractor_id')->constrained()->cascadeOnDelete();
|
||||
$table->string('name');
|
||||
$table->string('type')->nullable(); // heavy, light, vehicle
|
||||
$table->string('serial_number')->nullable();
|
||||
$table->string('status')->default('available'); // available, deployed, maintenance
|
||||
$table->decimal('daily_rate', 12, 2)->default(0);
|
||||
$table->date('last_maintenance_date')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('contractor_certifications', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('contractor_id')->constrained()->cascadeOnDelete();
|
||||
$table->string('name'); // e.g., ISO, PCAB License
|
||||
$table->string('certification_number')->nullable();
|
||||
$table->date('issued_date')->nullable();
|
||||
$table->date('expiry_date')->nullable();
|
||||
$table->string('status')->default('active'); // active, expired, revoked
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('contractor_invoices', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('contractor_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('project_id')->nullable()->constrained()->nullOnDelete();
|
||||
$table->string('invoice_number')->unique();
|
||||
$table->string('status')->default('draft'); // draft, submitted, approved, paid, rejected
|
||||
$table->decimal('amount', 15, 2);
|
||||
$table->text('description')->nullable();
|
||||
$table->date('invoice_date');
|
||||
$table->date('due_date')->nullable();
|
||||
$table->timestamp('paid_at')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('contractor_payments', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('contractor_invoice_id')->constrained()->cascadeOnDelete();
|
||||
$table->decimal('amount', 15, 2);
|
||||
$table->string('payment_method')->default('bank_transfer');
|
||||
$table->string('reference_number')->nullable();
|
||||
$table->text('notes')->nullable();
|
||||
$table->date('payment_date');
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('equipment_deployments', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('contractor_equipment_id')->constrained('contractor_equipment')->cascadeOnDelete();
|
||||
$table->foreignId('project_id')->constrained()->cascadeOnDelete();
|
||||
$table->date('deployed_date');
|
||||
$table->date('returned_date')->nullable();
|
||||
$table->text('notes')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('project_contractor', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('project_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('contractor_id')->constrained()->cascadeOnDelete();
|
||||
$table->string('role')->default('subcontractor'); // subcontractor, supplier, consultant
|
||||
$table->decimal('contract_amount', 15, 2)->default(0);
|
||||
$table->timestamps();
|
||||
$table->unique(['project_id', 'contractor_id']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('project_contractor');
|
||||
Schema::dropIfExists('equipment_deployments');
|
||||
Schema::dropIfExists('contractor_payments');
|
||||
Schema::dropIfExists('contractor_invoices');
|
||||
Schema::dropIfExists('contractor_certifications');
|
||||
Schema::dropIfExists('contractor_equipment');
|
||||
Schema::dropIfExists('contractors');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\ContractorManagement\Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class ContractorManagementDatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
// $this->call([]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user