Compare commits

...

4 Commits

Author SHA1 Message Date
I-Fun
a0b294fa1c feat: implement gate authentication with login and logout functionality 2026-04-03 11:14:57 +07:00
I-Fun
3f18dbaadf feat: update Docker configuration to manage public storage and optimize entrypoint script 2026-04-02 23:51:29 +07:00
I-Fun
1b90f730a6 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.
2026-04-02 23:24:38 +07:00
I-Fun
5748b163b6 feat: Add accent color to invoice settings and update related views; enhance event creation with brand contract option 2026-04-02 07:24:43 +07:00
38 changed files with 1984 additions and 401 deletions

View File

@@ -29,6 +29,9 @@ database/database.sqlite
public/build
public/hot
# ── Local storage symlink (recreated by entrypoint.sh) ──
public/storage
# ── Tests / dev tooling ──────────────────────
tests
phpunit.xml
@@ -44,7 +47,6 @@ Thumbs.db
# ── Docker config itself ─────────────────────
Dockerfile
docker-compose*.yml
docker/
# ── Claude / project meta ────────────────────
.claude

View File

@@ -4,6 +4,9 @@ APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost
# ── App Gate Password ─────────────────────────────────────────────────────────
APP_PASSWORD=
APP_LOCALE=en
APP_FALLBACK_LOCALE=en
APP_FAKER_LOCALE=en_US

View File

@@ -24,6 +24,7 @@ RUN apk add --no-cache \
nginx \
supervisor \
sqlite \
sqlite-dev \
curl \
git \
unzip \
@@ -83,6 +84,7 @@ RUN chmod +x /entrypoint.sh
# ── File system ──────────────────────────────
RUN mkdir -p \
storage/app/public \
storage/app/private/talent-assets \
storage/logs \
storage/framework/cache \

View File

@@ -7,8 +7,10 @@ namespace App\Http\Controllers;
use App\Enums\ClientStatus;
use App\Models\Client;
use App\Models\ClientCategory;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage;
use Illuminate\View\View;
class ClientController extends Controller
@@ -146,4 +148,42 @@ class ClientController extends Controller
return redirect()->route('clients.index')
->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,13 +4,17 @@ declare(strict_types=1);
namespace App\Http\Controllers;
use App\Enums\ContentStatus;
use App\Enums\EventStatus;
use App\Models\BrandContract;
use App\Models\Client;
use App\Models\ClientCategory;
use App\Models\ContentBrief;
use App\Models\Event;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Arr;
use Illuminate\View\View;
class EventController extends Controller
@@ -23,6 +27,14 @@ class EventController extends Controller
->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
{
$events = Event::with('client')->orderBy('start_time')->get();
@@ -63,12 +75,46 @@ class EventController extends Controller
'is_all_day' => 'boolean',
'color' => 'nullable|string|max:20',
'notes' => 'nullable|string',
'create_brand_contract' => 'nullable|boolean',
'contract_title' => 'nullable|string|max:255',
'contract_start_date' => 'nullable|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_all_day'] = $request->boolean('is_all_day');
Event::create($validated);
$event = Event::create(Arr::except($validated, [
'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) {
BrandContract::create([
'title' => $request->input('contract_title') ?: $event->title,
'client_id' => $event->client_id,
'category_id' => $event->category_id,
'start_date' => $request->input('contract_start_date') ?? $event->start_time->toDateString(),
'end_date' => $request->input('contract_end_date') ?? ($event->end_time?->toDateString() ?? $event->start_time->toDateString()),
'is_active' => true,
]);
}
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')
->with('success', '🐾 Event scheduled!');
@@ -98,10 +144,27 @@ class EventController extends Controller
'status' => 'required|in:pending,in_progress,completed,cancelled',
'color' => 'nullable|string|max:20',
'notes' => 'nullable|string',
'create_brand_contract' => 'nullable|boolean',
'contract_title' => 'nullable|string|max:255',
'contract_start_date' => 'nullable|date',
'contract_end_date' => 'nullable|date|after_or_equal:contract_start_date',
]);
$validated['is_priority'] = $request->boolean('is_priority');
$event->update($validated);
$event->update(Arr::except($validated, [
'create_brand_contract', 'contract_title', 'contract_start_date', 'contract_end_date',
]));
if ($request->boolean('create_brand_contract') && $event->client_id) {
BrandContract::create([
'title' => $request->input('contract_title') ?: $event->title,
'client_id' => $event->client_id,
'category_id' => $event->category_id,
'start_date' => $request->input('contract_start_date') ?? $event->start_time->toDateString(),
'end_date' => $request->input('contract_end_date') ?? ($event->end_time?->toDateString() ?? $event->start_time->toDateString()),
'is_active' => true,
]);
}
return redirect()->route('schedule.index')
->with('success', '🐾 Event updated!');

View File

