Compare commits

..

8 Commits

44 changed files with 2306 additions and 740 deletions

View File

@@ -1,11 +1,11 @@
APP_NAME=Laravel APP_NAME="KOL-Manager"
APP_ENV=local APP_ENV=local
APP_KEY= APP_KEY=
APP_DEBUG=true APP_DEBUG=true
APP_URL=http://localhost APP_URL=http://localhost
# ── App Gate Password ───────────────────────────────────────────────────────── # ── App Gate Password ─────────────────────────────────────────────────────────
APP_PASSWORD= APP_PASSWORD=admin123
APP_LOCALE=en APP_LOCALE=en
APP_FALLBACK_LOCALE=en APP_FALLBACK_LOCALE=en

View File

@@ -92,12 +92,14 @@ RUN mkdir -p \
storage/framework/cache \ storage/framework/cache \
storage/framework/sessions \ storage/framework/sessions \
storage/framework/views \ storage/framework/views \
storage \
bootstrap/cache \ bootstrap/cache \
database \ database \
&& chown -R www-data:www-data \ && chown -R www-data:www-data \
storage \ storage \
bootstrap/cache \ bootstrap/cache \
database \ database \
/var/lib/nginx \
&& chmod -R 775 \ && chmod -R 775 \
storage \ storage \
bootstrap/cache \ bootstrap/cache \
@@ -118,8 +120,8 @@ RUN { \
} > /usr/local/etc/php/conf.d/opcache.ini } > /usr/local/etc/php/conf.d/opcache.ini
RUN { \ RUN { \
echo "upload_max_filesize = 200M"; \ echo "upload_max_filesize = 500M"; \
echo "post_max_size = 200M"; \ echo "post_max_size = 500M"; \
echo "memory_limit = 512M"; \ echo "memory_limit = 512M"; \
echo "max_execution_time = 300"; \ echo "max_execution_time = 300"; \
} > /usr/local/etc/php/conf.d/uploads.ini } > /usr/local/etc/php/conf.d/uploads.ini

View File

@@ -1,6 +1,14 @@
git clone this repository # On local machine
#git clone this repository
composer install composer install
#php artisan key:generate php artisan key:generate
touch database/database.sqlite && php artisan migrate touch database/database.sqlite && php artisan migrate
npm install npm install
npm run build npm run build
# On Docker
cp .env.example .env.docker
docker compose build
docker compose up -d

View File

@@ -38,7 +38,7 @@ class ClientController extends Controller
public function index(Request $request): View public function index(Request $request): View
{ {
$query = Client::with('category') $query = Client::with('category')
->withCount(['invoices', 'events', 'contentBriefs']) ->withCount(['invoices', 'events', 'contentBriefs', 'mediaFiles'])
->latest(); ->latest();
if ($request->filled('category')) { if ($request->filled('category')) {
@@ -94,13 +94,11 @@ class ClientController extends Controller
public function show(Client $client): View public function show(Client $client): View
{ {
$client->load([ $client->load('category');
'category', $client->setRelation('events', $client->events()->latest()->limit(5)->get());
'events' => fn ($q) => $q->latest()->limit(5), $client->setRelation('invoices', $client->invoices()->latest()->limit(5)->get());
'invoices' => fn ($q) => $q->latest()->limit(5), $client->setRelation('contentBriefs', $client->contentBriefs()->latest()->limit(5)->get());
'contentBriefs'=> fn ($q) => $q->latest()->limit(5), $client->setRelation('mediaFiles', $client->mediaFiles()->latest()->limit(10)->get());
'mediaFiles' => fn ($q) => $q->latest()->limit(10),
]);
return view('clients.show', compact('client')); return view('clients.show', compact('client'));
} }

View File

@@ -30,8 +30,7 @@ class InvoiceController extends Controller
{ {
$clients = Client::where('status', 'active')->orderBy('name')->get(); $clients = Client::where('status', 'active')->orderBy('name')->get();
$statuses = InvoiceStatus::cases(); $statuses = InvoiceStatus::cases();
$invoiceSettings = InvoiceSettings::instance(); return view('invoices.create', compact('clients', 'statuses'));
return view('invoices.create', compact('clients', 'statuses', 'invoiceSettings'));
} }
public function store(Request $request): RedirectResponse public function store(Request $request): RedirectResponse
@@ -57,6 +56,8 @@ class InvoiceController extends Controller
'items.*.quantity' => 'required|integer|min:1', 'items.*.quantity' => 'required|integer|min:1',
'items.*.unit_price' => 'required|numeric|min:0', 'items.*.unit_price' => 'required|numeric|min:0',
'items.*.is_taxable' => 'nullable|boolean', 'items.*.is_taxable' => 'nullable|boolean',
'items.*.is_discountable' => 'nullable|boolean',
'discount_rate' => 'nullable|integer|min:0|max:100',
]); ]);
$items = $validated['items']; $items = $validated['items'];
@@ -84,17 +85,15 @@ class InvoiceController extends Controller
public function show(Invoice $invoice): View public function show(Invoice $invoice): View
{ {
$invoice->load('client', 'items'); $invoice->load('client', 'items');
$invoiceSettings = InvoiceSettings::instance(); return view('invoices.show', compact('invoice'));
return view('invoices.show', compact('invoice', 'invoiceSettings'));
} }
public function edit(Invoice $invoice): View public function edit(Invoice $invoice): View
{ {
$clients = Client::where('status', 'active')->orderBy('name')->get(); $clients = Client::where('status', 'active')->orderBy('name')->get();
$statuses = InvoiceStatus::cases(); $statuses = InvoiceStatus::cases();
$invoiceSettings = InvoiceSettings::instance();
$invoice->load('client', 'items'); $invoice->load('client', 'items');
return view('invoices.edit', compact('invoice', 'clients', 'statuses', 'invoiceSettings')); return view('invoices.edit', compact('invoice', 'clients', 'statuses'));
} }
public function update(Request $request, Invoice $invoice): RedirectResponse public function update(Request $request, Invoice $invoice): RedirectResponse
@@ -121,6 +120,8 @@ class InvoiceController extends Controller
'items.*.quantity' => 'required|integer|min:1', 'items.*.quantity' => 'required|integer|min:1',
'items.*.unit_price' => 'required|numeric|min:0', 'items.*.unit_price' => 'required|numeric|min:0',
'items.*.is_taxable' => 'nullable|boolean', 'items.*.is_taxable' => 'nullable|boolean',
'items.*.is_discountable' => 'nullable|boolean',
'discount_rate' => 'nullable|integer|min:0|max:100',
]); ]);
$items = $validated['items']; $items = $validated['items'];
@@ -154,4 +155,9 @@ class InvoiceController extends Controller
{ {
return $this->invoiceService->generatePdf($invoice); return $this->invoiceService->generatePdf($invoice);
} }
public function pdfLegacy(Invoice $invoice): Response
{
return $this->invoiceService->generateLegacyPdf($invoice);
}
} }

View File

@@ -52,7 +52,7 @@ class MediaFileController extends Controller
$this->fileService->uploadAsset( $this->fileService->uploadAsset(
$request->file('file'), $request->file('file'),
$request->input('folder'), $request->input('folder'),
$request->input('client_id') $request->filled('client_id') ? (int) $request->input('client_id') : null
); );
if ($request->expectsJson() || $request->ajax()) { if ($request->expectsJson() || $request->ajax()) {

View File

@@ -17,8 +17,7 @@ class RateCardController extends Controller
public function index(): View public function index(): View
{ {
$rateCards = RateCard::orderBy('sort_order')->orderBy('platform')->get(); $rateCards = RateCard::orderBy('sort_order')->orderBy('platform')->get();
$profile = RateCardProfile::getSingleton(); return view('rate-cards.index', compact('rateCards'));
return view('rate-cards.index', compact('rateCards', 'profile'));
} }
public function create(): View public function create(): View
@@ -88,22 +87,21 @@ class RateCardController extends Controller
public function public(): View public function public(): View
{ {
$profile = RateCardProfile::getSingleton();
$rateCards = RateCard::where('is_active', true) $rateCards = RateCard::where('is_active', true)
->orderBy('sort_order') ->orderBy('sort_order')
->orderBy('platform') ->orderBy('platform')
->get() ->get()
->groupBy('platform'); ->groupBy('platform');
return view('rate-cards.public', compact('rateCards', 'profile')); return view('rate-cards.public', compact('rateCards'));
} }
// ── Profile Settings ───────────────────────────────────────── // ── Profile Settings ─────────────────────────────────────────
public function profilePage(): View public function profilePage(): View
{ {
$profile = RateCardProfile::getSingleton(); $mediaFiles = \App\Models\MediaFile::latest()->get();
return view('rate-cards.profile', compact('profile')); return view('rate-cards.profile', compact('mediaFiles'));
} }
public function profileUpdate(Request $request): RedirectResponse public function profileUpdate(Request $request): RedirectResponse
@@ -119,9 +117,19 @@ class RateCardController extends Controller
'bg_color' => 'nullable|string|max:20', 'bg_color' => 'nullable|string|max:20',
'accent_color' => 'nullable|string|max:20', 'accent_color' => 'nullable|string|max:20',
'text_color' => 'nullable|string|max:20', 'text_color' => 'nullable|string|max:20',
'custom_footer' => 'nullable|string|max:500', 'custom_footer' => 'nullable|string|max:255',
'show_prices' => 'boolean', 'show_prices' => 'nullable|boolean',
'terms_and_conditions' => 'nullable|string',
'brand_logo_size' => 'nullable|in:small,medium,large',
'contact_person_html' => 'nullable|string',
'logo' => 'nullable|image|max:2048', 'logo' => 'nullable|image|max:2048',
'content_showcase' => 'nullable|array',
'content_showcase.*.file_id' => 'required_with:content_showcase|string',
'content_showcase.*.name' => 'required_with:content_showcase|string|max:255',
'content_showcase.*.url' => 'nullable|url',
'content_showcase.*.thumbnail_path' => 'nullable|string',
'content_showcase.*.show_on_public' => 'nullable',
'content_showcase.*.show_on_pdf' => 'nullable',
]); ]);
$profile = RateCardProfile::getSingleton(); $profile = RateCardProfile::getSingleton();
@@ -131,7 +139,13 @@ class RateCardController extends Controller
$validated['logo_path'] = $path; $validated['logo_path'] = $path;
} }
$validated['show_prices'] = $request->boolean('show_prices'); $validated['show_prices'] = $request->has('show_prices');
$contentShowcase = $validated['content_showcase'] ?? [];
foreach ($contentShowcase as &$item) {
$item['show_on_public'] = filter_var($item['show_on_public'] ?? true, FILTER_VALIDATE_BOOLEAN);
$item['show_on_pdf'] = filter_var($item['show_on_pdf'] ?? true, FILTER_VALIDATE_BOOLEAN);
}
$validated['content_showcase'] = $contentShowcase;
unset($validated['logo']); unset($validated['logo']);
$profile->update($validated); $profile->update($validated);
@@ -139,6 +153,70 @@ class RateCardController extends Controller
return back()->with('success', '🎨 Profile updated!'); return back()->with('success', '🎨 Profile updated!');
} }
public function uploadLogo(Request $request)
{
$request->validate([
'logo' => 'required|image|max:2048',
]);
$profile = RateCardProfile::getSingleton();
if ($profile->logo_path) {
\Storage::disk('private')->delete($profile->logo_path);
}
$path = $request->file('logo')->store('profile', 'private');
$profile->update(['logo_path' => $path]);
return response()->json([
'url' => route('files.serve-profile-logo'),
]);
}
public function deleteLogo()
{
$profile = RateCardProfile::getSingleton();
if ($profile->logo_path) {
\Storage::disk('private')->delete($profile->logo_path);
$profile->update(['logo_path' => null]);
}
return response()->json(['success' => true]);
}
public function uploadBrandLogo(Request $request)
{
$request->validate(['logo' => 'required|image|max:2048']);
$profile = RateCardProfile::getSingleton();
$path = $request->file('logo')->store('brands', 'public');
$brands = $profile->past_brands ?? [];
$brands[] = $path;
$profile->update(['past_brands' => $brands]);
return response()->json([
'path' => $path,
'url' => asset('storage/' . $path)
]);
}
public function deleteBrandLogo(Request $request)
{
$request->validate(['path' => 'required|string']);
$path = $request->input('path');
$profile = RateCardProfile::getSingleton();
$brands = $profile->past_brands ?? [];
if (($key = array_search($path, $brands)) !== false) {
unset($brands[$key]);
$profile->update(['past_brands' => array_values($brands)]);
Storage::disk('public')->delete($path);
}
return response()->json(['success' => true]);
}
public function serveProfileLogo(): Response public function serveProfileLogo(): Response
{ {
$profile = RateCardProfile::getSingleton(); $profile = RateCardProfile::getSingleton();
@@ -155,6 +233,17 @@ class RateCardController extends Controller
// ── PDF Download ───────────────────────────────────────────── // ── PDF Download ─────────────────────────────────────────────
public function uploadShowcaseThumbnail(Request $request)
{
$request->validate(['thumbnail' => 'required|image|max:2048']);
$path = $request->file('thumbnail')->store('showcase', 'public');
return response()->json([
'path' => $path,
'url' => asset('storage/' . $path)
]);
}
public function pdf(): \Illuminate\Http\Response public function pdf(): \Illuminate\Http\Response
{ {
$profile = RateCardProfile::getSingleton(); $profile = RateCardProfile::getSingleton();
@@ -165,7 +254,7 @@ class RateCardController extends Controller
->groupBy('platform'); ->groupBy('platform');
$pdf = Pdf::loadView('rate-cards.pdf', compact('rateCards', 'profile')) $pdf = Pdf::loadView('rate-cards.pdf', compact('rateCards', 'profile'))
->setPaper('a4', 'portrait'); ->setPaper('a4', 'landscape');
$filename = 'rate-card-' . now()->format('Y-m-d') . '.pdf'; $filename = 'rate-card-' . now()->format('Y-m-d') . '.pdf';

View File

@@ -17,7 +17,7 @@ class SearchController extends Controller
{ {
public function index(Request $request): View public function index(Request $request): View
{ {
$q = trim($request->get('q', '')); $q = trim((string) $request->get('q', ''));
$results = $q ? $this->search($q) : []; $results = $q ? $this->search($q) : [];
return view('search.index', compact('q', 'results')); return view('search.index', compact('q', 'results'));
@@ -26,7 +26,7 @@ class SearchController extends Controller
/** Quick AJAX endpoint — returns grouped results for the dropdown */ /** Quick AJAX endpoint — returns grouped results for the dropdown */
public function quick(Request $request): JsonResponse public function quick(Request $request): JsonResponse
{ {
$q = trim($request->get('q', '')); $q = trim((string) $request->get('q', ''));
if (strlen($q) < 2) { if (strlen($q) < 2) {
return response()->json([]); return response()->json([]);
@@ -138,6 +138,24 @@ class SearchController extends Controller
]; ];
} }
// ── Notes ───────────────────────────────────────────
$notes = \App\Models\Note::where('title', 'LIKE', $like)
->orWhere('content', 'LIKE', $like)
->limit($limit)->get();
if ($notes->isNotEmpty()) {
$groups[] = [
'type' => 'notes',
'label' => '📝 Notes',
'items' => $notes->map(fn ($n) => [
'icon' => '📝',
'title' => $n->title ?: 'Untitled',
'subtitle' => 'Notes Management',
'url' => route('notes.index'),
])->values()->all(),
];
}
return $groups; return $groups;
} }
} }

View File

@@ -13,7 +13,7 @@ class GateAuth
public function handle(Request $request, Closure $next): Response public function handle(Request $request, Closure $next): Response
{ {
// Allow the login routes through without auth check // Allow the login routes through without auth check
if ($request->routeIs('gate.login', 'gate.attempt', 'gate.logout')) { if ($request->routeIs('gate.login', 'gate.attempt', 'gate.logout', 'rate-cards.public')) {
return $next($request); return $next($request);
} }

View File

@@ -57,14 +57,19 @@ class Client extends Model
public function getFullAddressAttribute(): string public function getFullAddressAttribute(): string
{ {
$line3_parts = array_filter([$this->city, $this->state]);
$country_part = array_filter([$this->postal_code, $this->country]);
$country_str = implode(' - ', $country_part);
if ($country_str) {
$line3_parts[] = $country_str;
}
$line3 = implode(', ', $line3_parts);
return collect([ return collect([
$this->address_line1, $this->address_line1,
$this->address_line2, $this->address_line2,
$this->city, $line3
$this->state, ])->filter()->implode("\n");
$this->postal_code,
$this->country,
])->filter()->implode(', ');
} }
public function getInitialsAttribute(): string public function getInitialsAttribute(): string

View File

@@ -21,7 +21,7 @@ class Invoice extends Model
'subtotal', 'tax_rate', 'tax_amount', 'total', 'currency', 'subtotal', 'tax_rate', 'tax_amount', 'total', 'currency',
'status', 'issue_date', 'due_date', 'paid_date', 'notes', 'status', 'issue_date', 'due_date', 'paid_date', 'notes',
'bank_name', 'bank_account', 'bank_holder', 'branch_name', 'bank_name', 'bank_account', 'bank_holder', 'branch_name',
'signature_image', 'signer_name', 'signer_title', 'signature_image', 'signer_name', 'signer_title', 'discount_rate',
]; ];
protected $casts = [ protected $casts = [
@@ -47,14 +47,32 @@ class Invoice extends Model
public function recalculate(): void public function recalculate(): void
{ {
// Total of all items (what the creator receives) // Total of all items
$this->subtotal = $this->items->sum('total'); $this->subtotal = $this->items->sum('total');
// Tax is calculated only on taxable items, but paid by the client on top $discountAmount = 0;
$taxableSubtotal = $this->items->where('is_taxable', true)->sum('total'); if ($this->discount_rate > 0) {
$discountableSubtotal = $this->items->where('is_discountable', true)->sum('total');
$discountAmount = round((float) $discountableSubtotal * ($this->discount_rate / 100), 2);
}
$this->subtotal = $this->subtotal - $discountAmount;
// Tax is calculated only on taxable items
$taxableSubtotal = 0;
foreach ($this->items as $item) {
if ($item->is_taxable) {
if ($this->discount_rate > 0 && $item->is_discountable) {
$taxableSubtotal += $item->total * (1 - $this->discount_rate / 100);
} else {
$taxableSubtotal += $item->total;
}
}
}
$this->tax_amount = round((float) $taxableSubtotal * ($this->tax_rate / 100), 2); $this->tax_amount = round((float) $taxableSubtotal * ($this->tax_rate / 100), 2);
// Grand total = subtotal (creator's fee, pre-tax — tax is borne by client separately) // Grand total = subtotal (tax is borne by client separately)
$this->total = $this->subtotal; $this->total = $this->subtotal;
$this->save(); $this->save();
} }
@@ -64,6 +82,14 @@ class Invoice extends Model
return 'Rp ' . number_format((float) $this->total, 0, ',', '.'); return 'Rp ' . number_format((float) $this->total, 0, ',', '.');
} }
public function getDiscountAmountAttribute(): float
{
if ($this->discount_rate <= 0) return 0.0;
$discountableSubtotal = $this->items->where('is_discountable', true)->sum('total');
return round((float) $discountableSubtotal * ($this->discount_rate / 100), 2);
}
public static function generateNumber(): string public static function generateNumber(): string
{ {
return InvoiceSettings::generateNumber(); return InvoiceSettings::generateNumber();

View File

@@ -9,12 +9,13 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
class InvoiceItem extends Model class InvoiceItem extends Model
{ {
protected $fillable = ['invoice_id', 'description', 'quantity', 'unit_price', 'total', 'is_taxable']; protected $fillable = ['invoice_id', 'description', 'quantity', 'unit_price', 'total', 'is_taxable', 'is_discountable'];
protected $casts = [ protected $casts = [
'unit_price' => 'decimal:2', 'unit_price' => 'decimal:2',
'total' => 'decimal:2', 'total' => 'decimal:2',
'is_taxable' => 'boolean', 'is_taxable' => 'boolean',
'is_discountable' => 'boolean',
]; ];
public function invoice(): BelongsTo public function invoice(): BelongsTo

View File

@@ -35,25 +35,39 @@ class InvoiceSettings extends Model
'default_tax_rate' => 'decimal:2', 'default_tax_rate' => 'decimal:2',
]; ];
protected static ?self $instance = null;
/** Always return the single settings row, creating it if absent. */ /** Always return the single settings row, creating it if absent. */
public static function instance(): self public static function instance(): self
{ {
return static::firstOrCreate([], [ if (self::$instance) {
return self::$instance;
}
self::$instance = static::firstOrCreate([], [
'invoice_prefix' => 'INV', 'invoice_prefix' => 'INV',
'invoice_next_number' => 1, 'invoice_next_number' => 1,
'accent_color' => '#FFB7C5', 'accent_color' => '#FFB7C5',
'default_tax_rate' => 11, 'default_tax_rate' => 2.5,
'default_currency' => 'IDR', 'default_currency' => 'IDR',
]); ]);
return self::$instance;
}
protected static function booted()
{
static::saved(fn ($model) => self::$instance = $model);
static::deleted(fn () => self::$instance = null);
} }
/** Generate the next invoice number and increment the counter. */
public static function generateNumber(): string public static function generateNumber(): string
{ {
$settings = static::instance(); $settings = static::instance();
$prefix = rtrim($settings->invoice_prefix, '-'); $prefix = rtrim($settings->invoice_prefix, '-');
$number = str_pad((string) $settings->invoice_next_number, 3, '0', STR_PAD_LEFT); $number = str_pad((string) $settings->invoice_next_number, 3, '0', STR_PAD_LEFT);
$settings->increment('invoice_next_number'); $settings->increment('invoice_next_number');
\Illuminate\Support\Facades\Cache::forget('invoice_settings');
return $prefix . '-' . $number; return $prefix . '-' . $number;
} }
} }

View File

@@ -13,22 +13,43 @@ class RateCardProfile extends Model
'ig_handle', 'tiktok_handle', 'youtube_handle', 'email', 'ig_handle', 'tiktok_handle', 'youtube_handle', 'email',
'logo_path', 'bg_color', 'accent_color', 'text_color', 'logo_path', 'bg_color', 'accent_color', 'text_color',
'custom_footer', 'show_prices', 'access_token', 'custom_footer', 'show_prices', 'access_token',
'terms_and_conditions',
'past_brands',
'brand_logo_size',
'contact_person_html',
'content_showcase',
]; ];
protected $casts = [ protected $casts = [
'show_prices' => 'boolean', 'show_prices' => 'boolean',
'past_brands' => 'array',
'content_showcase' => 'array',
]; ];
protected static ?self $instance = null;
/** Get the singleton profile, creating defaults if needed */ /** Get the singleton profile, creating defaults if needed */
public static function getSingleton(): self public static function getSingleton(): self
{ {
return static::firstOrCreate([], [ if (self::$instance) {
return self::$instance;
}
self::$instance = static::firstOrCreate([], [
'owner_name' => config('app.name', 'Cathy Page'), 'owner_name' => config('app.name', 'Cathy Page'),
'bg_color' => '#FFF8F0', 'bg_color' => '#FFF8F0',
'accent_color' => '#FFB7C5', 'accent_color' => '#FFB7C5',
'text_color' => '#374151', 'text_color' => '#374151',
'show_prices' => true, 'show_prices' => true,
]); ]);
return self::$instance;
}
protected static function booted()
{
static::saved(fn ($model) => self::$instance = $model);
static::deleted(fn () => self::$instance = null);
} }
public function getWhatsappUrlAttribute(): ?string public function getWhatsappUrlAttribute(): ?string

View File

@@ -16,6 +16,13 @@ class AppServiceProvider extends ServiceProvider
{ {
// Inject alert badge count into all views // Inject alert badge count into all views
View::composer('*', function (\Illuminate\View\View $view): void { View::composer('*', function (\Illuminate\View\View $view): void {
if (!$view->offsetExists('profile')) {
$view->with('profile', \App\Models\RateCardProfile::getSingleton());
}
if (!$view->offsetExists('invoiceSettings')) {
$view->with('invoiceSettings', \App\Models\InvoiceSettings::instance());
}
try { try {
$alertCount = Event::upcoming(24)->count(); $alertCount = Event::upcoming(24)->count();
} catch (\Throwable) { } catch (\Throwable) {

View File

@@ -59,4 +59,15 @@ final class InvoiceService
return $pdf->download("invoice-{$invoice->invoice_number}.pdf"); return $pdf->download("invoice-{$invoice->invoice_number}.pdf");
} }
public function generateLegacyPdf(Invoice $invoice): Response
{
$invoice->load('client', 'items');
$invoiceSettings = InvoiceSettings::instance();
$pdf = Pdf::loadView('invoices.pdf-legacy', compact('invoice', 'invoiceSettings'));
$pdf->setPaper('A4', 'portrait');
return $pdf->download("invoice-{$invoice->invoice_number}-legacy.pdf");
}
} }

View File

@@ -0,0 +1,29 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('rate_card_profiles', function (Blueprint $table) {
$table->text('terms_and_conditions')->nullable();
$table->json('past_brands')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('rate_card_profiles', function (Blueprint $table) {
$table->dropColumn(['terms_and_conditions', 'past_brands']);
});
}
};

View File

@@ -0,0 +1,22 @@
<?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('rate_card_profiles', function (Blueprint $table) {
$table->text('contact_person_html')->nullable();
});
}
public function down(): void
{
Schema::table('rate_card_profiles', function (Blueprint $table) {
$table->dropColumn('contact_person_html');
});
}
};

View File

@@ -0,0 +1,22 @@
<?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('rate_card_profiles', function (Blueprint $table) {
$table->string('brand_logo_size')->default('medium')->after('past_brands');
});
}
public function down(): void
{
Schema::table('rate_card_profiles', function (Blueprint $table) {
$table->dropColumn('brand_logo_size');
});
}
};

View File

@@ -0,0 +1,22 @@
<?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('rate_card_profiles', function (Blueprint $table) {
$table->json('content_showcase')->nullable();
});
}
public function down(): void
{
Schema::table('rate_card_profiles', function (Blueprint $table) {
$table->dropColumn('content_showcase');
});
}
};

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('invoices', function (Blueprint $table) {
if (!Schema::hasColumn('invoices', 'discount_rate')) {
$table->integer('discount_rate')->default(0);
}
});
Schema::table('invoice_items', function (Blueprint $table) {
if (!Schema::hasColumn('invoice_items', 'is_discountable')) {
$table->boolean('is_discountable')->default(true);
}
});
}
public function down(): void
{
Schema::table('invoices', function (Blueprint $table) {
if (Schema::hasColumn('invoices', 'discount_rate')) {
$table->dropColumn('discount_rate');
}
});
Schema::table('invoice_items', function (Blueprint $table) {
if (Schema::hasColumn('invoice_items', 'is_discountable')) {
$table->dropColumn('is_discountable');
}
});
}
};

