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:
47
app/Models/RateCardProfile.php
Normal file
47
app/Models/RateCardProfile.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class RateCardProfile extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'owner_name', 'tagline', 'whatsapp',
|
||||
'ig_handle', 'tiktok_handle', 'youtube_handle', 'email',
|
||||
'logo_path', 'bg_color', 'accent_color', 'text_color',
|
||||
'custom_footer', 'show_prices', 'access_token',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'show_prices' => 'boolean',
|
||||
];
|
||||
|
||||
/** Get the singleton profile, creating defaults if needed */
|
||||
public static function getSingleton(): self
|
||||
{
|
||||
return static::firstOrCreate([], [
|
||||
'owner_name' => config('app.name', 'KOL Manager'),
|
||||
'bg_color' => '#FFF8F0',
|
||||
'accent_color' => '#FFB7C5',
|
||||
'text_color' => '#374151',
|
||||
'show_prices' => true,
|
||||
]);
|
||||
}
|
||||
|
||||
public function getWhatsappUrlAttribute(): ?string
|
||||
{
|
||||
if (! $this->whatsapp) return null;
|
||||
$number = preg_replace('/[^0-9]/', '', $this->whatsapp);
|
||||
return "https://wa.me/{$number}";
|
||||
}
|
||||
|
||||
public function getLogoUrlAttribute(): ?string
|
||||
{
|
||||
return $this->logo_path
|
||||
? route('files.serve-profile-logo')
|
||||
: null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user