Add contract management and invoice settings pages
- Created a new Blade view for managing brand contracts with forms for adding and editing contracts, including client and category selection. - Implemented success message notifications for contract actions. - Added a new Blade view for invoice settings, allowing customization of invoice number format, header branding, and default values for new invoices. - Introduced a new PDF view for generating rate cards with customizable styles based on user profile settings. - Developed a profile management page for rate cards, enabling users to update their identity, appearance, and visibility settings.
This commit is contained in:
@@ -13,7 +13,8 @@
|
|||||||
"Bash(NODE_BIN=\"/c/laragon/bin/nodejs/node-v22\" cd \"E:/_PERSONAL-PROJECT_/PHP/KOL-Manager\" \"$NODE_BIN/node.exe\" \"$NODE_BIN/node_modules/npm/bin/npm-cli.js\" run build)",
|
"Bash(NODE_BIN=\"/c/laragon/bin/nodejs/node-v22\" cd \"E:/_PERSONAL-PROJECT_/PHP/KOL-Manager\" \"$NODE_BIN/node.exe\" \"$NODE_BIN/node_modules/npm/bin/npm-cli.js\" run build)",
|
||||||
"Bash(/c/laragon/bin/nodejs/node-v22/node node_modules/npm/bin/npm-cli.js run build)",
|
"Bash(/c/laragon/bin/nodejs/node-v22/node node_modules/npm/bin/npm-cli.js run build)",
|
||||||
"Bash(/c/laragon/bin/nodejs/node-v22/node /c/laragon/bin/nodejs/node-v22/node_modules/npm/bin/npm-cli.js run build)",
|
"Bash(/c/laragon/bin/nodejs/node-v22/node /c/laragon/bin/nodejs/node-v22/node_modules/npm/bin/npm-cli.js run build)",
|
||||||
"Bash(php artisan:*)"
|
"Bash(php artisan:*)",
|
||||||
|
"Bash(php -r \":*)"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
126
app/Http/Controllers/BrandContractController.php
Normal file
126
app/Http/Controllers/BrandContractController.php
Normal file
@@ -0,0 +1,126 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\BrandContract;
|
||||||
|
use App\Models\Client;
|
||||||
|
use App\Models\ClientCategory;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\RedirectResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\View\View;
|
||||||
|
|
||||||
|
class BrandContractController extends Controller
|
||||||
|
{
|
||||||
|
private function categoryTree(): \Illuminate\Support\Collection
|
||||||
|
{
|
||||||
|
return ClientCategory::with('children')
|
||||||
|
->whereNull('parent_id')
|
||||||
|
->orderBy('sort_order')
|
||||||
|
->get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index(): View
|
||||||
|
{
|
||||||
|
$contracts = BrandContract::with(['client', 'category'])
|
||||||
|
->orderByDesc('end_date')
|
||||||
|
->get();
|
||||||
|
$clients = Client::orderBy('name')->get();
|
||||||
|
$categoryTree = $this->categoryTree();
|
||||||
|
|
||||||
|
return view('contracts.index', compact('contracts', 'clients', 'categoryTree'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request): RedirectResponse
|
||||||
|
{
|
||||||
|
$validated = $request->validate([
|
||||||
|
'title' => 'required|string|max:255',
|
||||||
|
'client_id' => 'nullable|exists:clients,id',
|
||||||
|
'category_id' => 'required|exists:client_categories,id',
|
||||||
|
'start_date' => 'required|date',
|
||||||
|
'end_date' => 'required|date|after_or_equal:start_date',
|
||||||
|
'notes' => 'nullable|string',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$validated['is_active'] = true;
|
||||||
|
BrandContract::create($validated);
|
||||||
|
|
||||||
|
return back()->with('success', '📝 Contract added!');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(Request $request, BrandContract $contract): RedirectResponse
|
||||||
|
{
|
||||||
|
$validated = $request->validate([
|
||||||
|
'title' => 'required|string|max:255',
|
||||||
|
'client_id' => 'nullable|exists:clients,id',
|
||||||
|
'category_id' => 'required|exists:client_categories,id',
|
||||||
|
'start_date' => 'required|date',
|
||||||
|
'end_date' => 'required|date|after_or_equal:start_date',
|
||||||
|
'notes' => 'nullable|string',
|
||||||
|
'is_active' => 'boolean',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$validated['is_active'] = $request->boolean('is_active', $contract->is_active);
|
||||||
|
$contract->update($validated);
|
||||||
|
|
||||||
|
return back()->with('success', '📝 Contract updated!');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy(BrandContract $contract): RedirectResponse
|
||||||
|
{
|
||||||
|
$contract->delete();
|
||||||
|
return back()->with('success', '📝 Contract removed.');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function toggle(BrandContract $contract): RedirectResponse
|
||||||
|
{
|
||||||
|
$contract->update(['is_active' => ! $contract->is_active]);
|
||||||
|
return back()->with('success', $contract->is_active ? '✅ Contract activated.' : '⏸️ Contract paused.');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AJAX: check if a category has an active exclusive contract.
|
||||||
|
* Returns null if clear, or contract details if blocked.
|
||||||
|
*/
|
||||||
|
public function check(Request $request): JsonResponse
|
||||||
|
{
|
||||||
|
$categoryId = $request->integer('category_id');
|
||||||
|
$clientId = $request->integer('client_id');
|
||||||
|
|
||||||
|
if (! $categoryId) {
|
||||||
|
return response()->json(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Collect the category and its parent chain (so blocking a parent also blocks children)
|
||||||
|
$category = ClientCategory::find($categoryId);
|
||||||
|
$checkIds = [$categoryId];
|
||||||
|
if ($category?->parent_id) {
|
||||||
|
$checkIds[] = $category->parent_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
$contract = BrandContract::with(['client', 'category'])
|
||||||
|
->active()
|
||||||
|
->whereIn('category_id', $checkIds)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if (! $contract) {
|
||||||
|
return response()->json(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Allow if it's the contracted brand itself
|
||||||
|
if ($clientId && $contract->client_id && $contract->client_id === $clientId) {
|
||||||
|
return response()->json(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'id' => $contract->id,
|
||||||
|
'title' => $contract->title,
|
||||||
|
'client_name' => $contract->client?->name ?? 'Unknown',
|
||||||
|
'category' => $contract->category?->name ?? 'Unknown',
|
||||||
|
'end_date' => $contract->end_date->format('d M Y'),
|
||||||
|
'days_left' => $contract->days_remaining,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,10 +10,18 @@ use Illuminate\Http\Request;
|
|||||||
|
|
||||||
class ClientCategoryController extends Controller
|
class ClientCategoryController extends Controller
|
||||||
{
|
{
|
||||||
public function index()
|
public function index(): \Illuminate\View\View
|
||||||
{
|
{
|
||||||
// Managed inline from the clients page; redirect there
|
$categories = ClientCategory::with('children', 'parent')
|
||||||
return redirect()->route('clients.index');
|
->withCount('clients')
|
||||||
|
->orderBy('sort_order')
|
||||||
|
->get();
|
||||||
|
|
||||||
|
$parents = ClientCategory::whereNull('parent_id')
|
||||||
|
->orderBy('sort_order')
|
||||||
|
->get();
|
||||||
|
|
||||||
|
return view('categories.index', compact('categories', 'parents'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function store(Request $request): RedirectResponse
|
public function store(Request $request): RedirectResponse
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ namespace App\Http\Controllers;
|
|||||||
|
|
||||||
use App\Enums\ContentStatus;
|
use App\Enums\ContentStatus;
|
||||||
use App\Models\Client;
|
use App\Models\Client;
|
||||||
|
use App\Models\ClientCategory;
|
||||||
use App\Models\ContentBrief;
|
use App\Models\ContentBrief;
|
||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
use Illuminate\Http\RedirectResponse;
|
use Illuminate\Http\RedirectResponse;
|
||||||
@@ -14,6 +15,14 @@ use Illuminate\View\View;
|
|||||||
|
|
||||||
class ContentBriefController extends Controller
|
class ContentBriefController extends Controller
|
||||||
{
|
{
|
||||||
|
private function categoryTree(): \Illuminate\Support\Collection
|
||||||
|
{
|
||||||
|
return ClientCategory::with('children')
|
||||||
|
->whereNull('parent_id')
|
||||||
|
->orderBy('sort_order')
|
||||||
|
->get();
|
||||||
|
}
|
||||||
|
|
||||||
public function index(): View
|
public function index(): View
|
||||||
{
|
{
|
||||||
$clients = Client::where('status', 'active')->orderBy('name')->get();
|
$clients = Client::where('status', 'active')->orderBy('name')->get();
|
||||||
@@ -34,7 +43,8 @@ class ContentBriefController extends Controller
|
|||||||
{
|
{
|
||||||
$clients = Client::where('status', 'active')->orderBy('name')->get();
|
$clients = Client::where('status', 'active')->orderBy('name')->get();
|
||||||
$statuses = ContentStatus::cases();
|
$statuses = ContentStatus::cases();
|
||||||
return view('content.create', compact('clients', 'statuses'));
|
$categoryTree = $this->categoryTree();
|
||||||
|
return view('content.create', compact('clients', 'statuses', 'categoryTree'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function store(Request $request): RedirectResponse
|
public function store(Request $request): RedirectResponse
|
||||||
@@ -42,6 +52,7 @@ class ContentBriefController extends Controller
|
|||||||
$validated = $request->validate([
|
$validated = $request->validate([
|
||||||
'title' => 'required|string|max:255',
|
'title' => 'required|string|max:255',
|
||||||
'client_id' => 'nullable|exists:clients,id',
|
'client_id' => 'nullable|exists:clients,id',
|
||||||
|
'category_id' => 'nullable|exists:client_categories,id',
|
||||||
'platform' => 'required|in:instagram,tiktok,youtube',
|
'platform' => 'required|in:instagram,tiktok,youtube',
|
||||||
'content_type' => 'required|string|max:50',
|
'content_type' => 'required|string|max:50',
|
||||||
'status' => 'required|in:drafting,filming,editing,review,posted,archived',
|
'status' => 'required|in:drafting,filming,editing,review,posted,archived',
|
||||||
@@ -71,8 +82,14 @@ class ContentBriefController extends Controller
|
|||||||
{
|
{
|
||||||
$clients = Client::where('status', 'active')->orderBy('name')->get();
|
$clients = Client::where('status', 'active')->orderBy('name')->get();
|
||||||
$statuses = ContentStatus::cases();
|
$statuses = ContentStatus::cases();
|
||||||
|
$categoryTree = $this->categoryTree();
|
||||||
$contentBrief->load('client');
|
$contentBrief->load('client');
|
||||||
return view('content.edit', ['brief' => $contentBrief, 'clients' => $clients, 'statuses' => $statuses]);
|
return view('content.edit', [
|
||||||
|
'brief' => $contentBrief,
|
||||||
|
'clients' => $clients,
|
||||||
|
'statuses' => $statuses,
|
||||||
|
'categoryTree' => $categoryTree,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update(Request $request, ContentBrief $contentBrief): RedirectResponse
|
public function update(Request $request, ContentBrief $contentBrief): RedirectResponse
|
||||||
@@ -80,6 +97,7 @@ class ContentBriefController extends Controller
|
|||||||
$validated = $request->validate([
|
$validated = $request->validate([
|
||||||
'title' => 'required|string|max:255',
|
'title' => 'required|string|max:255',
|
||||||
'client_id' => 'nullable|exists:clients,id',
|
'client_id' => 'nullable|exists:clients,id',
|
||||||
|
'category_id' => 'nullable|exists:client_categories,id',
|
||||||
'platform' => 'required|in:instagram,tiktok,youtube',
|
'platform' => 'required|in:instagram,tiktok,youtube',
|
||||||
'content_type' => 'required|string|max:50',
|
'content_type' => 'required|string|max:50',
|
||||||
'status' => 'required|in:drafting,filming,editing,review,posted,archived',
|
'status' => 'required|in:drafting,filming,editing,review,posted,archived',
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ namespace App\Http\Controllers;
|
|||||||
|
|
||||||
use App\Enums\EventStatus;
|
use App\Enums\EventStatus;
|
||||||
use App\Models\Client;
|
use App\Models\Client;
|
||||||
|
use App\Models\ClientCategory;
|
||||||
use App\Models\Event;
|
use App\Models\Event;
|
||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
use Illuminate\Http\RedirectResponse;
|
use Illuminate\Http\RedirectResponse;
|
||||||
@@ -14,10 +15,19 @@ use Illuminate\View\View;
|
|||||||
|
|
||||||
class EventController extends Controller
|
class EventController extends Controller
|
||||||
{
|
{
|
||||||
|
private function categoryTree(): \Illuminate\Support\Collection
|
||||||
|
{
|
||||||
|
return ClientCategory::with('children')
|
||||||
|
->whereNull('parent_id')
|
||||||
|
->orderBy('sort_order')
|
||||||
|
->get();
|
||||||
|
}
|
||||||
|
|
||||||
public function index(): View
|
public function index(): View
|
||||||
{
|
{
|
||||||
$events = Event::with('client')->orderBy('start_time')->get();
|
$events = Event::with('client')->orderBy('start_time')->get();
|
||||||
$clients = Client::where('status', 'active')->orderBy('name')->get();
|
$clients = Client::where('status', 'active')->orderBy('name')->get();
|
||||||
|
$categoryTree = $this->categoryTree();
|
||||||
|
|
||||||
// Format for FullCalendar
|
// Format for FullCalendar
|
||||||
$calendarEvents = $events->map(fn (Event $e) => [
|
$calendarEvents = $events->map(fn (Event $e) => [
|
||||||
@@ -35,7 +45,7 @@ class EventController extends Controller
|
|||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return view('schedule.index', compact('events', 'clients', 'calendarEvents'));
|
return view('schedule.index', compact('events', 'clients', 'calendarEvents', 'categoryTree'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function store(Request $request): RedirectResponse
|
public function store(Request $request): RedirectResponse
|
||||||
@@ -44,6 +54,7 @@ class EventController extends Controller
|
|||||||
'title' => 'required|string|max:255',
|
'title' => 'required|string|max:255',
|
||||||
'description' => 'nullable|string',
|
'description' => 'nullable|string',
|
||||||
'client_id' => 'nullable|exists:clients,id',
|
'client_id' => 'nullable|exists:clients,id',
|
||||||
|
'category_id' => 'nullable|exists:client_categories,id',
|
||||||
'event_type' => 'required|in:task,meeting,deadline,posting',
|
'event_type' => 'required|in:task,meeting,deadline,posting',
|
||||||
'start_time' => 'required|date',
|
'start_time' => 'required|date',
|
||||||
'end_time' => 'nullable|date|after:start_time',
|
'end_time' => 'nullable|date|after:start_time',
|
||||||
@@ -67,8 +78,9 @@ class EventController extends Controller
|
|||||||
{
|
{
|
||||||
$clients = Client::where('status', 'active')->orderBy('name')->get();
|
$clients = Client::where('status', 'active')->orderBy('name')->get();
|
||||||
$statuses = EventStatus::cases();
|
$statuses = EventStatus::cases();
|
||||||
|
$categoryTree = $this->categoryTree();
|
||||||
|
|
||||||
return view('schedule.edit', compact('event', 'clients', 'statuses'));
|
return view('schedule.edit', compact('event', 'clients', 'statuses', 'categoryTree'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update(Request $request, Event $event): RedirectResponse
|
public function update(Request $request, Event $event): RedirectResponse
|
||||||
@@ -77,6 +89,7 @@ class EventController extends Controller
|
|||||||
'title' => 'required|string|max:255',
|
'title' => 'required|string|max:255',
|
||||||
'description' => 'nullable|string',
|
'description' => 'nullable|string',
|
||||||
'client_id' => 'nullable|exists:clients,id',
|
'client_id' => 'nullable|exists:clients,id',
|
||||||
|
'category_id' => 'nullable|exists:client_categories,id',
|
||||||
'event_type' => 'required|in:task,meeting,deadline,posting',
|
'event_type' => 'required|in:task,meeting,deadline,posting',
|
||||||
'start_time' => 'required|date',
|
'start_time' => 'required|date',
|
||||||
'end_time' => 'nullable|date',
|
'end_time' => 'nullable|date',
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ namespace App\Http\Controllers;
|
|||||||
use App\Enums\InvoiceStatus;
|
use App\Enums\InvoiceStatus;
|
||||||
use App\Models\Client;
|
use App\Models\Client;
|
||||||
use App\Models\Invoice;
|
use App\Models\Invoice;
|
||||||
|
use App\Models\InvoiceSettings;
|
||||||
use App\Services\InvoiceService;
|
use App\Services\InvoiceService;
|
||||||
use Illuminate\Http\RedirectResponse;
|
use Illuminate\Http\RedirectResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
@@ -29,7 +30,8 @@ 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();
|
||||||
return view('invoices.create', compact('clients', 'statuses'));
|
$invoiceSettings = InvoiceSettings::instance();
|
||||||
|
return view('invoices.create', compact('clients', 'statuses', 'invoiceSettings'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function store(Request $request): RedirectResponse
|
public function store(Request $request): RedirectResponse
|
||||||
@@ -46,10 +48,12 @@ class InvoiceController extends Controller
|
|||||||
'bank_name' => 'nullable|string|max:100',
|
'bank_name' => 'nullable|string|max:100',
|
||||||
'bank_account' => 'nullable|string|max:50',
|
'bank_account' => 'nullable|string|max:50',
|
||||||
'bank_holder' => 'nullable|string|max:100',
|
'bank_holder' => 'nullable|string|max:100',
|
||||||
|
'branch_name' => 'nullable|string|max:100',
|
||||||
'items' => 'required|array|min:1',
|
'items' => 'required|array|min:1',
|
||||||
'items.*.description' => 'required|string',
|
'items.*.description' => 'required|string',
|
||||||
'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 = $validated['items'];
|
$items = $validated['items'];
|
||||||
@@ -65,15 +69,17 @@ class InvoiceController extends Controller
|
|||||||
public function show(Invoice $invoice): View
|
public function show(Invoice $invoice): View
|
||||||
{
|
{
|
||||||
$invoice->load('client', 'items');
|
$invoice->load('client', 'items');
|
||||||
return view('invoices.show', compact('invoice'));
|
$invoiceSettings = InvoiceSettings::instance();
|
||||||
|
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'));
|
return view('invoices.edit', compact('invoice', 'clients', 'statuses', 'invoiceSettings'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update(Request $request, Invoice $invoice): RedirectResponse
|
public function update(Request $request, Invoice $invoice): RedirectResponse
|
||||||
@@ -91,10 +97,12 @@ class InvoiceController extends Controller
|
|||||||
'bank_name' => 'nullable|string|max:100',
|
'bank_name' => 'nullable|string|max:100',
|
||||||
'bank_account' => 'nullable|string|max:50',
|
'bank_account' => 'nullable|string|max:50',
|
||||||
'bank_holder' => 'nullable|string|max:100',
|
'bank_holder' => 'nullable|string|max:100',
|
||||||
|
'branch_name' => 'nullable|string|max:100',
|
||||||
'items' => 'required|array|min:1',
|
'items' => 'required|array|min:1',
|
||||||
'items.*.description' => 'required|string',
|
'items.*.description' => 'required|string',
|
||||||
'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 = $validated['items'];
|
$items = $validated['items'];
|
||||||
|
|||||||
55
app/Http/Controllers/InvoiceSettingsController.php
Normal file
55
app/Http/Controllers/InvoiceSettingsController.php
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\InvoiceSettings;
|
||||||
|
use Illuminate\Http\RedirectResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
use Illuminate\View\View;
|
||||||
|
|
||||||
|
class InvoiceSettingsController extends Controller
|
||||||
|
{
|
||||||
|
public function edit(): View
|
||||||
|
{
|
||||||
|
$settings = InvoiceSettings::instance();
|
||||||
|
return view('invoices.settings', compact('settings'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(Request $request): RedirectResponse
|
||||||
|
{
|
||||||
|
$validated = $request->validate([
|
||||||
|
'invoice_prefix' => 'required|string|max:20',
|
||||||
|
'invoice_next_number' => 'required|integer|min:1',
|
||||||
|
'header_name' => 'nullable|string|max:100',
|
||||||
|
'header_title' => 'nullable|string|max:150',
|
||||||
|
'header_logo' => 'nullable|image|max:2048',
|
||||||
|
'default_tax_rate' => 'nullable|numeric|min:0|max:100',
|
||||||
|
'default_currency' => 'nullable|string|max:10',
|
||||||
|
'default_service_description'=> 'nullable|string|max:255',
|
||||||
|
'default_bank_name' => 'nullable|string|max:100',
|
||||||
|
'default_branch_name' => 'nullable|string|max:100',
|
||||||
|
'default_bank_account' => 'nullable|string|max:50',
|
||||||
|
'default_bank_holder' => 'nullable|string|max:100',
|
||||||
|
'default_notes' => 'nullable|string|max:1000',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$settings = InvoiceSettings::instance();
|
||||||
|
|
||||||
|
if ($request->hasFile('header_logo')) {
|
||||||
|
// Delete old logo if exists
|
||||||
|
if ($settings->header_logo) {
|
||||||
|
Storage::disk('public')->delete($settings->header_logo);
|
||||||
|
}
|
||||||
|
$path = $request->file('header_logo')->store('invoice-logos', 'public');
|
||||||
|
$validated['header_logo'] = $path;
|
||||||
|
}
|
||||||
|
|
||||||
|
$settings->update($validated);
|
||||||
|
|
||||||
|
return redirect()->route('invoice-settings.edit')
|
||||||
|
->with('success', '🧾 Invoice settings saved!');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -41,7 +41,7 @@ class MediaFileController extends Controller
|
|||||||
return view('files.index', compact('files', 'folders', 'folder', 'clients'));
|
return view('files.index', compact('files', 'folders', 'folder', 'clients'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function store(Request $request): RedirectResponse
|
public function store(Request $request): RedirectResponse|\Illuminate\Http\JsonResponse
|
||||||
{
|
{
|
||||||
$request->validate([
|
$request->validate([
|
||||||
'file' => 'required|file|max:51200', // 50 MB
|
'file' => 'required|file|max:51200', // 50 MB
|
||||||
@@ -55,6 +55,10 @@ class MediaFileController extends Controller
|
|||||||
$request->input('client_id')
|
$request->input('client_id')
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if ($request->expectsJson() || $request->ajax()) {
|
||||||
|
return response()->json(['success' => true, 'message' => 'File uploaded successfully!']);
|
||||||
|
}
|
||||||
|
|
||||||
return back()->with('success', '📁 File uploaded successfully!');
|
return back()->with('success', '📁 File uploaded successfully!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,17 +32,17 @@ class NotificationSettingController extends Controller
|
|||||||
'config.to_email' => 'required_if:channel,email|nullable|email',
|
'config.to_email' => 'required_if:channel,email|nullable|email',
|
||||||
// Telegram
|
// Telegram
|
||||||
'config.bot_token' => 'required_if:channel,telegram|nullable|string',
|
'config.bot_token' => 'required_if:channel,telegram|nullable|string',
|
||||||
'config.chat_id' => 'required_if:channel,telegram|nullable|string',
|
'config.chat_id' => 'nullable|string',
|
||||||
// WhatsApp (WAHA)
|
// WhatsApp (WAHA)
|
||||||
'config.waha_url' => 'required_if:channel,whatsapp|nullable|url',
|
'config.waha_endpoint' => 'required_if:channel,whatsapp|nullable|url',
|
||||||
'config.waha_session' => 'required_if:channel,whatsapp|nullable|string',
|
'config.waha_session' => 'nullable|string',
|
||||||
'config.phone' => 'required_if:channel,whatsapp|nullable|string',
|
'config.api_key' => 'nullable|string',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
NotificationSetting::create([
|
NotificationSetting::create([
|
||||||
'name' => $validated['name'],
|
'name' => $validated['name'],
|
||||||
'channel' => $validated['channel'],
|
'channel' => $validated['channel'],
|
||||||
'config' => $validated['config'] ?? [],
|
'config' => $request->input('config', []), // pass raw config — not stripped by validation
|
||||||
'triggers' => $validated['triggers'] ?? [],
|
'triggers' => $validated['triggers'] ?? [],
|
||||||
'notify_before_hours' => $validated['notify_before_hours'] ?? 24,
|
'notify_before_hours' => $validated['notify_before_hours'] ?? 24,
|
||||||
'is_enabled' => true,
|
'is_enabled' => true,
|
||||||
@@ -65,7 +65,7 @@ class NotificationSettingController extends Controller
|
|||||||
'name' => $validated['name'],
|
'name' => $validated['name'],
|
||||||
'triggers' => $validated['triggers'] ?? [],
|
'triggers' => $validated['triggers'] ?? [],
|
||||||
'notify_before_hours' => $validated['notify_before_hours'] ?? $setting->notify_before_hours,
|
'notify_before_hours' => $validated['notify_before_hours'] ?? $setting->notify_before_hours,
|
||||||
'config' => $validated['config'] ?? $setting->config,
|
'config' => $request->input('config', $setting->config), // use raw input so no keys are stripped
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return back()->with('success', '🔔 Notification updated!');
|
return back()->with('success', '🔔 Notification updated!');
|
||||||
|
|||||||
@@ -5,8 +5,11 @@ declare(strict_types=1);
|
|||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\Models\RateCard;
|
use App\Models\RateCard;
|
||||||
|
use App\Models\RateCardProfile;
|
||||||
|
use Barryvdh\DomPDF\Facade\Pdf;
|
||||||
use Illuminate\Http\RedirectResponse;
|
use Illuminate\Http\RedirectResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Http\Response;
|
||||||
use Illuminate\View\View;
|
use Illuminate\View\View;
|
||||||
|
|
||||||
class RateCardController extends Controller
|
class RateCardController extends Controller
|
||||||
@@ -14,7 +17,8 @@ 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();
|
||||||
return view('rate-cards.index', compact('rateCards'));
|
$profile = RateCardProfile::getSingleton();
|
||||||
|
return view('rate-cards.index', compact('rateCards', 'profile'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function create(): View
|
public function create(): View
|
||||||
@@ -80,14 +84,91 @@ class RateCardController extends Controller
|
|||||||
return redirect()->route('rate-cards.index')->with('success', 'Entry removed.');
|
return redirect()->route('rate-cards.index')->with('success', 'Entry removed.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ── Public Page ──────────────────────────────────────────────
|
||||||
|
|
||||||
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'));
|
return view('rate-cards.public', compact('rateCards', 'profile'));
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── Profile Settings ─────────────────────────────────────────
|
||||||
|
|
||||||
|
public function profilePage(): View
|
||||||
|
{
|
||||||
|
$profile = RateCardProfile::getSingleton();
|
||||||
|
return view('rate-cards.profile', compact('profile'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function profileUpdate(Request $request): RedirectResponse
|
||||||
|
{
|
||||||
|
$validated = $request->validate([
|
||||||
|
'owner_name' => 'required|string|max:100',
|
||||||
|
'tagline' => 'nullable|string|max:200',
|
||||||
|
'whatsapp' => 'nullable|string|max:30',
|
||||||
|
'ig_handle' => 'nullable|string|max:60',
|
||||||
|
'tiktok_handle' => 'nullable|string|max:60',
|
||||||
|
'youtube_handle'=> 'nullable|string|max:60',
|
||||||
|
'email' => 'nullable|email|max:150',
|
||||||
|
'bg_color' => 'nullable|string|max:20',
|
||||||
|
'accent_color' => 'nullable|string|max:20',
|
||||||
|
'text_color' => 'nullable|string|max:20',
|
||||||
|
'custom_footer' => 'nullable|string|max:500',
|
||||||
|
'show_prices' => 'boolean',
|
||||||
|
'logo' => 'nullable|image|max:2048',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$profile = RateCardProfile::getSingleton();
|
||||||
|
|
||||||
|
if ($request->hasFile('logo')) {
|
||||||
|
$path = $request->file('logo')->store('profile', 'private');
|
||||||
|
$validated['logo_path'] = $path;
|
||||||
|
}
|
||||||
|
|
||||||
|
$validated['show_prices'] = $request->boolean('show_prices');
|
||||||
|
unset($validated['logo']);
|
||||||
|
|
||||||
|
$profile->update($validated);
|
||||||
|
|
||||||
|
return back()->with('success', '🎨 Profile updated!');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function serveProfileLogo(): Response
|
||||||
|
{
|
||||||
|
$profile = RateCardProfile::getSingleton();
|
||||||
|
|
||||||
|
if (! $profile->logo_path || ! \Storage::disk('private')->exists($profile->logo_path)) {
|
||||||
|
abort(404);
|
||||||
|
}
|
||||||
|
|
||||||
|
$contents = \Storage::disk('private')->get($profile->logo_path);
|
||||||
|
$mime = \Storage::disk('private')->mimeType($profile->logo_path);
|
||||||
|
|
||||||
|
return response($contents, 200)->header('Content-Type', $mime);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── PDF Download ─────────────────────────────────────────────
|
||||||
|
|
||||||
|
public function pdf(): \Illuminate\Http\Response
|
||||||
|
{
|
||||||
|
$profile = RateCardProfile::getSingleton();
|
||||||
|
$rateCards = RateCard::where('is_active', true)
|
||||||
|
->orderBy('sort_order')
|
||||||
|
->orderBy('platform')
|
||||||
|
->get()
|
||||||
|
->groupBy('platform');
|
||||||
|
|
||||||
|
$pdf = Pdf::loadView('rate-cards.pdf', compact('rateCards', 'profile'))
|
||||||
|
->setPaper('a4', 'portrait');
|
||||||
|
|
||||||
|
$filename = 'rate-card-' . now()->format('Y-m-d') . '.pdf';
|
||||||
|
|
||||||
|
return $pdf->download($filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
75
app/Models/BrandContract.php
Normal file
75
app/Models/BrandContract.php
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
|
|
||||||
|
class BrandContract extends Model
|
||||||
|
{
|
||||||
|
protected $fillable = [
|
||||||
|
'title', 'client_id', 'category_id',
|
||||||
|
'start_date', 'end_date', 'notes', 'is_active',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'start_date' => 'date',
|
||||||
|
'end_date' => 'date',
|
||||||
|
'is_active' => 'boolean',
|
||||||
|
];
|
||||||
|
|
||||||
|
// ── Relationships ────────────────────────────────────────────
|
||||||
|
|
||||||
|
public function client(): BelongsTo
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Client::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function category(): BelongsTo
|
||||||
|
{
|
||||||
|
return $this->belongsTo(ClientCategory::class, 'category_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── Scopes ───────────────────────────────────────────────────
|
||||||
|
|
||||||
|
public function scopeActive($query)
|
||||||
|
{
|
||||||
|
return $query->where('is_active', true)
|
||||||
|
->where('start_date', '<=', today())
|
||||||
|
->where('end_date', '>=', today());
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── Helpers ──────────────────────────────────────────────────
|
||||||
|
|
||||||
|
public function isCurrentlyActive(): bool
|
||||||
|
{
|
||||||
|
return $this->is_active
|
||||||
|
&& $this->start_date->lte(today())
|
||||||
|
&& $this->end_date->gte(today());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDaysRemainingAttribute(): int
|
||||||
|
{
|
||||||
|
return (int) max(0, today()->diffInDays($this->end_date, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getStatusLabelAttribute(): string
|
||||||
|
{
|
||||||
|
if (! $this->is_active) return 'Inactive';
|
||||||
|
if ($this->start_date->gt(today())) return 'Upcoming';
|
||||||
|
if ($this->end_date->lt(today())) return 'Expired';
|
||||||
|
return 'Active';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getStatusColorAttribute(): string
|
||||||
|
{
|
||||||
|
return match ($this->statusLabel) {
|
||||||
|
'Active' => 'badge-success',
|
||||||
|
'Upcoming' => 'badge-info',
|
||||||
|
'Expired' => 'badge-neutral',
|
||||||
|
default => 'badge-ghost',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,7 +15,7 @@ class ContentBrief extends Model
|
|||||||
use HasFactory, SoftDeletes;
|
use HasFactory, SoftDeletes;
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'client_id', 'title', 'platform', 'content_type', 'status',
|
'client_id', 'category_id', 'title', 'platform', 'content_type', 'status',
|
||||||
'hook', 'body', 'cta', 'script', 'caption', 'hashtags',
|
'hook', 'body', 'cta', 'script', 'caption', 'hashtags',
|
||||||
'target_date', 'posted_date', 'posted_url', 'sort_order', 'notes',
|
'target_date', 'posted_date', 'posted_url', 'sort_order', 'notes',
|
||||||
];
|
];
|
||||||
@@ -31,6 +31,11 @@ class ContentBrief extends Model
|
|||||||
return $this->belongsTo(Client::class);
|
return $this->belongsTo(Client::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function category(): BelongsTo
|
||||||
|
{
|
||||||
|
return $this->belongsTo(ClientCategory::class, 'category_id');
|
||||||
|
}
|
||||||
|
|
||||||
public function getPlatformIconAttribute(): string
|
public function getPlatformIconAttribute(): string
|
||||||
{
|
{
|
||||||
return match($this->platform) {
|
return match($this->platform) {
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class Event extends Model
|
|||||||
use HasFactory, SoftDeletes;
|
use HasFactory, SoftDeletes;
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'client_id', 'title', 'description', 'event_type',
|
'client_id', 'category_id', 'title', 'description', 'event_type',
|
||||||
'start_time', 'end_time', 'location', 'is_priority',
|
'start_time', 'end_time', 'location', 'is_priority',
|
||||||
'is_all_day', 'status', 'color', 'notes',
|
'is_all_day', 'status', 'color', 'notes',
|
||||||
];
|
];
|
||||||
@@ -33,6 +33,11 @@ class Event extends Model
|
|||||||
return $this->belongsTo(Client::class);
|
return $this->belongsTo(Client::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function category(): BelongsTo
|
||||||
|
{
|
||||||
|
return $this->belongsTo(ClientCategory::class, 'category_id');
|
||||||
|
}
|
||||||
|
|
||||||
public function scopeUpcoming($query, int $hours = 24)
|
public function scopeUpcoming($query, int $hours = 24)
|
||||||
{
|
{
|
||||||
return $query->where('start_time', '>=', now())
|
return $query->where('start_time', '>=', now())
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ namespace App\Models;
|
|||||||
|
|
||||||
use App\Enums\InvoiceStatus;
|
use App\Enums\InvoiceStatus;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
// InvoiceSettings used for number generation
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
@@ -19,7 +20,7 @@ class Invoice extends Model
|
|||||||
'client_id', 'invoice_number', 'title', 'description',
|
'client_id', 'invoice_number', 'title', 'description',
|
||||||
'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',
|
'bank_name', 'bank_account', 'bank_holder', 'branch_name',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
@@ -45,9 +46,15 @@ class Invoice extends Model
|
|||||||
|
|
||||||
public function recalculate(): void
|
public function recalculate(): void
|
||||||
{
|
{
|
||||||
|
// Total of all items (what the creator receives)
|
||||||
$this->subtotal = $this->items->sum('total');
|
$this->subtotal = $this->items->sum('total');
|
||||||
$this->tax_amount = round($this->subtotal * ($this->tax_rate / 100), 2);
|
|
||||||
$this->total = $this->subtotal + $this->tax_amount;
|
// Tax is calculated only on taxable items, but paid by the client on top
|
||||||
|
$taxableSubtotal = $this->items->where('is_taxable', true)->sum('total');
|
||||||
|
$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)
|
||||||
|
$this->total = $this->subtotal;
|
||||||
$this->save();
|
$this->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,8 +65,6 @@ class Invoice extends Model
|
|||||||
|
|
||||||
public static function generateNumber(): string
|
public static function generateNumber(): string
|
||||||
{
|
{
|
||||||
$prefix = 'INV-' . now()->format('Ym');
|
return InvoiceSettings::generateNumber();
|
||||||
$last = static::where('invoice_number', 'like', $prefix . '%')->count();
|
|
||||||
return $prefix . '-' . str_pad((string) ($last + 1), 3, '0', STR_PAD_LEFT);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,11 +9,12 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|||||||
|
|
||||||
class InvoiceItem extends Model
|
class InvoiceItem extends Model
|
||||||
{
|
{
|
||||||
protected $fillable = ['invoice_id', 'description', 'quantity', 'unit_price', 'total'];
|
protected $fillable = ['invoice_id', 'description', 'quantity', 'unit_price', 'total', 'is_taxable'];
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'unit_price' => 'decimal:2',
|
'unit_price' => 'decimal:2',
|
||||||
'total' => 'decimal:2',
|
'total' => 'decimal:2',
|
||||||
|
'is_taxable' => 'boolean',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function invoice(): BelongsTo
|
public function invoice(): BelongsTo
|
||||||
|
|||||||
54
app/Models/InvoiceSettings.php
Normal file
54
app/Models/InvoiceSettings.php
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class InvoiceSettings extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'invoice_settings';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'invoice_prefix',
|
||||||
|
'invoice_next_number',
|
||||||
|
'header_name',
|
||||||
|
'header_title',
|
||||||
|
'header_logo',
|
||||||
|
'default_tax_rate',
|
||||||
|
'default_currency',
|
||||||
|
'default_service_description',
|
||||||
|
'default_bank_name',
|
||||||
|
'default_branch_name',
|
||||||
|
'default_bank_account',
|
||||||
|
'default_bank_holder',
|
||||||
|
'default_notes',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'invoice_next_number' => 'integer',
|
||||||
|
'default_tax_rate' => 'decimal:2',
|
||||||
|
];
|
||||||
|
|
||||||
|
/** Always return the single settings row, creating it if absent. */
|
||||||
|
public static function instance(): self
|
||||||
|
{
|
||||||
|
return static::firstOrCreate([], [
|
||||||
|
'invoice_prefix' => 'INV',
|
||||||
|
'invoice_next_number' => 1,
|
||||||
|
'default_tax_rate' => 11,
|
||||||
|
'default_currency' => 'IDR',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Generate the next invoice number and increment the counter. */
|
||||||
|
public static function generateNumber(): string
|
||||||
|
{
|
||||||
|
$settings = static::instance();
|
||||||
|
$prefix = rtrim($settings->invoice_prefix, '-');
|
||||||
|
$number = str_pad((string) $settings->invoice_next_number, 3, '0', STR_PAD_LEFT);
|
||||||
|
$settings->increment('invoice_next_number');
|
||||||
|
return $prefix . '-' . $number;
|
||||||
|
}
|
||||||
|
}
|
||||||
47
app/Models/RateCardProfile.php
Normal file
47
app/Models/RateCardProfile.php
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class RateCardProfile extends Model
|
||||||
|
{
|
||||||
|
protected $fillable = [
|
||||||
|
'owner_name', 'tagline', 'whatsapp',
|
||||||
|
'ig_handle', 'tiktok_handle', 'youtube_handle', 'email',
|
||||||
|
'logo_path', 'bg_color', 'accent_color', 'text_color',
|
||||||
|
'custom_footer', 'show_prices', 'access_token',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'show_prices' => 'boolean',
|
||||||
|
];
|
||||||
|
|
||||||
|
/** Get the singleton profile, creating defaults if needed */
|
||||||
|
public static function getSingleton(): self
|
||||||
|
{
|
||||||
|
return static::firstOrCreate([], [
|
||||||
|
'owner_name' => config('app.name', 'KOL Manager'),
|
||||||
|
'bg_color' => '#FFF8F0',
|
||||||
|
'accent_color' => '#FFB7C5',
|
||||||
|
'text_color' => '#374151',
|
||||||
|
'show_prices' => true,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getWhatsappUrlAttribute(): ?string
|
||||||
|
{
|
||||||
|
if (! $this->whatsapp) return null;
|
||||||
|
$number = preg_replace('/[^0-9]/', '', $this->whatsapp);
|
||||||
|
return "https://wa.me/{$number}";
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLogoUrlAttribute(): ?string
|
||||||
|
{
|
||||||
|
return $this->logo_path
|
||||||
|
? route('files.serve-profile-logo')
|
||||||
|
: null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,10 +4,13 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Services;
|
namespace App\Services;
|
||||||
|
|
||||||
|
use App\Models\BrandContract;
|
||||||
use App\Models\Client;
|
use App\Models\Client;
|
||||||
|
use App\Models\ClientCategory;
|
||||||
use App\Models\ContentBrief;
|
use App\Models\ContentBrief;
|
||||||
use App\Models\Event;
|
use App\Models\Event;
|
||||||
use App\Models\Invoice;
|
use App\Models\Invoice;
|
||||||
|
use App\Models\MediaFile;
|
||||||
use App\Models\SocialStat;
|
use App\Models\SocialStat;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
|
|
||||||
@@ -22,6 +25,11 @@ final class DashboardService
|
|||||||
'pending_invoices' => Invoice::where('status', 'sent')->count(),
|
'pending_invoices' => Invoice::where('status', 'sent')->count(),
|
||||||
'total_revenue' => Invoice::where('status', 'paid')->sum('total'),
|
'total_revenue' => Invoice::where('status', 'paid')->sum('total'),
|
||||||
'content_in_progress' => ContentBrief::whereNotIn('status', ['posted', 'archived'])->count(),
|
'content_in_progress' => ContentBrief::whereNotIn('status', ['posted', 'archived'])->count(),
|
||||||
|
'total_categories' => ClientCategory::whereNull('parent_id')->count(),
|
||||||
|
'total_subcategories' => ClientCategory::whereNotNull('parent_id')->count(),
|
||||||
|
'total_files' => MediaFile::count(),
|
||||||
|
'active_contracts' => BrandContract::where('is_active', true)->where('end_date', '>=', today())->count(),
|
||||||
|
'total_contracts' => BrandContract::count(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ namespace App\Services;
|
|||||||
|
|
||||||
use App\Models\Invoice;
|
use App\Models\Invoice;
|
||||||
use App\Models\InvoiceItem;
|
use App\Models\InvoiceItem;
|
||||||
|
use App\Models\InvoiceSettings;
|
||||||
use Barryvdh\DomPDF\Facade\Pdf;
|
use Barryvdh\DomPDF\Facade\Pdf;
|
||||||
use Illuminate\Http\Response;
|
use Illuminate\Http\Response;
|
||||||
|
|
||||||
@@ -23,6 +24,7 @@ final class InvoiceService
|
|||||||
|
|
||||||
foreach ($items as $item) {
|
foreach ($items as $item) {
|
||||||
$item['total'] = $item['quantity'] * $item['unit_price'];
|
$item['total'] = $item['quantity'] * $item['unit_price'];
|
||||||
|
$item['is_taxable'] = isset($item['is_taxable']) && $item['is_taxable'] ? true : false;
|
||||||
$invoice->items()->create($item);
|
$invoice->items()->create($item);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,6 +40,7 @@ final class InvoiceService
|
|||||||
|
|
||||||
foreach ($items as $item) {
|
foreach ($items as $item) {
|
||||||
$item['total'] = $item['quantity'] * $item['unit_price'];
|
$item['total'] = $item['quantity'] * $item['unit_price'];
|
||||||
|
$item['is_taxable'] = isset($item['is_taxable']) && $item['is_taxable'] ? true : false;
|
||||||
$invoice->items()->create($item);
|
$invoice->items()->create($item);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,8 +52,9 @@ final class InvoiceService
|
|||||||
public function generatePdf(Invoice $invoice): Response
|
public function generatePdf(Invoice $invoice): Response
|
||||||
{
|
{
|
||||||
$invoice->load('client', 'items');
|
$invoice->load('client', 'items');
|
||||||
|
$invoiceSettings = InvoiceSettings::instance();
|
||||||
|
|
||||||
$pdf = Pdf::loadView('invoices.pdf', compact('invoice'));
|
$pdf = Pdf::loadView('invoices.pdf', compact('invoice', 'invoiceSettings'));
|
||||||
$pdf->setPaper('A4', 'portrait');
|
$pdf->setPaper('A4', 'portrait');
|
||||||
|
|
||||||
return $pdf->download("invoice-{$invoice->invoice_number}.pdf");
|
return $pdf->download("invoice-{$invoice->invoice_number}.pdf");
|
||||||
|
|||||||
@@ -31,25 +31,32 @@ class WahaNotifier
|
|||||||
private function send(NotificationSetting $setting, string $text): void
|
private function send(NotificationSetting $setting, string $text): void
|
||||||
{
|
{
|
||||||
$config = $setting->config ?? [];
|
$config = $setting->config ?? [];
|
||||||
$url = rtrim($config['waha_url'] ?? '', '/');
|
$endpoint = $config['waha_endpoint'] ?? null;
|
||||||
$session = $config['waha_session'] ?? 'default';
|
$session = $config['waha_session'] ?? 'default';
|
||||||
$phone = $config['phone'] ?? null;
|
$chatId = $config['chat_id'] ?? null;
|
||||||
|
$apiKey = $config['api_key'] ?? null;
|
||||||
|
|
||||||
if (! $url || ! $phone) {
|
if (! $endpoint || ! $chatId) {
|
||||||
throw new \RuntimeException('WAHA waha_url and phone are required.');
|
throw new \RuntimeException('WAHA waha_endpoint and chat_id are required.');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Normalise phone: strip non-digits, ensure no leading +
|
$http = Http::timeout(15)->acceptJson()->contentType('application/json');
|
||||||
$chatId = preg_replace('/[^0-9]/', '', $phone) . '@c.us';
|
|
||||||
|
|
||||||
$response = Http::timeout(15)->post("{$url}/api/sendText", [
|
if ($apiKey) {
|
||||||
'session' => $session,
|
$http = $http->withHeaders(['X-Api-Key' => $apiKey]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$response = $http->post($endpoint, [
|
||||||
'chatId' => $chatId,
|
'chatId' => $chatId,
|
||||||
'text' => $text,
|
'text' => $text,
|
||||||
|
'session' => $session,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (! $response->successful()) {
|
if (! $response->successful()) {
|
||||||
throw new \RuntimeException('WAHA API error: ' . $response->body());
|
$keyHint = $apiKey ? '(api_key set, length=' . strlen($apiKey) . ')' : '(no api_key)';
|
||||||
|
throw new \RuntimeException(
|
||||||
|
"WAHA API error {$response->status()} {$keyHint} → " . $response->body()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('events', function (Blueprint $table): void {
|
||||||
|
$table->unsignedBigInteger('category_id')->nullable()->after('client_id');
|
||||||
|
$table->foreign('category_id')
|
||||||
|
->references('id')->on('client_categories')->onDelete('set null');
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::table('content_briefs', function (Blueprint $table): void {
|
||||||
|
$table->unsignedBigInteger('category_id')->nullable()->after('client_id');
|
||||||
|
$table->foreign('category_id')
|
||||||
|
->references('id')->on('client_categories')->onDelete('set null');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('events', function (Blueprint $table): void {
|
||||||
|
$table->dropForeign(['category_id']);
|
||||||
|
$table->dropColumn('category_id');
|
||||||
|
});
|
||||||
|
Schema::table('content_briefs', function (Blueprint $table): void {
|
||||||
|
$table->dropForeign(['category_id']);
|
||||||
|
$table->dropColumn('category_id');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('brand_contracts', function (Blueprint $table): void {
|
||||||
|
$table->id();
|
||||||
|
$table->string('title');
|
||||||
|
$table->unsignedBigInteger('client_id')->nullable(); // the contracted brand
|
||||||
|
$table->unsignedBigInteger('category_id')->nullable(); // the exclusive category
|
||||||
|
$table->date('start_date');
|
||||||
|
$table->date('end_date');
|
||||||
|
$table->text('notes')->nullable();
|
||||||
|
$table->boolean('is_active')->default(true);
|
||||||
|
$table->timestamps();
|
||||||
|
|
||||||
|
$table->foreign('client_id')->references('id')->on('clients')->onDelete('set null');
|
||||||
|
$table->foreign('category_id')->references('id')->on('client_categories')->onDelete('set null');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('brand_contracts');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('rate_card_profiles', function (Blueprint $table): void {
|
||||||
|
$table->id();
|
||||||
|
$table->string('owner_name')->default('KOL Manager');
|
||||||
|
$table->string('tagline')->nullable();
|
||||||
|
$table->string('whatsapp')->nullable();
|
||||||
|
$table->string('ig_handle')->nullable();
|
||||||
|
$table->string('tiktok_handle')->nullable();
|
||||||
|
$table->string('youtube_handle')->nullable();
|
||||||
|
$table->string('email')->nullable();
|
||||||
|
$table->string('logo_path')->nullable(); // uploaded image
|
||||||
|
$table->string('bg_color')->default('#FFF8F0');
|
||||||
|
$table->string('accent_color')->default('#FFB7C5');
|
||||||
|
$table->string('text_color')->default('#374151');
|
||||||
|
$table->text('custom_footer')->nullable();
|
||||||
|
$table->boolean('show_prices')->default(true);
|
||||||
|
$table->string('access_token')->nullable(); // optional: require ?token=xxx
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('rate_card_profiles');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
// Add branch_name to invoices
|
||||||
|
Schema::table('invoices', function (Blueprint $table): void {
|
||||||
|
$table->string('branch_name')->nullable()->after('bank_holder');
|
||||||
|
});
|
||||||
|
|
||||||
|
// Add is_taxable to invoice_items
|
||||||
|
Schema::table('invoice_items', function (Blueprint $table): void {
|
||||||
|
$table->boolean('is_taxable')->default(true)->after('total');
|
||||||
|
});
|
||||||
|
|
||||||
|
// Invoice settings singleton table
|
||||||
|
Schema::create('invoice_settings', function (Blueprint $table): void {
|
||||||
|
$table->id();
|
||||||
|
$table->string('invoice_prefix')->default('INV');
|
||||||
|
$table->unsignedInteger('invoice_next_number')->default(1);
|
||||||
|
$table->string('header_name')->nullable(); // talent name
|
||||||
|
$table->string('header_title')->nullable(); // subtitle / tagline
|
||||||
|
$table->string('header_logo')->nullable(); // stored path
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('invoice_settings');
|
||||||
|
Schema::table('invoice_items', function (Blueprint $table): void {
|
||||||
|
$table->dropColumn('is_taxable');
|
||||||
|
});
|
||||||
|
Schema::table('invoices', function (Blueprint $table): void {
|
||||||
|
$table->dropColumn('branch_name');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('invoice_settings', function (Blueprint $table): void {
|
||||||
|
$table->decimal('default_tax_rate', 5, 2)->default(11)->after('header_logo');
|
||||||
|
$table->string('default_currency')->default('IDR')->after('default_tax_rate');
|
||||||
|
$table->string('default_service_description')->nullable()->after('default_currency');
|
||||||
|
$table->string('default_bank_name')->nullable()->after('default_service_description');
|
||||||
|
$table->string('default_branch_name')->nullable()->after('default_bank_name');
|
||||||
|
$table->string('default_bank_account')->nullable()->after('default_branch_name');
|
||||||
|
$table->string('default_bank_holder')->nullable()->after('default_bank_account');
|
||||||
|
$table->text('default_notes')->nullable()->after('default_bank_holder');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('invoice_settings', function (Blueprint $table): void {
|
||||||
|
$table->dropColumn([
|
||||||
|
'default_tax_rate', 'default_currency',
|
||||||
|
'default_service_description',
|
||||||
|
'default_bank_name', 'default_branch_name',
|
||||||
|
'default_bank_account', 'default_bank_holder', 'default_notes',
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -115,6 +115,40 @@ aside {
|
|||||||
}
|
}
|
||||||
.paw-bounce { animation: paw-bounce 0.4s ease-in-out; }
|
.paw-bounce { animation: paw-bounce 0.4s ease-in-out; }
|
||||||
|
|
||||||
|
/* ── Label Soft ───────────────────────────────────────────── */
|
||||||
|
.label-soft {
|
||||||
|
@apply block text-xs font-semibold text-gray-600 mb-1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Select Soft ──────────────────────────────────────────── */
|
||||||
|
.select-soft {
|
||||||
|
@apply rounded-2xl border border-pink-200 px-4 py-2
|
||||||
|
focus:border-pink-400 focus:outline-none focus:ring-2 focus:ring-pink-200
|
||||||
|
w-full bg-white text-sm;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Btn Pink (alias for btn-sakura) ─────────────────────── */
|
||||||
|
.btn-pink {
|
||||||
|
@apply rounded-full text-white font-semibold shadow-sm
|
||||||
|
transition-all duration-150 inline-block cursor-pointer text-center;
|
||||||
|
background-color: #FFB7C5;
|
||||||
|
border: none;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
.btn-pink:hover { background-color: #FF8FAD; }
|
||||||
|
.btn-pink:active { transform: scale(0.96); }
|
||||||
|
|
||||||
|
/* ── Badge Soft ───────────────────────────────────────────── */
|
||||||
|
.badge-soft { @apply badge badge-ghost; }
|
||||||
|
|
||||||
|
/* ── Cat Card Header ──────────────────────────────────────── */
|
||||||
|
.cat-card-header {
|
||||||
|
@apply flex items-center gap-3 px-4 py-3 border-b border-pink-50;
|
||||||
|
}
|
||||||
|
.cat-card-icon {
|
||||||
|
@apply text-xl shrink-0;
|
||||||
|
}
|
||||||
|
|
||||||
/* ── Mobile touch targets ─────────────────────────────────── */
|
/* ── Mobile touch targets ─────────────────────────────────── */
|
||||||
@media (max-width: 1023px) {
|
@media (max-width: 1023px) {
|
||||||
.nav-item { @apply py-3.5; }
|
.nav-item { @apply py-3.5; }
|
||||||
|
|||||||
213
resources/views/categories/index.blade.php
Normal file
213
resources/views/categories/index.blade.php
Normal file
@@ -0,0 +1,213 @@
|
|||||||
|
@extends('layouts.app')
|
||||||
|
@section('title', 'Categories')
|
||||||
|
@section('page-title', '🏷️ Category Management')
|
||||||
|
@section('page-subtitle', 'Organise clients, schedules & content by category')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<div class="max-w-4xl mx-auto space-y-5">
|
||||||
|
|
||||||
|
@if(session('success'))
|
||||||
|
<div x-data="{ show: true }" x-show="show" x-init="setTimeout(() => show = false, 4000)"
|
||||||
|
class="flex items-center justify-between gap-3 bg-green-50 border border-green-200 rounded-2xl px-4 py-3 text-sm text-green-700">
|
||||||
|
<span>{{ session('success') }}</span>
|
||||||
|
<button @click="show = false" class="text-green-500 hover:text-green-700 text-lg leading-none">✕</button>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
{{-- Add form --}}
|
||||||
|
<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">Add New Category</h2>
|
||||||
|
</div>
|
||||||
|
<form action="{{ route('client-categories.store') }}" method="POST"
|
||||||
|
class="p-5 grid grid-cols-2 sm:grid-cols-4 gap-3 items-end">
|
||||||
|
@csrf
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Name <span class="text-pink-400">*</span></label>
|
||||||
|
<input type="text" name="name" required maxlength="100"
|
||||||
|
placeholder="e.g. Energy Drinks"
|
||||||
|
class="input-soft" value="{{ old('name') }}">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Parent (optional)</label>
|
||||||
|
<select name="parent_id" class="input-soft">
|
||||||
|
<option value="">— Root category —</option>
|
||||||
|
@foreach($parents as $p)
|
||||||
|
<option value="{{ $p->id }}" {{ old('parent_id') == $p->id ? 'selected' : '' }}>
|
||||||
|
{{ $p->icon }} {{ $p->name }}
|
||||||
|
</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Icon (emoji)</label>
|
||||||
|
<input type="text" name="icon" maxlength="10" placeholder="🏷️"
|
||||||
|
class="input-soft" value="{{ old('icon') }}">
|
||||||
|
</div>
|
||||||
|
<div class="flex items-end gap-2">
|
||||||
|
<div class="flex-1">
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Color</label>
|
||||||
|
<input type="color" name="color" value="{{ old('color', '#FFB7C5') }}"
|
||||||
|
class="w-full h-[42px] rounded-2xl border border-pink-200 cursor-pointer p-1 bg-white">
|
||||||
|
</div>
|
||||||
|
<button type="submit" class="btn-sakura px-4 py-2.5 shrink-0 text-sm">Add</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- List --}}
|
||||||
|
<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">All Categories</h2>
|
||||||
|
<span class="ml-auto text-xs bg-pink-100 text-pink-600 font-semibold px-2.5 py-0.5 rounded-full">
|
||||||
|
{{ $categories->count() }} total
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@php $roots = $categories->whereNull('parent_id'); @endphp
|
||||||
|
|
||||||
|
@forelse($roots as $root)
|
||||||
|
<div x-data="{ editing: false }" class="border-b border-pink-50 last:border-0">
|
||||||
|
{{-- Root row --}}
|
||||||
|
<div class="flex items-center gap-3 px-5 py-3 hover:bg-pink-50/40 transition-colors">
|
||||||
|
<span class="text-xl w-7 text-center shrink-0">{{ $root->icon ?: '🏷️' }}</span>
|
||||||
|
@if($root->color)
|
||||||
|
<span class="w-3 h-3 rounded-full shrink-0" style="background:{{ $root->color }}"></span>
|
||||||
|
@endif
|
||||||
|
<div class="flex-1 min-w-0">
|
||||||
|
<div class="font-semibold text-gray-700 text-sm">{{ $root->name }}</div>
|
||||||
|
<div class="text-xs text-gray-400">{{ $root->children->count() }} sub · {{ $root->clients_count }} client(s)</div>
|
||||||
|
</div>
|
||||||
|
<div class="flex gap-2 shrink-0">
|
||||||
|
<button @click="editing = !editing"
|
||||||
|
class="text-xs px-3 py-1.5 rounded-full border border-blue-200 text-blue-500 hover:bg-blue-50">
|
||||||
|
✏️ Edit
|
||||||
|
</button>
|
||||||
|
@unless($root->is_system)
|
||||||
|
<form action="{{ route('client-categories.destroy', $root) }}" method="POST"
|
||||||
|
onsubmit="return confirm('Remove this category? Its children will be promoted.')">
|
||||||
|
@csrf @method('DELETE')
|
||||||
|
<button class="text-xs px-3 py-1.5 rounded-full border border-red-100 text-red-400 hover:bg-red-50">
|
||||||
|
🗑️
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
@endunless
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Edit form --}}
|
||||||
|
<div x-show="editing" x-transition style="display:none"
|
||||||
|
class="px-5 py-4 bg-pink-50/30 border-t border-pink-50">
|
||||||
|
<form action="{{ route('client-categories.update', $root) }}" method="POST"
|
||||||
|
class="grid grid-cols-2 sm:grid-cols-4 gap-3 items-end">
|
||||||
|
@csrf @method('PUT')
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Name</label>
|
||||||
|
<input type="text" name="name" required value="{{ $root->name }}" class="input-soft">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Parent</label>
|
||||||
|
<select name="parent_id" class="input-soft">
|
||||||
|
<option value="">— Root —</option>
|
||||||
|
@foreach($parents as $p)
|
||||||
|
@if($p->id !== $root->id)
|
||||||
|
<option value="{{ $p->id }}" {{ $root->parent_id == $p->id ? 'selected' : '' }}>
|
||||||
|
{{ $p->icon }} {{ $p->name }}
|
||||||
|
</option>
|
||||||
|
@endif
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Icon</label>
|
||||||
|
<input type="text" name="icon" value="{{ $root->icon }}" maxlength="10" class="input-soft">
|
||||||
|
</div>
|
||||||
|
<div class="flex items-end gap-2">
|
||||||
|
<div class="flex-1">
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Color</label>
|
||||||
|
<input type="color" name="color" value="{{ $root->color ?: '#FFB7C5' }}"
|
||||||
|
class="w-full h-[42px] rounded-2xl border border-pink-200 cursor-pointer p-1 bg-white">
|
||||||
|
</div>
|
||||||
|
<button type="submit" class="btn-sakura px-3 py-2.5 text-sm shrink-0">Save</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Children --}}
|
||||||
|
@foreach($root->children as $child)
|
||||||
|
<div x-data="{ editingC: false }">
|
||||||
|
<div class="flex items-center gap-3 px-5 py-2.5 pl-12 border-t border-pink-50/60 hover:bg-pink-50/20 transition-colors">
|
||||||
|
<span class="text-base w-6 text-center shrink-0">{{ $child->icon ?: '↳' }}</span>
|
||||||
|
@if($child->color)
|
||||||
|
<span class="w-2.5 h-2.5 rounded-full shrink-0" style="background:{{ $child->color }}"></span>
|
||||||
|
@endif
|
||||||
|
<div class="flex-1 min-w-0">
|
||||||
|
<div class="text-sm font-medium text-gray-600">↳ {{ $child->name }}</div>
|
||||||
|
<div class="text-xs text-gray-400">{{ $child->clients_count }} client(s)</div>
|
||||||
|
</div>
|
||||||
|
<div class="flex gap-2 shrink-0">
|
||||||
|
<button @click="editingC = !editingC"
|
||||||
|
class="text-xs px-2.5 py-1 rounded-full border border-blue-200 text-blue-500 hover:bg-blue-50">
|
||||||
|
✏️
|
||||||
|
</button>
|
||||||
|
@unless($child->is_system)
|
||||||
|
<form action="{{ route('client-categories.destroy', $child) }}" method="POST"
|
||||||
|
onsubmit="return confirm('Remove subcategory?')">
|
||||||
|
@csrf @method('DELETE')
|
||||||
|
<button class="text-xs px-2.5 py-1 rounded-full border border-red-100 text-red-400 hover:bg-red-50">
|
||||||
|
🗑️
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
@endunless
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div x-show="editingC" x-transition style="display:none"
|
||||||
|
class="px-5 py-4 pl-12 bg-pink-50/20 border-t border-pink-50/60">
|
||||||
|
<form action="{{ route('client-categories.update', $child) }}" method="POST"
|
||||||
|
class="grid grid-cols-2 sm:grid-cols-4 gap-3 items-end">
|
||||||
|
@csrf @method('PUT')
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Name</label>
|
||||||
|
<input type="text" name="name" required value="{{ $child->name }}" class="input-soft">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Parent</label>
|
||||||
|
<select name="parent_id" class="input-soft">
|
||||||
|
<option value="">— Root —</option>
|
||||||
|
@foreach($parents as $p)
|
||||||
|
@if($p->id !== $child->id)
|
||||||
|
<option value="{{ $p->id }}" {{ $child->parent_id == $p->id ? 'selected' : '' }}>
|
||||||
|
{{ $p->icon }} {{ $p->name }}
|
||||||
|
</option>
|
||||||
|
@endif
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Icon</label>
|
||||||
|
<input type="text" name="icon" value="{{ $child->icon }}" maxlength="10" class="input-soft">
|
||||||
|
</div>
|
||||||
|
<div class="flex items-end gap-2">
|
||||||
|
<div class="flex-1">
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Color</label>
|
||||||
|
<input type="color" name="color" value="{{ $child->color ?: '#FFB7C5' }}"
|
||||||
|
class="w-full h-[42px] rounded-2xl border border-pink-200 cursor-pointer p-1 bg-white">
|
||||||
|
</div>
|
||||||
|
<button type="submit" class="btn-sakura px-3 py-2.5 text-sm shrink-0">Save</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endforeach
|
||||||
|
</div>
|
||||||
|
@empty
|
||||||
|
<div class="text-center py-14 text-gray-400">
|
||||||
|
<div class="text-4xl mb-2">🏷️</div>
|
||||||
|
<p class="text-sm">No categories yet. Add your first one above.</p>
|
||||||
|
</div>
|
||||||
|
@endforelse
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
@@ -6,20 +6,47 @@
|
|||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
|
|
||||||
{{-- ── Filters bar ─────────────────────────────────────────── --}}
|
{{-- ── Toolbar + collapsible filter ───────────────────────── --}}
|
||||||
<div class="flex flex-col gap-3 mb-5">
|
<div x-data="{ open: {{ request('category') || request('status') ? 'true' : 'false' }} }">
|
||||||
<div class="flex flex-col sm:flex-row sm:items-center gap-3">
|
|
||||||
{{-- Local text filter --}}
|
<div class="flex items-center justify-between gap-2 mb-3">
|
||||||
<div class="relative flex-1 max-w-xs">
|
<div class="flex items-center gap-2">
|
||||||
<span class="absolute left-3 top-2.5 text-gray-400 text-sm">🔍</span>
|
<a href="{{ route('clients.create') }}" class="btn-sakura text-sm">+ Add</a>
|
||||||
<input type="text" placeholder="Filter by name…" class="input-soft pl-9 text-sm"
|
@if(request('category') || request('status'))
|
||||||
|
<a href="{{ route('clients.index') }}"
|
||||||
|
class="text-xs px-3 py-2 rounded-full border border-gray-200 text-gray-500 hover:bg-gray-50 flex items-center gap-1">
|
||||||
|
✕ Clear filters
|
||||||
|
</a>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
<button @click="open = !open"
|
||||||
|
class="flex items-center gap-1.5 text-xs px-3 py-2 rounded-full border transition-colors"
|
||||||
|
:class="open ? 'border-pink-300 bg-pink-50 text-pink-600' : 'border-gray-200 text-gray-500 hover:bg-gray-50'">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" class="w-3.5 h-3.5" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" d="M3 4h18M7 10h10M11 16h2"/>
|
||||||
|
</svg>
|
||||||
|
Filter
|
||||||
|
@if(request('category') || request('status'))
|
||||||
|
<span class="w-2 h-2 rounded-full bg-pink-400 inline-block ml-0.5"></span>
|
||||||
|
@endif
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- ── Filters panel (collapsible) ────────────────────────── --}}
|
||||||
|
<div x-show="open" x-transition.duration.150ms>
|
||||||
|
<form method="GET" action="{{ route('clients.index') }}" id="filter-form" class="cat-card p-3 mb-4">
|
||||||
|
{{-- Row 1: search + dropdowns --}}
|
||||||
|
<div class="flex flex-col sm:flex-row sm:items-center gap-2">
|
||||||
|
{{-- Search (fills remaining space on desktop) --}}
|
||||||
|
<div class="relative flex-1 min-w-0">
|
||||||
|
<span class="absolute left-3 top-1/2 -translate-y-1/2 text-gray-400 text-sm pointer-events-none">🔍</span>
|
||||||
|
<input type="text" placeholder="Filter by name…" class="input-soft pl-9 text-sm py-2 w-full"
|
||||||
oninput="filterClients(this.value)" id="search-input">
|
oninput="filterClients(this.value)" id="search-input">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{-- Category filter --}}
|
{{-- Category dropdown --}}
|
||||||
<form method="GET" action="{{ route('clients.index') }}" class="flex flex-wrap gap-2 items-center" id="filter-form">
|
<select name="category" class="input-soft text-sm py-2 sm:w-48 shrink-0"
|
||||||
<select name="category" class="input-soft text-sm py-2"
|
onchange="this.form.submit()">
|
||||||
onchange="document.getElementById('filter-form').submit()">
|
|
||||||
<option value="">All Categories</option>
|
<option value="">All Categories</option>
|
||||||
@foreach($categories as $parent)
|
@foreach($categories as $parent)
|
||||||
<option value="{{ $parent->id }}"
|
<option value="{{ $parent->id }}"
|
||||||
@@ -29,14 +56,15 @@
|
|||||||
@foreach($parent->children as $child)
|
@foreach($parent->children as $child)
|
||||||
<option value="{{ $child->id }}"
|
<option value="{{ $child->id }}"
|
||||||
{{ request('category') == $child->id ? 'selected' : '' }}>
|
{{ request('category') == $child->id ? 'selected' : '' }}>
|
||||||
↳ {{ $child->icon }} {{ $child->name }}
|
↳ {{ $child->name }}
|
||||||
</option>
|
</option>
|
||||||
@endforeach
|
@endforeach
|
||||||
@endforeach
|
@endforeach
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select name="status" class="input-soft text-sm py-2"
|
{{-- Status dropdown --}}
|
||||||
onchange="document.getElementById('filter-form').submit()">
|
<select name="status" class="input-soft text-sm py-2 sm:w-36 shrink-0"
|
||||||
|
onchange="this.form.submit()">
|
||||||
<option value="">All Statuses</option>
|
<option value="">All Statuses</option>
|
||||||
@foreach($statuses as $s)
|
@foreach($statuses as $s)
|
||||||
<option value="{{ $s->value }}" {{ request('status') === $s->value ? 'selected' : '' }}>
|
<option value="{{ $s->value }}" {{ request('status') === $s->value ? 'selected' : '' }}>
|
||||||
@@ -44,32 +72,11 @@
|
|||||||
</option>
|
</option>
|
||||||
@endforeach
|
@endforeach
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@if(request('category') || request('status'))
|
|
||||||
<a href="{{ route('clients.index') }}" class="text-xs text-gray-400 hover:text-gray-600">✕ Clear</a>
|
|
||||||
@endif
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<a href="{{ route('clients.create') }}" class="btn-sakura text-sm text-center shrink-0">+ Add Client</a>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{-- Category pills (top-level only) --}}
|
</form>
|
||||||
<div class="flex gap-2 overflow-x-auto pb-1 -mx-4 px-4 lg:mx-0 lg:px-0">
|
|
||||||
<a href="{{ route('clients.index') }}"
|
|
||||||
class="shrink-0 text-xs px-3 py-1.5 rounded-full font-semibold transition-colors
|
|
||||||
{{ ! request('category') ? 'bg-pink-400 text-white' : 'bg-white border border-pink-200 text-gray-600 hover:bg-pink-50' }}">
|
|
||||||
All
|
|
||||||
</a>
|
|
||||||
@foreach($categories as $cat)
|
|
||||||
<a href="{{ route('clients.index', ['category' => $cat->id, 'status' => request('status')]) }}"
|
|
||||||
class="shrink-0 text-xs px-3 py-1.5 rounded-full font-semibold transition-colors whitespace-nowrap
|
|
||||||
{{ request('category') == $cat->id ? 'bg-pink-400 text-white' : 'bg-white border border-pink-200 text-gray-600 hover:bg-pink-50' }}"
|
|
||||||
style="{{ request('category') == $cat->id ? '' : 'border-color:' . $cat->color }}">
|
|
||||||
{{ $cat->icon }} {{ $cat->name }}
|
|
||||||
</a>
|
|
||||||
@endforeach
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>{{-- end x-data --}}
|
||||||
|
|
||||||
{{-- ── Client grid ─────────────────────────────────────────── --}}
|
{{-- ── Client grid ─────────────────────────────────────────── --}}
|
||||||
<div class="grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-3 gap-4" id="clients-grid">
|
<div class="grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-3 gap-4" id="clients-grid">
|
||||||
@@ -135,11 +142,12 @@
|
|||||||
class="flex-1 text-center text-xs py-1.5 px-3 rounded-full border border-pink-200 text-gray-600 hover:bg-pink-50">
|
class="flex-1 text-center text-xs py-1.5 px-3 rounded-full border border-pink-200 text-gray-600 hover:bg-pink-50">
|
||||||
Edit
|
Edit
|
||||||
</a>
|
</a>
|
||||||
|
{{-- Share button disabled --}}
|
||||||
<form action="{{ route('clients.destroy', $client) }}" method="POST"
|
<form action="{{ route('clients.destroy', $client) }}" method="POST"
|
||||||
onsubmit="return confirm('Remove this client?')">
|
onsubmit="return confirm('Remove this client?')">
|
||||||
@csrf @method('DELETE')
|
@csrf @method('DELETE')
|
||||||
<button class="text-xs py-1.5 px-3 rounded-full border border-red-100 text-red-400 hover:bg-red-50">
|
<button class="text-xs py-1.5 px-3 rounded-full border border-red-100 text-red-400 hover:bg-red-50">
|
||||||
Del
|
✕
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -6,8 +6,9 @@
|
|||||||
@section('content')
|
@section('content')
|
||||||
<div class="max-w-2xl mx-auto">
|
<div class="max-w-2xl mx-auto">
|
||||||
<div class="cat-card p-4 lg:p-8">
|
<div class="cat-card p-4 lg:p-8">
|
||||||
<form action="{{ route('content.store') }}" method="POST" class="space-y-4">
|
<form action="{{ route('content.store') }}" method="POST" class="space-y-4"
|
||||||
@csrf
|
x-data="contractCheck('{{ route('contracts.check') }}')"
|
||||||
|
@submit.prevent="submitIfClear($el)">
|
||||||
|
|
||||||
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3">
|
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3">
|
||||||
<div class="sm:col-span-2">
|
<div class="sm:col-span-2">
|
||||||
@@ -40,19 +41,38 @@
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label class="block text-sm font-semibold text-gray-700 mb-1">Client</label>
|
<label class="block text-sm font-semibold text-gray-700 mb-1">Client</label>
|
||||||
<select name="client_id" class="input-soft">
|
<select name="client_id" class="input-soft" x-model="clientId" @change="checkContract()">
|
||||||
<option value="">— None —</option>
|
<option value="">— None —</option>
|
||||||
@foreach($clients as $client)
|
@foreach($clients as $client)
|
||||||
<option value="{{ $client->id }}">{{ $client->name }}</option>
|
<option value="{{ $client->id }}">{{ $client->name }}</option>
|
||||||
@endforeach
|
@endforeach
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-sm font-semibold text-gray-700 mb-1">Category</label>
|
||||||
|
<select name="category_id" class="input-soft" x-model="categoryId" @change="checkContract()">
|
||||||
|
<option value="">— None —</option>
|
||||||
|
@foreach($categoryTree as $parent)
|
||||||
|
<option value="{{ $parent->id }}">{{ $parent->icon }} {{ $parent->name }}</option>
|
||||||
|
@foreach($parent->children as $child)
|
||||||
|
<option value="{{ $child->id }}"> ↳ {{ $child->name }}</option>
|
||||||
|
@endforeach
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label class="block text-sm font-semibold text-gray-700 mb-1">Target Date</label>
|
<label class="block text-sm font-semibold text-gray-700 mb-1">Target Date</label>
|
||||||
<input type="date" name="target_date" value="{{ old('target_date') }}" class="input-soft">
|
<input type="date" name="target_date" value="{{ old('target_date') }}" class="input-soft">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{{-- Contract warning --}}
|
||||||
|
<div x-show="contractWarning" x-transition
|
||||||
|
class="rounded-2xl bg-amber-50 border border-amber-200 px-4 py-3 text-sm" style="display:none">
|
||||||
|
<div class="font-semibold text-amber-700 mb-1">⚠️ Exclusive Contract Active</div>
|
||||||
|
<p class="text-amber-600 text-xs" x-text="contractMessage"></p>
|
||||||
|
</div>
|
||||||
|
|
||||||
{{-- Storyline Maker --}}
|
{{-- Storyline Maker --}}
|
||||||
<div class="bg-pink-50 rounded-2xl p-4 space-y-3">
|
<div class="bg-pink-50 rounded-2xl p-4 space-y-3">
|
||||||
<h3 class="font-bold text-gray-700 flex items-center gap-2 text-sm">✍️ Storyline Maker</h3>
|
<h3 class="font-bold text-gray-700 flex items-center gap-2 text-sm">✍️ Storyline Maker</h3>
|
||||||
@@ -95,7 +115,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex flex-col sm:flex-row gap-3 pt-1">
|
<div class="flex flex-col sm:flex-row gap-3 pt-1">
|
||||||
<button type="submit" class="btn-sakura flex-1 py-3">🎬 Create Brief</button>
|
<button type="submit" class="btn-sakura flex-1 py-3"
|
||||||
|
:class="{ 'opacity-50 cursor-not-allowed': contractWarning }">🎬 Create Brief</button>
|
||||||
<a href="{{ route('content.index') }}"
|
<a href="{{ route('content.index') }}"
|
||||||
class="flex-1 py-3 text-center rounded-full border border-pink-200 text-gray-600 hover:bg-pink-50 font-semibold text-sm">
|
class="flex-1 py-3 text-center rounded-full border border-pink-200 text-gray-600 hover:bg-pink-50 font-semibold text-sm">
|
||||||
Cancel
|
Cancel
|
||||||
@@ -104,4 +125,35 @@
|
|||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@push('scripts')
|
||||||
|
<script>
|
||||||
|
function contractCheck(checkUrl) {
|
||||||
|
return {
|
||||||
|
categoryId: '',
|
||||||
|
clientId: '',
|
||||||
|
contractWarning: false,
|
||||||
|
contractMessage: '',
|
||||||
|
async checkContract() {
|
||||||
|
if (!this.categoryId) { this.contractWarning = false; return; }
|
||||||
|
const params = new URLSearchParams({ category_id: this.categoryId, client_id: this.clientId || '' });
|
||||||
|
const res = await fetch(checkUrl + '?' + params);
|
||||||
|
const data = await res.json();
|
||||||
|
if (data) {
|
||||||
|
this.contractWarning = true;
|
||||||
|
this.contractMessage = `"${data.title}" — ${data.client_name} holds exclusive rights in the ${data.category} category until ${data.end_date} (${data.days_left} days left).`;
|
||||||
|
} else {
|
||||||
|
this.contractWarning = false;
|
||||||
|
this.contractMessage = '';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
submitIfClear(form) {
|
||||||
|
if (this.contractWarning) {
|
||||||
|
if (!confirm('⚠️ An exclusive contract is active for this category.\n\nAre you sure you want to proceed?')) return;
|
||||||
|
}
|
||||||
|
form.submit();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
@endpush
|
||||||
@endsection
|
@endsection
|
||||||
|
|||||||
@@ -43,6 +43,22 @@
|
|||||||
@endforeach
|
@endforeach
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-sm font-semibold text-gray-700 mb-1">Category</label>
|
||||||
|
<select name="category_id" class="input-soft">
|
||||||
|
<option value="">— None —</option>
|
||||||
|
@foreach($categoryTree as $parent)
|
||||||
|
<option value="{{ $parent->id }}" {{ old('category_id', $brief->category_id) == $parent->id ? 'selected' : '' }}>
|
||||||
|
{{ $parent->icon }} {{ $parent->name }}
|
||||||
|
</option>
|
||||||
|
@foreach($parent->children as $child)
|
||||||
|
<option value="{{ $child->id }}" {{ old('category_id', $brief->category_id) == $child->id ? 'selected' : '' }}>
|
||||||
|
↳ {{ $child->name }}
|
||||||
|
</option>
|
||||||
|
@endforeach
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label class="block text-sm font-semibold text-gray-700 mb-1">Target Date</label>
|
<label class="block text-sm font-semibold text-gray-700 mb-1">Target Date</label>
|
||||||
<input type="date" name="target_date" value="{{ old('target_date', $brief->target_date?->toDateString()) }}" class="input-soft">
|
<input type="date" name="target_date" value="{{ old('target_date', $brief->target_date?->toDateString()) }}" class="input-soft">
|
||||||
|
|||||||
212
resources/views/contracts/index.blade.php
Normal file
212
resources/views/contracts/index.blade.php
Normal file
@@ -0,0 +1,212 @@
|
|||||||
|
@extends('layouts.app')
|
||||||
|
@section('title', 'Brand Contracts')
|
||||||
|
@section('page-title', '📋 Brand Contracts')
|
||||||
|
@section('page-subtitle', 'Manage exclusive brand agreements per category')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<div class="max-w-4xl mx-auto space-y-5">
|
||||||
|
|
||||||
|
@if(session('success'))
|
||||||
|
<div x-data="{ show: true }" x-show="show" x-init="setTimeout(() => show = false, 4000)"
|
||||||
|
class="flex items-center justify-between gap-3 bg-green-50 border border-green-200 rounded-2xl px-4 py-3 text-sm text-green-700">
|
||||||
|
<span>{{ session('success') }}</span>
|
||||||
|
<button @click="show = false" class="text-green-500 hover:text-green-700 text-lg leading-none">✕</button>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
{{-- Add Contract --}}
|
||||||
|
<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">Add New Contract</h2>
|
||||||
|
</div>
|
||||||
|
<form action="{{ route('contracts.store') }}" method="POST"
|
||||||
|
class="p-5 grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4">
|
||||||
|
@csrf
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Contract Title <span class="text-pink-400">*</span></label>
|
||||||
|
<input type="text" name="title" required maxlength="255"
|
||||||
|
placeholder="e.g. Exclusive – Energy Drinks 2025"
|
||||||
|
class="input-soft" value="{{ old('title') }}">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Brand / Client</label>
|
||||||
|
<select name="client_id" class="input-soft">
|
||||||
|
<option value="">— No specific client —</option>
|
||||||
|
@foreach($clients as $c)
|
||||||
|
<option value="{{ $c->id }}" {{ old('client_id') == $c->id ? 'selected' : '' }}>
|
||||||
|
{{ $c->name }}
|
||||||
|
</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Category (exclusive) <span class="text-pink-400">*</span></label>
|
||||||
|
<select name="category_id" required class="input-soft">
|
||||||
|
<option value="">— Select category —</option>
|
||||||
|
@foreach($categoryTree as $parent)
|
||||||
|
<option value="{{ $parent->id }}" {{ old('category_id') == $parent->id ? 'selected' : '' }}>
|
||||||
|
{{ $parent->icon }} {{ $parent->name }}
|
||||||
|
</option>
|
||||||
|
@foreach($parent->children as $child)
|
||||||
|
<option value="{{ $child->id }}" {{ old('category_id') == $child->id ? 'selected' : '' }}>
|
||||||
|
↳ {{ $child->name }}
|
||||||
|
</option>
|
||||||
|
@endforeach
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Start Date <span class="text-pink-400">*</span></label>
|
||||||
|
<input type="date" name="start_date" required class="input-soft"
|
||||||
|
value="{{ old('start_date', today()->toDateString()) }}">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">End Date <span class="text-pink-400">*</span></label>
|
||||||
|
<input type="date" name="end_date" required class="input-soft"
|
||||||
|
value="{{ old('end_date') }}">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Notes</label>
|
||||||
|
<input type="text" name="notes" maxlength="500" placeholder="Optional notes…"
|
||||||
|
class="input-soft" value="{{ old('notes') }}">
|
||||||
|
</div>
|
||||||
|
<div class="sm:col-span-2 lg:col-span-3 flex justify-end pt-1">
|
||||||
|
<button type="submit" class="btn-sakura px-6 py-2.5">📋 Add Contract</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Contracts List --}}
|
||||||
|
<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">Active & Upcoming Contracts</h2>
|
||||||
|
<span class="ml-auto text-xs bg-pink-100 text-pink-600 font-semibold px-2.5 py-0.5 rounded-full">
|
||||||
|
{{ $contracts->count() }} total
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@forelse($contracts as $contract)
|
||||||
|
<div x-data="{ editing: false }" class="border-b border-pink-50 last:border-0">
|
||||||
|
<div class="flex items-center gap-3 px-5 py-3 hover:bg-pink-50/30 transition-colors">
|
||||||
|
<span class="badge {{ $contract->statusColor }} shrink-0">{{ $contract->statusLabel }}</span>
|
||||||
|
<div class="flex-1 min-w-0">
|
||||||
|
<div class="font-semibold text-gray-700 text-sm truncate">{{ $contract->title }}</div>
|
||||||
|
<div class="text-xs text-gray-400 flex flex-wrap gap-x-3 mt-0.5">
|
||||||
|
@if($contract->client)<span>👤 {{ $contract->client->name }}</span>@endif
|
||||||
|
@if($contract->category)<span>🏷️ {{ $contract->category->fullName }}</span>@endif
|
||||||
|
<span>📅 {{ $contract->start_date->format('d M Y') }} – {{ $contract->end_date->format('d M Y') }}</span>
|
||||||
|
@if($contract->isCurrentlyActive())
|
||||||
|
<span class="text-pink-500 font-medium">{{ $contract->days_remaining }}d left</span>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
@if($contract->notes)
|
||||||
|
<div class="text-xs text-gray-400 mt-0.5 italic truncate">{{ $contract->notes }}</div>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
<div class="flex gap-1.5 shrink-0">
|
||||||
|
<form action="{{ route('contracts.toggle', $contract) }}" method="POST">
|
||||||
|
@csrf @method('PATCH')
|
||||||
|
<button class="text-xs px-2.5 py-1.5 rounded-full border
|
||||||
|
{{ $contract->is_active ? 'border-amber-200 text-amber-500 hover:bg-amber-50' : 'border-green-200 text-green-500 hover:bg-green-50' }}"
|
||||||
|
title="{{ $contract->is_active ? 'Pause' : 'Activate' }}">
|
||||||
|
{{ $contract->is_active ? '⏸️' : '▶️' }}
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
<button @click="editing = !editing"
|
||||||
|
class="text-xs px-2.5 py-1.5 rounded-full border border-blue-200 text-blue-500 hover:bg-blue-50">
|
||||||
|
✏️
|
||||||
|
</button>
|
||||||
|
<form action="{{ route('contracts.destroy', $contract) }}" method="POST"
|
||||||
|
onsubmit="return confirm('Delete this contract?')">
|
||||||
|
@csrf @method('DELETE')
|
||||||
|
<button class="text-xs px-2.5 py-1.5 rounded-full border border-red-100 text-red-400 hover:bg-red-50">
|
||||||
|
🗑️
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div x-show="editing" x-transition style="display:none"
|
||||||
|
class="px-5 pb-5 pt-3 bg-pink-50/20 border-t border-pink-50">
|
||||||
|
<form action="{{ route('contracts.update', $contract) }}" method="POST"
|
||||||
|
class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3">
|
||||||
|
@csrf @method('PUT')
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Title</label>
|
||||||
|
<input type="text" name="title" required value="{{ $contract->title }}" class="input-soft">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Brand / Client</label>
|
||||||
|
<select name="client_id" class="input-soft">
|
||||||
|
<option value="">— No specific client —</option>
|
||||||
|
@foreach($clients as $c)
|
||||||
|
<option value="{{ $c->id }}" {{ $contract->client_id == $c->id ? 'selected' : '' }}>{{ $c->name }}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Category</label>
|
||||||
|
<select name="category_id" required class="input-soft">
|
||||||
|
<option value="">— Select —</option>
|
||||||
|
@foreach($categoryTree as $parent)
|
||||||
|
<option value="{{ $parent->id }}" {{ $contract->category_id == $parent->id ? 'selected' : '' }}>
|
||||||
|
{{ $parent->icon }} {{ $parent->name }}
|
||||||
|
</option>
|
||||||
|
@foreach($parent->children as $child)
|
||||||
|
<option value="{{ $child->id }}" {{ $contract->category_id == $child->id ? 'selected' : '' }}>
|
||||||
|
↳ {{ $child->name }}
|
||||||
|
</option>
|
||||||
|
@endforeach
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Start Date</label>
|
||||||
|
<input type="date" name="start_date" required value="{{ $contract->start_date->toDateString() }}" class="input-soft">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">End Date</label>
|
||||||
|
<input type="date" name="end_date" required value="{{ $contract->end_date->toDateString() }}" class="input-soft">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Notes</label>
|
||||||
|
<input type="text" name="notes" value="{{ $contract->notes }}" class="input-soft">
|
||||||
|
</div>
|
||||||
|
<div class="flex items-center gap-4 sm:col-span-2 lg:col-span-3">
|
||||||
|
<label class="flex items-center gap-2 cursor-pointer">
|
||||||
|
<input type="checkbox" name="is_active" value="1"
|
||||||
|
class="w-4 h-4 accent-pink-400 rounded"
|
||||||
|
{{ $contract->is_active ? 'checked' : '' }}>
|
||||||
|
<span class="text-sm text-gray-600">Active</span>
|
||||||
|
</label>
|
||||||
|
<button type="submit" class="btn-sakura px-5 py-2 text-sm ml-auto">💾 Save</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@empty
|
||||||
|
<div class="text-center py-14 text-gray-400">
|
||||||
|
<div class="text-4xl mb-2">📋</div>
|
||||||
|
<p class="text-sm">No contracts yet. Add your first exclusive agreement above.</p>
|
||||||
|
</div>
|
||||||
|
@endforelse
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- How it works --}}
|
||||||
|
<div class="cat-card overflow-hidden border-blue-100 bg-blue-50/30">
|
||||||
|
<div class="flex items-center gap-3 px-5 py-3 border-b border-blue-100">
|
||||||
|
<span class="text-xl">💡</span>
|
||||||
|
<h2 class="font-semibold text-gray-600 text-sm">How Brand Contracts Work</h2>
|
||||||
|
</div>
|
||||||
|
<ul class="text-xs text-gray-500 space-y-1.5 px-5 py-4">
|
||||||
|
<li>🔒 When a contract is <strong>Active</strong>, creating schedules or content for a competing brand in the same category will show a warning.</li>
|
||||||
|
<li>✅ The contracted brand itself is always allowed — no warning shown.</li>
|
||||||
|
<li>🏷️ Blocking a <strong>parent category</strong> also blocks all its subcategories.</li>
|
||||||
|
<li>📅 Contracts only block during their active date range. Expired contracts are ignored automatically.</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
@@ -45,22 +45,22 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{-- ── Stat Pills (BELOW schedule) ─────────────────────────── --}}
|
{{-- ── Stat Pills (BELOW schedule) ─────────────────────────── --}}
|
||||||
<div class="grid grid-cols-2 gap-3 mb-4">
|
<div class="grid grid-cols-2 sm:grid-cols-4 gap-3 mb-4">
|
||||||
<div class="stat-pill">
|
<a href="{{ route('clients.index') }}" class="stat-pill hover:shadow-md transition-shadow">
|
||||||
<div class="text-2xl lg:text-3xl font-extrabold text-pink-500">{{ $stats['total_clients'] }}</div>
|
<div class="text-2xl lg:text-3xl font-extrabold text-pink-500">{{ $stats['total_clients'] }}</div>
|
||||||
<div class="text-xs lg:text-sm font-semibold text-gray-600">Total Clients</div>
|
<div class="text-xs lg:text-sm font-semibold text-gray-600">Total Clients</div>
|
||||||
<div class="text-xs text-gray-400">{{ $stats['active_clients'] }} active</div>
|
<div class="text-xs text-gray-400">{{ $stats['active_clients'] }} active</div>
|
||||||
</div>
|
</a>
|
||||||
<div class="stat-pill">
|
<a href="{{ route('schedule.index') }}" class="stat-pill hover:shadow-md transition-shadow">
|
||||||
<div class="text-2xl lg:text-3xl font-extrabold text-purple-500">{{ $stats['upcoming_events'] }}</div>
|
<div class="text-2xl lg:text-3xl font-extrabold text-purple-500">{{ $stats['upcoming_events'] }}</div>
|
||||||
<div class="text-xs lg:text-sm font-semibold text-gray-600">Upcoming Events</div>
|
<div class="text-xs lg:text-sm font-semibold text-gray-600">Upcoming Events</div>
|
||||||
<div class="text-xs text-gray-400">Next 3 months</div>
|
<div class="text-xs text-gray-400">Next 3 months</div>
|
||||||
</div>
|
</a>
|
||||||
<div class="stat-pill">
|
<a href="{{ route('invoices.index') }}" class="stat-pill hover:shadow-md transition-shadow">
|
||||||
<div class="text-2xl lg:text-3xl font-extrabold text-amber-500">{{ $stats['pending_invoices'] }}</div>
|
<div class="text-2xl lg:text-3xl font-extrabold text-amber-500">{{ $stats['pending_invoices'] }}</div>
|
||||||
<div class="text-xs lg:text-sm font-semibold text-gray-600">Pending Invoices</div>
|
<div class="text-xs lg:text-sm font-semibold text-gray-600">Pending Invoices</div>
|
||||||
<div class="text-xs text-gray-400">Awaiting payment</div>
|
<div class="text-xs text-gray-400">Awaiting payment</div>
|
||||||
</div>
|
</a>
|
||||||
<div class="stat-pill">
|
<div class="stat-pill">
|
||||||
<div class="text-lg lg:text-2xl font-extrabold text-emerald-500 leading-tight">
|
<div class="text-lg lg:text-2xl font-extrabold text-emerald-500 leading-tight">
|
||||||
Rp {{ number_format($stats['total_revenue'], 0, ',', '.') }}
|
Rp {{ number_format($stats['total_revenue'], 0, ',', '.') }}
|
||||||
@@ -70,6 +70,25 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{{-- ── Secondary Stats ──────────────────────────────────────── --}}
|
||||||
|
<div class="grid grid-cols-3 gap-3 mb-4">
|
||||||
|
<a href="{{ route('client-categories.index') }}" class="stat-pill hover:shadow-md transition-shadow">
|
||||||
|
<div class="text-2xl font-extrabold text-indigo-500">{{ $stats['total_categories'] }}</div>
|
||||||
|
<div class="text-xs font-semibold text-gray-600">Categories</div>
|
||||||
|
<div class="text-xs text-gray-400">{{ $stats['total_subcategories'] }} subcategories</div>
|
||||||
|
</a>
|
||||||
|
<a href="{{ route('contracts.index') }}" class="stat-pill hover:shadow-md transition-shadow">
|
||||||
|
<div class="text-2xl font-extrabold text-rose-500">{{ $stats['active_contracts'] }}</div>
|
||||||
|
<div class="text-xs font-semibold text-gray-600">Brand Contracts</div>
|
||||||
|
<div class="text-xs text-gray-400">{{ $stats['total_contracts'] }} total</div>
|
||||||
|
</a>
|
||||||
|
<a href="{{ route('files.index') }}" class="stat-pill hover:shadow-md transition-shadow">
|
||||||
|
<div class="text-2xl font-extrabold text-teal-500">{{ $stats['total_files'] }}</div>
|
||||||
|
<div class="text-xs font-semibold text-gray-600">Files Saved</div>
|
||||||
|
<div class="text-xs text-gray-400">In file manager</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
{{-- ── Bottom Row ───────────────────────────────────────────── --}}
|
{{-- ── Bottom Row ───────────────────────────────────────────── --}}
|
||||||
<div class="grid grid-cols-1 lg:grid-cols-3 gap-4">
|
<div class="grid grid-cols-1 lg:grid-cols-3 gap-4">
|
||||||
|
|
||||||
|
|||||||
@@ -6,17 +6,74 @@
|
|||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
|
|
||||||
{{-- ── Upload Form (collapsible on mobile) ─────────────────── --}}
|
{{-- ── Upload Form (collapsible) ────────────────────────────── --}}
|
||||||
<div class="cat-card p-4 mb-4" x-data="{ open: false }">
|
<div class="cat-card p-4 mb-4"
|
||||||
|
x-data="{
|
||||||
|
open: false,
|
||||||
|
uploading: false,
|
||||||
|
progress: 0,
|
||||||
|
statusMsg: '',
|
||||||
|
statusOk: true,
|
||||||
|
|
||||||
|
submitUpload(form) {
|
||||||
|
const fd = new FormData(form);
|
||||||
|
const xhr = new XMLHttpRequest();
|
||||||
|
|
||||||
|
xhr.upload.addEventListener('progress', (e) => {
|
||||||
|
if (e.lengthComputable) {
|
||||||
|
this.progress = Math.round((e.loaded / e.total) * 100);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
xhr.addEventListener('load', () => {
|
||||||
|
this.uploading = false;
|
||||||
|
if (xhr.status >= 200 && xhr.status < 300) {
|
||||||
|
this.statusOk = true;
|
||||||
|
this.statusMsg = '✅ File uploaded successfully!';
|
||||||
|
this.progress = 100;
|
||||||
|
form.reset();
|
||||||
|
setTimeout(() => {
|
||||||
|
this.open = false;
|
||||||
|
this.statusMsg = '';
|
||||||
|
this.progress = 0;
|
||||||
|
window.location.reload();
|
||||||
|
}, 1200);
|
||||||
|
} else {
|
||||||
|
this.statusOk = false;
|
||||||
|
try {
|
||||||
|
const body = JSON.parse(xhr.responseText);
|
||||||
|
this.statusMsg = body.message ?? 'Upload failed. Please try again.';
|
||||||
|
} catch {
|
||||||
|
this.statusMsg = 'Upload failed. Please try again.';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
xhr.addEventListener('error', () => {
|
||||||
|
this.uploading = false;
|
||||||
|
this.statusOk = false;
|
||||||
|
this.statusMsg = 'Network error. Please try again.';
|
||||||
|
});
|
||||||
|
|
||||||
|
xhr.open('POST', form.action);
|
||||||
|
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
|
||||||
|
xhr.setRequestHeader('Accept', 'application/json');
|
||||||
|
this.uploading = true;
|
||||||
|
this.progress = 0;
|
||||||
|
this.statusMsg = '';
|
||||||
|
xhr.send(fd);
|
||||||
|
}
|
||||||
|
}">
|
||||||
<div class="flex items-center justify-between">
|
<div class="flex items-center justify-between">
|
||||||
<h3 class="text-sm font-bold text-gray-700 flex items-center gap-2">📤 Upload File</h3>
|
<h3 class="text-sm font-bold text-gray-700 flex items-center gap-2">📤 Upload File</h3>
|
||||||
<button class="btn-sakura text-xs px-4 py-1.5" @click="open = !open"
|
<button class="btn-sakura text-xs px-4 py-1.5" @click="open = !open; statusMsg = ''; progress = 0;"
|
||||||
x-text="open ? '✕ Close' : '+ Upload'"></button>
|
x-text="open ? '✕ Close' : '+ Upload'"></button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form x-show="open" x-transition
|
<div x-show="open" x-transition>
|
||||||
action="{{ route('files.store') }}" method="POST" enctype="multipart/form-data"
|
<form action="{{ route('files.store') }}" method="POST" enctype="multipart/form-data"
|
||||||
class="mt-4 grid grid-cols-1 sm:grid-cols-3 gap-3">
|
class="mt-4 grid grid-cols-1 sm:grid-cols-3 gap-3"
|
||||||
|
@submit.prevent="submitUpload($el)">
|
||||||
@csrf
|
@csrf
|
||||||
<div class="sm:col-span-3">
|
<div class="sm:col-span-3">
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">
|
<label class="block text-xs font-semibold text-gray-600 mb-1">
|
||||||
@@ -57,9 +114,33 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="sm:flex sm:items-end">
|
<div class="sm:flex sm:items-end">
|
||||||
<button type="submit" class="btn-sakura w-full py-2.5">📤 Upload</button>
|
<button type="submit" class="btn-sakura w-full py-2.5" :disabled="uploading">
|
||||||
|
<span x-show="!uploading">📤 Upload</span>
|
||||||
|
<span x-show="uploading">Uploading…</span>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
{{-- Progress Bar --}}
|
||||||
|
<div x-show="uploading || progress > 0" x-transition class="mt-3">
|
||||||
|
<div class="flex items-center justify-between text-xs text-gray-500 mb-1">
|
||||||
|
<span>Uploading…</span>
|
||||||
|
<span x-text="progress + '%'"></span>
|
||||||
|
</div>
|
||||||
|
<div class="w-full bg-pink-100 rounded-full h-2.5 overflow-hidden">
|
||||||
|
<div class="h-2.5 rounded-full transition-all duration-200"
|
||||||
|
style="background:#FFB7C5"
|
||||||
|
:style="'width:' + progress + '%'"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Status Message --}}
|
||||||
|
<div x-show="statusMsg" x-transition
|
||||||
|
class="mt-3 px-4 py-2.5 rounded-xl text-sm font-medium"
|
||||||
|
:class="statusOk ? 'bg-green-50 text-green-700' : 'bg-red-50 text-red-600'"
|
||||||
|
x-text="statusMsg">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{-- ── Folder Filter Chips ──────────────────────────────────── --}}
|
{{-- ── Folder Filter Chips ──────────────────────────────────── --}}
|
||||||
@@ -124,7 +205,7 @@
|
|||||||
<form action="{{ route('files.destroy', $file) }}" method="POST"
|
<form action="{{ route('files.destroy', $file) }}" method="POST"
|
||||||
onsubmit="return confirm('Delete this file?')">
|
onsubmit="return confirm('Delete this file?')">
|
||||||
@csrf @method('DELETE')
|
@csrf @method('DELETE')
|
||||||
<button class="text-xs py-1.5 px-3 rounded-full border border-red-100 text-red-400 hover:bg-red-50">
|
<button class="text-xs py-1.5 px-2.5 rounded-full border border-red-100 text-red-400 hover:bg-red-50">
|
||||||
✕
|
✕
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
@@ -138,7 +219,7 @@
|
|||||||
<div class="text-center py-16 text-gray-400">
|
<div class="text-center py-16 text-gray-400">
|
||||||
<span class="text-5xl block mb-3">📁</span>
|
<span class="text-5xl block mb-3">📁</span>
|
||||||
<p class="text-sm">No files yet.</p>
|
<p class="text-sm">No files yet.</p>
|
||||||
<button onclick="document.querySelector('[\\@click=\\'open = !open\\']').click()"
|
<button onclick="document.querySelector('[x-data]').__x.$data.open = true"
|
||||||
class="btn-sakura mt-4 inline-block text-sm">Upload your first file</button>
|
class="btn-sakura mt-4 inline-block text-sm">Upload your first file</button>
|
||||||
</div>
|
</div>
|
||||||
@endforelse
|
@endforelse
|
||||||
|
|||||||
@@ -31,9 +31,9 @@
|
|||||||
<div>
|
<div>
|
||||||
<label class="block text-sm font-semibold text-gray-700 mb-1">Currency</label>
|
<label class="block text-sm font-semibold text-gray-700 mb-1">Currency</label>
|
||||||
<select name="currency" class="input-soft">
|
<select name="currency" class="input-soft">
|
||||||
<option value="IDR" selected>IDR (Rupiah)</option>
|
@foreach(['IDR' => 'IDR (Rupiah)', 'USD' => 'USD (Dollar)', 'SGD' => 'SGD', 'MYR' => 'MYR (Ringgit)'] as $code => $label)
|
||||||
<option value="USD">USD (Dollar)</option>
|
<option value="{{ $code }}" {{ old('currency', $invoiceSettings->default_currency ?? 'IDR') === $code ? 'selected' : '' }}>{{ $label }}</option>
|
||||||
<option value="SGD">SGD</option>
|
@endforeach
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@@ -50,7 +50,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<label class="block text-sm font-semibold text-gray-700 mb-1">Tax Rate (%)</label>
|
<label class="block text-sm font-semibold text-gray-700 mb-1">Tax Rate (%)</label>
|
||||||
<input type="number" name="tax_rate" x-model="taxRate" @input="recalc()"
|
<input type="number" name="tax_rate" x-model="taxRate" @input="recalc()"
|
||||||
value="{{ old('tax_rate', 11) }}" class="input-soft" step="0.01">
|
value="{{ old('tax_rate', $invoiceSettings->default_tax_rate ?? 11) }}" class="input-soft" step="0.01">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -93,6 +93,18 @@
|
|||||||
<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 --}}
|
||||||
|
<div class="mt-2 flex items-center gap-2">
|
||||||
|
<input type="hidden" :name="`items[${index}][is_taxable]`" value="0">
|
||||||
|
<input type="checkbox" :name="`items[${index}][is_taxable]`"
|
||||||
|
:id="`taxable_${index}`"
|
||||||
|
x-model="item.is_taxable" @change="recalc()"
|
||||||
|
value="1"
|
||||||
|
class="w-3.5 h-3.5 accent-pink-400">
|
||||||
|
<label :for="`taxable_${index}`" class="text-xs text-gray-500 cursor-pointer select-none">
|
||||||
|
Taxable
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
@@ -101,34 +113,43 @@
|
|||||||
{{-- 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="flex justify-between text-sm py-1">
|
<div class="flex justify-between text-sm py-1">
|
||||||
<span class="text-gray-500">Subtotal</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">
|
<div class="flex justify-between text-sm py-1 text-amber-600">
|
||||||
<span class="text-gray-500">Tax (<span x-text="taxRate"></span>%)</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>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex justify-between text-base font-bold py-2 mt-1 border-t border-pink-200">
|
<div class="flex justify-between text-base font-bold py-2 mt-1 border-t border-pink-200">
|
||||||
<span class="text-gray-700">Total</span>
|
<span class="text-gray-700">Total (you receive)</span>
|
||||||
<span class="text-pink-600">Rp <span x-text="formatNum(total)"></span></span>
|
<span class="text-pink-600">Rp <span x-text="formatNum(total)"></span></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{-- Bank Info --}}
|
{{-- Bank Info --}}
|
||||||
<div class="grid grid-cols-1 sm:grid-cols-3 gap-3 mb-5">
|
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3 mb-5">
|
||||||
<div>
|
<div>
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Bank Name</label>
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Bank Name</label>
|
||||||
<input type="text" name="bank_name" value="{{ old('bank_name') }}"
|
<input type="text" name="bank_name"
|
||||||
|
value="{{ old('bank_name', $invoiceSettings->default_bank_name) }}"
|
||||||
class="input-soft text-sm" placeholder="BCA, Mandiri...">
|
class="input-soft text-sm" placeholder="BCA, Mandiri...">
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Branch Name</label>
|
||||||
|
<input type="text" name="branch_name"
|
||||||
|
value="{{ old('branch_name', $invoiceSettings->default_branch_name) }}"
|
||||||
|
class="input-soft text-sm" placeholder="e.g. KCP Sudirman">
|
||||||
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Account Number</label>
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Account Number</label>
|
||||||
<input type="text" name="bank_account" value="{{ old('bank_account') }}"
|
<input type="text" name="bank_account"
|
||||||
|
value="{{ old('bank_account', $invoiceSettings->default_bank_account) }}"
|
||||||
class="input-soft text-sm">
|
class="input-soft text-sm">
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Account Holder</label>
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Account Holder</label>
|
||||||
<input type="text" name="bank_holder" value="{{ old('bank_holder') }}"
|
<input type="text" name="bank_holder"
|
||||||
|
value="{{ old('bank_holder', $invoiceSettings->default_bank_holder) }}"
|
||||||
class="input-soft text-sm">
|
class="input-soft text-sm">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -136,7 +157,7 @@
|
|||||||
<div class="mb-5">
|
<div class="mb-5">
|
||||||
<label class="block text-sm font-semibold text-gray-700 mb-1">Notes</label>
|
<label class="block text-sm font-semibold text-gray-700 mb-1">Notes</label>
|
||||||
<textarea name="notes" rows="2" class="input-soft resize-none"
|
<textarea name="notes" rows="2" class="input-soft resize-none"
|
||||||
placeholder="Payment terms, etc.">{{ old('notes') }}</textarea>
|
placeholder="Payment terms, etc.">{{ old('notes', $invoiceSettings->default_notes) }}</textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex flex-col sm:flex-row gap-3">
|
<div class="flex flex-col sm:flex-row gap-3">
|
||||||
@@ -154,12 +175,19 @@
|
|||||||
<script>
|
<script>
|
||||||
function invoiceForm() {
|
function invoiceForm() {
|
||||||
return {
|
return {
|
||||||
items: [{ description: '', quantity: 1, unit_price: 0 }],
|
items: [{ description: '{{ addslashes($invoiceSettings->default_service_description ?? '') }}', quantity: 1, unit_price: 0, is_taxable: true }],
|
||||||
taxRate: 11,
|
taxRate: {{ $invoiceSettings->default_tax_rate ?? 11 }},
|
||||||
get subtotal() { return this.items.reduce((s, i) => s + (i.quantity * i.unit_price), 0); },
|
get subtotal() {
|
||||||
get taxAmount() { return Math.round(this.subtotal * this.taxRate / 100); },
|
return this.items.reduce((s, i) => s + (i.quantity * i.unit_price), 0);
|
||||||
get total() { return this.subtotal + this.taxAmount; },
|
},
|
||||||
addItem() { this.items.push({ description: '', quantity: 1, unit_price: 0 }); },
|
get taxAmount() {
|
||||||
|
const taxable = this.items
|
||||||
|
.filter(i => i.is_taxable)
|
||||||
|
.reduce((s, i) => s + (i.quantity * i.unit_price), 0);
|
||||||
|
return Math.round(taxable * this.taxRate / 100);
|
||||||
|
},
|
||||||
|
get total() { return this.subtotal; }, // grand total = pre-tax (tax borne by client)
|
||||||
|
addItem() { this.items.push({ description: '', quantity: 1, unit_price: 0, is_taxable: true }); },
|
||||||
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'); },
|
||||||
|
|||||||
@@ -88,6 +88,18 @@
|
|||||||
<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 --}}
|
||||||
|
<div class="mt-2 flex items-center gap-2">
|
||||||
|
<input type="hidden" :name="`items[${index}][is_taxable]`" value="0">
|
||||||
|
<input type="checkbox" :name="`items[${index}][is_taxable]`"
|
||||||
|
:id="`taxable_${index}`"
|
||||||
|
x-model="item.is_taxable" @change="recalc()"
|
||||||
|
value="1"
|
||||||
|
class="w-3.5 h-3.5 accent-pink-400">
|
||||||
|
<label :for="`taxable_${index}`" class="text-xs text-gray-500 cursor-pointer select-none">
|
||||||
|
Taxable
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
@@ -96,26 +108,31 @@
|
|||||||
{{-- 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="flex justify-between text-sm py-1">
|
<div class="flex justify-between text-sm py-1">
|
||||||
<span class="text-gray-500">Subtotal</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">
|
<div class="flex justify-between text-sm py-1 text-amber-600">
|
||||||
<span class="text-gray-500">Tax (<span x-text="taxRate"></span>%)</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>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex justify-between text-base font-bold py-2 mt-1 border-t border-pink-200">
|
<div class="flex justify-between text-base font-bold py-2 mt-1 border-t border-pink-200">
|
||||||
<span class="text-gray-700">Total</span>
|
<span class="text-gray-700">Total (you receive)</span>
|
||||||
<span class="text-pink-600">Rp <span x-text="formatNum(total)"></span></span>
|
<span class="text-pink-600">Rp <span x-text="formatNum(total)"></span></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{-- Bank Info --}}
|
{{-- Bank Info --}}
|
||||||
<div class="grid grid-cols-1 sm:grid-cols-3 gap-3 mb-5">
|
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3 mb-5">
|
||||||
<div>
|
<div>
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Bank Name</label>
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Bank Name</label>
|
||||||
<input type="text" name="bank_name" value="{{ old('bank_name', $invoice->bank_name) }}"
|
<input type="text" name="bank_name" value="{{ old('bank_name', $invoice->bank_name) }}"
|
||||||
class="input-soft text-sm">
|
class="input-soft text-sm">
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Branch Name</label>
|
||||||
|
<input type="text" name="branch_name" value="{{ old('branch_name', $invoice->branch_name) }}"
|
||||||
|
class="input-soft text-sm" placeholder="e.g. KCP Sudirman">
|
||||||
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Account Number</label>
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Account Number</label>
|
||||||
<input type="text" name="bank_account" value="{{ old('bank_account', $invoice->bank_account) }}"
|
<input type="text" name="bank_account" value="{{ old('bank_account', $invoice->bank_account) }}"
|
||||||
@@ -147,13 +164,25 @@
|
|||||||
@push('scripts')
|
@push('scripts')
|
||||||
<script>
|
<script>
|
||||||
function invoiceEditForm() {
|
function invoiceEditForm() {
|
||||||
|
@php
|
||||||
|
$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];
|
||||||
|
});
|
||||||
|
@endphp
|
||||||
return {
|
return {
|
||||||
items: @json($invoice->items->map(fn($i) => ['description' => $i->description, 'quantity' => $i->quantity, 'unit_price' => (float)$i->unit_price])),
|
items: @json($itemsJson),
|
||||||
taxRate: {{ $invoice->tax_rate }},
|
taxRate: {{ $invoice->tax_rate }},
|
||||||
get subtotal() { return this.items.reduce((s, i) => s + (i.quantity * i.unit_price), 0); },
|
get subtotal() {
|
||||||
get taxAmount() { return Math.round(this.subtotal * this.taxRate / 100); },
|
return this.items.reduce((s, i) => s + (i.quantity * i.unit_price), 0);
|
||||||
get total() { return this.subtotal + this.taxAmount; },
|
},
|
||||||
addItem() { this.items.push({ description: '', quantity: 1, unit_price: 0 }); },
|
get taxAmount() {
|
||||||
|
const taxable = this.items
|
||||||
|
.filter(i => i.is_taxable)
|
||||||
|
.reduce((s, i) => s + (i.quantity * i.unit_price), 0);
|
||||||
|
return Math.round(taxable * this.taxRate / 100);
|
||||||
|
},
|
||||||
|
get total() { return this.subtotal; },
|
||||||
|
addItem() { this.items.push({ description: '', quantity: 1, unit_price: 0, is_taxable: true }); },
|
||||||
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'); },
|
||||||
|
|||||||
@@ -18,7 +18,13 @@
|
|||||||
</a>
|
</a>
|
||||||
@endforeach
|
@endforeach
|
||||||
</div>
|
</div>
|
||||||
<a href="{{ route('invoices.create') }}" class="btn-sakura text-sm shrink-0">+ New Invoice</a>
|
<div class="flex gap-2 shrink-0">
|
||||||
|
<a href="{{ route('invoice-settings.edit') }}"
|
||||||
|
class="text-xs px-3 py-2 rounded-full border border-gray-200 text-gray-500 hover:bg-gray-50 flex items-center gap-1">
|
||||||
|
⚙️ Settings
|
||||||
|
</a>
|
||||||
|
<a href="{{ route('invoices.create') }}" class="btn-sakura text-sm">+ New Invoice</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{-- Mobile card list --}}
|
{{-- Mobile card list --}}
|
||||||
@@ -41,6 +47,7 @@
|
|||||||
<a href="{{ route('invoices.show', $invoice) }}" class="flex-1 text-center text-xs py-1.5 px-3 rounded-full border border-pink-200 text-pink-600 hover:bg-pink-50">View</a>
|
<a href="{{ route('invoices.show', $invoice) }}" class="flex-1 text-center text-xs py-1.5 px-3 rounded-full border border-pink-200 text-pink-600 hover:bg-pink-50">View</a>
|
||||||
<a href="{{ route('invoices.pdf', $invoice) }}" target="_blank" class="flex-1 text-center text-xs py-1.5 px-3 rounded-full border border-pink-200 text-pink-600 hover:bg-pink-50">PDF</a>
|
<a href="{{ route('invoices.pdf', $invoice) }}" target="_blank" class="flex-1 text-center text-xs py-1.5 px-3 rounded-full border border-pink-200 text-pink-600 hover:bg-pink-50">PDF</a>
|
||||||
<a href="{{ route('invoices.edit', $invoice) }}" class="flex-1 text-center text-xs py-1.5 px-3 rounded-full border border-pink-200 text-gray-600 hover:bg-pink-50">Edit</a>
|
<a href="{{ route('invoices.edit', $invoice) }}" class="flex-1 text-center text-xs py-1.5 px-3 rounded-full border border-pink-200 text-gray-600 hover:bg-pink-50">Edit</a>
|
||||||
|
{{-- Share button disabled --}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@empty
|
@empty
|
||||||
@@ -85,6 +92,7 @@
|
|||||||
<a href="{{ route('invoices.show', $invoice) }}" class="text-xs text-pink-500 hover:underline">View</a>
|
<a href="{{ route('invoices.show', $invoice) }}" class="text-xs text-pink-500 hover:underline">View</a>
|
||||||
<a href="{{ route('invoices.pdf', $invoice) }}" class="text-xs text-pink-500 hover:underline" target="_blank">PDF</a>
|
<a href="{{ route('invoices.pdf', $invoice) }}" class="text-xs text-pink-500 hover:underline" target="_blank">PDF</a>
|
||||||
<a href="{{ route('invoices.edit', $invoice) }}" class="text-xs text-gray-500 hover:underline">Edit</a>
|
<a href="{{ route('invoices.edit', $invoice) }}" class="text-xs text-gray-500 hover:underline">Edit</a>
|
||||||
|
{{-- Share button disabled --}}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -100,4 +108,5 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mt-4">{{ $invoices->links() }}</div>
|
<div class="mt-4">{{ $invoices->links() }}</div>
|
||||||
|
{{-- Share scripts disabled --}}
|
||||||
@endsection
|
@endsection
|
||||||
|
|||||||
@@ -38,9 +38,15 @@
|
|||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="header">
|
<div class="header">
|
||||||
|
<div style="display:flex; align-items:center; gap:12px;">
|
||||||
|
@if($invoiceSettings->header_logo && file_exists(storage_path('app/public/' . $invoiceSettings->header_logo)))
|
||||||
|
<img src="{{ storage_path('app/public/' . $invoiceSettings->header_logo) }}"
|
||||||
|
style="width:52px; height:52px; object-fit:cover; border-radius:12px;" alt="Logo">
|
||||||
|
@endif
|
||||||
<div>
|
<div>
|
||||||
<div class="logo">🐱 KOL Manager</div>
|
<div class="logo">{{ $invoiceSettings->header_name ?: 'KOL Manager' }}</div>
|
||||||
<div class="logo-sub">Personal Talent Assistant</div>
|
<div class="logo-sub">{{ $invoiceSettings->header_title ?: 'Personal Talent Assistant' }}</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div style="text-align:right">
|
<div style="text-align:right">
|
||||||
<div class="inv-number">{{ $invoice->invoice_number }}</div>
|
<div class="inv-number">{{ $invoice->invoice_number }}</div>
|
||||||
@@ -97,15 +103,21 @@
|
|||||||
<div class="totals">
|
<div class="totals">
|
||||||
<div class="totals-box">
|
<div class="totals-box">
|
||||||
<div class="totals-row"><span>Subtotal</span><span>Rp {{ number_format($invoice->subtotal, 0, ',', '.') }}</span></div>
|
<div class="totals-row"><span>Subtotal</span><span>Rp {{ number_format($invoice->subtotal, 0, ',', '.') }}</span></div>
|
||||||
<div class="totals-row"><span>Tax ({{ $invoice->tax_rate }}%)</span><span>Rp {{ number_format($invoice->tax_amount, 0, ',', '.') }}</span></div>
|
@if($invoice->tax_rate > 0)
|
||||||
<div class="totals-row total"><span>Total</span><span>{{ $invoice->formatted_total }}</span></div>
|
<div class="totals-row" style="color:#D97706"><span>Tax ({{ $invoice->tax_rate }}% — paid by client)</span><span>Rp {{ number_format($invoice->tax_amount, 0, ',', '.') }}</span></div>
|
||||||
|
@endif
|
||||||
|
<div class="totals-row total"><span>Total (you receive)</span><span>{{ $invoice->formatted_total }}</span></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@if($invoice->bank_name)
|
@if($invoice->bank_name)
|
||||||
<div class="bank-box">
|
<div class="bank-box">
|
||||||
<div class="bank-title">💳 Payment Information</div>
|
<div class="bank-title">Payment Information</div>
|
||||||
<div class="bank-detail">{{ $invoice->bank_name }} · {{ $invoice->bank_account }} · a/n {{ $invoice->bank_holder }}</div>
|
<div class="bank-detail">
|
||||||
|
{{ $invoice->bank_name }}
|
||||||
|
@if($invoice->branch_name) · {{ $invoice->branch_name }} @endif
|
||||||
|
· {{ $invoice->bank_account }} · a/n {{ $invoice->bank_holder }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
|||||||
175
resources/views/invoices/settings.blade.php
Normal file
175
resources/views/invoices/settings.blade.php
Normal file
@@ -0,0 +1,175 @@
|
|||||||
|
@extends('layouts.app')
|
||||||
|
|
||||||
|
@section('title', 'Invoice Settings')
|
||||||
|
@section('page-title', 'Invoice Settings 🧾')
|
||||||
|
@section('page-subtitle', 'Customize number format, header, and invoice defaults')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<div class="max-w-2xl mx-auto">
|
||||||
|
<div class="flex items-center gap-3 mb-5">
|
||||||
|
<a href="{{ route('invoices.index') }}"
|
||||||
|
class="text-xs px-3 py-2 rounded-full border border-pink-200 text-gray-500 hover:bg-pink-50">
|
||||||
|
← Back to Invoices
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if(session('success'))
|
||||||
|
<div x-data="{ show: true }" x-show="show" x-init="setTimeout(() => show = false, 4000)"
|
||||||
|
class="flex items-center justify-between gap-3 bg-green-50 border border-green-200 rounded-2xl px-4 py-3 text-sm text-green-700 mb-4">
|
||||||
|
<span>{{ session('success') }}</span>
|
||||||
|
<button @click="show = false" class="text-green-500 hover:text-green-700 text-lg leading-none">✕</button>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<form action="{{ route('invoice-settings.update') }}" method="POST" enctype="multipart/form-data"
|
||||||
|
class="space-y-5">
|
||||||
|
@csrf
|
||||||
|
|
||||||
|
{{-- Number Format --}}
|
||||||
|
<div class="cat-card p-5">
|
||||||
|
<h2 class="text-sm font-bold text-gray-700 mb-4 flex items-center gap-2">🔢 Invoice Number Format</h2>
|
||||||
|
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">
|
||||||
|
Prefix <span class="text-pink-400">*</span>
|
||||||
|
</label>
|
||||||
|
<input type="text" name="invoice_prefix"
|
||||||
|
value="{{ old('invoice_prefix', $settings->invoice_prefix) }}"
|
||||||
|
class="input-soft text-sm" placeholder="INV-EA" required
|
||||||
|
id="prefix-input" oninput="updatePreview()">
|
||||||
|
<p class="text-xs text-gray-400 mt-1">e.g. <code>INV-EA</code> → <strong>INV-EA-001</strong></p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">
|
||||||
|
Next Number <span class="text-pink-400">*</span>
|
||||||
|
</label>
|
||||||
|
<input type="number" name="invoice_next_number"
|
||||||
|
value="{{ old('invoice_next_number', $settings->invoice_next_number) }}"
|
||||||
|
class="input-soft text-sm" min="1" required
|
||||||
|
id="number-input" oninput="updatePreview()">
|
||||||
|
<p class="text-xs text-gray-400 mt-1">Used for the next new invoice</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="mt-3 bg-pink-50 rounded-xl px-4 py-2.5 text-sm text-gray-600">
|
||||||
|
Preview: <strong class="text-pink-600" id="number-preview">
|
||||||
|
{{ rtrim(old('invoice_prefix', $settings->invoice_prefix), '-') }}-{{ str_pad((string) (old('invoice_next_number', $settings->invoice_next_number) ?? 1), 3, '0', STR_PAD_LEFT) }}
|
||||||
|
</strong>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Header / Branding --}}
|
||||||
|
<div class="cat-card p-5">
|
||||||
|
<h2 class="text-sm font-bold text-gray-700 mb-4 flex items-center gap-2">🎨 Invoice Header</h2>
|
||||||
|
|
||||||
|
@if($settings->header_logo)
|
||||||
|
<div class="mb-3 flex items-center gap-3">
|
||||||
|
<img src="{{ asset('storage/' . $settings->header_logo) }}"
|
||||||
|
alt="Logo" class="h-16 w-16 object-cover rounded-2xl border border-pink-100">
|
||||||
|
<div>
|
||||||
|
<p class="text-xs font-semibold text-gray-600">Current Logo</p>
|
||||||
|
<p class="text-xs text-gray-400 mt-0.5">Upload a new file to replace it</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
||||||
|
<div class="sm:col-span-2">
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Logo / Profile Picture</label>
|
||||||
|
<input type="file" name="header_logo" accept="image/*"
|
||||||
|
class="w-full text-sm text-gray-600
|
||||||
|
file:mr-3 file:py-1.5 file:px-4
|
||||||
|
file:rounded-full file:border-0
|
||||||
|
file:text-xs file:font-semibold
|
||||||
|
file:bg-pink-50 file:text-pink-600
|
||||||
|
hover:file:bg-pink-100 cursor-pointer">
|
||||||
|
<p class="text-xs text-gray-400 mt-1">Max 2 MB. Shown at the top-left of your invoice.</p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Talent / Business Name</label>
|
||||||
|
<input type="text" name="header_name"
|
||||||
|
value="{{ old('header_name', $settings->header_name) }}"
|
||||||
|
class="input-soft text-sm" placeholder="Your name or brand">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Title / Tagline</label>
|
||||||
|
<input type="text" name="header_title"
|
||||||
|
value="{{ old('header_title', $settings->header_title) }}"
|
||||||
|
class="input-soft text-sm" placeholder="Content Creator · KOL">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Invoice Defaults --}}
|
||||||
|
<div class="cat-card p-5">
|
||||||
|
<h2 class="text-sm font-bold text-gray-700 mb-4 flex items-center gap-2">📋 Invoice Defaults</h2>
|
||||||
|
<p class="text-xs text-gray-400 mb-4">These values will pre-fill every new invoice you create.</p>
|
||||||
|
|
||||||
|
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Default Tax Rate (%)</label>
|
||||||
|
<input type="number" name="default_tax_rate" step="0.01" min="0" max="100"
|
||||||
|
value="{{ old('default_tax_rate', $settings->default_tax_rate ?? 11) }}"
|
||||||
|
class="input-soft text-sm" placeholder="11">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Default Currency</label>
|
||||||
|
<select name="default_currency" class="input-soft text-sm">
|
||||||
|
@foreach(['IDR' => 'IDR (Rupiah)', 'USD' => 'USD (Dollar)', 'SGD' => 'SGD', 'MYR' => 'MYR (Ringgit)'] as $code => $label)
|
||||||
|
<option value="{{ $code }}" {{ old('default_currency', $settings->default_currency ?? 'IDR') === $code ? 'selected' : '' }}>
|
||||||
|
{{ $label }}
|
||||||
|
</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="sm:col-span-2">
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Default Service Description</label>
|
||||||
|
<input type="text" name="default_service_description"
|
||||||
|
value="{{ old('default_service_description', $settings->default_service_description) }}"
|
||||||
|
class="input-soft text-sm" placeholder="e.g. Instagram Feed Post — 1 carousel">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Default Bank Name</label>
|
||||||
|
<input type="text" name="default_bank_name"
|
||||||
|
value="{{ old('default_bank_name', $settings->default_bank_name) }}"
|
||||||
|
class="input-soft text-sm" placeholder="BCA, Mandiri…">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Default Branch Name</label>
|
||||||
|
<input type="text" name="default_branch_name"
|
||||||
|
value="{{ old('default_branch_name', $settings->default_branch_name) }}"
|
||||||
|
class="input-soft text-sm" placeholder="KCP Sudirman">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Default Account Number</label>
|
||||||
|
<input type="text" name="default_bank_account"
|
||||||
|
value="{{ old('default_bank_account', $settings->default_bank_account) }}"
|
||||||
|
class="input-soft text-sm" placeholder="1234567890">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Default Account Holder</label>
|
||||||
|
<input type="text" name="default_bank_holder"
|
||||||
|
value="{{ old('default_bank_holder', $settings->default_bank_holder) }}"
|
||||||
|
class="input-soft text-sm" placeholder="Your full name">
|
||||||
|
</div>
|
||||||
|
<div class="sm:col-span-2">
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Default Notes / Payment Terms</label>
|
||||||
|
<textarea name="default_notes" rows="2" class="input-soft text-sm resize-none"
|
||||||
|
placeholder="e.g. Payment due within 14 days from invoice date.">{{ old('default_notes', $settings->default_notes) }}</textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button type="submit" class="btn-sakura w-full py-3">💾 Save Settings</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@push('scripts')
|
||||||
|
<script>
|
||||||
|
function updatePreview() {
|
||||||
|
const prefix = document.getElementById('prefix-input').value.replace(/-+$/, '') || 'INV';
|
||||||
|
const num = parseInt(document.getElementById('number-input').value) || 1;
|
||||||
|
document.getElementById('number-preview').textContent = prefix + '-' + String(num).padStart(3, '0');
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
@endpush
|
||||||
|
@endsection
|
||||||
@@ -18,9 +18,19 @@
|
|||||||
<div class="cat-card p-8">
|
<div class="cat-card p-8">
|
||||||
{{-- Invoice Header --}}
|
{{-- Invoice Header --}}
|
||||||
<div class="flex justify-between items-start mb-8">
|
<div class="flex justify-between items-start mb-8">
|
||||||
|
<div class="flex items-center gap-3">
|
||||||
|
@if($invoiceSettings->header_logo)
|
||||||
|
<img src="{{ asset('storage/' . $invoiceSettings->header_logo) }}"
|
||||||
|
alt="Logo" class="h-14 w-14 object-cover rounded-2xl border border-pink-100 shrink-0">
|
||||||
|
@endif
|
||||||
<div>
|
<div>
|
||||||
<div class="text-2xl font-extrabold text-pink-500 flex items-center gap-2">🐱 KOL Manager</div>
|
<div class="text-xl font-extrabold text-pink-500">
|
||||||
<div class="text-sm text-gray-400 mt-1">Personal Talent Assistant</div>
|
{{ $invoiceSettings->header_name ?: '🐱 KOL Manager' }}
|
||||||
|
</div>
|
||||||
|
<div class="text-sm text-gray-400 mt-0.5">
|
||||||
|
{{ $invoiceSettings->header_title ?: 'Personal Talent Assistant' }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="text-right">
|
<div class="text-right">
|
||||||
<div class="text-2xl font-bold text-gray-800">{{ $invoice->invoice_number }}</div>
|
<div class="text-2xl font-bold text-gray-800">{{ $invoice->invoice_number }}</div>
|
||||||
@@ -75,15 +85,18 @@
|
|||||||
|
|
||||||
{{-- Totals --}}
|
{{-- Totals --}}
|
||||||
<div class="flex justify-end mb-8">
|
<div class="flex justify-end mb-8">
|
||||||
<div class="w-64 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 {{ number_format($invoice->subtotal, 0, ',', '.') }}</span>
|
<span>Subtotal</span><span class="font-medium">Rp {{ number_format($invoice->subtotal, 0, ',', '.') }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex justify-between text-gray-500">
|
@if($invoice->tax_rate > 0)
|
||||||
<span>Tax ({{ $invoice->tax_rate }}%)</span><span class="font-medium">Rp {{ number_format($invoice->tax_amount, 0, ',', '.') }}</span>
|
<div class="flex justify-between text-amber-600">
|
||||||
|
<span>Tax ({{ $invoice->tax_rate }}% — paid by client)</span>
|
||||||
|
<span class="font-medium">Rp {{ number_format($invoice->tax_amount, 0, ',', '.') }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
@endif
|
||||||
<div class="flex justify-between text-base font-bold text-pink-600 pt-2 border-t border-pink-200">
|
<div class="flex justify-between text-base font-bold text-pink-600 pt-2 border-t border-pink-200">
|
||||||
<span>Total</span><span>{{ $invoice->formatted_total }}</span>
|
<span>Total (you receive)</span><span>{{ $invoice->formatted_total }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -92,7 +105,11 @@
|
|||||||
@if($invoice->bank_name)
|
@if($invoice->bank_name)
|
||||||
<div class="bg-pink-50 rounded-2xl p-4 text-sm">
|
<div class="bg-pink-50 rounded-2xl p-4 text-sm">
|
||||||
<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">{{ $invoice->bank_name }} · {{ $invoice->bank_account }} · {{ $invoice->bank_holder }}</div>
|
<div class="text-gray-600">
|
||||||
|
{{ $invoice->bank_name }}
|
||||||
|
@if($invoice->branch_name) · {{ $invoice->branch_name }} @endif
|
||||||
|
· {{ $invoice->bank_account }} · a/n {{ $invoice->bank_holder }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
|||||||
@@ -75,6 +75,18 @@
|
|||||||
<span class="text-lg shrink-0">👥</span> Clients / CRM
|
<span class="text-lg shrink-0">👥</span> Clients / CRM
|
||||||
</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"
|
||||||
|
class="nav-item {{ request()->routeIs('contracts.*') ? 'active' : '' }}">
|
||||||
|
<span class="text-lg shrink-0">📋</span> Brand Contracts
|
||||||
|
</a>
|
||||||
|
|
||||||
<a href="{{ route('social-hub.index') }}"
|
<a href="{{ route('social-hub.index') }}"
|
||||||
@click="sidebarOpen = false"
|
@click="sidebarOpen = false"
|
||||||
class="nav-item {{ request()->routeIs('social-hub.*') ? 'active' : '' }}">
|
class="nav-item {{ request()->routeIs('social-hub.*') ? 'active' : '' }}">
|
||||||
|
|||||||
@@ -5,11 +5,21 @@
|
|||||||
@section('page-subtitle', 'Manage your service pricing')
|
@section('page-subtitle', 'Manage your service pricing')
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<div class="flex flex-col sm:flex-row sm: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">
|
||||||
<a href="{{ route('rate-cards.public') }}" target="_blank"
|
<a href="{{ route('rate-cards.public') }}" target="_blank"
|
||||||
class="text-sm text-pink-500 hover:underline flex items-center gap-1">
|
class="text-xs px-3 py-2 rounded-full border border-pink-200 text-pink-500 hover:bg-pink-50 flex items-center gap-1">
|
||||||
🔗 View Public Page →
|
🔗 Public Page
|
||||||
</a>
|
</a>
|
||||||
|
<a href="{{ route('rate-cards.pdf') }}"
|
||||||
|
class="text-xs px-3 py-2 rounded-full border border-blue-200 text-blue-500 hover:bg-blue-50 flex items-center gap-1">
|
||||||
|
📄 PDF
|
||||||
|
</a>
|
||||||
|
<a href="{{ route('rate-cards.profile') }}"
|
||||||
|
class="text-xs px-3 py-2 rounded-full border border-purple-200 text-purple-500 hover:bg-purple-50 flex items-center gap-1">
|
||||||
|
🎨 Profile
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
<a href="{{ route('rate-cards.create') }}" class="btn-sakura text-sm shrink-0">+ Add Service</a>
|
<a href="{{ route('rate-cards.create') }}" class="btn-sakura text-sm shrink-0">+ Add Service</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -57,11 +67,12 @@
|
|||||||
class="flex-1 text-center text-xs py-2 rounded-full border border-pink-200 text-gray-600 hover:bg-pink-50 font-medium">
|
class="flex-1 text-center text-xs py-2 rounded-full border border-pink-200 text-gray-600 hover:bg-pink-50 font-medium">
|
||||||
Edit
|
Edit
|
||||||
</a>
|
</a>
|
||||||
|
{{-- Share button disabled --}}
|
||||||
<form action="{{ route('rate-cards.destroy', $card) }}" method="POST"
|
<form action="{{ route('rate-cards.destroy', $card) }}" method="POST"
|
||||||
onsubmit="return confirm('Delete this entry?')">
|
onsubmit="return confirm('Delete this entry?')">
|
||||||
@csrf @method('DELETE')
|
@csrf @method('DELETE')
|
||||||
<button class="text-xs py-2 px-4 rounded-full border border-red-100 text-red-400 hover:bg-red-50">
|
<button class="text-xs py-2 px-3 rounded-full border border-red-100 text-red-400 hover:bg-red-50">
|
||||||
Delete
|
✕
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
@@ -79,4 +90,5 @@
|
|||||||
<a href="{{ route('rate-cards.create') }}" class="btn-sakura mt-4 inline-block">Add your first service!</a>
|
<a href="{{ route('rate-cards.create') }}" class="btn-sakura mt-4 inline-block">Add your first service!</a>
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
|
{{-- Share scripts disabled --}}
|
||||||
@endsection
|
@endsection
|
||||||
|
|||||||
142
resources/views/rate-cards/pdf.blade.php
Normal file
142
resources/views/rate-cards/pdf.blade.php
Normal file
@@ -0,0 +1,142 @@
|
|||||||
|
@php
|
||||||
|
// Convert hex accent color to rgb for rgba() usage in dompdf
|
||||||
|
$accent = ltrim($profile->accent_color ?? '#FFB7C5', '#');
|
||||||
|
$ar = hexdec(substr($accent, 0, 2));
|
||||||
|
$ag = hexdec(substr($accent, 2, 2));
|
||||||
|
$ab = hexdec(substr($accent, 4, 2));
|
||||||
|
$accentRgb = "{$ar},{$ag},{$ab}";
|
||||||
|
|
||||||
|
$bg = $profile->bg_color ?? '#FFFBFE';
|
||||||
|
$text = $profile->text_color ?? '#374151';
|
||||||
|
$accentHex = '#' . $accent;
|
||||||
|
@endphp
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Rate Card — {{ $profile->owner_name }}</title>
|
||||||
|
<style>
|
||||||
|
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||||||
|
body {
|
||||||
|
font-family: 'DejaVu Sans', sans-serif;
|
||||||
|
background: {{ $bg }};
|
||||||
|
color: {{ $text }};
|
||||||
|
padding: 36px 32px;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
.header {
|
||||||
|
text-align: center;
|
||||||
|
margin-bottom: 32px;
|
||||||
|
padding-bottom: 20px;
|
||||||
|
border-bottom: 2px solid {{ $accentHex }};
|
||||||
|
}
|
||||||
|
.logo-img { max-height: 72px; max-width: 140px; margin: 0 auto 10px; display: block; }
|
||||||
|
.name { font-size: 24px; font-weight: 700; color: {{ $accentHex }}; }
|
||||||
|
.tagline { color: #9CA3AF; margin-top: 4px; font-size: 11px; }
|
||||||
|
.contacts { margin-top: 10px; font-size: 10px; color: #6B7280; }
|
||||||
|
.contacts span { margin: 0 6px; }
|
||||||
|
.platform-section { margin-bottom: 22px; }
|
||||||
|
.platform-title {
|
||||||
|
font-size: 13px; font-weight: 700;
|
||||||
|
color: {{ $text }};
|
||||||
|
margin-bottom: 8px;
|
||||||
|
padding: 5px 10px;
|
||||||
|
background-color: rgba({{ $accentRgb }}, 0.1);
|
||||||
|
border-left: 4px solid {{ $accentHex }};
|
||||||
|
}
|
||||||
|
table { width: 100%; border-collapse: collapse; }
|
||||||
|
th {
|
||||||
|
text-align: left; padding: 7px 10px;
|
||||||
|
background-color: rgba({{ $accentRgb }}, 0.08);
|
||||||
|
color: #6B7280; font-size: 9px;
|
||||||
|
text-transform: uppercase; letter-spacing: 0.05em;
|
||||||
|
border-bottom: 1px solid rgba({{ $accentRgb }}, 0.25);
|
||||||
|
}
|
||||||
|
td { padding: 8px 10px; border-bottom: 1px solid #F3F4F6; vertical-align: top; }
|
||||||
|
tr:last-child td { border-bottom: none; }
|
||||||
|
.service-name { font-weight: 600; color: {{ $text }}; }
|
||||||
|
.content-type {
|
||||||
|
display: inline-block; font-size: 9px;
|
||||||
|
background-color: rgba({{ $accentRgb }}, 0.1);
|
||||||
|
color: {{ $accentHex }};
|
||||||
|
padding: 1px 7px; border-radius: 10px; margin-top: 2px;
|
||||||
|
}
|
||||||
|
.desc { color: #9CA3AF; font-size: 10px; margin-top: 3px; }
|
||||||
|
.price { font-weight: 700; color: {{ $accentHex }}; font-size: 13px; }
|
||||||
|
.price-unit { color: #9CA3AF; font-size: 9px; }
|
||||||
|
.negotiable { color: #F59E0B; font-size: 9px; font-weight: 600; }
|
||||||
|
.footer { text-align: center; margin-top: 36px; color: #D1D5DB; font-size: 9px; border-top: 1px solid #F3F4F6; padding-top: 14px; }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="header">
|
||||||
|
@if($profile->logo_path && file_exists(storage_path('app/private/' . $profile->logo_path)))
|
||||||
|
<img src="{{ storage_path('app/private/' . $profile->logo_path) }}" class="logo-img" alt="{{ $profile->owner_name }}">
|
||||||
|
@endif
|
||||||
|
<div class="name">{{ $profile->owner_name }}</div>
|
||||||
|
@if($profile->tagline)
|
||||||
|
<div class="tagline">{{ $profile->tagline }}</div>
|
||||||
|
@endif
|
||||||
|
<div class="contacts">
|
||||||
|
@if($profile->email)<span>✉ {{ $profile->email }}</span>@endif
|
||||||
|
@if($profile->whatsapp)<span>· {{ $profile->whatsapp }}</span>@endif
|
||||||
|
@if($profile->ig_handle)<span>· @{{ $profile->ig_handle }}</span>@endif
|
||||||
|
@if($profile->tiktok_handle)<span>· @{{ $profile->tiktok_handle }}</span>@endif
|
||||||
|
@if($profile->youtube_handle)<span>· {{ $profile->youtube_handle }}</span>@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@foreach($rateCards as $platform => $cards)
|
||||||
|
<div class="platform-section">
|
||||||
|
<div class="platform-title">
|
||||||
|
@php $icons = ['instagram' => 'Instagram', 'tiktok' => 'TikTok', 'youtube' => 'YouTube', 'general' => 'General']; @endphp
|
||||||
|
{{ $icons[$platform] ?? ucfirst($platform) }}
|
||||||
|
</div>
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th style="width:38%">Service</th>
|
||||||
|
<th style="width:37%">Description</th>
|
||||||
|
<th style="width:25%; text-align:right">Price</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach($cards as $card)
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<div class="service-name">{{ $card->service_name }}</div>
|
||||||
|
@if($card->content_type)
|
||||||
|
<span class="content-type">{{ $card->content_type }}</span>
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@if($card->description)
|
||||||
|
<div class="desc">{{ $card->description }}</div>
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
|
<td style="text-align:right">
|
||||||
|
@if($profile->show_prices)
|
||||||
|
<div class="price">{{ $card->formatted_price }}</div>
|
||||||
|
<div class="price-unit">{{ str_replace('_', ' ', $card->price_unit) }}</div>
|
||||||
|
@else
|
||||||
|
<div class="price" style="font-size:11px">On Request</div>
|
||||||
|
@endif
|
||||||
|
@if($card->is_negotiable)
|
||||||
|
<div class="negotiable">Negotiable</div>
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
@endforeach
|
||||||
|
|
||||||
|
<div class="footer">
|
||||||
|
{{ $profile->custom_footer ?: 'Prices may vary. Contact for custom packages.' }}
|
||||||
|
· Generated {{ now()->format('d M Y') }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
172
resources/views/rate-cards/profile.blade.php
Normal file
172
resources/views/rate-cards/profile.blade.php
Normal file
@@ -0,0 +1,172 @@
|
|||||||
|
@extends('layouts.app')
|
||||||
|
@section('title', 'Rate Card Profile')
|
||||||
|
@section('page-title', '🎨 Rate Card Profile')
|
||||||
|
@section('page-subtitle', 'Customise your public rate card page')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<div class="max-w-3xl mx-auto space-y-5">
|
||||||
|
|
||||||
|
@if(session('success'))
|
||||||
|
<div x-data="{ show: true }" x-show="show" x-init="setTimeout(() => show = false, 4000)"
|
||||||
|
class="flex items-center justify-between gap-3 bg-green-50 border border-green-200 rounded-2xl px-4 py-3 text-sm text-green-700">
|
||||||
|
<span>{{ session('success') }}</span>
|
||||||
|
<button @click="show = false" class="text-green-500 hover:text-green-700 text-lg leading-none">✕</button>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<form action="{{ route('rate-cards.profile.update') }}" method="POST" enctype="multipart/form-data"
|
||||||
|
class="space-y-5">
|
||||||
|
@csrf
|
||||||
|
|
||||||
|
{{-- Identity --}}
|
||||||
|
<div class="cat-card overflow-hidden">
|
||||||
|
<div class="flex items-center gap-3 px-5 py-4 border-b border-pink-50">
|
||||||
|
<span class="text-xl">👤</span>
|
||||||
|
<h2 class="font-bold text-gray-700">Identity</h2>
|
||||||
|
</div>
|
||||||
|
<div class="p-5 grid grid-cols-1 sm:grid-cols-2 gap-4">
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Display Name <span class="text-pink-400">*</span></label>
|
||||||
|
<input type="text" name="owner_name" required
|
||||||
|
value="{{ old('owner_name', $profile->owner_name) }}"
|
||||||
|
class="input-soft" placeholder="e.g. Sakura KOL">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Tagline</label>
|
||||||
|
<input type="text" name="tagline"
|
||||||
|
value="{{ old('tagline', $profile->tagline) }}"
|
||||||
|
class="input-soft" placeholder="e.g. Lifestyle & Beauty Creator">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Email</label>
|
||||||
|
<input type="email" name="email"
|
||||||
|
value="{{ old('email', $profile->email) }}"
|
||||||
|
class="input-soft" placeholder="hi@example.com">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">WhatsApp Number</label>
|
||||||
|
<input type="text" name="whatsapp"
|
||||||
|
value="{{ old('whatsapp', $profile->whatsapp) }}"
|
||||||
|
class="input-soft" placeholder="+6012-345-6789">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Instagram Handle</label>
|
||||||
|
<div class="relative">
|
||||||
|
<span class="absolute left-3 top-1/2 -translate-y-1/2 text-gray-400 text-sm pointer-events-none">@</span>
|
||||||
|
<input type="text" name="ig_handle"
|
||||||
|
value="{{ old('ig_handle', $profile->ig_handle) }}"
|
||||||
|
class="input-soft pl-7" placeholder="yourhandle">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">TikTok Handle</label>
|
||||||
|
<div class="relative">
|
||||||
|
<span class="absolute left-3 top-1/2 -translate-y-1/2 text-gray-400 text-sm pointer-events-none">@</span>
|
||||||
|
<input type="text" name="tiktok_handle"
|
||||||
|
value="{{ old('tiktok_handle', $profile->tiktok_handle) }}"
|
||||||
|
class="input-soft pl-7" placeholder="yourhandle">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="sm:col-span-2">
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">YouTube Handle / Channel</label>
|
||||||
|
<input type="text" name="youtube_handle"
|
||||||
|
value="{{ old('youtube_handle', $profile->youtube_handle) }}"
|
||||||
|
class="input-soft" placeholder="@yourchannel">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Appearance --}}
|
||||||
|
<div class="cat-card overflow-hidden">
|
||||||
|
<div class="flex items-center gap-3 px-5 py-4 border-b border-pink-50">
|
||||||
|
<span class="text-xl">🎨</span>
|
||||||
|
<h2 class="font-bold text-gray-700">Appearance</h2>
|
||||||
|
</div>
|
||||||
|
<div class="p-5 grid grid-cols-1 sm:grid-cols-2 gap-4">
|
||||||
|
<div class="sm:col-span-2">
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Logo / Profile Image</label>
|
||||||
|
@if($profile->logo_path)
|
||||||
|
<div class="flex items-center gap-3 mb-2">
|
||||||
|
<img src="{{ route('files.serve-profile-logo') }}" alt="Logo"
|
||||||
|
class="w-16 h-16 object-cover rounded-2xl border border-pink-100">
|
||||||
|
<span class="text-xs text-gray-400">Current logo</span>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
<input type="file" name="logo" accept="image/*"
|
||||||
|
class="w-full text-sm text-gray-600
|
||||||
|
file:mr-3 file:py-2 file:px-4 file:rounded-full file:border-0
|
||||||
|
file:text-xs file:font-semibold file:bg-pink-50 file:text-pink-600
|
||||||
|
hover:file:bg-pink-100 cursor-pointer">
|
||||||
|
<p class="text-xs text-gray-400 mt-1">Max 2MB. PNG/JPG/WebP.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Background Color</label>
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<input type="color" name="bg_color" value="{{ old('bg_color', $profile->bg_color) }}"
|
||||||
|
class="h-10 w-16 rounded-2xl border border-pink-200 cursor-pointer p-1 bg-white shrink-0"
|
||||||
|
oninput="document.getElementById('bg_text').value=this.value">
|
||||||
|
<input type="text" id="bg_text" value="{{ old('bg_color', $profile->bg_color) }}"
|
||||||
|
class="input-soft text-sm flex-1" readonly>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Accent Color</label>
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<input type="color" name="accent_color" value="{{ old('accent_color', $profile->accent_color) }}"
|
||||||
|
class="h-10 w-16 rounded-2xl border border-pink-200 cursor-pointer p-1 bg-white shrink-0"
|
||||||
|
oninput="document.getElementById('accent_text').value=this.value">
|
||||||
|
<input type="text" id="accent_text" value="{{ old('accent_color', $profile->accent_color) }}"
|
||||||
|
class="input-soft text-sm flex-1" readonly>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Text Color</label>
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<input type="color" name="text_color" value="{{ old('text_color', $profile->text_color) }}"
|
||||||
|
class="h-10 w-16 rounded-2xl border border-pink-200 cursor-pointer p-1 bg-white shrink-0"
|
||||||
|
oninput="document.getElementById('text_text').value=this.value">
|
||||||
|
<input type="text" id="text_text" value="{{ old('text_color', $profile->text_color) }}"
|
||||||
|
class="input-soft text-sm flex-1" readonly>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Custom Footer</label>
|
||||||
|
<input type="text" name="custom_footer"
|
||||||
|
value="{{ old('custom_footer', $profile->custom_footer) }}"
|
||||||
|
class="input-soft"
|
||||||
|
placeholder="e.g. Prices valid until Dec 2025 · DM for bundles">
|
||||||
|
</div>
|
||||||
|
<div class="sm:col-span-2">
|
||||||
|
<label class="flex items-start gap-3 cursor-pointer">
|
||||||
|
<input type="checkbox" name="show_prices" value="1"
|
||||||
|
class="w-4 h-4 accent-pink-400 mt-0.5 shrink-0"
|
||||||
|
{{ old('show_prices', $profile->show_prices) ? 'checked' : '' }}>
|
||||||
|
<div>
|
||||||
|
<span class="text-sm font-medium text-gray-700">Show prices publicly</span>
|
||||||
|
<p class="text-xs text-gray-400">Uncheck to show "On Request" instead of actual prices</p>
|
||||||
|
</div>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Actions --}}
|
||||||
|
<div class="flex flex-wrap items-center gap-3">
|
||||||
|
<button type="submit" class="btn-sakura px-6 py-2.5">💾 Save Profile</button>
|
||||||
|
<a href="{{ route('rate-cards.public') }}" target="_blank"
|
||||||
|
class="text-xs px-4 py-2.5 rounded-full border border-pink-200 text-pink-500 hover:bg-pink-50">
|
||||||
|
👁️ Preview Public Page
|
||||||
|
</a>
|
||||||
|
<a href="{{ route('rate-cards.pdf') }}"
|
||||||
|
class="text-xs px-4 py-2.5 rounded-full border border-blue-200 text-blue-500 hover:bg-blue-50">
|
||||||
|
📄 Download PDF
|
||||||
|
</a>
|
||||||
|
<a href="{{ route('rate-cards.index') }}"
|
||||||
|
class="text-xs px-4 py-2.5 rounded-full border border-gray-200 text-gray-500 hover:bg-gray-50">
|
||||||
|
← Back to Rate Cards
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
@@ -3,36 +3,80 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<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 — KOL Manager</title>
|
<title>Rate Card — {{ $profile->owner_name }}</title>
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&display=swap" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&display=swap" rel="stylesheet">
|
||||||
<style>
|
<style>
|
||||||
* { box-sizing: border-box; margin: 0; padding: 0; }
|
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||||||
body { font-family: 'Nunito', sans-serif; background: #FFF8F0; color: #374151; padding: 40px 20px; }
|
body { font-family: 'Nunito', sans-serif; background: {{ $profile->bg_color }}; color: {{ $profile->text_color }}; padding: 40px 20px; }
|
||||||
.container { max-width: 800px; margin: 0 auto; }
|
.container { max-width: 820px; margin: 0 auto; }
|
||||||
.header { text-align: center; margin-bottom: 48px; }
|
.header { text-align: center; margin-bottom: 48px; }
|
||||||
.logo { font-size: 48px; margin-bottom: 12px; }
|
.logo-img { max-height: 100px; max-width: 200px; margin: 0 auto 16px; display: block; border-radius: 16px; }
|
||||||
.title { font-size: 32px; font-weight: 900; color: #FFB7C5; }
|
.title { font-size: 32px; font-weight: 900; color: {{ $profile->accent_color }}; }
|
||||||
.subtitle { color: #9CA3AF; margin-top: 6px; font-size: 14px; }
|
.tagline { color: #9CA3AF; margin-top: 6px; font-size: 14px; }
|
||||||
|
.contacts { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px 20px; margin-top: 16px; }
|
||||||
|
.contact-pill {
|
||||||
|
display: inline-flex; align-items: center; gap-6px;
|
||||||
|
background: white; border: 1px solid {{ $profile->accent_color }}44;
|
||||||
|
border-radius: 99px; padding: 6px 14px; font-size: 12px; color: {{ $profile->text_color }};
|
||||||
|
text-decoration: none; transition: background 0.2s;
|
||||||
|
}
|
||||||
|
.contact-pill:hover { background: {{ $profile->accent_color }}18; }
|
||||||
.platform-section { margin-bottom: 32px; }
|
.platform-section { margin-bottom: 32px; }
|
||||||
.platform-title { font-size: 18px; font-weight: 800; color: #374151; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
|
.platform-title { font-size: 18px; font-weight: 800; color: {{ $profile->text_color }}; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
|
||||||
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
|
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
|
||||||
.card { background: white; border-radius: 24px; padding: 20px; border: 1px solid #FFE4EC; box-shadow: 0 2px 8px rgba(255,183,197,0.15); }
|
.card { background: white; border-radius: 24px; padding: 20px; border: 1px solid {{ $profile->accent_color }}33; box-shadow: 0 2px 8px {{ $profile->accent_color }}22; }
|
||||||
.service { font-weight: 700; color: #1F2937; margin-bottom: 6px; }
|
.service { font-weight: 700; color: #1F2937; margin-bottom: 6px; }
|
||||||
.type { display: inline-block; background: #FFF0F5; color: #FFB7C5; font-size: 11px; font-weight: 600; padding: 2px 10px; border-radius: 20px; margin-bottom: 8px; }
|
.type { display: inline-block; background: {{ $profile->accent_color }}18; color: {{ $profile->accent_color }}; font-size: 11px; font-weight: 600; padding: 2px 10px; border-radius: 20px; margin-bottom: 8px; }
|
||||||
.desc { font-size: 12px; color: #9CA3AF; margin-bottom: 12px; line-height: 1.5; }
|
.desc { font-size: 12px; color: #9CA3AF; margin-bottom: 12px; line-height: 1.5; }
|
||||||
.price { font-size: 22px; font-weight: 900; color: #FFB7C5; }
|
.price { font-size: 22px; font-weight: 900; color: {{ $profile->accent_color }}; }
|
||||||
.price-meta { font-size: 11px; color: #D1D5DB; margin-top: 2px; }
|
.price-meta { font-size: 11px; color: #D1D5DB; margin-top: 2px; }
|
||||||
.negotiable { font-size: 11px; color: #F59E0B; font-weight: 600; }
|
.negotiable { font-size: 11px; color: #F59E0B; font-weight: 600; }
|
||||||
.footer { text-align: center; margin-top: 60px; color: #D1D5DB; font-size: 12px; }
|
.footer { text-align: center; margin-top: 60px; color: #D1D5DB; font-size: 12px; }
|
||||||
@media print { body { background: white; } .card { break-inside: avoid; } }
|
.pdf-btn {
|
||||||
|
display: inline-flex; align-items: center; gap: 6px;
|
||||||
|
background: {{ $profile->accent_color }}; color: white;
|
||||||
|
border: none; border-radius: 99px; padding: 10px 24px;
|
||||||
|
font-size: 14px; font-weight: 700; cursor: pointer;
|
||||||
|
text-decoration: none; transition: opacity 0.2s;
|
||||||
|
}
|
||||||
|
.pdf-btn:hover { opacity: 0.9; }
|
||||||
|
@media print { body { background: white; } .card { break-inside: avoid; } .pdf-btn { display: none; } }
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<div class="logo">🐱</div>
|
@if($profile->logo_path)
|
||||||
<div class="title">Rate Card</div>
|
<img src="{{ route('files.serve-profile-logo') }}" alt="{{ $profile->owner_name }}" class="logo-img">
|
||||||
<div class="subtitle">Services & Pricing · {{ now()->format('Y') }}</div>
|
@else
|
||||||
|
<div style="font-size:56px; margin-bottom:12px;">🐱</div>
|
||||||
|
@endif
|
||||||
|
<div class="title">{{ $profile->owner_name }}</div>
|
||||||
|
@if($profile->tagline)
|
||||||
|
<div class="tagline">{{ $profile->tagline }}</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<div class="contacts" style="margin-top:14px">
|
||||||
|
@if($profile->whatsappUrl)
|
||||||
|
<a href="{{ $profile->whatsappUrl }}" target="_blank" class="contact-pill">📱 WhatsApp</a>
|
||||||
|
@endif
|
||||||
|
@if($profile->ig_handle)
|
||||||
|
<a href="https://instagram.com/{{ ltrim($profile->ig_handle, '@') }}" target="_blank" class="contact-pill">📸 @{{ $profile->ig_handle }}</a>
|
||||||
|
@endif
|
||||||
|
@if($profile->tiktok_handle)
|
||||||
|
<a href="https://tiktok.com/@{{ ltrim($profile->tiktok_handle, '@') }}" target="_blank" class="contact-pill">🎵 @{{ $profile->tiktok_handle }}</a>
|
||||||
|
@endif
|
||||||
|
@if($profile->youtube_handle)
|
||||||
|
<a href="https://youtube.com/{{ $profile->youtube_handle }}" target="_blank" class="contact-pill">▶️ {{ $profile->youtube_handle }}</a>
|
||||||
|
@endif
|
||||||
|
@if($profile->email)
|
||||||
|
<a href="mailto:{{ $profile->email }}" class="contact-pill">✉️ {{ $profile->email }}</a>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="margin-top:20px">
|
||||||
|
<a href="{{ route('rate-cards.pdf') }}" class="pdf-btn">📄 Download PDF</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@forelse($rateCards as $platform => $cards)
|
@forelse($rateCards as $platform => $cards)
|
||||||
@@ -51,8 +95,12 @@
|
|||||||
@if($card->description)
|
@if($card->description)
|
||||||
<div class="desc">{{ $card->description }}</div>
|
<div class="desc">{{ $card->description }}</div>
|
||||||
@endif
|
@endif
|
||||||
|
@if($profile->show_prices)
|
||||||
<div class="price">{{ $card->formatted_price }}</div>
|
<div class="price">{{ $card->formatted_price }}</div>
|
||||||
<div class="price-meta">{{ str_replace('_', ' ', $card->price_unit) }}</div>
|
<div class="price-meta">{{ str_replace('_', ' ', $card->price_unit) }}</div>
|
||||||
|
@else
|
||||||
|
<div class="price" style="font-size:16px">On Request</div>
|
||||||
|
@endif
|
||||||
@if($card->is_negotiable)
|
@if($card->is_negotiable)
|
||||||
<div class="negotiable">✦ Negotiable</div>
|
<div class="negotiable">✦ Negotiable</div>
|
||||||
@endif
|
@endif
|
||||||
@@ -65,7 +113,8 @@
|
|||||||
@endforelse
|
@endforelse
|
||||||
|
|
||||||
<div class="footer">
|
<div class="footer">
|
||||||
Generated by KOL Manager · Prices may vary. Contact for custom packages. 🐾
|
{{ $profile->custom_footer ?: 'Prices may vary. Contact for custom packages. 🐾' }}
|
||||||
|
<br>Generated by KOL Manager · {{ now()->format('Y') }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -52,7 +52,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{-- Client --}}
|
{{-- Client --}}
|
||||||
<div class="sm:col-span-2">
|
<div>
|
||||||
<label class="block text-sm font-semibold text-gray-700 mb-1">Client</label>
|
<label class="block text-sm font-semibold text-gray-700 mb-1">Client</label>
|
||||||
<select name="client_id" class="input-soft">
|
<select name="client_id" class="input-soft">
|
||||||
<option value="">— None —</option>
|
<option value="">— None —</option>
|
||||||
@@ -65,6 +65,26 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{{-- Category --}}
|
||||||
|
<div>
|
||||||
|
<label class="block text-sm font-semibold text-gray-700 mb-1">Category</label>
|
||||||
|
<select name="category_id" class="input-soft">
|
||||||
|
<option value="">— None —</option>
|
||||||
|
@foreach($categoryTree as $parent)
|
||||||
|
<option value="{{ $parent->id }}"
|
||||||
|
{{ old('category_id', $event->category_id) == $parent->id ? 'selected' : '' }}>
|
||||||
|
{{ $parent->icon }} {{ $parent->name }}
|
||||||
|
</option>
|
||||||
|
@foreach($parent->children as $child)
|
||||||
|
<option value="{{ $child->id }}"
|
||||||
|
{{ old('category_id', $event->category_id) == $child->id ? 'selected' : '' }}>
|
||||||
|
↳ {{ $child->name }}
|
||||||
|
</option>
|
||||||
|
@endforeach
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
{{-- Start Date --}}
|
{{-- Start Date --}}
|
||||||
<div>
|
<div>
|
||||||
<label class="block text-sm font-semibold text-gray-700 mb-1">
|
<label class="block text-sm font-semibold text-gray-700 mb-1">
|
||||||
|
|||||||
@@ -16,7 +16,9 @@
|
|||||||
|
|
||||||
<form x-show="open" x-transition action="{{ route('schedule.store') }}" method="POST"
|
<form x-show="open" x-transition action="{{ route('schedule.store') }}" method="POST"
|
||||||
class="mt-4 grid grid-cols-1 sm:grid-cols-2 gap-3"
|
class="mt-4 grid grid-cols-1 sm:grid-cols-2 gap-3"
|
||||||
id="new-event-form">
|
id="new-event-form"
|
||||||
|
x-data="contractCheck('{{ route('contracts.check') }}')"
|
||||||
|
@submit.prevent="submitIfClear($el)">
|
||||||
@csrf
|
@csrf
|
||||||
{{-- Hidden combined datetime fields --}}
|
{{-- Hidden combined datetime fields --}}
|
||||||
<input type="hidden" name="start_time" id="start_time_hidden">
|
<input type="hidden" name="start_time" id="start_time_hidden">
|
||||||
@@ -37,13 +39,31 @@
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label class="text-xs font-semibold text-gray-600">Client</label>
|
<label class="text-xs font-semibold text-gray-600">Client</label>
|
||||||
<select name="client_id" class="input-soft mt-1">
|
<select name="client_id" class="input-soft mt-1" x-model="clientId" @change="checkContract()">
|
||||||
<option value="">— None —</option>
|
<option value="">— None —</option>
|
||||||
@foreach($clients as $client)
|
@foreach($clients as $client)
|
||||||
<option value="{{ $client->id }}">{{ $client->name }}</option>
|
<option value="{{ $client->id }}">{{ $client->name }}</option>
|
||||||
@endforeach
|
@endforeach
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="text-xs font-semibold text-gray-600">Category</label>
|
||||||
|
<select name="category_id" class="input-soft mt-1" x-model="categoryId" @change="checkContract()">
|
||||||
|
<option value="">— None —</option>
|
||||||
|
@foreach($categoryTree as $parent)
|
||||||
|
<option value="{{ $parent->id }}">{{ $parent->icon }} {{ $parent->name }}</option>
|
||||||
|
@foreach($parent->children as $child)
|
||||||
|
<option value="{{ $child->id }}"> ↳ {{ $child->name }}</option>
|
||||||
|
@endforeach
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Contract warning --}}
|
||||||
|
<div x-show="contractWarning" x-transition class="sm:col-span-2 rounded-2xl bg-amber-50 border border-amber-200 px-4 py-3 text-sm" style="display:none">
|
||||||
|
<div class="font-semibold text-amber-700 mb-1">⚠️ Exclusive Contract Active</div>
|
||||||
|
<p class="text-amber-600 text-xs" x-text="contractMessage"></p>
|
||||||
|
</div>
|
||||||
|
|
||||||
{{-- Start: date + time side by side --}}
|
{{-- Start: date + time side by side --}}
|
||||||
<div>
|
<div>
|
||||||
@@ -86,7 +106,10 @@
|
|||||||
<textarea name="notes" rows="2" class="input-soft mt-1 resize-none text-sm"></textarea>
|
<textarea name="notes" rows="2" class="input-soft mt-1 resize-none text-sm"></textarea>
|
||||||
</div>
|
</div>
|
||||||
<div class="sm:col-span-2">
|
<div class="sm:col-span-2">
|
||||||
<button type="submit" class="btn-sakura w-full">🐾 Schedule It!</button>
|
<button type="submit" class="btn-sakura w-full"
|
||||||
|
:class="{ 'opacity-50 cursor-not-allowed': contractWarning }">
|
||||||
|
🐾 Schedule It!
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
@@ -209,8 +232,9 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
<div class="flex gap-2"><span class="text-gray-400 w-16 shrink-0">Start</span><span>${e.start?.toLocaleString()}</span></div>
|
<div class="flex gap-2"><span class="text-gray-400 w-16 shrink-0">Start</span><span>${e.start?.toLocaleString()}</span></div>
|
||||||
${e.end ? `<div class="flex gap-2"><span class="text-gray-400 w-16 shrink-0">End</span><span>${e.end.toLocaleString()}</span></div>` : ''}
|
${e.end ? `<div class="flex gap-2"><span class="text-gray-400 w-16 shrink-0">End</span><span>${e.end.toLocaleString()}</span></div>` : ''}
|
||||||
`;
|
`;
|
||||||
|
const editUrl = `/schedule/${e.id}/edit`;
|
||||||
document.getElementById('modal-actions').innerHTML = `
|
document.getElementById('modal-actions').innerHTML = `
|
||||||
<a href="/schedule/${e.id}/edit" class="btn-sakura text-sm flex-1 text-center py-2">Edit</a>
|
<a href="${editUrl}" class="btn-sakura text-sm flex-1 text-center py-2">Edit</a>
|
||||||
<form method="POST" action="/schedule/${e.id}" onsubmit="return confirm('Delete?')" class="flex-1">
|
<form method="POST" action="/schedule/${e.id}" onsubmit="return confirm('Delete?')" class="flex-1">
|
||||||
<input type="hidden" name="_method" value="DELETE">
|
<input type="hidden" name="_method" value="DELETE">
|
||||||
<input type="hidden" name="_token" value="${document.querySelector('meta[name=csrf-token]').content}">
|
<input type="hidden" name="_token" value="${document.querySelector('meta[name=csrf-token]').content}">
|
||||||
@@ -248,5 +272,37 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
{{-- Share scripts disabled --}}
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function contractCheck(checkUrl) {
|
||||||
|
return {
|
||||||
|
categoryId: '',
|
||||||
|
clientId: '',
|
||||||
|
contractWarning: false,
|
||||||
|
contractMessage: '',
|
||||||
|
async checkContract() {
|
||||||
|
if (!this.categoryId) { this.contractWarning = false; return; }
|
||||||
|
const params = new URLSearchParams({ category_id: this.categoryId, client_id: this.clientId || '' });
|
||||||
|
const res = await fetch(checkUrl + '?' + params);
|
||||||
|
const data = await res.json();
|
||||||
|
if (data) {
|
||||||
|
this.contractWarning = true;
|
||||||
|
this.contractMessage = `"${data.title}" — ${data.client_name} holds exclusive rights in the ${data.category} category until ${data.end_date} (${data.days_left} days left).`;
|
||||||
|
} else {
|
||||||
|
this.contractWarning = false;
|
||||||
|
this.contractMessage = '';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
submitIfClear(form) {
|
||||||
|
if (this.contractWarning) {
|
||||||
|
if (!confirm('⚠️ An exclusive contract is active for this category.\n\nAre you sure you want to proceed?')) return;
|
||||||
|
}
|
||||||
|
form.submit();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@endpush
|
@endpush
|
||||||
@endsection
|
@endsection
|
||||||
|
|||||||
@@ -134,11 +134,12 @@
|
|||||||
</div>
|
</div>
|
||||||
@elseif($setting->channel === 'whatsapp')
|
@elseif($setting->channel === 'whatsapp')
|
||||||
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3">
|
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3">
|
||||||
<div>
|
<div class="sm:col-span-2">
|
||||||
<label class="text-xs font-semibold text-gray-600 block mb-1">WAHA URL</label>
|
<label class="text-xs font-semibold text-gray-600 block mb-1">WAHA Endpoint</label>
|
||||||
<input type="url" name="config[waha_url]"
|
<input type="url" name="config[waha_endpoint]"
|
||||||
value="{{ $setting->config['waha_url'] ?? '' }}"
|
value="{{ $setting->config['waha_endpoint'] ?? '' }}"
|
||||||
class="input-soft text-sm" placeholder="http://localhost:3000">
|
class="input-soft text-sm" placeholder="http://localhost:3000/api/sendText">
|
||||||
|
<p class="text-xs text-gray-400 mt-1">Full URL to the sendText endpoint</p>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label class="text-xs font-semibold text-gray-600 block mb-1">Session Name</label>
|
<label class="text-xs font-semibold text-gray-600 block mb-1">Session Name</label>
|
||||||
@@ -146,11 +147,21 @@
|
|||||||
value="{{ $setting->config['waha_session'] ?? 'default' }}"
|
value="{{ $setting->config['waha_session'] ?? 'default' }}"
|
||||||
class="input-soft text-sm" placeholder="default">
|
class="input-soft text-sm" placeholder="default">
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="text-xs font-semibold text-gray-600 block mb-1">API Key
|
||||||
|
<span class="font-normal text-gray-400">(if required)</span>
|
||||||
|
</label>
|
||||||
|
<input type="text" name="config[api_key]"
|
||||||
|
value="{{ $setting->config['api_key'] ?? '' }}"
|
||||||
|
class="input-soft text-sm" placeholder="your-waha-api-key">
|
||||||
|
<p class="text-xs text-gray-400 mt-1">Sent as <code>X-Api-Key</code> header. Leave blank if WAHA has no auth.</p>
|
||||||
|
</div>
|
||||||
<div class="sm:col-span-2">
|
<div class="sm:col-span-2">
|
||||||
<label class="text-xs font-semibold text-gray-600 block mb-1">Phone Number</label>
|
<label class="text-xs font-semibold text-gray-600 block mb-1">Chat ID</label>
|
||||||
<input type="text" name="config[phone]"
|
<input type="text" name="config[chat_id]"
|
||||||
value="{{ $setting->config['phone'] ?? '' }}"
|
value="{{ $setting->config['chat_id'] ?? '' }}"
|
||||||
class="input-soft text-sm" placeholder="628123456789">
|
class="input-soft text-sm" placeholder="628123456789@c.us or 120363xxx@g.us">
|
||||||
|
<p class="text-xs text-gray-400 mt-1">Individual: <code>628xxx@c.us</code> · Group: <code>120363xxx@g.us</code></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
@@ -238,20 +249,29 @@
|
|||||||
|
|
||||||
{{-- WhatsApp / WAHA --}}
|
{{-- WhatsApp / WAHA --}}
|
||||||
<div x-show="channel === 'whatsapp'" x-transition class="grid grid-cols-1 sm:grid-cols-2 gap-3">
|
<div x-show="channel === 'whatsapp'" x-transition class="grid grid-cols-1 sm:grid-cols-2 gap-3">
|
||||||
<div>
|
<div class="sm:col-span-2">
|
||||||
<label class="text-xs font-semibold text-gray-600 block mb-1">WAHA API URL <span class="text-pink-400">*</span></label>
|
<label class="text-xs font-semibold text-gray-600 block mb-1">WAHA Endpoint <span class="text-pink-400">*</span></label>
|
||||||
<input type="url" name="config[waha_url]" class="input-soft text-sm"
|
<input type="url" name="config[waha_endpoint]" class="input-soft text-sm"
|
||||||
placeholder="http://localhost:3000">
|
placeholder="http://localhost:3000/api/sendText">
|
||||||
<p class="text-xs text-gray-400 mt-1">Your self-hosted WAHA instance</p>
|
<p class="text-xs text-gray-400 mt-1">Full URL to the sendText endpoint of your WAHA instance</p>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label class="text-xs font-semibold text-gray-600 block mb-1">Session Name</label>
|
<label class="text-xs font-semibold text-gray-600 block mb-1">Session Name</label>
|
||||||
<input type="text" name="config[waha_session]" value="default" class="input-soft text-sm">
|
<input type="text" name="config[waha_session]" value="default" class="input-soft text-sm">
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="text-xs font-semibold text-gray-600 block mb-1">API Key
|
||||||
|
<span class="font-normal text-gray-400">(if required)</span>
|
||||||
|
</label>
|
||||||
|
<input type="text" name="config[api_key]" class="input-soft text-sm"
|
||||||
|
placeholder="your-waha-api-key">
|
||||||
|
<p class="text-xs text-gray-400 mt-1">Sent as <code class="bg-gray-100 px-1 rounded">X-Api-Key</code> header. Leave blank if WAHA has no auth.</p>
|
||||||
|
</div>
|
||||||
<div class="sm:col-span-2">
|
<div class="sm:col-span-2">
|
||||||
<label class="text-xs font-semibold text-gray-600 block mb-1">Phone Number <span class="text-pink-400">*</span></label>
|
<label class="text-xs font-semibold text-gray-600 block mb-1">Chat ID <span class="text-pink-400">*</span></label>
|
||||||
<input type="text" name="config[phone]" class="input-soft text-sm"
|
<input type="text" name="config[chat_id]" class="input-soft text-sm"
|
||||||
placeholder="628123456789 (country code, no +)">
|
placeholder="628123456789@c.us or 120363xxx@g.us">
|
||||||
|
<p class="text-xs text-gray-400 mt-1">Individual: <code class="bg-gray-100 px-1 rounded">628xxx@c.us</code> · Group: <code class="bg-gray-100 px-1 rounded">120363xxx@g.us</code></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -2,12 +2,14 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
use App\Http\Controllers\BrandContractController;
|
||||||
use App\Http\Controllers\ClientCategoryController;
|
use App\Http\Controllers\ClientCategoryController;
|
||||||
use App\Http\Controllers\ClientController;
|
use App\Http\Controllers\ClientController;
|
||||||
use App\Http\Controllers\ContentBriefController;
|
use App\Http\Controllers\ContentBriefController;
|
||||||
use App\Http\Controllers\DashboardController;
|
use App\Http\Controllers\DashboardController;
|
||||||
use App\Http\Controllers\EventController;
|
use App\Http\Controllers\EventController;
|
||||||
use App\Http\Controllers\InvoiceController;
|
use App\Http\Controllers\InvoiceController;
|
||||||
|
use App\Http\Controllers\InvoiceSettingsController;
|
||||||
use App\Http\Controllers\MediaFileController;
|
use App\Http\Controllers\MediaFileController;
|
||||||
use App\Http\Controllers\NotificationSettingController;
|
use App\Http\Controllers\NotificationSettingController;
|
||||||
use App\Http\Controllers\RateCardController;
|
use App\Http\Controllers\RateCardController;
|
||||||
@@ -28,6 +30,16 @@ Route::prefix('client-categories')->name('client-categories.')->group(function (
|
|||||||
Route::delete('/{category}', [ClientCategoryController::class, 'destroy'])->name('destroy');
|
Route::delete('/{category}', [ClientCategoryController::class, 'destroy'])->name('destroy');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Brand Contracts
|
||||||
|
Route::prefix('contracts')->name('contracts.')->group(function (): void {
|
||||||
|
Route::get('/', [BrandContractController::class, 'index'])->name('index');
|
||||||
|
Route::post('/', [BrandContractController::class, 'store'])->name('store');
|
||||||
|
Route::put('/{contract}', [BrandContractController::class, 'update'])->name('update');
|
||||||
|
Route::delete('/{contract}', [BrandContractController::class, 'destroy'])->name('destroy');
|
||||||
|
Route::patch('/{contract}/toggle', [BrandContractController::class, 'toggle'])->name('toggle');
|
||||||
|
Route::get('/check', [BrandContractController::class, 'check'])->name('check');
|
||||||
|
});
|
||||||
|
|
||||||
// Schedule & Calendar
|
// Schedule & Calendar
|
||||||
Route::prefix('schedule')->name('schedule.')->group(function (): void {
|
Route::prefix('schedule')->name('schedule.')->group(function (): void {
|
||||||
Route::get('/', [EventController::class, 'index'])->name('index');
|
Route::get('/', [EventController::class, 'index'])->name('index');
|
||||||
@@ -48,9 +60,15 @@ 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('/invoice-settings', [InvoiceSettingsController::class, 'edit'])->name('invoice-settings.edit');
|
||||||
|
Route::post('/invoice-settings', [InvoiceSettingsController::class, 'update'])->name('invoice-settings.update');
|
||||||
|
|
||||||
// Financial – Rate Cards
|
// Financial – Rate Cards
|
||||||
Route::get('/rate-cards/public', [RateCardController::class, 'public'])->name('rate-cards.public');
|
Route::get('/rate-cards/public', [RateCardController::class, 'public'])->name('rate-cards.public');
|
||||||
|
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::post('/rate-cards/profile', [RateCardController::class, 'profileUpdate'])->name('rate-cards.profile.update');
|
||||||
|
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']);
|
||||||
|
|
||||||
// Content Strategy – Kanban
|
// Content Strategy – Kanban
|
||||||
|
|||||||
Reference in New Issue
Block a user