View File

@@ -7,8 +7,8 @@ services:
container_name: kol-manager container_name: kol-manager
restart: unless-stopped restart: unless-stopped
ports: # ports:
- "${APP_PORT:-8080}:80" # - "${APP_PORT:-8080}:80"
# Mount .env.docker as the runtime .env # Mount .env.docker as the runtime .env
env_file: env_file:
@@ -22,7 +22,7 @@ services:
- kol_storage:/var/www/html/storage - kol_storage:/var/www/html/storage
healthcheck: healthcheck:
test: ["CMD", "curl", "-f", "http://localhost/up"] test: [ "CMD", "curl", "-f", "http://localhost/up" ]
interval: 30s interval: 30s
timeout: 10s timeout: 10s
retries: 3 retries: 3

View File

@@ -24,7 +24,7 @@ http {
gzip_types text/plain text/css application/json application/javascript text/xml application/xml; gzip_types text/plain text/css application/json application/javascript text/xml application/xml;
# Upload size limit (matches file uploads in the app) # Upload size limit (matches file uploads in the app)
client_max_body_size 64M; client_max_body_size 500M;
server { server {
listen 80; listen 80;

View File

@@ -138,6 +138,7 @@
<span>📅 {{ $client->events_count }}</span> <span>📅 {{ $client->events_count }}</span>
<span>🧾 {{ $client->invoices_count }}</span> <span>🧾 {{ $client->invoices_count }}</span>
<span>🎬 {{ $client->content_briefs_count }}</span> <span>🎬 {{ $client->content_briefs_count }}</span>
<span>📁 {{ $client->media_files_count ?? 0 }}</span>
</div> </div>
@if($client->email || $client->city) @if($client->email || $client->city)

View File

@@ -18,9 +18,22 @@
const fd = new FormData(); const fd = new FormData();
fd.append('avatar', input.files[0]); fd.append('avatar', input.files[0]);
fd.append('_token', document.querySelector('meta[name=csrf-token]').content); fd.append('_token', document.querySelector('meta[name=csrf-token]').content);
const res = await fetch('{{ route('clients.upload-avatar', $client) }}', { method: 'POST', body: fd }); try {
const res = await fetch('{{ route('clients.upload-avatar', $client->id, false) }}', {
method: 'POST',
body: fd,
headers: { 'Accept': 'application/json' }
});
const data = await res.json(); const data = await res.json();
if (res.ok) this.avatarUrl = data.url + '?t=' + Date.now(); if (res.ok) {
this.avatarUrl = data.url + '?t=' + Date.now();
} else {
alert(data.message || 'Upload failed');
}
} catch (err) {
console.error('Avatar upload error:', err);
alert('Network Error. Could not upload.');
}
this.uploading = false; this.uploading = false;
input.value = ''; input.value = '';
}, },
@@ -29,8 +42,16 @@
const fd = new FormData(); const fd = new FormData();
fd.append('_token', document.querySelector('meta[name=csrf-token]').content); fd.append('_token', document.querySelector('meta[name=csrf-token]').content);
fd.append('_method', 'DELETE'); fd.append('_method', 'DELETE');
await fetch('{{ route('clients.delete-avatar', $client) }}', { method: 'POST', body: fd }); try {
await fetch('{{ route('clients.delete-avatar', $client->id, false) }}', {
method: 'POST',
body: fd,
headers: { 'Accept': 'application/json' }
});
this.avatarUrl = ''; this.avatarUrl = '';
} catch (err) {
console.error(err);
}
} }
}"> }">
<div class="flex items-start gap-4"> <div class="flex items-start gap-4">
@@ -55,6 +76,13 @@
<span x-show="uploading" class="text-white text-xs">…</span> <span x-show="uploading" class="text-white text-xs">…</span>
<input type="file" accept="image/*" class="hidden" @change="pickAvatar($event.target)"> <input type="file" accept="image/*" class="hidden" @change="pickAvatar($event.target)">
</label> </label>
{{-- Remove Photo Button (Top Left) --}}
<button x-show="avatarUrl" @click.prevent="removeAvatar()"
class="absolute -top-2 -left-2 bg-red-100 text-red-500 rounded-full w-6 h-6 flex items-center justify-center hover:bg-red-200 shadow text-xs z-10 border border-white"
title="Remove Photo">
✕
</button>
</div> </div>
<div class="flex-1 min-w-0"> <div class="flex-1 min-w-0">
@@ -81,10 +109,6 @@
class="text-sm px-4 py-2 rounded-full border border-pink-200 text-gray-600 hover:bg-pink-50 font-semibold"> class="text-sm px-4 py-2 rounded-full border border-pink-200 text-gray-600 hover:bg-pink-50 font-semibold">
🧾 New Invoice 🧾 New Invoice
</a> </a>
<button x-show="avatarUrl" @click="removeAvatar()"
class="text-sm px-4 py-2 rounded-full border border-red-200 text-red-400 hover:bg-red-50 font-semibold">
🗑️ Remove Photo
</button>
</div> </div>
</div> </div>
@@ -109,7 +133,7 @@
@if($client->full_address) @if($client->full_address)
<div class="flex gap-2 items-start"> <div class="flex gap-2 items-start">
<span class="text-gray-400 shrink-0">📍</span> <span class="text-gray-400 shrink-0">📍</span>
<span class="text-gray-600">{{ $client->full_address }}</span> <span class="text-gray-600">{!! nl2br(e($client->full_address)) !!}</span>
</div> </div>
@endif @endif
@if($client->notes) @if($client->notes)
@@ -181,5 +205,29 @@
</div> </div>
</div> </div>
@endif @endif
{{-- Uploaded Files --}}
@if($client->mediaFiles->isNotEmpty())
<div class="cat-card p-4 mt-4">
<div class="flex items-center justify-between mb-3">
<h3 class="font-bold text-gray-700 text-sm flex items-center gap-2">📁 Files</h3>
<a href="{{ route('files.index') }}?client_id={{ $client->id }}" class="text-xs text-pink-500">All Files →</a>
</div>
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3">
@foreach($client->mediaFiles as $file)
<a href="{{ route('files.serve', $file) }}" target="_blank"
class="bg-blue-50 rounded-2xl p-3 hover:bg-blue-100 transition-colors flex items-center gap-3">
<div class="shrink-0 text-xl border border-blue-200 rounded-lg w-10 h-10 flex items-center justify-center bg-white">
📄
</div>
<div class="min-w-0 flex-1">
<div class="font-semibold text-gray-700 text-sm truncate" title="{{ $file->name }}">{{ $file->name }}</div>
<div class="text-xs text-gray-400 mt-0.5">{{ number_format($file->size / 1024, 1) }} KB</div>
</div>
</a>
@endforeach
</div>
</div>
@endif
</div> </div>
@endsection @endsection

View File