@@ -0,0 +1,44 @@
<?php
declare(strict_types=1);
namespace App\Http\Controllers;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\View\View;
class GateController extends Controller
{
public function login(): View
{
return view('gate.login');
}
public function attempt(Request $request): RedirectResponse
{
$request->validate([
'password' => 'required|string',
]);
$expected = config('app.password');
if (! $expected || $request->input('password') !== $expected) {
return back()->withErrors(['password' => 'Wrong password. Please try again.']);
}
// Store flag in session; expires with session lifetime (24 h in .env)
$request->session()->put('gate_authenticated', true);
$request->session()->regenerate();
return redirect()->intended(route('dashboard'));
}
public function logout(Request $request): RedirectResponse
{
$request->session()->forget('gate_authenticated');
$request->session()->regenerate();
return redirect()->route('gate.login');
}
}

View File

@@ -5,6 +5,7 @@ declare(strict_types=1);
namespace App\Http\Controllers;
use App\Models\InvoiceSettings;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage;
@@ -26,6 +27,7 @@ class InvoiceSettingsController extends Controller
'header_name' => 'nullable|string|max:100',
'header_title' => 'nullable|string|max:150',
'header_logo' => 'nullable|image|max:2048',
'accent_color' => 'nullable|string|max:20',
'default_tax_rate' => 'nullable|numeric|min:0|max:100',
'default_currency' => 'nullable|string|max:10',
'default_service_description'=> 'nullable|string|max:255',
@@ -52,4 +54,35 @@ class InvoiceSettingsController extends Controller
return redirect()->route('invoice-settings.edit')
->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

@@ -0,0 +1,26 @@
<?php
declare(strict_types=1);
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response;
class GateAuth
{
public function handle(Request $request, Closure $next): Response
{
// Allow the login routes through without auth check
if ($request->routeIs('gate.login', 'gate.attempt', 'gate.logout')) {
return $next($request);
}
if (! $request->session()->get('gate_authenticated')) {
return redirect()->route('gate.login');
}
return $next($request);
}
}

View File

@@ -16,6 +16,7 @@ class InvoiceSettings extends Model
'header_name',
'header_title',
'header_logo',
'accent_color',
'default_tax_rate',
'default_currency',
'default_service_description',
@@ -37,6 +38,7 @@ class InvoiceSettings extends Model
return static::firstOrCreate([], [
'invoice_prefix' => 'INV',
'invoice_next_number' => 1,
'accent_color' => '#FFB7C5',
'default_tax_rate' => 11,
'default_currency' => 'IDR',
]);

View File

