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

@@ -5,11 +5,21 @@
@section('page-subtitle', 'Manage your service pricing')
@section('content')
<div class="flex flex-col sm:flex-row sm:items-center justify-between gap-3 mb-5">
<a href="{{ route('rate-cards.public') }}" target="_blank"
class="text-sm text-pink-500 hover:underline flex items-center gap-1">
🔗 View Public Page →
</a>
<div class="flex flex-wrap items-center justify-between gap-3 mb-5">
<div class="flex flex-wrap items-center gap-2">
<a href="{{ route('rate-cards.public') }}" target="_blank"
class="text-xs px-3 py-2 rounded-full border border-pink-200 text-pink-500 hover:bg-pink-50 flex items-center gap-1">
🔗 Public Page
</a>
<a href="{{ route('rate-cards.pdf') }}"
class="text-xs px-3 py-2 rounded-full border border-blue-200 text-blue-500 hover:bg-blue-50 flex items-center gap-1">
📄 PDF
</a>
<a href="{{ route('rate-cards.profile') }}"
class="text-xs px-3 py-2 rounded-full border border-purple-200 text-purple-500 hover:bg-purple-50 flex items-center gap-1">
🎨 Profile
</a>
</div>
<a href="{{ route('rate-cards.create') }}" class="btn-sakura text-sm shrink-0">+ Add Service</a>
</div>
@@ -57,11 +67,12 @@
class="flex-1 text-center text-xs py-2 rounded-full border border-pink-200 text-gray-600 hover:bg-pink-50 font-medium">
Edit
</a>
{{-- Share button disabled --}}
<form action="{{ route('rate-cards.destroy', $card) }}" method="POST"
onsubmit="return confirm('Delete this entry?')">
@csrf @method('DELETE')
<button class="text-xs py-2 px-4 rounded-full border border-red-100 text-red-400 hover:bg-red-50">
Delete
<button class="text-xs py-2 px-3 rounded-full border border-red-100 text-red-400 hover:bg-red-50">
✕
</button>
</form>
</div>
@@ -79,4 +90,5 @@
<a href="{{ route('rate-cards.create') }}" class="btn-sakura mt-4 inline-block">Add your first service!</a>
</div>
@endif
{{-- Share scripts disabled --}}
@endsection

View File