@@ -8,19 +8,6 @@
<div class="flex flex-col sm:flex-row sm:items-center justify-between gap-3 mb-5"> <div class="flex flex-col sm:flex-row sm:items-center justify-between gap-3 mb-5">
<div class="flex gap-2 flex-wrap"> <div class="flex gap-2 flex-wrap">
<a href="{{ route('content.create') }}" class="btn-sakura text-sm shrink-0">+ New Brief</a> <a href="{{ route('content.create') }}" class="btn-sakura text-sm shrink-0">+ New Brief</a>
@foreach(['instagram', 'tiktok', 'youtube'] as $p)
<a href="{{ request()->fullUrlWithQuery(['platform' => $p]) }}"
class="px-3 py-1.5 rounded-full text-xs font-semibold transition-colors
{{ request('platform') === $p ? 'text-white' : 'bg-white text-gray-500 hover:bg-pink-50 border border-pink-100' }}"
style="{{ request('platform') === $p ? 'background:#FFB7C5' : '' }}">
{{ ['instagram' => '📸', 'tiktok' => '🎵', 'youtube' => '▶️'][$p] }} {{ ucfirst($p) }}
</a>
@endforeach
@if(request('platform'))
<a href="{{ route('content.index') }}"
class="px-3 py-1.5 rounded-full text-xs text-gray-400 hover:text-gray-600 border border-gray-200 bg-white">✕
Clear</a>
@endif
</div> </div>
</div> </div>
@@ -36,8 +23,19 @@
@php $status = $col['status']; @endphp @php $status = $col['status']; @endphp
{{-- Column shell — layout only, NOT the sort target --}} {{-- Column shell — layout only, NOT the sort target --}}
@php
$bgColors = [
'drafting' => '#f2f2f2',
'filming' => 'rgba(251, 189, 35, 0.2)',
'editing' => 'rgba(58, 191, 248, 0.2)',
'review' => 'rgba(240, 0, 184, 0.2)',
'posted' => 'rgba(54, 211, 153, 0.2)',
'archived' => 'rgba(42, 50, 60, 0.2)',
];
$bgStyle = isset($bgColors[$status->value]) ? 'background-color: ' . $bgColors[$status->value] . ';' : '';
@endphp
<div class="{{ $status->colorClass() }} flex flex-col w-full lg:flex-1 lg:min-w-36 rounded-2xl p-3" <div class="{{ $status->colorClass() }} flex flex-col w-full lg:flex-1 lg:min-w-36 rounded-2xl p-3"
data-status="{{ $status->value }}"> style="{{ $bgStyle }}" data-status="{{ $status->value }}">
{{-- Column header --}} {{-- Column header --}}
<div class="flex items-center justify-between mb-3"> <div class="flex items-center justify-between mb-3">
@@ -50,8 +48,7 @@
</div> </div>
{{-- Sortable items container --}} {{-- Sortable items container --}}
<div class="flex flex-col gap-2 flex-1 min-h-12 kanban-column" <div class="flex flex-col gap-2 flex-1 min-h-12 kanban-column" data-col-status="{{ $status->value }}">
data-col-status="{{ $status->value }}">
@foreach($col['items'] as $brief) @foreach($col['items'] as $brief)
<div class="bg-white rounded-2xl p-3 shadow-sm border border-pink-50 select-none <div class="bg-white rounded-2xl p-3 shadow-sm border border-pink-50 select-none
@@ -59,8 +56,7 @@
data-id="{{ $brief->id }}"> data-id="{{ $brief->id }}">
<div class="flex items-start gap-2 mb-1.5"> <div class="flex items-start gap-2 mb-1.5">
<span class="text-sm shrink-0">{{ $brief->platform_icon }}</span> <span class="text-sm shrink-0">{{ $brief->platform_icon }}</span>
<a href="#" <a href="#" data-brief="{{ json_encode([
data-brief="{{ json_encode([
'id' => $brief->id, 'id' => $brief->id,
'title' => $brief->title, 'title' => $brief->title,
'platform' => $brief->platform_icon . ' ' . ucfirst($brief->platform), 'platform' => $brief->platform_icon . ' ' . ucfirst($brief->platform),
@@ -70,8 +66,7 @@
'hook' => $brief->hook, 'hook' => $brief->hook,
'body' => $brief->body, 'body' => $brief->body,
'notes' => $brief->notes 'notes' => $brief->notes
]) }}" ]) }}" @click.prevent="openModal(JSON.parse($el.dataset.brief))"
@click.prevent="openModal(JSON.parse($el.dataset.brief))"
class="font-semibold text-gray-800 text-xs leading-tight hover:text-pink-500 line-clamp-2 flex-1"> class="font-semibold text-gray-800 text-xs leading-tight hover:text-pink-500 line-clamp-2 flex-1">
{{ $brief->title }} {{ $brief->title }}
</a> </a>
@@ -103,52 +98,64 @@
@endforeach @endforeach
{{-- Content Detail Request Modal --}} {{-- Content Detail Request Modal --}}
<div x-show="modalOpen" class="fixed inset-0 z-[60] flex items-center justify-center bg-black/40 backdrop-blur-sm" style="display: none;" x-transition> <div x-show="modalOpen" class="fixed inset-0 z-[60] flex items-center justify-center bg-black/40 backdrop-blur-sm"
<div @click.outside="modalOpen = false" class="bg-white p-5 w-full max-w-lg rounded-3xl shadow-xl mx-4 max-h-[90vh] flex flex-col relative" style="display: none;" x-transition>
x-transition:enter="transition ease-out duration-300" <div @click.outside="modalOpen = false"
x-transition:enter-start="opacity-0 translate-y-4" class="bg-white p-5 w-full max-w-lg rounded-3xl shadow-xl mx-4 max-h-[90vh] flex flex-col relative"
x-transition:enter-end="opacity-100 translate-y-0" x-transition:enter="transition ease-out duration-300" x-transition:enter-start="opacity-0 translate-y-4"
x-transition:leave="transition ease-in duration-200" x-transition:enter-end="opacity-100 translate-y-0" x-transition:leave="transition ease-in duration-200"
x-transition:leave-start="opacity-100 translate-y-0" x-transition:leave-start="opacity-100 translate-y-0" x-transition:leave-end="opacity-0 translate-y-4">
x-transition:leave-end="opacity-0 translate-y-4">
<div class="flex items-center justify-between mb-4 border-b border-pink-50 pb-3 shrink-0"> <div class="flex items-center justify-between mb-4 border-b border-pink-50 pb-3 shrink-0">
<h3 class="font-extrabold text-gray-800 text-xl truncate pr-4" x-text="activeBrief?.title"></h3> <h3 class="font-extrabold text-gray-800 text-xl truncate pr-4" x-text="activeBrief?.title"></h3>
<button @click="modalOpen = false" class="text-gray-400 hover:text-pink-500 hover:bg-pink-50 w-8 h-8 rounded-full flex items-center justify-center transition-colors">✕</button> <button @click="modalOpen = false"
class="text-gray-400 hover:text-pink-500 hover:bg-pink-50 w-8 h-8 rounded-full flex items-center justify-center transition-colors">✕</button>
</div> </div>
<div class="text-sm text-gray-600 space-y-4 flex-1 overflow-y-auto pr-2 custom-scrollbar"> <div class="text-sm text-gray-600 space-y-4 flex-1 overflow-y-auto pr-2 custom-scrollbar">
<div class="flex gap-3"><span class="text-gray-400 w-20 shrink-0 font-medium">Platform</span><span class="font-bold text-gray-800" x-text="activeBrief?.platform"></span></div> <div class="flex gap-3"><span class="text-gray-400 w-20 shrink-0 font-medium">Platform</span><span
<div class="flex gap-3"><span class="text-gray-400 w-20 shrink-0 font-medium">Status</span><span class="font-bold badge bg-pink-100 text-pink-700 rounded-full px-2 py-0.5" x-text="activeBrief?.status"></span></div> class="font-bold text-gray-800" x-text="activeBrief?.platform"></span></div>
<div class="flex gap-3"><span class="text-gray-400 w-20 shrink-0 font-medium">Status</span><span
class="font-bold badge bg-pink-100 text-pink-700 rounded-full px-2 py-0.5"
x-text="activeBrief?.status"></span></div>
<template x-if="activeBrief?.client"> <template x-if="activeBrief?.client">
<div class="flex gap-3 items-center"><span class="text-gray-400 w-20 shrink-0 font-medium">Client</span><span class="font-semibold text-pink-500" x-text="activeBrief?.client"></span></div> <div class="flex gap-3 items-center"><span
class="text-gray-400 w-20 shrink-0 font-medium">Client</span><span
class="font-semibold text-pink-500" x-text="activeBrief?.client"></span></div>
</template> </template>
<template x-if="activeBrief?.target_date"> <template x-if="activeBrief?.target_date">
<div class="flex gap-3"><span class="text-gray-400 w-20 shrink-0 font-medium">Target</span><span class="font-medium" x-text="activeBrief?.target_date"></span></div> <div class="flex gap-3"><span class="text-gray-400 w-20 shrink-0 font-medium">Target</span><span
class="font-medium" x-text="activeBrief?.target_date"></span></div>
</template> </template>
<template x-if="activeBrief?.hook"> <template x-if="activeBrief?.hook">
<div class="flex flex-col gap-1 mt-4"> <div class="flex flex-col gap-1 mt-4">
<span class="text-gray-400 font-medium">🎣 Hook</span> <span class="text-gray-400 font-medium">🎣 Hook</span>
<div class="whitespace-pre-wrap bg-pink-50/50 border border-pink-100 p-3 rounded-2xl text-gray-700 leading-relaxed" x-text="activeBrief?.hook"></div> <div class="whitespace-pre-wrap bg-pink-50/50 border border-pink-100 p-3 rounded-2xl text-gray-700 leading-relaxed"
x-text="activeBrief?.hook"></div>
</div> </div>
</template> </template>
<template x-if="activeBrief?.body"> <template x-if="activeBrief?.body">
<div class="flex flex-col gap-1 mt-4"> <div class="flex flex-col gap-1 mt-4">
<span class="text-gray-400 font-medium">📖 Body</span> <span class="text-gray-400 font-medium">📖 Body</span>
<div class="whitespace-pre-wrap bg-gray-50 border border-gray-100 p-3 rounded-2xl text-gray-700 leading-relaxed" x-text="activeBrief?.body"></div> <div class="whitespace-pre-wrap bg-gray-50 border border-gray-100 p-3 rounded-2xl text-gray-700 leading-relaxed"
x-text="activeBrief?.body"></div>
</div> </div>
</template> </template>
<template x-if="activeBrief?.notes"> <template x-if="activeBrief?.notes">
<div class="flex flex-col gap-1 mt-4"> <div class="flex flex-col gap-1 mt-4">
<span class="text-gray-400 font-medium">📝 Notes</span> <span class="text-gray-400 font-medium">📝 Notes</span>
<div class="whitespace-pre-wrap bg-yellow-50/50 border border-yellow-100 p-3 rounded-2xl text-gray-700 leading-relaxed" x-text="activeBrief?.notes"></div> <div class="whitespace-pre-wrap bg-yellow-50/50 border border-yellow-100 p-3 rounded-2xl text-gray-700 leading-relaxed"
x-text="activeBrief?.notes"></div>
</div> </div>
</template> </template>
</div> </div>
<div class="flex gap-3 mt-5 pt-4 border-t border-pink-50 shrink-0"> <div class="flex gap-3 mt-5 pt-4 border-t border-pink-50 shrink-0">
<a :href="`/content/${activeBrief?.id}/edit`" class="btn-sakura text-sm flex-1 text-center py-2.5">Edit Brief</a> <a :href="`/content/${activeBrief?.id}/edit`" class="btn-sakura text-sm flex-1 text-center py-2.5">Edit
<a :href="`/content/${activeBrief?.id}`" class="py-2.5 rounded-full border border-pink-200 text-pink-500 text-sm hover:bg-pink-50 flex-1 text-center font-bold bg-white transition-colors">Details Page</a> Brief</a>
<a :href="`/content/${activeBrief?.id}`"
class="py-2.5 rounded-full border border-pink-200 text-pink-500 text-sm hover:bg-pink-50 flex-1 text-center font-bold bg-white transition-colors">Details
Page</a>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -78,9 +78,16 @@
</div> </div>
<div class="flex-1"> <div class="flex-1">
<label class="text-xs text-gray-400 block mb-0.5">Unit Price</label> <label class="text-xs text-gray-400 block mb-0.5">Unit Price</label>
<input type="number" :name="`items[${index}][unit_price]`" <input type="hidden" :name="`items[${index}][unit_price]`" :value="item.unit_price">
x-model.number="item.unit_price" @input="recalc()" <input type="text"
class="input-soft text-sm bg-white" min="0" step="1000" placeholder="0"> :value="item.unit_price ? formatNum(item.unit_price) : ''"
@input="
let raw = $event.target.value.replace(/\D/g, '');
item.unit_price = raw ? parseInt(raw, 10) : 0;
$event.target.value = item.unit_price ? formatNum(item.unit_price) : '';
recalc();
"
class="input-soft text-sm bg-white" placeholder="0">
</div> </div>
<div class="w-24 shrink-0 text-right"> <div class="w-24 shrink-0 text-right">
<label class="text-xs text-gray-400 block mb-0.5">Total</label> <label class="text-xs text-gray-400 block mb-0.5">Total</label>
@@ -91,8 +98,9 @@
<button type="button" @click="removeItem(index)" <button type="button" @click="removeItem(index)"
class="text-red-400 hover:text-red-600 text-lg shrink-0 pt-4">✕</button> class="text-red-400 hover:text-red-600 text-lg shrink-0 pt-4">✕</button>
</div> </div>
{{-- Taxable checkbox --}} {{-- Taxable and Discount checkboxes --}}
<div class="mt-2 flex items-center gap-2"> <div class="mt-2 flex items-center gap-4">
<div class="flex items-center gap-2">
<input type="hidden" :name="`items[${index}][is_taxable]`" value="0"> <input type="hidden" :name="`items[${index}][is_taxable]`" value="0">
<input type="checkbox" :name="`items[${index}][is_taxable]`" :id="`taxable_${index}`" <input type="checkbox" :name="`items[${index}][is_taxable]`" :id="`taxable_${index}`"
x-model="item.is_taxable" @change="recalc()" value="1" x-model="item.is_taxable" @change="recalc()" value="1"
@@ -102,6 +110,17 @@
Taxable Taxable
</label> </label>
</div> </div>
<div class="flex items-center gap-2" x-show="addDiscount">
<input type="hidden" :name="`items[${index}][is_discountable]`" value="0">
<input type="checkbox" :name="`items[${index}][is_discountable]`" :id="`discountable_${index}`"
x-model="item.is_discountable" @change="recalc()" value="1"
class="w-3.5 h-3.5 accent-pink-400">
<label :for="`discountable_${index}`"
class="text-xs text-gray-500 cursor-pointer select-none">
Discount
</label>
</div>
</div>
</div> </div>
</template> </template>
</div> </div>
@@ -109,10 +128,26 @@
{{-- Totals --}} {{-- Totals --}}
<div class="bg-pink-50 rounded-2xl p-4 mb-5"> <div class="bg-pink-50 rounded-2xl p-4 mb-5">
<div class="mb-3 border-b border-pink-100 pb-3 flex flex-col sm:flex-row sm:items-center gap-y-2 gap-x-4 min-h-[32px]">
<label class="flex items-center gap-2 cursor-pointer shrink-0 w-max">
<input type="checkbox" x-model="addDiscount" @change="toggleDiscount()" class="w-4 h-4 accent-pink-400">
<span class="text-sm font-bold text-gray-700">Add Discount</span>
</label>
<div x-show="addDiscount" class="flex items-center gap-3 flex-1 overflow-hidden" style="display: none;">
<input type="range" name="discount_rate" min="5" max="90" step="5" x-model.number="discountRate" @input="recalc()" class="w-32 sm:w-48 accent-pink-500 h-2 bg-pink-100 rounded-lg appearance-none cursor-pointer shrink-0 hover:accent-pink-600 transition-all">
<span class="font-bold text-pink-600 text-sm shrink-0 w-8 text-right"><span x-text="discountRate"></span>%</span>
<span class="text-xs text-pink-500 font-medium tracking-wide truncate border-l border-pink-200 pl-3" x-text="getDiscountLabel()"></span>
</div>
</div>
<div class="flex justify-between text-sm py-1"> <div class="flex justify-between text-sm py-1">
<span class="text-gray-500">Subtotal (all items)</span> <span class="text-gray-500">Subtotal (all items)</span>
<span class="font-semibold">Rp <span x-text="formatNum(subtotal)"></span></span> <span class="font-semibold">Rp <span x-text="formatNum(subtotal)"></span></span>
</div> </div>
<div class="flex justify-between text-sm py-1 text-pink-500" x-show="addDiscount && discountAmount > 0">
<span>Discount (<span x-text="discountRate"></span>%)</span>
<span class="font-semibold">- Rp <span x-text="formatNum(discountAmount)"></span></span>
</div>
<div class="flex justify-between text-sm py-1 text-amber-600"> <div class="flex justify-between text-sm py-1 text-amber-600">
<span>Tax (<span x-text="taxRate"></span>% — paid by client)</span> <span>Tax (<span x-text="taxRate"></span>% — paid by client)</span>
<span class="font-semibold">Rp <span x-text="formatNum(taxAmount)"></span></span> <span class="font-semibold">Rp <span x-text="formatNum(taxAmount)"></span></span>
@@ -204,19 +239,68 @@
function invoiceForm() { function invoiceForm() {
return { return {
showCustomFields: {{ old('use_custom_fields', false) ? 'true' : 'false' }}, showCustomFields: {{ old('use_custom_fields', false) ? 'true' : 'false' }},
items: [{ description: @json($invoiceSettings->default_service_description ?? ''), quantity: 1, unit_price: 0, is_taxable: true }], addDiscount: false,
discountRate: 5,
items: [{ description: @json($invoiceSettings->default_service_description ?? ''), quantity: 1, unit_price: 0, is_taxable: true, is_discountable: false }],
taxRate: {{ $invoiceSettings->default_tax_rate ?? 11 }}, taxRate: {{ $invoiceSettings->default_tax_rate ?? 11 }},
get subtotal() { get subtotal() {
return this.items.reduce((s, i) => s + (i.quantity * i.unit_price), 0); return this.items.reduce((s, i) => s + (i.quantity * i.unit_price), 0);
}, },
get discountAmount() {
if (!this.addDiscount) return 0;
const discountable = this.items
.filter(i => i.is_discountable)
.reduce((s, i) => s + (i.quantity * i.unit_price), 0);
return Math.round(discountable * (this.discountRate / 100));
},
get totalSubtotal() {
return this.subtotal - this.discountAmount;
},
get taxAmount() { get taxAmount() {
const taxable = this.items const taxable = this.items
.filter(i => i.is_taxable) .filter(i => i.is_taxable)
.reduce((s, i) => s + (i.quantity * i.unit_price), 0); .reduce((s, i) => {
let itemTotal = i.quantity * i.unit_price;
if (this.addDiscount && i.is_discountable) {
itemTotal -= itemTotal * (this.discountRate / 100);
}
return s + itemTotal;
}, 0);
return Math.round(taxable * this.taxRate / 100); return Math.round(taxable * this.taxRate / 100);
}, },
get total() { return this.subtotal; }, // grand total = pre-tax (tax borne by client) get total() { return this.totalSubtotal; }, // grand total = pre-tax
addItem() { this.items.push({ description: '', quantity: 1, unit_price: 0, is_taxable: true }); }, getDiscountLabel() {
const labels = {
5: 'Small thank-you discount 🙏',
10: 'Appreciation bonus ✨',
15: 'Loyalty perk unlocked 🤝',
20: 'Client appreciation deal 💼',
25: 'Special partner discount ⭐',
30: 'Valued client offer 🎯',
35: 'Priority client savings 📌',
40: 'Strong appreciation rate 💎',
45: 'Preferred client pricing 🏅',
50: 'Half-off partner special 🎉',
55: 'Premium loyalty reward 🧩',
60: 'Major appreciation offer 🚀',
65: 'VIP-level savings 🏆',
70: 'Elite client advantage 👑',
75: 'Strategic partner bonus 🤝✨',
80: 'Executive-tier discount 💼🔥',
85: 'Signature client reward 🖋️',
90: 'Ultimate partnership rate 🌟'
};
return labels[this.discountRate] || '';
},
toggleDiscount() {
if (this.addDiscount) {
this.items.forEach(i => i.is_discountable = true);
} else {
// We can leave them checked or uncheck them, usually uncheck
this.items.forEach(i => i.is_discountable = false);
}
},
addItem() { this.items.push({ description: '', quantity: 1, unit_price: 0, is_taxable: true, is_discountable: this.addDiscount }); },
removeItem(i) { if (this.items.length > 1) this.items.splice(i, 1); }, removeItem(i) { if (this.items.length > 1) this.items.splice(i, 1); },
recalc() { }, recalc() { },
formatNum(n) { return Number(n).toLocaleString('id-ID'); }, formatNum(n) { return Number(n).toLocaleString('id-ID'); },

View File

@@ -75,9 +75,16 @@
</div> </div>
<div class="flex-1"> <div class="flex-1">
<label class="text-xs text-gray-400 block mb-0.5">Unit Price</label> <label class="text-xs text-gray-400 block mb-0.5">Unit Price</label>
<input type="number" :name="`items[${index}][unit_price]`" <input type="hidden" :name="`items[${index}][unit_price]`" :value="item.unit_price">
x-model.number="item.unit_price" @input="recalc()" <input type="text"
class="input-soft text-sm bg-white" min="0" step="1000"> :value="item.unit_price ? formatNum(item.unit_price) : ''"
@input="
let raw = $event.target.value.replace(/\D/g, '');
item.unit_price = raw ? parseInt(raw, 10) : 0;
$event.target.value = item.unit_price ? formatNum(item.unit_price) : '';
recalc();
"
class="input-soft text-sm bg-white" placeholder="0">
</div> </div>
<div class="w-24 shrink-0 text-right"> <div class="w-24 shrink-0 text-right">
<label class="text-xs text-gray-400 block mb-0.5">Total</label> <label class="text-xs text-gray-400 block mb-0.5">Total</label>
@@ -88,8 +95,9 @@
<button type="button" @click="removeItem(index)" <button type="button" @click="removeItem(index)"
class="text-red-400 hover:text-red-600 text-lg shrink-0 pt-4">✕</button> class="text-red-400 hover:text-red-600 text-lg shrink-0 pt-4">✕</button>
</div> </div>
{{-- Taxable checkbox --}} {{-- Taxable and Discount checkboxes --}}
<div class="mt-2 flex items-center gap-2"> <div class="mt-2 flex items-center gap-4">
<div class="flex items-center gap-2">
<input type="hidden" :name="`items[${index}][is_taxable]`" value="0"> <input type="hidden" :name="`items[${index}][is_taxable]`" value="0">
<input type="checkbox" :name="`items[${index}][is_taxable]`" <input type="checkbox" :name="`items[${index}][is_taxable]`"
:id="`taxable_${index}`" :id="`taxable_${index}`"
@@ -100,6 +108,18 @@
Taxable Taxable
</label> </label>
</div> </div>
<div class="flex items-center gap-2" x-show="addDiscount">
<input type="hidden" :name="`items[${index}][is_discountable]`" value="0">
<input type="checkbox" :name="`items[${index}][is_discountable]`"
:id="`discountable_${index}`"
x-model="item.is_discountable" @change="recalc()"
value="1"
class="w-3.5 h-3.5 accent-pink-400">
<label :for="`discountable_${index}`" class="text-xs text-gray-500 cursor-pointer select-none">
Discount
</label>
</div>
</div>
</div> </div>
</template> </template>
</div> </div>
@@ -107,10 +127,26 @@
{{-- Totals --}} {{-- Totals --}}
<div class="bg-pink-50 rounded-2xl p-4 mb-5"> <div class="bg-pink-50 rounded-2xl p-4 mb-5">
<div class="mb-3 border-b border-pink-100 pb-3 flex flex-col sm:flex-row sm:items-center gap-y-2 gap-x-4 min-h-[32px]">
<label class="flex items-center gap-2 cursor-pointer shrink-0 w-max">
<input type="checkbox" x-model="addDiscount" @change="toggleDiscount()" class="w-4 h-4 accent-pink-400">
<span class="text-sm font-bold text-gray-700">Add Discount</span>
</label>
<div x-show="addDiscount" class="flex items-center gap-3 flex-1 overflow-hidden" style="display: none;">
<input type="range" name="discount_rate" min="5" max="90" step="5" x-model.number="discountRate" @input="recalc()" class="w-32 sm:w-48 accent-pink-500 h-2 bg-pink-100 rounded-lg appearance-none cursor-pointer shrink-0 hover:accent-pink-600 transition-all">
<span class="font-bold text-pink-600 text-sm shrink-0 w-8 text-right"><span x-text="discountRate"></span>%</span>
<span class="text-xs text-pink-500 font-medium tracking-wide truncate border-l border-pink-200 pl-3" x-text="getDiscountLabel()"></span>
</div>
</div>
<div class="flex justify-between text-sm py-1"> <div class="flex justify-between text-sm py-1">
<span class="text-gray-500">Subtotal (all items)</span> <span class="text-gray-500">Subtotal (all items)</span>
<span class="font-semibold">Rp <span x-text="formatNum(subtotal)"></span></span> <span class="font-semibold">Rp <span x-text="formatNum(subtotal)"></span></span>
</div> </div>
<div class="flex justify-between text-sm py-1 text-pink-500" x-show="addDiscount && discountAmount > 0">
<span>Discount (<span x-text="discountRate"></span>%)</span>
<span class="font-semibold">- Rp <span x-text="formatNum(discountAmount)"></span></span>
</div>
<div class="flex justify-between text-sm py-1 text-amber-600"> <div class="flex justify-between text-sm py-1 text-amber-600">
<span>Tax (<span x-text="taxRate"></span>% — paid by client)</span> <span>Tax (<span x-text="taxRate"></span>% — paid by client)</span>
<span class="font-semibold">Rp <span x-text="formatNum(taxAmount)"></span></span> <span class="font-semibold">Rp <span x-text="formatNum(taxAmount)"></span></span>
@@ -216,24 +252,72 @@
function invoiceEditForm() { function invoiceEditForm() {
@php @php
$itemsJson = $invoice->items->map(function($i) { $itemsJson = $invoice->items->map(function($i) {
return ['description' => $i->description, 'quantity' => $i->quantity, 'unit_price' => (float)$i->unit_price, 'is_taxable' => (bool)$i->is_taxable]; return ['description' => $i->description, 'quantity' => $i->quantity, 'unit_price' => (float)$i->unit_price, 'is_taxable' => (bool)$i->is_taxable, 'is_discountable' => (bool)$i->is_discountable];
}); });
@endphp @endphp
return { return {
showCustomFields: {{ old('use_custom_fields', ($invoice->bank_name || $invoice->signature_image || $invoice->signer_name || $invoice->signer_title) ? true : false) ? 'true' : 'false' }}, showCustomFields: {{ old('use_custom_fields', ($invoice->bank_name || $invoice->signature_image || $invoice->signer_name || $invoice->signer_title) ? true : false) ? 'true' : 'false' }},
addDiscount: {{ $invoice->discount_rate > 0 ? 'true' : 'false' }},
discountRate: {{ $invoice->discount_rate ?: 5 }},
items: @json($itemsJson), items: @json($itemsJson),
taxRate: {{ $invoice->tax_rate }}, taxRate: {{ $invoice->tax_rate }},
get subtotal() { get subtotal() {
return this.items.reduce((s, i) => s + (i.quantity * i.unit_price), 0); return this.items.reduce((s, i) => s + (i.quantity * i.unit_price), 0);
}, },
get discountAmount() {
if (!this.addDiscount) return 0;
const discountable = this.items
.filter(i => i.is_discountable)
.reduce((s, i) => s + (i.quantity * i.unit_price), 0);
return Math.round(discountable * (this.discountRate / 100));
},
get totalSubtotal() {
return this.subtotal - this.discountAmount;
},
get taxAmount() { get taxAmount() {
const taxable = this.items const taxable = this.items
.filter(i => i.is_taxable) .filter(i => i.is_taxable)
.reduce((s, i) => s + (i.quantity * i.unit_price), 0); .reduce((s, i) => {
let itemTotal = i.quantity * i.unit_price;
if (this.addDiscount && i.is_discountable) {
itemTotal -= itemTotal * (this.discountRate / 100);
}
return s + itemTotal;
}, 0);
return Math.round(taxable * this.taxRate / 100); return Math.round(taxable * this.taxRate / 100);
}, },
get total() { return this.subtotal; }, get total() { return this.totalSubtotal; }, // grand total = pre-tax
addItem() { this.items.push({ description: '', quantity: 1, unit_price: 0, is_taxable: true }); }, getDiscountLabel() {
const labels = {
5: 'Small thank-you discount 🙏',
10: 'Appreciation bonus ✨',
15: 'Loyalty perk unlocked 🤝',
20: 'Client appreciation deal 💼',
25: 'Special partner discount ⭐',
30: 'Valued client offer 🎯',
35: 'Priority client savings 📌',
40: 'Strong appreciation rate 💎',
45: 'Preferred client pricing 🏅',
50: 'Half-off partner special 🎉',
55: 'Premium loyalty reward 🧩',
60: 'Major appreciation offer 🚀',
65: 'VIP-level savings 🏆',
70: 'Elite client advantage 👑',
75: 'Strategic partner bonus 🤝✨',
80: 'Executive-tier discount 💼🔥',
85: 'Signature client reward 🖋️',
90: 'Ultimate partnership rate 🌟'
};
return labels[this.discountRate] || '';
},
toggleDiscount() {
if (this.addDiscount) {
this.items.forEach(i => i.is_discountable = true);
} else {
this.items.forEach(i => i.is_discountable = false);
}
},
addItem() { this.items.push({ description: '', quantity: 1, unit_price: 0, is_taxable: true, is_discountable: this.addDiscount }); },
removeItem(i) { if (this.items.length > 1) this.items.splice(i, 1); }, removeItem(i) { if (this.items.length > 1) this.items.splice(i, 1); },
recalc() {}, recalc() {},
formatNum(n) { return Number(n).toLocaleString('id-ID'); }, formatNum(n) { return Number(n).toLocaleString('id-ID'); },

View File

@@ -89,6 +89,8 @@
class="text-xs text-pink-500 hover:underline">View</a> class="text-xs text-pink-500 hover:underline">View</a>
<a href="{{ route('invoices.pdf', $invoice) }}" <a href="{{ route('invoices.pdf', $invoice) }}"
class="text-xs text-pink-500 hover:underline" target="_blank">PDF</a> class="text-xs text-pink-500 hover:underline" target="_blank">PDF</a>
<a href="{{ route('invoices.pdf-legacy', $invoice) }}"
class="text-xs text-pink-500 hover:underline" target="_blank">PDF (Legacy)</a>
<a href="{{ route('invoices.edit', $invoice) }}" <a href="{{ route('invoices.edit', $invoice) }}"
class="text-xs text-gray-500 hover:underline">Edit</a> class="text-xs text-gray-500 hover:underline">Edit</a>
{{-- Share button disabled --}} {{-- Share button disabled --}}

View File

@@ -0,0 +1,373 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Helvetica', Arial, sans-serif;
color: #000;
font-size: 11px;
padding: 40px;
}
.header-wrap {
margin-bottom: 40px;
}
.title-block {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 30px;
}
.title-line {
flex-grow: 1;
height: 1px;
background: #000;
margin-right: 20px;
}
.title {
font-size: 32px;
letter-spacing: 12px;
font-weight: 300;
}
.info-table {
width: 100%;
margin-bottom: 30px;
}
.info-table td {
vertical-align: top;
}
.label {
font-size: 9px;
color: #666;
text-transform: uppercase;
font-weight: bold;
margin-bottom: 5px;
letter-spacing: 1px;
}
.val-bold {
font-weight: bold;
font-size: 13px;
margin-bottom: 4px;
}
.val {
font-size: 11px;
color: #444;
line-height: 1.4;
}
.details-table {
border-collapse: collapse;
float: right;
}
.details-table td {
padding: 3px 0;
font-size: 11px;
}
.details-table .lbl {
color: #666;
text-align: right;
padding-right: 15px;
font-weight: bold;
width: 80px;
}
.details-table .val-dt {
font-weight: bold;
text-align: left;
}
.items {
width: 100%;
border-collapse: collapse;
margin-bottom: 10px;
}
.items th,
.items td {
padding: 8px 0;
font-size: 11px;
}
.items th {
text-align: left;
text-transform: uppercase;
font-weight: bold;
border-top: 1px solid #000;
border-bottom: 1px solid #000;
font-size: 9px;
letter-spacing: 1px;
color: #333;
}
.items td {
border-bottom: 1px solid #ddd;
}
.items tr:last-child td {
border-bottom: 1px solid #000;
}
.items .td-right {
text-align: right;
}
.items .td-center {
text-align: center;
}
.totals-wrapper {
width: 100%;
margin-bottom: 40px;
}
.totals-wrapper::after {
content: "";
display: table;
clear: both;
}
.totals {
float: right;
border-collapse: collapse;
min-width: 250px;
}
.totals td {
padding: 3px 0;
font-size: 11px;
}
.totals .lbl {
text-align: right;
padding-right: 35px;
letter-spacing: 1px;
font-size: 9px;
font-weight: bold;
}
.totals .val {
text-align: right;
font-weight: bold;
}
.bank-info {
margin-bottom: 60px;
}
.bank-info .label {
margin-bottom: 15px;
}
.bank-info p {
font-size: 11px;
line-height: 1.6;
color: #444;
}
.footer {
width: 100%;
text-align: right;
}
.signature {
display: inline-block;
text-align: center;
width: 200px;
}
.sig-date {
font-size: 11px;
color: #444;
margin-bottom: 15px;
}
.sig-img {
max-height: 60px;
max-width: 180px;
object-fit: contain;
margin-bottom: 15px;
}
.sig-name {
font-size: 11px;
font-weight: bold;
text-transform: uppercase;
margin-bottom: 3px;
}
.sig-title {
font-size: 9px;
color: #666;
text-transform: uppercase;
letter-spacing: 1px;
}
</style>
</head>
<body>
<table style="width:100%; margin-bottom: 30px;" cellpadding="0" cellspacing="0">
<tr>
<td style="width:50%; vertical-align:middle; padding-right:20px;">
<div style="height:1px; background:#000; width:100%;"></div>
</td>
<td style="vertical-align:middle; text-align:right;">
<div class="title">I N V O I C E</div>
</td>
</tr>
</table>
<table class="info-table" cellpadding="0" cellspacing="0">
<tr>
<td style="width:50%; padding-right:20px;">
<div class="label">BILLING TO:</div>
@if($invoice->client)
<div class="val-bold">{{ $invoice->client->company }}</div>
<!-- @if($invoice->client->company)
<div class="val">{{ $invoice->client->company }}</div>@endif -->
@if($invoice->client->full_address)
<div class="val">{!! nl2br(e($invoice->client->full_address)) !!}</div>@endif
@else
<div class="val">—</div>
@endif
</td>
<td style="width:50%; text-align:right;">
<table class="details-table" align="right" cellpadding="0" cellspacing="0">
<tr>
<td class="lbl">Invoice No:</td>
<td class="val-dt">{{ $invoice->invoice_number }}</td>
</tr>
<tr>
<td class="lbl">Date:</td>
<td class="val-dt">{{ $invoice->issue_date->format('d.m.Y') }}</td>
</tr>
<tr>
<td class="lbl">Due Date:</td>
<td class="val-dt">{{ $invoice->due_date->format('d.m.Y') }}</td>
</tr>
</table>
</td>
</tr>
</table>
<div style="margin-bottom: 30px;">
<div class="label">FROM:</div>
<div class="val-bold">
{{ $invoiceSettings->header_name ?: 'Cathy' }}
@if($invoiceSettings->header_title)
<span style="font-weight: normal; color: #444;"> ( {{ $invoiceSettings->header_title }} )</span>
@endif
</div>
</div>
<table class="items" cellpadding="0" cellspacing="0">
<thead>
<tr>
<th style="width:45%;">DESCRIPTION</th>
<th class="td-right" style="width:25%;">PRICE</th>
<th class="td-center" style="width:10%;">QTY</th>
<th class="td-right" style="width:20%;">TOTAL</th>
</tr>
</thead>
<tbody>
@foreach($invoice->items as $item)
<tr>
<td>
{{ $item->description }}
@if(!$item->is_taxable)
<span
style="margin-left:6px; font-size:8px; border:1px solid #999; color:#666; padding:1px 4px; border-radius:3px; text-transform:uppercase; letter-spacing:0.5px;">Non-Taxable</span>
@endif
@if($invoice->discount_rate > 0 && !$item->is_discountable)
<span
style="margin-left:6px; font-size:8px; border:1px solid #999; color:#666; padding:1px 4px; border-radius:3px; text-transform:uppercase; letter-spacing:0.5px;">No
Discount</span>
@endif
</td>
<td class="td-right">Rp {{ number_format($item->unit_price, 0, ',', '.') }}</td>
<td class="td-center">{{ $item->quantity }}</td>
<td class="td-right">Rp {{ number_format($item->total, 0, ',', '.') }}</td>
</tr>
@endforeach
</tbody>
</table>
<div class="totals-wrapper">
<table class="totals" cellpadding="0" cellspacing="0">
<tr>
<td class="lbl" style="font-weight: normal;">SUBTOTAL</td>
<td class="val" style="font-weight: normal;">Rp
{{ number_format($invoice->subtotal + $invoice->discount_amount, 0, ',', '.') }}
</td>
</tr>
@if($invoice->discount_amount > 0)
<tr>
<td class="lbl" style="font-weight: normal; color:#666;">DISCOUNT ({{ $invoice->discount_rate }}%)</td>
<td class="val" style="font-weight: normal; color:#666;">- Rp
{{ number_format($invoice->discount_amount, 0, ',', '.') }}
</td>
</tr>
@endif
@if($invoice->tax_rate > 0)
<tr>
<td class="lbl" style="font-weight: normal; color:#666;">TAX ({{ $invoice->tax_rate }}%)</td>
<td class="val" style="font-weight: normal; color:#666;">Rp
{{ number_format($invoice->tax_amount, 0, ',', '.') }}
</td>
</tr>
@endif
<tr>
<td class="lbl" style="padding-top:10px;">GRAND TOTAL</td>
<td class="val" style="padding-top:10px;">{{ $invoice->formatted_total }}</td>
</tr>
</table>
</div>
@if($invoice->bank_name)
<div class="bank-info">
<div class="label"><b>PAYMENT ABOVE SHOULD BE MADE TO:</b></div>
<p>
{{ $invoice->bank_name }}<br>
A/N {{ $invoice->bank_holder }}<br>
{{ $invoice->bank_account }}
@if($invoice->branch_name)<br>KCP: {{ $invoice->branch_name }}@endif
</p>
</div>
@endif
<div class="footer">
@if($invoice->signature_image && file_exists(storage_path('app/public/' . $invoice->signature_image)))
<div class="signature">
<div class="sig-date">Jakarta, {{ $invoice->issue_date->format('d F Y') }}</div>
<img src="{{ storage_path('app/public/' . $invoice->signature_image) }}" class="sig-img">
<div class="sig-name">
{{ $invoice->signer_name ?: ($invoiceSettings->signer_name ?: ($invoiceSettings->header_name ?: 'Signature')) }}
</div>
<div class="sig-title">
{{ $invoice->signer_title ?: ($invoiceSettings->signer_title ?: $invoiceSettings->header_title) }}
</div>
</div>
@endif
</div>
</body>
</html>

View File

@@ -271,7 +271,7 @@
@if($invoice->client->email) @if($invoice->client->email)
<div class="billing-detail">{{ $invoice->client->email }}</div> @endif <div class="billing-detail">{{ $invoice->client->email }}</div> @endif
@if($invoice->client->full_address) @if($invoice->client->full_address)
<div class="billing-detail">{{ $invoice->client->full_address }}</div> @endif <div class="billing-detail">{!! nl2br(e($invoice->client->full_address)) !!}</div> @endif
@else @else
<div class="billing-detail">—</div> <div class="billing-detail">—</div>
@endif @endif
@@ -303,8 +303,8 @@
<thead> <thead>
<tr> <tr>
<td style="width:50%;">Description</td> <td style="width:50%;">Description</td>
<td class="td-center" style="width:10%;">Qty</td>
<td class="td-right" style="width:20%;">Unit Price</td> <td class="td-right" style="width:20%;">Unit Price</td>
<td class="td-center" style="width:10%;">Qty</td>
<td class="td-right" style="width:20%;">Total</td> <td class="td-right" style="width:20%;">Total</td>
</tr> </tr>
</thead> </thead>
@@ -317,9 +317,13 @@
<span <span
style="margin-left:6px; font-size:10px; background:#F3F4F6; color:#6B7280; padding:2px 8px; border-radius:10px; font-weight:600;">Non-Taxable</span> style="margin-left:6px; font-size:10px; background:#F3F4F6; color:#6B7280; padding:2px 8px; border-radius:10px; font-weight:600;">Non-Taxable</span>
@endif @endif
@if($invoice->discount_rate > 0 && !$item->is_discountable)
<span
style="margin-left:6px; font-size:10px; background:#FDF2F8; color:#EC4899; padding:2px 8px; border-radius:10px; font-weight:600;">No Discount</span>
@endif
</td> </td>
<td class="td-center">{{ $item->quantity }}</td>
<td class="td-right">Rp {{ number_format($item->unit_price, 0, ',', '.') }}</td> <td class="td-right">Rp {{ number_format($item->unit_price, 0, ',', '.') }}</td>
<td class="td-center">{{ $item->quantity }}</td>
<td class="td-right" style="font-weight:600;">Rp {{ number_format($item->total, 0, ',', '.') }}</td> <td class="td-right" style="font-weight:600;">Rp {{ number_format($item->total, 0, ',', '.') }}</td>
</tr> </tr>
@endforeach @endforeach
@@ -332,8 +336,14 @@
<table cellpadding="0" cellspacing="0"> <table cellpadding="0" cellspacing="0">
<tr> <tr>
<td style="color:#6B7280;">Subtotal</td> <td style="color:#6B7280;">Subtotal</td>
<td class="amount">Rp {{ number_format($invoice->subtotal, 0, ',', '.') }}</td> <td class="amount">Rp {{ number_format($invoice->subtotal + $invoice->discount_amount, 0, ',', '.') }}</td>
</tr> </tr>
@if($invoice->discount_amount > 0)
<tr>
<td style="color:#EC4899;">Discount ({{ $invoice->discount_rate }}%)</td>
<td class="amount" style="color:#EC4899;">- Rp {{ number_format($invoice->discount_amount, 0, ',', '.') }}</td>
</tr>
@endif
@if($invoice->tax_rate > 0) @if($invoice->tax_rate > 0)
<tr> <tr>
<td style="color:#D97706;">Tax ({{ $invoice->tax_rate }}% — paid by client)</td> <td style="color:#D97706;">Tax ({{ $invoice->tax_rate }}% — paid by client)</td>
@@ -361,17 +371,18 @@
</div> </div>
@endif @endif
<div style="margin-top: 40px;">
@if($invoice->notes) @if($invoice->notes)
<div class="notes" style="width: 50%; float: left; margin-top: 10px;">{{ $invoice->notes }}</div> <div class="notes" style="margin-bottom: 24px;">{{ $invoice->notes }}</div>
@endif @endif
<div style="margin-top: 40px;">
@if($invoice->signature_image && file_exists(storage_path('app/public/' . $invoice->signature_image))) @if($invoice->signature_image && file_exists(storage_path('app/public/' . $invoice->signature_image)))
<div style="width: 200px; float: right; text-align: center;"> <div style="width: 200px; float: right; text-align: center;">
<div style="font-size: 11px; color: #374151; margin-bottom: 12px;"> <div style="font-size: 11px; color: #374151; margin-bottom: 12px;">
Jakarta, {{ $invoice->issue_date->format('d F Y') }} Jakarta, {{ $invoice->issue_date->format('d F Y') }}
</div> </div>
<img src="{{ storage_path('app/public/' . $invoice->signature_image) }}" style="max-height: 80px; max-width: 180px; object-fit: contain; margin-bottom: 8px;"> <img src="{{ storage_path('app/public/' . $invoice->signature_image) }}"
style="max-height: 80px; max-width: 180px; object-fit: contain; margin-bottom: 8px;">
<div style="font-size: 12px; font-weight: 800; color: #111827; text-transform: uppercase;"> <div style="font-size: 12px; font-weight: 800; color: #111827; text-transform: uppercase;">
{{ $invoice->signer_name ?: ($invoiceSettings->signer_name ?: ($invoiceSettings->header_name ?: 'Signature')) }} {{ $invoice->signer_name ?: ($invoiceSettings->signer_name ?: ($invoiceSettings->header_name ?: 'Signature')) }}
</div> </div>
@@ -386,7 +397,7 @@
<div style="clear: both;"></div> <div style="clear: both;"></div>
</div> </div>
<div class="footer">Thank you for the collaboration!</div> <!-- <div class="footer">Thank you for the collaboration!</div> -->
</body> </body>

View File

@@ -72,14 +72,21 @@
fd.append('header_logo', input.files[0]); fd.append('header_logo', input.files[0]);
fd.append('_token', document.querySelector('meta[name=csrf-token]').content); fd.append('_token', document.querySelector('meta[name=csrf-token]').content);
try { try {
const res = await fetch('{{ route('invoice-settings.upload-logo', [], false) }}', { method: 'POST', body: fd }); const res = await fetch('{{ route('invoice-settings.upload-logo', [], false) }}', {
method: 'POST',
body: fd,
headers: {
'Accept': 'application/json'
}
});
const data = await res.json(); const data = await res.json();
if (res.ok) { if (res.ok) {
this.logoUrl = data.url + '?t=' + Date.now(); this.logoUrl = data.url + '?t=' + Date.now();
} else { } else {
this.errorMsg = data.message ?? 'Upload failed.'; this.errorMsg = data.message ?? 'Upload failed.';
} }
} catch { } catch (err) {
console.error(err);
this.errorMsg = 'Network error. Please try again.'; this.errorMsg = 'Network error. Please try again.';
} }
this.uploading = false; this.uploading = false;
@@ -91,7 +98,11 @@
const fd = new FormData(); const fd = new FormData();
fd.append('_token', document.querySelector('meta[name=csrf-token]').content); fd.append('_token', document.querySelector('meta[name=csrf-token]').content);
fd.append('_method', 'DELETE'); fd.append('_method', 'DELETE');
await fetch('{{ route('invoice-settings.delete-logo', [], false) }}', { method: 'POST', body: fd }); await fetch('{{ route('invoice-settings.delete-logo', [], false) }}', {
method: 'POST',
body: fd,
headers: { 'Accept': 'application/json' }
});
this.logoUrl = ''; this.logoUrl = '';
} }
}"> }">
@@ -234,14 +245,21 @@
fd.append('signature_image', input.files[0]); fd.append('signature_image', input.files[0]);
fd.append('_token', document.querySelector('meta[name=csrf-token]').content); fd.append('_token', document.querySelector('meta[name=csrf-token]').content);
try { try {
const res = await fetch('{{ route('invoice-settings.upload-signature', [], false) }}', { method: 'POST', body: fd }); const res = await fetch('{{ route('invoice-settings.upload-signature', [], false) }}', {
method: 'POST',
body: fd,
headers: {
'Accept': 'application/json'
}
});
const data = await res.json(); const data = await res.json();
if (res.ok) { if (res.ok) {
this.signatureUrl = data.url + '?t=' + Date.now(); this.signatureUrl = data.url + '?t=' + Date.now();
} else { } else {
this.errorMsg = data.message ?? 'Upload failed.'; this.errorMsg = data.message ?? 'Upload failed.';
} }
} catch { } catch (err) {
console.error(err);
this.errorMsg = 'Network error. Please try again.'; this.errorMsg = 'Network error. Please try again.';
} }
this.uploading = false; this.uploading = false;
@@ -253,7 +271,11 @@
const fd = new FormData(); const fd = new FormData();
fd.append('_token', document.querySelector('meta[name=csrf-token]').content); fd.append('_token', document.querySelector('meta[name=csrf-token]').content);
fd.append('_method', 'DELETE'); fd.append('_method', 'DELETE');
await fetch('{{ route('invoice-settings.delete-signature', [], false) }}', { method: 'POST', body: fd }); await fetch('{{ route('invoice-settings.delete-signature', [], false) }}', {
method: 'POST',
body: fd,
headers: { 'Accept': 'application/json' }
});
this.signatureUrl = ''; this.signatureUrl = '';
} }
}"> }">

View File

@@ -11,6 +11,9 @@
<a href="{{ route('invoices.pdf', $invoice) }}" target="_blank" <a href="{{ route('invoices.pdf', $invoice) }}" target="_blank"
class="btn-sakura text-sm px-4 py-2.5 rounded-full border border-pink-200 text-pink-500 hover:bg-pink-50">📥 class="btn-sakura text-sm px-4 py-2.5 rounded-full border border-pink-200 text-pink-500 hover:bg-pink-50">📥
Download PDF</a> Download PDF</a>
<a href="{{ route('invoices.pdf-legacy', $invoice) }}" target="_blank"
class="btn-sakura text-sm px-4 py-2.5 rounded-full border border-gray-200 text-gray-500 hover:bg-gray-50">📥
PDF (Legacy)</a>
<form action="{{ route('invoices.destroy', $invoice) }}" method="POST" <form action="{{ route('invoices.destroy', $invoice) }}" method="POST"
onsubmit="return confirm('Delete this invoice?')"> onsubmit="return confirm('Delete this invoice?')">
@csrf @method('DELETE') @csrf @method('DELETE')
@@ -53,7 +56,7 @@
@if($invoice->client->email) @if($invoice->client->email)
<div class="text-sm text-gray-500">{{ $invoice->client->email }}</div> @endif <div class="text-sm text-gray-500">{{ $invoice->client->email }}</div> @endif
@if($invoice->client->full_address) @if($invoice->client->full_address)
<div class="text-sm text-gray-400">{{ $invoice->client->full_address }}</div> @endif <div class="text-sm text-gray-400">{!! nl2br(e($invoice->client->full_address)) !!}</div> @endif
@else @else
<div class="text-gray-500 text-sm">No client</div> <div class="text-gray-500 text-sm">No client</div>
@endif @endif
@@ -90,8 +93,8 @@
<thead> <thead>
<tr class="text-xs text-gray-500 uppercase" style="background:{{ $tint }}"> <tr class="text-xs text-gray-500 uppercase" style="background:{{ $tint }}">
<th class="text-left py-3 px-4 rounded-l-2xl">Description</th> <th class="text-left py-3 px-4 rounded-l-2xl">Description</th>
<th class="text-center py-3 px-4">Qty</th>
<th class="text-right py-3 px-4">Unit Price</th> <th class="text-right py-3 px-4">Unit Price</th>
<th class="text-center py-3 px-4">Qty</th>
<th class="text-right py-3 px-4 rounded-r-2xl">Total</th> <th class="text-right py-3 px-4 rounded-r-2xl">Total</th>
</tr> </tr>
</thead> </thead>
@@ -104,10 +107,14 @@
<span <span
class="ml-1.5 text-xs bg-gray-100 text-gray-500 px-2 py-0.5 rounded-full font-medium">Non-Taxable</span> class="ml-1.5 text-xs bg-gray-100 text-gray-500 px-2 py-0.5 rounded-full font-medium">Non-Taxable</span>
@endif @endif
@if($invoice->discount_rate > 0 && !$item->is_discountable)
<span
class="ml-1.5 text-xs bg-pink-50 text-pink-500 px-2 py-0.5 rounded-full font-medium">No Discount</span>
@endif
</td> </td>
<td class="py-3 px-4 text-sm text-center text-gray-600">{{ $item->quantity }}</td>
<td class="py-3 px-4 text-sm text-right text-gray-600">Rp <td class="py-3 px-4 text-sm text-right text-gray-600">Rp
{{ number_format($item->unit_price, 0, ',', '.') }}</td> {{ number_format($item->unit_price, 0, ',', '.') }}</td>
<td class="py-3 px-4 text-sm text-center text-gray-600">{{ $item->quantity }}</td>
<td class="py-3 px-4 text-sm text-right font-semibold text-gray-800">Rp <td class="py-3 px-4 text-sm text-right font-semibold text-gray-800">Rp
{{ number_format($item->total, 0, ',', '.') }}</td> {{ number_format($item->total, 0, ',', '.') }}</td>
</tr> </tr>
@@ -120,8 +127,14 @@
<div class="w-72 space-y-2 text-sm"> <div class="w-72 space-y-2 text-sm">
<div class="flex justify-between text-gray-500"> <div class="flex justify-between text-gray-500">
<span>Subtotal</span><span class="font-medium">Rp <span>Subtotal</span><span class="font-medium">Rp
{{ number_format($invoice->subtotal, 0, ',', '.') }}</span> {{ number_format($invoice->subtotal + $invoice->discount_amount, 0, ',', '.') }}</span>
</div> </div>
@if($invoice->discount_amount > 0)
<div class="flex justify-between text-pink-500">
<span>Discount ({{ $invoice->discount_rate }}%)</span>
<span class="font-medium">- Rp {{ number_format($invoice->discount_amount, 0, ',', '.') }}</span>
</div>
@endif
@if($invoice->tax_rate > 0) @if($invoice->tax_rate > 0)
<div class="flex justify-between text-amber-600"> <div class="flex justify-between text-amber-600">
<span>Tax ({{ $invoice->tax_rate }}% — paid by client)</span> <span>Tax ({{ $invoice->tax_rate }}% — paid by client)</span>
@@ -137,7 +150,7 @@
{{-- Bank Info --}} {{-- Bank Info --}}
@if($invoice->bank_name) @if($invoice->bank_name)
<div class="rounded-2xl p-4 text-sm" style="background:{{ $tint }}"> <div class="rounded-2xl p-4 text-sm mb-4" style="background:{{ $tint }}">
<div class="font-semibold text-gray-700 mb-2">💳 Payment Info</div> <div class="font-semibold text-gray-700 mb-2">💳 Payment Info</div>
<div class="text-gray-600"> <div class="text-gray-600">
{{ $invoice->bank_name }} {{ $invoice->bank_name }}
@@ -147,12 +160,11 @@
</div> </div>
@endif @endif
<div class="flex flex-col sm:flex-row justify-between items-start mt-10 gap-6">
<div class="flex-1 text-left">
@if($invoice->notes) @if($invoice->notes)
<div class="text-sm text-gray-500 italic">{{ $invoice->notes }}</div> <div class="text-sm text-gray-500 italic mb-8">{{ $invoice->notes }}</div>
@endif @endif
</div>
<div class="flex justify-end mt-10">
@if($invoice->signature_image) @if($invoice->signature_image)
<div class="shrink-0 text-center w-full sm:w-auto"> <div class="shrink-0 text-center w-full sm:w-auto">
<div class="text-sm text-gray-500 mb-3"> <div class="text-sm text-gray-500 mb-3">

View File

@@ -65,11 +65,6 @@
<span class="text-lg shrink-0">👥</span> Clients <span class="text-lg shrink-0">👥</span> Clients
</a> </a>
<a href="{{ route('client-categories.index') }}" @click="sidebarOpen = false"
class="nav-item {{ request()->routeIs('client-categories.*') ? 'active' : '' }}">
<span class="text-lg shrink-0">🏷️</span> Categories
</a>
<a href="{{ route('contracts.index') }}" @click="sidebarOpen = false" <a href="{{ route('contracts.index') }}" @click="sidebarOpen = false"
class="nav-item {{ request()->routeIs('contracts.*') ? 'active' : '' }}"> class="nav-item {{ request()->routeIs('contracts.*') ? 'active' : '' }}">
<span class="text-lg shrink-0">📋</span> Contracts <span class="text-lg shrink-0">📋</span> Contracts
@@ -112,6 +107,11 @@
<div class="text-xs font-bold text-gray-400 uppercase tracking-wider mt-4 mb-1 px-2">Settings</div> <div class="text-xs font-bold text-gray-400 uppercase tracking-wider mt-4 mb-1 px-2">Settings</div>
<a href="{{ route('client-categories.index') }}" @click="sidebarOpen = false"
class="nav-item {{ request()->routeIs('client-categories.*') ? 'active' : '' }}">
<span class="text-lg shrink-0">🏷️</span> Categories
</a>
<a href="{{ route('settings.notifications') }}" @click="sidebarOpen = false" <a href="{{ route('settings.notifications') }}" @click="sidebarOpen = false"
class="nav-item {{ request()->routeIs('settings.*') ? 'active' : '' }}"> class="nav-item {{ request()->routeIs('settings.*') ? 'active' : '' }}">
<span class="text-lg shrink-0">🔔</span> Notifications <span class="text-lg shrink-0">🔔</span> Notifications
@@ -191,9 +191,8 @@
</div> </div>
</template> </template>
<div class="border-t border-pink-50 px-4 py-2"> <div class="border-t border-pink-50 px-4 py-2">
<a :href="'/search?q=' + encodeURIComponent(searchQuery)" <a :href="`/search?q=${encodeURIComponent(searchQuery)}`"
class="text-xs text-pink-500 hover:text-pink-700 font-medium flex items-center gap-1" class="text-xs text-pink-500 hover:text-pink-700 font-medium flex items-center gap-1">
@click="closeSearch()">
🔍 See all results for "<span x-text="searchQuery"></span>" 🔍 See all results for "<span x-text="searchQuery"></span>"
</a> </a>
</div> </div>

View File

@@ -9,20 +9,13 @@
<div x-data="notesApp({{ json_encode($notes) }})" x-cloak> <div x-data="notesApp({{ json_encode($notes) }})" x-cloak>
{{-- ── Toolbar ──────────────────────────────────────────────── --}} {{-- ── Toolbar ──────────────────────────────────────────────── --}}
<div class="flex items-center gap-2 mb-4"> <div class="flex items-center justify-between mb-4">
<button @click="openNew()" class="btn-sakura text-sm px-4 py-2 flex items-center gap-1.5 shrink-0"> <button @click="openNew()" class="btn-sakura text-sm px-4 py-2 flex items-center gap-1.5 shrink-0">
+ New Note + New Note
</button> </button>
{{-- Search --}}
<div class="relative flex-1 max-w-xs">
<span class="absolute left-3 top-1/2 -translate-y-1/2 text-gray-400 text-sm pointer-events-none"></span>
<input type="text" x-model="searchQuery" placeholder="🔍Search notes…"
class="input-soft pl-9 text-sm py-2 w-full">
</div>
{{-- Count --}} {{-- Count --}}
<span class="ml-auto text-xs text-gray-400 shrink-0" <span class="text-xs text-gray-400 shrink-0"
x-text="notes.length + ' note' + (notes.length !== 1 ? 's' : '')"></span> x-text="notes.length + ' note' + (notes.length !== 1 ? 's' : '')"></span>
</div> </div>
@@ -121,7 +114,7 @@
</div> </div>
</template> </template>
{{-- ── Empty state ──────────────────────────────────────────── --}} {{-- Empty state is only when NO notes exist --}}
<template x-if="notes.length === 0"> <template x-if="notes.length === 0">
<div class="text-center py-20 text-gray-400"> <div class="text-center py-20 text-gray-400">
<span class="text-5xl block mb-3">📝</span> <span class="text-5xl block mb-3">📝</span>
@@ -130,13 +123,6 @@
</div> </div>
</template> </template>
<template x-if="notes.length > 0 && filteredPinned.length === 0 && filteredUnpinned.length === 0">
<div class="text-center py-12 text-gray-400">
<span class="text-3xl block mb-2">🔍</span>
<p class="text-sm">No notes match "<span x-text="searchQuery"></span>"</p>
</div>
</template>
{{-- ════════════════════════════════════════════════════════════ {{-- ════════════════════════════════════════════════════════════
Note Editor Modal Note Editor Modal
@@ -285,20 +271,11 @@
// ── Computed / Filtered ─────────────────────────────── // ── Computed / Filtered ───────────────────────────────
get filteredPinned() { get filteredPinned() {
return this.filterNotes(this.notes.filter(n => n.is_pinned)); return this.notes.filter(n => n.is_pinned);
}, },
get filteredUnpinned() { get filteredUnpinned() {
return this.filterNotes(this.notes.filter(n => !n.is_pinned)); return this.notes.filter(n => !n.is_pinned);
},
filterNotes(list) {
const q = this.searchQuery.trim().toLowerCase();
if (!q) return list;
return list.filter(n =>
(n.title || '').toLowerCase().includes(q) ||
(n.content || []).some(b => (b.text || '').toLowerCase().includes(q))
);
}, },
// ── Modal open/close ───────────────────────────────── // ── Modal open/close ─────────────────────────────────

View File

@@ -6,18 +6,18 @@
@section('content') @section('content')
<div class="flex flex-wrap items-center justify-between gap-3 mb-5"> <div class="flex flex-wrap items-center justify-between gap-3 mb-5">
<div class="flex flex-wrap items-center gap-2"> <div class="flex flex-wrap items-center gap-2 w-full">
<a href="{{ route('rate-cards.create') }}" class="btn-sakura text-sm shrink-0">+ Add Service</a> <a href="{{ route('rate-cards.create') }}" class="btn-sakura text-xs sm:text-sm shrink-0 px-3 py-1.5 sm:px-4 sm:py-2 flex items-center gap-1">+ Add Service</a>
<a href="{{ route('rate-cards.public') }}" target="_blank" <a href="{{ route('rate-cards.public') }}" target="_blank"
class="btn-sakura text-sm px-3 py-2 rounded-full border border-pink-200 text-pink-500 hover:bg-pink-50 flex items-center gap-1"> class="bg-white text-xs sm:text-sm px-3 py-1.5 sm:px-4 sm:py-2 rounded-full border border-pink-200 text-pink-600 hover:bg-pink-50 flex items-center gap-1 shadow-sm shrink-0">
🔗 Public Page 🔗 Public Page
</a> </a>
<a href="{{ route('rate-cards.pdf') }}" <a href="{{ route('rate-cards.pdf') }}"
class="btn-sakura text-sm px-3 py-2 rounded-full border border-blue-200 text-blue-500 hover:bg-blue-50 flex items-center gap-1"> class="bg-white text-xs sm:text-sm px-3 py-1.5 sm:px-4 sm:py-2 rounded-full border border-blue-200 text-blue-600 hover:bg-blue-50 flex items-center gap-1 shadow-sm shrink-0">
📄 PDF 📄 PDF
</a> </a>
<a href="{{ route('rate-cards.profile') }}" <a href="{{ route('rate-cards.profile') }}"
class="btn-sakura text-sm px-3 py-2 rounded-full border border-purple-200 text-purple-500 hover:bg-purple-50 flex items-center gap-1"> class="bg-white text-xs sm:text-sm px-3 py-1.5 sm:px-4 sm:py-2 rounded-full border border-purple-200 text-purple-600 hover:bg-purple-50 flex items-center gap-1 shadow-sm shrink-0">
🎨 Profile 🎨 Profile
</a> </a>
</div> </div>

View File

@@ -12,83 +12,225 @@
@endphp @endphp
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>Rate Card — {{ $profile->owner_name }}</title> <title>Rate Card — {{ $profile->owner_name }}</title>
<style> <style>
* { box-sizing: border-box; margin: 0; padding: 0; } * {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body { body {
font-family: 'DejaVu Sans', sans-serif; font-family: 'DejaVu Sans', sans-serif;
background: {{ $bg }}; background:
color: {{ $text }}; {{ $bg }}
;
color:
{{ $text }}
;
padding: 36px 32px; padding: 36px 32px;
font-size: 12px; font-size: 12px;
} }
.footer {
margin-top: 40px;
text-align: center;
font-size: 11px;
color: #D1D5DB;
}
/* Quill WYSIWYG Compatibility */
.ql-align-center {
text-align: center !important;
}
.ql-align-right {
text-align: right !important;
}
.ql-align-justify {
text-align: justify !important;
}
.ql-size-small {
font-size: 0.75em !important;
}
.ql-size-large {
font-size: 1.5em !important;
}
.ql-size-huge {
font-size: 2.5em !important;
}
.contact-person-page,
.terms-and-conditions-page {
width: 100%;
}
.header { .header {
text-align: center; text-align: center;
margin-bottom: 32px; margin-bottom: 32px;
padding-bottom: 20px; padding-bottom: 20px;
border-bottom: 2px solid {{ $accentHex }}; 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 }}; } .logo-img {
.tagline { color: #9CA3AF; margin-top: 4px; font-size: 11px; } max-height: 72px;
.contacts { margin-top: 10px; font-size: 10px; color: #6B7280; } max-width: 140px;
.contacts span { margin: 0 6px; } margin: 0 auto 10px;
.platform-section { margin-bottom: 22px; } 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 { .platform-title {
font-size: 13px; font-weight: 700; font-size: 13px;
color: {{ $text }}; font-weight: 700;
color:
{{ $text }}
;
margin-bottom: 8px; margin-bottom: 8px;
padding: 5px 10px; padding: 5px 10px;
background-color: rgba({{ $accentRgb }}, 0.1); background-color: rgba({{ $accentRgb }}, 0.1);
border-left: 4px solid {{ $accentHex }}; border-left: 4px solid
{{ $accentHex }}
;
} }
table { width: 100%; border-collapse: collapse; }
table {
width: 100%;
border-collapse: collapse;
}
th { th {
text-align: left; padding: 7px 10px; text-align: left;
padding: 7px 10px;
background-color: rgba({{ $accentRgb }}, 0.08); background-color: rgba({{ $accentRgb }}, 0.08);
color: #6B7280; font-size: 9px; color: #6B7280;
text-transform: uppercase; letter-spacing: 0.05em; font-size: 9px;
text-transform: uppercase;
letter-spacing: 0.05em;
border-bottom: 1px solid rgba({{ $accentRgb }}, 0.25); 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; } td {
.service-name { font-weight: 600; color: {{ $text }}; } padding: 8px 10px;
.content-type { border-bottom: 1px solid #F3F4F6;
display: inline-block; font-size: 9px; vertical-align: top;
background-color: rgba({{ $accentRgb }}, 0.1); }
color: {{ $accentHex }};
padding: 1px 7px; border-radius: 10px; margin-top: 2px; 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;
} }
.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> </style>
</head> </head>
<body> <body>
<div class="header"> <div class="header">
@if($profile->logo_path && file_exists(storage_path('app/private/' . $profile->logo_path))) @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 }}"> <img src="{{ storage_path('app/private/' . $profile->logo_path) }}" class="logo-img"
alt="{{ $profile->owner_name }}">
@endif @endif
<div class="name">{{ $profile->owner_name }}</div> <div class="name">{{ $profile->owner_name }}</div>
@if($profile->tagline) @if($profile->tagline)
<div class="tagline">{{ $profile->tagline }}</div> <div class="tagline">{{ $profile->tagline }}</div>
@endif @endif
<div class="contacts"> <div class="contacts">
@if($profile->email)<span>✉ {{ $profile->email }}</span>@endif @if($profile->ig_handle)<span>· {{ '@' . ltrim($profile->ig_handle, '@') }}</span>@endif
@if($profile->whatsapp)<span>· {{ $profile->whatsapp }}</span>@endif @if($profile->tiktok_handle)<span>· {{ '@' . ltrim($profile->tiktok_handle, '@') }}</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 @if($profile->youtube_handle)<span>· {{ $profile->youtube_handle }}</span>@endif
</div> </div>
</div> </div>
@foreach($rateCards as $platform => $cards) @foreach($rateCards as $platform => $cards)
<div class="platform-section"> <div class="platform-section">
<div class="platform-title"> <div class="platform-title">
@php $icons = ['instagram' => 'Instagram', 'tiktok' => 'TikTok', 'youtube' => 'YouTube', 'general' => 'General']; @endphp @php $icons = ['instagram' => 'Instagram', 'tiktok' => 'TikTok', 'youtube' => 'YouTube', 'general' => 'General']; @endphp
{{ $icons[$platform] ?? ucfirst($platform) }} {{ $icons[$platform] ?? ucfirst($platform) }}
@@ -130,13 +272,132 @@
@endforeach @endforeach
</tbody> </tbody>
</table> </table>
</div> </div>
@endforeach </div>
@endforeach
<div class="footer"> @if(!empty($profile->past_brands))
@php
$logoSizesPdf = [
'small' => 'max-height:30px; max-width:60px;',
'medium' => 'max-height:45px; max-width:90px;',
'large' => 'max-height:65px; max-width:130px;',
];
$sizeStylePdf = $logoSizesPdf[$profile->brand_logo_size ?? 'medium'] ?? $logoSizesPdf['medium'];
@endphp
<div style="page-break-before: always;"></div>
<div class="platform-section" style="margin-top:20px; page-break-inside:avoid;">
<div class="platform-title" style="text-align:center;">Brand Collaborations</div>
<div style="text-align:center; padding-top:10px;">
@foreach($profile->past_brands as $brandPath)
@if(file_exists(storage_path('app/public/' . $brandPath)))
<img src="{{ storage_path('app/public/' . $brandPath) }}"
style="{{ $sizeStylePdf }} object-fit:contain; margin:0 10px; display:inline-block; vertical-align:middle;">
@endif
@endforeach
</div>
</div>
@endif
@php
$pdfShowcase = array_filter($profile->content_showcase ?? [], function($item) {
return !isset($item['show_on_pdf']) || $item['show_on_pdf'];
});
@endphp
@if(!empty($pdfShowcase))
<div style="page-break-before: always;"></div>
<div class="platform-section" style="margin-top:20px; page-break-inside:avoid;">
<div class="platform-title" style="text-align:center;">Content Showcase</div>
<div style="text-align:center; padding-top:10px;">
@foreach($pdfShowcase as $item)
@php
$isUrl = ($item['file_id'] === 'url');
$file = !$isUrl ? \App\Models\MediaFile::find($item['file_id']) : null;
@endphp
@if($file || $isUrl)
<div style="display:inline-block; width:135px; margin:10px; border:1px solid rgba(0,0,0,0.1); border-radius:8px; overflow:hidden; vertical-align:top; background:#ffffff;">
<div style="height:240px; background:#F9FAFB; border-bottom:1px solid rgba(0,0,0,0.05); position:relative; text-align:center;">
@if(!empty($item['thumbnail_path']) && file_exists(storage_path('app/public/' . $item['thumbnail_path'])))
<a href="{{ $isUrl ? $item['url'] : $file->url }}" target="_blank" style="display:block; text-decoration:none; position:relative;">
<div style="width:100%; height:240px; background-image:url('{{ storage_path('app/public/' . $item['thumbnail_path']) }}'); background-size:cover; background-position:center; background-repeat:no-repeat;"></div>
@if(!$isUrl && $file->is_video)
<div style="position:absolute; inset:0; display:flex; align-items:center; justify-content:center; background:rgba(0,0,0,0.2);">
<div style="width:30px; height:30px; background:rgba(255,255,255,0.8); border-radius:50%; text-align:center; line-height:30px; color:{{ $accentHex }}; font-size:16px;">▶</div>
</div>
@endif
</a>
@elseif(!$isUrl && $file->is_image && file_exists(storage_path('app/private/' . $file->path)))
<a href="{{ $file->url }}" target="_blank" style="display:block; text-decoration:none;">
<div style="width:100%; height:240px; background-image:url('{{ storage_path('app/private/' . $file->path) }}'); background-size:cover; background-position:center; background-repeat:no-repeat;"></div>
</a>
@else
<a href="{{ $isUrl ? $item['url'] : $file->url }}" target="_blank" style="display:block; text-decoration:none; color:{{ $accentHex }}; padding-top:90px; font-weight:bold;">
<span style="font-size:30px; display:block;">{{ $isUrl ? '🌐' : ($file->is_video ? '🎬' : '📁') }}</span>
{{ $isUrl ? 'Open Link' : 'View File' }}
</a>
@endif
</div>
<div style="padding:10px; text-align:center;">
<div style="font-weight:700; font-size:11px;">{{ $item['name'] }}</div>
<div style="font-size:9px; color:#9CA3AF; margin-top:4px;">
{{ $isUrl ? 'External Link' : ($file->is_video ? 'Video' : ($file->is_image ? 'Image' : 'Document')) }}
</div>
</div>
</div>
@endif
@endforeach
</div>
</div>
@endif
@if($profile->terms_and_conditions)
<div style="page-break-before: always;"></div>
<div class="platform-section" style="margin-top:20px; page-break-inside:avoid;">
<div class="platform-title">Terms & Conditions</div>
<div style="font-size:10px; color:#6B7280; line-height:1.5; padding:0 10px;">
{!! $profile->terms_and_conditions !!}</div>
</div>
@endif
<div style="page-break-before: always;"></div>
@if($profile->contact_person_html)
<div class="contact-person-page">
{!! $profile->contact_person_html !!}
</div>
@else
<div style="text-align: center; margin-top: 40px;">
<h1
style="font-family: 'Comic Sans MS', sans-serif; font-size: 32px; font-weight: 900; letter-spacing: 4px; color: #111827; margin-bottom: 30px; text-transform: uppercase;">
CONTACT PERSON</h1>
@if($profile->whatsapp)
<div
style="font-family: 'Comic Sans MS', sans-serif; font-size: 36px; font-weight: 900; color: #14b8a6; margin-bottom: 5px;">
{{ $profile->whatsapp }}</div>
<div
style="font-family: 'Comic Sans MS', sans-serif; font-size: 20px; font-weight: 800; color: #14b8a6; margin-bottom: 30px; letter-spacing: 2px;">
(WHATS APP)</div>
@endif
@if($profile->email)
<div
style="font-family: 'Comic Sans MS', sans-serif; font-size: 14px; font-weight: 800; color: #f97316; margin-bottom: 10px; letter-spacing: 2px;">
EMAIL</div>
<div
style="font-family: 'Comic Sans MS', sans-serif; font-size: 32px; font-weight: 900; color: #ef4444; margin-bottom: 40px; letter-spacing: 2px;">
{{ strtoupper($profile->email) }}</div>
@endif
<div
style="font-size: 11px; font-weight: 900; color: #111827; line-height: 1.5; max-width: 80%; margin: 0 auto; text-transform: uppercase;">
Kami tidak bertanggung jawab atas segala bentuk kerjasama yg timbul dengan pihak selain dari kontak diatas
</div>
</div>
@endif
<div class="footer">
{{ $profile->custom_footer ?: 'Prices may vary. Contact for custom packages.' }} {{ $profile->custom_footer ?: 'Prices may vary. Contact for custom packages.' }}
· Generated {{ now()->format('d M Y') }} · Generated {{ now()->format('d M Y') }}
</div> </div>
</body> </body>
</html> </html>

View File

@@ -4,6 +4,8 @@
@section('page-subtitle', 'Customise your public rate card page') @section('page-subtitle', 'Customise your public rate card page')
@section('content') @section('content')
<link href="https://cdn.quilljs.com/1.3.6/quill.snow.css" rel="stylesheet">
<script src="https://cdn.quilljs.com/1.3.6/quill.min.js"></script>
<div class="max-w-3xl mx-auto space-y-5"> <div class="max-w-3xl mx-auto space-y-5">
@if(session('success')) @if(session('success'))
@@ -81,20 +83,79 @@
<h2 class="font-bold text-gray-700">Appearance</h2> <h2 class="font-bold text-gray-700">Appearance</h2>
</div> </div>
<div class="p-5 grid grid-cols-1 sm:grid-cols-2 gap-4"> <div class="p-5 grid grid-cols-1 sm:grid-cols-2 gap-4">
<div class="sm:col-span-2"> <div class="sm:col-span-2" x-data="{
uploading: false,
errorMsg: '',
logoUrl: '{{ $profile->logo_path ? route('files.serve-profile-logo') : '' }}',
async pickFile(input) {
if (!input.files.length) return;
this.uploading = true;
this.errorMsg = '';
const fd = new FormData();
fd.append('logo', input.files[0]);
fd.append('_token', document.querySelector('meta[name=csrf-token]').content);
try {
const res = await fetch('{{ route('rate-cards.profile.upload-logo', [], false) }}', {
method: 'POST',
body: fd,
headers: {
'Accept': 'application/json'
}
});
const data = await res.json();
if (res.ok) {
this.logoUrl = data.url + '?t=' + Date.now();
} else {
this.errorMsg = data.message ?? 'Upload failed.';
}
} catch (err) {
console.error(err);
this.errorMsg = 'Network error. Please try again.';
}
this.uploading = false;
input.value = '';
},
async removeLogo() {
if (!confirm('Remove this logo?')) return;
const fd = new FormData();
fd.append('_token', document.querySelector('meta[name=csrf-token]').content);
fd.append('_method', 'DELETE');
await fetch('{{ route('rate-cards.profile.delete-logo', [], false) }}', {
method: 'POST',
body: fd,
headers: { 'Accept': 'application/json' }
});
this.logoUrl = '';
}
}">
<label class="block text-xs font-semibold text-gray-600 mb-1">Logo / Profile Image</label> <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"> <template x-if="logoUrl">
<img src="{{ route('files.serve-profile-logo') }}" alt="Logo" <div class="flex items-center gap-3 mb-3">
class="w-16 h-16 object-cover rounded-2xl border border-pink-100"> <img :src="logoUrl" alt="Logo"
<span class="text-xs text-gray-400">Current logo</span> class="w-16 h-16 object-cover rounded-2xl border border-pink-100 shrink-0">
<div class="flex-1 min-w-0">
<p class="text-xs font-semibold text-gray-600">Current Logo</p>
<p class="text-xs text-gray-400 mt-0.5">Choose a new file to replace it</p>
</div> </div>
@endif <button type="button" @click="removeLogo()"
<input type="file" name="logo" accept="image/*" class="w-full text-sm text-gray-600 class="text-xs px-3 py-1.5 rounded-full border border-red-200 text-red-400 hover:bg-red-50 shrink-0">
🗑️ Remove
</button>
</div>
</template>
<div class="relative">
<input type="file" accept="image/*" @change="pickFile($event.target)" class="w-full text-sm text-gray-600
file:mr-3 file:py-2 file:px-4 file:rounded-full file:border-0 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 file:text-xs file:font-semibold file:bg-pink-50 file:text-pink-600
hover:file:bg-pink-100 cursor-pointer"> hover:file:bg-pink-100 cursor-pointer" :disabled="uploading">
<p class="text-xs text-gray-400 mt-1">Max 2MB. PNG/JPG/WebP.</p> <span x-show="uploading" class="text-xs text-pink-500 mt-1 block">Uploading…</span>
<span x-show="errorMsg" x-text="errorMsg" class="text-xs text-red-500 mt-1 block"></span>
</div>
<p class="text-xs text-gray-400 mt-1">Max 2MB. Uploads immediately on file selection.</p>
</div> </div>
<div> <div>
@@ -128,7 +189,82 @@
class="input-soft text-sm flex-1" readonly> class="input-soft text-sm flex-1" readonly>
</div> </div>
</div> </div>
<div> <div class="sm:col-span-2" x-data="{
init() {
var quill = new Quill(this.$refs.editor, {
theme: 'snow',
placeholder: 'e.g. 1. 50% down payment required. 2. Rates valid for 30 days.',
modules: {
toolbar: [
[{ 'size': ['small', false, 'large', 'huge'] }],
['bold', 'italic', 'underline', 'strike'],
[{ 'color': [] }, { 'background': [] }],
[{ 'list': 'ordered'}, { 'list': 'bullet' }],
['clean']
]
}
});
quill.on('text-change', () => {
this.$refs.input.value = quill.root.innerHTML;
});
}
}">
<label class="block text-xs font-semibold text-gray-600 mb-1">Terms & Conditions</label>
<input type="hidden" name="terms_and_conditions" x-ref="input"
value="{{ old('terms_and_conditions', $profile->terms_and_conditions) }}">
<div class="bg-white rounded-lg border border-pink-200">
<div x-ref="editor" style="min-height: 120px;">
{!! old('terms_and_conditions', $profile->terms_and_conditions) !!}
</div>
</div>
</div>
<div class="sm:col-span-2" x-data="{
init() {
var quill = new Quill(this.$refs.editor, {
theme: 'snow',
placeholder: 'Customize your Contact Person Page formatting...',
modules: {
toolbar: [
[{ 'size': ['small', false, 'large', 'huge'] }],
['bold', 'italic', 'underline', 'strike'],
[{ 'color': [] }, { 'background': [] }],
[{ 'align': [] }],
['clean']
]
}
});
quill.on('text-change', () => {
this.$refs.input.value = quill.root.innerHTML;
});
}
}">
<label class="block text-xs font-semibold text-gray-600 mb-1">Contact Person Page (PDF)</label>
@php
$defaultContactHtml = '<div style="text-align: center; margin-top: 40px;">
<h1 style="font-family: \'Comic Sans MS\', sans-serif; font-size: 32px; font-weight: 900; letter-spacing: 4px; color: #111827; margin-bottom: 30px; text-transform: uppercase;">CONTACT PERSON</h1>';
if ($profile->whatsapp) {
$defaultContactHtml .= '<div style="font-family: \'Comic Sans MS\', sans-serif; font-size: 36px; font-weight: 900; color: #14b8a6; margin-bottom: 5px;">' . $profile->whatsapp . '</div>
<div style="font-family: \'Comic Sans MS\', sans-serif; font-size: 20px; font-weight: 800; color: #14b8a6; margin-bottom: 30px; letter-spacing: 2px;">(WHATS APP)</div>';
}
if ($profile->email) {
$defaultContactHtml .= '<div style="font-family: \'Comic Sans MS\', sans-serif; font-size: 14px; font-weight: 800; color: #f97316; margin-bottom: 10px; letter-spacing: 2px;">EMAIL</div>
<div style="font-family: \'Comic Sans MS\', sans-serif; font-size: 32px; font-weight: 900; color: #ef4444; margin-bottom: 40px; letter-spacing: 2px;">' . strtoupper($profile->email) . '</div>';
}
$defaultContactHtml .= '<div style="font-size: 11px; font-weight: 900; color: #111827; line-height: 1.5; max-width: 80%; margin: 0 auto; text-transform: uppercase;">
Kami tidak bertanggung jawab atas segala bentuk kerjasama yg timbul dengan pihak selain dari kontak diatas
</div>
</div>';
@endphp
<input type="hidden" name="contact_person_html" x-ref="input"
value="{{ old('contact_person_html', $profile->contact_person_html) }}">
<div class="bg-white rounded-lg border border-pink-200">
<div x-ref="editor" style="min-height: 120px;">
{!! old('contact_person_html', $profile->contact_person_html ?: $defaultContactHtml) !!}
</div>
</div>
</div>
<div class="sm:col-span-2">
<label class="block text-xs font-semibold text-gray-600 mb-1">Custom Footer</label> <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) }}" <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"> class="input-soft" placeholder="e.g. Prices valid until Dec 2025 · DM for bundles">
@@ -146,19 +282,229 @@
</div> </div>
</div> </div>
{{-- Past Brands --}}
<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">Brand Collaborations Logo</h2>
</div>
<div class="p-5" x-data="{
uploading: false,
brands: {{ Illuminate\Support\Js::from($profile->past_brands ?? []) }},
async pickBrand(input) {
if (!input.files.length) return;
this.uploading = true;
const fd = new FormData();
for (let i = 0; i < input.files.length; i++) {
fd.set('logo', input.files[i]);
fd.set('_token', document.querySelector('meta[name=csrf-token]').content);
try {
const res = await fetch('{{ route('rate-cards.profile.upload-brand-logo', [], false) }}', { method: 'POST', body: fd, headers: { 'Accept': 'application/json' } });
const data = await res.json();
if (res.ok) this.brands.push(data.path);
} catch (e) { console.error(e); }
}
this.uploading = false;
input.value = '';
},
async removeBrand(path, index) {
if(!confirm('Remove this brand?')) return;
const fd = new FormData();
fd.append('_token', document.querySelector('meta[name=csrf-token]').content);
fd.append('_method', 'DELETE');
fd.append('path', path);
await fetch('{{ route('rate-cards.profile.delete-brand-logo', [], false) }}', { method: 'POST', body: fd, headers: {'Accept': 'application/json'} });
this.brands.splice(index, 1);
}
}">
<div class="flex items-center justify-between mb-2">
<label class="block text-xs font-semibold text-gray-600">Brand Logos</label>
<div class="flex items-center gap-2">
<span class="text-[10px] text-gray-500 uppercase tracking-widest font-semibold">Display Size on
PDF:</span>
<select name="brand_logo_size"
class="text-xs border-pink-200 rounded-md py-1 pr-8 pl-2 focus:ring-pink-500 focus:border-pink-500 bg-white">
<option value="small" {{ old('brand_logo_size', $profile->brand_logo_size ?? 'medium') == 'small' ? 'selected' : '' }}>Small</option>
<option value="medium" {{ old('brand_logo_size', $profile->brand_logo_size ?? 'medium') == 'medium' ? 'selected' : '' }}>Medium</option>
<option value="large" {{ old('brand_logo_size', $profile->brand_logo_size ?? 'medium') == 'large' ? 'selected' : '' }}>Large</option>
</select>
</div>
</div>
<div class="flex flex-wrap gap-4 mb-3">
<template x-for="(path, index) in brands" :key="index">
<div class="relative rounded-2xl border border-pink-100 p-2 flex items-center justify-center bg-white group shrink-0"
style="width: 100px; height: 100px;">
<img :src="'/storage/' + path" class="max-w-full max-h-full object-contain">
<button type="button" @click="removeBrand(path, index)"
class="absolute -bottom-2 -right-2 bg-red-100 text-red-500 rounded-full w-6 h-6 flex items-center justify-center hover:bg-red-200 shadow text-[10px] z-10 transition-colors">🗑️</button>
</div>
</template>
<label
class="rounded-2xl border-2 border-dashed border-pink-200 flex items-center justify-center text-pink-300 hover:bg-pink-50 hover:text-pink-400 cursor-pointer transition-colors shrink-0"
style="width: 100px; height: 100px;" :class="{'opacity-50 pointer-events-none': uploading}">
<span x-show="!uploading" class="text-2xl">+</span>
<span x-show="uploading" class="text-xs">...</span>
<input type="file" multiple accept="image/*" class="hidden" @change="pickBrand($event.target)">
</label>
</div>
<p class="text-xs text-gray-400 mt-1">Upload brand logos you've worked with. They will be displayed on
your rate
cards.</p>
</div>
</div>
{{-- Content Showcase --}}
<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">Content Showcase</h2>
</div>
<div class="p-5" x-data="{
items: {{ Illuminate\Support\Js::from(old('content_showcase', $profile->content_showcase ?? [])) }}.map(i => ({ file_id: i.file_id || '', name: i.name || '', url: i.url || '', thumbnail_path: i.thumbnail_path || '', show_on_public: i.show_on_public ?? true, show_on_pdf: i.show_on_pdf ?? true, uploading: false })),
addItem() {
this.items.push({ file_id: '', name: '', url: '', thumbnail_path: '', show_on_public: true, show_on_pdf: true, uploading: false });
},
removeItem(index) {
this.items.splice(index, 1);
},
async uploadThumb(input, item) {
if (!input.files.length) return;
item.uploading = true;
const fd = new FormData();
fd.append('thumbnail', input.files[0]);
fd.append('_token', document.querySelector('meta[name=csrf-token]').content);
try {
const res = await fetch('{{ route('rate-cards.profile.upload-showcase-thumbnail', [], false) }}', { method: 'POST', body: fd, headers: { 'Accept': 'application/json' } });
const data = await res.json();
if (res.ok) {
item.thumbnail_path = data.path;
} else {
alert(data.message || 'Upload failed');
}
} catch (e) {
console.error(e);
alert('Network Error. Please try again.');
}
item.uploading = false;
input.value = '';
}
}">
<template x-for="(item, index) in items" :key="index">
<div class="flex flex-col gap-3 mb-4 bg-pink-50/30 p-3 rounded-2xl border border-pink-100 relative">
<div class="flex flex-col sm:flex-row gap-3 items-start w-full">
<div class="flex-1 w-full">
<label class="block text-[10px] font-semibold text-gray-600 mb-1">Select File <span
class="text-pink-400">*</span></label>
<select :name="'content_showcase['+index+'][file_id]'" x-model="item.file_id" required
class="input-soft w-full py-1.5 text-xs">
<option value="">-- Choose a File --</option>
<option value="url" class="font-bold text-pink-600">+ External Link</option>
@foreach($mediaFiles as $file)
<option value="{{ $file->id }}">{{ $file->name }}</option>
@endforeach
</select>
</div>
<div class="flex-1 w-full">
<label class="block text-[10px] font-semibold text-gray-600 mb-1">Custom Display Name
<span class="text-pink-400">*</span></label>
<input type="text" :name="'content_showcase['+index+'][name]'" x-model="item.name"
required class="input-soft w-full py-1.5 text-xs" placeholder="e.g. Viral Vlog">
</div>
<div class="shrink-0 flex items-end pt-5">
<button type="button" @click="removeItem(index)"
class="bg-red-100 text-red-500 rounded-lg px-3 py-1.5 hover:bg-red-200 transition-colors text-[10px] font-semibold">
Remove
</button>
</div>
</div>
<template x-if="item.file_id">
<div class="w-full">
<div class="w-full border-t border-pink-100 pt-3 flex flex-wrap gap-3 items-center">
<div class="shrink-0 flex items-center justify-center">
<input type="hidden" :name="'content_showcase['+index+'][thumbnail_path]'"
x-model="item.thumbnail_path">
<template x-if="item.thumbnail_path">
<div class="relative rounded-xl border border-pink-100 p-1 flex items-center justify-center bg-white group shrink-0"
style="width: 54px; height: 54px;">
<img :src="'/storage/' + item.thumbnail_path"
class="max-w-full max-h-full object-contain rounded">
<button type="button" @click="item.thumbnail_path = ''"
class="absolute -top-2 -right-2 bg-red-100 text-red-500 rounded-full w-5 h-5 flex items-center justify-center hover:bg-red-200 shadow text-[9px] z-10 transition-colors">🗑️</button>
</div>
</template>
<template x-if="!item.thumbnail_path">
<label
class="rounded-xl border-2 border-dashed border-pink-200 flex items-center justify-center text-pink-300 hover:bg-pink-50 hover:text-pink-400 cursor-pointer transition-colors shrink-0"
style="width: 54px; height: 54px;"
:class="{'opacity-50 pointer-events-none': item.uploading}"
title="Upload Thumbnail (Optional)">
<span x-show="!item.uploading"
class="text-xl font-light leading-none mb-1">+</span>
<span x-show="item.uploading" class="text-[10px]">...</span>
<input type="file" accept="image/*" class="hidden"
@change="uploadThumb($event.target, item)">
</label>
</template>
</div>
<template x-if="item.file_id === 'url'">
<div class="flex-1 min-w-[200px]">
<input type="url" :name="'content_showcase['+index+'][url]'" x-model="item.url"
class="input-soft w-full py-2 px-3 text-xs"
placeholder="URL (https://instagram.com/p/...)" required>
</div>
</template>
<template x-if="item.file_id !== 'url'">
<div class="flex-1 text-xs text-gray-400">
Uploaded Thumbnail: Use this to override the default display icon for videos and documents.
</div>
</template>
</div>
<div class="w-full border-t border-pink-100 pt-3 flex flex-wrap gap-4 items-center mt-2">
<label class="flex items-center gap-2 cursor-pointer text-[11px] font-semibold text-gray-600">
<input type="hidden" :name="'content_showcase['+index+'][show_on_public]'" value="0">
<input type="checkbox" :name="'content_showcase['+index+'][show_on_public]'" value="1" x-model="item.show_on_public" class="w-4 h-4 accent-pink-400 rounded cursor-pointer shrink-0">
Show on Public Page
</label>
<label class="flex items-center gap-2 cursor-pointer text-[11px] font-semibold text-gray-600">
<input type="hidden" :name="'content_showcase['+index+'][show_on_pdf]'" value="0">
<input type="checkbox" :name="'content_showcase['+index+'][show_on_pdf]'" value="1" x-model="item.show_on_pdf" class="w-4 h-4 accent-pink-400 rounded cursor-pointer shrink-0">
Show on PDF
</label>
</div>
</div>
</template>
</div>
</template>
<button type="button" @click="addItem()"
class="text-sm px-4 py-2 rounded-full border border-pink-200 text-pink-500 hover:bg-pink-50 font-semibold bg-white mb-2 shadow-sm">
+ Add Content to Showcase
</button>
<p class="text-xs text-gray-400 mt-1">Select files you've uploaded in the Files page to feature them
directly on your public rate card.</p>
</div>
</div>
{{-- Actions --}} {{-- Actions --}}
<div class="flex flex-wrap items-center gap-3"> <div class="flex flex-wrap items-center gap-2 w-full">
<button type="submit" class="btn-sakura px-6 py-2.5">💾 Save Profile</button> <button type="submit" class="btn-sakura text-xs sm:text-sm shrink-0 px-4 py-2 sm:px-6 sm:py-2.5">💾 Save
Profile</button>
<a href="{{ route('rate-cards.public') }}" target="_blank" <a href="{{ route('rate-cards.public') }}" target="_blank"
class="btn-sakura text-sm px-4 py-2.5 rounded-full border border-pink-200 text-pink-500 hover:bg-pink-50"> class="bg-white text-xs sm:text-sm px-3 py-1.5 sm:px-4 sm:py-2 rounded-full border border-pink-200 text-pink-600 hover:bg-pink-50 shadow-sm shrink-0">
👁️ Preview 👁️ Preview
</a> </a>
<a href="{{ route('rate-cards.pdf') }}" <a href="{{ route('rate-cards.pdf') }}"
class="btn-sakura text-sm px-4 py-2.5 rounded-full border border-blue-200 text-blue-500 hover:bg-blue-50"> class="bg-white text-xs sm:text-sm px-3 py-1.5 sm:px-4 sm:py-2 rounded-full border border-blue-200 text-blue-600 hover:bg-blue-50 shadow-sm shrink-0">
📄 Download PDF 📄 Download PDF
</a> </a>
<a href="{{ route('rate-cards.index') }}" <a href="{{ route('rate-cards.index') }}"
class="btn-sakura text-sm px-4 py-2.5 rounded-full border border-gray-200 text-gray-500 hover:bg-gray-50"> class="bg-white text-xs sm:text-sm px-3 py-1.5 sm:px-4 sm:py-2 rounded-full border border-gray-200 text-gray-600 hover:bg-gray-50 shadow-sm shrink-0">
← Back ← Back
</a> </a>
</div> </div>