@@ -41,6 +41,11 @@ class MediaFile extends Model
return str_starts_with($this->mime_type, 'image/');
}
public function getIsVideoAttribute(): bool
{
return str_starts_with($this->mime_type, 'video/');
}
public function getIconAttribute(): string
{
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

@@ -1,5 +1,6 @@
<?php
use App\Http\Middleware\GateAuth;
use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Foundation\Configuration\Middleware;
@@ -11,7 +12,9 @@ return Application::configure(basePath: dirname(__DIR__))
health: '/up',
)
->withMiddleware(function (Middleware $middleware): void {
//
$middleware->web(append: [
GateAuth::class,
]);
})
->withExceptions(function (Exceptions $exceptions): void {
//

View File

@@ -15,6 +15,8 @@ return [
'name' => env('APP_NAME', 'Laravel'),
'password' => env('APP_PASSWORD'),
/*
|--------------------------------------------------------------------------
| Application Environment

View File

@@ -38,6 +38,13 @@ return [
'report' => false,
],
'private' => [
'driver' => 'local',
'root' => storage_path('app/private'),
'serve' => false,
'throw' => false,
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),

View File

@@ -0,0 +1,22 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('invoice_settings', function (Blueprint $table) {
$table->string('accent_color', 20)->default('#FFB7C5')->after('header_logo');
});
}
public function down(): void
{
Schema::table('invoice_settings', function (Blueprint $table) {
$table->dropColumn('accent_color');
});
}
};

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

@@ -41,11 +41,19 @@ chmod -R 775 \
bootstrap/cache \
database
# ── 5. Run migrations ────────────────────────
# ── 5. Discover packages (composer --no-scripts skips this) ──
echo "[packages] Discovering service providers…"
php artisan package:discover --ansi 2>/dev/null || true
# ── 6. Run migrations ─────────────────────────
echo "[migrate] Running database migrations…"
php artisan migrate --force --no-interaction
# ── 6. Cache config / routes / views ────────
# ── 7. Create public storage symlink ──────────
echo "[storage] Creating public storage symlink…"
php artisan storage:link --quiet 2>/dev/null || true
# ── 8. Cache config / routes / views ─────────
echo "[optimize] Caching configuration…"
php artisan config:cache --quiet
php artisan route:cache --quiet
@@ -55,5 +63,5 @@ echo "────────────────────────
echo " All checks passed. Starting services…"
echo "──────────────────────────────────────────"
# ── 7. Hand off to Supervisor ────────────────
# ── 9. Hand off to Supervisor ────────────────
exec supervisord -c /etc/supervisord.conf

View File

@@ -14,18 +14,7 @@ serverurl=unix:///run/supervisor.sock
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
; ── Nginx ─────────────────────────────────────────────────────────────────
[program:nginx]
command=nginx -g "daemon off;"
autostart=true
autorestart=true
priority=10
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
; ── PHP-FPM ───────────────────────────────────────────────────────────────
; ── PHP-FPM ───────────────────────────────────────────────────────────────────
[program:php-fpm]
command=php-fpm --nodaemonize
autostart=true
@@ -36,13 +25,20 @@ stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
; ── Laravel Queue Worker ──────────────────────────────────────────────────
; ── Nginx ─────────────────────────────────────────────────────────────────────
[program:nginx]
command=nginx -g "daemon off;"
autostart=true
autorestart=true
priority=10
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
; ── Laravel Queue Worker ──────────────────────────────────────────────────────
[program:queue]
command=php /var/www/html/artisan queue:work \
--sleep=3 \
--tries=3 \
--max-time=3600 \
--queue=default
command=php /var/www/html/artisan queue:work --sleep=3 --tries=3 --max-time=3600 --queue=default
directory=/var/www/html
user=www-data
autostart=true

View File

@@ -15,13 +15,17 @@
@endif
{{-- 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">
<span class="text-xl">➕</span>
<h2 class="font-bold text-gray-700">Add New Category</h2>
<button type="button" @click="open = !open"
class="btn-sakura text-xs"
x-text="open ? '✕ Close' : '+ Add New Category'">
</button>
</div>
<div x-show="open" x-transition style="display:none">
<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
<div>
<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>
</form>
</div>
</div>
{{-- List --}}
<div class="cat-card overflow-hidden">
@@ -66,6 +71,7 @@
</span>
</div>
@php $roots = $categories->whereNull('parent_id'); @endphp
@forelse($roots as $root)

View File

@@ -85,10 +85,18 @@
data-name="{{ strtolower($client->name) }} {{ strtolower($client->company ?? '') }}">
<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"
style="background: linear-gradient(135deg, {{ $client->category?->color ?? '#FFB7C5' }}, #E8D5F5);">
{{ $client->initials }}
</div>
@endif
<div class="flex-1 min-w-0">
<div class="flex items-center gap-2 flex-wrap">
<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">
{{-- 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="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);">
{{ $client->initials }}
</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">
<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
@@ -31,13 +74,17 @@
</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('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">
🧾 New Invoice
</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>

View File

@@ -15,13 +15,17 @@
@endif
{{-- 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">
<span class="text-xl">➕</span>
<h2 class="font-bold text-gray-700">Add New Contract</h2>
<button type="button" @click="open = !open"
class="btn-sakura text-xs"
x-text="open ? '✕ Close' : '+ Add New Contract'">
</button>
</div>
<div x-show="open" x-transition style="display:none">
<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
<div>
<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>
</form>
</div>
</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>
<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">
{{ $contracts->count() }} total
</span>

View File

@@ -6,8 +6,53 @@
@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 ──────────────────────────────── --}}
<div id="file-detail-modal"
class="fixed inset-0 z-50 flex items-end sm:items-center justify-center bg-black/40 hidden"
onclick="if(event.target===this)this.classList.add('hidden')">
<div class="cat-card p-5 w-full sm:max-w-sm rounded-b-none sm:rounded-3xl shadow-xl mx-0 sm:mx-4">
<div class="w-10 h-1 bg-gray-200 rounded-full mx-auto mb-4 sm:hidden"></div>
<div class="flex items-center justify-between mb-3">
<h3 class="font-bold text-gray-800 text-base" id="fdm-name">File</h3>
<button onclick="document.getElementById('file-detail-modal').classList.add('hidden')"
class="text-gray-400 hover:text-gray-600 text-xl leading-none">✕</button>
</div>
<div id="fdm-preview" class="mb-3 flex justify-center"></div>
<div class="text-sm text-gray-600 space-y-1.5" id="fdm-body"></div>
<div class="flex gap-2 mt-4">
<a id="fdm-view-btn" href="#" target="_blank"
class="btn-sakura flex-1 text-center py-2 text-sm">View / Download</a>
<button onclick="document.getElementById('file-detail-modal').classList.add('hidden')"
class="flex-1 py-2 rounded-full border border-pink-200 text-gray-600 text-sm hover:bg-pink-50">Close</button>
</div>
</div>
</div>
{{-- ── Upload Form (collapsible) ────────────────────────────── --}}
<div class="cat-card p-4 mb-4"
<div class="cat-card p-4 mb-4" id="upload-panel"
x-data="{
open: false,
uploading: false,
@@ -169,15 +214,37 @@
<div class="grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 gap-3">
@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">
{{-- Preview / Icon --}}
@if($file->is_image)
<div class="w-full aspect-square rounded-2xl overflow-hidden bg-pink-50">
<div class="w-full aspect-square rounded-2xl overflow-hidden bg-pink-50 cursor-pointer"
onclick="showFileDetail({{ json_encode($fileData) }})">
<img src="{{ $file->url }}" alt="{{ $file->name }}"
class="w-full h-full object-cover">
</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
<div class="w-full aspect-square rounded-2xl bg-pink-50 flex items-center justify-center text-4xl">
<div class="w-full aspect-square rounded-2xl bg-pink-50 flex items-center justify-center text-4xl cursor-pointer"
onclick="showFileDetail({{ json_encode($fileData) }})">
{{ $file->icon }}
</div>
@endif
@@ -219,11 +286,66 @@
<div class="text-center py-16 text-gray-400">
<span class="text-5xl block mb-3">📁</span>
<p class="text-sm">No files yet.</p>
<button onclick="document.querySelector('[x-data]').__x.$data.open = true"
<button onclick="document.getElementById('upload-panel')._x_dataStack[0].open = true; document.getElementById('upload-panel').scrollIntoView({behavior:'smooth'})"
class="btn-sakura mt-4 inline-block text-sm">Upload your first file</button>
</div>
@endforelse
<div class="mt-4">{{ $files->links() }}</div>
@push('scripts')
<script>
function showFileDetail(file) {
document.getElementById('fdm-name').textContent = file.name;
document.getElementById('fdm-view-btn').href = file.url;
const preview = document.getElementById('fdm-preview');
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">`;
} else {
preview.innerHTML = `<span class="text-6xl">${file.icon}</span>`;
}
const rows = [
['Size', file.size],
['Folder', file.folder],
file.client ? ['Client', file.client] : null,
['Uploaded', file.created_at],
].filter(Boolean);
document.getElementById('fdm-body').innerHTML = rows.map(([label, value]) =>
`<div class="flex gap-2"><span class="text-gray-400 w-16 shrink-0">${label}</span><span class="font-medium text-gray-700 truncate">${value}</span></div>`
).join('');
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>
@endpush
@endsection

View File

@@ -0,0 +1,111 @@
<!DOCTYPE html>
<html lang="en" data-theme="light">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="theme-color" content="#FFB7C5">
<title>KOL Manager — Login</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link href="https://fonts.googleapis.com/css2?family=Nunito:wght@400;500;600;700;800&display=swap" rel="stylesheet">
@vite(['resources/css/app.css', 'resources/js/app.js'])
</head>
<body class="bg-cream font-sans antialiased min-h-screen flex items-center justify-center px-4"
x-data="{ show: false, shaking: false }">
{{-- ── Decorative blobs ───────────────────────────────────────── --}}
<div class="fixed inset-0 overflow-hidden pointer-events-none select-none" aria-hidden="true">
<div class="absolute -top-32 -left-32 w-96 h-96 rounded-full opacity-20"
style="background: radial-gradient(circle, #FFB7C5, transparent)"></div>
<div class="absolute -bottom-32 -right-32 w-96 h-96 rounded-full opacity-20"
style="background: radial-gradient(circle, #E8D5F5, transparent)"></div>
<div class="absolute top-1/2 left-1/4 w-48 h-48 rounded-full opacity-10"
style="background: radial-gradient(circle, #FFC8DD, transparent)"></div>
</div>
{{-- ── Login card ─────────────────────────────────────────────── --}}
<div class="relative z-10 w-full max-w-sm">
{{-- Logo / header --}}
<div class="text-center mb-8 select-none">
<div class="text-7xl mb-3 inline-block animate-bounce" style="animation-duration:2s">🐱</div>
<h1 class="text-2xl font-extrabold text-pink-500 leading-tight">KOL Manager</h1>
<p class="text-sm text-gray-400 mt-1">Your Purr-fect Assistant</p>
</div>
{{-- Card --}}
<div class="bg-white rounded-3xl shadow-xl border border-pink-100 p-8">
<h2 class="text-base font-bold text-gray-700 mb-1">Welcome back 👋</h2>
<p class="text-xs text-gray-400 mb-6">Enter the app password to continue.</p>
{{-- Error --}}
@error('password')
<div class="flex items-center gap-2 bg-red-50 border border-red-200 text-red-600 text-xs px-4 py-3 rounded-2xl mb-4"
x-data x-init="$el.closest('[x-data]').shaking = true; setTimeout(() => $el.closest('[x-data]').shaking = false, 500)">
<span class="text-base">😿</span>
<span>{{ $message }}</span>
</div>
@enderror
<form method="POST" action="{{ route('gate.attempt') }}"
:class="shaking ? 'animate-[shake_0.4s_ease-in-out]' : ''">
@csrf
{{-- Password field --}}
<div class="relative mb-5">
<label for="password" class="block text-xs font-semibold text-gray-500 mb-1.5">
Password
</label>
<div class="relative">
<input
:type="show ? 'text' : 'password'"
id="password"
name="password"
autocomplete="current-password"
autofocus
placeholder="Enter password…"
class="w-full rounded-2xl border border-pink-100 bg-pink-50/40 px-4 py-3 pr-11 text-sm text-gray-700
placeholder-gray-300 outline-none transition
focus:border-pink-300 focus:ring-2 focus:ring-pink-100
@error('password') border-red-300 bg-red-50/40 @enderror"
>
{{-- Show/hide toggle --}}
<button type="button"
@click="show = !show"
class="absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-pink-400 transition-colors select-none"
tabindex="-1"
:title="show ? 'Hide password' : 'Show password'">
<span x-text="show ? '🙈' : '👁️'" class="text-base leading-none"></span>
</button>
</div>
</div>
{{-- Submit --}}
<button type="submit"
class="w-full py-3 rounded-2xl font-bold text-sm text-white shadow-md
transition-all duration-200 active:scale-95 hover:shadow-lg hover:brightness-105"
style="background: linear-gradient(135deg, #FFB7C5, #E8A0B4)">
🐾 Enter the App
</button>
</form>
</div>
{{-- Footer hint --}}
<p class="text-center text-xs text-gray-400 mt-5">
<!-- Session lasts 24 hours after login. -->
</p>
</div>
{{-- Shake keyframe --}}
<style>
@keyframes shake {
0%, 100% { transform: translateX(0); }
20% { transform: translateX(-6px); }
40% { transform: translateX(6px); }
60% { transform: translateX(-4px); }
80% { transform: translateX(4px); }
}
</style>
</body>
</html>

View File

@@ -121,7 +121,7 @@
<span class="font-semibold">Rp <span x-text="formatNum(taxAmount)"></span></span>
</div>
<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>
</div>
</div>

View File

@@ -116,7 +116,7 @@
<span class="font-semibold">Rp <span x-text="formatNum(taxAmount)"></span></span>
</div>
<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>
</div>
</div>

View File

@@ -6,18 +6,7 @@
@section('content')
<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">
<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">

View File

@@ -2,60 +2,107 @@
<html lang="en">
<head>
<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>
* { margin: 0; padding: 0; box-sizing: border-box; }
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: #FFB7C5; }
.logo-sub { font-size: 11px; color: #9CA3AF; margin-top: 2px; }
.inv-number { font-size: 22px; font-weight: 700; color: #1F2937; text-align: right; }
.badge { display: inline-block; padding: 3px 12px; border-radius: 20px; font-size: 11px; font-weight: 700; background: #FDE68A; color: #92400E; }
.section-title { font-size: 10px; font-weight: 700; color: #9CA3AF; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 6px; }
.billing-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-bottom: 32px; }
/* ── Header ───────────────────────────────── */
.header-table { width: 100%; margin-bottom: 36px; }
.logo-name { font-size: 22px; font-weight: 900; color: {{ $accent }}; }
.logo-sub { font-size: 11px; color: #9CA3AF; margin-top: 3px; }
.inv-number { font-size: 22px; font-weight: 700; color: #1F2937; }
/* ── 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-detail { font-size: 12px; color: #6B7280; margin-top: 2px; }
.detail-table { width: 100%; font-size: 12px; }
.billing-detail{ font-size: 12px; color: #6B7280; margin-top: 2px; }
.detail-table { font-size: 12px; width: auto; float: right; }
.detail-table td { padding: 3px 0; }
.detail-table td:first-child { color: #9CA3AF; }
.detail-table td:last-child { font-weight: 600; text-align: right; }
table.items { width: 100%; border-collapse: collapse; margin-bottom: 24px; }
table.items thead { background: #FFF0F5; }
table.items th { padding: 10px 12px; text-align: left; font-size: 10px; font-weight: 700; color: #9CA3AF; text-transform: uppercase; }
table.items th:last-child, table.items td:last-child { text-align: right; }
table.items th:nth-child(2), table.items td:nth-child(2) { text-align: center; }
table.items td { padding: 10px 12px; border-bottom: 1px solid #FDE8F0; font-size: 12px; }
.totals { display: flex; justify-content: flex-end; margin-bottom: 24px; }
.totals-box { width: 260px; }
.totals-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 12px; }
.totals-row.total { border-top: 2px solid #FFB7C5; margin-top: 6px; padding-top: 8px; font-size: 15px; font-weight: 800; color: #FFB7C5; }
.bank-box { background: #FFF5F7; border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; }
.detail-table .lbl { color: #9CA3AF; padding-right: 16px; white-space: nowrap; }
.detail-table .val { font-weight: 600; text-align: right; white-space: nowrap; }
/* ── Line items ───────────────────────────── */
table.items { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
table.items thead td { background: {{ $tint }}; padding: 10px 12px;
font-size: 10px; font-weight: 700; color: #9CA3AF; text-transform: uppercase; }
table.items tbody td { padding: 10px 12px; border-bottom: 1px solid {{ $tintMid }}; font-size: 12px; }
.td-right { text-align: right; }
.td-center { text-align: center; }
/* ── Totals ───────────────────────────────── */
.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-detail { font-size: 12px; color: #6B7280; }
.notes { font-size: 11px; color: #9CA3AF; font-style: italic; }
.footer { margin-top: 40px; text-align: center; font-size: 11px; color: #D1D5DB; }
</style>
</head>
<body>
<div class="header">
<div style="display:flex; align-items:center; gap:12px;">
{{-- ── Header ─────────────────────────────────────────────────── --}}
<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)))
<td style="vertical-align:middle; padding-right:12px; width:64px;">
<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
<div>
<div class="logo">{{ $invoiceSettings->header_name ?: 'KOL Manager' }}</div>
<td style="vertical-align:middle;">
<div class="logo-name">{{ $invoiceSettings->header_name ?: 'KOL Manager' }}</div>
<div class="logo-sub">{{ $invoiceSettings->header_title ?: 'Personal Talent Assistant' }}</div>
</div>
</div>
<div style="text-align:right">
</td>
</tr>
</table>
</td>
<td style="text-align:right; vertical-align:top;">
<div class="inv-number">{{ $invoice->invoice_number }}</div>
<div style="margin-top:4px"><span class="badge">{{ $invoice->status->label() }}</span></div>
</div>
</div>
</td>
</tr>
</table>
<div class="billing-grid">
<div>
{{-- ── Billing Info ─────────────────────────────────────────────── --}}
<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>
@if($invoice->client)
<div class="billing-name">{{ $invoice->client->name }}</div>
@@ -65,51 +112,70 @@
@else
<div class="billing-detail">—</div>
@endif
</div>
<div style="text-align:right">
</td>
<td style="width:50%; vertical-align:top; text-align:right;">
<div class="section-title">Invoice Details</div>
<table class="detail-table">
<tr><td>Issue Date</td><td>{{ $invoice->issue_date->format('d M Y') }}</td></tr>
<tr><td>Due Date</td><td>{{ $invoice->due_date->format('d M Y') }}</td></tr>
<table class="detail-table" cellpadding="0" cellspacing="0">
<tr><td class="lbl">Issue Date</td><td class="val">{{ $invoice->issue_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)
<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
<tr><td>Currency</td><td>{{ $invoice->currency }}</td></tr>
</table>
</div>
</div>
</td>
</tr>
</table>
<table class="items">
{{-- ── Line Items ───────────────────────────────────────────────── --}}
<table class="items" cellpadding="0" cellspacing="0">
<thead>
<tr>
<th>Description</th>
<th>Qty</th>
<th style="text-align:right">Unit Price</th>
<th>Total</th>
<td style="width:50%;">Description</td>
<td class="td-center" style="width:10%;">Qty</td>
<td class="td-right" style="width:20%;">Unit Price</td>
<td class="td-right" style="width:20%;">Total</td>
</tr>
</thead>
<tbody>
@foreach($invoice->items as $item)
<tr>
<td>{{ $item->description }}</td>
<td style="text-align:center">{{ $item->quantity }}</td>
<td style="text-align: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>
{{ $item->description }}
@if(!$item->is_taxable)
<span style="margin-left:6px; font-size:10px; background:#F3F4F6; color:#6B7280; padding:2px 8px; border-radius:10px; font-weight:600;">Non-Taxable</span>
@endif
</td>
<td class="td-center">{{ $item->quantity }}</td>
<td class="td-right">Rp {{ number_format($item->unit_price, 0, ',', '.') }}</td>
<td class="td-right" style="font-weight:600;">Rp {{ number_format($item->total, 0, ',', '.') }}</td>
</tr>
@endforeach
</tbody>
</table>
<div class="totals">
<div class="totals-box">
<div class="totals-row"><span>Subtotal</span><span>Rp {{ number_format($invoice->subtotal, 0, ',', '.') }}</span></div>
{{-- ── Totals ───────────────────────────────────────────────────── --}}
<div class="totals-wrap clearfix">
<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)
<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
<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>
{{-- ── Payment Info ──────────────────────────────────────────────── --}}
@if($invoice->bank_name)
<div class="bank-box">
<div class="bank-title">Payment Information</div>
@@ -125,7 +191,7 @@
<div class="notes">{{ $invoice->notes }}</div>
@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>
</html>

View File

@@ -61,29 +61,79 @@
<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
{{-- Logo auto-upload (independent of main Save form) --}}
<div class="mb-4"
x-data="{
uploading: false,
errorMsg: '',
logoUrl: '{{ $settings->header_logo ? asset('storage/' . $settings->header_logo) : '' }}',
async pickFile(input) {
if (!input.files.length) return;
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>
<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
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>
hover:file:bg-pink-100 cursor-pointer"
: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>
<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>
<label class="block text-xs font-semibold text-gray-600 mb-1">Talent / Business Name</label>
<input type="text" name="header_name"
@@ -96,6 +146,14 @@
value="{{ old('header_title', $settings->header_title) }}"
class="input-soft text-sm" placeholder="Content Creator · KOL">
</div>
<div x-data="{ color: '{{ old('accent_color', $settings->accent_color ?? '#FFB7C5') }}' }">
<label class="block text-xs font-semibold text-gray-600 mb-1">Accent Color</label>
<div class="flex items-center gap-3 mt-1">
<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">
</div>
<p class="text-xs text-gray-400 mt-1.5">Applied to your invoice header name and totals.</p>
</div>
</div>
</div>

View File

@@ -24,7 +24,8 @@
alt="Logo" class="h-14 w-14 object-cover rounded-2xl border border-pink-100 shrink-0">
@endif
<div>
<div class="text-xl font-extrabold text-pink-500">
<div class="text-xl font-extrabold"
style="color:{{ $invoiceSettings->accent_color ?? '#FFB7C5' }}">
{{ $invoiceSettings->header_name ?: '🐱 KOL Manager' }}
</div>
<div class="text-sm text-gray-400 mt-0.5">
@@ -62,9 +63,21 @@
</div>
{{-- 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">
<thead class="bg-pink-50">
<tr class="text-xs text-gray-500 uppercase">
<thead>
<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-center py-3 px-4">Qty</th>
<th class="text-right py-3 px-4">Unit Price</th>
@@ -74,7 +87,12 @@
<tbody>
@foreach($invoice->items as $item)
<tr class="border-b border-pink-50">
<td class="py-3 px-4 text-sm text-gray-700">{{ $item->description }}</td>
<td class="py-3 px-4 text-sm text-gray-700">
{{ $item->description }}
@if(!$item->is_taxable)
<span class="ml-1.5 text-xs bg-gray-100 text-gray-500 px-2 py-0.5 rounded-full font-medium">Non-Taxable</span>
@endif
</td>
<td class="py-3 px-4 text-sm text-center text-gray-600">{{ $item->quantity }}</td>
<td class="py-3 px-4 text-sm text-right text-gray-600">Rp {{ number_format($item->unit_price, 0, ',', '.') }}</td>
<td class="py-3 px-4 text-sm text-right font-semibold text-gray-800">Rp {{ number_format($item->total, 0, ',', '.') }}</td>
@@ -95,15 +113,16 @@
<span class="font-medium">Rp {{ number_format($invoice->tax_amount, 0, ',', '.') }}</span>
</div>
@endif
<div class="flex justify-between text-base font-bold text-pink-600 pt-2 border-t border-pink-200">
<span>Total (you receive)</span><span>{{ $invoice->formatted_total }}</span>
<div class="flex justify-between text-base font-bold pt-2 border-t border-pink-200"
style="color:{{ $invoiceSettings->accent_color ?? '#FFB7C5' }}">
<span>Grand Total</span><span>{{ $invoice->formatted_total }}</span>
</div>
</div>
</div>
{{-- Bank Info --}}
@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="text-gray-600">
{{ $invoice->bank_name }}

View File

@@ -121,6 +121,12 @@
<span class="text-lg shrink-0">📁</span> Files
</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>
<a href="{{ route('settings.notifications') }}"
@@ -128,6 +134,15 @@
class="nav-item {{ request()->routeIs('settings.*') ? 'active' : '' }}">
<span class="text-lg shrink-0">🔔</span> Notifications
</a>
{{-- Logout --}}
<form method="POST" action="{{ route('gate.logout') }}" class="mt-auto pt-4">
@csrf
<button type="submit"
class="nav-item w-full text-left text-gray-400 hover:text-red-400 hover:bg-red-50 transition-colors">
<span class="text-lg shrink-0">🚪</span> Lock App
</button>
</form>
</nav>
</aside>
@@ -223,7 +238,7 @@
{{-- 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"
style="background: linear-gradient(135deg, #FFB7C5, #E8D5F5);">
KOL
FUN
</div>
</div>
</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>
@endif
</div>
<div style="margin-top:20px">
<a href="{{ route('rate-cards.pdf') }}" class="pdf-btn">📄 Download PDF</a>
</div>
</div>
@forelse($rateCards as $platform => $cards)

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

@@ -131,17 +131,12 @@
</div>
{{-- Color --}}
<div>
<div x-data="{ color: '{{ old('color', $event->color ?? '#FFB7C5') }}' }">
<label class="block text-sm font-semibold text-gray-700 mb-2">Color</label>
<div class="flex gap-2 flex-wrap">
@foreach(['#FFB7C5','#B5EAD7','#FDFD96','#E8D5F5','#FFD5B8','#AEC6CF'] as $hex)
<label class="cursor-pointer">
<input type="radio" name="color" value="{{ $hex }}" class="sr-only peer"
{{ old('color', $event->color) === $hex ? 'checked' : '' }}>
<span class="w-8 h-8 rounded-full block ring-2 ring-transparent peer-checked:ring-gray-500 peer-checked:ring-offset-1 transition-all"
style="background:{{ $hex }};"></span>
</label>
@endforeach
<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>
@@ -159,6 +154,35 @@
placeholder="Additional notes…">{{ old('notes', $event->notes) }}</textarea>
</div>
{{-- Active Contract checkbox --}}
<div x-data="{ createContract: false }">
<div class="flex items-center gap-2">
<input type="checkbox" name="create_brand_contract" value="1" id="edit_create_contract"
class="w-4 h-4 accent-pink-400" x-model="createContract">
<label for="edit_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', $event->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', $event->start_time->format('Y-m-d')) }}">
</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', $event->end_time?->format('Y-m-d') ?? '') }}">
</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">💾 Save Changes</button>
<a href="{{ route('schedule.index') }}"

View File

@@ -6,112 +6,9 @@
@section('content')
{{-- ── Add Event Form (always accessible, collapsible) ─────── --}}
<div class="cat-card p-4 mb-4" x-data="{ open: false }">
<div class="flex items-center justify-between">
<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>
<label class="text-xs font-semibold text-gray-600">Color</label>
<div class="flex gap-2 mt-1 flex-wrap">
@foreach(['#FFB7C5','#B5EAD7','#FDFD96','#E8D5F5','#FFD5B8','#AEC6CF'] as $hex)
<label class="cursor-pointer">
<input type="radio" name="color" value="{{ $hex }}" class="sr-only peer" {{ $loop->first ? 'checked' : '' }}>
<span class="w-7 h-7 rounded-full block ring-2 ring-transparent peer-checked:ring-gray-500 peer-checked:ring-offset-1 transition-all"
style="background:{{ $hex }};"></span>
</label>
@endforeach
</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>
<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>
{{-- ── Add Event Button ─────────────────────────────────────── --}}
<div class="flex items-center justify-between mb-4">
<a href="{{ route('schedule.create') }}" class="btn-sakura text-sm px-5 py-2">+ Add Event</a>
</div>
{{-- ── Upcoming Alert Strip ─────────────────────────────────── --}}
@@ -121,7 +18,8 @@
@if($upcomingList->isNotEmpty())
<div class="flex gap-2 overflow-x-auto pb-2 mb-4 -mx-4 px-4 lg:mx-0 lg:px-0">
@foreach($upcomingList->take(6) as $event)
<div class="shrink-0 flex items-center gap-2 bg-white rounded-2xl border border-pink-100 px-3 py-2 shadow-sm">
<div class="shrink-0 flex items-center gap-2 bg-white rounded-2xl border border-pink-100 px-3 py-2 shadow-sm cursor-pointer hover:border-pink-300 transition-colors"
onclick="openAlertEventModal({{ json_encode(['id' => $event->id, 'title' => $event->title, 'type' => $event->event_type, 'status' => $event->status->value, 'client' => $event->client?->name, 'start' => $event->start_time->toIso8601String(), 'end' => $event->end_time?->toIso8601String()]) }})">
<div class="w-1.5 h-8 rounded-full shrink-0" style="background:{{ $event->color }}"></div>
<div>
<div class="text-xs font-semibold text-gray-700 whitespace-nowrap">{{ $event->title }}</div>
@@ -255,6 +153,28 @@ document.addEventListener('DOMContentLoaded', function () {
// Note: datetime hidden fields are populated in contractCheck's submitIfClear()
// since @submit.prevent is used on the form (form.submit() bypasses native submit event)
});
function openAlertEventModal(e) {
document.getElementById('modal-title').textContent = e.title;
const startStr = e.start ? new Date(e.start).toLocaleString() : '—';
const endStr = e.end ? new Date(e.end).toLocaleString() : null;
document.getElementById('modal-body').innerHTML = `
<div class="flex gap-2"><span class="text-gray-400 w-16 shrink-0">Type</span><span>${e.type}</span></div>
<div class="flex gap-2"><span class="text-gray-400 w-16 shrink-0">Status</span><span>${e.status}</span></div>
${e.client ? `<div class="flex gap-2"><span class="text-gray-400 w-16 shrink-0">Client</span><span>${e.client}</span></div>` : ''}
<div class="flex gap-2"><span class="text-gray-400 w-16 shrink-0">Start</span><span>${startStr}</span></div>
${endStr ? `<div class="flex gap-2"><span class="text-gray-400 w-16 shrink-0">End</span><span>${endStr}</span></div>` : ''}
`;
document.getElementById('modal-actions').innerHTML = `
<a href="/schedule/${e.id}/edit" 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">
<input type="hidden" name="_method" value="DELETE">
<input type="hidden" name="_token" value="${document.querySelector('meta[name=csrf-token]').content}">
<button class="w-full py-2 rounded-full border border-red-200 text-red-400 text-sm hover:bg-red-50">Delete</button>
</form>
`;
document.getElementById('event-modal').classList.remove('hidden');
}
</script>
{{-- Share scripts disabled --}}

View File

@@ -3,6 +3,8 @@
declare(strict_types=1);
use App\Http\Controllers\BrandContractController;
use App\Http\Controllers\GateController;
use App\Http\Controllers\NoteController;
use App\Http\Controllers\ClientCategoryController;
use App\Http\Controllers\ClientController;
use App\Http\Controllers\ContentBriefController;
@@ -17,10 +19,18 @@ use App\Http\Controllers\SearchController;
use App\Http\Controllers\SocialHubController;
use Illuminate\Support\Facades\Route;
// ── Gate Authentication ───────────────────────────────────────────────────────
Route::get('/login', [GateController::class, 'login'])->name('gate.login');
Route::post('/login', [GateController::class, 'attempt'])->name('gate.attempt');
Route::post('/logout', [GateController::class, 'logout'])->name('gate.logout');
Route::get('/', [DashboardController::class, 'index'])->name('dashboard');
// CRM – Clients
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
Route::prefix('client-categories')->name('client-categories.')->group(function (): void {
@@ -43,6 +53,7 @@ Route::prefix('contracts')->name('contracts.')->group(function (): void {
// Schedule & Calendar
Route::prefix('schedule')->name('schedule.')->group(function (): void {
Route::get('/', [EventController::class, 'index'])->name('index');
Route::get('/create', [EventController::class, 'create'])->name('create');
Route::post('/', [EventController::class, 'store'])->name('store');
Route::get('/{event}/edit', [EventController::class, 'edit'])->name('edit');
Route::put('/{event}', [EventController::class, 'update'])->name('update');
@@ -62,6 +73,8 @@ Route::resource('invoices', InvoiceController::class);
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');
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
Route::get('/rate-cards/public', [RateCardController::class, 'public'])->name('rate-cards.public');
@@ -97,6 +110,15 @@ Route::prefix('search')->name('search.')->group(function (): void {
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
Route::prefix('settings')->name('settings.')->group(function (): void {
Route::get('/notifications', [NotificationSettingController::class, 'index'])->name('notifications');