change style of button
This commit is contained in:
@@ -1,219 +1,222 @@
|
|||||||
@extends('layouts.app')
|
@extends('layouts.app')
|
||||||
@section('title', 'Categories')
|
@section('title', 'Categories')
|
||||||
@section('page-title', '🏷️ Category Management')
|
@section('page-title', 'Category Management 🏷️')
|
||||||
@section('page-subtitle', 'Organise clients, schedules & content by category')
|
@section('page-subtitle', 'Organise clients, schedules & content by category')
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<div class="max-w-4xl mx-auto space-y-5">
|
<div class="max-w-4xl mx-auto space-y-5">
|
||||||
|
|
||||||
@if(session('success'))
|
@if(session('success'))
|
||||||
<div x-data="{ show: true }" x-show="show" x-init="setTimeout(() => show = false, 4000)"
|
<div x-data="{ show: true }" x-show="show" x-init="setTimeout(() => show = false, 4000)"
|
||||||
class="flex items-center justify-between gap-3 bg-green-50 border border-green-200 rounded-2xl px-4 py-3 text-sm text-green-700">
|
class="flex items-center justify-between gap-3 bg-green-50 border border-green-200 rounded-2xl px-4 py-3 text-sm text-green-700">
|
||||||
<span>{{ session('success') }}</span>
|
<span>{{ session('success') }}</span>
|
||||||
<button @click="show = false" class="text-green-500 hover:text-green-700 text-lg leading-none">✕</button>
|
<button @click="show = false" class="text-green-500 hover:text-green-700 text-lg leading-none">✕</button>
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
{{-- Add form --}}
|
{{-- Add form --}}
|
||||||
<div class="cat-card overflow-hidden" x-data="{ open: {{ $errors->any() ? 'true' : 'false' }} }">
|
<div class="cat-card overflow-hidden" x-data="{ open: {{ $errors->any() ? 'true' : 'false' }} }">
|
||||||
<div class="flex items-center gap-3 px-5 py-4 border-b border-pink-50">
|
<div class="flex items-center gap-3 px-5 py-4 border-b border-pink-50">
|
||||||
<button type="button" @click="open = !open"
|
<button type="button" @click="open = !open" class="btn-sakura text-xs"
|
||||||
class="btn-sakura text-xs"
|
x-text="open ? '✕ Close' : '+ Add Category'">
|
||||||
x-text="open ? '✕ Close' : '+ Add New Category'">
|
</button>
|
||||||
</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 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. Susu Formula"
|
|
||||||
class="input-soft" value="{{ old('name') }}">
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Parent (optional)</label>
|
|
||||||
<select name="parent_id" class="input-soft">
|
|
||||||
<option value="">— Root category —</option>
|
|
||||||
@foreach($parents as $p)
|
|
||||||
<option value="{{ $p->id }}" {{ old('parent_id') == $p->id ? 'selected' : '' }}>
|
|
||||||
{{ $p->icon }} {{ $p->name }}
|
|
||||||
</option>
|
|
||||||
@endforeach
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Icon (emoji)</label>
|
|
||||||
<input type="text" name="icon" maxlength="10" placeholder="🏷️"
|
|
||||||
class="input-soft" value="{{ old('icon') }}">
|
|
||||||
</div>
|
|
||||||
<div class="flex items-end gap-2">
|
|
||||||
<div class="flex-1">
|
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Color</label>
|
|
||||||
<input type="color" name="color" value="{{ old('color', '#FFB7C5') }}"
|
|
||||||
class="w-full h-[42px] rounded-2xl border border-pink-200 cursor-pointer p-1 bg-white">
|
|
||||||
</div>
|
|
||||||
<button type="submit" class="btn-sakura px-4 py-2.5 shrink-0 text-sm">Add</button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{-- List --}}
|
|
||||||
<div class="cat-card overflow-hidden">
|
|
||||||
<div class="flex items-center gap-3 px-5 py-4 border-b border-pink-50">
|
|
||||||
<span class="text-xl">🗂️</span>
|
|
||||||
<h2 class="font-bold text-gray-700">All Categories</h2>
|
|
||||||
<span class="ml-auto text-xs bg-pink-100 text-pink-600 font-semibold px-2.5 py-0.5 rounded-full">
|
|
||||||
{{ $categories->count() }} total
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
@php $roots = $categories->whereNull('parent_id'); @endphp
|
|
||||||
|
|
||||||
@forelse($roots as $root)
|
|
||||||
<div x-data="{ editing: false }" class="border-b border-pink-50 last:border-0">
|
|
||||||
{{-- Root row --}}
|
|
||||||
<div class="flex items-center gap-3 px-5 py-3 hover:bg-pink-50/40 transition-colors">
|
|
||||||
<span class="text-xl w-7 text-center shrink-0">{{ $root->icon ?: '🏷️' }}</span>
|
|
||||||
@if($root->color)
|
|
||||||
<span class="w-3 h-3 rounded-full shrink-0" style="background:{{ $root->color }}"></span>
|
|
||||||
@endif
|
|
||||||
<div class="flex-1 min-w-0">
|
|
||||||
<div class="font-semibold text-gray-700 text-sm">{{ $root->name }}</div>
|
|
||||||
<div class="text-xs text-gray-400">{{ $root->children->count() }} sub · {{ $root->clients_count }} client(s)</div>
|
|
||||||
</div>
|
|
||||||
<div class="flex gap-2 shrink-0">
|
|
||||||
<button @click="editing = !editing"
|
|
||||||
class="text-xs px-3 py-1.5 rounded-full border border-blue-200 text-blue-500 hover:bg-blue-50">
|
|
||||||
✏️ Edit
|
|
||||||
</button>
|
|
||||||
@unless($root->is_system)
|
|
||||||
<form action="{{ route('client-categories.destroy', $root) }}" method="POST"
|
|
||||||
onsubmit="return confirm('Remove this category? Its children will be promoted.')">
|
|
||||||
@csrf @method('DELETE')
|
|
||||||
<button class="text-xs px-3 py-1.5 rounded-full border border-red-100 text-red-400 hover:bg-red-50">
|
|
||||||
🗑️
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
@endunless
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{-- Edit form --}}
|
<div x-show="open" x-transition style="display:none">
|
||||||
<div x-show="editing" x-transition style="display:none"
|
<form action="{{ route('client-categories.store') }}" method="POST"
|
||||||
class="px-5 py-4 bg-pink-50/30 border-t border-pink-50">
|
class="p-5 grid grid-cols-2 sm:grid-cols-4 gap-3 items-end border-b border-pink-50">
|
||||||
<form action="{{ route('client-categories.update', $root) }}" method="POST"
|
@csrf
|
||||||
class="grid grid-cols-2 sm:grid-cols-4 gap-3 items-end">
|
|
||||||
@csrf @method('PUT')
|
|
||||||
<div>
|
<div>
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Name</label>
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Name <span
|
||||||
<input type="text" name="name" required value="{{ $root->name }}" class="input-soft">
|
class="text-pink-400">*</span></label>
|
||||||
|
<input type="text" name="name" required maxlength="100" placeholder="e.g. Susu Formula"
|
||||||
|
class="input-soft" value="{{ old('name') }}">
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Parent</label>
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Parent (optional)</label>
|
||||||
<select name="parent_id" class="input-soft">
|
<select name="parent_id" class="input-soft">
|
||||||
<option value="">— Root —</option>
|
<option value="">— Root category —</option>
|
||||||
@foreach($parents as $p)
|
@foreach($parents as $p)
|
||||||
@if($p->id !== $root->id)
|
<option value="{{ $p->id }}" {{ old('parent_id') == $p->id ? 'selected' : '' }}>
|
||||||
<option value="{{ $p->id }}" {{ $root->parent_id == $p->id ? 'selected' : '' }}>
|
{{ $p->icon }} {{ $p->name }}
|
||||||
{{ $p->icon }} {{ $p->name }}
|
</option>
|
||||||
</option>
|
|
||||||
@endif
|
|
||||||
@endforeach
|
@endforeach
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Icon</label>
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Icon (emoji)</label>
|
||||||
<input type="text" name="icon" value="{{ $root->icon }}" maxlength="10" class="input-soft">
|
<input type="text" name="icon" maxlength="10" placeholder="🏷️" class="input-soft"
|
||||||
|
value="{{ old('icon') }}">
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-end gap-2">
|
<div class="flex items-end gap-2">
|
||||||
<div class="flex-1">
|
<div class="flex-1">
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Color</label>
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Color</label>
|
||||||
<input type="color" name="color" value="{{ $root->color ?: '#FFB7C5' }}"
|
<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">
|
class="w-full h-[42px] rounded-2xl border border-pink-200 cursor-pointer p-1 bg-white">
|
||||||
</div>
|
</div>
|
||||||
<button type="submit" class="btn-sakura px-3 py-2.5 text-sm shrink-0">Save</button>
|
<button type="submit" class="btn-sakura px-4 py-2.5 shrink-0 text-sm">Add</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
{{-- Children --}}
|
{{-- List --}}
|
||||||
@foreach($root->children as $child)
|
<div class="cat-card overflow-hidden">
|
||||||
<div x-data="{ editingC: false }">
|
<div class="flex items-center gap-3 px-5 py-4 border-b border-pink-50">
|
||||||
<div class="flex items-center gap-3 px-5 py-2.5 pl-12 border-t border-pink-50/60 hover:bg-pink-50/20 transition-colors">
|
<span class="text-xl">🗂️</span>
|
||||||
<span class="text-base w-6 text-center shrink-0">{{ $child->icon ?: '↳' }}</span>
|
<h2 class="font-bold text-gray-700">All Categories</h2>
|
||||||
@if($child->color)
|
<span class="ml-auto text-xs bg-pink-100 text-pink-600 font-semibold px-2.5 py-0.5 rounded-full">
|
||||||
<span class="w-2.5 h-2.5 rounded-full shrink-0" style="background:{{ $child->color }}"></span>
|
{{ $categories->count() }} total
|
||||||
@endif
|
</span>
|
||||||
<div class="flex-1 min-w-0">
|
|
||||||
<div class="text-sm font-medium text-gray-600">↳ {{ $child->name }}</div>
|
|
||||||
<div class="text-xs text-gray-400">{{ $child->clients_count }} client(s)</div>
|
|
||||||
</div>
|
|
||||||
<div class="flex gap-2 shrink-0">
|
|
||||||
<button @click="editingC = !editingC"
|
|
||||||
class="text-xs px-2.5 py-1 rounded-full border border-blue-200 text-blue-500 hover:bg-blue-50">
|
|
||||||
✏️
|
|
||||||
</button>
|
|
||||||
@unless($child->is_system)
|
|
||||||
<form action="{{ route('client-categories.destroy', $child) }}" method="POST"
|
|
||||||
onsubmit="return confirm('Remove subcategory?')">
|
|
||||||
@csrf @method('DELETE')
|
|
||||||
<button class="text-xs px-2.5 py-1 rounded-full border border-red-100 text-red-400 hover:bg-red-50">
|
|
||||||
🗑️
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
@endunless
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div x-show="editingC" x-transition style="display:none"
|
|
||||||
class="px-5 py-4 pl-12 bg-pink-50/20 border-t border-pink-50/60">
|
|
||||||
<form action="{{ route('client-categories.update', $child) }}" method="POST"
|
|
||||||
class="grid grid-cols-2 sm:grid-cols-4 gap-3 items-end">
|
|
||||||
@csrf @method('PUT')
|
|
||||||
<div>
|
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Name</label>
|
|
||||||
<input type="text" name="name" required value="{{ $child->name }}" class="input-soft">
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Parent</label>
|
|
||||||
<select name="parent_id" class="input-soft">
|
|
||||||
<option value="">— Root —</option>
|
|
||||||
@foreach($parents as $p)
|
|
||||||
@if($p->id !== $child->id)
|
|
||||||
<option value="{{ $p->id }}" {{ $child->parent_id == $p->id ? 'selected' : '' }}>
|
|
||||||
{{ $p->icon }} {{ $p->name }}
|
|
||||||
</option>
|
|
||||||
@endif
|
|
||||||
@endforeach
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Icon</label>
|
|
||||||
<input type="text" name="icon" value="{{ $child->icon }}" maxlength="10" class="input-soft">
|
|
||||||
</div>
|
|
||||||
<div class="flex items-end gap-2">
|
|
||||||
<div class="flex-1">
|
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Color</label>
|
|
||||||
<input type="color" name="color" value="{{ $child->color ?: '#FFB7C5' }}"
|
|
||||||
class="w-full h-[42px] rounded-2xl border border-pink-200 cursor-pointer p-1 bg-white">
|
|
||||||
</div>
|
|
||||||
<button type="submit" class="btn-sakura px-3 py-2.5 text-sm shrink-0">Save</button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
@endforeach
|
|
||||||
|
|
||||||
|
@php $roots = $categories->whereNull('parent_id'); @endphp
|
||||||
|
|
||||||
|
@forelse($roots as $root)
|
||||||
|
<div x-data="{ editing: false }" class="border-b border-pink-50 last:border-0">
|
||||||
|
{{-- Root row --}}
|
||||||
|
<div class="flex items-center gap-3 px-5 py-3 hover:bg-pink-50/40 transition-colors">
|
||||||
|
<span class="text-xl w-7 text-center shrink-0">{{ $root->icon ?: '🏷️' }}</span>
|
||||||
|
@if($root->color)
|
||||||
|
<span class="w-3 h-3 rounded-full shrink-0" style="background:{{ $root->color }}"></span>
|
||||||
|
@endif
|
||||||
|
<div class="flex-1 min-w-0">
|
||||||
|
<div class="font-semibold text-gray-700 text-sm">{{ $root->name }}</div>
|
||||||
|
<div class="text-xs text-gray-400">{{ $root->children->count() }} sub · {{ $root->clients_count }}
|
||||||
|
client(s)</div>
|
||||||
|
</div>
|
||||||
|
<div class="flex gap-2 shrink-0">
|
||||||
|
<button @click="editing = !editing"
|
||||||
|
class="text-xs px-3 py-1.5 rounded-full border border-blue-200 text-blue-500 hover:bg-blue-50">
|
||||||
|
✏️ Edit
|
||||||
|
</button>
|
||||||
|
@unless($root->is_system)
|
||||||
|
<form action="{{ route('client-categories.destroy', $root) }}" method="POST"
|
||||||
|
onsubmit="return confirm('Remove this category? Its children will be promoted.')">
|
||||||
|
@csrf @method('DELETE')
|
||||||
|
<button
|
||||||
|
class="text-xs px-3 py-1.5 rounded-full border border-red-100 text-red-400 hover:bg-red-50">
|
||||||
|
🗑️
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
@endunless
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Edit form --}}
|
||||||
|
<div x-show="editing" x-transition style="display:none"
|
||||||
|
class="px-5 py-4 bg-pink-50/30 border-t border-pink-50">
|
||||||
|
<form action="{{ route('client-categories.update', $root) }}" method="POST"
|
||||||
|
class="grid grid-cols-2 sm:grid-cols-4 gap-3 items-end">
|
||||||
|
@csrf @method('PUT')
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Name</label>
|
||||||
|
<input type="text" name="name" required value="{{ $root->name }}" class="input-soft">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Parent</label>
|
||||||
|
<select name="parent_id" class="input-soft">
|
||||||
|
<option value="">— Root —</option>
|
||||||
|
@foreach($parents as $p)
|
||||||
|
@if($p->id !== $root->id)
|
||||||
|
<option value="{{ $p->id }}" {{ $root->parent_id == $p->id ? 'selected' : '' }}>
|
||||||
|
{{ $p->icon }} {{ $p->name }}
|
||||||
|
</option>
|
||||||
|
@endif
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Icon</label>
|
||||||
|
<input type="text" name="icon" value="{{ $root->icon }}" maxlength="10" class="input-soft">
|
||||||
|
</div>
|
||||||
|
<div class="flex items-end gap-2">
|
||||||
|
<div class="flex-1">
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Color</label>
|
||||||
|
<input type="color" name="color" value="{{ $root->color ?: '#FFB7C5' }}"
|
||||||
|
class="w-full h-[42px] rounded-2xl border border-pink-200 cursor-pointer p-1 bg-white">
|
||||||
|
</div>
|
||||||
|
<button type="submit" class="btn-sakura px-3 py-2.5 text-sm shrink-0">Save</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Children --}}
|
||||||
|
@foreach($root->children as $child)
|
||||||
|
<div x-data="{ editingC: false }">
|
||||||
|
<div
|
||||||
|
class="flex items-center gap-3 px-5 py-2.5 pl-12 border-t border-pink-50/60 hover:bg-pink-50/20 transition-colors">
|
||||||
|
<span class="text-base w-6 text-center shrink-0">{{ $child->icon ?: '↳' }}</span>
|
||||||
|
@if($child->color)
|
||||||
|
<span class="w-2.5 h-2.5 rounded-full shrink-0" style="background:{{ $child->color }}"></span>
|
||||||
|
@endif
|
||||||
|
<div class="flex-1 min-w-0">
|
||||||
|
<div class="text-sm font-medium text-gray-600">↳ {{ $child->name }}</div>
|
||||||
|
<div class="text-xs text-gray-400">{{ $child->clients_count }} client(s)</div>
|
||||||
|
</div>
|
||||||
|
<div class="flex gap-2 shrink-0">
|
||||||
|
<button @click="editingC = !editingC"
|
||||||
|
class="text-xs px-2.5 py-1 rounded-full border border-blue-200 text-blue-500 hover:bg-blue-50">
|
||||||
|
✏️
|
||||||
|
</button>
|
||||||
|
@unless($child->is_system)
|
||||||
|
<form action="{{ route('client-categories.destroy', $child) }}" method="POST"
|
||||||
|
onsubmit="return confirm('Remove subcategory?')">
|
||||||
|
@csrf @method('DELETE')
|
||||||
|
<button
|
||||||
|
class="text-xs px-2.5 py-1 rounded-full border border-red-100 text-red-400 hover:bg-red-50">
|
||||||
|
🗑️
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
@endunless
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div x-show="editingC" x-transition style="display:none"
|
||||||
|
class="px-5 py-4 pl-12 bg-pink-50/20 border-t border-pink-50/60">
|
||||||
|
<form action="{{ route('client-categories.update', $child) }}" method="POST"
|
||||||
|
class="grid grid-cols-2 sm:grid-cols-4 gap-3 items-end">
|
||||||
|
@csrf @method('PUT')
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Name</label>
|
||||||
|
<input type="text" name="name" required value="{{ $child->name }}" class="input-soft">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Parent</label>
|
||||||
|
<select name="parent_id" class="input-soft">
|
||||||
|
<option value="">— Root —</option>
|
||||||
|
@foreach($parents as $p)
|
||||||
|
@if($p->id !== $child->id)
|
||||||
|
<option value="{{ $p->id }}" {{ $child->parent_id == $p->id ? 'selected' : '' }}>
|
||||||
|
{{ $p->icon }} {{ $p->name }}
|
||||||
|
</option>
|
||||||
|
@endif
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Icon</label>
|
||||||
|
<input type="text" name="icon" value="{{ $child->icon }}" maxlength="10" class="input-soft">
|
||||||
|
</div>
|
||||||
|
<div class="flex items-end gap-2">
|
||||||
|
<div class="flex-1">
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Color</label>
|
||||||
|
<input type="color" name="color" value="{{ $child->color ?: '#FFB7C5' }}"
|
||||||
|
class="w-full h-[42px] rounded-2xl border border-pink-200 cursor-pointer p-1 bg-white">
|
||||||
|
</div>
|
||||||
|
<button type="submit" class="btn-sakura px-3 py-2.5 text-sm shrink-0">Save</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endforeach
|
||||||
|
</div>
|
||||||
|
@empty
|
||||||
|
<div class="text-center py-14 text-gray-400">
|
||||||
|
<div class="text-4xl mb-2">🏷️</div>
|
||||||
|
<p class="text-sm">No categories yet. Add your first one above.</p>
|
||||||
|
</div>
|
||||||
|
@endforelse
|
||||||
</div>
|
</div>
|
||||||
@empty
|
|
||||||
<div class="text-center py-14 text-gray-400">
|
|
||||||
<div class="text-4xl mb-2">🏷️</div>
|
|
||||||
<p class="text-sm">No categories yet. Add your first one above.</p>
|
|
||||||
</div>
|
|
||||||
@endforelse
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
@endsection
|
@endsection
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
<div class="flex items-center justify-between gap-2 mb-3">
|
<div class="flex items-center justify-between gap-2 mb-3">
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex items-center gap-2">
|
||||||
<a href="{{ route('clients.create') }}" class="btn-sakura text-sm">+ Add</a>
|
<a href="{{ route('clients.create') }}" class="btn-sakura text-sm">+ Add Client</a>
|
||||||
@if(request('category') || request('status'))
|
@if(request('category') || request('status'))
|
||||||
<a href="{{ route('clients.index') }}"
|
<a href="{{ route('clients.index') }}"
|
||||||
class="text-xs px-3 py-2 rounded-full border border-gray-200 text-gray-500 hover:bg-gray-50 flex items-center gap-1">
|
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">
|
||||||
@@ -37,39 +37,42 @@
|
|||||||
<div x-show="open" x-transition.duration.150ms>
|
<div x-show="open" x-transition.duration.150ms>
|
||||||
<form method="GET" action="{{ route('clients.index') }}" id="filter-form" class="cat-card p-3 mb-4">
|
<form method="GET" action="{{ route('clients.index') }}" id="filter-form" class="cat-card p-3 mb-4">
|
||||||
{{-- Row 1: search + dropdowns --}}
|
{{-- Row 1: search + dropdowns --}}
|
||||||
<div class="flex flex-col sm:flex-row sm:items-center gap-2">
|
<div class="grid grid-cols-1 sm:grid-cols-12 gap-3 items-center">
|
||||||
{{-- Search (fills remaining space on desktop) --}}
|
{{-- Search --}}
|
||||||
<div class="relative flex-1 min-w-0">
|
<div class="relative sm:col-span-5 lg:col-span-6 w-full">
|
||||||
<span
|
<span class="absolute left-3 top-1/2 -translate-y-1/2 text-gray-400 text-sm pointer-events-none"></span>
|
||||||
class="absolute left-3 top-1/2 -translate-y-1/2 text-gray-400 text-sm pointer-events-none">🔍</span>
|
<input type="text" placeholder="🔍 Filter by name…" class="input-soft pl-9 text-sm py-2 w-full"
|
||||||
<input type="text" placeholder="Filter by name…" class="input-soft pl-9 text-sm py-2 w-full"
|
|
||||||
oninput="filterClients(this.value)" id="search-input">
|
oninput="filterClients(this.value)" id="search-input">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{-- Category dropdown --}}
|
{{-- Category dropdown --}}
|
||||||
<select name="category" class="input-soft text-sm py-2 sm:w-48 shrink-0" onchange="this.form.submit()">
|
<div class="sm:col-span-4 lg:col-span-3 w-full">
|
||||||
<option value="">All Categories</option>
|
<select name="category" class="input-soft text-sm py-2 w-full" onchange="this.form.submit()">
|
||||||
@foreach($categories as $parent)
|
<option value="">All Categories</option>
|
||||||
<option value="{{ $parent->id }}" {{ request('category') == $parent->id ? 'selected' : '' }}>
|
@foreach($categories as $parent)
|
||||||
{{ $parent->icon }} {{ $parent->name }}
|
<option value="{{ $parent->id }}" {{ request('category') == $parent->id ? 'selected' : '' }}>
|
||||||
</option>
|
{{ $parent->icon }} {{ $parent->name }}
|
||||||
@foreach($parent->children as $child)
|
|
||||||
<option value="{{ $child->id }}" {{ request('category') == $child->id ? 'selected' : '' }}>
|
|
||||||
↳ {{ $child->name }}
|
|
||||||
</option>
|
</option>
|
||||||
|
@foreach($parent->children as $child)
|
||||||
|
<option value="{{ $child->id }}" {{ request('category') == $child->id ? 'selected' : '' }}>
|
||||||
|
↳ {{ $child->name }}
|
||||||
|
</option>
|
||||||
|
@endforeach
|
||||||
@endforeach
|
@endforeach
|
||||||
@endforeach
|
</select>
|
||||||
</select>
|
</div>
|
||||||
|
|
||||||
{{-- Status dropdown --}}
|
{{-- Status dropdown --}}
|
||||||
<select name="status" class="input-soft text-sm py-2 sm:w-36 shrink-0" onchange="this.form.submit()">
|
<div class="sm:col-span-3 lg:col-span-3 w-full">
|
||||||
<option value="">All Statuses</option>
|
<select name="status" class="input-soft text-sm py-2 w-full" onchange="this.form.submit()">
|
||||||
@foreach($statuses as $s)
|
<option value="">All Statuses</option>
|
||||||
<option value="{{ $s->value }}" {{ request('status') === $s->value ? 'selected' : '' }}>
|
@foreach($statuses as $s)
|
||||||
{{ $s->label() }}
|
<option value="{{ $s->value }}" {{ request('status') === $s->value ? 'selected' : '' }}>
|
||||||
</option>
|
{{ $s->label() }}
|
||||||
@endforeach
|
</option>
|
||||||
</select>
|
@endforeach
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -5,108 +5,110 @@
|
|||||||
@section('page-subtitle', 'Drag cards between columns to update status')
|
@section('page-subtitle', 'Drag cards between columns to update status')
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<div class="flex flex-col sm:flex-row sm:items-center justify-between gap-3 mb-5">
|
<div class="flex flex-col sm:flex-row sm:items-center justify-between gap-3 mb-5">
|
||||||
<div class="flex gap-2 flex-wrap">
|
<div class="flex gap-2 flex-wrap">
|
||||||
@foreach(['instagram','tiktok','youtube'] as $p)
|
<a href="{{ route('content.create') }}" class="btn-sakura text-sm shrink-0">+ New Brief</a>
|
||||||
<a href="{{ request()->fullUrlWithQuery(['platform' => $p]) }}"
|
@foreach(['instagram', 'tiktok', 'youtube'] as $p)
|
||||||
class="px-3 py-1.5 rounded-full text-xs font-semibold transition-colors
|
<a href="{{ request()->fullUrlWithQuery(['platform' => $p]) }}"
|
||||||
{{ request('platform') === $p ? 'text-white' : 'bg-white text-gray-500 hover:bg-pink-50 border border-pink-100' }}"
|
class="px-3 py-1.5 rounded-full text-xs font-semibold transition-colors
|
||||||
style="{{ request('platform') === $p ? 'background:#FFB7C5' : '' }}">
|
{{ request('platform') === $p ? 'text-white' : 'bg-white text-gray-500 hover:bg-pink-50 border border-pink-100' }}"
|
||||||
{{ ['instagram'=>'📸','tiktok'=>'🎵','youtube'=>'▶️'][$p] }} {{ ucfirst($p) }}
|
style="{{ request('platform') === $p ? 'background:#FFB7C5' : '' }}">
|
||||||
</a>
|
{{ ['instagram' => '📸', 'tiktok' => '🎵', 'youtube' => '▶️'][$p] }} {{ ucfirst($p) }}
|
||||||
@endforeach
|
</a>
|
||||||
@if(request('platform'))
|
@endforeach
|
||||||
<a href="{{ route('content.index') }}" class="px-3 py-1.5 rounded-full text-xs text-gray-400 hover:text-gray-600 border border-gray-200 bg-white">✕ Clear</a>
|
@if(request('platform'))
|
||||||
@endif
|
<a href="{{ route('content.index') }}"
|
||||||
</div>
|
class="px-3 py-1.5 rounded-full text-xs text-gray-400 hover:text-gray-600 border border-gray-200 bg-white">✕
|
||||||
<a href="{{ route('content.create') }}" class="btn-sakura text-sm shrink-0">+ New Brief</a>
|
Clear</a>
|
||||||
</div>
|
@endif
|
||||||
|
</div>
|
||||||
|
|
||||||
{{--
|
</div>
|
||||||
Mobile : grid grid-cols-1 → columns stack vertically, each full width
|
|
||||||
Desktop : flex flex-nowrap → columns in a single horizontal row, each flex-1
|
{{--
|
||||||
|
Mobile : grid grid-cols-1 → columns stack vertically, each full width
|
||||||
|
Desktop : flex flex-nowrap → columns in a single horizontal row, each flex-1
|
||||||
x-sort:group is on the INNER items div (not the column div) to avoid
|
x-sort:group is on the INNER items div (not the column div) to avoid
|
||||||
SortableJS mutating the outer layout container.
|
SortableJS mutating the outer layout container.
|
||||||
--}}
|
--}}
|
||||||
<div class="grid grid-cols-1 gap-4 lg:flex lg:flex-nowrap lg:gap-4"
|
<div class="grid grid-cols-1 gap-4 lg:flex lg:flex-nowrap lg:gap-4" x-data="kanban()">
|
||||||
x-data="kanban()">
|
@foreach($columns as $col)
|
||||||
@foreach($columns as $col)
|
@php $status = $col['status']; @endphp
|
||||||
@php $status = $col['status']; @endphp
|
|
||||||
|
|
||||||
{{-- Column shell — layout only, NOT the sort target --}}
|
{{-- Column shell — layout only, NOT the sort target --}}
|
||||||
<div class="{{ $status->colorClass() }} flex flex-col w-full lg:flex-1 lg:min-w-36 rounded-2xl p-3"
|
<div class="{{ $status->colorClass() }} flex flex-col w-full lg:flex-1 lg:min-w-36 rounded-2xl p-3"
|
||||||
data-status="{{ $status->value }}">
|
data-status="{{ $status->value }}">
|
||||||
|
|
||||||
{{-- Column header --}}
|
{{-- Column header --}}
|
||||||
<div class="flex items-center justify-between mb-3">
|
<div class="flex items-center justify-between mb-3">
|
||||||
<div class="flex items-center gap-1.5">
|
<div class="flex items-center gap-1.5">
|
||||||
<span class="text-base">{{ $status->icon() }}</span>
|
<span class="text-base">{{ $status->icon() }}</span>
|
||||||
<span class="font-bold text-gray-700 text-sm">{{ $status->label() }}</span>
|
<span class="font-bold text-gray-700 text-sm">{{ $status->label() }}</span>
|
||||||
</div>
|
|
||||||
<span class="text-xs bg-white rounded-full px-2 py-0.5 font-bold text-gray-500 shadow-sm">{{ count($col['items']) }}</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{-- Sortable items container --}}
|
|
||||||
<div class="flex flex-col gap-2 flex-1 min-h-12"
|
|
||||||
x-sort:group="kanban"
|
|
||||||
@sort="moved($event, '{{ $status->value }}')"
|
|
||||||
data-col-status="{{ $status->value }}">
|
|
||||||
|
|
||||||
@foreach($col['items'] as $brief)
|
|
||||||
<div class="bg-white rounded-2xl p-3 shadow-sm border border-pink-50 select-none
|
|
||||||
cursor-grab active:cursor-grabbing hover:shadow-md transition-shadow"
|
|
||||||
x-sort:item="{{ $brief->id }}"
|
|
||||||
data-id="{{ $brief->id }}">
|
|
||||||
<div class="flex items-start gap-2 mb-1.5">
|
|
||||||
<span class="text-sm shrink-0">{{ $brief->platform_icon }}</span>
|
|
||||||
<a href="{{ route('content.show', $brief) }}"
|
|
||||||
class="font-semibold text-gray-800 text-xs leading-tight hover:text-pink-500 line-clamp-2 flex-1">
|
|
||||||
{{ $brief->title }}
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
@if($brief->client)
|
|
||||||
<div class="text-xs text-gray-400 mb-1">👥 {{ $brief->client->name }}</div>
|
|
||||||
@endif
|
|
||||||
@if($brief->target_date)
|
|
||||||
<div class="text-xs {{ $brief->target_date->isPast() && $brief->status->value !== 'posted' ? 'text-red-400 font-bold' : 'text-gray-400' }}">
|
|
||||||
📅 {{ $brief->target_date->format('d M') }}
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
<div class="flex justify-end mt-1.5">
|
|
||||||
<a href="{{ route('content.edit', $brief) }}" class="text-xs text-gray-400 hover:text-pink-500">Edit</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
@endforeach
|
<span
|
||||||
|
class="text-xs bg-white rounded-full px-2 py-0.5 font-bold text-gray-500 shadow-sm">{{ count($col['items']) }}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Sortable items container --}}
|
||||||
|
<div class="flex flex-col gap-2 flex-1 min-h-12" x-sort:group="kanban"
|
||||||
|
@sort="moved($event, '{{ $status->value }}')" data-col-status="{{ $status->value }}">
|
||||||
|
|
||||||
|
@foreach($col['items'] as $brief)
|
||||||
|
<div class="bg-white rounded-2xl p-3 shadow-sm border border-pink-50 select-none
|
||||||
|
cursor-grab active:cursor-grabbing hover:shadow-md transition-shadow"
|
||||||
|
x-sort:item="{{ $brief->id }}" data-id="{{ $brief->id }}">
|
||||||
|
<div class="flex items-start gap-2 mb-1.5">
|
||||||
|
<span class="text-sm shrink-0">{{ $brief->platform_icon }}</span>
|
||||||
|
<a href="{{ route('content.show', $brief) }}"
|
||||||
|
class="font-semibold text-gray-800 text-xs leading-tight hover:text-pink-500 line-clamp-2 flex-1">
|
||||||
|
{{ $brief->title }}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
@if($brief->client)
|
||||||
|
<div class="text-xs text-gray-400 mb-1">👥 {{ $brief->client->name }}</div>
|
||||||
|
@endif
|
||||||
|
@if($brief->target_date)
|
||||||
|
<div
|
||||||
|
class="text-xs {{ $brief->target_date->isPast() && $brief->status->value !== 'posted' ? 'text-red-400 font-bold' : 'text-gray-400' }}">
|
||||||
|
📅 {{ $brief->target_date->format('d M') }}
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
<div class="flex justify-end mt-1.5">
|
||||||
|
<a href="{{ route('content.edit', $brief) }}"
|
||||||
|
class="text-xs text-gray-400 hover:text-pink-500">Edit</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endforeach
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Add button --}}
|
||||||
|
<a href="{{ route('content.create') }}?status={{ $status->value }}"
|
||||||
|
class="mt-3 text-xs text-gray-400 hover:text-pink-500 text-center py-2
|
||||||
|
border-2 border-dashed border-pink-100 rounded-2xl hover:border-pink-300 transition-colors block">
|
||||||
|
+ Add
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
@endforeach
|
||||||
|
</div>
|
||||||
|
|
||||||
{{-- Add button --}}
|
@push('scripts')
|
||||||
<a href="{{ route('content.create') }}?status={{ $status->value }}"
|
<script>
|
||||||
class="mt-3 text-xs text-gray-400 hover:text-pink-500 text-center py-2
|
function kanban() {
|
||||||
border-2 border-dashed border-pink-100 rounded-2xl hover:border-pink-300 transition-colors block">
|
return {
|
||||||
+ Add
|
moved(event, targetStatus) {
|
||||||
</a>
|
const id = event.item?.dataset?.id;
|
||||||
</div>
|
if (!id) return;
|
||||||
@endforeach
|
fetch(`/content/${id}/status`, {
|
||||||
</div>
|
method: 'PATCH',
|
||||||
|
headers: {
|
||||||
@push('scripts')
|
'Content-Type': 'application/json',
|
||||||
<script>
|
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').content,
|
||||||
function kanban() {
|
},
|
||||||
return {
|
body: JSON.stringify({ status: targetStatus }),
|
||||||
moved(event, targetStatus) {
|
}).then(r => { if (r.ok) window.KolManager.notify('Status updated! 🎬'); });
|
||||||
const id = event.item?.dataset?.id;
|
},
|
||||||
if (!id) return;
|
};
|
||||||
fetch(`/content/${id}/status`, {
|
}
|
||||||
method: 'PATCH',
|
</script>
|
||||||
headers: {
|
@endpush
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').content,
|
|
||||||
},
|
|
||||||
body: JSON.stringify({ status: targetStatus }),
|
|
||||||
}).then(r => { if (r.ok) window.KolManager.notify('Status updated! 🎬'); });
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@endpush
|
|
||||||
@endsection
|
@endsection
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
@extends('layouts.app')
|
@extends('layouts.app')
|
||||||
@section('title', 'Brand Contracts')
|
@section('title', 'Brand Contracts')
|
||||||
@section('page-title', '📋 Brand Contracts')
|
@section('page-title', 'Brand Contracts 📋')
|
||||||
@section('page-subtitle', 'Manage exclusive brand agreements per category')
|
@section('page-subtitle', 'Manage exclusive brand agreements per category')
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
<div class="flex items-center gap-3 px-5 py-4 border-b border-pink-50">
|
<div class="flex items-center gap-3 px-5 py-4 border-b border-pink-50">
|
||||||
<button type="button" @click="open = !open"
|
<button type="button" @click="open = !open"
|
||||||
class="btn-sakura text-xs"
|
class="btn-sakura text-xs"
|
||||||
x-text="open ? '✕ Close' : '+ Add New Contract'">
|
x-text="open ? '✕ Close' : '+ Add Contract'">
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -209,6 +209,7 @@
|
|||||||
<li>🔒 When a contract is <strong>Active</strong>, creating schedules or content for a competing brand in the same category will show a warning.</li>
|
<li>🔒 When a contract is <strong>Active</strong>, creating schedules or content for a competing brand in the same category will show a warning.</li>
|
||||||
<li>✅ The contracted brand itself is always allowed — no warning shown.</li>
|
<li>✅ The contracted brand itself is always allowed — no warning shown.</li>
|
||||||
<li>🏷️ Blocking a <strong>parent category</strong> also blocks all its subcategories.</li>
|
<li>🏷️ Blocking a <strong>parent category</strong> also blocks all its subcategories.</li>
|
||||||
|
<li>🏷️ Blocking a <strong>child category</strong> does not block the parent category.</li>
|
||||||
<li>📅 Contracts only block during their active date range. Expired contracts are ignored automatically.</li>
|
<li>📅 Contracts only block during their active date range. Expired contracts are ignored automatically.</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -156,4 +156,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@include('layouts.fab')
|
||||||
|
|
||||||
@endsection
|
@endsection
|
||||||
@@ -5,97 +5,109 @@
|
|||||||
@section('page-subtitle', 'Manage your brand deal payments')
|
@section('page-subtitle', 'Manage your brand deal payments')
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<div class="flex flex-col sm:flex-row sm:items-center justify-between gap-3 mb-5">
|
<div class="flex flex-col sm:flex-row sm:items-center justify-between gap-3 mb-5">
|
||||||
|
|
||||||
<div class="flex gap-2 shrink-0">
|
<div class="flex gap-2 shrink-0">
|
||||||
<a href="{{ route('invoice-settings.edit') }}"
|
<a href="{{ route('invoices.create') }}" class="btn-sakura text-sm">+ New Invoice</a>
|
||||||
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">
|
<a href="{{ route('invoice-settings.edit') }}"
|
||||||
⚙️ Settings
|
class="btn-sakura text-sm px-3 py-2 rounded-full border border-gray-200 text-gray-500 hover:bg-gray-50 flex items-center gap-1">
|
||||||
</a>
|
⚙️ Settings
|
||||||
<a href="{{ route('invoices.create') }}" class="btn-sakura text-sm">+ New Invoice</a>
|
</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
{{-- Mobile card list --}}
|
{{-- Mobile card list --}}
|
||||||
<div class="flex flex-col gap-3 sm:hidden">
|
<div class="flex flex-col gap-3 sm:hidden">
|
||||||
@forelse($invoices as $invoice)
|
@forelse($invoices as $invoice)
|
||||||
<div class="cat-card p-4">
|
<div class="cat-card p-4">
|
||||||
<div class="flex items-start justify-between gap-2 mb-2">
|
<div class="flex items-start justify-between gap-2 mb-2">
|
||||||
<div>
|
<div>
|
||||||
<div class="font-mono text-sm font-bold text-gray-700">{{ $invoice->invoice_number }}</div>
|
<div class="font-mono text-sm font-bold text-gray-700">{{ $invoice->invoice_number }}</div>
|
||||||
<div class="text-xs text-gray-400">{{ $invoice->client?->name ?? '—' }}</div>
|
<div class="text-xs text-gray-400">{{ $invoice->client?->name ?? '—' }}</div>
|
||||||
|
</div>
|
||||||
|
<span class="badge {{ $invoice->status->badgeClass() }} shrink-0">{{ $invoice->status->label() }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="text-sm text-gray-700 font-semibold mb-1">{{ $invoice->title }}</div>
|
||||||
|
<div class="flex items-center justify-between text-xs text-gray-500">
|
||||||
|
<span>Due {{ $invoice->due_date->format('d M Y') }}</span>
|
||||||
|
<span class="font-bold text-gray-800">{{ $invoice->formatted_total }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="flex gap-2 mt-3 pt-3 border-t border-pink-50">
|
||||||
|
<a href="{{ route('invoices.show', $invoice) }}"
|
||||||
|
class="flex-1 text-center text-xs py-1.5 px-3 rounded-full border border-pink-200 text-pink-600 hover:bg-pink-50">View</a>
|
||||||
|
<a href="{{ route('invoices.pdf', $invoice) }}" target="_blank"
|
||||||
|
class="flex-1 text-center text-xs py-1.5 px-3 rounded-full border border-pink-200 text-pink-600 hover:bg-pink-50">PDF</a>
|
||||||
|
<a href="{{ route('invoices.edit', $invoice) }}"
|
||||||
|
class="flex-1 text-center text-xs py-1.5 px-3 rounded-full border border-pink-200 text-gray-600 hover:bg-pink-50">Edit</a>
|
||||||
|
{{-- Share button disabled --}}
|
||||||
</div>
|
</div>
|
||||||
<span class="badge {{ $invoice->status->badgeClass() }} shrink-0">{{ $invoice->status->label() }}</span>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="text-sm text-gray-700 font-semibold mb-1">{{ $invoice->title }}</div>
|
@empty
|
||||||
<div class="flex items-center justify-between text-xs text-gray-500">
|
<div class="text-center py-16 text-gray-400">
|
||||||
<span>Due {{ $invoice->due_date->format('d M Y') }}</span>
|
<span class="text-5xl block mb-2">🧾</span>
|
||||||
<span class="font-bold text-gray-800">{{ $invoice->formatted_total }}</span>
|
<p>No invoices yet. <a href="{{ route('invoices.create') }}" class="text-pink-500 hover:underline">Create
|
||||||
|
one!</a></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex gap-2 mt-3 pt-3 border-t border-pink-50">
|
@endforelse
|
||||||
<a href="{{ route('invoices.show', $invoice) }}" class="flex-1 text-center text-xs py-1.5 px-3 rounded-full border border-pink-200 text-pink-600 hover:bg-pink-50">View</a>
|
|
||||||
<a href="{{ route('invoices.pdf', $invoice) }}" target="_blank" class="flex-1 text-center text-xs py-1.5 px-3 rounded-full border border-pink-200 text-pink-600 hover:bg-pink-50">PDF</a>
|
|
||||||
<a href="{{ route('invoices.edit', $invoice) }}" class="flex-1 text-center text-xs py-1.5 px-3 rounded-full border border-pink-200 text-gray-600 hover:bg-pink-50">Edit</a>
|
|
||||||
{{-- Share button disabled --}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@empty
|
|
||||||
<div class="text-center py-16 text-gray-400">
|
|
||||||
<span class="text-5xl block mb-2">🧾</span>
|
|
||||||
<p>No invoices yet. <a href="{{ route('invoices.create') }}" class="text-pink-500 hover:underline">Create one!</a></p>
|
|
||||||
</div>
|
|
||||||
@endforelse
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{-- Desktop table --}}
|
|
||||||
<div class="cat-card overflow-hidden hidden sm:block">
|
|
||||||
<div class="overflow-x-auto">
|
|
||||||
<table class="table w-full">
|
|
||||||
<thead class="bg-pink-50">
|
|
||||||
<tr>
|
|
||||||
<th class="px-5 py-4">Invoice #</th>
|
|
||||||
<th class="px-5 py-4">Client</th>
|
|
||||||
<th class="px-5 py-4">Title</th>
|
|
||||||
<th class="px-5 py-4">Total</th>
|
|
||||||
<th class="px-5 py-4">Due Date</th>
|
|
||||||
<th class="px-5 py-4">Status</th>
|
|
||||||
<th class="px-5 py-4">Actions</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
@forelse($invoices as $invoice)
|
|
||||||
<tr class="border-b border-pink-50 hover:bg-pink-50/50 transition-colors">
|
|
||||||
<td class="px-5 py-4 font-mono text-sm font-semibold text-gray-700">{{ $invoice->invoice_number }}</td>
|
|
||||||
<td class="px-5 py-4 text-sm text-gray-600">{{ $invoice->client?->name ?? '—' }}</td>
|
|
||||||
<td class="px-5 py-4 text-sm text-gray-700 max-w-xs truncate">{{ $invoice->title }}</td>
|
|
||||||
<td class="px-5 py-4 font-bold text-gray-800 text-sm">{{ $invoice->formatted_total }}</td>
|
|
||||||
<td class="px-5 py-4 text-sm text-gray-500">
|
|
||||||
{{ $invoice->due_date->format('d M Y') }}
|
|
||||||
@if($invoice->due_date->isPast() && $invoice->status->value !== 'paid')
|
|
||||||
<span class="text-red-400 text-xs block">Overdue!</span>
|
|
||||||
@endif
|
|
||||||
</td>
|
|
||||||
<td class="px-5 py-4"><span class="badge {{ $invoice->status->badgeClass() }}">{{ $invoice->status->label() }}</span></td>
|
|
||||||
<td class="px-5 py-4">
|
|
||||||
<div class="flex items-center gap-2">
|
|
||||||
<a href="{{ route('invoices.show', $invoice) }}" class="text-xs text-pink-500 hover:underline">View</a>
|
|
||||||
<a href="{{ route('invoices.pdf', $invoice) }}" class="text-xs text-pink-500 hover:underline" target="_blank">PDF</a>
|
|
||||||
<a href="{{ route('invoices.edit', $invoice) }}" class="text-xs text-gray-500 hover:underline">Edit</a>
|
|
||||||
{{-- Share button disabled --}}
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
@empty
|
|
||||||
<tr><td colspan="7" class="text-center py-16 text-gray-400">
|
|
||||||
<span class="text-4xl block mb-2">🧾</span>
|
|
||||||
No invoices yet.
|
|
||||||
</td></tr>
|
|
||||||
@endforelse
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mt-4">{{ $invoices->links() }}</div>
|
{{-- Desktop table --}}
|
||||||
{{-- Share scripts disabled --}}
|
<div class="cat-card overflow-hidden hidden sm:block">
|
||||||
|
<div class="overflow-x-auto">
|
||||||
|
<table class="table w-full">
|
||||||
|
<thead class="bg-pink-50">
|
||||||
|
<tr>
|
||||||
|
<th class="px-5 py-4">Invoice #</th>
|
||||||
|
<th class="px-5 py-4">Client</th>
|
||||||
|
<th class="px-5 py-4">Title</th>
|
||||||
|
<th class="px-5 py-4">Total</th>
|
||||||
|
<th class="px-5 py-4">Due Date</th>
|
||||||
|
<th class="px-5 py-4">Status</th>
|
||||||
|
<th class="px-5 py-4">Actions</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@forelse($invoices as $invoice)
|
||||||
|
<tr class="border-b border-pink-50 hover:bg-pink-50/50 transition-colors">
|
||||||
|
<td class="px-5 py-4 font-mono text-sm font-semibold text-gray-700">{{ $invoice->invoice_number }}
|
||||||
|
</td>
|
||||||
|
<td class="px-5 py-4 text-sm text-gray-600">{{ $invoice->client?->name ?? '—' }}</td>
|
||||||
|
<td class="px-5 py-4 text-sm text-gray-700 max-w-xs truncate">{{ $invoice->title }}</td>
|
||||||
|
<td class="px-5 py-4 font-bold text-gray-800 text-sm">{{ $invoice->formatted_total }}</td>
|
||||||
|
<td class="px-5 py-4 text-sm text-gray-500">
|
||||||
|
{{ $invoice->due_date->format('d M Y') }}
|
||||||
|
@if($invoice->due_date->isPast() && $invoice->status->value !== 'paid')
|
||||||
|
<span class="text-red-400 text-xs block">Overdue!</span>
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
|
<td class="px-5 py-4"><span
|
||||||
|
class="badge {{ $invoice->status->badgeClass() }}">{{ $invoice->status->label() }}</span>
|
||||||
|
</td>
|
||||||
|
<td class="px-5 py-4">
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<a href="{{ route('invoices.show', $invoice) }}"
|
||||||
|
class="text-xs text-pink-500 hover:underline">View</a>
|
||||||
|
<a href="{{ route('invoices.pdf', $invoice) }}"
|
||||||
|
class="text-xs text-pink-500 hover:underline" target="_blank">PDF</a>
|
||||||
|
<a href="{{ route('invoices.edit', $invoice) }}"
|
||||||
|
class="text-xs text-gray-500 hover:underline">Edit</a>
|
||||||
|
{{-- Share button disabled --}}
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@empty
|
||||||
|
<tr>
|
||||||
|
<td colspan="7" class="text-center py-16 text-gray-400">
|
||||||
|
<span class="text-4xl block mb-2">🧾</span>
|
||||||
|
No invoices yet.
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@endforelse
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mt-4">{{ $invoices->links() }}</div>
|
||||||
|
{{-- Share scripts disabled --}}
|
||||||
@endsection
|
@endsection
|
||||||
@@ -5,229 +5,220 @@
|
|||||||
@section('page-subtitle', 'Customize number format, header, and invoice defaults')
|
@section('page-subtitle', 'Customize number format, header, and invoice defaults')
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<div class="max-w-2xl mx-auto">
|
<div class="max-w-2xl mx-auto">
|
||||||
<div class="flex items-center gap-3 mb-5">
|
<div class="flex items-center gap-3 mb-5">
|
||||||
<a href="{{ route('invoices.index') }}"
|
<a href="{{ route('invoices.index') }}"
|
||||||
class="text-xs px-3 py-2 rounded-full border border-pink-200 text-gray-500 hover:bg-pink-50">
|
class="btn-sakura text-sm px-3 py-2 rounded-full border border-pink-200 text-gray-500 hover:bg-pink-50">
|
||||||
← Back to Invoices
|
← Back to Invoices
|
||||||
</a>
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if(session('success'))
|
||||||
|
<div x-data="{ show: true }" x-show="show" x-init="setTimeout(() => show = false, 4000)"
|
||||||
|
class="flex items-center justify-between gap-3 bg-green-50 border border-green-200 rounded-2xl px-4 py-3 text-sm text-green-700 mb-4">
|
||||||
|
<span>{{ session('success') }}</span>
|
||||||
|
<button @click="show = false" class="text-green-500 hover:text-green-700 text-lg leading-none">✕</button>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<form action="{{ route('invoice-settings.update') }}" method="POST" enctype="multipart/form-data" class="space-y-5">
|
||||||
|
@csrf
|
||||||
|
|
||||||
|
{{-- Number Format --}}
|
||||||
|
<div class="cat-card p-5">
|
||||||
|
<h2 class="text-sm font-bold text-gray-700 mb-4 flex items-center gap-2">🔢 Invoice Number Format</h2>
|
||||||
|
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">
|
||||||
|
Prefix <span class="text-pink-400">*</span>
|
||||||
|
</label>
|
||||||
|
<input type="text" name="invoice_prefix"
|
||||||
|
value="{{ old('invoice_prefix', $settings->invoice_prefix) }}" class="input-soft text-sm"
|
||||||
|
placeholder="INV-EA" required id="prefix-input" oninput="updatePreview()">
|
||||||
|
<p class="text-xs text-gray-400 mt-1">e.g. <code>INV-EA</code> → <strong>INV-EA-001</strong></p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">
|
||||||
|
Next Number <span class="text-pink-400">*</span>
|
||||||
|
</label>
|
||||||
|
<input type="number" name="invoice_next_number"
|
||||||
|
value="{{ old('invoice_next_number', $settings->invoice_next_number) }}"
|
||||||
|
class="input-soft text-sm" min="1" required id="number-input" oninput="updatePreview()">
|
||||||
|
<p class="text-xs text-gray-400 mt-1">Used for the next new invoice</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="mt-3 bg-pink-50 rounded-xl px-4 py-2.5 text-sm text-gray-600">
|
||||||
|
Preview: <strong class="text-pink-600" id="number-preview">
|
||||||
|
{{ rtrim(old('invoice_prefix', $settings->invoice_prefix), '-') }}-{{ str_pad((string) (old('invoice_next_number', $settings->invoice_next_number) ?? 1), 3, '0', STR_PAD_LEFT) }}
|
||||||
|
</strong>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Header / Branding --}}
|
||||||
|
<div class="cat-card p-5">
|
||||||
|
<h2 class="text-sm font-bold text-gray-700 mb-4 flex items-center gap-2">🎨 Invoice Header</h2>
|
||||||
|
|
||||||
|
{{-- 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>
|
||||||
|
|
||||||
|
<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" :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" value="{{ old('header_name', $settings->header_name) }}"
|
||||||
|
class="input-soft text-sm" placeholder="Your name or brand">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Title / Tagline</label>
|
||||||
|
<input type="text" name="header_title" value="{{ old('header_title', $settings->header_title) }}"
|
||||||
|
class="input-soft text-sm" placeholder="Content Creator · KOL">
|
||||||
|
</div>
|
||||||
|
<div 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>
|
||||||
|
|
||||||
|
{{-- Invoice Defaults --}}
|
||||||
|
<div class="cat-card p-5">
|
||||||
|
<h2 class="text-sm font-bold text-gray-700 mb-4 flex items-center gap-2">📋 Invoice Defaults</h2>
|
||||||
|
<p class="text-xs text-gray-400 mb-4">These values will pre-fill every new invoice you create.</p>
|
||||||
|
|
||||||
|
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Default Tax Rate (%)</label>
|
||||||
|
<input type="number" name="default_tax_rate" step="0.01" min="0" max="100"
|
||||||
|
value="{{ old('default_tax_rate', $settings->default_tax_rate ?? 11) }}"
|
||||||
|
class="input-soft text-sm" placeholder="11">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Default Currency</label>
|
||||||
|
<select name="default_currency" class="input-soft text-sm">
|
||||||
|
@foreach(['IDR' => 'IDR (Rupiah)', 'USD' => 'USD (Dollar)', 'SGD' => 'SGD', 'MYR' => 'MYR (Ringgit)'] as $code => $label)
|
||||||
|
<option value="{{ $code }}" {{ old('default_currency', $settings->default_currency ?? 'IDR') === $code ? 'selected' : '' }}>
|
||||||
|
{{ $label }}
|
||||||
|
</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="sm:col-span-2">
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Default Service Description</label>
|
||||||
|
<input type="text" name="default_service_description"
|
||||||
|
value="{{ old('default_service_description', $settings->default_service_description) }}"
|
||||||
|
class="input-soft text-sm" placeholder="e.g. Instagram Feed Post — 1 carousel">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Default Bank Name</label>
|
||||||
|
<input type="text" name="default_bank_name"
|
||||||
|
value="{{ old('default_bank_name', $settings->default_bank_name) }}" class="input-soft text-sm"
|
||||||
|
placeholder="BCA, Mandiri…">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Default Branch Name</label>
|
||||||
|
<input type="text" name="default_branch_name"
|
||||||
|
value="{{ old('default_branch_name', $settings->default_branch_name) }}"
|
||||||
|
class="input-soft text-sm" placeholder="KCP Sudirman">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Default Account Number</label>
|
||||||
|
<input type="text" name="default_bank_account"
|
||||||
|
value="{{ old('default_bank_account', $settings->default_bank_account) }}"
|
||||||
|
class="input-soft text-sm" placeholder="1234567890">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Default Account Holder</label>
|
||||||
|
<input type="text" name="default_bank_holder"
|
||||||
|
value="{{ old('default_bank_holder', $settings->default_bank_holder) }}"
|
||||||
|
class="input-soft text-sm" placeholder="Your full name">
|
||||||
|
</div>
|
||||||
|
<div class="sm:col-span-2">
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Default Notes / Payment Terms</label>
|
||||||
|
<textarea name="default_notes" rows="2" class="input-soft text-sm resize-none"
|
||||||
|
placeholder="e.g. Payment due within 14 days from invoice date.">{{ old('default_notes', $settings->default_notes) }}</textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button type="submit" class="btn-sakura w-full py-3">💾 Save Settings</button>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@if(session('success'))
|
@push('scripts')
|
||||||
<div x-data="{ show: true }" x-show="show" x-init="setTimeout(() => show = false, 4000)"
|
<script>
|
||||||
class="flex items-center justify-between gap-3 bg-green-50 border border-green-200 rounded-2xl px-4 py-3 text-sm text-green-700 mb-4">
|
function updatePreview() {
|
||||||
<span>{{ session('success') }}</span>
|
const prefix = document.getElementById('prefix-input').value.replace(/-+$/, '') || 'INV';
|
||||||
<button @click="show = false" class="text-green-500 hover:text-green-700 text-lg leading-none">✕</button>
|
const num = parseInt(document.getElementById('number-input').value) || 1;
|
||||||
</div>
|
document.getElementById('number-preview').textContent = prefix + '-' + String(num).padStart(3, '0');
|
||||||
@endif
|
}
|
||||||
|
</script>
|
||||||
<form action="{{ route('invoice-settings.update') }}" method="POST" enctype="multipart/form-data"
|
@endpush
|
||||||
class="space-y-5">
|
|
||||||
@csrf
|
|
||||||
|
|
||||||
{{-- Number Format --}}
|
|
||||||
<div class="cat-card p-5">
|
|
||||||
<h2 class="text-sm font-bold text-gray-700 mb-4 flex items-center gap-2">🔢 Invoice Number Format</h2>
|
|
||||||
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
|
||||||
<div>
|
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">
|
|
||||||
Prefix <span class="text-pink-400">*</span>
|
|
||||||
</label>
|
|
||||||
<input type="text" name="invoice_prefix"
|
|
||||||
value="{{ old('invoice_prefix', $settings->invoice_prefix) }}"
|
|
||||||
class="input-soft text-sm" placeholder="INV-EA" required
|
|
||||||
id="prefix-input" oninput="updatePreview()">
|
|
||||||
<p class="text-xs text-gray-400 mt-1">e.g. <code>INV-EA</code> → <strong>INV-EA-001</strong></p>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">
|
|
||||||
Next Number <span class="text-pink-400">*</span>
|
|
||||||
</label>
|
|
||||||
<input type="number" name="invoice_next_number"
|
|
||||||
value="{{ old('invoice_next_number', $settings->invoice_next_number) }}"
|
|
||||||
class="input-soft text-sm" min="1" required
|
|
||||||
id="number-input" oninput="updatePreview()">
|
|
||||||
<p class="text-xs text-gray-400 mt-1">Used for the next new invoice</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="mt-3 bg-pink-50 rounded-xl px-4 py-2.5 text-sm text-gray-600">
|
|
||||||
Preview: <strong class="text-pink-600" id="number-preview">
|
|
||||||
{{ rtrim(old('invoice_prefix', $settings->invoice_prefix), '-') }}-{{ str_pad((string) (old('invoice_next_number', $settings->invoice_next_number) ?? 1), 3, '0', STR_PAD_LEFT) }}
|
|
||||||
</strong>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{-- Header / Branding --}}
|
|
||||||
<div class="cat-card p-5">
|
|
||||||
<h2 class="text-sm font-bold text-gray-700 mb-4 flex items-center gap-2">🎨 Invoice Header</h2>
|
|
||||||
|
|
||||||
{{-- 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>
|
|
||||||
|
|
||||||
<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"
|
|
||||||
: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"
|
|
||||||
value="{{ old('header_name', $settings->header_name) }}"
|
|
||||||
class="input-soft text-sm" placeholder="Your name or brand">
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Title / Tagline</label>
|
|
||||||
<input type="text" name="header_title"
|
|
||||||
value="{{ old('header_title', $settings->header_title) }}"
|
|
||||||
class="input-soft text-sm" placeholder="Content Creator · KOL">
|
|
||||||
</div>
|
|
||||||
<div 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>
|
|
||||||
|
|
||||||
{{-- Invoice Defaults --}}
|
|
||||||
<div class="cat-card p-5">
|
|
||||||
<h2 class="text-sm font-bold text-gray-700 mb-4 flex items-center gap-2">📋 Invoice Defaults</h2>
|
|
||||||
<p class="text-xs text-gray-400 mb-4">These values will pre-fill every new invoice you create.</p>
|
|
||||||
|
|
||||||
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
|
||||||
<div>
|
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Default Tax Rate (%)</label>
|
|
||||||
<input type="number" name="default_tax_rate" step="0.01" min="0" max="100"
|
|
||||||
value="{{ old('default_tax_rate', $settings->default_tax_rate ?? 11) }}"
|
|
||||||
class="input-soft text-sm" placeholder="11">
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Default Currency</label>
|
|
||||||
<select name="default_currency" class="input-soft text-sm">
|
|
||||||
@foreach(['IDR' => 'IDR (Rupiah)', 'USD' => 'USD (Dollar)', 'SGD' => 'SGD', 'MYR' => 'MYR (Ringgit)'] as $code => $label)
|
|
||||||
<option value="{{ $code }}" {{ old('default_currency', $settings->default_currency ?? 'IDR') === $code ? 'selected' : '' }}>
|
|
||||||
{{ $label }}
|
|
||||||
</option>
|
|
||||||
@endforeach
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="sm:col-span-2">
|
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Default Service Description</label>
|
|
||||||
<input type="text" name="default_service_description"
|
|
||||||
value="{{ old('default_service_description', $settings->default_service_description) }}"
|
|
||||||
class="input-soft text-sm" placeholder="e.g. Instagram Feed Post — 1 carousel">
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Default Bank Name</label>
|
|
||||||
<input type="text" name="default_bank_name"
|
|
||||||
value="{{ old('default_bank_name', $settings->default_bank_name) }}"
|
|
||||||
class="input-soft text-sm" placeholder="BCA, Mandiri…">
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Default Branch Name</label>
|
|
||||||
<input type="text" name="default_branch_name"
|
|
||||||
value="{{ old('default_branch_name', $settings->default_branch_name) }}"
|
|
||||||
class="input-soft text-sm" placeholder="KCP Sudirman">
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Default Account Number</label>
|
|
||||||
<input type="text" name="default_bank_account"
|
|
||||||
value="{{ old('default_bank_account', $settings->default_bank_account) }}"
|
|
||||||
class="input-soft text-sm" placeholder="1234567890">
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Default Account Holder</label>
|
|
||||||
<input type="text" name="default_bank_holder"
|
|
||||||
value="{{ old('default_bank_holder', $settings->default_bank_holder) }}"
|
|
||||||
class="input-soft text-sm" placeholder="Your full name">
|
|
||||||
</div>
|
|
||||||
<div class="sm:col-span-2">
|
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Default Notes / Payment Terms</label>
|
|
||||||
<textarea name="default_notes" rows="2" class="input-soft text-sm resize-none"
|
|
||||||
placeholder="e.g. Payment due within 14 days from invoice date.">{{ old('default_notes', $settings->default_notes) }}</textarea>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<button type="submit" class="btn-sakura w-full py-3">💾 Save Settings</button>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
@push('scripts')
|
|
||||||
<script>
|
|
||||||
function updatePreview() {
|
|
||||||
const prefix = document.getElementById('prefix-input').value.replace(/-+$/, '') || 'INV';
|
|
||||||
const num = parseInt(document.getElementById('number-input').value) || 1;
|
|
||||||
document.getElementById('number-preview').textContent = prefix + '-' + String(num).padStart(3, '0');
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@endpush
|
|
||||||
@endsection
|
@endsection
|
||||||
@@ -5,136 +5,151 @@
|
|||||||
@section('page-subtitle', $invoice->title)
|
@section('page-subtitle', $invoice->title)
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<div class="max-w-3xl mx-auto">
|
<div class="max-w-3xl mx-auto">
|
||||||
<div class="flex gap-3 mb-6">
|
<div class="flex gap-3 mb-6">
|
||||||
<a href="{{ route('invoices.edit', $invoice) }}" class="btn-sakura">Edit</a>
|
<a href="{{ route('invoices.edit', $invoice) }}" class="btn-sakura">Edit</a>
|
||||||
<a href="{{ route('invoices.pdf', $invoice) }}" target="_blank" class="btn btn-outline rounded-full text-pink-500 border-pink-300">📥 Download PDF</a>
|
<a href="{{ route('invoices.pdf', $invoice) }}" target="_blank"
|
||||||
<form action="{{ route('invoices.destroy', $invoice) }}" method="POST" onsubmit="return confirm('Delete this invoice?')">
|
class="btn-sakura text-sm px-4 py-2.5 rounded-full border border-pink-200 text-pink-500 hover:bg-pink-50">📥
|
||||||
@csrf @method('DELETE')
|
Download PDF</a>
|
||||||
<button class="btn btn-ghost rounded-full text-error">Delete</button>
|
<form action="{{ route('invoices.destroy', $invoice) }}" method="POST"
|
||||||
</form>
|
onsubmit="return confirm('Delete this invoice?')">
|
||||||
</div>
|
@csrf @method('DELETE')
|
||||||
|
<button
|
||||||
|
class="btn-sakura text-sm px-4 py-2.5 rounded-full border border-red-200 text-red-500 hover:bg-red-50">Delete</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="cat-card p-8">
|
<div class="cat-card p-8">
|
||||||
{{-- Invoice Header --}}
|
{{-- Invoice Header --}}
|
||||||
<div class="flex justify-between items-start mb-8">
|
<div class="flex justify-between items-start mb-8">
|
||||||
<div class="flex items-center gap-3">
|
<div class="flex items-center gap-3">
|
||||||
@if($invoiceSettings->header_logo)
|
@if($invoiceSettings->header_logo)
|
||||||
<img src="{{ asset('storage/' . $invoiceSettings->header_logo) }}"
|
<img src="{{ asset('storage/' . $invoiceSettings->header_logo) }}" alt="Logo"
|
||||||
alt="Logo" class="h-14 w-14 object-cover rounded-2xl border border-pink-100 shrink-0">
|
class="h-14 w-14 object-cover rounded-2xl border border-pink-100 shrink-0">
|
||||||
@endif
|
@endif
|
||||||
|
<div>
|
||||||
|
<div class="text-xl font-extrabold" style="color:{{ $invoiceSettings->accent_color ?? '#FFB7C5' }}">
|
||||||
|
{{ $invoiceSettings->header_name ?: '🐱 Cathy' }}
|
||||||
|
</div>
|
||||||
|
<div class="text-sm text-gray-400 mt-0.5">
|
||||||
|
{{ $invoiceSettings->header_title ?: 'Personal Talent Assistant' }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="text-right">
|
||||||
|
<div class="text-2xl font-bold text-gray-800">{{ $invoice->invoice_number }}</div>
|
||||||
|
<span class="badge {{ $invoice->status->badgeClass() }} mt-1">{{ $invoice->status->label() }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Billing Info --}}
|
||||||
|
<div class="grid grid-cols-2 gap-8 mb-8">
|
||||||
<div>
|
<div>
|
||||||
<div class="text-xl font-extrabold"
|
<h4 class="text-xs font-bold text-gray-400 uppercase mb-2">Bill To</h4>
|
||||||
style="color:{{ $invoiceSettings->accent_color ?? '#FFB7C5' }}">
|
@if($invoice->client)
|
||||||
{{ $invoiceSettings->header_name ?: '🐱 Cathy' }}
|
<div class="font-semibold text-gray-800">{{ $invoice->client->name }}</div>
|
||||||
</div>
|
@if($invoice->client->company)
|
||||||
<div class="text-sm text-gray-400 mt-0.5">
|
<div class="text-sm text-gray-500">{{ $invoice->client->company }}</div> @endif
|
||||||
{{ $invoiceSettings->header_title ?: 'Personal Talent Assistant' }}
|
@if($invoice->client->email)
|
||||||
|
<div class="text-sm text-gray-500">{{ $invoice->client->email }}</div> @endif
|
||||||
|
@if($invoice->client->full_address)
|
||||||
|
<div class="text-sm text-gray-400">{{ $invoice->client->full_address }}</div> @endif
|
||||||
|
@else
|
||||||
|
<div class="text-gray-500 text-sm">No client</div>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
<div class="text-right">
|
||||||
|
<div class="text-xs font-bold text-gray-400 uppercase mb-2">Invoice Details</div>
|
||||||
|
<div class="text-sm space-y-1">
|
||||||
|
<div><span class="text-gray-400">Issue:</span> {{ $invoice->issue_date->format('d M Y') }}</div>
|
||||||
|
<div><span class="text-gray-400">Due:</span> <span
|
||||||
|
class="{{ $invoice->due_date->isPast() && $invoice->status->value !== 'paid' ? 'text-red-500 font-bold' : '' }}">{{ $invoice->due_date->format('d M Y') }}</span>
|
||||||
|
</div>
|
||||||
|
@if($invoice->paid_date)
|
||||||
|
<div><span class="text-gray-400">Paid:</span> {{ $invoice->paid_date->format('d M Y') }}</div>
|
||||||
|
@endif
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="text-right">
|
|
||||||
<div class="text-2xl font-bold text-gray-800">{{ $invoice->invoice_number }}</div>
|
|
||||||
<span class="badge {{ $invoice->status->badgeClass() }} mt-1">{{ $invoice->status->label() }}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{-- Billing Info --}}
|
{{-- Line Items --}}
|
||||||
<div class="grid grid-cols-2 gap-8 mb-8">
|
@php
|
||||||
<div>
|
$accent = $invoiceSettings->accent_color ?? '#FFB7C5';
|
||||||
<h4 class="text-xs font-bold text-gray-400 uppercase mb-2">Bill To</h4>
|
$hex = ltrim($accent, '#');
|
||||||
@if($invoice->client)
|
$r = hexdec(substr($hex, 0, 2));
|
||||||
<div class="font-semibold text-gray-800">{{ $invoice->client->name }}</div>
|
$g = hexdec(substr($hex, 2, 2));
|
||||||
@if($invoice->client->company) <div class="text-sm text-gray-500">{{ $invoice->client->company }}</div> @endif
|
$b = hexdec(substr($hex, 4, 2));
|
||||||
@if($invoice->client->email) <div class="text-sm text-gray-500">{{ $invoice->client->email }}</div> @endif
|
$tint = sprintf(
|
||||||
@if($invoice->client->full_address) <div class="text-sm text-gray-400">{{ $invoice->client->full_address }}</div> @endif
|
'#%02X%02X%02X',
|
||||||
@else
|
(int) (255 * 0.92 + $r * 0.08),
|
||||||
<div class="text-gray-500 text-sm">No client</div>
|
(int) (255 * 0.92 + $g * 0.08),
|
||||||
@endif
|
(int) (255 * 0.92 + $b * 0.08)
|
||||||
</div>
|
);
|
||||||
<div class="text-right">
|
@endphp
|
||||||
<div class="text-xs font-bold text-gray-400 uppercase mb-2">Invoice Details</div>
|
<table class="w-full mb-6">
|
||||||
<div class="text-sm space-y-1">
|
<thead>
|
||||||
<div><span class="text-gray-400">Issue:</span> {{ $invoice->issue_date->format('d M Y') }}</div>
|
<tr class="text-xs text-gray-500 uppercase" style="background:{{ $tint }}">
|
||||||
<div><span class="text-gray-400">Due:</span> <span class="{{ $invoice->due_date->isPast() && $invoice->status->value !== 'paid' ? 'text-red-500 font-bold' : '' }}">{{ $invoice->due_date->format('d M Y') }}</span></div>
|
<th class="text-left py-3 px-4 rounded-l-2xl">Description</th>
|
||||||
@if($invoice->paid_date) <div><span class="text-gray-400">Paid:</span> {{ $invoice->paid_date->format('d M Y') }}</div> @endif
|
<th class="text-center py-3 px-4">Qty</th>
|
||||||
</div>
|
<th class="text-right py-3 px-4">Unit Price</th>
|
||||||
</div>
|
<th class="text-right py-3 px-4 rounded-r-2xl">Total</th>
|
||||||
</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>
|
|
||||||
<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>
|
|
||||||
<th class="text-right py-3 px-4 rounded-r-2xl">Total</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<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 }}
|
|
||||||
@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>
|
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
</thead>
|
||||||
</tbody>
|
<tbody>
|
||||||
</table>
|
@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 }}
|
||||||
|
@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>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
{{-- Totals --}}
|
{{-- Totals --}}
|
||||||
<div class="flex justify-end mb-8">
|
<div class="flex justify-end mb-8">
|
||||||
<div class="w-72 space-y-2 text-sm">
|
<div class="w-72 space-y-2 text-sm">
|
||||||
<div class="flex justify-between text-gray-500">
|
<div class="flex justify-between text-gray-500">
|
||||||
<span>Subtotal</span><span class="font-medium">Rp {{ number_format($invoice->subtotal, 0, ',', '.') }}</span>
|
<span>Subtotal</span><span class="font-medium">Rp
|
||||||
</div>
|
{{ number_format($invoice->subtotal, 0, ',', '.') }}</span>
|
||||||
@if($invoice->tax_rate > 0)
|
</div>
|
||||||
<div class="flex justify-between text-amber-600">
|
@if($invoice->tax_rate > 0)
|
||||||
<span>Tax ({{ $invoice->tax_rate }}% — paid by client)</span>
|
<div class="flex justify-between text-amber-600">
|
||||||
<span class="font-medium">Rp {{ number_format($invoice->tax_amount, 0, ',', '.') }}</span>
|
<span>Tax ({{ $invoice->tax_rate }}% — paid by client)</span>
|
||||||
</div>
|
<span class="font-medium">Rp {{ number_format($invoice->tax_amount, 0, ',', '.') }}</span>
|
||||||
@endif
|
</div>
|
||||||
<div class="flex justify-between text-base font-bold pt-2 border-t border-pink-200"
|
@endif
|
||||||
style="color:{{ $invoiceSettings->accent_color ?? '#FFB7C5' }}">
|
<div class="flex justify-between text-base font-bold pt-2 border-t border-pink-200"
|
||||||
<span>Grand Total</span><span>{{ $invoice->formatted_total }}</span>
|
style="color:{{ $invoiceSettings->accent_color ?? '#FFB7C5' }}">
|
||||||
|
<span>Grand Total</span><span>{{ $invoice->formatted_total }}</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{{-- Bank Info --}}
|
||||||
|
@if($invoice->bank_name)
|
||||||
|
<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 }}
|
||||||
|
@if($invoice->branch_name) · {{ $invoice->branch_name }} @endif
|
||||||
|
· {{ $invoice->bank_account }} · a/n {{ $invoice->bank_holder }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
@if($invoice->notes)
|
||||||
|
<div class="mt-4 text-sm text-gray-500 italic">{{ $invoice->notes }}</div>
|
||||||
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{-- Bank Info --}}
|
|
||||||
@if($invoice->bank_name)
|
|
||||||
<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 }}
|
|
||||||
@if($invoice->branch_name) · {{ $invoice->branch_name }} @endif
|
|
||||||
· {{ $invoice->bank_account }} · a/n {{ $invoice->bank_holder }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
|
|
||||||
@if($invoice->notes)
|
|
||||||
<div class="mt-4 text-sm text-gray-500 italic">{{ $invoice->notes }}</div>
|
|
||||||
@endif
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
@endsection
|
@endsection
|
||||||
@@ -72,7 +72,7 @@
|
|||||||
|
|
||||||
<a href="{{ route('contracts.index') }}" @click="sidebarOpen = false"
|
<a href="{{ route('contracts.index') }}" @click="sidebarOpen = false"
|
||||||
class="nav-item {{ request()->routeIs('contracts.*') ? 'active' : '' }}">
|
class="nav-item {{ request()->routeIs('contracts.*') ? 'active' : '' }}">
|
||||||
<span class="text-lg shrink-0">📋</span> Brand Contracts
|
<span class="text-lg shrink-0">📋</span> Contracts
|
||||||
</a>
|
</a>
|
||||||
<!--
|
<!--
|
||||||
<a href="{{ route('social-hub.index') }}"
|
<a href="{{ route('social-hub.index') }}"
|
||||||
|
|||||||
57
resources/views/layouts/fab.blade.php
Normal file
57
resources/views/layouts/fab.blade.php
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
<div x-data="{ open: false }" class="fixed bottom-6 right-6 z-50 flex flex-col items-end">
|
||||||
|
{{-- Menu items (hidden by default) --}}
|
||||||
|
<div x-show="open" x-transition:enter="transition ease-out duration-200"
|
||||||
|
x-transition:enter-start="opacity-0 translate-y-4 scale-95"
|
||||||
|
x-transition:enter-end="opacity-100 translate-y-0 scale-100"
|
||||||
|
x-transition:leave="transition ease-in duration-150"
|
||||||
|
x-transition:leave-start="opacity-100 translate-y-0 scale-100"
|
||||||
|
x-transition:leave-end="opacity-0 translate-y-4 scale-95"
|
||||||
|
@click.away="open = false"
|
||||||
|
class="flex flex-col items-end gap-3 mb-4" style="display: none;">
|
||||||
|
|
||||||
|
<a href="{{ route('files.index') }}" class="flex items-center gap-3 group">
|
||||||
|
<span class="bg-gray-800 text-white font-medium text-xs px-3 py-2 rounded-lg shadow-xl min-w-max hidden lg:block opacity-0 translate-x-4 group-hover:opacity-100 group-hover:translate-x-0 transition-all duration-300 ease-out">Upload File</span>
|
||||||
|
<div class="w-12 h-12 rounded-full bg-teal-500 text-white flex items-center justify-center shadow hover:scale-110 transition-transform duration-200 text-lg">📁</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<a href="{{ route('notes.index') }}" class="flex items-center gap-3 group">
|
||||||
|
<span class="bg-gray-800 text-white font-medium text-xs px-3 py-2 rounded-lg shadow-xl min-w-max hidden lg:block opacity-0 translate-x-4 group-hover:opacity-100 group-hover:translate-x-0 transition-all duration-300 ease-out">Add Notes</span>
|
||||||
|
<div class="w-12 h-12 rounded-full bg-yellow-400 text-white flex items-center justify-center shadow hover:scale-110 transition-transform duration-200 text-lg">📝</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<a href="{{ route('content.create') }}" class="flex items-center gap-3 group">
|
||||||
|
<span class="bg-gray-800 text-white font-medium text-xs px-3 py-2 rounded-lg shadow-xl min-w-max hidden lg:block opacity-0 translate-x-4 group-hover:opacity-100 group-hover:translate-x-0 transition-all duration-300 ease-out">New Board</span>
|
||||||
|
<div class="w-12 h-12 rounded-full bg-purple-500 text-white flex items-center justify-center shadow hover:scale-110 transition-transform duration-200 text-lg">🎬</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<a href="{{ route('contracts.index') }}" class="flex items-center gap-3 group">
|
||||||
|
<span class="bg-gray-800 text-white font-medium text-xs px-3 py-2 rounded-lg shadow-xl min-w-max hidden lg:block opacity-0 translate-x-4 group-hover:opacity-100 group-hover:translate-x-0 transition-all duration-300 ease-out">New Contract</span>
|
||||||
|
<div class="w-12 h-12 rounded-full bg-rose-500 text-white flex items-center justify-center shadow hover:scale-110 transition-transform duration-200 text-lg">📄</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<a href="{{ route('invoices.create') }}" class="flex items-center gap-3 group">
|
||||||
|
<span class="bg-gray-800 text-white font-medium text-xs px-3 py-2 rounded-lg shadow-xl min-w-max hidden lg:block opacity-0 translate-x-4 group-hover:opacity-100 group-hover:translate-x-0 transition-all duration-300 ease-out">New Invoice</span>
|
||||||
|
<div class="w-12 h-12 rounded-full bg-amber-500 text-white flex items-center justify-center shadow hover:scale-110 transition-transform duration-200 text-lg">🧾</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<a href="{{ route('clients.create') }}" class="flex items-center gap-3 group">
|
||||||
|
<span class="bg-gray-800 text-white font-medium text-xs px-3 py-2 rounded-lg shadow-xl min-w-max hidden lg:block opacity-0 translate-x-4 group-hover:opacity-100 group-hover:translate-x-0 transition-all duration-300 ease-out">Add Client</span>
|
||||||
|
<div class="w-12 h-12 rounded-full bg-emerald-500 text-white flex items-center justify-center shadow hover:scale-110 transition-transform duration-200 text-lg">👥</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<a href="{{ route('schedule.create') }}" class="flex items-center gap-3 group">
|
||||||
|
<span class="bg-gray-800 text-white font-medium text-xs px-3 py-2 rounded-lg shadow-xl min-w-max hidden lg:block opacity-0 translate-x-4 group-hover:opacity-100 group-hover:translate-x-0 transition-all duration-300 ease-out">Add Event</span>
|
||||||
|
<div class="w-12 h-12 rounded-full bg-blue-500 text-white flex items-center justify-center shadow hover:scale-110 transition-transform duration-200 text-lg">📅</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Main FAB button --}}
|
||||||
|
<button @click="open = !open"
|
||||||
|
class="w-16 h-16 rounded-full bg-pink-500 hover:bg-pink-600 text-white flex items-center justify-center shadow-lg shadow-pink-500/40 hover:shadow-2xl hover:shadow-pink-500/50 transition-all duration-300 hover:-translate-y-1 hover:scale-105 active:scale-95 z-50 transform"
|
||||||
|
:class="{'rotate-45 bg-pink-600': open}">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" class="h-8 w-8 transition-transform duration-300" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="3">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" d="M12 4v16m8-8H4" />
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
@@ -1,483 +1,472 @@
|
|||||||
@extends('layouts.app')
|
@extends('layouts.app')
|
||||||
|
|
||||||
@section('title', 'Notes')
|
@section('title', 'Notes')
|
||||||
@section('page-title', '📝 Notes')
|
@section('page-title', 'Notes Management 📝')
|
||||||
@section('page-subtitle', 'Quick notes, checklists & reminders')
|
@section('page-subtitle', 'Quick notes, checklists & reminders')
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
|
|
||||||
<div x-data="notesApp({{ json_encode($notes) }})" x-cloak>
|
<div x-data="notesApp({{ json_encode($notes) }})" x-cloak>
|
||||||
|
|
||||||
{{-- ── Toolbar ──────────────────────────────────────────────── --}}
|
{{-- ── Toolbar ──────────────────────────────────────────────── --}}
|
||||||
<div class="flex items-center gap-2 mb-4">
|
<div class="flex items-center gap-2 mb-4">
|
||||||
<button @click="openNew()"
|
<button @click="openNew()" class="btn-sakura text-sm px-4 py-2 flex items-center gap-1.5 shrink-0">
|
||||||
class="btn-sakura text-sm px-4 py-2 flex items-center gap-1.5 shrink-0">
|
+ New Note
|
||||||
+ New Note
|
</button>
|
||||||
</button>
|
|
||||||
|
|
||||||
{{-- Search --}}
|
{{-- Search --}}
|
||||||
<div class="relative flex-1 max-w-xs">
|
<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>
|
<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…"
|
<input type="text" x-model="searchQuery" placeholder="🔍Search notes…"
|
||||||
class="input-soft pl-9 text-sm py-2 w-full">
|
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>
|
</div>
|
||||||
|
|
||||||
{{-- Count --}}
|
{{-- ── Pinned section ───────────────────────────────────────── --}}
|
||||||
<span class="ml-auto text-xs text-gray-400 shrink-0"
|
<template x-if="filteredPinned.length > 0">
|
||||||
x-text="notes.length + ' note' + (notes.length !== 1 ? 's' : '')"></span>
|
<div class="mb-5">
|
||||||
</div>
|
<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)">
|
||||||
|
|
||||||
{{-- ── Pinned section ───────────────────────────────────────── --}}
|
{{-- Pin badge --}}
|
||||||
<template x-if="filteredPinned.length > 0">
|
<div
|
||||||
<div class="mb-5">
|
class="absolute top-2.5 right-2.5 text-xs text-amber-400 opacity-60 group-hover:opacity-100">
|
||||||
<div class="text-xs font-bold text-gray-400 uppercase tracking-wider mb-2 flex items-center gap-1.5">
|
📌</div>
|
||||||
📌 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 --}}
|
{{-- Title --}}
|
||||||
<div class="absolute top-2.5 right-2.5 text-xs text-amber-400 opacity-60 group-hover:opacity-100">📌</div>
|
<p class="font-bold text-gray-800 text-sm leading-snug pr-5 line-clamp-2"
|
||||||
|
x-text="note.title || 'Untitled'"></p>
|
||||||
|
|
||||||
{{-- Title --}}
|
{{-- Content preview --}}
|
||||||
<p class="font-bold text-gray-800 text-sm leading-snug pr-5 line-clamp-2"
|
<div class="flex-1 text-xs text-gray-500 space-y-0.5 line-clamp-4">
|
||||||
x-text="note.title || 'Untitled'"></p>
|
<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>
|
||||||
|
|
||||||
{{-- Content preview --}}
|
{{-- Footer --}}
|
||||||
<div class="flex-1 text-xs text-gray-500 space-y-0.5 line-clamp-4">
|
<div class="flex items-center justify-between mt-1">
|
||||||
<template x-for="(block, i) in (note.content || []).slice(0, 4)" :key="i">
|
<span class="text-xs text-gray-400" x-text="formatDate(note.updated_at)"></span>
|
||||||
<div class="flex items-start gap-1.5 min-w-0">
|
<button @click.stop="deleteNote(note)"
|
||||||
<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>
|
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>
|
</div>
|
||||||
</div>
|
</template>
|
||||||
</template>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</template>
|
||||||
</template>
|
|
||||||
|
|
||||||
{{-- ── All / Other notes ────────────────────────────────────── --}}
|
{{-- ── All / Other notes ────────────────────────────────────── --}}
|
||||||
<template x-if="filteredUnpinned.length > 0 || (filteredPinned.length > 0)">
|
<template x-if="filteredUnpinned.length > 0 || (filteredPinned.length > 0)">
|
||||||
<div>
|
<div>
|
||||||
<template x-if="filteredPinned.length > 0 && filteredUnpinned.length > 0">
|
<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>
|
<div class="text-xs font-bold text-gray-400 uppercase tracking-wider mb-2">Others</div>
|
||||||
</template>
|
</template>
|
||||||
<div class="grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 gap-3">
|
<div class="grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 gap-3">
|
||||||
<template x-for="note in filteredUnpinned" :key="note.id">
|
<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
|
<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"
|
hover:shadow-md transition-shadow duration-200 group"
|
||||||
:style="`background:${note.color || '#FFFFFF'}`"
|
:style="`background:${note.color || '#FFFFFF'}`" @click="openEdit(note)">
|
||||||
@click="openEdit(note)">
|
|
||||||
|
|
||||||
{{-- Title --}}
|
{{-- Title --}}
|
||||||
<p class="font-bold text-gray-800 text-sm leading-snug line-clamp-2"
|
<p class="font-bold text-gray-800 text-sm leading-snug line-clamp-2"
|
||||||
x-text="note.title || 'Untitled'"></p>
|
x-text="note.title || 'Untitled'"></p>
|
||||||
|
|
||||||
{{-- Content preview --}}
|
{{-- Content preview --}}
|
||||||
<div class="flex-1 text-xs text-gray-500 space-y-0.5">
|
<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">
|
<template x-for="(block, i) in (note.content || []).slice(0, 4)" :key="i">
|
||||||
<div class="flex items-start gap-1.5 min-w-0">
|
<div class="flex items-start gap-1.5 min-w-0">
|
||||||
<template x-if="block.type === 'bullet'">
|
<template x-if="block.type === 'bullet'">
|
||||||
<span class="shrink-0 text-gray-400 mt-px">•</span>
|
<span class="shrink-0 text-gray-400 mt-px">•</span>
|
||||||
</template>
|
</template>
|
||||||
<template x-if="block.type === 'checkbox'">
|
<template x-if="block.type === 'checkbox'">
|
||||||
<span class="shrink-0 mt-px" x-text="block.checked ? '☑' : '☐'"></span>
|
<span class="shrink-0 mt-px" x-text="block.checked ? '☑' : '☐'"></span>
|
||||||
</template>
|
</template>
|
||||||
<span class="truncate"
|
<span class="truncate"
|
||||||
:class="block.type === 'checkbox' && block.checked ? 'line-through text-gray-400' : ''"
|
:class="block.type === 'checkbox' && block.checked ? 'line-through text-gray-400' : ''"
|
||||||
x-text="block.text || '…'"></span>
|
x-text="block.text || '…'"></span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{-- Footer --}}
|
{{-- Footer --}}
|
||||||
<div class="flex items-center justify-between mt-1">
|
<div class="flex items-center justify-between mt-1">
|
||||||
<span class="text-xs text-gray-400" x-text="formatDate(note.updated_at)"></span>
|
<span class="text-xs text-gray-400" x-text="formatDate(note.updated_at)"></span>
|
||||||
<button @click.stop="deleteNote(note)"
|
<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>
|
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>
|
</div>
|
||||||
</div>
|
</template>
|
||||||
</template>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</template>
|
||||||
</template>
|
|
||||||
|
|
||||||
{{-- ── Empty state ──────────────────────────────────────────── --}}
|
{{-- ── Empty state ──────────────────────────────────────────── --}}
|
||||||
<template x-if="notes.length === 0">
|
<template x-if="notes.length === 0">
|
||||||
<div class="text-center py-20 text-gray-400">
|
<div class="text-center py-20 text-gray-400">
|
||||||
<span class="text-5xl block mb-3">📝</span>
|
<span class="text-5xl block mb-3">📝</span>
|
||||||
<p class="text-sm font-medium mb-4">No notes yet.</p>
|
<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>
|
<button @click="openNew()" class="btn-sakura text-sm">Write your first note</button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template x-if="notes.length > 0 && filteredPinned.length === 0 && filteredUnpinned.length === 0">
|
<template x-if="notes.length > 0 && filteredPinned.length === 0 && filteredUnpinned.length === 0">
|
||||||
<div class="text-center py-12 text-gray-400">
|
<div class="text-center py-12 text-gray-400">
|
||||||
<span class="text-3xl block mb-2">🔍</span>
|
<span class="text-3xl block mb-2">🔍</span>
|
||||||
<p class="text-sm">No notes match "<span x-text="searchQuery"></span>"</p>
|
<p class="text-sm">No notes match "<span x-text="searchQuery"></span>"</p>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
||||||
{{-- ════════════════════════════════════════════════════════════
|
{{-- ════════════════════════════════════════════════════════════
|
||||||
Note Editor Modal
|
Note Editor Modal
|
||||||
════════════════════════════════════════════════════════════ --}}
|
════════════════════════════════════════════════════════════ --}}
|
||||||
<div x-show="showModal"
|
<div x-show="showModal" x-transition:enter="transition ease-out duration-200" x-transition:enter-start="opacity-0"
|
||||||
x-transition:enter="transition ease-out duration-200"
|
x-transition:enter-end="opacity-100" x-transition:leave="transition ease-in duration-150"
|
||||||
x-transition:enter-start="opacity-0"
|
x-transition:leave-start="opacity-100" x-transition:leave-end="opacity-0"
|
||||||
x-transition:enter-end="opacity-100"
|
class="fixed inset-0 z-50 flex items-end sm:items-center justify-center bg-black/40 px-0 sm:px-4"
|
||||||
x-transition:leave="transition ease-in duration-150"
|
style="display:none" @keydown.escape.window="showModal = false">
|
||||||
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"
|
<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="`background:${editorColor || '#FFFFFF'}`" style="max-height:90vh" @click.stop>
|
||||||
style="max-height:90vh"
|
|
||||||
@click.stop>
|
|
||||||
|
|
||||||
{{-- ── Modal Header ─────────────────────────────── --}}
|
{{-- ── Modal Header ─────────────────────────────── --}}
|
||||||
<div class="flex items-center gap-2 px-4 pt-4 pb-3 border-b border-black/5 shrink-0">
|
<div class="flex items-center gap-2 px-4 pt-4 pb-3 border-b border-black/5 shrink-0">
|
||||||
|
|
||||||
{{-- Color swatches --}}
|
{{-- Color swatches --}}
|
||||||
<div class="flex gap-1.5 flex-wrap">
|
<div class="flex gap-1.5 flex-wrap">
|
||||||
<template x-for="c in noteColors" :key="c">
|
<template x-for="c in noteColors" :key="c">
|
||||||
<button @click="editorColor = c" type="button"
|
<button @click="editorColor = c" type="button"
|
||||||
class="w-5 h-5 rounded-full border-2 transition-transform hover:scale-110 shrink-0"
|
class="w-5 h-5 rounded-full border-2 transition-transform hover:scale-110 shrink-0"
|
||||||
:style="`background:${c}`"
|
:style="`background:${c}`"
|
||||||
:class="editorColor === c ? 'border-gray-500 scale-110' : 'border-gray-200'">
|
:class="editorColor === c ? 'border-gray-500 scale-110' : 'border-gray-200'">
|
||||||
</button>
|
</button>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{-- Pin toggle --}}
|
{{-- Pin toggle --}}
|
||||||
<button @click="editorPinned = !editorPinned" type="button"
|
<button @click="editorPinned = !editorPinned" type="button"
|
||||||
class="ml-auto text-sm px-2.5 py-1 rounded-full border transition-colors shrink-0"
|
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'">
|
: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>
|
📌 <span x-text="editorPinned ? 'Pinned' : 'Pin'"></span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
{{-- Close --}}
|
{{-- Close --}}
|
||||||
<button @click="showModal = false" type="button"
|
<button @click="showModal = false" type="button"
|
||||||
class="text-gray-400 hover:text-gray-600 text-xl leading-none shrink-0 ml-1">✕</button>
|
class="text-gray-400 hover:text-gray-600 text-xl leading-none shrink-0 ml-1">✕</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{-- ── Scrollable Body ──────────────────────────── --}}
|
{{-- ── Scrollable Body ──────────────────────────── --}}
|
||||||
<div class="flex-1 overflow-y-auto px-4 py-3 space-y-1">
|
<div class="flex-1 overflow-y-auto px-4 py-3 space-y-1">
|
||||||
|
|
||||||
{{-- Title --}}
|
{{-- Title --}}
|
||||||
<input type="text" x-model="editorTitle" x-ref="titleInput"
|
<input type="text" x-model="editorTitle" x-ref="titleInput" placeholder="Note title…"
|
||||||
placeholder="Note title…"
|
class="w-full bg-transparent border-none outline-none font-bold text-gray-800 text-lg placeholder-gray-300 mb-2"
|
||||||
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()">
|
||||||
@keydown.enter.prevent="focusFirstBlock()">
|
|
||||||
|
|
||||||
{{-- Blocks --}}
|
{{-- Blocks --}}
|
||||||
<template x-for="(block, idx) in editorBlocks" :key="block.id">
|
<template x-for="(block, idx) in editorBlocks" :key="block.id">
|
||||||
<div class="flex items-center gap-2 group/block py-0.5">
|
<div class="flex items-center gap-2 group/block py-0.5">
|
||||||
|
|
||||||
{{-- Left side: bullet / checkbox / empty --}}
|
{{-- Left side: bullet / checkbox / empty --}}
|
||||||
<template x-if="block.type === 'bullet'">
|
<template x-if="block.type === 'bullet'">
|
||||||
<span class="text-gray-400 text-sm shrink-0 select-none mt-px">•</span>
|
<span class="text-gray-400 text-sm shrink-0 select-none mt-px">•</span>
|
||||||
</template>
|
</template>
|
||||||
<template x-if="block.type === 'checkbox'">
|
<template x-if="block.type === 'checkbox'">
|
||||||
<input type="checkbox" x-model="block.checked"
|
<input type="checkbox" x-model="block.checked"
|
||||||
class="w-4 h-4 accent-pink-400 shrink-0 cursor-pointer mt-px"
|
class="w-4 h-4 accent-pink-400 shrink-0 cursor-pointer mt-px" @click.stop>
|
||||||
@click.stop>
|
</template>
|
||||||
</template>
|
<template x-if="block.type === 'paragraph'">
|
||||||
<template x-if="block.type === 'paragraph'">
|
<span class="w-4 shrink-0"></span>
|
||||||
<span class="w-4 shrink-0"></span>
|
</template>
|
||||||
</template>
|
|
||||||
|
|
||||||
{{-- Text input --}}
|
{{-- Text input --}}
|
||||||
<input type="text"
|
<input type="text" x-model="block.text"
|
||||||
x-model="block.text"
|
:placeholder="block.type === 'paragraph' ? 'Add text…' : block.type === 'bullet' ? 'List item…' : 'To-do item…'"
|
||||||
: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="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"
|
||||||
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)"
|
||||||
:data-block-id="block.id"
|
@keydown.backspace="handleBackspace($event, block, idx)">
|
||||||
@keydown.enter.prevent="insertBlockAfter(idx)"
|
|
||||||
@keydown.backspace="handleBackspace($event, block, idx)">
|
|
||||||
|
|
||||||
{{-- Block type switcher (hover) --}}
|
{{-- Block type switcher (hover) --}}
|
||||||
<div class="flex gap-0.5 opacity-0 group-hover/block:opacity-100 transition-opacity shrink-0">
|
<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"
|
<button @click.stop="changeType(idx, 'paragraph')" type="button"
|
||||||
:class="block.type === 'paragraph' ? 'text-pink-500' : 'text-gray-300 hover:text-gray-500'"
|
: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>
|
class="text-xs px-1 leading-none" title="Text">T</button>
|
||||||
<button @click.stop="changeType(idx, 'bullet')" type="button"
|
<button @click.stop="changeType(idx, 'bullet')" type="button"
|
||||||
:class="block.type === 'bullet' ? 'text-pink-500' : 'text-gray-300 hover:text-gray-500'"
|
:class="block.type === 'bullet' ? 'text-pink-500' : 'text-gray-300 hover:text-gray-500'"
|
||||||
class="text-xs px-1 leading-none" title="Bullet">•</button>
|
class="text-xs px-1 leading-none" title="Bullet">•</button>
|
||||||
<button @click.stop="changeType(idx, 'checkbox')" type="button"
|
<button @click.stop="changeType(idx, 'checkbox')" type="button"
|
||||||
:class="block.type === 'checkbox' ? 'text-pink-500' : 'text-gray-300 hover:text-gray-500'"
|
:class="block.type === 'checkbox' ? 'text-pink-500' : 'text-gray-300 hover:text-gray-500'"
|
||||||
class="text-xs px-1 leading-none" title="Checkbox">☐</button>
|
class="text-xs px-1 leading-none" title="Checkbox">☐</button>
|
||||||
<button @click.stop="removeBlock(idx)" type="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>
|
class="text-xs px-1 leading-none text-gray-300 hover:text-red-400 ml-1"
|
||||||
|
title="Remove">✕</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</template>
|
||||||
</template>
|
|
||||||
|
|
||||||
{{-- Add block toolbar --}}
|
{{-- Add block toolbar --}}
|
||||||
<div class="flex gap-2 pt-3 border-t border-black/5 mt-2">
|
<div class="flex gap-2 pt-3 border-t border-black/5 mt-2">
|
||||||
<button @click="addBlock('paragraph')" type="button"
|
<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">
|
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
|
<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>
|
||||||
<button @click="addBlock('bullet')" type="button"
|
<button @click="showModal = false" 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">
|
class="flex-1 py-2.5 rounded-full border border-pink-200 text-gray-600 text-sm hover:bg-pink-50 transition-colors">
|
||||||
• Bullet
|
Cancel
|
||||||
</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>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</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>
|
|
||||||
|
|
||||||
</div>{{-- end x-data --}}
|
</div>{{-- end x-data --}}
|
||||||
|
|
||||||
@push('scripts')
|
@push('scripts')
|
||||||
<script>
|
<script>
|
||||||
function notesApp(initialNotes) {
|
function notesApp(initialNotes) {
|
||||||
return {
|
return {
|
||||||
notes: initialNotes,
|
notes: initialNotes,
|
||||||
showModal: false,
|
showModal: false,
|
||||||
editing: null,
|
editing: null,
|
||||||
|
|
||||||
// editor state
|
// editor state
|
||||||
editorTitle: '',
|
editorTitle: '',
|
||||||
editorBlocks: [],
|
editorBlocks: [],
|
||||||
editorColor: '#FFFFFF',
|
editorColor: '#FFFFFF',
|
||||||
editorPinned: false,
|
editorPinned: false,
|
||||||
saving: false,
|
saving: false,
|
||||||
nextBlockId: 1,
|
nextBlockId: 1,
|
||||||
searchQuery: '',
|
searchQuery: '',
|
||||||
|
|
||||||
noteColors: [
|
noteColors: [
|
||||||
'#FFFFFF', '#FFE4E8', '#FFF9C4', '#E8F5E9',
|
'#FFFFFF', '#FFE4E8', '#FFF9C4', '#E8F5E9',
|
||||||
'#E3F2FD', '#F3E5F5', '#FFF3E0', '#E0F7FA'
|
'#E3F2FD', '#F3E5F5', '#FFF3E0', '#E0F7FA'
|
||||||
],
|
],
|
||||||
|
|
||||||
// ── Computed / Filtered ───────────────────────────────
|
// ── Computed / Filtered ───────────────────────────────
|
||||||
get filteredPinned() {
|
get filteredPinned() {
|
||||||
return this.filterNotes(this.notes.filter(n => n.is_pinned));
|
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) {
|
get filteredUnpinned() {
|
||||||
const idx = this.notes.findIndex(n => n.id === this.editing.id);
|
return this.filterNotes(this.notes.filter(n => !n.is_pinned));
|
||||||
if (idx !== -1) this.notes.splice(idx, 1, saved);
|
},
|
||||||
} else {
|
|
||||||
this.notes.unshift(saved);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.showModal = false;
|
filterNotes(list) {
|
||||||
} catch (err) {
|
const q = this.searchQuery.trim().toLowerCase();
|
||||||
console.error('Save failed', err);
|
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' });
|
||||||
|
},
|
||||||
|
};
|
||||||
}
|
}
|
||||||
this.saving = false;
|
</script>
|
||||||
},
|
@endpush
|
||||||
|
|
||||||
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
|
@endsection
|
||||||
@@ -5,90 +5,92 @@
|
|||||||
@section('page-subtitle', 'Manage your service pricing')
|
@section('page-subtitle', 'Manage your service pricing')
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<div class="flex flex-wrap items-center justify-between gap-3 mb-5">
|
<div class="flex flex-wrap items-center justify-between gap-3 mb-5">
|
||||||
<div class="flex flex-wrap items-center gap-2">
|
<div class="flex flex-wrap items-center gap-2">
|
||||||
<a href="{{ route('rate-cards.public') }}" target="_blank"
|
<a href="{{ route('rate-cards.create') }}" class="btn-sakura text-sm shrink-0">+ Add Service</a>
|
||||||
class="text-xs px-3 py-2 rounded-full border border-pink-200 text-pink-500 hover:bg-pink-50 flex items-center gap-1">
|
<a href="{{ route('rate-cards.public') }}" target="_blank"
|
||||||
🔗 Public Page
|
class="btn-sakura text-sm px-3 py-2 rounded-full border border-pink-200 text-pink-500 hover:bg-pink-50 flex items-center gap-1">
|
||||||
</a>
|
🔗 Public Page
|
||||||
<a href="{{ route('rate-cards.pdf') }}"
|
</a>
|
||||||
class="text-xs px-3 py-2 rounded-full border border-blue-200 text-blue-500 hover:bg-blue-50 flex items-center gap-1">
|
<a href="{{ route('rate-cards.pdf') }}"
|
||||||
📄 PDF
|
class="btn-sakura text-sm px-3 py-2 rounded-full border border-blue-200 text-blue-500 hover:bg-blue-50 flex items-center gap-1">
|
||||||
</a>
|
📄 PDF
|
||||||
<a href="{{ route('rate-cards.profile') }}"
|
</a>
|
||||||
class="text-xs px-3 py-2 rounded-full border border-purple-200 text-purple-500 hover:bg-purple-50 flex items-center gap-1">
|
<a href="{{ route('rate-cards.profile') }}"
|
||||||
🎨 Profile
|
class="btn-sakura text-sm px-3 py-2 rounded-full border border-purple-200 text-purple-500 hover:bg-purple-50 flex items-center gap-1">
|
||||||
</a>
|
🎨 Profile
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<a href="{{ route('rate-cards.create') }}" class="btn-sakura text-sm shrink-0">+ Add Service</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
@php
|
@php
|
||||||
$grouped = $rateCards->groupBy('platform');
|
$grouped = $rateCards->groupBy('platform');
|
||||||
$platformOrder = ['general', 'instagram', 'tiktok', 'youtube'];
|
$platformOrder = ['general', 'instagram', 'tiktok', 'youtube'];
|
||||||
@endphp
|
@endphp
|
||||||
|
|
||||||
@foreach($platformOrder as $platform)
|
@foreach($platformOrder as $platform)
|
||||||
@if($grouped->has($platform))
|
@if($grouped->has($platform))
|
||||||
<div class="mb-6">
|
<div class="mb-6">
|
||||||
<h2 class="text-sm font-bold text-gray-700 mb-3 flex items-center gap-2">
|
<h2 class="text-sm font-bold text-gray-700 mb-3 flex items-center gap-2">
|
||||||
<span class="text-lg">{{ $grouped[$platform]->first()->platform_icon }}</span>
|
<span class="text-lg">{{ $grouped[$platform]->first()->platform_icon }}</span>
|
||||||
{{ ucfirst($platform) }}
|
{{ ucfirst($platform) }}
|
||||||
<span class="text-xs text-gray-400 font-normal">({{ $grouped[$platform]->count() }})</span>
|
<span class="text-xs text-gray-400 font-normal">({{ $grouped[$platform]->count() }})</span>
|
||||||
</h2>
|
</h2>
|
||||||
<div class="grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-3 gap-3">
|
<div class="grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-3 gap-3">
|
||||||
@foreach($grouped[$platform] as $card)
|
@foreach($grouped[$platform] as $card)
|
||||||
<div class="cat-card p-4 {{ !$card->is_active ? 'opacity-50' : '' }}">
|
<div class="cat-card p-4 {{ !$card->is_active ? 'opacity-50' : '' }}">
|
||||||
<div class="flex justify-between items-start gap-2 mb-2">
|
<div class="flex justify-between items-start gap-2 mb-2">
|
||||||
<div class="min-w-0">
|
<div class="min-w-0">
|
||||||
<h3 class="font-bold text-gray-800 text-sm leading-tight">{{ $card->service_name }}</h3>
|
<h3 class="font-bold text-gray-800 text-sm leading-tight">{{ $card->service_name }}</h3>
|
||||||
@if($card->content_type)
|
@if($card->content_type)
|
||||||
<span class="text-xs bg-pink-50 text-pink-600 px-2 py-0.5 rounded-full inline-block mt-1">{{ $card->content_type }}</span>
|
<span
|
||||||
@endif
|
class="text-xs bg-pink-50 text-pink-600 px-2 py-0.5 rounded-full inline-block mt-1">{{ $card->content_type }}</span>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
<span
|
||||||
|
class="text-xs px-2 py-1 rounded-full shrink-0
|
||||||
|
{{ $card->is_active ? 'bg-green-100 text-green-600' : 'bg-gray-100 text-gray-400' }}">
|
||||||
|
{{ $card->is_active ? 'Active' : 'Hidden' }}
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<span class="text-xs px-2 py-1 rounded-full shrink-0
|
|
||||||
{{ $card->is_active ? 'bg-green-100 text-green-600' : 'bg-gray-100 text-gray-400' }}">
|
|
||||||
{{ $card->is_active ? 'Active' : 'Hidden' }}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
@if($card->description)
|
@if($card->description)
|
||||||
<p class="text-xs text-gray-500 mb-2 line-clamp-2">{{ $card->description }}</p>
|
<p class="text-xs text-gray-500 mb-2 line-clamp-2">{{ $card->description }}</p>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
<div class="text-xl font-extrabold text-pink-500 mb-0.5">{{ $card->formatted_price }}</div>
|
<div class="text-xl font-extrabold text-pink-500 mb-0.5">{{ $card->formatted_price }}</div>
|
||||||
<div class="text-xs text-gray-400 mb-3">
|
<div class="text-xs text-gray-400 mb-3">
|
||||||
{{ str_replace('_', ' ', $card->price_unit) }}
|
{{ str_replace('_', ' ', $card->price_unit) }}
|
||||||
@if($card->is_negotiable) <span class="text-amber-500 ml-1">· Negotiable</span> @endif
|
@if($card->is_negotiable) <span class="text-amber-500 ml-1">· Negotiable</span> @endif
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex gap-2 pt-3 border-t border-pink-50">
|
<div class="flex gap-2 pt-3 border-t border-pink-50">
|
||||||
<a href="{{ route('rate-cards.edit', $card) }}"
|
<a href="{{ route('rate-cards.edit', $card) }}"
|
||||||
class="flex-1 text-center text-xs py-2 rounded-full border border-pink-200 text-gray-600 hover:bg-pink-50 font-medium">
|
class="flex-1 text-center text-xs py-2 rounded-full border border-pink-200 text-gray-600 hover:bg-pink-50 font-medium">
|
||||||
Edit
|
Edit
|
||||||
</a>
|
</a>
|
||||||
{{-- Share button disabled --}}
|
{{-- Share button disabled --}}
|
||||||
<form action="{{ route('rate-cards.destroy', $card) }}" method="POST"
|
<form action="{{ route('rate-cards.destroy', $card) }}" method="POST"
|
||||||
onsubmit="return confirm('Delete this entry?')">
|
onsubmit="return confirm('Delete this entry?')">
|
||||||
@csrf @method('DELETE')
|
@csrf @method('DELETE')
|
||||||
<button class="text-xs py-2 px-3 rounded-full border border-red-100 text-red-400 hover:bg-red-50">
|
<button class="text-xs py-2 px-3 rounded-full border border-red-100 text-red-400 hover:bg-red-50">
|
||||||
✕
|
✕
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
@endforeach
|
||||||
@endforeach
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@endif
|
||||||
|
@endforeach
|
||||||
|
|
||||||
|
@if($rateCards->isEmpty())
|
||||||
|
<div class="text-center py-20 text-gray-400">
|
||||||
|
<span class="text-5xl block mb-3">💰</span>
|
||||||
|
<p class="text-sm">No rate cards yet.</p>
|
||||||
|
<a href="{{ route('rate-cards.create') }}" class="btn-sakura mt-4 inline-block">Add your first service!</a>
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
@endforeach
|
{{-- Share scripts disabled --}}
|
||||||
|
|
||||||
@if($rateCards->isEmpty())
|
|
||||||
<div class="text-center py-20 text-gray-400">
|
|
||||||
<span class="text-5xl block mb-3">💰</span>
|
|
||||||
<p class="text-sm">No rate cards yet.</p>
|
|
||||||
<a href="{{ route('rate-cards.create') }}" class="btn-sakura mt-4 inline-block">Add your first service!</a>
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
{{-- Share scripts disabled --}}
|
|
||||||
@endsection
|
@endsection
|
||||||
@@ -4,169 +4,164 @@
|
|||||||
@section('page-subtitle', 'Customise your public rate card page')
|
@section('page-subtitle', 'Customise your public rate card page')
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<div class="max-w-3xl mx-auto space-y-5">
|
<div class="max-w-3xl mx-auto space-y-5">
|
||||||
|
|
||||||
@if(session('success'))
|
@if(session('success'))
|
||||||
<div x-data="{ show: true }" x-show="show" x-init="setTimeout(() => show = false, 4000)"
|
<div x-data="{ show: true }" x-show="show" x-init="setTimeout(() => show = false, 4000)"
|
||||||
class="flex items-center justify-between gap-3 bg-green-50 border border-green-200 rounded-2xl px-4 py-3 text-sm text-green-700">
|
class="flex items-center justify-between gap-3 bg-green-50 border border-green-200 rounded-2xl px-4 py-3 text-sm text-green-700">
|
||||||
<span>{{ session('success') }}</span>
|
<span>{{ session('success') }}</span>
|
||||||
<button @click="show = false" class="text-green-500 hover:text-green-700 text-lg leading-none">✕</button>
|
<button @click="show = false" class="text-green-500 hover:text-green-700 text-lg leading-none">✕</button>
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
|
|
||||||
<form action="{{ route('rate-cards.profile.update') }}" method="POST" enctype="multipart/form-data"
|
|
||||||
class="space-y-5">
|
|
||||||
@csrf
|
|
||||||
|
|
||||||
{{-- Identity --}}
|
|
||||||
<div class="cat-card overflow-hidden">
|
|
||||||
<div class="flex items-center gap-3 px-5 py-4 border-b border-pink-50">
|
|
||||||
<span class="text-xl">👤</span>
|
|
||||||
<h2 class="font-bold text-gray-700">Identity</h2>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="p-5 grid grid-cols-1 sm:grid-cols-2 gap-4">
|
@endif
|
||||||
<div>
|
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Display Name <span class="text-pink-400">*</span></label>
|
|
||||||
<input type="text" name="owner_name" required
|
|
||||||
value="{{ old('owner_name', $profile->owner_name) }}"
|
|
||||||
class="input-soft" placeholder="e.g. Sakura KOL">
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Tagline</label>
|
|
||||||
<input type="text" name="tagline"
|
|
||||||
value="{{ old('tagline', $profile->tagline) }}"
|
|
||||||
class="input-soft" placeholder="e.g. Lifestyle & Beauty Creator">
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Email</label>
|
|
||||||
<input type="email" name="email"
|
|
||||||
value="{{ old('email', $profile->email) }}"
|
|
||||||
class="input-soft" placeholder="hi@example.com">
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">WhatsApp Number</label>
|
|
||||||
<input type="text" name="whatsapp"
|
|
||||||
value="{{ old('whatsapp', $profile->whatsapp) }}"
|
|
||||||
class="input-soft" placeholder="+6012-345-6789">
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Instagram Handle</label>
|
|
||||||
<div class="relative">
|
|
||||||
<span class="absolute left-3 top-1/2 -translate-y-1/2 text-gray-400 text-sm pointer-events-none"></span>
|
|
||||||
<input type="text" name="ig_handle"
|
|
||||||
value="{{ old('ig_handle', $profile->ig_handle) }}"
|
|
||||||
class="input-soft pl-7" placeholder="@yourhandle">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">TikTok Handle</label>
|
|
||||||
<div class="relative">
|
|
||||||
<span class="absolute left-3 top-1/2 -translate-y-1/2 text-gray-400 text-sm pointer-events-none"></span>
|
|
||||||
<input type="text" name="tiktok_handle"
|
|
||||||
value="{{ old('tiktok_handle', $profile->tiktok_handle) }}"
|
|
||||||
class="input-soft pl-7" placeholder="@yourhandle">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="sm:col-span-2">
|
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">YouTube Handle / Channel</label>
|
|
||||||
<input type="text" name="youtube_handle"
|
|
||||||
value="{{ old('youtube_handle', $profile->youtube_handle) }}"
|
|
||||||
class="input-soft" placeholder="@yourchannel">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{-- Appearance --}}
|
<form action="{{ route('rate-cards.profile.update') }}" method="POST" enctype="multipart/form-data"
|
||||||
<div class="cat-card overflow-hidden">
|
class="space-y-5">
|
||||||
<div class="flex items-center gap-3 px-5 py-4 border-b border-pink-50">
|
@csrf
|
||||||
<span class="text-xl">🎨</span>
|
|
||||||
<h2 class="font-bold text-gray-700">Appearance</h2>
|
|
||||||
</div>
|
|
||||||
<div class="p-5 grid grid-cols-1 sm:grid-cols-2 gap-4">
|
|
||||||
<div class="sm:col-span-2">
|
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Logo / Profile Image</label>
|
|
||||||
@if($profile->logo_path)
|
|
||||||
<div class="flex items-center gap-3 mb-2">
|
|
||||||
<img src="{{ route('files.serve-profile-logo') }}" alt="Logo"
|
|
||||||
class="w-16 h-16 object-cover rounded-2xl border border-pink-100">
|
|
||||||
<span class="text-xs text-gray-400">Current logo</span>
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
<input type="file" name="logo" accept="image/*"
|
|
||||||
class="w-full text-sm text-gray-600
|
|
||||||
file:mr-3 file:py-2 file:px-4 file:rounded-full file:border-0
|
|
||||||
file:text-xs file:font-semibold file:bg-pink-50 file:text-pink-600
|
|
||||||
hover:file:bg-pink-100 cursor-pointer">
|
|
||||||
<p class="text-xs text-gray-400 mt-1">Max 2MB. PNG/JPG/WebP.</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
{{-- Identity --}}
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Background Color</label>
|
<div class="cat-card overflow-hidden">
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex items-center gap-3 px-5 py-4 border-b border-pink-50">
|
||||||
<input type="color" name="bg_color" value="{{ old('bg_color', $profile->bg_color) }}"
|
<span class="text-xl">👤</span>
|
||||||
class="h-10 w-16 rounded-2xl border border-pink-200 cursor-pointer p-1 bg-white shrink-0"
|
<h2 class="font-bold text-gray-700">Identity</h2>
|
||||||
oninput="document.getElementById('bg_text').value=this.value">
|
</div>
|
||||||
<input type="text" id="bg_text" value="{{ old('bg_color', $profile->bg_color) }}"
|
<div class="p-5 grid grid-cols-1 sm:grid-cols-2 gap-4">
|
||||||
class="input-soft text-sm flex-1" readonly>
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Display Name <span
|
||||||
|
class="text-pink-400">*</span></label>
|
||||||
|
<input type="text" name="owner_name" required value="{{ old('owner_name', $profile->owner_name) }}"
|
||||||
|
class="input-soft" placeholder="e.g. Sakura KOL">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div>
|
||||||
<div>
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Tagline</label>
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Accent Color</label>
|
<input type="text" name="tagline" value="{{ old('tagline', $profile->tagline) }}" class="input-soft"
|
||||||
<div class="flex items-center gap-2">
|
placeholder="e.g. Lifestyle & Beauty Creator">
|
||||||
<input type="color" name="accent_color" value="{{ old('accent_color', $profile->accent_color) }}"
|
|
||||||
class="h-10 w-16 rounded-2xl border border-pink-200 cursor-pointer p-1 bg-white shrink-0"
|
|
||||||
oninput="document.getElementById('accent_text').value=this.value">
|
|
||||||
<input type="text" id="accent_text" value="{{ old('accent_color', $profile->accent_color) }}"
|
|
||||||
class="input-soft text-sm flex-1" readonly>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div>
|
||||||
<div>
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Email</label>
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Text Color</label>
|
<input type="email" name="email" value="{{ old('email', $profile->email) }}" class="input-soft"
|
||||||
<div class="flex items-center gap-2">
|
placeholder="hi@example.com">
|
||||||
<input type="color" name="text_color" value="{{ old('text_color', $profile->text_color) }}"
|
|
||||||
class="h-10 w-16 rounded-2xl border border-pink-200 cursor-pointer p-1 bg-white shrink-0"
|
|
||||||
oninput="document.getElementById('text_text').value=this.value">
|
|
||||||
<input type="text" id="text_text" value="{{ old('text_color', $profile->text_color) }}"
|
|
||||||
class="input-soft text-sm flex-1" readonly>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div>
|
||||||
<div>
|
<label class="block text-xs font-semibold text-gray-600 mb-1">WhatsApp Number</label>
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Custom Footer</label>
|
<input type="text" name="whatsapp" value="{{ old('whatsapp', $profile->whatsapp) }}"
|
||||||
<input type="text" name="custom_footer"
|
class="input-soft" placeholder="+6012-345-6789">
|
||||||
value="{{ old('custom_footer', $profile->custom_footer) }}"
|
</div>
|
||||||
class="input-soft"
|
<div>
|
||||||
placeholder="e.g. Prices valid until Dec 2025 · DM for bundles">
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Instagram Handle</label>
|
||||||
</div>
|
<div class="relative">
|
||||||
<div class="sm:col-span-2">
|
<span
|
||||||
<label class="flex items-start gap-3 cursor-pointer">
|
class="absolute left-3 top-1/2 -translate-y-1/2 text-gray-400 text-sm pointer-events-none"></span>
|
||||||
<input type="checkbox" name="show_prices" value="1"
|
<input type="text" name="ig_handle" value="{{ old('ig_handle', $profile->ig_handle) }}"
|
||||||
class="w-4 h-4 accent-pink-400 mt-0.5 shrink-0"
|
class="input-soft pl-7" placeholder="@yourhandle">
|
||||||
{{ old('show_prices', $profile->show_prices) ? 'checked' : '' }}>
|
|
||||||
<div>
|
|
||||||
<span class="text-sm font-medium text-gray-700">Show prices publicly</span>
|
|
||||||
<p class="text-xs text-gray-400">Uncheck to show "On Request" instead of actual prices</p>
|
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">TikTok Handle</label>
|
||||||
|
<div class="relative">
|
||||||
|
<span
|
||||||
|
class="absolute left-3 top-1/2 -translate-y-1/2 text-gray-400 text-sm pointer-events-none"></span>
|
||||||
|
<input type="text" name="tiktok_handle"
|
||||||
|
value="{{ old('tiktok_handle', $profile->tiktok_handle) }}" class="input-soft pl-7"
|
||||||
|
placeholder="@yourhandle">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="sm:col-span-2">
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">YouTube Handle / Channel</label>
|
||||||
|
<input type="text" name="youtube_handle"
|
||||||
|
value="{{ old('youtube_handle', $profile->youtube_handle) }}" class="input-soft"
|
||||||
|
placeholder="@yourchannel">
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
{{-- Actions --}}
|
{{-- Appearance --}}
|
||||||
<div class="flex flex-wrap items-center gap-3">
|
<div class="cat-card overflow-hidden">
|
||||||
<button type="submit" class="btn-sakura px-6 py-2.5">💾 Save Profile</button>
|
<div class="flex items-center gap-3 px-5 py-4 border-b border-pink-50">
|
||||||
<a href="{{ route('rate-cards.public') }}" target="_blank"
|
<span class="text-xl">🎨</span>
|
||||||
class="text-xs px-4 py-2.5 rounded-full border border-pink-200 text-pink-500 hover:bg-pink-50">
|
<h2 class="font-bold text-gray-700">Appearance</h2>
|
||||||
👁️ Preview Public Page
|
</div>
|
||||||
</a>
|
<div class="p-5 grid grid-cols-1 sm:grid-cols-2 gap-4">
|
||||||
<a href="{{ route('rate-cards.pdf') }}"
|
<div class="sm:col-span-2">
|
||||||
class="text-xs px-4 py-2.5 rounded-full border border-blue-200 text-blue-500 hover:bg-blue-50">
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Logo / Profile Image</label>
|
||||||
📄 Download PDF
|
@if($profile->logo_path)
|
||||||
</a>
|
<div class="flex items-center gap-3 mb-2">
|
||||||
<a href="{{ route('rate-cards.index') }}"
|
<img src="{{ route('files.serve-profile-logo') }}" alt="Logo"
|
||||||
class="text-xs px-4 py-2.5 rounded-full border border-gray-200 text-gray-500 hover:bg-gray-50">
|
class="w-16 h-16 object-cover rounded-2xl border border-pink-100">
|
||||||
← Back to Rate Cards
|
<span class="text-xs text-gray-400">Current logo</span>
|
||||||
</a>
|
</div>
|
||||||
</div>
|
@endif
|
||||||
</form>
|
<input type="file" name="logo" accept="image/*" class="w-full text-sm text-gray-600
|
||||||
</div>
|
file:mr-3 file:py-2 file:px-4 file:rounded-full file:border-0
|
||||||
|
file:text-xs file:font-semibold file:bg-pink-50 file:text-pink-600
|
||||||
|
hover:file:bg-pink-100 cursor-pointer">
|
||||||
|
<p class="text-xs text-gray-400 mt-1">Max 2MB. PNG/JPG/WebP.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Background Color</label>
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<input type="color" name="bg_color" value="{{ old('bg_color', $profile->bg_color) }}"
|
||||||
|
class="h-10 w-16 rounded-2xl border border-pink-200 cursor-pointer p-1 bg-white shrink-0"
|
||||||
|
oninput="document.getElementById('bg_text').value=this.value">
|
||||||
|
<input type="text" id="bg_text" value="{{ old('bg_color', $profile->bg_color) }}"
|
||||||
|
class="input-soft text-sm flex-1" readonly>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Accent Color</label>
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<input type="color" name="accent_color"
|
||||||
|
value="{{ old('accent_color', $profile->accent_color) }}"
|
||||||
|
class="h-10 w-16 rounded-2xl border border-pink-200 cursor-pointer p-1 bg-white shrink-0"
|
||||||
|
oninput="document.getElementById('accent_text').value=this.value">
|
||||||
|
<input type="text" id="accent_text" value="{{ old('accent_color', $profile->accent_color) }}"
|
||||||
|
class="input-soft text-sm flex-1" readonly>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Text Color</label>
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<input type="color" name="text_color" value="{{ old('text_color', $profile->text_color) }}"
|
||||||
|
class="h-10 w-16 rounded-2xl border border-pink-200 cursor-pointer p-1 bg-white shrink-0"
|
||||||
|
oninput="document.getElementById('text_text').value=this.value">
|
||||||
|
<input type="text" id="text_text" value="{{ old('text_color', $profile->text_color) }}"
|
||||||
|
class="input-soft text-sm flex-1" readonly>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Custom Footer</label>
|
||||||
|
<input type="text" name="custom_footer" value="{{ old('custom_footer', $profile->custom_footer) }}"
|
||||||
|
class="input-soft" placeholder="e.g. Prices valid until Dec 2025 · DM for bundles">
|
||||||
|
</div>
|
||||||
|
<div class="sm:col-span-2">
|
||||||
|
<label class="flex items-start gap-3 cursor-pointer">
|
||||||
|
<input type="checkbox" name="show_prices" value="1"
|
||||||
|
class="w-4 h-4 accent-pink-400 mt-0.5 shrink-0" {{ old('show_prices', $profile->show_prices) ? 'checked' : '' }}>
|
||||||
|
<div>
|
||||||
|
<span class="text-sm font-medium text-gray-700">Show prices publicly</span>
|
||||||
|
<p class="text-xs text-gray-400">Uncheck to show "On Request" instead of actual prices</p>
|
||||||
|
</div>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Actions --}}
|
||||||
|
<div class="flex flex-wrap items-center gap-3">
|
||||||
|
<button type="submit" class="btn-sakura px-6 py-2.5">💾 Save Profile</button>
|
||||||
|
<a href="{{ route('rate-cards.public') }}" target="_blank"
|
||||||
|
class="btn-sakura text-sm px-4 py-2.5 rounded-full border border-pink-200 text-pink-500 hover:bg-pink-50">
|
||||||
|
👁️ Preview
|
||||||
|
</a>
|
||||||
|
<a href="{{ route('rate-cards.pdf') }}"
|
||||||
|
class="btn-sakura text-sm px-4 py-2.5 rounded-full border border-blue-200 text-blue-500 hover:bg-blue-50">
|
||||||
|
📄 Download PDF
|
||||||
|
</a>
|
||||||
|
<a href="{{ route('rate-cards.index') }}"
|
||||||
|
class="btn-sakura text-sm px-4 py-2.5 rounded-full border border-gray-200 text-gray-500 hover:bg-gray-50">
|
||||||
|
← Back
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
@endsection
|
@endsection
|
||||||
@@ -136,8 +136,8 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
${p.location ? `<div class="flex gap-2"><span class="text-gray-400 w-24 shrink-0">Location</span><span>${p.location}</span></div>` : ''}
|
${p.location ? `<div class="flex gap-2"><span class="text-gray-400 w-24 shrink-0">Location</span><span>${p.location}</span></div>` : ''}
|
||||||
<div class="flex gap-2"><span class="text-gray-400 w-24 shrink-0">Start</span><span>${e.start?.toLocaleString()}</span></div>
|
<div class="flex gap-2"><span class="text-gray-400 w-24 shrink-0">Start</span><span>${e.start?.toLocaleString()}</span></div>
|
||||||
${e.end ? `<div class="flex gap-2"><span class="text-gray-400 w-24 shrink-0">End</span><span>${e.end.toLocaleString()}</span></div>` : ''}
|
${e.end ? `<div class="flex gap-2"><span class="text-gray-400 w-24 shrink-0">End</span><span>${e.end.toLocaleString()}</span></div>` : ''}
|
||||||
${p.description ? `<div class="flex gap-2"><span class="text-gray-400 w-24 shrink-0">Description</span><span class="break-words">${p.description}</span></div>` : ''}
|
${p.description ? `<div class="flex gap-2"><span class="text-gray-400 w-24 shrink-0">Description</span><div class="flex-1 break-words whitespace-pre-wrap overflow-y-auto max-h-20 pr-1">${p.description}</div></div>` : ''}
|
||||||
${p.notes ? `<div class="flex gap-2"><span class="text-gray-400 w-24 shrink-0">Notes</span><span class="break-words">${p.notes}</span></div>` : ''}
|
${p.notes ? `<div class="flex gap-2"><span class="text-gray-400 w-24 shrink-0">Notes</span><div class="flex-1 break-words whitespace-pre-wrap overflow-y-auto max-h-20 pr-1">${p.notes}</div></div>` : ''}
|
||||||
${p.has_contract ? `<div class="flex gap-2"><span class="text-gray-400 w-24 shrink-0">Contract</span><span class="text-pink-500 font-semibold">Yes</span></div>` : ''}
|
${p.has_contract ? `<div class="flex gap-2"><span class="text-gray-400 w-24 shrink-0">Contract</span><span class="text-pink-500 font-semibold">Yes</span></div>` : ''}
|
||||||
${p.has_content ? `<div class="flex gap-2"><span class="text-gray-400 w-24 shrink-0">Content Bd</span><span class="text-pink-500 font-semibold">Yes</span></div>` : ''}
|
${p.has_content ? `<div class="flex gap-2"><span class="text-gray-400 w-24 shrink-0">Content Bd</span><span class="text-pink-500 font-semibold">Yes</span></div>` : ''}
|
||||||
`;
|
`;
|
||||||
@@ -176,8 +176,8 @@ function openAlertEventModal(e) {
|
|||||||
${e.location ? `<div class="flex gap-2"><span class="text-gray-400 w-24 shrink-0">Location</span><span>${e.location}</span></div>` : ''}
|
${e.location ? `<div class="flex gap-2"><span class="text-gray-400 w-24 shrink-0">Location</span><span>${e.location}</span></div>` : ''}
|
||||||
<div class="flex gap-2"><span class="text-gray-400 w-24 shrink-0">Start</span><span>${startStr}</span></div>
|
<div class="flex gap-2"><span class="text-gray-400 w-24 shrink-0">Start</span><span>${startStr}</span></div>
|
||||||
${endStr ? `<div class="flex gap-2"><span class="text-gray-400 w-24 shrink-0">End</span><span>${endStr}</span></div>` : ''}
|
${endStr ? `<div class="flex gap-2"><span class="text-gray-400 w-24 shrink-0">End</span><span>${endStr}</span></div>` : ''}
|
||||||
${e.description ? `<div class="flex gap-2"><span class="text-gray-400 w-24 shrink-0">Description</span><span class="break-words">${e.description}</span></div>` : ''}
|
${e.description ? `<div class="flex gap-2"><span class="text-gray-400 w-24 shrink-0">Description</span><div class="flex-1 break-words whitespace-pre-wrap overflow-y-auto max-h-20 pr-1">${e.description}</div></div>` : ''}
|
||||||
${e.notes ? `<div class="flex gap-2"><span class="text-gray-400 w-24 shrink-0">Notes</span><span class="break-words">${e.notes}</span></div>` : ''}
|
${e.notes ? `<div class="flex gap-2"><span class="text-gray-400 w-24 shrink-0">Notes</span><div class="flex-1 break-words whitespace-pre-wrap overflow-y-auto max-h-20 pr-1">${e.notes}</div></div>` : ''}
|
||||||
${e.has_contract ? `<div class="flex gap-2"><span class="text-gray-400 w-24 shrink-0">Contract</span><span class="text-pink-500 font-semibold">Yes</span></div>` : ''}
|
${e.has_contract ? `<div class="flex gap-2"><span class="text-gray-400 w-24 shrink-0">Contract</span><span class="text-pink-500 font-semibold">Yes</span></div>` : ''}
|
||||||
${e.has_content ? `<div class="flex gap-2"><span class="text-gray-400 w-24 shrink-0">Content Bd</span><span class="text-pink-500 font-semibold">Yes</span></div>` : ''}
|
${e.has_content ? `<div class="flex gap-2"><span class="text-gray-400 w-24 shrink-0">Content Bd</span><span class="text-pink-500 font-semibold">Yes</span></div>` : ''}
|
||||||
`;
|
`;
|
||||||
|
|||||||
Reference in New Issue
Block a user