View File

@@ -6,6 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Rate Card — {{ $profile->owner_name }}</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"> <link href="https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&display=swap" rel="stylesheet">
<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script>
<style> <style>
* { * {
box-sizing: border-box; box-sizing: border-box;
@@ -110,6 +111,63 @@
gap: 14px; gap: 14px;
} }
.carousel-wrapper {
position: relative;
}
.carousel-track {
display: flex;
overflow-x: auto;
scroll-snap-type: x mandatory;
gap: 14px;
padding-bottom: 10px;
scrollbar-width: none;
}
.carousel-track::-webkit-scrollbar {
display: none;
}
.carousel-slide {
flex: 0 0 220px;
scroll-snap-align: start;
}
.carousel-btn {
position: absolute;
top: 50%;
transform: translateY(-50%);
width: 40px;
height: 40px;
border-radius: 50%;
background: white;
border: 1px solid rgba(0,0,0,0.05);
box-shadow: 0 4px 10px rgba(0,0,0,0.1);
color:
{{ $profile->accent_color }}
;
font-size: 20px;
font-weight: 900;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
z-index: 10;
}
.carousel-btn:hover {
background: #fdfdfd;
box-shadow: 0 6px 14px rgba(0,0,0,0.15);
}
.carousel-btn.prev {
left: -20px;
}
.carousel-btn.next {
right: -20px;
}
.card { .card {
background: white; background: white;
border-radius: 24px; border-radius: 24px;
@@ -122,6 +180,17 @@
22; 22;
} }
.popup-modal {
position: fixed;
inset: 0;
background: rgba(0, 0, 0, 0.8);
z-index: 9999;
display: flex;
align-items: center;
justify-content: center;
padding: 20px;
}
.service { .service {
font-weight: 700; font-weight: 700;
color: #1F2937; color: #1F2937;
@@ -171,10 +240,35 @@
} }
.footer { .footer {
margin-top: 40px;
text-align: center; text-align: center;
margin-top: 60px;
color: #D1D5DB;
font-size: 12px; font-size: 12px;
color: #D1D5DB;
}
/* Quill WYSIWYG Compatibility */
.ql-align-center {
text-align: center !important;
}
.ql-align-right {
text-align: right !important;
}
.ql-align-justify {
text-align: justify !important;
}
.ql-size-small {
font-size: 0.75em !important;
}
.ql-size-large {
font-size: 1.5em !important;
}
.ql-size-huge {
font-size: 2.5em !important;
} }
.pdf-btn { .pdf-btn {
@@ -215,7 +309,7 @@
</style> </style>
</head> </head>
<body> <body x-data="{ popupOpen: false, popupImage: '' }">
<div class="container"> <div class="container">
<div class="header"> <div class="header">
@if($profile->logo_path) @if($profile->logo_path)
@@ -283,11 +377,151 @@
<p style="text-align:center; color:#9CA3AF; padding: 60px 0;">No rate cards published yet.</p> <p style="text-align:center; color:#9CA3AF; padding: 60px 0;">No rate cards published yet.</p>
@endforelse @endforelse
@if(!empty($profile->past_brands))
@php
$logoSizesPublic = [
'small' => 'max-height:45px; max-width:90px;',
'medium' => 'max-height:60px; max-width:120px;',
'large' => 'max-height:80px; max-width:160px;',
];
$sizeStylePublic = $logoSizesPublic[$profile->brand_logo_size ?? 'medium'] ?? $logoSizesPublic['medium'];
@endphp
<div class="platform-section" style="margin-top:40px;">
<div class="platform-title" style="justify-content:center;">Brand Collaborations</div>
<div style="display:flex; flex-wrap:wrap; justify-content:center; gap:24px; margin-top:20px;">
@foreach($profile->past_brands as $brandPath)
<img src="{{ asset('storage/' . $brandPath) }}"
style="{{ $sizeStylePublic }} object-fit:contain; border-radius:8px;">
@endforeach
</div>
</div>
@endif
@php
$publicShowcase = array_filter($profile->content_showcase ?? [], function($item) {
return !isset($item['show_on_public']) || $item['show_on_public'];
});
@endphp
@if(!empty($publicShowcase))
<div class="platform-section" style="margin-top:40px;">
<div class="platform-title" style="justify-content:center;">Content Showcase</div>
@php
$isCarousel = count($publicShowcase) >= 3;
$renderShowcase = $isCarousel ? array_merge($publicShowcase, $publicShowcase) : $publicShowcase;
@endphp
@if($isCarousel)
<div class="carousel-wrapper" x-data="{
scrollTimeout: null,
scrollPrev() {
const slider = this.$refs.slider;
const el = slider.lastElementChild;
const dist = el.offsetWidth + 14;
slider.insertBefore(el, slider.firstElementChild);
slider.scrollLeft += dist;
void slider.offsetWidth;
slider.scrollBy({left: -dist, behavior: 'smooth'});
},
scrollNext() {
const slider = this.$refs.slider;
const el = slider.firstElementChild;
const dist = el.offsetWidth + 14;
slider.scrollBy({left: dist, behavior: 'smooth'});
if (this.scrollTimeout) clearTimeout(this.scrollTimeout);
this.scrollTimeout = setTimeout(() => {
while (slider.scrollLeft >= slider.firstElementChild.offsetWidth + 10) {
const first = slider.firstElementChild;
const moveDist = first.offsetWidth + 14;
slider.appendChild(first);
slider.scrollLeft -= moveDist;
}
}, 400);
}
}">
<button type="button" class="carousel-btn prev" @click="scrollPrev()">&#10094;</button>
<div class="carousel-track" x-ref="slider" style="overflow-anchor: none;">
@else
<div class="cards">
@endif
@foreach($renderShowcase as $item)
@php
$isUrl = ($item['file_id'] === 'url');
$file = !$isUrl ? \App\Models\MediaFile::find($item['file_id']) : null;
@endphp
@if($file || $isUrl)
<div class="card {{ $isCarousel ? 'carousel-slide' : '' }}" style="padding:0; overflow:hidden; display:flex; flex-direction:column;">
<div style="flex:1; background:#F9FAFB; display:flex; align-items:center; justify-content:center; position:relative;">
@if(!empty($item['thumbnail_path']))
@if(!$isUrl && $file->is_image)
<div style="width:100%; aspect-ratio:9/16; cursor:pointer; position:relative;" @click="popupImage = '{{ $file->url }}'; popupOpen = true;">
<img src="{{ asset('storage/' . $item['thumbnail_path']) }}" style="width:100%; height:100%; object-fit:cover; display:block;">
</div>
@else
<a href="{{ $isUrl ? ($item['url'] ?? '#') : $file->url }}" target="_blank" style="display:block; width:100%; aspect-ratio:9/16; position:relative;">
<img src="{{ asset('storage/' . $item['thumbnail_path']) }}" style="width:100%; height:100%; object-fit:cover; display:block;">
@if(!$isUrl && $file->is_video)
<div style="position:absolute; inset:0; display:flex; align-items:center; justify-content:center; background:rgba(0,0,0,0.2);">
<div style="width:48px; height:48px; background:rgba(255,255,255,0.8); border-radius:50%; display:flex; align-items:center; justify-content:center; color:{{ $profile->accent_color }}; font-size:24px;">▶</div>
</div>
@endif
</a>
@endif
@elseif($isUrl)
<div style="aspect-ratio:9/16; display:flex; flex-direction:column; align-items:center; justify-content:center; padding:20px; text-align:center;">
<span style="font-size:48px;">🌐</span>
<a href="{{ $item['url'] ?? '#' }}" target="_blank" style="margin-top:10px; font-size:12px; color:{{ $profile->accent_color }}; text-decoration:none; font-weight:700;">Open Link</a>
</div>
@else
@if($file->is_image)
<div style="width:100%; aspect-ratio:9/16; cursor:pointer;" @click="popupImage = '{{ $file->url }}'; popupOpen = true;">
<img src="{{ $file->url }}" style="width:100%; height:100%; object-fit:cover; display:block;">
</div>
@elseif($file->is_video)
<video src="{{ $file->url }}" style="width:100%; aspect-ratio:9/16; object-fit:cover; display:block;" controls></video>
@else
<div style="aspect-ratio:9/16; display:flex; flex-direction:column; align-items:center; justify-content:center; padding:20px; text-align:center;">
<span style="font-size:48px;">{{ $file->icon }}</span>
<a href="{{ $file->url }}" target="_blank" style="margin-top:10px; font-size:12px; color:{{ $profile->accent_color }}; text-decoration:none; font-weight:700;">View File</a>
</div>
@endif
@endif
</div>
<div style="padding:16px;">
<div class="service" style="margin-bottom:0; text-align:center; font-weight:700;">{{ $item['name'] }}</div>
</div>
</div>
@endif
@endforeach
@if($isCarousel)
</div>
<button type="button" class="carousel-btn next" @click="scrollNext()">&#10095;</button>
</div>
@else
</div>
@endif
</div>
@endif
@if($profile->terms_and_conditions)
<div class="platform-section" style="margin-top:40px;">
<div class="platform-title" style="justify-content:center;">Terms & Conditions</div>
<div class="card" style="font-size:13px; color:#6B7280; line-height:1.6;">
{!! $profile->terms_and_conditions !!}</div>
</div>
@endif
<div class="footer"> <div class="footer">
{{ $profile->custom_footer ?: 'Prices may vary. Contact for custom packages.' }} {{ $profile->custom_footer ?: 'Prices may vary. Contact for custom packages.' }}
<!--<br>Generated by Cathy's App · {{ now()->format('Y-M-D') }}--> <!--<br>Generated by Cathy's App · {{ now()->format('Y-M-D') }}-->
</div> </div>
</div> </div>
<!-- Image Popup Modal -->
<div x-show="popupOpen" x-transition.opacity style="display:none;" class="popup-modal">
<div style="position:absolute; inset:0; cursor:pointer;" @click="popupOpen = false"></div>
<img :src="popupImage" style="max-width:100%; max-height:100%; object-fit:contain; position:relative; z-index:10000; border-radius:12px; box-shadow:0 10px 25px rgba(0,0,0,0.5);">
<button @click="popupOpen = false" style="position:absolute; top:20px; right:20px; background:rgba(255,255,255,0.2); border:none; color:white; font-size:30px; width:40px; height:40px; border-radius:50%; cursor:pointer; z-index:10001; display:flex; align-items:center; justify-content:center;">&times;</button>
</div>
</body> </body>
</html> </html>

View File

@@ -217,8 +217,7 @@
<div> <div>
<label class="block text-xs font-semibold text-gray-600 mb-1">Category Name <span <label class="block text-xs font-semibold text-gray-600 mb-1">Category Name <span
class="text-pink-400">*</span></label> class="text-pink-400">*</span></label>
<input type="text" x-model="newCatName" class="input-soft text-sm" <input type="text" x-model="newCatName" class="input-soft text-sm" placeholder="e.g. Susu UHT">
placeholder="e.g. Sponsored Post">
</div> </div>
<p x-show="catErrMsg" x-text="catErrMsg" class="text-xs text-red-500"></p> <p x-show="catErrMsg" x-text="catErrMsg" class="text-xs text-red-500"></p>
<div class="flex gap-2 pt-1"> <div class="flex gap-2 pt-1">

View File

@@ -91,7 +91,7 @@ document.addEventListener('DOMContentLoaded', function () {
headerToolbar: { headerToolbar: {
left: 'prev,next today', left: 'prev,next today',
center: 'title', center: 'title',
right: isMobile ? 'listWeek,timeGridDay' : 'dayGridMonth,timeGridWeek,listWeek', right: isMobile ? 'dayGridMonth,listWeek,timeGridDay' : 'dayGridMonth,timeGridWeek,listWeek',
}, },
editable: !isMobile, editable: !isMobile,
selectable: true, selectable: true,
@@ -99,7 +99,7 @@ document.addEventListener('DOMContentLoaded', function () {
height: 'auto', height: 'auto',
windowResize(view) { windowResize(view) {
const mob = window.innerWidth < 640; const mob = window.innerWidth < 640;
if (mob && calendar.view.type !== 'listWeek' && calendar.view.type !== 'timeGridDay') { if (mob && calendar.view.type !== 'listWeek' && calendar.view.type !== 'timeGridDay' && calendar.view.type !== 'dayGridMonth') {
calendar.changeView('listWeek'); calendar.changeView('listWeek');
} }
}, },

View File

@@ -6,33 +6,19 @@
@section('content') @section('content')
<form method="GET" action="{{ route('search.index') }}" class="mb-6"> @if(!$q)
<div class="relative max-w-xl">
<span class="absolute left-4 top-1/2 -translate-y-1/2 text-gray-400">🔍</span>
<input
type="text"
name="q"
value="{{ e($q) }}"
placeholder="Search clients, events, invoices, content…"
class="input-soft pl-11 py-3 text-base w-full"
autofocus
>
</div>
</form>
@if(! $q)
<div class="text-center py-20 text-gray-400"> <div class="text-center py-20 text-gray-400">
<span class="text-5xl block mb-3">🔍</span> <span class="text-5xl block mb-3">🔍</span>
<p class="text-base font-medium">Start typing to search across everything</p> <p class="text-base font-medium">Start typing to search across everything</p>
<p class="text-sm mt-1">Clients, events, invoices, content briefs, rate cards</p> <p class="text-sm mt-1">Clients, events, invoices, content briefs, rate cards</p>
</div> </div>
@elseif(empty($results)) @elseif(empty($results))
<div class="text-center py-20 text-gray-400"> <div class="text-center py-20 text-gray-400">
<span class="text-5xl block mb-3">😿</span> <span class="text-5xl block mb-3">😿</span>
<p class="text-base font-medium">No results for "{{ e($q) }}"</p> <p class="text-base font-medium">No results for "{{ e($q) }}"</p>
<p class="text-sm mt-1">Try a different keyword</p> <p class="text-sm mt-1">Try a different keyword</p>
</div> </div>
@else @else
<div class="space-y-6"> <div class="space-y-6">
@foreach($results as $group) @foreach($results as $group)
<div class="cat-card overflow-hidden"> <div class="cat-card overflow-hidden">
@@ -57,6 +43,6 @@
</div> </div>
@endforeach @endforeach
</div> </div>
@endif @endif
@endsection @endsection

File diff suppressed because one or more lines are too long

View File

@@ -72,6 +72,7 @@ Route::prefix('social-hub')->name('social-hub.')->group(function (): void {
// Financial – Invoices // Financial – Invoices
Route::resource('invoices', InvoiceController::class); Route::resource('invoices', InvoiceController::class);
Route::get('/invoices/{invoice}/pdf', [InvoiceController::class, 'pdf'])->name('invoices.pdf'); Route::get('/invoices/{invoice}/pdf', [InvoiceController::class, 'pdf'])->name('invoices.pdf');
Route::get('/invoices/{invoice}/pdf-legacy', [InvoiceController::class, 'pdfLegacy'])->name('invoices.pdf-legacy');
Route::get('/invoice-settings', [InvoiceSettingsController::class, 'edit'])->name('invoice-settings.edit'); Route::get('/invoice-settings', [InvoiceSettingsController::class, 'edit'])->name('invoice-settings.edit');
Route::post('/invoice-settings', [InvoiceSettingsController::class, 'update'])->name('invoice-settings.update'); Route::post('/invoice-settings', [InvoiceSettingsController::class, 'update'])->name('invoice-settings.update');
Route::post('/invoice-settings/logo', [InvoiceSettingsController::class, 'uploadLogo'])->name('invoice-settings.upload-logo'); Route::post('/invoice-settings/logo', [InvoiceSettingsController::class, 'uploadLogo'])->name('invoice-settings.upload-logo');
@@ -84,6 +85,11 @@ Route::get('/rate-cards/public', [RateCardController::class, 'public'])->name('r
Route::get('/rate-cards/pdf', [RateCardController::class, 'pdf'])->name('rate-cards.pdf'); Route::get('/rate-cards/pdf', [RateCardController::class, 'pdf'])->name('rate-cards.pdf');
Route::get('/rate-cards/profile', [RateCardController::class, 'profilePage'])->name('rate-cards.profile'); Route::get('/rate-cards/profile', [RateCardController::class, 'profilePage'])->name('rate-cards.profile');
Route::post('/rate-cards/profile', [RateCardController::class, 'profileUpdate'])->name('rate-cards.profile.update'); Route::post('/rate-cards/profile', [RateCardController::class, 'profileUpdate'])->name('rate-cards.profile.update');
Route::post('/rate-cards/profile/logo', [RateCardController::class, 'uploadLogo'])->name('rate-cards.profile.upload-logo');
Route::delete('/rate-cards/profile/logo', [RateCardController::class, 'deleteLogo'])->name('rate-cards.profile.delete-logo');
Route::post('/rate-cards/profile/brand-logo', [RateCardController::class, 'uploadBrandLogo'])->name('rate-cards.profile.upload-brand-logo');
Route::delete('/rate-cards/profile/brand-logo', [RateCardController::class, 'deleteBrandLogo'])->name('rate-cards.profile.delete-brand-logo');
Route::post('/rate-cards/profile/content-thumbnail', [RateCardController::class, 'uploadShowcaseThumbnail'])->name('rate-cards.profile.upload-showcase-thumbnail');
Route::get('/files/profile-logo', [RateCardController::class, 'serveProfileLogo'])->name('files.serve-profile-logo'); Route::get('/files/profile-logo', [RateCardController::class, 'serveProfileLogo'])->name('files.serve-profile-logo');
Route::resource('rate-cards', RateCardController::class)->except(['show']); Route::resource('rate-cards', RateCardController::class)->except(['show']);