feat: add notes management feature with CRUD operations

- Created Note model and controller for handling notes.
- Added routes for notes CRUD operations.
- Implemented notes index view with search and pinning functionality.
- Created migration for notes table with necessary fields.
- Developed event creation form with client and contract options.
This commit is contained in:
I-Fun
2026-04-02 23:24:38 +07:00
parent 5748b163b6
commit 1b90f730a6
25 changed files with 1524 additions and 390 deletions

View File

@@ -7,8 +7,10 @@ namespace App\Http\Controllers;
use App\Enums\ClientStatus; use App\Enums\ClientStatus;
use App\Models\Client; use App\Models\Client;
use App\Models\ClientCategory; use App\Models\ClientCategory;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\RedirectResponse; use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage;
use Illuminate\View\View; use Illuminate\View\View;
class ClientController extends Controller class ClientController extends Controller
@@ -146,4 +148,42 @@ class ClientController extends Controller
return redirect()->route('clients.index') return redirect()->route('clients.index')
->with('success', '🐱 Client removed.'); ->with('success', '🐱 Client removed.');
} }
public function quickStore(Request $request): JsonResponse
{
$validated = $request->validate([
'name' => 'required|string|max:255',
'email' => 'nullable|email|unique:clients,email',
'phone' => 'nullable|string|max:50',
'company' => 'nullable|string|max:255',
]);
$client = Client::create(array_merge($validated, ['status' => 'active']));
return response()->json(['id' => $client->id, 'name' => $client->name]);
}
public function uploadAvatar(Request $request, Client $client): JsonResponse
{
$request->validate(['avatar' => 'required|image|max:2048']);
if ($client->avatar) {
Storage::disk('public')->delete($client->avatar);
}
$path = $request->file('avatar')->store('client-avatars', 'public');
$client->update(['avatar' => $path]);
return response()->json(['url' => asset('storage/' . $path)]);
}
public function deleteAvatar(Client $client): JsonResponse
{
if ($client->avatar) {
Storage::disk('public')->delete($client->avatar);
$client->update(['avatar' => null]);
}
return response()->json(['ok' => true]);
}
} }

View File

@@ -4,10 +4,12 @@ declare(strict_types=1);
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Enums\ContentStatus;
use App\Enums\EventStatus; use App\Enums\EventStatus;
use App\Models\BrandContract; use App\Models\BrandContract;
use App\Models\Client; use App\Models\Client;
use App\Models\ClientCategory; use App\Models\ClientCategory;
use App\Models\ContentBrief;
use App\Models\Event; use App\Models\Event;
use Illuminate\Http\JsonResponse; use Illuminate\Http\JsonResponse;
use Illuminate\Http\RedirectResponse; use Illuminate\Http\RedirectResponse;
@@ -25,6 +27,14 @@ class EventController extends Controller
->get(); ->get();
} }
public function create(): View
{
$clients = Client::where('status', 'active')->orderBy('name')->get();
$categoryTree = $this->categoryTree();
return view('schedule.create', compact('clients', 'categoryTree'));
}
public function index(): View public function index(): View
{ {
$events = Event::with('client')->orderBy('start_time')->get(); $events = Event::with('client')->orderBy('start_time')->get();
@@ -69,6 +79,9 @@ class EventController extends Controller
'contract_title' => 'nullable|string|max:255', 'contract_title' => 'nullable|string|max:255',
'contract_start_date' => 'nullable|date', 'contract_start_date' => 'nullable|date',
'contract_end_date' => 'nullable|date|after_or_equal:contract_start_date', 'contract_end_date' => 'nullable|date|after_or_equal:contract_start_date',
'add_to_content_board' => 'nullable|boolean',
'content_platform' => 'nullable|string|max:50',
'content_type' => 'nullable|string|max:50',
]); ]);
$validated['is_priority'] = $request->boolean('is_priority'); $validated['is_priority'] = $request->boolean('is_priority');
@@ -76,6 +89,7 @@ class EventController extends Controller
$event = Event::create(Arr::except($validated, [ $event = Event::create(Arr::except($validated, [
'create_brand_contract', 'contract_title', 'contract_start_date', 'contract_end_date', 'create_brand_contract', 'contract_title', 'contract_start_date', 'contract_end_date',
'add_to_content_board', 'content_platform', 'content_type',
])); ]));
if ($request->boolean('create_brand_contract') && $event->client_id) { if ($request->boolean('create_brand_contract') && $event->client_id) {
@@ -89,6 +103,19 @@ class EventController extends Controller
]); ]);
} }
if ($request->boolean('add_to_content_board')) {
ContentBrief::create([
'title' => $event->title,
'client_id' => $event->client_id,
'category_id' => $event->category_id,
'platform' => $request->input('content_platform', 'instagram'),
'content_type' => $request->input('content_type', 'post'),
'status' => ContentStatus::Drafting,
'target_date' => $event->start_time->toDateString(),
'notes' => $event->notes,
]);
}
return redirect()->route('schedule.index') return redirect()->route('schedule.index')
->with('success', '🐾 Event scheduled!'); ->with('success', '🐾 Event scheduled!');
} }

View File

@@ -5,6 +5,7 @@ declare(strict_types=1);
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Models\InvoiceSettings; use App\Models\InvoiceSettings;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\RedirectResponse; use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;
@@ -53,4 +54,35 @@ class InvoiceSettingsController extends Controller
return redirect()->route('invoice-settings.edit') return redirect()->route('invoice-settings.edit')
->with('success', '🧾 Invoice settings saved!'); ->with('success', '🧾 Invoice settings saved!');
} }
public function uploadLogo(Request $request): JsonResponse
{
$request->validate(['header_logo' => 'required|image|max:2048']);
$settings = InvoiceSettings::instance();
if ($settings->header_logo) {
Storage::disk('public')->delete($settings->header_logo);
}
$path = $request->file('header_logo')->store('invoice-logos', 'public');
$settings->update(['header_logo' => $path]);
return response()->json([
'url' => asset('storage/' . $path),
]);
}
public function deleteLogo(): RedirectResponse
{
$settings = InvoiceSettings::instance();
if ($settings->header_logo) {
Storage::disk('public')->delete($settings->header_logo);
$settings->update(['header_logo' => null]);
}
return redirect()->route('invoice-settings.edit')
->with('success', '🗑️ Logo removed.');
}
} }

View File

@@ -0,0 +1,64 @@
<?php
declare(strict_types=1);
namespace App\Http\Controllers;
use App\Models\Note;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\View\View;
class NoteController extends Controller
{
public function index(): View
{
$notes = Note::orderByDesc('is_pinned')
->orderByDesc('updated_at')
->get();
return view('notes.index', compact('notes'));
}
public function store(Request $request): JsonResponse
{
$data = $request->validate([
'title' => 'required|string|max:255',
'content' => 'nullable|array',
'color' => 'nullable|string|max:20',
'is_pinned' => 'boolean',
]);
$note = Note::create($data);
return response()->json($note, 201);
}
public function update(Request $request, Note $note): JsonResponse
{
$data = $request->validate([
'title' => 'required|string|max:255',
'content' => 'nullable|array',
'color' => 'nullable|string|max:20',
'is_pinned' => 'boolean',
]);
$note->update($data);
return response()->json($note);
}
public function destroy(Note $note): JsonResponse
{
$note->delete();
return response()->json(['ok' => true]);
}
public function togglePin(Note $note): JsonResponse
{
$note->update(['is_pinned' => ! $note->is_pinned]);
return response()->json($note);
}
}

View File

