feat: add notes management feature with CRUD operations
- Created Note model and controller for handling notes. - Added routes for notes CRUD operations. - Implemented notes index view with search and pinning functionality. - Created migration for notes table with necessary fields. - Developed event creation form with client and contract options.
This commit is contained in:
@@ -15,45 +15,50 @@
|
||||
@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>
|
||||
<form action="{{ route('client-categories.store') }}" method="POST"
|
||||
class="p-5 grid grid-cols-2 sm:grid-cols-4 gap-3 items-end">
|
||||
@csrf
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Name <span class="text-pink-400">*</span></label>
|
||||
<input type="text" name="name" required maxlength="100"
|
||||
placeholder="e.g. Energy Drinks"
|
||||
class="input-soft" value="{{ old('name') }}">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Parent (optional)</label>
|
||||
<select name="parent_id" class="input-soft">
|
||||
<option value="">— Root category —</option>
|
||||
@foreach($parents as $p)
|
||||
<option value="{{ $p->id }}" {{ old('parent_id') == $p->id ? 'selected' : '' }}>
|
||||
{{ $p->icon }} {{ $p->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Icon (emoji)</label>
|
||||
<input type="text" name="icon" maxlength="10" placeholder="🏷️"
|
||||
class="input-soft" value="{{ old('icon') }}">
|
||||
</div>
|
||||
<div class="flex items-end gap-2">
|
||||
<div class="flex-1">
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Color</label>
|
||||
<input type="color" name="color" value="{{ old('color', '#FFB7C5') }}"
|
||||
class="w-full h-[42px] rounded-2xl border border-pink-200 cursor-pointer p-1 bg-white">
|
||||
|
||||
<div 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 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>
|
||||
<input type="text" name="name" required maxlength="100"
|
||||
placeholder="e.g. Energy Drinks"
|
||||
class="input-soft" value="{{ old('name') }}">
|
||||
</div>
|
||||
<button type="submit" class="btn-sakura px-4 py-2.5 shrink-0 text-sm">Add</button>
|
||||
</div>
|
||||
</form>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Parent (optional)</label>
|
||||
<select name="parent_id" class="input-soft">
|
||||
<option value="">— Root category —</option>
|
||||
@foreach($parents as $p)
|
||||
<option value="{{ $p->id }}" {{ old('parent_id') == $p->id ? 'selected' : '' }}>
|
||||
{{ $p->icon }} {{ $p->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Icon (emoji)</label>
|
||||
<input type="text" name="icon" maxlength="10" placeholder="🏷️"
|
||||
class="input-soft" value="{{ old('icon') }}">
|
||||
</div>
|
||||
<div class="flex items-end gap-2">
|
||||
<div class="flex-1">
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Color</label>
|
||||
<input type="color" name="color" value="{{ old('color', '#FFB7C5') }}"
|
||||
class="w-full h-[42px] rounded-2xl border border-pink-200 cursor-pointer p-1 bg-white">
|
||||
</div>
|
||||
<button type="submit" class="btn-sakura px-4 py-2.5 shrink-0 text-sm">Add</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- List --}}
|
||||
@@ -66,6 +71,7 @@
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
@php $roots = $categories->whereNull('parent_id'); @endphp
|
||||
|
||||
@forelse($roots as $root)
|
||||
|
||||
@@ -85,10 +85,18 @@
|
||||
data-name="{{ strtolower($client->name) }} {{ strtolower($client->company ?? '') }}">
|
||||
|
||||
<div class="flex items-start gap-3">
|
||||
<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>
|
||||
@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>
|
||||
|
||||
@@ -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"
|
||||
style="background: linear-gradient(135deg, #FFB7C5, #E8D5F5);">
|
||||
{{ $client->initials }}
|
||||
{{-- 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>
|
||||
|
||||
|
||||
@@ -15,73 +15,78 @@
|
||||
@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 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>
|
||||
<input type="text" name="title" required maxlength="255"
|
||||
placeholder="e.g. Exclusive – Energy Drinks 2025"
|
||||
class="input-soft" value="{{ old('title') }}">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Brand / Client</label>
|
||||
<select name="client_id" class="input-soft">
|
||||
<option value="">— No specific client —</option>
|
||||
@foreach($clients as $c)
|
||||
<option value="{{ $c->id }}" {{ old('client_id') == $c->id ? 'selected' : '' }}>
|
||||
{{ $c->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Category (exclusive) <span class="text-pink-400">*</span></label>
|
||||
<select name="category_id" required class="input-soft">
|
||||
<option value="">— Select category —</option>
|
||||
@foreach($categoryTree as $parent)
|
||||
<option value="{{ $parent->id }}" {{ old('category_id') == $parent->id ? 'selected' : '' }}>
|
||||
{{ $parent->icon }} {{ $parent->name }}
|
||||
</option>
|
||||
@foreach($parent->children as $child)
|
||||
<option value="{{ $child->id }}" {{ old('category_id') == $child->id ? 'selected' : '' }}>
|
||||
↳ {{ $child->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Start Date <span class="text-pink-400">*</span></label>
|
||||
<input type="date" name="start_date" required class="input-soft"
|
||||
value="{{ old('start_date', today()->toDateString()) }}">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">End Date <span class="text-pink-400">*</span></label>
|
||||
<input type="date" name="end_date" required class="input-soft"
|
||||
value="{{ old('end_date') }}">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Notes</label>
|
||||
<input type="text" name="notes" maxlength="500" placeholder="Optional notes…"
|
||||
class="input-soft" value="{{ old('notes') }}">
|
||||
</div>
|
||||
<div class="sm:col-span-2 lg:col-span-3 flex justify-end pt-1">
|
||||
<button type="submit" class="btn-sakura px-6 py-2.5">📋 Add Contract</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<form action="{{ route('contracts.store') }}" method="POST"
|
||||
class="p-5 grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4">
|
||||
@csrf
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Contract Title <span class="text-pink-400">*</span></label>
|
||||
<input type="text" name="title" required maxlength="255"
|
||||
placeholder="e.g. Exclusive – Energy Drinks 2025"
|
||||
class="input-soft" value="{{ old('title') }}">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Brand / Client</label>
|
||||
<select name="client_id" class="input-soft">
|
||||
<option value="">— No specific client —</option>
|
||||
@foreach($clients as $c)
|
||||
<option value="{{ $c->id }}" {{ old('client_id') == $c->id ? 'selected' : '' }}>
|
||||
{{ $c->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Category (exclusive) <span class="text-pink-400">*</span></label>
|
||||
<select name="category_id" required class="input-soft">
|
||||
<option value="">— Select category —</option>
|
||||
@foreach($categoryTree as $parent)
|
||||
<option value="{{ $parent->id }}" {{ old('category_id') == $parent->id ? 'selected' : '' }}>
|
||||
{{ $parent->icon }} {{ $parent->name }}
|
||||
</option>
|
||||
@foreach($parent->children as $child)
|
||||
<option value="{{ $child->id }}" {{ old('category_id') == $child->id ? 'selected' : '' }}>
|
||||
↳ {{ $child->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Start Date <span class="text-pink-400">*</span></label>
|
||||
<input type="date" name="start_date" required class="input-soft"
|
||||
value="{{ old('start_date', today()->toDateString()) }}">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">End Date <span class="text-pink-400">*</span></label>
|
||||
<input type="date" name="end_date" required class="input-soft"
|
||||
value="{{ old('end_date') }}">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Notes</label>
|
||||
<input type="text" name="notes" maxlength="500" placeholder="Optional notes…"
|
||||
class="input-soft" value="{{ old('notes') }}">
|
||||
</div>
|
||||
<div class="sm:col-span-2 lg:col-span-3 flex justify-end pt-1">
|
||||
<button type="submit" class="btn-sakura px-6 py-2.5">📋 Add Contract</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
{{-- Contracts List --}}
|
||||
<div class="cat-card overflow-hidden">
|
||||
<div class="flex items-center gap-3 px-5 py-4 border-b border-pink-50">
|
||||
<span class="text-xl">📋</span>
|
||||
<h2 class="font-bold text-gray-700">Active & Upcoming Contracts</h2>
|
||||
<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>
|
||||
|
||||
@@ -6,6 +6,29 @@
|
||||
|
||||
@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"
|
||||
@@ -191,17 +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 cursor-pointer"
|
||||
onclick="showFileDetail({{ json_encode(['name' => $file->name ?: $file->original_name, 'url' => $file->url, 'size' => $file->human_size, 'folder' => $file->folder, 'client' => $file->client?->name, 'is_image' => $file->is_image, 'icon' => $file->icon, 'created_at' => $file->created_at->format('d M Y')]) }})">
|
||||
onclick="showFileDetail({{ json_encode($fileData) }})">
|
||||
<img src="{{ $file->url }}" alt="{{ $file->name }}"
|
||||
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 cursor-pointer"
|
||||
onclick="showFileDetail({{ json_encode(['name' => $file->name ?: $file->original_name, 'url' => $file->url, 'size' => $file->human_size, 'folder' => $file->folder, 'client' => $file->client?->name, 'is_image' => false, 'icon' => $file->icon, 'created_at' => $file->created_at->format('d M Y')]) }})">
|
||||
onclick="showFileDetail({{ json_encode($fileData) }})">
|
||||
{{ $file->icon }}
|
||||
</div>
|
||||
@endif
|
||||
@@ -256,7 +299,6 @@ function showFileDetail(file) {
|
||||
document.getElementById('fdm-name').textContent = file.name;
|
||||
document.getElementById('fdm-view-btn').href = file.url;
|
||||
|
||||
// Preview area
|
||||
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">`;
|
||||
@@ -264,7 +306,6 @@ function showFileDetail(file) {
|
||||
preview.innerHTML = `<span class="text-6xl">${file.icon}</span>`;
|
||||
}
|
||||
|
||||
// Info rows
|
||||
const rows = [
|
||||
['Size', file.size],
|
||||
['Folder', file.folder],
|
||||
@@ -278,6 +319,32 @@ function showFileDetail(file) {
|
||||
|
||||
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
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -2,119 +2,180 @@
|
||||
<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: {{ $invoiceSettings->accent_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; }
|
||||
.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; }
|
||||
body { font-family: 'Helvetica', Arial, sans-serif; color: #374151; font-size: 13px; padding: 40px; }
|
||||
|
||||
/* ── 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 { 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 {{ $invoiceSettings->accent_color ?? '#FFB7C5' }}; margin-top: 6px; padding-top: 8px; font-size: 15px; font-weight: 800; color: {{ $invoiceSettings->accent_color ?? '#FFB7C5' }}; }
|
||||
.bank-box { background: #FFF5F7; border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; }
|
||||
.bank-title { font-weight: 700; font-size: 12px; color: #374151; margin-bottom: 4px; }
|
||||
.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; }
|
||||
|
||||
.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;">
|
||||
@if($invoiceSettings->header_logo && file_exists(storage_path('app/public/' . $invoiceSettings->header_logo)))
|
||||
<img src="{{ storage_path('app/public/' . $invoiceSettings->header_logo) }}"
|
||||
style="width:52px; height:52px; object-fit:cover; border-radius:12px;" alt="Logo">
|
||||
@endif
|
||||
<div>
|
||||
<div class="logo">{{ $invoiceSettings->header_name ?: 'KOL Manager' }}</div>
|
||||
<div class="logo-sub">{{ $invoiceSettings->header_title ?: 'Personal Talent Assistant' }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="text-align:right">
|
||||
<div class="inv-number">{{ $invoice->invoice_number }}</div>
|
||||
<div style="margin-top:4px"><span class="badge">{{ $invoice->status->label() }}</span></div>
|
||||
</div>
|
||||
</div>
|
||||
{{-- ── 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; display:block;" alt="Logo">
|
||||
</td>
|
||||
@endif
|
||||
<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>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td style="text-align:right; vertical-align:top;">
|
||||
<div class="inv-number">{{ $invoice->invoice_number }}</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div class="billing-grid">
|
||||
<div>
|
||||
<div class="section-title">Bill To</div>
|
||||
@if($invoice->client)
|
||||
<div class="billing-name">{{ $invoice->client->name }}</div>
|
||||
@if($invoice->client->company) <div class="billing-detail">{{ $invoice->client->company }}</div> @endif
|
||||
@if($invoice->client->email) <div class="billing-detail">{{ $invoice->client->email }}</div> @endif
|
||||
@if($invoice->client->full_address) <div class="billing-detail">{{ $invoice->client->full_address }}</div> @endif
|
||||
@else
|
||||
<div class="billing-detail">—</div>
|
||||
@endif
|
||||
</div>
|
||||
<div style="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>
|
||||
@if($invoice->paid_date)
|
||||
<tr><td>Paid Date</td><td>{{ $invoice->paid_date->format('d M Y') }}</td></tr>
|
||||
{{-- ── 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>
|
||||
@if($invoice->client->company) <div class="billing-detail">{{ $invoice->client->company }}</div> @endif
|
||||
@if($invoice->client->email) <div class="billing-detail">{{ $invoice->client->email }}</div> @endif
|
||||
@if($invoice->client->full_address) <div class="billing-detail">{{ $invoice->client->full_address }}</div> @endif
|
||||
@else
|
||||
<div class="billing-detail">—</div>
|
||||
@endif
|
||||
<tr><td>Currency</td><td>{{ $invoice->currency }}</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td style="width:50%; vertical-align:top; text-align:right;">
|
||||
<div class="section-title">Invoice Details</div>
|
||||
<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 class="lbl">Paid Date</td><td class="val">{{ $invoice->paid_date->format('d M Y') }}</td></tr>
|
||||
@endif
|
||||
</table>
|
||||
</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 }}
|
||||
@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 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>
|
||||
</tr>
|
||||
<tr>
|
||||
<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>
|
||||
@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>
|
||||
@endif
|
||||
<div class="totals-row total"><span>Total (you receive)</span><span>{{ $invoice->formatted_total }}</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)
|
||||
<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
|
||||
<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>
|
||||
@@ -130,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>
|
||||
|
||||
@@ -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) : '' }}',
|
||||
|
||||
<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/*"
|
||||
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>
|
||||
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Logo / Profile Picture</label>
|
||||
<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"
|
||||
@@ -101,14 +151,6 @@
|
||||
<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 class="flex gap-2 flex-wrap">
|
||||
@foreach(['#FFB7C5','#B5EAD7','#FDFD96','#E8D5F5','#FFD5B8','#AEC6CF','#FF8FAD','#A8D8EA'] as $preset)
|
||||
<button type="button"
|
||||
class="w-7 h-7 rounded-full ring-2 ring-transparent hover:ring-gray-400 transition-all"
|
||||
style="background:{{ $preset }}"
|
||||
@click="color = '{{ $preset }}'"></button>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
<p class="text-xs text-gray-400 mt-1.5">Applied to your invoice header name and totals.</p>
|
||||
</div>
|
||||
|
||||
@@ -63,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>
|
||||
@@ -103,14 +115,14 @@
|
||||
@endif
|
||||
<div class="flex justify-between text-base font-bold pt-2 border-t border-pink-200"
|
||||
style="color:{{ $invoiceSettings->accent_color ?? '#FFB7C5' }}">
|
||||
<span>Total (you receive)</span><span>{{ $invoice->formatted_total }}</span>
|
||||
<span>Grand Total</span><span>{{ $invoice->formatted_total }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- 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 }}
|
||||
|
||||
@@ -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') }}"
|
||||
@@ -223,7 +229,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>
|
||||
|
||||
483
resources/views/notes/index.blade.php
Normal file
483
resources/views/notes/index.blade.php
Normal 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
|
||||
@@ -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)
|
||||
|
||||
323
resources/views/schedule/create.blade.php
Normal file
323
resources/views/schedule/create.blade.php
Normal 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' : '' }}>
|
||||
↳ {{ $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
|
||||
@@ -137,14 +137,6 @@
|
||||
<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 class="flex gap-2 flex-wrap">
|
||||
@foreach(['#FFB7C5','#B5EAD7','#FDFD96','#E8D5F5','#FFD5B8','#AEC6CF'] as $hex)
|
||||
<button type="button"
|
||||
class="w-8 h-8 rounded-full ring-2 ring-transparent hover:ring-gray-400 transition-all"
|
||||
style="background:{{ $hex }}"
|
||||
@click="color = '{{ $hex }}'"></button>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -6,143 +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 }}"> ↳ {{ $child->name }}</option>
|
||||
@endforeach
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
{{-- Contract warning --}}
|
||||
<div x-show="contractWarning" x-transition class="sm:col-span-2 rounded-2xl bg-amber-50 border border-amber-200 px-4 py-3 text-sm" style="display:none">
|
||||
<div class="font-semibold text-amber-700 mb-1">⚠️ Exclusive Contract Active</div>
|
||||
<p class="text-amber-600 text-xs" x-text="contractMessage"></p>
|
||||
</div>
|
||||
|
||||
{{-- Start: date + time side by side --}}
|
||||
<div>
|
||||
<label class="text-xs font-semibold text-gray-600">Start Date <span class="text-pink-400">*</span></label>
|
||||
<input type="date" id="start_date" class="input-soft mt-1" required>
|
||||
</div>
|
||||
<div>
|
||||
<label class="text-xs font-semibold text-gray-600">Start Time</label>
|
||||
<input type="time" id="start_time_input" class="input-soft mt-1" value="09:00">
|
||||
</div>
|
||||
|
||||
{{-- End: date + time side by side --}}
|
||||
<div>
|
||||
<label class="text-xs font-semibold text-gray-600">End Date</label>
|
||||
<input type="date" id="end_date" class="input-soft mt-1">
|
||||
</div>
|
||||
<div>
|
||||
<label class="text-xs font-semibold text-gray-600">End Time</label>
|
||||
<input type="time" id="end_time_input" class="input-soft mt-1" value="18:00">
|
||||
</div>
|
||||
|
||||
<div x-data="{ color: '#FFB7C5' }">
|
||||
<label class="text-xs font-semibold text-gray-600">Color</label>
|
||||
<input type="hidden" name="color" :value="color">
|
||||
<div class="flex items-center gap-3 mt-1">
|
||||
<input type="color" x-model="color"
|
||||
class="w-9 h-9 rounded-xl cursor-pointer border-2 border-pink-100 p-0.5 shrink-0">
|
||||
<div class="flex gap-2 flex-wrap">
|
||||
@foreach(['#FFB7C5','#B5EAD7','#FDFD96','#E8D5F5','#FFD5B8','#AEC6CF'] as $hex)
|
||||
<button type="button"
|
||||
class="w-7 h-7 rounded-full ring-2 ring-transparent hover:ring-gray-400 transition-all"
|
||||
style="background:{{ $hex }}"
|
||||
@click="color = '{{ $hex }}'"></button>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-center gap-2 mt-1">
|
||||
<input type="checkbox" name="is_priority" value="1" id="priority" class="w-4 h-4 accent-pink-400">
|
||||
<label for="priority" class="text-xs text-gray-600 cursor-pointer">⭐ Priority</label>
|
||||
</div>
|
||||
<div class="sm:col-span-2">
|
||||
<label class="text-xs font-semibold text-gray-600">Notes</label>
|
||||
<textarea name="notes" rows="2" class="input-soft mt-1 resize-none text-sm"></textarea>
|
||||
</div>
|
||||
|
||||
{{-- Active Contract checkbox --}}
|
||||
<div class="sm:col-span-2" x-data="{ createContract: false }">
|
||||
<div class="flex items-center gap-2">
|
||||
<input type="checkbox" name="create_brand_contract" value="1" id="new_create_contract"
|
||||
class="w-4 h-4 accent-pink-400" x-model="createContract">
|
||||
<label for="new_create_contract" class="text-xs text-gray-600 cursor-pointer">
|
||||
📄 Also create a Brand Contract for this event
|
||||
</label>
|
||||
</div>
|
||||
<div x-show="createContract" x-transition class="mt-3 grid grid-cols-1 sm:grid-cols-2 gap-3 bg-pink-50 rounded-2xl p-3">
|
||||
<div class="sm:col-span-2">
|
||||
<label class="text-xs font-semibold text-gray-600">Contract Title</label>
|
||||
<input type="text" name="contract_title" class="input-soft mt-1 text-xs"
|
||||
placeholder="e.g. Exclusive Posting Contract — BrandX">
|
||||
</div>
|
||||
<div>
|
||||
<label class="text-xs font-semibold text-gray-600">Contract Start</label>
|
||||
<input type="date" name="contract_start_date" class="input-soft mt-1 text-xs">
|
||||
</div>
|
||||
<div>
|
||||
<label class="text-xs font-semibold text-gray-600">Contract End</label>
|
||||
<input type="date" name="contract_end_date" class="input-soft mt-1 text-xs">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="sm:col-span-2">
|
||||
<button type="submit" class="btn-sakura w-full"
|
||||
:class="{ 'opacity-50 cursor-not-allowed': contractWarning }">
|
||||
🐾 Schedule It!
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
{{-- ── 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 ─────────────────────────────────── --}}
|
||||
|
||||
Reference in New Issue
Block a user