@@ -0,0 +1,142 @@
@php
// Convert hex accent color to rgb for rgba() usage in dompdf
$accent = ltrim($profile->accent_color ?? '#FFB7C5', '#');
$ar = hexdec(substr($accent, 0, 2));
$ag = hexdec(substr($accent, 2, 2));
$ab = hexdec(substr($accent, 4, 2));
$accentRgb = "{$ar},{$ag},{$ab}";
$bg = $profile->bg_color ?? '#FFFBFE';
$text = $profile->text_color ?? '#374151';
$accentHex = '#' . $accent;
@endphp
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Rate Card — {{ $profile->owner_name }}</title>
<style>
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
font-family: 'DejaVu Sans', sans-serif;
background: {{ $bg }};
color: {{ $text }};
padding: 36px 32px;
font-size: 12px;
}
.header {
text-align: center;
margin-bottom: 32px;
padding-bottom: 20px;
border-bottom: 2px solid {{ $accentHex }};
}
.logo-img { max-height: 72px; max-width: 140px; margin: 0 auto 10px; display: block; }
.name { font-size: 24px; font-weight: 700; color: {{ $accentHex }}; }
.tagline { color: #9CA3AF; margin-top: 4px; font-size: 11px; }
.contacts { margin-top: 10px; font-size: 10px; color: #6B7280; }
.contacts span { margin: 0 6px; }
.platform-section { margin-bottom: 22px; }
.platform-title {
font-size: 13px; font-weight: 700;
color: {{ $text }};
margin-bottom: 8px;
padding: 5px 10px;
background-color: rgba({{ $accentRgb }}, 0.1);
border-left: 4px solid {{ $accentHex }};
}
table { width: 100%; border-collapse: collapse; }
th {
text-align: left; padding: 7px 10px;
background-color: rgba({{ $accentRgb }}, 0.08);
color: #6B7280; font-size: 9px;
text-transform: uppercase; letter-spacing: 0.05em;
border-bottom: 1px solid rgba({{ $accentRgb }}, 0.25);
}
td { padding: 8px 10px; border-bottom: 1px solid #F3F4F6; vertical-align: top; }
tr:last-child td { border-bottom: none; }
.service-name { font-weight: 600; color: {{ $text }}; }
.content-type {
display: inline-block; font-size: 9px;
background-color: rgba({{ $accentRgb }}, 0.1);
color: {{ $accentHex }};
padding: 1px 7px; border-radius: 10px; margin-top: 2px;
}
.desc { color: #9CA3AF; font-size: 10px; margin-top: 3px; }
.price { font-weight: 700; color: {{ $accentHex }}; font-size: 13px; }
.price-unit { color: #9CA3AF; font-size: 9px; }
.negotiable { color: #F59E0B; font-size: 9px; font-weight: 600; }
.footer { text-align: center; margin-top: 36px; color: #D1D5DB; font-size: 9px; border-top: 1px solid #F3F4F6; padding-top: 14px; }
</style>
</head>
<body>
<div class="header">
@if($profile->logo_path && file_exists(storage_path('app/private/' . $profile->logo_path)))
<img src="{{ storage_path('app/private/' . $profile->logo_path) }}" class="logo-img" alt="{{ $profile->owner_name }}">
@endif
<div class="name">{{ $profile->owner_name }}</div>
@if($profile->tagline)
<div class="tagline">{{ $profile->tagline }}</div>
@endif
<div class="contacts">
@if($profile->email)<span>✉ {{ $profile->email }}</span>@endif
@if($profile->whatsapp)<span>· {{ $profile->whatsapp }}</span>@endif
@if($profile->ig_handle)<span>· @{{ $profile->ig_handle }}</span>@endif
@if($profile->tiktok_handle)<span>· @{{ $profile->tiktok_handle }}</span>@endif
@if($profile->youtube_handle)<span>· {{ $profile->youtube_handle }}</span>@endif
</div>
</div>
@foreach($rateCards as $platform => $cards)
<div class="platform-section">
<div class="platform-title">
@php $icons = ['instagram' => 'Instagram', 'tiktok' => 'TikTok', 'youtube' => 'YouTube', 'general' => 'General']; @endphp
{{ $icons[$platform] ?? ucfirst($platform) }}
</div>
<table>
<thead>
<tr>
<th style="width:38%">Service</th>
<th style="width:37%">Description</th>
<th style="width:25%; text-align:right">Price</th>
</tr>
</thead>
<tbody>
@foreach($cards as $card)
<tr>
<td>
<div class="service-name">{{ $card->service_name }}</div>
@if($card->content_type)
<span class="content-type">{{ $card->content_type }}</span>
@endif
</td>
<td>
@if($card->description)
<div class="desc">{{ $card->description }}</div>
@endif
</td>
<td style="text-align:right">
@if($profile->show_prices)
<div class="price">{{ $card->formatted_price }}</div>
<div class="price-unit">{{ str_replace('_', ' ', $card->price_unit) }}</div>
@else
<div class="price" style="font-size:11px">On Request</div>
@endif
@if($card->is_negotiable)
<div class="negotiable">Negotiable</div>
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@endforeach
<div class="footer">
{{ $profile->custom_footer ?: 'Prices may vary. Contact for custom packages.' }}
· Generated {{ now()->format('d M Y') }}
</div>
</body>
</html>

View File

@@ -0,0 +1,172 @@
@extends('layouts.app')
@section('title', 'Rate Card Profile')
@section('page-title', '🎨 Rate Card Profile')
@section('page-subtitle', 'Customise your public rate card page')
@section('content')
<div class="max-w-3xl mx-auto space-y-5">
@if(session('success'))
<div x-data="{ show: true }" x-show="show" x-init="setTimeout(() => show = false, 4000)"
class="flex items-center justify-between gap-3 bg-green-50 border border-green-200 rounded-2xl px-4 py-3 text-sm text-green-700">
<span>{{ session('success') }}</span>
<button @click="show = false" class="text-green-500 hover:text-green-700 text-lg leading-none">✕</button>
</div>
@endif
<form action="{{ route('rate-cards.profile.update') }}" method="POST" enctype="multipart/form-data"
class="space-y-5">
@csrf
{{-- Identity --}}
<div class="cat-card overflow-hidden">
<div class="flex items-center gap-3 px-5 py-4 border-b border-pink-50">
<span class="text-xl">👤</span>
<h2 class="font-bold text-gray-700">Identity</h2>
</div>
<div class="p-5 grid grid-cols-1 sm:grid-cols-2 gap-4">
<div>
<label class="block text-xs font-semibold text-gray-600 mb-1">Display Name <span class="text-pink-400">*</span></label>
<input type="text" name="owner_name" required
value="{{ old('owner_name', $profile->owner_name) }}"
class="input-soft" placeholder="e.g. Sakura KOL">
</div>
<div>
<label class="block text-xs font-semibold text-gray-600 mb-1">Tagline</label>
<input type="text" name="tagline"
value="{{ old('tagline', $profile->tagline) }}"
class="input-soft" placeholder="e.g. Lifestyle & Beauty Creator">
</div>
<div>
<label class="block text-xs font-semibold text-gray-600 mb-1">Email</label>
<input type="email" name="email"
value="{{ old('email', $profile->email) }}"
class="input-soft" placeholder="hi@example.com">
</div>
<div>
<label class="block text-xs font-semibold text-gray-600 mb-1">WhatsApp Number</label>
<input type="text" name="whatsapp"
value="{{ old('whatsapp', $profile->whatsapp) }}"
class="input-soft" placeholder="+6012-345-6789">
</div>
<div>
<label class="block text-xs font-semibold text-gray-600 mb-1">Instagram Handle</label>
<div class="relative">
<span class="absolute left-3 top-1/2 -translate-y-1/2 text-gray-400 text-sm pointer-events-none">@</span>
<input type="text" name="ig_handle"
value="{{ old('ig_handle', $profile->ig_handle) }}"
class="input-soft pl-7" placeholder="yourhandle">
</div>
</div>
<div>
<label class="block text-xs font-semibold text-gray-600 mb-1">TikTok Handle</label>
<div class="relative">
<span class="absolute left-3 top-1/2 -translate-y-1/2 text-gray-400 text-sm pointer-events-none">@</span>
<input type="text" name="tiktok_handle"
value="{{ old('tiktok_handle', $profile->tiktok_handle) }}"
class="input-soft pl-7" placeholder="yourhandle">
</div>
</div>
<div class="sm:col-span-2">
<label class="block text-xs font-semibold text-gray-600 mb-1">YouTube Handle / Channel</label>
<input type="text" name="youtube_handle"
value="{{ old('youtube_handle', $profile->youtube_handle) }}"
class="input-soft" placeholder="@yourchannel">
</div>
</div>
</div>
{{-- Appearance --}}
<div class="cat-card overflow-hidden">
<div class="flex items-center gap-3 px-5 py-4 border-b border-pink-50">
<span class="text-xl">🎨</span>
<h2 class="font-bold text-gray-700">Appearance</h2>
</div>
<div class="p-5 grid grid-cols-1 sm:grid-cols-2 gap-4">
<div class="sm:col-span-2">
<label class="block text-xs font-semibold text-gray-600 mb-1">Logo / Profile Image</label>
@if($profile->logo_path)
<div class="flex items-center gap-3 mb-2">
<img src="{{ route('files.serve-profile-logo') }}" alt="Logo"
class="w-16 h-16 object-cover rounded-2xl border border-pink-100">
<span class="text-xs text-gray-400">Current logo</span>
</div>
@endif
<input type="file" name="logo" accept="image/*"
class="w-full text-sm text-gray-600
file:mr-3 file:py-2 file:px-4 file:rounded-full file:border-0
file:text-xs file:font-semibold file:bg-pink-50 file:text-pink-600
hover:file:bg-pink-100 cursor-pointer">
<p class="text-xs text-gray-400 mt-1">Max 2MB. PNG/JPG/WebP.</p>
</div>
<div>
<label class="block text-xs font-semibold text-gray-600 mb-1">Background Color</label>
<div class="flex items-center gap-2">
<input type="color" name="bg_color" value="{{ old('bg_color', $profile->bg_color) }}"
class="h-10 w-16 rounded-2xl border border-pink-200 cursor-pointer p-1 bg-white shrink-0"
oninput="document.getElementById('bg_text').value=this.value">
<input type="text" id="bg_text" value="{{ old('bg_color', $profile->bg_color) }}"
class="input-soft text-sm flex-1" readonly>
</div>
</div>
<div>
<label class="block text-xs font-semibold text-gray-600 mb-1">Accent Color</label>
<div class="flex items-center gap-2">
<input type="color" name="accent_color" value="{{ old('accent_color', $profile->accent_color) }}"
class="h-10 w-16 rounded-2xl border border-pink-200 cursor-pointer p-1 bg-white shrink-0"
oninput="document.getElementById('accent_text').value=this.value">
<input type="text" id="accent_text" value="{{ old('accent_color', $profile->accent_color) }}"
class="input-soft text-sm flex-1" readonly>
</div>
</div>
<div>
<label class="block text-xs font-semibold text-gray-600 mb-1">Text Color</label>
<div class="flex items-center gap-2">
<input type="color" name="text_color" value="{{ old('text_color', $profile->text_color) }}"
class="h-10 w-16 rounded-2xl border border-pink-200 cursor-pointer p-1 bg-white shrink-0"
oninput="document.getElementById('text_text').value=this.value">
<input type="text" id="text_text" value="{{ old('text_color', $profile->text_color) }}"
class="input-soft text-sm flex-1" readonly>
</div>
</div>
<div>
<label class="block text-xs font-semibold text-gray-600 mb-1">Custom Footer</label>
<input type="text" name="custom_footer"
value="{{ old('custom_footer', $profile->custom_footer) }}"
class="input-soft"
placeholder="e.g. Prices valid until Dec 2025 · DM for bundles">
</div>
<div class="sm:col-span-2">
<label class="flex items-start gap-3 cursor-pointer">
<input type="checkbox" name="show_prices" value="1"
class="w-4 h-4 accent-pink-400 mt-0.5 shrink-0"
{{ old('show_prices', $profile->show_prices) ? 'checked' : '' }}>
<div>
<span class="text-sm font-medium text-gray-700">Show prices publicly</span>
<p class="text-xs text-gray-400">Uncheck to show "On Request" instead of actual prices</p>
</div>
</label>
</div>
</div>
</div>
{{-- Actions --}}
<div class="flex flex-wrap items-center gap-3">
<button type="submit" class="btn-sakura px-6 py-2.5">💾 Save Profile</button>
<a href="{{ route('rate-cards.public') }}" target="_blank"
class="text-xs px-4 py-2.5 rounded-full border border-pink-200 text-pink-500 hover:bg-pink-50">
👁️ Preview Public Page
</a>
<a href="{{ route('rate-cards.pdf') }}"
class="text-xs px-4 py-2.5 rounded-full border border-blue-200 text-blue-500 hover:bg-blue-50">
📄 Download PDF
</a>
<a href="{{ route('rate-cards.index') }}"
class="text-xs px-4 py-2.5 rounded-full border border-gray-200 text-gray-500 hover:bg-gray-50">
← Back to Rate Cards
</a>
</div>
</form>
</div>
@endsection

View File

@@ -3,36 +3,80 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Rate Card — KOL Manager</title>
<title>Rate Card — {{ $profile->owner_name }}</title>
<link href="https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&display=swap" rel="stylesheet">
<style>
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Nunito', sans-serif; background: #FFF8F0; color: #374151; padding: 40px 20px; }
.container { max-width: 800px; margin: 0 auto; }
body { font-family: 'Nunito', sans-serif; background: {{ $profile->bg_color }}; color: {{ $profile->text_color }}; padding: 40px 20px; }
.container { max-width: 820px; margin: 0 auto; }
.header { text-align: center; margin-bottom: 48px; }
.logo { font-size: 48px; margin-bottom: 12px; }
.title { font-size: 32px; font-weight: 900; color: #FFB7C5; }
.subtitle { color: #9CA3AF; margin-top: 6px; font-size: 14px; }
.logo-img { max-height: 100px; max-width: 200px; margin: 0 auto 16px; display: block; border-radius: 16px; }
.title { font-size: 32px; font-weight: 900; color: {{ $profile->accent_color }}; }
.tagline { color: #9CA3AF; margin-top: 6px; font-size: 14px; }
.contacts { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px 20px; margin-top: 16px; }
.contact-pill {
display: inline-flex; align-items: center; gap-6px;
background: white; border: 1px solid {{ $profile->accent_color }}44;
border-radius: 99px; padding: 6px 14px; font-size: 12px; color: {{ $profile->text_color }};
text-decoration: none; transition: background 0.2s;
}
.contact-pill:hover { background: {{ $profile->accent_color }}18; }
.platform-section { margin-bottom: 32px; }
.platform-title { font-size: 18px; font-weight: 800; color: #374151; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.platform-title { font-size: 18px; font-weight: 800; color: {{ $profile->text_color }}; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.card { background: white; border-radius: 24px; padding: 20px; border: 1px solid #FFE4EC; box-shadow: 0 2px 8px rgba(255,183,197,0.15); }
.card { background: white; border-radius: 24px; padding: 20px; border: 1px solid {{ $profile->accent_color }}33; box-shadow: 0 2px 8px {{ $profile->accent_color }}22; }
.service { font-weight: 700; color: #1F2937; margin-bottom: 6px; }
.type { display: inline-block; background: #FFF0F5; color: #FFB7C5; font-size: 11px; font-weight: 600; padding: 2px 10px; border-radius: 20px; margin-bottom: 8px; }
.type { display: inline-block; background: {{ $profile->accent_color }}18; color: {{ $profile->accent_color }}; font-size: 11px; font-weight: 600; padding: 2px 10px; border-radius: 20px; margin-bottom: 8px; }
.desc { font-size: 12px; color: #9CA3AF; margin-bottom: 12px; line-height: 1.5; }
.price { font-size: 22px; font-weight: 900; color: #FFB7C5; }
.price { font-size: 22px; font-weight: 900; color: {{ $profile->accent_color }}; }
.price-meta { font-size: 11px; color: #D1D5DB; margin-top: 2px; }
.negotiable { font-size: 11px; color: #F59E0B; font-weight: 600; }
.footer { text-align: center; margin-top: 60px; color: #D1D5DB; font-size: 12px; }
@media print { body { background: white; } .card { break-inside: avoid; } }
.pdf-btn {
display: inline-flex; align-items: center; gap: 6px;
background: {{ $profile->accent_color }}; color: white;
border: none; border-radius: 99px; padding: 10px 24px;
font-size: 14px; font-weight: 700; cursor: pointer;
text-decoration: none; transition: opacity 0.2s;
}
.pdf-btn:hover { opacity: 0.9; }
@media print { body { background: white; } .card { break-inside: avoid; } .pdf-btn { display: none; } }
</style>
</head>
<body>
<div class="container">
<div class="header">
<div class="logo">🐱</div>
<div class="title">Rate Card</div>
<div class="subtitle">Services & Pricing · {{ now()->format('Y') }}</div>
@if($profile->logo_path)
<img src="{{ route('files.serve-profile-logo') }}" alt="{{ $profile->owner_name }}" class="logo-img">
@else
<div style="font-size:56px; margin-bottom:12px;">🐱</div>
@endif
<div class="title">{{ $profile->owner_name }}</div>
@if($profile->tagline)
<div class="tagline">{{ $profile->tagline }}</div>
@endif
<div class="contacts" style="margin-top:14px">
@if($profile->whatsappUrl)
<a href="{{ $profile->whatsappUrl }}" target="_blank" class="contact-pill">📱 WhatsApp</a>
@endif
@if($profile->ig_handle)
<a href="https://instagram.com/{{ ltrim($profile->ig_handle, '@') }}" target="_blank" class="contact-pill">📸 @{{ $profile->ig_handle }}</a>
@endif
@if($profile->tiktok_handle)
<a href="https://tiktok.com/@{{ ltrim($profile->tiktok_handle, '@') }}" target="_blank" class="contact-pill">🎵 @{{ $profile->tiktok_handle }}</a>
@endif
@if($profile->youtube_handle)
<a href="https://youtube.com/{{ $profile->youtube_handle }}" target="_blank" class="contact-pill">▶️ {{ $profile->youtube_handle }}</a>
@endif
@if($profile->email)
<a href="mailto:{{ $profile->email }}" class="contact-pill">✉️ {{ $profile->email }}</a>
@endif
</div>
<div style="margin-top:20px">
<a href="{{ route('rate-cards.pdf') }}" class="pdf-btn">📄 Download PDF</a>
</div>
</div>
@forelse($rateCards as $platform => $cards)
@@ -51,8 +95,12 @@
@if($card->description)
<div class="desc">{{ $card->description }}</div>
@endif
@if($profile->show_prices)
<div class="price">{{ $card->formatted_price }}</div>
<div class="price-meta">{{ str_replace('_', ' ', $card->price_unit) }}</div>
@else
<div class="price" style="font-size:16px">On Request</div>
@endif
@if($card->is_negotiable)
<div class="negotiable">✦ Negotiable</div>
@endif
@@ -65,7 +113,8 @@
@endforelse
<div class="footer">
Generated by KOL Manager · Prices may vary. Contact for custom packages. 🐾
{{ $profile->custom_footer ?: 'Prices may vary. Contact for custom packages. 🐾' }}
<br>Generated by KOL Manager · {{ now()->format('Y') }}
</div>
</div>
</body>