@@ -41,6 +41,11 @@ class MediaFile extends Model
return str_starts_with($this->mime_type, 'image/'); return str_starts_with($this->mime_type, 'image/');
} }
public function getIsVideoAttribute(): bool
{
return str_starts_with($this->mime_type, 'video/');
}
public function getIconAttribute(): string public function getIconAttribute(): string
{ {
if ($this->is_image) return '🖼️'; if ($this->is_image) return '🖼️';

22
app/Models/Note.php Normal file
View File

@@ -0,0 +1,22 @@
<?php
declare(strict_types=1);
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Note extends Model
{
protected $fillable = [
'title',
'content',
'color',
'is_pinned',
];
protected $casts = [
'content' => 'array',
'is_pinned' => 'boolean',
];
}

View File

@@ -0,0 +1,25 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('notes', function (Blueprint $table): void {
$table->id();
$table->string('title')->default('Untitled Note');
$table->json('content')->nullable(); // array of block objects
$table->string('color', 20)->default('#FFFFFF');
$table->boolean('is_pinned')->default(false);
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('notes');
}
};

View File

@@ -15,13 +15,17 @@
@endif @endif
{{-- Add form --}} {{-- Add form --}}
<div class="cat-card overflow-hidden"> <div class="cat-card overflow-hidden" x-data="{ open: {{ $errors->any() ? 'true' : 'false' }} }">
<div class="flex items-center gap-3 px-5 py-4 border-b border-pink-50"> <div class="flex items-center gap-3 px-5 py-4 border-b border-pink-50">
<span class="text-xl">➕</span> <button type="button" @click="open = !open"
<h2 class="font-bold text-gray-700">Add New Category</h2> class="btn-sakura text-xs"
x-text="open ? '✕ Close' : '+ Add New Category'">
</button>
</div> </div>
<div x-show="open" x-transition style="display:none">
<form action="{{ route('client-categories.store') }}" method="POST" <form action="{{ route('client-categories.store') }}" method="POST"
class="p-5 grid grid-cols-2 sm:grid-cols-4 gap-3 items-end"> class="p-5 grid grid-cols-2 sm:grid-cols-4 gap-3 items-end border-b border-pink-50">
@csrf @csrf
<div> <div>
<label class="block text-xs font-semibold text-gray-600 mb-1">Name <span class="text-pink-400">*</span></label> <label class="block text-xs font-semibold text-gray-600 mb-1">Name <span class="text-pink-400">*</span></label>
@@ -55,6 +59,7 @@
</div> </div>
</form> </form>
</div> </div>
</div>
{{-- List --}} {{-- List --}}
<div class="cat-card overflow-hidden"> <div class="cat-card overflow-hidden">
@@ -66,6 +71,7 @@
</span> </span>
</div> </div>
@php $roots = $categories->whereNull('parent_id'); @endphp @php $roots = $categories->whereNull('parent_id'); @endphp
@forelse($roots as $root) @forelse($roots as $root)

View File

@@ -85,10 +85,18 @@
data-name="{{ strtolower($client->name) }} {{ strtolower($client->company ?? '') }}"> data-name="{{ strtolower($client->name) }} {{ strtolower($client->company ?? '') }}">
<div class="flex items-start gap-3"> <div class="flex items-start gap-3">
@if($client->avatar)
<div class="w-11 h-11 rounded-2xl overflow-hidden shrink-0 shadow-sm ring-2 ring-pink-100">
<img src="{{ \Illuminate\Support\Facades\Storage::url($client->avatar) }}"
alt="{{ $client->name }}"
class="w-full h-full object-cover">
</div>
@else
<div class="w-11 h-11 rounded-2xl flex items-center justify-center text-white font-bold text-base shadow-sm shrink-0" <div class="w-11 h-11 rounded-2xl flex items-center justify-center text-white font-bold text-base shadow-sm shrink-0"
style="background: linear-gradient(135deg, {{ $client->category?->color ?? '#FFB7C5' }}, #E8D5F5);"> style="background: linear-gradient(135deg, {{ $client->category?->color ?? '#FFB7C5' }}, #E8D5F5);">
{{ $client->initials }} {{ $client->initials }}
</div> </div>
@endif
<div class="flex-1 min-w-0"> <div class="flex-1 min-w-0">
<div class="flex items-center gap-2 flex-wrap"> <div class="flex items-center gap-2 flex-wrap">
<h3 class="font-bold text-gray-800 text-sm truncate">{{ $client->name }}</h3> <h3 class="font-bold text-gray-800 text-sm truncate">{{ $client->name }}</h3>

View File

@@ -8,12 +8,55 @@
<div class="max-w-5xl mx-auto"> <div class="max-w-5xl mx-auto">
{{-- Profile Header --}} {{-- Profile Header --}}
<div class="cat-card p-4 mb-4"> <div class="cat-card p-4 mb-4"
x-data="{
avatarUrl: '{{ $client->avatar ? asset('storage/' . $client->avatar) : '' }}',
uploading: false,
async pickAvatar(input) {
if (!input.files.length) return;
this.uploading = true;
const fd = new FormData();
fd.append('avatar', input.files[0]);
fd.append('_token', document.querySelector('meta[name=csrf-token]').content);
const res = await fetch('{{ route('clients.upload-avatar', $client) }}', { method: 'POST', body: fd });
const data = await res.json();
if (res.ok) this.avatarUrl = data.url + '?t=' + Date.now();
this.uploading = false;
input.value = '';
},
async removeAvatar() {
if (!confirm('Remove profile picture?')) return;
const fd = new FormData();
fd.append('_token', document.querySelector('meta[name=csrf-token]').content);
fd.append('_method', 'DELETE');
await fetch('{{ route('clients.delete-avatar', $client) }}', { method: 'POST', body: fd });
this.avatarUrl = '';
}
}">
<div class="flex items-start gap-4"> <div class="flex items-start gap-4">
<div class="w-14 h-14 rounded-3xl flex items-center justify-center text-white font-bold text-xl shadow shrink-0" {{-- Avatar with upload overlay --}}
<div class="relative shrink-0 group">
<template x-if="avatarUrl">
<img :src="avatarUrl" alt="{{ $client->name }}"
class="w-16 h-16 rounded-3xl object-cover shadow border border-pink-100">
</template>
<template x-if="!avatarUrl">
<div class="w-16 h-16 rounded-3xl flex items-center justify-center text-white font-bold text-xl shadow"
style="background: linear-gradient(135deg, #FFB7C5, #E8D5F5);"> style="background: linear-gradient(135deg, #FFB7C5, #E8D5F5);">
{{ $client->initials }} {{ $client->initials }}
</div> </div>
</template>
{{-- Upload overlay --}}
<label class="absolute inset-0 rounded-3xl bg-black/30 flex items-center justify-center
opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer"
:class="{ 'opacity-100': uploading }"
title="Change photo">
<span x-show="!uploading" class="text-white text-lg">📷</span>
<span x-show="uploading" class="text-white text-xs">…</span>
<input type="file" accept="image/*" class="hidden" @change="pickAvatar($event.target)">
</label>
</div>
<div class="flex-1 min-w-0"> <div class="flex-1 min-w-0">
<h2 class="text-lg font-bold text-gray-800 leading-tight">{{ $client->name }}</h2> <h2 class="text-lg font-bold text-gray-800 leading-tight">{{ $client->name }}</h2>
@if($client->company) <p class="text-sm text-gray-500">{{ $client->company }}</p> @endif @if($client->company) <p class="text-sm text-gray-500">{{ $client->company }}</p> @endif
@@ -31,13 +74,17 @@
</div> </div>
</div> </div>
</div> </div>
{{-- Action buttons below on mobile, inline on larger screens --}}
<div class="flex gap-2 mt-3"> <div class="flex gap-2 mt-3 flex-wrap">
<a href="{{ route('clients.edit', $client) }}" class="btn-sakura text-sm px-4 py-2">Edit</a> <a href="{{ route('clients.edit', $client) }}" class="btn-sakura text-sm px-4 py-2">Edit</a>
<a href="{{ route('invoices.create') }}?client={{ $client->id }}" <a href="{{ route('invoices.create') }}?client={{ $client->id }}"
class="text-sm px-4 py-2 rounded-full border border-pink-200 text-gray-600 hover:bg-pink-50 font-semibold"> class="text-sm px-4 py-2 rounded-full border border-pink-200 text-gray-600 hover:bg-pink-50 font-semibold">
🧾 New Invoice 🧾 New Invoice
</a> </a>
<button x-show="avatarUrl" @click="removeAvatar()"
class="text-sm px-4 py-2 rounded-full border border-red-200 text-red-400 hover:bg-red-50 font-semibold">
🗑️ Remove Photo
</button>
</div> </div>
</div> </div>

View File

@@ -15,13 +15,17 @@
@endif @endif
{{-- Add Contract --}} {{-- Add Contract --}}
<div class="cat-card overflow-hidden"> <div class="cat-card overflow-hidden" x-data="{ open: {{ $errors->any() ? 'true' : 'false' }} }">
<div class="flex items-center gap-3 px-5 py-4 border-b border-pink-50"> <div class="flex items-center gap-3 px-5 py-4 border-b border-pink-50">
<span class="text-xl">➕</span> <button type="button" @click="open = !open"
<h2 class="font-bold text-gray-700">Add New Contract</h2> class="btn-sakura text-xs"
x-text="open ? '✕ Close' : '+ Add New Contract'">
</button>
</div> </div>
<div x-show="open" x-transition style="display:none">
<form action="{{ route('contracts.store') }}" method="POST" <form action="{{ route('contracts.store') }}" method="POST"
class="p-5 grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4"> class="p-5 grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4 border-b border-pink-50">
@csrf @csrf
<div> <div>
<label class="block text-xs font-semibold text-gray-600 mb-1">Contract Title <span class="text-pink-400">*</span></label> <label class="block text-xs font-semibold text-gray-600 mb-1">Contract Title <span class="text-pink-400">*</span></label>
@@ -76,12 +80,13 @@
</div> </div>
</form> </form>
</div> </div>
</div>
{{-- Contracts List --}} {{-- Contracts List --}}
<div class="cat-card overflow-hidden"> <div class="cat-card overflow-hidden">
<div class="flex items-center gap-3 px-5 py-4 border-b border-pink-50"> <div class="flex items-center gap-3 px-5 py-4 border-b border-pink-50">
<span class="text-xl">📋</span> <span class="text-xl">📋</span>
<h2 class="font-bold text-gray-700">Active & Upcoming Contracts</h2> <h2 class="font-bold text-gray-700">All Contracts</h2>
<span class="ml-auto text-xs bg-pink-100 text-pink-600 font-semibold px-2.5 py-0.5 rounded-full"> <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 {{ $contracts->count() }} total
</span> </span>

View File

@@ -6,6 +6,29 @@
@section('content') @section('content')
{{-- ── Video Player Modal ───────────────────────────────────── --}}
<div id="video-player-modal"
class="fixed inset-0 z-50 flex items-center justify-center bg-black/80 hidden"
onclick="if(event.target===this)closeVideoModal()">
<div class="relative w-full max-w-3xl mx-4">
<div class="flex items-center justify-between mb-3 px-1">
<p class="text-white text-sm font-semibold truncate" id="vpm-title"></p>
<button onclick="closeVideoModal()"
class="text-white/70 hover:text-white text-2xl leading-none ml-4 shrink-0">✕</button>
</div>
<video id="vpm-player"
class="w-full rounded-2xl bg-black shadow-2xl"
controls controlsList="nodownload"
style="max-height:70vh">
</video>
<div class="flex items-center justify-between mt-3 px-1 text-xs text-white/60">
<span id="vpm-meta"></span>
<a id="vpm-dl" href="#" target="_blank"
class="text-pink-300 hover:text-pink-200 font-medium">⬇️ Download</a>
</div>
</div>
</div>
{{-- ── File Detail Popup Modal ──────────────────────────────── --}} {{-- ── File Detail Popup Modal ──────────────────────────────── --}}
<div id="file-detail-modal" <div id="file-detail-modal"
class="fixed inset-0 z-50 flex items-end sm:items-center justify-center bg-black/40 hidden" class="fixed inset-0 z-50 flex items-end sm:items-center justify-center bg-black/40 hidden"
@@ -191,17 +214,37 @@
<div class="grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 gap-3"> <div class="grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 gap-3">
@endif @endif
@php $fileData = ['name' => $file->name ?: $file->original_name, 'url' => $file->url, 'size' => $file->human_size, 'folder' => $file->folder, 'client' => $file->client?->name, 'is_image' => $file->is_image, 'is_video' => $file->is_video, 'icon' => $file->icon, 'created_at' => $file->created_at->format('d M Y')] @endphp
<div class="cat-card p-3 flex flex-col gap-2"> <div class="cat-card p-3 flex flex-col gap-2">
{{-- Preview / Icon --}} {{-- Preview / Icon --}}
@if($file->is_image) @if($file->is_image)
<div class="w-full aspect-square rounded-2xl overflow-hidden bg-pink-50 cursor-pointer" <div class="w-full aspect-square rounded-2xl overflow-hidden bg-pink-50 cursor-pointer"
onclick="showFileDetail({{ json_encode(['name' => $file->name ?: $file->original_name, 'url' => $file->url, 'size' => $file->human_size, 'folder' => $file->folder, 'client' => $file->client?->name, 'is_image' => $file->is_image, 'icon' => $file->icon, 'created_at' => $file->created_at->format('d M Y')]) }})"> onclick="showFileDetail({{ json_encode($fileData) }})">
<img src="{{ $file->url }}" alt="{{ $file->name }}" <img src="{{ $file->url }}" alt="{{ $file->name }}"
class="w-full h-full object-cover"> class="w-full h-full object-cover">
</div> </div>
@elseif($file->is_video)
<div class="w-full aspect-square rounded-2xl overflow-hidden bg-gray-900 relative cursor-pointer group"
onclick="openVideoPlayer({{ json_encode($fileData) }})">
{{-- Native video poster (browser generates a frame) --}}
<video src="{{ $file->url }}"
class="w-full h-full object-cover opacity-80"
preload="metadata"
muted playsinline
style="pointer-events:none">
</video>
{{-- Play overlay --}}
<div class="absolute inset-0 flex items-center justify-center
bg-black/20 group-hover:bg-black/40 transition-colors">
<div class="w-12 h-12 rounded-full bg-white/90 flex items-center justify-center shadow-lg
group-hover:scale-110 transition-transform">
<span class="text-gray-800 text-xl ml-0.5">▶</span>
</div>
</div>
</div>
@else @else
<div class="w-full aspect-square rounded-2xl bg-pink-50 flex items-center justify-center text-4xl cursor-pointer" <div class="w-full aspect-square rounded-2xl bg-pink-50 flex items-center justify-center text-4xl cursor-pointer"
onclick="showFileDetail({{ json_encode(['name' => $file->name ?: $file->original_name, 'url' => $file->url, 'size' => $file->human_size, 'folder' => $file->folder, 'client' => $file->client?->name, 'is_image' => false, 'icon' => $file->icon, 'created_at' => $file->created_at->format('d M Y')]) }})"> onclick="showFileDetail({{ json_encode($fileData) }})">
{{ $file->icon }} {{ $file->icon }}
</div> </div>
@endif @endif
@@ -256,7 +299,6 @@ function showFileDetail(file) {
document.getElementById('fdm-name').textContent = file.name; document.getElementById('fdm-name').textContent = file.name;
document.getElementById('fdm-view-btn').href = file.url; document.getElementById('fdm-view-btn').href = file.url;
// Preview area
const preview = document.getElementById('fdm-preview'); const preview = document.getElementById('fdm-preview');
if (file.is_image) { if (file.is_image) {
preview.innerHTML = `<img src="${file.url}" alt="${file.name}" class="max-h-48 rounded-2xl object-contain border border-pink-100">`; preview.innerHTML = `<img src="${file.url}" alt="${file.name}" class="max-h-48 rounded-2xl object-contain border border-pink-100">`;
@@ -264,7 +306,6 @@ function showFileDetail(file) {
preview.innerHTML = `<span class="text-6xl">${file.icon}</span>`; preview.innerHTML = `<span class="text-6xl">${file.icon}</span>`;
} }
// Info rows
const rows = [ const rows = [
['Size', file.size], ['Size', file.size],
['Folder', file.folder], ['Folder', file.folder],
@@ -278,6 +319,32 @@ function showFileDetail(file) {
document.getElementById('file-detail-modal').classList.remove('hidden'); document.getElementById('file-detail-modal').classList.remove('hidden');
} }
function openVideoPlayer(file) {
const player = document.getElementById('vpm-player');
player.src = file.url;
player.load();
document.getElementById('vpm-title').textContent = file.name;
document.getElementById('vpm-meta').textContent = file.size + (file.client ? ' · ' + file.client : '');
document.getElementById('vpm-dl').href = file.url;
document.getElementById('video-player-modal').classList.remove('hidden');
document.body.style.overflow = 'hidden';
}
function closeVideoModal() {
const player = document.getElementById('vpm-player');
player.pause();
player.src = '';
document.getElementById('video-player-modal').classList.add('hidden');
document.body.style.overflow = '';
}
// Close video modal on Escape
document.addEventListener('keydown', e => {
if (e.key === 'Escape') closeVideoModal();
});
</script> </script>
@endpush @endpush

View File

@@ -121,7 +121,7 @@
<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 (you receive)</span> <span class="text-gray-700">Grand Total</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>

View File

@@ -116,7 +116,7 @@
<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 (you receive)</span> <span class="text-gray-700">Grand Total</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>

View File

@@ -6,18 +6,7 @@
@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-col sm:flex-row sm:items-center justify-between gap-3 mb-5">
<div class="flex gap-2 flex-wrap">
@foreach(['all','draft','sent','paid','overdue'] as $s)
<a href="{{ request()->fullUrlWithQuery(['status' => $s]) }}"
class="px-3 py-1.5 rounded-full text-xs font-semibold transition-colors
{{ request('status', 'all') === $s
? 'text-white'
: 'bg-white text-gray-500 hover:bg-pink-50 border border-pink-100' }}"
style="{{ request('status', 'all') === $s ? 'background:#FFB7C5' : '' }}">
{{ ucfirst($s) }}
</a>
@endforeach
</div>
<div class="flex gap-2 shrink-0"> <div class="flex gap-2 shrink-0">
<a href="{{ route('invoice-settings.edit') }}" <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"> 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">

View File

@@ -2,60 +2,107 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
@php
$accent = $invoiceSettings->accent_color ?? '#FFB7C5';
$hex = ltrim($accent, '#');
$r = hexdec(substr($hex, 0, 2));
$g = hexdec(substr($hex, 2, 2));
$b = hexdec(substr($hex, 4, 2));
// 92% white + 8% accent → very light tint
$tint = sprintf('#%02X%02X%02X',
(int)(255 * 0.92 + $r * 0.08),
(int)(255 * 0.92 + $g * 0.08),
(int)(255 * 0.92 + $b * 0.08)
);
// 80% white + 20% accent → medium-light tint (for borders)
$tintMid = sprintf('#%02X%02X%02X',
(int)(255 * 0.80 + $r * 0.20),
(int)(255 * 0.80 + $g * 0.20),
(int)(255 * 0.80 + $b * 0.20)
);
@endphp
<style> <style>
* { margin: 0; padding: 0; box-sizing: border-box; } * { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Helvetica', Arial, sans-serif; color: #374151; font-size: 13px; padding: 40px; } body { font-family: 'Helvetica', Arial, sans-serif; color: #374151; font-size: 13px; padding: 40px; }
.header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 40px; }
.logo { font-size: 22px; font-weight: 900; color: {{ $invoiceSettings->accent_color ?? '#FFB7C5' }}; } /* ── Header ───────────────────────────────── */
.logo-sub { font-size: 11px; color: #9CA3AF; margin-top: 2px; } .header-table { width: 100%; margin-bottom: 36px; }
.inv-number { font-size: 22px; font-weight: 700; color: #1F2937; text-align: right; } .logo-name { font-size: 22px; font-weight: 900; color: {{ $accent }}; }
.badge { display: inline-block; padding: 3px 12px; border-radius: 20px; font-size: 11px; font-weight: 700; background: #FDE68A; color: #92400E; } .logo-sub { font-size: 11px; color: #9CA3AF; margin-top: 3px; }
.section-title { font-size: 10px; font-weight: 700; color: #9CA3AF; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 6px; } .inv-number { font-size: 22px; font-weight: 700; color: #1F2937; }
.billing-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-bottom: 32px; }
/* ── Billing grid ─────────────────────────── */
.billing-table { width: 100%; margin-bottom: 28px; }
.section-title { font-size: 10px; font-weight: 700; color: #9CA3AF;
text-transform: uppercase; letter-spacing: 1px; margin-bottom: 6px; }
.billing-name { font-weight: 700; font-size: 15px; color: #111827; } .billing-name { font-weight: 700; font-size: 15px; color: #111827; }
.billing-detail{ font-size: 12px; color: #6B7280; margin-top: 2px; } .billing-detail{ font-size: 12px; color: #6B7280; margin-top: 2px; }
.detail-table { width: 100%; font-size: 12px; } .detail-table { font-size: 12px; width: auto; float: right; }
.detail-table td { padding: 3px 0; } .detail-table td { padding: 3px 0; }
.detail-table td:first-child { color: #9CA3AF; } .detail-table .lbl { color: #9CA3AF; padding-right: 16px; white-space: nowrap; }
.detail-table td:last-child { font-weight: 600; text-align: right; } .detail-table .val { font-weight: 600; text-align: right; white-space: nowrap; }
table.items { width: 100%; border-collapse: collapse; margin-bottom: 24px; }
table.items thead { background: #FFF0F5; } /* ── Line items ───────────────────────────── */
table.items th { padding: 10px 12px; text-align: left; font-size: 10px; font-weight: 700; color: #9CA3AF; text-transform: uppercase; } table.items { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
table.items th:last-child, table.items td:last-child { text-align: right; } table.items thead td { background: {{ $tint }}; padding: 10px 12px;
table.items th:nth-child(2), table.items td:nth-child(2) { text-align: center; } font-size: 10px; font-weight: 700; color: #9CA3AF; text-transform: uppercase; }
table.items td { padding: 10px 12px; border-bottom: 1px solid #FDE8F0; font-size: 12px; } table.items tbody td { padding: 10px 12px; border-bottom: 1px solid {{ $tintMid }}; font-size: 12px; }
.totals { display: flex; justify-content: flex-end; margin-bottom: 24px; } .td-right { text-align: right; }
.totals-box { width: 260px; } .td-center { text-align: center; }
.totals-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 12px; }
.totals-row.total { border-top: 2px solid {{ $invoiceSettings->accent_color ?? '#FFB7C5' }}; margin-top: 6px; padding-top: 8px; font-size: 15px; font-weight: 800; color: {{ $invoiceSettings->accent_color ?? '#FFB7C5' }}; } /* ── Totals ───────────────────────────────── */
.bank-box { background: #FFF5F7; border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; } .totals-wrap { width: 100%; margin-bottom: 24px; }
.totals-inner { width: 260px; float: right; }
.totals-inner table { width: 100%; font-size: 12px; border-collapse: collapse; }
.totals-inner table td { padding: 4px 0; }
.totals-inner table td.amount { text-align: right; font-weight: 600; }
.totals-total td { border-top: 2px solid {{ $accent }};
padding-top: 8px !important; margin-top: 6px;
font-size: 15px; font-weight: 800; color: {{ $accent }}; }
.clearfix::after { content: ""; display: table; clear: both; }
/* ── Payment info ─────────────────────────── */
.bank-box { background: {{ $tint }}; border-radius: 10px;
padding: 14px 16px; margin-bottom: 16px; }
.bank-title { font-weight: 700; font-size: 12px; color: #374151; margin-bottom: 4px; } .bank-title { font-weight: 700; font-size: 12px; color: #374151; margin-bottom: 4px; }
.bank-detail { font-size: 12px; color: #6B7280; } .bank-detail { font-size: 12px; color: #6B7280; }
.notes { font-size: 11px; color: #9CA3AF; font-style: italic; } .notes { font-size: 11px; color: #9CA3AF; font-style: italic; }
.footer { margin-top: 40px; text-align: center; font-size: 11px; color: #D1D5DB; } .footer { margin-top: 40px; text-align: center; font-size: 11px; color: #D1D5DB; }
</style> </style>
</head> </head>
<body> <body>
<div class="header"> {{-- ── Header ─────────────────────────────────────────────────── --}}
<div style="display:flex; align-items:center; gap:12px;"> <table class="header-table" cellpadding="0" cellspacing="0">
<tr>
<td style="vertical-align:middle;">
<table cellpadding="0" cellspacing="0">
<tr>
@if($invoiceSettings->header_logo && file_exists(storage_path('app/public/' . $invoiceSettings->header_logo))) @if($invoiceSettings->header_logo && file_exists(storage_path('app/public/' . $invoiceSettings->header_logo)))
<td style="vertical-align:middle; padding-right:12px; width:64px;">
<img src="{{ 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"> style="width:52px; height:52px; object-fit:cover; border-radius:12px; display:block;" alt="Logo">
</td>
@endif @endif
<div> <td style="vertical-align:middle;">
<div class="logo">{{ $invoiceSettings->header_name ?: 'KOL Manager' }}</div> <div class="logo-name">{{ $invoiceSettings->header_name ?: 'KOL Manager' }}</div>
<div class="logo-sub">{{ $invoiceSettings->header_title ?: 'Personal Talent Assistant' }}</div> <div class="logo-sub">{{ $invoiceSettings->header_title ?: 'Personal Talent Assistant' }}</div>
</div> </td>
</div> </tr>
<div style="text-align:right"> </table>
</td>
<td style="text-align:right; vertical-align:top;">
<div class="inv-number">{{ $invoice->invoice_number }}</div> <div class="inv-number">{{ $invoice->invoice_number }}</div>
<div style="margin-top:4px"><span class="badge">{{ $invoice->status->label() }}</span></div> </td>
</div> </tr>
</div> </table>
<div class="billing-grid"> {{-- ── Billing Info ─────────────────────────────────────────────── --}}
<div> <table class="billing-table" cellpadding="0" cellspacing="0">
<tr>
<td style="width:50%; vertical-align:top; padding-right:24px;">
<div class="section-title">Bill To</div> <div class="section-title">Bill To</div>
@if($invoice->client) @if($invoice->client)
<div class="billing-name">{{ $invoice->client->name }}</div> <div class="billing-name">{{ $invoice->client->name }}</div>
@@ -65,27 +112,28 @@
@else @else
<div class="billing-detail">—</div> <div class="billing-detail">—</div>
@endif @endif
</div> </td>
<div style="text-align:right"> <td style="width:50%; vertical-align:top; text-align:right;">
<div class="section-title">Invoice Details</div> <div class="section-title">Invoice Details</div>
<table class="detail-table"> <table class="detail-table" cellpadding="0" cellspacing="0">
<tr><td>Issue Date</td><td>{{ $invoice->issue_date->format('d M Y') }}</td></tr> <tr><td class="lbl">Issue Date</td><td class="val">{{ $invoice->issue_date->format('d M Y') }}</td></tr>
<tr><td>Due Date</td><td>{{ $invoice->due_date->format('d M Y') }}</td></tr> <tr><td class="lbl">Due Date</td><td class="val">{{ $invoice->due_date->format('d M Y') }}</td></tr>
@if($invoice->paid_date) @if($invoice->paid_date)
<tr><td>Paid Date</td><td>{{ $invoice->paid_date->format('d M Y') }}</td></tr> <tr><td class="lbl">Paid Date</td><td class="val">{{ $invoice->paid_date->format('d M Y') }}</td></tr>
@endif @endif
<tr><td>Currency</td><td>{{ $invoice->currency }}</td></tr>
</table> </table>
</div> </td>
</div> </tr>
</table>
<table class="items"> {{-- ── Line Items ───────────────────────────────────────────────── --}}
<table class="items" cellpadding="0" cellspacing="0">
<thead> <thead>
<tr> <tr>
<th>Description</th> <td style="width:50%;">Description</td>
<th>Qty</th> <td class="td-center" style="width:10%;">Qty</td>
<th style="text-align:right">Unit Price</th> <td class="td-right" style="width:20%;">Unit Price</td>
<th>Total</th> <td class="td-right" style="width:20%;">Total</td>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@@ -97,24 +145,37 @@
<span style="margin-left:6px; font-size:10px; background:#F3F4F6; color:#6B7280; padding:2px 8px; border-radius:10px; font-weight:600;">Non-Taxable</span> <span style="margin-left:6px; font-size:10px; background:#F3F4F6; color:#6B7280; padding:2px 8px; border-radius:10px; font-weight:600;">Non-Taxable</span>
@endif @endif
</td> </td>
<td style="text-align:center">{{ $item->quantity }}</td> <td class="td-center">{{ $item->quantity }}</td>
<td style="text-align:right">Rp {{ number_format($item->unit_price, 0, ',', '.') }}</td> <td class="td-right">Rp {{ number_format($item->unit_price, 0, ',', '.') }}</td>
<td style="text-align:right; font-weight:600">Rp {{ number_format($item->total, 0, ',', '.') }}</td> <td class="td-right" style="font-weight:600;">Rp {{ number_format($item->total, 0, ',', '.') }}</td>
</tr> </tr>
@endforeach @endforeach
</tbody> </tbody>
</table> </table>
<div class="totals"> {{-- ── Totals ───────────────────────────────────────────────────── --}}
<div class="totals-box"> <div class="totals-wrap clearfix">
<div class="totals-row"><span>Subtotal</span><span>Rp {{ number_format($invoice->subtotal, 0, ',', '.') }}</span></div> <div class="totals-inner">
<table cellpadding="0" cellspacing="0">
<tr>
<td style="color:#6B7280;">Subtotal</td>
<td class="amount">Rp {{ number_format($invoice->subtotal, 0, ',', '.') }}</td>
</tr>
@if($invoice->tax_rate > 0) @if($invoice->tax_rate > 0)
<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> <tr>
<td style="color:#D97706;">Tax ({{ $invoice->tax_rate }}% — paid by client)</td>
<td class="amount" style="color:#D97706;">Rp {{ number_format($invoice->tax_amount, 0, ',', '.') }}</td>
</tr>
@endif @endif
<div class="totals-row total"><span>Total (you receive)</span><span>{{ $invoice->formatted_total }}</span></div> <tr class="totals-total">
<td>Grand Total</td>
<td class="amount">{{ $invoice->formatted_total }}</td>
</tr>
</table>
</div> </div>
</div> </div>
{{-- ── Payment Info ──────────────────────────────────────────────── --}}
@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>
@@ -130,7 +191,7 @@
<div class="notes">{{ $invoice->notes }}</div> <div class="notes">{{ $invoice->notes }}</div>
@endif @endif
<div class="footer">Generated by KOL Manager · Thank you for the collaboration! 🐱</div> <div class="footer">Generated by KOL Manager · Thank you for the collaboration!</div>
</body> </body>
</html> </html>

View File

@@ -61,29 +61,79 @@
<div class="cat-card p-5"> <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> <h2 class="text-sm font-bold text-gray-700 mb-4 flex items-center gap-2">🎨 Invoice Header</h2>
@if($settings->header_logo) {{-- Logo auto-upload (independent of main Save form) --}}
<div class="mb-3 flex items-center gap-3"> <div class="mb-4"
<img src="{{ asset('storage/' . $settings->header_logo) }}" x-data="{
alt="Logo" class="h-16 w-16 object-cover rounded-2xl border border-pink-100"> uploading: false,
<div> errorMsg: '',
<p class="text-xs font-semibold text-gray-600">Current Logo</p> logoUrl: '{{ $settings->header_logo ? asset('storage/' . $settings->header_logo) : '' }}',
<p class="text-xs text-gray-400 mt-0.5">Upload a new file to replace it</p>
</div> async pickFile(input) {
</div> if (!input.files.length) return;
@endif this.uploading = true;
this.errorMsg = '';
const fd = new FormData();
fd.append('header_logo', input.files[0]);
fd.append('_token', document.querySelector('meta[name=csrf-token]').content);
try {
const res = await fetch('{{ route('invoice-settings.upload-logo') }}', { method: 'POST', body: fd });
const data = await res.json();
if (res.ok) {
this.logoUrl = data.url + '?t=' + Date.now();
} else {
this.errorMsg = data.message ?? 'Upload failed.';
}
} catch {
this.errorMsg = 'Network error. Please try again.';
}
this.uploading = false;
input.value = '';
},
async removeLogo() {
if (!confirm('Remove this logo?')) return;
const fd = new FormData();
fd.append('_token', document.querySelector('meta[name=csrf-token]').content);
fd.append('_method', 'DELETE');
await fetch('{{ route('invoice-settings.delete-logo') }}', { method: 'POST', body: fd });
this.logoUrl = '';
}
}">
{{-- Current logo preview --}}
<template x-if="logoUrl">
<div class="flex items-center gap-3 mb-3">
<img :src="logoUrl" alt="Logo"
class="h-16 w-16 object-cover rounded-2xl border border-pink-100 shrink-0">
<div class="flex-1 min-w-0">
<p class="text-xs font-semibold text-gray-600">Current Logo</p>
<p class="text-xs text-gray-400 mt-0.5">Choose a new file to replace it</p>
</div>
<button type="button" @click="removeLogo()"
class="text-xs px-3 py-1.5 rounded-full border border-red-200 text-red-400 hover:bg-red-50 shrink-0">
🗑️ Remove
</button>
</div>
</template>
<div class="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> <label class="block text-xs font-semibold text-gray-600 mb-1">Logo / Profile Picture</label>
<input type="file" name="header_logo" accept="image/*" <div class="relative">
<input type="file" accept="image/*"
@change="pickFile($event.target)"
class="w-full text-sm text-gray-600 class="w-full text-sm text-gray-600
file:mr-3 file:py-1.5 file:px-4 file:mr-3 file:py-1.5 file:px-4
file:rounded-full file:border-0 file:rounded-full file:border-0
file:text-xs file:font-semibold file:text-xs file:font-semibold
file:bg-pink-50 file:text-pink-600 file:bg-pink-50 file:text-pink-600
hover:file:bg-pink-100 cursor-pointer"> 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> :disabled="uploading">
<span x-show="uploading" class="text-xs text-pink-500 mt-1 block">Uploading…</span>
<span x-show="errorMsg" x-text="errorMsg" class="text-xs text-red-500 mt-1 block"></span>
</div> </div>
<p class="text-xs text-gray-400 mt-1">Max 2 MB. Uploads immediately on file selection.</p>
</div>
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
<div> <div>
<label class="block text-xs font-semibold text-gray-600 mb-1">Talent / Business Name</label> <label class="block text-xs font-semibold text-gray-600 mb-1">Talent / Business Name</label>
<input type="text" name="header_name" <input type="text" name="header_name"
@@ -101,14 +151,6 @@
<div class="flex items-center gap-3 mt-1"> <div class="flex items-center gap-3 mt-1">
<input type="color" name="accent_color" x-model="color" <input type="color" name="accent_color" x-model="color"
class="w-10 h-10 rounded-xl cursor-pointer border-2 border-pink-100 p-0.5"> class="w-10 h-10 rounded-xl cursor-pointer border-2 border-pink-100 p-0.5">
<div class="flex gap-2 flex-wrap">
@foreach(['#FFB7C5','#B5EAD7','#FDFD96','#E8D5F5','#FFD5B8','#AEC6CF','#FF8FAD','#A8D8EA'] as $preset)
<button type="button"
class="w-7 h-7 rounded-full ring-2 ring-transparent hover:ring-gray-400 transition-all"
style="background:{{ $preset }}"
@click="color = '{{ $preset }}'"></button>
@endforeach
</div>
</div> </div>
<p class="text-xs text-gray-400 mt-1.5">Applied to your invoice header name and totals.</p> <p class="text-xs text-gray-400 mt-1.5">Applied to your invoice header name and totals.</p>
</div> </div>

View File

@@ -63,9 +63,21 @@
</div> </div>
{{-- Line Items --}} {{-- Line Items --}}
@php
$accent = $invoiceSettings->accent_color ?? '#FFB7C5';
$hex = ltrim($accent, '#');
$r = hexdec(substr($hex, 0, 2));
$g = hexdec(substr($hex, 2, 2));
$b = hexdec(substr($hex, 4, 2));
$tint = sprintf('#%02X%02X%02X',
(int)(255 * 0.92 + $r * 0.08),
(int)(255 * 0.92 + $g * 0.08),
(int)(255 * 0.92 + $b * 0.08)
);
@endphp
<table class="w-full mb-6"> <table class="w-full mb-6">
<thead class="bg-pink-50"> <thead>
<tr class="text-xs text-gray-500 uppercase"> <tr class="text-xs text-gray-500 uppercase" style="background:{{ $tint }}">
<th class="text-left py-3 px-4 rounded-l-2xl">Description</th> <th class="text-left py-3 px-4 rounded-l-2xl">Description</th>
<th class="text-center py-3 px-4">Qty</th> <th class="text-center py-3 px-4">Qty</th>
<th class="text-right py-3 px-4">Unit Price</th> <th class="text-right py-3 px-4">Unit Price</th>
@@ -103,14 +115,14 @@
@endif @endif
<div class="flex justify-between text-base font-bold pt-2 border-t border-pink-200" <div class="flex justify-between text-base font-bold pt-2 border-t border-pink-200"
style="color:{{ $invoiceSettings->accent_color ?? '#FFB7C5' }}"> style="color:{{ $invoiceSettings->accent_color ?? '#FFB7C5' }}">
<span>Total (you receive)</span><span>{{ $invoice->formatted_total }}</span> <span>Grand Total</span><span>{{ $invoice->formatted_total }}</span>
</div> </div>
</div> </div>
</div> </div>
{{-- Bank Info --}} {{-- Bank Info --}}
@if($invoice->bank_name) @if($invoice->bank_name)
<div class="bg-pink-50 rounded-2xl p-4 text-sm"> <div class="rounded-2xl p-4 text-sm" style="background:{{ $tint }}">
<div class="font-semibold text-gray-700 mb-2">💳 Payment Info</div> <div class="font-semibold text-gray-700 mb-2">💳 Payment Info</div>
<div class="text-gray-600"> <div class="text-gray-600">
{{ $invoice->bank_name }} {{ $invoice->bank_name }}

View File

@@ -121,6 +121,12 @@
<span class="text-lg shrink-0">📁</span> Files <span class="text-lg shrink-0">📁</span> Files
</a> </a>
<a href="{{ route('notes.index') }}"
@click="sidebarOpen = false"
class="nav-item {{ request()->routeIs('notes.*') ? 'active' : '' }}">
<span class="text-lg shrink-0">📝</span> Notes
</a>
<div class="text-xs font-bold text-gray-400 uppercase tracking-wider mt-4 mb-1 px-2">Settings</div> <div class="text-xs font-bold text-gray-400 uppercase tracking-wider mt-4 mb-1 px-2">Settings</div>
<a href="{{ route('settings.notifications') }}" <a href="{{ route('settings.notifications') }}"
@@ -223,7 +229,7 @@
{{-- Avatar --}} {{-- Avatar --}}
<div class="w-8 h-8 lg:w-9 lg:h-9 rounded-full flex items-center justify-center text-white font-bold text-xs lg:text-sm shadow-sm" <div class="w-8 h-8 lg:w-9 lg:h-9 rounded-full flex items-center justify-center text-white font-bold text-xs lg:text-sm shadow-sm"
style="background: linear-gradient(135deg, #FFB7C5, #E8D5F5);"> style="background: linear-gradient(135deg, #FFB7C5, #E8D5F5);">
KOL FUN
</div> </div>
</div> </div>
</header> </header>

View File

@@ -0,0 +1,483 @@
@extends('layouts.app')
@section('title', 'Notes')
@section('page-title', '📝 Notes')
@section('page-subtitle', 'Quick notes, checklists & reminders')
@section('content')
<div x-data="notesApp({{ json_encode($notes) }})" x-cloak>
{{-- ── Toolbar ──────────────────────────────────────────────── --}}
<div class="flex items-center gap-2 mb-4">
<button @click="openNew()"
class="btn-sakura text-sm px-4 py-2 flex items-center gap-1.5 shrink-0">
+ New Note
</button>
{{-- Search --}}
<div class="relative flex-1 max-w-xs">
<span class="absolute left-3 top-1/2 -translate-y-1/2 text-gray-400 text-sm pointer-events-none">🔍</span>
<input type="text" x-model="searchQuery" placeholder="Search notes…"
class="input-soft pl-9 text-sm py-2 w-full">
</div>
{{-- Count --}}
<span class="ml-auto text-xs text-gray-400 shrink-0"
x-text="notes.length + ' note' + (notes.length !== 1 ? 's' : '')"></span>
</div>
{{-- ── Pinned section ───────────────────────────────────────── --}}
<template x-if="filteredPinned.length > 0">
<div class="mb-5">
<div class="text-xs font-bold text-gray-400 uppercase tracking-wider mb-2 flex items-center gap-1.5">
📌 Pinned
</div>
<div class="grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 gap-3">
<template x-for="note in filteredPinned" :key="note.id">
<div class="rounded-3xl p-4 flex flex-col gap-2 shadow-sm border border-black/5 cursor-pointer
hover:shadow-md transition-shadow duration-200 group relative"
:style="`background:${note.color || '#FFFFFF'}`"
@click="openEdit(note)">
{{-- Pin badge --}}
<div class="absolute top-2.5 right-2.5 text-xs text-amber-400 opacity-60 group-hover:opacity-100">📌</div>
{{-- Title --}}
<p class="font-bold text-gray-800 text-sm leading-snug pr-5 line-clamp-2"
x-text="note.title || 'Untitled'"></p>
{{-- Content preview --}}
<div class="flex-1 text-xs text-gray-500 space-y-0.5 line-clamp-4">
<template x-for="(block, i) in (note.content || []).slice(0, 4)" :key="i">
<div class="flex items-start gap-1.5 min-w-0">
<template x-if="block.type === 'bullet'">
<span class="shrink-0 text-gray-400 mt-px">•</span>
</template>
<template x-if="block.type === 'checkbox'">
<span class="shrink-0 mt-px" x-text="block.checked ? '☑' : '☐'"></span>
</template>
<span class="truncate"
:class="block.type === 'checkbox' && block.checked ? 'line-through text-gray-400' : ''"
x-text="block.text || '…'"></span>
</div>
</template>
</div>
{{-- Footer --}}
<div class="flex items-center justify-between mt-1">
<span class="text-xs text-gray-400" x-text="formatDate(note.updated_at)"></span>
<button @click.stop="deleteNote(note)"
class="opacity-0 group-hover:opacity-100 text-xs text-red-400 hover:text-red-600 transition-opacity leading-none px-1">✕</button>
</div>
</div>
</template>
</div>
</div>
</template>
{{-- ── All / Other notes ────────────────────────────────────── --}}
<template x-if="filteredUnpinned.length > 0 || (filteredPinned.length > 0)">
<div>
<template x-if="filteredPinned.length > 0 && filteredUnpinned.length > 0">
<div class="text-xs font-bold text-gray-400 uppercase tracking-wider mb-2">Others</div>
</template>
<div class="grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 gap-3">
<template x-for="note in filteredUnpinned" :key="note.id">
<div class="rounded-3xl p-4 flex flex-col gap-2 shadow-sm border border-black/5 cursor-pointer
hover:shadow-md transition-shadow duration-200 group"
:style="`background:${note.color || '#FFFFFF'}`"
@click="openEdit(note)">
{{-- Title --}}
<p class="font-bold text-gray-800 text-sm leading-snug line-clamp-2"
x-text="note.title || 'Untitled'"></p>
{{-- Content preview --}}
<div class="flex-1 text-xs text-gray-500 space-y-0.5">
<template x-for="(block, i) in (note.content || []).slice(0, 4)" :key="i">
<div class="flex items-start gap-1.5 min-w-0">
<template x-if="block.type === 'bullet'">
<span class="shrink-0 text-gray-400 mt-px">•</span>
</template>
<template x-if="block.type === 'checkbox'">
<span class="shrink-0 mt-px" x-text="block.checked ? '☑' : '☐'"></span>
</template>
<span class="truncate"
:class="block.type === 'checkbox' && block.checked ? 'line-through text-gray-400' : ''"
x-text="block.text || '…'"></span>
</div>
</template>
</div>
{{-- Footer --}}
<div class="flex items-center justify-between mt-1">
<span class="text-xs text-gray-400" x-text="formatDate(note.updated_at)"></span>
<button @click.stop="deleteNote(note)"
class="opacity-0 group-hover:opacity-100 text-xs text-red-400 hover:text-red-600 transition-opacity leading-none px-1">✕</button>
</div>
</div>
</template>
</div>
</div>
</template>
{{-- ── Empty state ──────────────────────────────────────────── --}}
<template x-if="notes.length === 0">
<div class="text-center py-20 text-gray-400">
<span class="text-5xl block mb-3">📝</span>
<p class="text-sm font-medium mb-4">No notes yet.</p>
<button @click="openNew()" class="btn-sakura text-sm">Write your first note</button>
</div>
</template>
<template x-if="notes.length > 0 && filteredPinned.length === 0 && filteredUnpinned.length === 0">
<div class="text-center py-12 text-gray-400">
<span class="text-3xl block mb-2">🔍</span>
<p class="text-sm">No notes match "<span x-text="searchQuery"></span>"</p>
</div>
</template>
{{-- ════════════════════════════════════════════════════════════
Note Editor Modal
════════════════════════════════════════════════════════════ --}}
<div x-show="showModal"
x-transition:enter="transition ease-out duration-200"
x-transition:enter-start="opacity-0"
x-transition:enter-end="opacity-100"
x-transition:leave="transition ease-in duration-150"
x-transition:leave-start="opacity-100"
x-transition:leave-end="opacity-0"
class="fixed inset-0 z-50 flex items-end sm:items-center justify-center bg-black/40 px-0 sm:px-4"
style="display:none"
@keydown.escape.window="showModal = false">
<div class="w-full sm:max-w-lg rounded-t-3xl sm:rounded-3xl shadow-2xl flex flex-col overflow-hidden"
:style="`background:${editorColor || '#FFFFFF'}`"
style="max-height:90vh"
@click.stop>
{{-- ── Modal Header ─────────────────────────────── --}}
<div class="flex items-center gap-2 px-4 pt-4 pb-3 border-b border-black/5 shrink-0">
{{-- Color swatches --}}
<div class="flex gap-1.5 flex-wrap">
<template x-for="c in noteColors" :key="c">
<button @click="editorColor = c" type="button"
class="w-5 h-5 rounded-full border-2 transition-transform hover:scale-110 shrink-0"
:style="`background:${c}`"
:class="editorColor === c ? 'border-gray-500 scale-110' : 'border-gray-200'">
</button>
</template>
</div>
{{-- Pin toggle --}}
<button @click="editorPinned = !editorPinned" type="button"
class="ml-auto text-sm px-2.5 py-1 rounded-full border transition-colors shrink-0"
:class="editorPinned ? 'border-amber-300 bg-amber-50 text-amber-600' : 'border-gray-200 text-gray-400 hover:border-amber-200 hover:text-amber-400'">
📌 <span x-text="editorPinned ? 'Pinned' : 'Pin'"></span>
</button>
{{-- Close --}}
<button @click="showModal = false" type="button"
class="text-gray-400 hover:text-gray-600 text-xl leading-none shrink-0 ml-1">✕</button>
</div>
{{-- ── Scrollable Body ──────────────────────────── --}}
<div class="flex-1 overflow-y-auto px-4 py-3 space-y-1">
{{-- Title --}}
<input type="text" x-model="editorTitle" x-ref="titleInput"
placeholder="Note title…"
class="w-full bg-transparent border-none outline-none font-bold text-gray-800 text-lg placeholder-gray-300 mb-2"
@keydown.enter.prevent="focusFirstBlock()">
{{-- Blocks --}}
<template x-for="(block, idx) in editorBlocks" :key="block.id">
<div class="flex items-center gap-2 group/block py-0.5">
{{-- Left side: bullet / checkbox / empty --}}
<template x-if="block.type === 'bullet'">
<span class="text-gray-400 text-sm shrink-0 select-none mt-px">•</span>
</template>
<template x-if="block.type === 'checkbox'">
<input type="checkbox" x-model="block.checked"
class="w-4 h-4 accent-pink-400 shrink-0 cursor-pointer mt-px"
@click.stop>
</template>
<template x-if="block.type === 'paragraph'">
<span class="w-4 shrink-0"></span>
</template>
{{-- Text input --}}
<input type="text"
x-model="block.text"
:placeholder="block.type === 'paragraph' ? 'Add text…' : block.type === 'bullet' ? 'List item…' : 'To-do item…'"
:class="block.type === 'checkbox' && block.checked ? 'line-through text-gray-400' : 'text-gray-700'"
class="flex-1 bg-transparent border-none outline-none text-sm placeholder-gray-300 py-0.5"
:data-block-id="block.id"
@keydown.enter.prevent="insertBlockAfter(idx)"
@keydown.backspace="handleBackspace($event, block, idx)">
{{-- Block type switcher (hover) --}}
<div class="flex gap-0.5 opacity-0 group-hover/block:opacity-100 transition-opacity shrink-0">
<button @click.stop="changeType(idx, 'paragraph')" type="button"
:class="block.type === 'paragraph' ? 'text-pink-500' : 'text-gray-300 hover:text-gray-500'"
class="text-xs px-1 leading-none" title="Text">T</button>
<button @click.stop="changeType(idx, 'bullet')" type="button"
:class="block.type === 'bullet' ? 'text-pink-500' : 'text-gray-300 hover:text-gray-500'"
class="text-xs px-1 leading-none" title="Bullet">•</button>
<button @click.stop="changeType(idx, 'checkbox')" type="button"
:class="block.type === 'checkbox' ? 'text-pink-500' : 'text-gray-300 hover:text-gray-500'"
class="text-xs px-1 leading-none" title="Checkbox">☐</button>
<button @click.stop="removeBlock(idx)" type="button"
class="text-xs px-1 leading-none text-gray-300 hover:text-red-400 ml-1" title="Remove">✕</button>
</div>
</div>
</template>
{{-- Add block toolbar --}}
<div class="flex gap-2 pt-3 border-t border-black/5 mt-2">
<button @click="addBlock('paragraph')" type="button"
class="flex items-center gap-1 text-xs px-3 py-1.5 rounded-full border border-gray-200 text-gray-500 hover:bg-white/60 hover:border-gray-300 transition-colors">
<span class="font-semibold">T</span> Text
</button>
<button @click="addBlock('bullet')" type="button"
class="flex items-center gap-1 text-xs px-3 py-1.5 rounded-full border border-gray-200 text-gray-500 hover:bg-white/60 hover:border-gray-300 transition-colors">
• Bullet
</button>
<button @click="addBlock('checkbox')" type="button"
class="flex items-center gap-1 text-xs px-3 py-1.5 rounded-full border border-gray-200 text-gray-500 hover:bg-white/60 hover:border-gray-300 transition-colors">
☐ Checkbox
</button>
</div>
</div>
{{-- ── Modal Footer ─────────────────────────────── --}}
<div class="flex gap-2 px-4 pb-5 pt-3 border-t border-black/5 shrink-0">
<button @click="saveNote()" type="button"
class="btn-sakura flex-1 py-2.5 text-sm flex items-center justify-center gap-2"
:disabled="saving">
<span x-show="!saving">💾 Save Note</span>
<span x-show="saving" class="flex items-center gap-1.5"><span class="animate-spin inline-block">🐾</span> Saving…</span>
</button>
<button @click="showModal = false" type="button"
class="flex-1 py-2.5 rounded-full border border-pink-200 text-gray-600 text-sm hover:bg-pink-50 transition-colors">
Cancel
</button>
</div>
</div>
</div>
</div>{{-- end x-data --}}
@push('scripts')
<script>
function notesApp(initialNotes) {
return {
notes: initialNotes,
showModal: false,
editing: null,
// editor state
editorTitle: '',
editorBlocks: [],
editorColor: '#FFFFFF',
editorPinned: false,
saving: false,
nextBlockId: 1,
searchQuery: '',
noteColors: [
'#FFFFFF', '#FFE4E8', '#FFF9C4', '#E8F5E9',
'#E3F2FD', '#F3E5F5', '#FFF3E0', '#E0F7FA'
],
// ── Computed / Filtered ───────────────────────────────
get filteredPinned() {
return this.filterNotes(this.notes.filter(n => n.is_pinned));
},
get filteredUnpinned() {
return this.filterNotes(this.notes.filter(n => !n.is_pinned));
},
filterNotes(list) {
const q = this.searchQuery.trim().toLowerCase();
if (!q) return list;
return list.filter(n =>
(n.title || '').toLowerCase().includes(q) ||
(n.content || []).some(b => (b.text || '').toLowerCase().includes(q))
);
},
// ── Modal open/close ─────────────────────────────────
openNew() {
this.editing = null;
this.editorTitle = '';
this.editorBlocks = [this.makeBlock('paragraph')];
this.editorColor = '#FFFFFF';
this.editorPinned = false;
this.showModal = true;
this.$nextTick(() => this.$refs.titleInput?.focus());
},
openEdit(note) {
this.editing = note;
this.editorTitle = note.title || '';
this.editorBlocks = (note.content && note.content.length)
? note.content.map(b => ({ ...b, id: this.nextBlockId++ }))
: [this.makeBlock('paragraph')];
this.editorColor = note.color || '#FFFFFF';
this.editorPinned = !!note.is_pinned;
this.showModal = true;
this.$nextTick(() => this.$refs.titleInput?.focus());
},
// ── CRUD ─────────────────────────────────────────────
async saveNote() {
if (!this.editorTitle.trim()) {
this.$refs.titleInput?.focus();
return;
}
this.saving = true;
const csrfToken = document.querySelector('meta[name=csrf-token]').content;
const payload = {
title: this.editorTitle.trim(),
content: this.editorBlocks.map(({ type, text, checked }) => ({ type, text: text || '', checked: !!checked })),
color: this.editorColor,
is_pinned: this.editorPinned,
};
const url = this.editing ? `/notes/${this.editing.id}` : '/notes';
const method = this.editing ? 'PUT' : 'POST';
try {
const res = await fetch(url, {
method,
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-CSRF-TOKEN': csrfToken,
},
body: JSON.stringify(payload),
});
const saved = await res.json();
if (this.editing) {
const idx = this.notes.findIndex(n => n.id === this.editing.id);
if (idx !== -1) this.notes.splice(idx, 1, saved);
} else {
this.notes.unshift(saved);
}
this.showModal = false;
} catch (err) {
console.error('Save failed', err);
}
this.saving = false;
},
async deleteNote(note) {
if (!confirm(`Delete "${note.title || 'this note'}"?`)) return;
const csrfToken = document.querySelector('meta[name=csrf-token]').content;
const res = await fetch(`/notes/${note.id}`, {
method: 'DELETE',
headers: { 'Accept': 'application/json', 'X-CSRF-TOKEN': csrfToken },
});
if (res.ok) {
this.notes = this.notes.filter(n => n.id !== note.id);
if (this.editing && this.editing.id === note.id) {
this.showModal = false;
}
}
},
async togglePin(note) {
const csrfToken = document.querySelector('meta[name=csrf-token]').content;
const res = await fetch(`/notes/${note.id}/pin`, {
method: 'PATCH',
headers: { 'Accept': 'application/json', 'X-CSRF-TOKEN': csrfToken },
});
if (res.ok) {
const updated = await res.json();
const idx = this.notes.findIndex(n => n.id === note.id);
if (idx !== -1) this.notes.splice(idx, 1, updated);
}
},
// ── Block editor helpers ──────────────────────────────
makeBlock(type = 'paragraph') {
return { id: this.nextBlockId++, type, text: '', checked: false };
},
insertBlockAfter(idx) {
const currentType = this.editorBlocks[idx]?.type ?? 'paragraph';
const newBlock = this.makeBlock(currentType);
this.editorBlocks.splice(idx + 1, 0, newBlock);
this.$nextTick(() => {
document.querySelector(`[data-block-id="${newBlock.id}"]`)?.focus();
});
},
handleBackspace(e, block, idx) {
if (block.text === '' && this.editorBlocks.length > 1) {
e.preventDefault();
this.editorBlocks.splice(idx, 1);
this.$nextTick(() => {
const target = this.editorBlocks[Math.max(0, idx - 1)];
if (target) document.querySelector(`[data-block-id="${target.id}"]`)?.focus();
});
}
},
addBlock(type) {
const nb = this.makeBlock(type);
this.editorBlocks.push(nb);
this.$nextTick(() => {
document.querySelector(`[data-block-id="${nb.id}"]`)?.focus();
});
},
removeBlock(idx) {
if (this.editorBlocks.length > 1) {
this.editorBlocks.splice(idx, 1);
}
},
changeType(idx, type) {
this.editorBlocks[idx].type = type;
},
focusFirstBlock() {
const first = this.editorBlocks[0];
if (first) {
this.$nextTick(() => {
document.querySelector(`[data-block-id="${first.id}"]`)?.focus();
});
}
},
// ── Utilities ─────────────────────────────────────────
formatDate(dt) {
if (!dt) return '';
const d = new Date(dt);
const now = new Date();
const diff = now - d;
if (diff < 60000) return 'just now';
if (diff < 3600000) return Math.floor(diff / 60000) + 'm ago';
if (diff < 86400000) return Math.floor(diff / 3600000) + 'h ago';
if (diff < 604800000) return Math.floor(diff / 86400000) + 'd ago';
return d.toLocaleDateString('en-GB', { day: 'numeric', month: 'short' });
},
};
}
</script>
@endpush
@endsection

View File

@@ -73,10 +73,6 @@
<a href="mailto:{{ $profile->email }}" class="contact-pill">✉️ {{ $profile->email }}</a> <a href="mailto:{{ $profile->email }}" class="contact-pill">✉️ {{ $profile->email }}</a>
@endif @endif
</div> </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)

View File

@@ -0,0 +1,323 @@
@extends('layouts.app')
@section('title', 'Add Event')
@section('page-title', 'Add Event 📅')
@section('page-subtitle', 'Schedule a new task, meeting, or posting')
@section('content')
<div class="max-w-2xl mx-auto">
<div class="flex items-center gap-3 mb-5">
<a href="{{ route('schedule.index') }}"
class="text-xs px-3 py-2 rounded-full border border-pink-200 text-gray-500 hover:bg-pink-50">
← Back to Schedule
</a>
</div>
<div class="cat-card p-4 lg:p-8">
<form action="{{ route('schedule.store') }}" method="POST" id="create-event-form"
x-data="contractCheck('{{ route('contracts.check') }}')"
class="space-y-5">
@csrf
<input type="hidden" name="start_time" id="start_time_hidden">
<input type="hidden" name="end_time" id="end_time_hidden">
{{-- Title --}}
<div>
<label class="block text-sm font-semibold text-gray-700 mb-1">
Title <span class="text-pink-400">*</span>
</label>
<input type="text" name="title" value="{{ old('title') }}"
class="input-soft" placeholder="Event title" required>
@error('title') <p class="text-xs text-red-500 mt-1">{{ $message }}</p> @enderror
</div>
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
{{-- Type --}}
<div>
<label class="block text-sm font-semibold text-gray-700 mb-1">Type</label>
<select name="event_type" class="input-soft">
@foreach(['task' => '📋 Task', 'meeting' => '🤝 Meeting', 'deadline' => '⏰ Deadline', 'posting' => '📸 Posting'] as $val => $label)
<option value="{{ $val }}" {{ old('event_type') === $val ? 'selected' : '' }}>
{{ $label }}
</option>
@endforeach
</select>
</div>
{{-- Client --}}
<div x-data="{
isNew: false,
saving: false,
newName: '', newEmail: '', newPhone: '', newCompany: '',
errMsg: '',
onClientChange(e) {
this.isNew = (e.target.value === '__new__');
if (!this.isNew) {
clientId = e.target.value;
$dispatch('contract-check');
}
},
async saveNewClient() {
if (!this.newName.trim()) { this.errMsg = 'Name is required.'; return; }
this.saving = true; this.errMsg = '';
const fd = new FormData();
fd.append('name', this.newName);
fd.append('email', this.newEmail);
fd.append('phone', this.newPhone);
fd.append('company', this.newCompany);
fd.append('_token', document.querySelector('meta[name=csrf-token]').content);
const res = await fetch('{{ route('clients.quick-store') }}', { method:'POST', body: fd });
const data = await res.json();
if (res.ok) {
// Add new option & select it
const sel = document.getElementById('client-select');
const opt = new Option(data.name, data.id, true, true);
sel.add(opt, sel.options[1]);
sel.value = data.id;
sel.dispatchEvent(new Event('change'));
this.isNew = false;
this.newName = this.newEmail = this.newPhone = this.newCompany = '';
} else {
this.errMsg = data.message ?? 'Could not create client.';
}
this.saving = false;
}
}">
<label class="block text-sm font-semibold text-gray-700 mb-1">Client</label>
<select name="client_id" id="client-select" class="input-soft"
x-model="clientId"
@change="onClientChange($event); if($event.target.value !== '__new__') checkContract()">
<option value="">— None —</option>
<option value="__new__" class="font-semibold text-pink-600">+ Create New Client…</option>
@foreach($clients as $client)
<option value="{{ $client->id }}" {{ old('client_id') == $client->id ? 'selected' : '' }}>
{{ $client->name }}
</option>
@endforeach
</select>
{{-- Quick New Client mini-form --}}
<div x-show="isNew" x-transition
class="mt-3 bg-purple-50 rounded-2xl p-4 space-y-3 border border-purple-100">
<p class="text-xs font-bold text-purple-700">🐱 New Client Basic Info</p>
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3">
<div>
<label class="block text-xs font-semibold text-gray-600 mb-1">Name <span class="text-pink-400">*</span></label>
<input type="text" x-model="newName" class="input-soft text-sm" placeholder="Client / brand name">
</div>
<div>
<label class="block text-xs font-semibold text-gray-600 mb-1">Company</label>
<input type="text" x-model="newCompany" class="input-soft text-sm" placeholder="Company name">
</div>
<div>
<label class="block text-xs font-semibold text-gray-600 mb-1">Email</label>
<input type="email" x-model="newEmail" class="input-soft text-sm" placeholder="contact@brand.com">
</div>
<div>
<label class="block text-xs font-semibold text-gray-600 mb-1">Phone</label>
<input type="text" x-model="newPhone" class="input-soft text-sm" placeholder="+62 …">
</div>
</div>
<p x-show="errMsg" x-text="errMsg" class="text-xs text-red-500"></p>
<div class="flex gap-2 pt-1">
<button type="button" @click="saveNewClient()" :disabled="saving"
class="btn-sakura text-sm px-4 py-2" x-text="saving ? 'Saving…' : '✓ Add & Select'"></button>
<button type="button" @click="isNew = false; $el.closest('div').querySelector('select').value = ''"
class="text-sm px-4 py-2 rounded-full border border-pink-200 text-gray-500 hover:bg-pink-50">
Cancel
</button>
</div>
<p class="text-xs text-purple-400">Status will be set to Active automatically.</p>
</div>
</div>
{{-- Category --}}
<div class="sm:col-span-2">
<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 }}" {{ 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' : '' }}>
&nbsp;&nbsp;↳ {{ $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 --}}
<div>
<label class="block text-sm font-semibold text-gray-700 mb-1">
Start Date <span class="text-pink-400">*</span>
</label>
<input type="date" id="start_date" class="input-soft"
value="{{ old('_start_date') }}" required>
</div>
<div>
<label class="block text-sm font-semibold text-gray-700 mb-1">Start Time</label>
<input type="time" id="start_time_input" class="input-soft" value="09:00">
</div>
{{-- End Date --}}
<div>
<label class="block text-sm font-semibold text-gray-700 mb-1">End Date</label>
<input type="date" id="end_date" class="input-soft" value="{{ old('_end_date') }}">
</div>
<div>
<label class="block text-sm font-semibold text-gray-700 mb-1">End Time</label>
<input type="time" id="end_time_input" class="input-soft" value="18:00">
</div>
{{-- Location --}}
<div class="sm:col-span-2">
<label class="block text-sm font-semibold text-gray-700 mb-1">Location</label>
<input type="text" name="location" value="{{ old('location') }}"
class="input-soft" placeholder="Online / venue address">
</div>
</div>
{{-- Description --}}
<div>
<label class="block text-sm font-semibold text-gray-700 mb-1">Description</label>
<textarea name="description" rows="2" class="input-soft resize-none"
placeholder="Brief description…">{{ old('description') }}</textarea>
</div>
{{-- Color --}}
<div x-data="{ color: '{{ old('color', '#FFB7C5') }}' }">
<label class="block text-sm font-semibold text-gray-700 mb-2">Color</label>
<input type="hidden" name="color" :value="color">
<div class="flex items-center gap-3">
<input type="color" x-model="color"
class="w-10 h-10 rounded-xl cursor-pointer border-2 border-pink-100 p-0.5 shrink-0">
</div>
</div>
{{-- Priority --}}
<div class="flex items-center gap-2">
<input type="checkbox" name="is_priority" value="1" id="priority"
class="w-4 h-4 accent-pink-400" {{ old('is_priority') ? 'checked' : '' }}>
<label for="priority" class="text-sm text-gray-600 cursor-pointer">⭐ Mark as Priority</label>
</div>
{{-- Notes --}}
<div>
<label class="block text-sm font-semibold text-gray-700 mb-1">Notes</label>
<textarea name="notes" rows="3" class="input-soft resize-none"
placeholder="Additional notes…">{{ old('notes') }}</textarea>
</div>
{{-- ── Add to Content Board ──────────────────────────────── --}}
<div x-data="{ addToBoard: {{ old('add_to_content_board') ? 'true' : 'false' }} }">
<div class="flex items-center gap-2">
<input type="checkbox" name="add_to_content_board" value="1" id="add_to_content_board"
class="w-4 h-4 accent-pink-400" x-model="addToBoard">
<label for="add_to_content_board" class="text-sm text-gray-600 cursor-pointer">
🗂️ Also add to Content Board as a Drafting card
</label>
</div>
<div x-show="addToBoard" x-transition
class="mt-3 grid grid-cols-1 sm:grid-cols-2 gap-3 bg-purple-50 rounded-2xl p-4">
<div>
<label class="block text-xs font-semibold text-gray-600 mb-1">Platform</label>
<select name="content_platform" class="input-soft text-sm">
<option value="instagram" {{ old('content_platform') === 'instagram' ? 'selected' : '' }}>📸 Instagram</option>
<option value="tiktok" {{ old('content_platform') === 'tiktok' ? 'selected' : '' }}>🎵 TikTok</option>
<option value="youtube" {{ old('content_platform') === 'youtube' ? 'selected' : '' }}>▶️ YouTube</option>
<option value="other" {{ old('content_platform') === 'other' ? 'selected' : '' }}>📱 Other</option>
</select>
</div>
<div>
<label class="block text-xs font-semibold text-gray-600 mb-1">Content Type</label>
<select name="content_type" class="input-soft text-sm">
<option value="post" {{ old('content_type') === 'post' ? 'selected' : '' }}>Post / Feed</option>
<option value="reel" {{ old('content_type') === 'reel' ? 'selected' : '' }}>Reel / Short</option>
<option value="story" {{ old('content_type') === 'story' ? 'selected' : '' }}>Story</option>
<option value="video" {{ old('content_type') === 'video' ? 'selected' : '' }}>Long Video</option>
</select>
</div>
<p class="sm:col-span-2 text-xs text-purple-500">
A Drafting card will be created in your Content Board with this event's title and date.
</p>
</div>
</div>
{{-- ── Brand Contract ────────────────────────────────────── --}}
<div x-data="{ createContract: {{ old('create_brand_contract') ? 'true' : 'false' }} }">
<div class="flex items-center gap-2">
<input type="checkbox" name="create_brand_contract" value="1" id="create_contract"
class="w-4 h-4 accent-pink-400" x-model="createContract">
<label for="create_contract" class="text-sm text-gray-600 cursor-pointer">
📄 Also create a Brand Contract for this event
</label>
</div>
<div x-show="createContract" x-transition
class="mt-3 grid grid-cols-1 sm:grid-cols-2 gap-3 bg-pink-50 rounded-2xl p-4">
<div class="sm:col-span-2">
<label class="block text-xs font-semibold text-gray-600 mb-1">Contract Title</label>
<input type="text" name="contract_title" class="input-soft text-sm"
placeholder="e.g. Exclusive Posting Contract — BrandX"
value="{{ old('contract_title') }}">
</div>
<div>
<label class="block text-xs font-semibold text-gray-600 mb-1">Contract Start</label>
<input type="date" name="contract_start_date" class="input-soft text-sm"
value="{{ old('contract_start_date') }}">
</div>
<div>
<label class="block text-xs font-semibold text-gray-600 mb-1">Contract End</label>
<input type="date" name="contract_end_date" class="input-soft text-sm"
value="{{ old('contract_end_date') }}">
</div>
</div>
</div>
<div class="flex flex-col sm:flex-row gap-3 pt-1">
<button type="submit" class="btn-sakura flex-1 py-3"
:class="{ 'opacity-50 cursor-not-allowed': contractWarning }">
🐾 Schedule It!
</button>
<a href="{{ route('schedule.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">
Cancel
</a>
</div>
</form>
</div>
</div>
@push('scripts')
<script>
document.getElementById('create-event-form').addEventListener('submit', function (e) {
const startDate = document.getElementById('start_date').value;
const startTime = document.getElementById('start_time_input').value || '00:00';
const endDate = document.getElementById('end_date').value;
const endTime = document.getElementById('end_time_input').value || '00:00';
if (!startDate) {
e.preventDefault();
alert('Please select a start date.');
return;
}
document.getElementById('start_time_hidden').value = startDate + 'T' + startTime;
if (endDate) {
document.getElementById('end_time_hidden').value = endDate + 'T' + endTime;
}
});
</script>
@endpush
@endsection

View File

@@ -137,14 +137,6 @@
<div class="flex items-center gap-3"> <div class="flex items-center gap-3">
<input type="color" x-model="color" <input type="color" x-model="color"
class="w-10 h-10 rounded-xl cursor-pointer border-2 border-pink-100 p-0.5 shrink-0"> class="w-10 h-10 rounded-xl cursor-pointer border-2 border-pink-100 p-0.5 shrink-0">
<div class="flex gap-2 flex-wrap">
@foreach(['#FFB7C5','#B5EAD7','#FDFD96','#E8D5F5','#FFD5B8','#AEC6CF'] as $hex)
<button type="button"
class="w-8 h-8 rounded-full ring-2 ring-transparent hover:ring-gray-400 transition-all"
style="background:{{ $hex }}"
@click="color = '{{ $hex }}'"></button>
@endforeach
</div>
</div> </div>
</div> </div>

View File

@@ -6,143 +6,9 @@
@section('content') @section('content')
{{-- ── Add Event Form (always accessible, collapsible) ─────── --}} {{-- ── Add Event Button ─────────────────────────────────────── --}}
<div class="cat-card p-4 mb-4" x-data="{ open: false }"> <div class="flex items-center justify-between mb-4">
<div class="flex items-center justify-between"> <a href="{{ route('schedule.create') }}" class="btn-sakura text-sm px-5 py-2">+ Add Event</a>
<h3 class="text-sm font-bold text-gray-700 flex items-center gap-2">➕ New Event</h3>
<button class="btn-sakura text-xs px-4 py-1.5" @click="open = !open"
x-text="open ? '✕ Close' : '+ Add Event'"></button>
</div>
<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"
id="new-event-form"
x-data="contractCheck('{{ route('contracts.check') }}')"
@submit.prevent="submitIfClear($el)">
@csrf
{{-- Hidden combined datetime fields --}}
<input type="hidden" name="start_time" id="start_time_hidden">
<input type="hidden" name="end_time" id="end_time_hidden">
<div class="sm:col-span-2">
<label class="text-xs font-semibold text-gray-600">Title <span class="text-pink-400">*</span></label>
<input type="text" name="title" class="input-soft mt-1" placeholder="Event title" required>
</div>
<div>
<label class="text-xs font-semibold text-gray-600">Type</label>
<select name="event_type" class="input-soft mt-1">
<option value="task">📋 Task</option>
<option value="meeting">🤝 Meeting</option>
<option value="deadline">⏰ Deadline</option>
<option value="posting">📸 Posting</option>
</select>
</div>
<div>
<label class="text-xs font-semibold text-gray-600">Client</label>
<select name="client_id" class="input-soft mt-1" x-model="clientId" @change="checkContract()">
<option value="">— None —</option>
@foreach($clients as $client)
<option value="{{ $client->id }}">{{ $client->name }}</option>
@endforeach
</select>
</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 }}">&nbsp;&nbsp;↳ {{ $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 --}}
<div>
<label class="text-xs font-semibold text-gray-600">Start Date <span class="text-pink-400">*</span></label>
<input type="date" id="start_date" class="input-soft mt-1" required>
</div>
<div>
<label class="text-xs font-semibold text-gray-600">Start Time</label>
<input type="time" id="start_time_input" class="input-soft mt-1" value="09:00">
</div>
{{-- End: date + time side by side --}}
<div>
<label class="text-xs font-semibold text-gray-600">End Date</label>
<input type="date" id="end_date" class="input-soft mt-1">
</div>
<div>
<label class="text-xs font-semibold text-gray-600">End Time</label>
<input type="time" id="end_time_input" class="input-soft mt-1" value="18:00">
</div>
<div x-data="{ color: '#FFB7C5' }">
<label class="text-xs font-semibold text-gray-600">Color</label>
<input type="hidden" name="color" :value="color">
<div class="flex items-center gap-3 mt-1">
<input type="color" x-model="color"
class="w-9 h-9 rounded-xl cursor-pointer border-2 border-pink-100 p-0.5 shrink-0">
<div class="flex gap-2 flex-wrap">
@foreach(['#FFB7C5','#B5EAD7','#FDFD96','#E8D5F5','#FFD5B8','#AEC6CF'] as $hex)
<button type="button"
class="w-7 h-7 rounded-full ring-2 ring-transparent hover:ring-gray-400 transition-all"
style="background:{{ $hex }}"
@click="color = '{{ $hex }}'"></button>
@endforeach
</div>
</div>
</div>
<div class="flex items-center gap-2 mt-1">
<input type="checkbox" name="is_priority" value="1" id="priority" class="w-4 h-4 accent-pink-400">
<label for="priority" class="text-xs text-gray-600 cursor-pointer">⭐ Priority</label>
</div>
<div class="sm:col-span-2">
<label class="text-xs font-semibold text-gray-600">Notes</label>
<textarea name="notes" rows="2" class="input-soft mt-1 resize-none text-sm"></textarea>
</div>
{{-- Active Contract checkbox --}}
<div class="sm:col-span-2" x-data="{ createContract: false }">
<div class="flex items-center gap-2">
<input type="checkbox" name="create_brand_contract" value="1" id="new_create_contract"
class="w-4 h-4 accent-pink-400" x-model="createContract">
<label for="new_create_contract" class="text-xs text-gray-600 cursor-pointer">
📄 Also create a Brand Contract for this event
</label>
</div>
<div x-show="createContract" x-transition class="mt-3 grid grid-cols-1 sm:grid-cols-2 gap-3 bg-pink-50 rounded-2xl p-3">
<div class="sm:col-span-2">
<label class="text-xs font-semibold text-gray-600">Contract Title</label>
<input type="text" name="contract_title" class="input-soft mt-1 text-xs"
placeholder="e.g. Exclusive Posting Contract — BrandX">
</div>
<div>
<label class="text-xs font-semibold text-gray-600">Contract Start</label>
<input type="date" name="contract_start_date" class="input-soft mt-1 text-xs">
</div>
<div>
<label class="text-xs font-semibold text-gray-600">Contract End</label>
<input type="date" name="contract_end_date" class="input-soft mt-1 text-xs">
</div>
</div>
</div>
<div class="sm:col-span-2">
<button type="submit" class="btn-sakura w-full"
:class="{ 'opacity-50 cursor-not-allowed': contractWarning }">
🐾 Schedule It!
</button>
</div>
</form>
</div> </div>
{{-- ── Upcoming Alert Strip ─────────────────────────────────── --}} {{-- ── Upcoming Alert Strip ─────────────────────────────────── --}}

View File

@@ -3,6 +3,7 @@
declare(strict_types=1); declare(strict_types=1);
use App\Http\Controllers\BrandContractController; use App\Http\Controllers\BrandContractController;
use App\Http\Controllers\NoteController;
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;
@@ -21,6 +22,9 @@ Route::get('/', [DashboardController::class, 'index'])->name('dashboard');
// CRM – Clients // CRM – Clients
Route::resource('clients', ClientController::class); Route::resource('clients', ClientController::class);
Route::post('/clients/quick', [ClientController::class, 'quickStore'])->name('clients.quick-store');
Route::post('/clients/{client}/avatar', [ClientController::class, 'uploadAvatar'])->name('clients.upload-avatar');
Route::delete('/clients/{client}/avatar', [ClientController::class, 'deleteAvatar'])->name('clients.delete-avatar');
// Client Categories // Client Categories
Route::prefix('client-categories')->name('client-categories.')->group(function (): void { Route::prefix('client-categories')->name('client-categories.')->group(function (): void {
@@ -43,6 +47,7 @@ Route::prefix('contracts')->name('contracts.')->group(function (): void {
// 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');
Route::get('/create', [EventController::class, 'create'])->name('create');
Route::post('/', [EventController::class, 'store'])->name('store'); Route::post('/', [EventController::class, 'store'])->name('store');
Route::get('/{event}/edit', [EventController::class, 'edit'])->name('edit'); Route::get('/{event}/edit', [EventController::class, 'edit'])->name('edit');
Route::put('/{event}', [EventController::class, 'update'])->name('update'); Route::put('/{event}', [EventController::class, 'update'])->name('update');
@@ -62,6 +67,8 @@ 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::get('/invoice-settings', [InvoiceSettingsController::class, 'edit'])->name('invoice-settings.edit');
Route::post('/invoice-settings', [InvoiceSettingsController::class, 'update'])->name('invoice-settings.update'); Route::post('/invoice-settings', [InvoiceSettingsController::class, 'update'])->name('invoice-settings.update');
Route::post('/invoice-settings/logo', [InvoiceSettingsController::class, 'uploadLogo'])->name('invoice-settings.upload-logo');
Route::delete('/invoice-settings/logo', [InvoiceSettingsController::class, 'deleteLogo'])->name('invoice-settings.delete-logo');
// 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');
@@ -97,6 +104,15 @@ Route::prefix('search')->name('search.')->group(function (): void {
Route::get('/quick', [SearchController::class, 'quick'])->name('quick'); Route::get('/quick', [SearchController::class, 'quick'])->name('quick');
}); });
// Notes
Route::prefix('notes')->name('notes.')->group(function (): void {
Route::get('/', [NoteController::class, 'index'])->name('index');
Route::post('/', [NoteController::class, 'store'])->name('store');
Route::put('/{note}', [NoteController::class, 'update'])->name('update');
Route::delete('/{note}', [NoteController::class, 'destroy'])->name('destroy');
Route::patch('/{note}/pin', [NoteController::class, 'togglePin'])->name('toggle-pin');
});
// Settings // Settings
Route::prefix('settings')->name('settings.')->group(function (): void { Route::prefix('settings')->name('settings.')->group(function (): void {
Route::get('/notifications', [NotificationSettingController::class, 'index'])->name('notifications'); Route::get('/notifications', [NotificationSettingController::class, 'index'])->name('notifications');