Add contract management and invoice settings pages

- Created a new Blade view for managing brand contracts with forms for adding and editing contracts, including client and category selection.
- Implemented success message notifications for contract actions.
- Added a new Blade view for invoice settings, allowing customization of invoice number format, header branding, and default values for new invoices.
- Introduced a new PDF view for generating rate cards with customizable styles based on user profile settings.
- Developed a profile management page for rate cards, enabling users to update their identity, appearance, and visibility settings.
This commit is contained in:
I-Fun
2026-04-01 21:47:34 +07:00
parent d3c35ad730
commit 22f03ccca7
48 changed files with 2415 additions and 296 deletions

View File

@@ -0,0 +1,37 @@
<?php
declare(strict_types=1);
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('events', function (Blueprint $table): void {
$table->unsignedBigInteger('category_id')->nullable()->after('client_id');
$table->foreign('category_id')
->references('id')->on('client_categories')->onDelete('set null');
});
Schema::table('content_briefs', function (Blueprint $table): void {
$table->unsignedBigInteger('category_id')->nullable()->after('client_id');
$table->foreign('category_id')
->references('id')->on('client_categories')->onDelete('set null');
});
}
public function down(): void
{
Schema::table('events', function (Blueprint $table): void {
$table->dropForeign(['category_id']);
$table->dropColumn('category_id');
});
Schema::table('content_briefs', function (Blueprint $table): void {
$table->dropForeign(['category_id']);
$table->dropColumn('category_id');
});
}
};

View File

@@ -0,0 +1,33 @@
<?php
declare(strict_types=1);
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('brand_contracts', function (Blueprint $table): void {
$table->id();
$table->string('title');
$table->unsignedBigInteger('client_id')->nullable(); // the contracted brand
$table->unsignedBigInteger('category_id')->nullable(); // the exclusive category
$table->date('start_date');
$table->date('end_date');
$table->text('notes')->nullable();
$table->boolean('is_active')->default(true);
$table->timestamps();
$table->foreign('client_id')->references('id')->on('clients')->onDelete('set null');
$table->foreign('category_id')->references('id')->on('client_categories')->onDelete('set null');
});
}
public function down(): void
{
Schema::dropIfExists('brand_contracts');
}
};

View File

@@ -0,0 +1,37 @@
<?php
declare(strict_types=1);
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('rate_card_profiles', function (Blueprint $table): void {
$table->id();
$table->string('owner_name')->default('KOL Manager');
$table->string('tagline')->nullable();
$table->string('whatsapp')->nullable();
$table->string('ig_handle')->nullable();
$table->string('tiktok_handle')->nullable();
$table->string('youtube_handle')->nullable();
$table->string('email')->nullable();
$table->string('logo_path')->nullable(); // uploaded image
$table->string('bg_color')->default('#FFF8F0');
$table->string('accent_color')->default('#FFB7C5');
$table->string('text_color')->default('#374151');
$table->text('custom_footer')->nullable();
$table->boolean('show_prices')->default(true);
$table->string('access_token')->nullable(); // optional: require ?token=xxx
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('rate_card_profiles');
}
};

View File

@@ -0,0 +1,45 @@
<?php
declare(strict_types=1);
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
// Add branch_name to invoices
Schema::table('invoices', function (Blueprint $table): void {
$table->string('branch_name')->nullable()->after('bank_holder');
});
// Add is_taxable to invoice_items
Schema::table('invoice_items', function (Blueprint $table): void {
$table->boolean('is_taxable')->default(true)->after('total');
});
// Invoice settings singleton table
Schema::create('invoice_settings', function (Blueprint $table): void {
$table->id();
$table->string('invoice_prefix')->default('INV');
$table->unsignedInteger('invoice_next_number')->default(1);
$table->string('header_name')->nullable(); // talent name
$table->string('header_title')->nullable(); // subtitle / tagline
$table->string('header_logo')->nullable(); // stored path
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('invoice_settings');
Schema::table('invoice_items', function (Blueprint $table): void {
$table->dropColumn('is_taxable');
});
Schema::table('invoices', function (Blueprint $table): void {
$table->dropColumn('branch_name');
});
}
};

View File

@@ -0,0 +1,36 @@
<?php
declare(strict_types=1);
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('invoice_settings', function (Blueprint $table): void {
$table->decimal('default_tax_rate', 5, 2)->default(11)->after('header_logo');
$table->string('default_currency')->default('IDR')->after('default_tax_rate');
$table->string('default_service_description')->nullable()->after('default_currency');
$table->string('default_bank_name')->nullable()->after('default_service_description');
$table->string('default_branch_name')->nullable()->after('default_bank_name');
$table->string('default_bank_account')->nullable()->after('default_branch_name');
$table->string('default_bank_holder')->nullable()->after('default_bank_account');
$table->text('default_notes')->nullable()->after('default_bank_holder');
});
}
public function down(): void
{
Schema::table('invoice_settings', function (Blueprint $table): void {
$table->dropColumn([
'default_tax_rate', 'default_currency',
'default_service_description',
'default_bank_name', 'default_branch_name',
'default_bank_account', 'default_bank_holder', 'default_notes',
]);
});
}
};