Add contract management and invoice settings pages
- Created a new Blade view for managing brand contracts with forms for adding and editing contracts, including client and category selection. - Implemented success message notifications for contract actions. - Added a new Blade view for invoice settings, allowing customization of invoice number format, header branding, and default values for new invoices. - Introduced a new PDF view for generating rate cards with customizable styles based on user profile settings. - Developed a profile management page for rate cards, enabling users to update their identity, appearance, and visibility settings.
This commit is contained in:
@@ -115,6 +115,40 @@ aside {
|
||||
}
|
||||
.paw-bounce { animation: paw-bounce 0.4s ease-in-out; }
|
||||
|
||||
/* ── Label Soft ───────────────────────────────────────────── */
|
||||
.label-soft {
|
||||
@apply block text-xs font-semibold text-gray-600 mb-1;
|
||||
}
|
||||
|
||||
/* ── Select Soft ──────────────────────────────────────────── */
|
||||
.select-soft {
|
||||
@apply rounded-2xl border border-pink-200 px-4 py-2
|
||||
focus:border-pink-400 focus:outline-none focus:ring-2 focus:ring-pink-200
|
||||
w-full bg-white text-sm;
|
||||
}
|
||||
|
||||
/* ── Btn Pink (alias for btn-sakura) ─────────────────────── */
|
||||
.btn-pink {
|
||||
@apply rounded-full text-white font-semibold shadow-sm
|
||||
transition-all duration-150 inline-block cursor-pointer text-center;
|
||||
background-color: #FFB7C5;
|
||||
border: none;
|
||||
text-decoration: none;
|
||||
}
|
||||
.btn-pink:hover { background-color: #FF8FAD; }
|
||||
.btn-pink:active { transform: scale(0.96); }
|
||||
|
||||
/* ── Badge Soft ───────────────────────────────────────────── */
|
||||
.badge-soft { @apply badge badge-ghost; }
|
||||
|
||||
/* ── Cat Card Header ──────────────────────────────────────── */
|
||||
.cat-card-header {
|
||||
@apply flex items-center gap-3 px-4 py-3 border-b border-pink-50;
|
||||
}
|
||||
.cat-card-icon {
|
||||
@apply text-xl shrink-0;
|
||||
}
|
||||
|
||||
/* ── Mobile touch targets ─────────────────────────────────── */
|
||||
@media (max-width: 1023px) {
|
||||
.nav-item { @apply py-3.5; }
|
||||
|
||||
213
resources/views/categories/index.blade.php
Normal file
213
resources/views/categories/index.blade.php
Normal file
@@ -0,0 +1,213 @@
|
||||
@extends('layouts.app')
|
||||
@section('title', 'Categories')
|
||||
@section('page-title', '🏷️ Category Management')
|
||||
@section('page-subtitle', 'Organise clients, schedules & content by category')
|
||||
|
||||
@section('content')
|
||||
<div class="max-w-4xl mx-auto space-y-5">
|
||||
|
||||
@if(session('success'))
|
||||
<div x-data="{ show: true }" x-show="show" x-init="setTimeout(() => show = false, 4000)"
|
||||
class="flex items-center justify-between gap-3 bg-green-50 border border-green-200 rounded-2xl px-4 py-3 text-sm text-green-700">
|
||||
<span>{{ session('success') }}</span>
|
||||
<button @click="show = false" class="text-green-500 hover:text-green-700 text-lg leading-none">✕</button>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
{{-- Add form --}}
|
||||
<div class="cat-card overflow-hidden">
|
||||
<div class="flex items-center gap-3 px-5 py-4 border-b border-pink-50">
|
||||
<span class="text-xl">➕</span>
|
||||
<h2 class="font-bold text-gray-700">Add New Category</h2>
|
||||
</div>
|
||||
<form action="{{ route('client-categories.store') }}" method="POST"
|
||||
class="p-5 grid grid-cols-2 sm:grid-cols-4 gap-3 items-end">
|
||||
@csrf
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Name <span class="text-pink-400">*</span></label>
|
||||
<input type="text" name="name" required maxlength="100"
|
||||
placeholder="e.g. Energy Drinks"
|
||||
class="input-soft" value="{{ old('name') }}">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Parent (optional)</label>
|
||||
<select name="parent_id" class="input-soft">
|
||||
<option value="">— Root category —</option>
|
||||
@foreach($parents as $p)
|
||||
<option value="{{ $p->id }}" {{ old('parent_id') == $p->id ? 'selected' : '' }}>
|
||||
{{ $p->icon }} {{ $p->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Icon (emoji)</label>
|
||||
<input type="text" name="icon" maxlength="10" placeholder="🏷️"
|
||||
class="input-soft" value="{{ old('icon') }}">
|
||||
</div>
|
||||
<div class="flex items-end gap-2">
|
||||
<div class="flex-1">
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Color</label>
|
||||
<input type="color" name="color" value="{{ old('color', '#FFB7C5') }}"
|
||||
class="w-full h-[42px] rounded-2xl border border-pink-200 cursor-pointer p-1 bg-white">
|
||||
</div>
|
||||
<button type="submit" class="btn-sakura px-4 py-2.5 shrink-0 text-sm">Add</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
{{-- List --}}
|
||||
<div class="cat-card overflow-hidden">
|
||||
<div class="flex items-center gap-3 px-5 py-4 border-b border-pink-50">
|
||||
<span class="text-xl">🗂️</span>
|
||||
<h2 class="font-bold text-gray-700">All Categories</h2>
|
||||
<span class="ml-auto text-xs bg-pink-100 text-pink-600 font-semibold px-2.5 py-0.5 rounded-full">
|
||||
{{ $categories->count() }} total
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@php $roots = $categories->whereNull('parent_id'); @endphp
|
||||
|
||||
@forelse($roots as $root)
|
||||
<div x-data="{ editing: false }" class="border-b border-pink-50 last:border-0">
|
||||
{{-- Root row --}}
|
||||
<div class="flex items-center gap-3 px-5 py-3 hover:bg-pink-50/40 transition-colors">
|
||||
<span class="text-xl w-7 text-center shrink-0">{{ $root->icon ?: '🏷️' }}</span>
|
||||
@if($root->color)
|
||||
<span class="w-3 h-3 rounded-full shrink-0" style="background:{{ $root->color }}"></span>
|
||||
@endif
|
||||
<div class="flex-1 min-w-0">
|
||||
<div class="font-semibold text-gray-700 text-sm">{{ $root->name }}</div>
|
||||
<div class="text-xs text-gray-400">{{ $root->children->count() }} sub · {{ $root->clients_count }} client(s)</div>
|
||||
</div>
|
||||
<div class="flex gap-2 shrink-0">
|
||||
<button @click="editing = !editing"
|
||||
class="text-xs px-3 py-1.5 rounded-full border border-blue-200 text-blue-500 hover:bg-blue-50">
|
||||
✏️ Edit
|
||||
</button>
|
||||
@unless($root->is_system)
|
||||
<form action="{{ route('client-categories.destroy', $root) }}" method="POST"
|
||||
onsubmit="return confirm('Remove this category? Its children will be promoted.')">
|
||||
@csrf @method('DELETE')
|
||||
<button class="text-xs px-3 py-1.5 rounded-full border border-red-100 text-red-400 hover:bg-red-50">
|
||||
🗑️
|
||||
</button>
|
||||
</form>
|
||||
@endunless
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- Edit form --}}
|
||||
<div x-show="editing" x-transition style="display:none"
|
||||
class="px-5 py-4 bg-pink-50/30 border-t border-pink-50">
|
||||
<form action="{{ route('client-categories.update', $root) }}" method="POST"
|
||||
class="grid grid-cols-2 sm:grid-cols-4 gap-3 items-end">
|
||||
@csrf @method('PUT')
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Name</label>
|
||||
<input type="text" name="name" required value="{{ $root->name }}" class="input-soft">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Parent</label>
|
||||
<select name="parent_id" class="input-soft">
|
||||
<option value="">— Root —</option>
|
||||
@foreach($parents as $p)
|
||||
@if($p->id !== $root->id)
|
||||
<option value="{{ $p->id }}" {{ $root->parent_id == $p->id ? 'selected' : '' }}>
|
||||
{{ $p->icon }} {{ $p->name }}
|
||||
</option>
|
||||
@endif
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Icon</label>
|
||||
<input type="text" name="icon" value="{{ $root->icon }}" maxlength="10" class="input-soft">
|
||||
</div>
|
||||
<div class="flex items-end gap-2">
|
||||
<div class="flex-1">
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Color</label>
|
||||
<input type="color" name="color" value="{{ $root->color ?: '#FFB7C5' }}"
|
||||
class="w-full h-[42px] rounded-2xl border border-pink-200 cursor-pointer p-1 bg-white">
|
||||
</div>
|
||||
<button type="submit" class="btn-sakura px-3 py-2.5 text-sm shrink-0">Save</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
{{-- Children --}}
|
||||
@foreach($root->children as $child)
|
||||
<div x-data="{ editingC: false }">
|
||||
<div class="flex items-center gap-3 px-5 py-2.5 pl-12 border-t border-pink-50/60 hover:bg-pink-50/20 transition-colors">
|
||||
<span class="text-base w-6 text-center shrink-0">{{ $child->icon ?: '↳' }}</span>
|
||||
@if($child->color)
|
||||
<span class="w-2.5 h-2.5 rounded-full shrink-0" style="background:{{ $child->color }}"></span>
|
||||
@endif
|
||||
<div class="flex-1 min-w-0">
|
||||
<div class="text-sm font-medium text-gray-600">↳ {{ $child->name }}</div>
|
||||
<div class="text-xs text-gray-400">{{ $child->clients_count }} client(s)</div>
|
||||
</div>
|
||||
<div class="flex gap-2 shrink-0">
|
||||
<button @click="editingC = !editingC"
|
||||
class="text-xs px-2.5 py-1 rounded-full border border-blue-200 text-blue-500 hover:bg-blue-50">
|
||||
✏️
|
||||
</button>
|
||||
@unless($child->is_system)
|
||||
<form action="{{ route('client-categories.destroy', $child) }}" method="POST"
|
||||
onsubmit="return confirm('Remove subcategory?')">
|
||||
@csrf @method('DELETE')
|
||||
<button class="text-xs px-2.5 py-1 rounded-full border border-red-100 text-red-400 hover:bg-red-50">
|
||||
🗑️
|
||||
</button>
|
||||
</form>
|
||||
@endunless
|
||||
</div>
|
||||
</div>
|
||||
<div x-show="editingC" x-transition style="display:none"
|
||||
class="px-5 py-4 pl-12 bg-pink-50/20 border-t border-pink-50/60">
|
||||
<form action="{{ route('client-categories.update', $child) }}" method="POST"
|
||||
class="grid grid-cols-2 sm:grid-cols-4 gap-3 items-end">
|
||||
@csrf @method('PUT')
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Name</label>
|
||||
<input type="text" name="name" required value="{{ $child->name }}" class="input-soft">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Parent</label>
|
||||
<select name="parent_id" class="input-soft">
|
||||
<option value="">— Root —</option>
|
||||
@foreach($parents as $p)
|
||||
@if($p->id !== $child->id)
|
||||
<option value="{{ $p->id }}" {{ $child->parent_id == $p->id ? 'selected' : '' }}>
|
||||
{{ $p->icon }} {{ $p->name }}
|
||||
</option>
|
||||
@endif
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Icon</label>
|
||||
<input type="text" name="icon" value="{{ $child->icon }}" maxlength="10" class="input-soft">
|
||||
</div>
|
||||
<div class="flex items-end gap-2">
|
||||
<div class="flex-1">
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Color</label>
|
||||
<input type="color" name="color" value="{{ $child->color ?: '#FFB7C5' }}"
|
||||
class="w-full h-[42px] rounded-2xl border border-pink-200 cursor-pointer p-1 bg-white">
|
||||
</div>
|
||||
<button type="submit" class="btn-sakura px-3 py-2.5 text-sm shrink-0">Save</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@empty
|
||||
<div class="text-center py-14 text-gray-400">
|
||||
<div class="text-4xl mb-2">🏷️</div>
|
||||
<p class="text-sm">No categories yet. Add your first one above.</p>
|
||||
</div>
|
||||
@endforelse
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@@ -6,70 +6,77 @@
|
||||
|
||||
@section('content')
|
||||
|
||||
{{-- ── Filters bar ─────────────────────────────────────────── --}}
|
||||
<div class="flex flex-col gap-3 mb-5">
|
||||
<div class="flex flex-col sm:flex-row sm:items-center gap-3">
|
||||
{{-- Local text filter --}}
|
||||
<div class="relative flex-1 max-w-xs">
|
||||
<span class="absolute left-3 top-2.5 text-gray-400 text-sm">🔍</span>
|
||||
<input type="text" placeholder="Filter by name…" class="input-soft pl-9 text-sm"
|
||||
{{-- ── Toolbar + collapsible filter ───────────────────────── --}}
|
||||
<div x-data="{ open: {{ request('category') || request('status') ? 'true' : 'false' }} }">
|
||||
|
||||
<div class="flex items-center justify-between gap-2 mb-3">
|
||||
<div class="flex items-center gap-2">
|
||||
<a href="{{ route('clients.create') }}" class="btn-sakura text-sm">+ Add</a>
|
||||
@if(request('category') || request('status'))
|
||||
<a href="{{ route('clients.index') }}"
|
||||
class="text-xs px-3 py-2 rounded-full border border-gray-200 text-gray-500 hover:bg-gray-50 flex items-center gap-1">
|
||||
✕ Clear filters
|
||||
</a>
|
||||
@endif
|
||||
</div>
|
||||
<button @click="open = !open"
|
||||
class="flex items-center gap-1.5 text-xs px-3 py-2 rounded-full border transition-colors"
|
||||
:class="open ? 'border-pink-300 bg-pink-50 text-pink-600' : 'border-gray-200 text-gray-500 hover:bg-gray-50'">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="w-3.5 h-3.5" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M3 4h18M7 10h10M11 16h2"/>
|
||||
</svg>
|
||||
Filter
|
||||
@if(request('category') || request('status'))
|
||||
<span class="w-2 h-2 rounded-full bg-pink-400 inline-block ml-0.5"></span>
|
||||
@endif
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{{-- ── Filters panel (collapsible) ────────────────────────── --}}
|
||||
<div x-show="open" x-transition.duration.150ms>
|
||||
<form method="GET" action="{{ route('clients.index') }}" id="filter-form" class="cat-card p-3 mb-4">
|
||||
{{-- Row 1: search + dropdowns --}}
|
||||
<div class="flex flex-col sm:flex-row sm:items-center gap-2">
|
||||
{{-- Search (fills remaining space on desktop) --}}
|
||||
<div class="relative flex-1 min-w-0">
|
||||
<span class="absolute left-3 top-1/2 -translate-y-1/2 text-gray-400 text-sm pointer-events-none">🔍</span>
|
||||
<input type="text" placeholder="Filter by name…" class="input-soft pl-9 text-sm py-2 w-full"
|
||||
oninput="filterClients(this.value)" id="search-input">
|
||||
</div>
|
||||
|
||||
{{-- Category filter --}}
|
||||
<form method="GET" action="{{ route('clients.index') }}" class="flex flex-wrap gap-2 items-center" id="filter-form">
|
||||
<select name="category" class="input-soft text-sm py-2"
|
||||
onchange="document.getElementById('filter-form').submit()">
|
||||
<option value="">All Categories</option>
|
||||
@foreach($categories as $parent)
|
||||
<option value="{{ $parent->id }}"
|
||||
{{ request('category') == $parent->id ? 'selected' : '' }}>
|
||||
{{ $parent->icon }} {{ $parent->name }}
|
||||
</option>
|
||||
@foreach($parent->children as $child)
|
||||
<option value="{{ $child->id }}"
|
||||
{{ request('category') == $child->id ? 'selected' : '' }}>
|
||||
↳ {{ $child->icon }} {{ $child->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
@endforeach
|
||||
</select>
|
||||
|
||||
<select name="status" class="input-soft text-sm py-2"
|
||||
onchange="document.getElementById('filter-form').submit()">
|
||||
<option value="">All Statuses</option>
|
||||
@foreach($statuses as $s)
|
||||
<option value="{{ $s->value }}" {{ request('status') === $s->value ? 'selected' : '' }}>
|
||||
{{ $s->label() }}
|
||||
{{-- Category dropdown --}}
|
||||
<select name="category" class="input-soft text-sm py-2 sm:w-48 shrink-0"
|
||||
onchange="this.form.submit()">
|
||||
<option value="">All Categories</option>
|
||||
@foreach($categories as $parent)
|
||||
<option value="{{ $parent->id }}"
|
||||
{{ request('category') == $parent->id ? 'selected' : '' }}>
|
||||
{{ $parent->icon }} {{ $parent->name }}
|
||||
</option>
|
||||
@foreach($parent->children as $child)
|
||||
<option value="{{ $child->id }}"
|
||||
{{ request('category') == $child->id ? 'selected' : '' }}>
|
||||
↳ {{ $child->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@endforeach
|
||||
</select>
|
||||
|
||||
@if(request('category') || request('status'))
|
||||
<a href="{{ route('clients.index') }}" class="text-xs text-gray-400 hover:text-gray-600">✕ Clear</a>
|
||||
@endif
|
||||
</form>
|
||||
|
||||
<a href="{{ route('clients.create') }}" class="btn-sakura text-sm text-center shrink-0">+ Add Client</a>
|
||||
{{-- Status dropdown --}}
|
||||
<select name="status" class="input-soft text-sm py-2 sm:w-36 shrink-0"
|
||||
onchange="this.form.submit()">
|
||||
<option value="">All Statuses</option>
|
||||
@foreach($statuses as $s)
|
||||
<option value="{{ $s->value }}" {{ request('status') === $s->value ? 'selected' : '' }}>
|
||||
{{ $s->label() }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
{{-- Category pills (top-level only) --}}
|
||||
<div class="flex gap-2 overflow-x-auto pb-1 -mx-4 px-4 lg:mx-0 lg:px-0">
|
||||
<a href="{{ route('clients.index') }}"
|
||||
class="shrink-0 text-xs px-3 py-1.5 rounded-full font-semibold transition-colors
|
||||
{{ ! request('category') ? 'bg-pink-400 text-white' : 'bg-white border border-pink-200 text-gray-600 hover:bg-pink-50' }}">
|
||||
All
|
||||
</a>
|
||||
@foreach($categories as $cat)
|
||||
<a href="{{ route('clients.index', ['category' => $cat->id, 'status' => request('status')]) }}"
|
||||
class="shrink-0 text-xs px-3 py-1.5 rounded-full font-semibold transition-colors whitespace-nowrap
|
||||
{{ request('category') == $cat->id ? 'bg-pink-400 text-white' : 'bg-white border border-pink-200 text-gray-600 hover:bg-pink-50' }}"
|
||||
style="{{ request('category') == $cat->id ? '' : 'border-color:' . $cat->color }}">
|
||||
{{ $cat->icon }} {{ $cat->name }}
|
||||
</a>
|
||||
@endforeach
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>{{-- end x-data --}}
|
||||
|
||||
{{-- ── Client grid ─────────────────────────────────────────── --}}
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-3 gap-4" id="clients-grid">
|
||||
@@ -135,11 +142,12 @@
|
||||
class="flex-1 text-center text-xs py-1.5 px-3 rounded-full border border-pink-200 text-gray-600 hover:bg-pink-50">
|
||||
Edit
|
||||
</a>
|
||||
{{-- Share button disabled --}}
|
||||
<form action="{{ route('clients.destroy', $client) }}" method="POST"
|
||||
onsubmit="return confirm('Remove this client?')">
|
||||
@csrf @method('DELETE')
|
||||
<button class="text-xs py-1.5 px-3 rounded-full border border-red-100 text-red-400 hover:bg-red-50">
|
||||
Del
|
||||
✕
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -6,8 +6,9 @@
|
||||
@section('content')
|
||||
<div class="max-w-2xl mx-auto">
|
||||
<div class="cat-card p-4 lg:p-8">
|
||||
<form action="{{ route('content.store') }}" method="POST" class="space-y-4">
|
||||
@csrf
|
||||
<form action="{{ route('content.store') }}" method="POST" class="space-y-4"
|
||||
x-data="contractCheck('{{ route('contracts.check') }}')"
|
||||
@submit.prevent="submitIfClear($el)">
|
||||
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3">
|
||||
<div class="sm:col-span-2">
|
||||
@@ -40,19 +41,38 @@
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-sm font-semibold text-gray-700 mb-1">Client</label>
|
||||
<select name="client_id" class="input-soft">
|
||||
<select name="client_id" class="input-soft" x-model="clientId" @change="checkContract()">
|
||||
<option value="">— None —</option>
|
||||
@foreach($clients as $client)
|
||||
<option value="{{ $client->id }}">{{ $client->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-sm font-semibold text-gray-700 mb-1">Category</label>
|
||||
<select name="category_id" class="input-soft" x-model="categoryId" @change="checkContract()">
|
||||
<option value="">— None —</option>
|
||||
@foreach($categoryTree as $parent)
|
||||
<option value="{{ $parent->id }}">{{ $parent->icon }} {{ $parent->name }}</option>
|
||||
@foreach($parent->children as $child)
|
||||
<option value="{{ $child->id }}"> ↳ {{ $child->name }}</option>
|
||||
@endforeach
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-sm font-semibold text-gray-700 mb-1">Target Date</label>
|
||||
<input type="date" name="target_date" value="{{ old('target_date') }}" class="input-soft">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- Contract warning --}}
|
||||
<div x-show="contractWarning" x-transition
|
||||
class="rounded-2xl bg-amber-50 border border-amber-200 px-4 py-3 text-sm" style="display:none">
|
||||
<div class="font-semibold text-amber-700 mb-1">⚠️ Exclusive Contract Active</div>
|
||||
<p class="text-amber-600 text-xs" x-text="contractMessage"></p>
|
||||
</div>
|
||||
|
||||
{{-- Storyline Maker --}}
|
||||
<div class="bg-pink-50 rounded-2xl p-4 space-y-3">
|
||||
<h3 class="font-bold text-gray-700 flex items-center gap-2 text-sm">✍️ Storyline Maker</h3>
|
||||
@@ -95,7 +115,8 @@
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col sm:flex-row gap-3 pt-1">
|
||||
<button type="submit" class="btn-sakura flex-1 py-3">🎬 Create Brief</button>
|
||||
<button type="submit" class="btn-sakura flex-1 py-3"
|
||||
:class="{ 'opacity-50 cursor-not-allowed': contractWarning }">🎬 Create Brief</button>
|
||||
<a href="{{ route('content.index') }}"
|
||||
class="flex-1 py-3 text-center rounded-full border border-pink-200 text-gray-600 hover:bg-pink-50 font-semibold text-sm">
|
||||
Cancel
|
||||
@@ -104,4 +125,35 @@
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@push('scripts')
|
||||
<script>
|
||||
function contractCheck(checkUrl) {
|
||||
return {
|
||||
categoryId: '',
|
||||
clientId: '',
|
||||
contractWarning: false,
|
||||
contractMessage: '',
|
||||
async checkContract() {
|
||||
if (!this.categoryId) { this.contractWarning = false; return; }
|
||||
const params = new URLSearchParams({ category_id: this.categoryId, client_id: this.clientId || '' });
|
||||
const res = await fetch(checkUrl + '?' + params);
|
||||
const data = await res.json();
|
||||
if (data) {
|
||||
this.contractWarning = true;
|
||||
this.contractMessage = `"${data.title}" — ${data.client_name} holds exclusive rights in the ${data.category} category until ${data.end_date} (${data.days_left} days left).`;
|
||||
} else {
|
||||
this.contractWarning = false;
|
||||
this.contractMessage = '';
|
||||
}
|
||||
},
|
||||
submitIfClear(form) {
|
||||
if (this.contractWarning) {
|
||||
if (!confirm('⚠️ An exclusive contract is active for this category.\n\nAre you sure you want to proceed?')) return;
|
||||
}
|
||||
form.submit();
|
||||
}
|
||||
};
|
||||
}
|
||||
</script>
|
||||
@endpush
|
||||
@endsection
|
||||
|
||||
@@ -43,6 +43,22 @@
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-sm font-semibold text-gray-700 mb-1">Category</label>
|
||||
<select name="category_id" class="input-soft">
|
||||
<option value="">— None —</option>
|
||||
@foreach($categoryTree as $parent)
|
||||
<option value="{{ $parent->id }}" {{ old('category_id', $brief->category_id) == $parent->id ? 'selected' : '' }}>
|
||||
{{ $parent->icon }} {{ $parent->name }}
|
||||
</option>
|
||||
@foreach($parent->children as $child)
|
||||
<option value="{{ $child->id }}" {{ old('category_id', $brief->category_id) == $child->id ? 'selected' : '' }}>
|
||||
↳ {{ $child->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-sm font-semibold text-gray-700 mb-1">Target Date</label>
|
||||
<input type="date" name="target_date" value="{{ old('target_date', $brief->target_date?->toDateString()) }}" class="input-soft">
|
||||
|
||||
212
resources/views/contracts/index.blade.php
Normal file
212
resources/views/contracts/index.blade.php
Normal file
@@ -0,0 +1,212 @@
|
||||
@extends('layouts.app')
|
||||
@section('title', 'Brand Contracts')
|
||||
@section('page-title', '📋 Brand Contracts')
|
||||
@section('page-subtitle', 'Manage exclusive brand agreements per category')
|
||||
|
||||
@section('content')
|
||||
<div class="max-w-4xl mx-auto space-y-5">
|
||||
|
||||
@if(session('success'))
|
||||
<div x-data="{ show: true }" x-show="show" x-init="setTimeout(() => show = false, 4000)"
|
||||
class="flex items-center justify-between gap-3 bg-green-50 border border-green-200 rounded-2xl px-4 py-3 text-sm text-green-700">
|
||||
<span>{{ session('success') }}</span>
|
||||
<button @click="show = false" class="text-green-500 hover:text-green-700 text-lg leading-none">✕</button>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
{{-- Add Contract --}}
|
||||
<div class="cat-card overflow-hidden">
|
||||
<div class="flex items-center gap-3 px-5 py-4 border-b border-pink-50">
|
||||
<span class="text-xl">➕</span>
|
||||
<h2 class="font-bold text-gray-700">Add New Contract</h2>
|
||||
</div>
|
||||
<form action="{{ route('contracts.store') }}" method="POST"
|
||||
class="p-5 grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4">
|
||||
@csrf
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Contract Title <span class="text-pink-400">*</span></label>
|
||||
<input type="text" name="title" required maxlength="255"
|
||||
placeholder="e.g. Exclusive – Energy Drinks 2025"
|
||||
class="input-soft" value="{{ old('title') }}">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Brand / Client</label>
|
||||
<select name="client_id" class="input-soft">
|
||||
<option value="">— No specific client —</option>
|
||||
@foreach($clients as $c)
|
||||
<option value="{{ $c->id }}" {{ old('client_id') == $c->id ? 'selected' : '' }}>
|
||||
{{ $c->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Category (exclusive) <span class="text-pink-400">*</span></label>
|
||||
<select name="category_id" required class="input-soft">
|
||||
<option value="">— Select category —</option>
|
||||
@foreach($categoryTree as $parent)
|
||||
<option value="{{ $parent->id }}" {{ old('category_id') == $parent->id ? 'selected' : '' }}>
|
||||
{{ $parent->icon }} {{ $parent->name }}
|
||||
</option>
|
||||
@foreach($parent->children as $child)
|
||||
<option value="{{ $child->id }}" {{ old('category_id') == $child->id ? 'selected' : '' }}>
|
||||
↳ {{ $child->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Start Date <span class="text-pink-400">*</span></label>
|
||||
<input type="date" name="start_date" required class="input-soft"
|
||||
value="{{ old('start_date', today()->toDateString()) }}">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">End Date <span class="text-pink-400">*</span></label>
|
||||
<input type="date" name="end_date" required class="input-soft"
|
||||
value="{{ old('end_date') }}">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Notes</label>
|
||||
<input type="text" name="notes" maxlength="500" placeholder="Optional notes…"
|
||||
class="input-soft" value="{{ old('notes') }}">
|
||||
</div>
|
||||
<div class="sm:col-span-2 lg:col-span-3 flex justify-end pt-1">
|
||||
<button type="submit" class="btn-sakura px-6 py-2.5">📋 Add Contract</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
{{-- Contracts List --}}
|
||||
<div class="cat-card overflow-hidden">
|
||||
<div class="flex items-center gap-3 px-5 py-4 border-b border-pink-50">
|
||||
<span class="text-xl">📋</span>
|
||||
<h2 class="font-bold text-gray-700">Active & Upcoming Contracts</h2>
|
||||
<span class="ml-auto text-xs bg-pink-100 text-pink-600 font-semibold px-2.5 py-0.5 rounded-full">
|
||||
{{ $contracts->count() }} total
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@forelse($contracts as $contract)
|
||||
<div x-data="{ editing: false }" class="border-b border-pink-50 last:border-0">
|
||||
<div class="flex items-center gap-3 px-5 py-3 hover:bg-pink-50/30 transition-colors">
|
||||
<span class="badge {{ $contract->statusColor }} shrink-0">{{ $contract->statusLabel }}</span>
|
||||
<div class="flex-1 min-w-0">
|
||||
<div class="font-semibold text-gray-700 text-sm truncate">{{ $contract->title }}</div>
|
||||
<div class="text-xs text-gray-400 flex flex-wrap gap-x-3 mt-0.5">
|
||||
@if($contract->client)<span>👤 {{ $contract->client->name }}</span>@endif
|
||||
@if($contract->category)<span>🏷️ {{ $contract->category->fullName }}</span>@endif
|
||||
<span>📅 {{ $contract->start_date->format('d M Y') }} – {{ $contract->end_date->format('d M Y') }}</span>
|
||||
@if($contract->isCurrentlyActive())
|
||||
<span class="text-pink-500 font-medium">{{ $contract->days_remaining }}d left</span>
|
||||
@endif
|
||||
</div>
|
||||
@if($contract->notes)
|
||||
<div class="text-xs text-gray-400 mt-0.5 italic truncate">{{ $contract->notes }}</div>
|
||||
@endif
|
||||
</div>
|
||||
<div class="flex gap-1.5 shrink-0">
|
||||
<form action="{{ route('contracts.toggle', $contract) }}" method="POST">
|
||||
@csrf @method('PATCH')
|
||||
<button class="text-xs px-2.5 py-1.5 rounded-full border
|
||||
{{ $contract->is_active ? 'border-amber-200 text-amber-500 hover:bg-amber-50' : 'border-green-200 text-green-500 hover:bg-green-50' }}"
|
||||
title="{{ $contract->is_active ? 'Pause' : 'Activate' }}">
|
||||
{{ $contract->is_active ? '⏸️' : '▶️' }}
|
||||
</button>
|
||||
</form>
|
||||
<button @click="editing = !editing"
|
||||
class="text-xs px-2.5 py-1.5 rounded-full border border-blue-200 text-blue-500 hover:bg-blue-50">
|
||||
✏️
|
||||
</button>
|
||||
<form action="{{ route('contracts.destroy', $contract) }}" method="POST"
|
||||
onsubmit="return confirm('Delete this contract?')">
|
||||
@csrf @method('DELETE')
|
||||
<button class="text-xs px-2.5 py-1.5 rounded-full border border-red-100 text-red-400 hover:bg-red-50">
|
||||
🗑️
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div x-show="editing" x-transition style="display:none"
|
||||
class="px-5 pb-5 pt-3 bg-pink-50/20 border-t border-pink-50">
|
||||
<form action="{{ route('contracts.update', $contract) }}" method="POST"
|
||||
class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3">
|
||||
@csrf @method('PUT')
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Title</label>
|
||||
<input type="text" name="title" required value="{{ $contract->title }}" class="input-soft">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Brand / Client</label>
|
||||
<select name="client_id" class="input-soft">
|
||||
<option value="">— No specific client —</option>
|
||||
@foreach($clients as $c)
|
||||
<option value="{{ $c->id }}" {{ $contract->client_id == $c->id ? 'selected' : '' }}>{{ $c->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Category</label>
|
||||
<select name="category_id" required class="input-soft">
|
||||
<option value="">— Select —</option>
|
||||
@foreach($categoryTree as $parent)
|
||||
<option value="{{ $parent->id }}" {{ $contract->category_id == $parent->id ? 'selected' : '' }}>
|
||||
{{ $parent->icon }} {{ $parent->name }}
|
||||
</option>
|
||||
@foreach($parent->children as $child)
|
||||
<option value="{{ $child->id }}" {{ $contract->category_id == $child->id ? 'selected' : '' }}>
|
||||
↳ {{ $child->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Start Date</label>
|
||||
<input type="date" name="start_date" required value="{{ $contract->start_date->toDateString() }}" class="input-soft">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">End Date</label>
|
||||
<input type="date" name="end_date" required value="{{ $contract->end_date->toDateString() }}" class="input-soft">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Notes</label>
|
||||
<input type="text" name="notes" value="{{ $contract->notes }}" class="input-soft">
|
||||
</div>
|
||||
<div class="flex items-center gap-4 sm:col-span-2 lg:col-span-3">
|
||||
<label class="flex items-center gap-2 cursor-pointer">
|
||||
<input type="checkbox" name="is_active" value="1"
|
||||
class="w-4 h-4 accent-pink-400 rounded"
|
||||
{{ $contract->is_active ? 'checked' : '' }}>
|
||||
<span class="text-sm text-gray-600">Active</span>
|
||||
</label>
|
||||
<button type="submit" class="btn-sakura px-5 py-2 text-sm ml-auto">💾 Save</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@empty
|
||||
<div class="text-center py-14 text-gray-400">
|
||||
<div class="text-4xl mb-2">📋</div>
|
||||
<p class="text-sm">No contracts yet. Add your first exclusive agreement above.</p>
|
||||
</div>
|
||||
@endforelse
|
||||
</div>
|
||||
|
||||
{{-- How it works --}}
|
||||
<div class="cat-card overflow-hidden border-blue-100 bg-blue-50/30">
|
||||
<div class="flex items-center gap-3 px-5 py-3 border-b border-blue-100">
|
||||
<span class="text-xl">💡</span>
|
||||
<h2 class="font-semibold text-gray-600 text-sm">How Brand Contracts Work</h2>
|
||||
</div>
|
||||
<ul class="text-xs text-gray-500 space-y-1.5 px-5 py-4">
|
||||
<li>🔒 When a contract is <strong>Active</strong>, creating schedules or content for a competing brand in the same category will show a warning.</li>
|
||||
<li>✅ The contracted brand itself is always allowed — no warning shown.</li>
|
||||
<li>🏷️ Blocking a <strong>parent category</strong> also blocks all its subcategories.</li>
|
||||
<li>📅 Contracts only block during their active date range. Expired contracts are ignored automatically.</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@endsection
|
||||
@@ -45,22 +45,22 @@
|
||||
</div>
|
||||
|
||||
{{-- ── Stat Pills (BELOW schedule) ─────────────────────────── --}}
|
||||
<div class="grid grid-cols-2 gap-3 mb-4">
|
||||
<div class="stat-pill">
|
||||
<div class="grid grid-cols-2 sm:grid-cols-4 gap-3 mb-4">
|
||||
<a href="{{ route('clients.index') }}" class="stat-pill hover:shadow-md transition-shadow">
|
||||
<div class="text-2xl lg:text-3xl font-extrabold text-pink-500">{{ $stats['total_clients'] }}</div>
|
||||
<div class="text-xs lg:text-sm font-semibold text-gray-600">Total Clients</div>
|
||||
<div class="text-xs text-gray-400">{{ $stats['active_clients'] }} active</div>
|
||||
</div>
|
||||
<div class="stat-pill">
|
||||
</a>
|
||||
<a href="{{ route('schedule.index') }}" class="stat-pill hover:shadow-md transition-shadow">
|
||||
<div class="text-2xl lg:text-3xl font-extrabold text-purple-500">{{ $stats['upcoming_events'] }}</div>
|
||||
<div class="text-xs lg:text-sm font-semibold text-gray-600">Upcoming Events</div>
|
||||
<div class="text-xs text-gray-400">Next 3 months</div>
|
||||
</div>
|
||||
<div class="stat-pill">
|
||||
</a>
|
||||
<a href="{{ route('invoices.index') }}" class="stat-pill hover:shadow-md transition-shadow">
|
||||
<div class="text-2xl lg:text-3xl font-extrabold text-amber-500">{{ $stats['pending_invoices'] }}</div>
|
||||
<div class="text-xs lg:text-sm font-semibold text-gray-600">Pending Invoices</div>
|
||||
<div class="text-xs text-gray-400">Awaiting payment</div>
|
||||
</div>
|
||||
</a>
|
||||
<div class="stat-pill">
|
||||
<div class="text-lg lg:text-2xl font-extrabold text-emerald-500 leading-tight">
|
||||
Rp {{ number_format($stats['total_revenue'], 0, ',', '.') }}
|
||||
@@ -70,6 +70,25 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- ── Secondary Stats ──────────────────────────────────────── --}}
|
||||
<div class="grid grid-cols-3 gap-3 mb-4">
|
||||
<a href="{{ route('client-categories.index') }}" class="stat-pill hover:shadow-md transition-shadow">
|
||||
<div class="text-2xl font-extrabold text-indigo-500">{{ $stats['total_categories'] }}</div>
|
||||
<div class="text-xs font-semibold text-gray-600">Categories</div>
|
||||
<div class="text-xs text-gray-400">{{ $stats['total_subcategories'] }} subcategories</div>
|
||||
</a>
|
||||
<a href="{{ route('contracts.index') }}" class="stat-pill hover:shadow-md transition-shadow">
|
||||
<div class="text-2xl font-extrabold text-rose-500">{{ $stats['active_contracts'] }}</div>
|
||||
<div class="text-xs font-semibold text-gray-600">Brand Contracts</div>
|
||||
<div class="text-xs text-gray-400">{{ $stats['total_contracts'] }} total</div>
|
||||
</a>
|
||||
<a href="{{ route('files.index') }}" class="stat-pill hover:shadow-md transition-shadow">
|
||||
<div class="text-2xl font-extrabold text-teal-500">{{ $stats['total_files'] }}</div>
|
||||
<div class="text-xs font-semibold text-gray-600">Files Saved</div>
|
||||
<div class="text-xs text-gray-400">In file manager</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
{{-- ── Bottom Row ───────────────────────────────────────────── --}}
|
||||
<div class="grid grid-cols-1 lg:grid-cols-3 gap-4">
|
||||
|
||||
|
||||
@@ -6,60 +6,141 @@
|
||||
|
||||
@section('content')
|
||||
|
||||
{{-- ── Upload Form (collapsible on mobile) ─────────────────── --}}
|
||||
<div class="cat-card p-4 mb-4" x-data="{ open: false }">
|
||||
{{-- ── Upload Form (collapsible) ────────────────────────────── --}}
|
||||
<div class="cat-card p-4 mb-4"
|
||||
x-data="{
|
||||
open: false,
|
||||
uploading: false,
|
||||
progress: 0,
|
||||
statusMsg: '',
|
||||
statusOk: true,
|
||||
|
||||
submitUpload(form) {
|
||||
const fd = new FormData(form);
|
||||
const xhr = new XMLHttpRequest();
|
||||
|
||||
xhr.upload.addEventListener('progress', (e) => {
|
||||
if (e.lengthComputable) {
|
||||
this.progress = Math.round((e.loaded / e.total) * 100);
|
||||
}
|
||||
});
|
||||
|
||||
xhr.addEventListener('load', () => {
|
||||
this.uploading = false;
|
||||
if (xhr.status >= 200 && xhr.status < 300) {
|
||||
this.statusOk = true;
|
||||
this.statusMsg = '✅ File uploaded successfully!';
|
||||
this.progress = 100;
|
||||
form.reset();
|
||||
setTimeout(() => {
|
||||
this.open = false;
|
||||
this.statusMsg = '';
|
||||
this.progress = 0;
|
||||
window.location.reload();
|
||||
}, 1200);
|
||||
} else {
|
||||
this.statusOk = false;
|
||||
try {
|
||||
const body = JSON.parse(xhr.responseText);
|
||||
this.statusMsg = body.message ?? 'Upload failed. Please try again.';
|
||||
} catch {
|
||||
this.statusMsg = 'Upload failed. Please try again.';
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
xhr.addEventListener('error', () => {
|
||||
this.uploading = false;
|
||||
this.statusOk = false;
|
||||
this.statusMsg = 'Network error. Please try again.';
|
||||
});
|
||||
|
||||
xhr.open('POST', form.action);
|
||||
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
|
||||
xhr.setRequestHeader('Accept', 'application/json');
|
||||
this.uploading = true;
|
||||
this.progress = 0;
|
||||
this.statusMsg = '';
|
||||
xhr.send(fd);
|
||||
}
|
||||
}">
|
||||
<div class="flex items-center justify-between">
|
||||
<h3 class="text-sm font-bold text-gray-700 flex items-center gap-2">📤 Upload File</h3>
|
||||
<button class="btn-sakura text-xs px-4 py-1.5" @click="open = !open"
|
||||
<button class="btn-sakura text-xs px-4 py-1.5" @click="open = !open; statusMsg = ''; progress = 0;"
|
||||
x-text="open ? '✕ Close' : '+ Upload'"></button>
|
||||
</div>
|
||||
|
||||
<form x-show="open" x-transition
|
||||
action="{{ route('files.store') }}" method="POST" enctype="multipart/form-data"
|
||||
class="mt-4 grid grid-cols-1 sm:grid-cols-3 gap-3">
|
||||
@csrf
|
||||
<div class="sm:col-span-3">
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">
|
||||
File <span class="text-pink-400">*</span>
|
||||
<span class="text-gray-400 font-normal ml-1">Max 50 MB</span>
|
||||
</label>
|
||||
<input type="file" name="file" required
|
||||
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">
|
||||
<div x-show="open" x-transition>
|
||||
<form action="{{ route('files.store') }}" method="POST" enctype="multipart/form-data"
|
||||
class="mt-4 grid grid-cols-1 sm:grid-cols-3 gap-3"
|
||||
@submit.prevent="submitUpload($el)">
|
||||
@csrf
|
||||
<div class="sm:col-span-3">
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">
|
||||
File <span class="text-pink-400">*</span>
|
||||
<span class="text-gray-400 font-normal ml-1">Max 50 MB</span>
|
||||
</label>
|
||||
<input type="file" name="file" required
|
||||
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">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Folder</label>
|
||||
<input type="text" name="folder" value="general" class="input-soft text-sm"
|
||||
list="folder-list" placeholder="brand-assets, logos...">
|
||||
<datalist id="folder-list">
|
||||
@foreach($folders as $f)
|
||||
<option value="{{ $f }}">
|
||||
@endforeach
|
||||
<option value="brand-assets">
|
||||
<option value="logos">
|
||||
<option value="videos">
|
||||
<option value="photos">
|
||||
<option value="documents">
|
||||
</datalist>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Client (optional)</label>
|
||||
<select name="client_id" class="input-soft text-sm">
|
||||
<option value="">— None —</option>
|
||||
@foreach($clients as $client)
|
||||
<option value="{{ $client->id }}">{{ $client->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="sm:flex sm:items-end">
|
||||
<button type="submit" class="btn-sakura w-full py-2.5" :disabled="uploading">
|
||||
<span x-show="!uploading">📤 Upload</span>
|
||||
<span x-show="uploading">Uploading…</span>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{{-- Progress Bar --}}
|
||||
<div x-show="uploading || progress > 0" x-transition class="mt-3">
|
||||
<div class="flex items-center justify-between text-xs text-gray-500 mb-1">
|
||||
<span>Uploading…</span>
|
||||
<span x-text="progress + '%'"></span>
|
||||
</div>
|
||||
<div class="w-full bg-pink-100 rounded-full h-2.5 overflow-hidden">
|
||||
<div class="h-2.5 rounded-full transition-all duration-200"
|
||||
style="background:#FFB7C5"
|
||||
:style="'width:' + progress + '%'"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Folder</label>
|
||||
<input type="text" name="folder" value="general" class="input-soft text-sm"
|
||||
list="folder-list" placeholder="brand-assets, logos...">
|
||||
<datalist id="folder-list">
|
||||
@foreach($folders as $f)
|
||||
<option value="{{ $f }}">
|
||||
@endforeach
|
||||
<option value="brand-assets">
|
||||
<option value="logos">
|
||||
<option value="videos">
|
||||
<option value="photos">
|
||||
<option value="documents">
|
||||
</datalist>
|
||||
|
||||
{{-- Status Message --}}
|
||||
<div x-show="statusMsg" x-transition
|
||||
class="mt-3 px-4 py-2.5 rounded-xl text-sm font-medium"
|
||||
:class="statusOk ? 'bg-green-50 text-green-700' : 'bg-red-50 text-red-600'"
|
||||
x-text="statusMsg">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Client (optional)</label>
|
||||
<select name="client_id" class="input-soft text-sm">
|
||||
<option value="">— None —</option>
|
||||
@foreach($clients as $client)
|
||||
<option value="{{ $client->id }}">{{ $client->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="sm:flex sm:items-end">
|
||||
<button type="submit" class="btn-sakura w-full py-2.5">📤 Upload</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- ── Folder Filter Chips ──────────────────────────────────── --}}
|
||||
@@ -124,7 +205,7 @@
|
||||
<form action="{{ route('files.destroy', $file) }}" method="POST"
|
||||
onsubmit="return confirm('Delete this file?')">
|
||||
@csrf @method('DELETE')
|
||||
<button class="text-xs py-1.5 px-3 rounded-full border border-red-100 text-red-400 hover:bg-red-50">
|
||||
<button class="text-xs py-1.5 px-2.5 rounded-full border border-red-100 text-red-400 hover:bg-red-50">
|
||||
✕
|
||||
</button>
|
||||
</form>
|
||||
@@ -138,7 +219,7 @@
|
||||
<div class="text-center py-16 text-gray-400">
|
||||
<span class="text-5xl block mb-3">📁</span>
|
||||
<p class="text-sm">No files yet.</p>
|
||||
<button onclick="document.querySelector('[\\@click=\\'open = !open\\']').click()"
|
||||
<button onclick="document.querySelector('[x-data]').__x.$data.open = true"
|
||||
class="btn-sakura mt-4 inline-block text-sm">Upload your first file</button>
|
||||
</div>
|
||||
@endforelse
|
||||
|
||||
@@ -31,9 +31,9 @@
|
||||
<div>
|
||||
<label class="block text-sm font-semibold text-gray-700 mb-1">Currency</label>
|
||||
<select name="currency" class="input-soft">
|
||||
<option value="IDR" selected>IDR (Rupiah)</option>
|
||||
<option value="USD">USD (Dollar)</option>
|
||||
<option value="SGD">SGD</option>
|
||||
@foreach(['IDR' => 'IDR (Rupiah)', 'USD' => 'USD (Dollar)', 'SGD' => 'SGD', 'MYR' => 'MYR (Ringgit)'] as $code => $label)
|
||||
<option value="{{ $code }}" {{ old('currency', $invoiceSettings->default_currency ?? 'IDR') === $code ? 'selected' : '' }}>{{ $label }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
@@ -50,7 +50,7 @@
|
||||
<div>
|
||||
<label class="block text-sm font-semibold text-gray-700 mb-1">Tax Rate (%)</label>
|
||||
<input type="number" name="tax_rate" x-model="taxRate" @input="recalc()"
|
||||
value="{{ old('tax_rate', 11) }}" class="input-soft" step="0.01">
|
||||
value="{{ old('tax_rate', $invoiceSettings->default_tax_rate ?? 11) }}" class="input-soft" step="0.01">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -93,6 +93,18 @@
|
||||
<button type="button" @click="removeItem(index)"
|
||||
class="text-red-400 hover:text-red-600 text-lg shrink-0 pt-4">✕</button>
|
||||
</div>
|
||||
{{-- Taxable checkbox --}}
|
||||
<div class="mt-2 flex items-center gap-2">
|
||||
<input type="hidden" :name="`items[${index}][is_taxable]`" value="0">
|
||||
<input type="checkbox" :name="`items[${index}][is_taxable]`"
|
||||
:id="`taxable_${index}`"
|
||||
x-model="item.is_taxable" @change="recalc()"
|
||||
value="1"
|
||||
class="w-3.5 h-3.5 accent-pink-400">
|
||||
<label :for="`taxable_${index}`" class="text-xs text-gray-500 cursor-pointer select-none">
|
||||
Taxable
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
@@ -101,34 +113,43 @@
|
||||
{{-- Totals --}}
|
||||
<div class="bg-pink-50 rounded-2xl p-4 mb-5">
|
||||
<div class="flex justify-between text-sm py-1">
|
||||
<span class="text-gray-500">Subtotal</span>
|
||||
<span class="text-gray-500">Subtotal (all items)</span>
|
||||
<span class="font-semibold">Rp <span x-text="formatNum(subtotal)"></span></span>
|
||||
</div>
|
||||
<div class="flex justify-between text-sm py-1">
|
||||
<span class="text-gray-500">Tax (<span x-text="taxRate"></span>%)</span>
|
||||
<div class="flex justify-between text-sm py-1 text-amber-600">
|
||||
<span>Tax (<span x-text="taxRate"></span>% — paid by client)</span>
|
||||
<span class="font-semibold">Rp <span x-text="formatNum(taxAmount)"></span></span>
|
||||
</div>
|
||||
<div class="flex justify-between text-base font-bold py-2 mt-1 border-t border-pink-200">
|
||||
<span class="text-gray-700">Total</span>
|
||||
<span class="text-gray-700">Total (you receive)</span>
|
||||
<span class="text-pink-600">Rp <span x-text="formatNum(total)"></span></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- Bank Info --}}
|
||||
<div class="grid grid-cols-1 sm:grid-cols-3 gap-3 mb-5">
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3 mb-5">
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Bank Name</label>
|
||||
<input type="text" name="bank_name" value="{{ old('bank_name') }}"
|
||||
<input type="text" name="bank_name"
|
||||
value="{{ old('bank_name', $invoiceSettings->default_bank_name) }}"
|
||||
class="input-soft text-sm" placeholder="BCA, Mandiri...">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Branch Name</label>
|
||||
<input type="text" name="branch_name"
|
||||
value="{{ old('branch_name', $invoiceSettings->default_branch_name) }}"
|
||||
class="input-soft text-sm" placeholder="e.g. KCP Sudirman">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Account Number</label>
|
||||
<input type="text" name="bank_account" value="{{ old('bank_account') }}"
|
||||
<input type="text" name="bank_account"
|
||||
value="{{ old('bank_account', $invoiceSettings->default_bank_account) }}"
|
||||
class="input-soft text-sm">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Account Holder</label>
|
||||
<input type="text" name="bank_holder" value="{{ old('bank_holder') }}"
|
||||
<input type="text" name="bank_holder"
|
||||
value="{{ old('bank_holder', $invoiceSettings->default_bank_holder) }}"
|
||||
class="input-soft text-sm">
|
||||
</div>
|
||||
</div>
|
||||
@@ -136,7 +157,7 @@
|
||||
<div class="mb-5">
|
||||
<label class="block text-sm font-semibold text-gray-700 mb-1">Notes</label>
|
||||
<textarea name="notes" rows="2" class="input-soft resize-none"
|
||||
placeholder="Payment terms, etc.">{{ old('notes') }}</textarea>
|
||||
placeholder="Payment terms, etc.">{{ old('notes', $invoiceSettings->default_notes) }}</textarea>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col sm:flex-row gap-3">
|
||||
@@ -154,15 +175,22 @@
|
||||
<script>
|
||||
function invoiceForm() {
|
||||
return {
|
||||
items: [{ description: '', quantity: 1, unit_price: 0 }],
|
||||
taxRate: 11,
|
||||
get subtotal() { return this.items.reduce((s, i) => s + (i.quantity * i.unit_price), 0); },
|
||||
get taxAmount() { return Math.round(this.subtotal * this.taxRate / 100); },
|
||||
get total() { return this.subtotal + this.taxAmount; },
|
||||
addItem() { this.items.push({ description: '', quantity: 1, unit_price: 0 }); },
|
||||
removeItem(i) { if (this.items.length > 1) this.items.splice(i, 1); },
|
||||
recalc() {},
|
||||
formatNum(n) { return Number(n).toLocaleString('id-ID'); },
|
||||
items: [{ description: '{{ addslashes($invoiceSettings->default_service_description ?? '') }}', quantity: 1, unit_price: 0, is_taxable: true }],
|
||||
taxRate: {{ $invoiceSettings->default_tax_rate ?? 11 }},
|
||||
get subtotal() {
|
||||
return this.items.reduce((s, i) => s + (i.quantity * i.unit_price), 0);
|
||||
},
|
||||
get taxAmount() {
|
||||
const taxable = this.items
|
||||
.filter(i => i.is_taxable)
|
||||
.reduce((s, i) => s + (i.quantity * i.unit_price), 0);
|
||||
return Math.round(taxable * this.taxRate / 100);
|
||||
},
|
||||
get total() { return this.subtotal; }, // grand total = pre-tax (tax borne by client)
|
||||
addItem() { this.items.push({ description: '', quantity: 1, unit_price: 0, is_taxable: true }); },
|
||||
removeItem(i) { if (this.items.length > 1) this.items.splice(i, 1); },
|
||||
recalc() {},
|
||||
formatNum(n) { return Number(n).toLocaleString('id-ID'); },
|
||||
};
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -88,6 +88,18 @@
|
||||
<button type="button" @click="removeItem(index)"
|
||||
class="text-red-400 hover:text-red-600 text-lg shrink-0 pt-4">✕</button>
|
||||
</div>
|
||||
{{-- Taxable checkbox --}}
|
||||
<div class="mt-2 flex items-center gap-2">
|
||||
<input type="hidden" :name="`items[${index}][is_taxable]`" value="0">
|
||||
<input type="checkbox" :name="`items[${index}][is_taxable]`"
|
||||
:id="`taxable_${index}`"
|
||||
x-model="item.is_taxable" @change="recalc()"
|
||||
value="1"
|
||||
class="w-3.5 h-3.5 accent-pink-400">
|
||||
<label :for="`taxable_${index}`" class="text-xs text-gray-500 cursor-pointer select-none">
|
||||
Taxable
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
@@ -96,26 +108,31 @@
|
||||
{{-- Totals --}}
|
||||
<div class="bg-pink-50 rounded-2xl p-4 mb-5">
|
||||
<div class="flex justify-between text-sm py-1">
|
||||
<span class="text-gray-500">Subtotal</span>
|
||||
<span class="text-gray-500">Subtotal (all items)</span>
|
||||
<span class="font-semibold">Rp <span x-text="formatNum(subtotal)"></span></span>
|
||||
</div>
|
||||
<div class="flex justify-between text-sm py-1">
|
||||
<span class="text-gray-500">Tax (<span x-text="taxRate"></span>%)</span>
|
||||
<div class="flex justify-between text-sm py-1 text-amber-600">
|
||||
<span>Tax (<span x-text="taxRate"></span>% — paid by client)</span>
|
||||
<span class="font-semibold">Rp <span x-text="formatNum(taxAmount)"></span></span>
|
||||
</div>
|
||||
<div class="flex justify-between text-base font-bold py-2 mt-1 border-t border-pink-200">
|
||||
<span class="text-gray-700">Total</span>
|
||||
<span class="text-gray-700">Total (you receive)</span>
|
||||
<span class="text-pink-600">Rp <span x-text="formatNum(total)"></span></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- Bank Info --}}
|
||||
<div class="grid grid-cols-1 sm:grid-cols-3 gap-3 mb-5">
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3 mb-5">
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Bank Name</label>
|
||||
<input type="text" name="bank_name" value="{{ old('bank_name', $invoice->bank_name) }}"
|
||||
class="input-soft text-sm">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Branch Name</label>
|
||||
<input type="text" name="branch_name" value="{{ old('branch_name', $invoice->branch_name) }}"
|
||||
class="input-soft text-sm" placeholder="e.g. KCP Sudirman">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Account Number</label>
|
||||
<input type="text" name="bank_account" value="{{ old('bank_account', $invoice->bank_account) }}"
|
||||
@@ -147,13 +164,25 @@
|
||||
@push('scripts')
|
||||
<script>
|
||||
function invoiceEditForm() {
|
||||
@php
|
||||
$itemsJson = $invoice->items->map(function($i) {
|
||||
return ['description' => $i->description, 'quantity' => $i->quantity, 'unit_price' => (float)$i->unit_price, 'is_taxable' => (bool)$i->is_taxable];
|
||||
});
|
||||
@endphp
|
||||
return {
|
||||
items: @json($invoice->items->map(fn($i) => ['description' => $i->description, 'quantity' => $i->quantity, 'unit_price' => (float)$i->unit_price])),
|
||||
items: @json($itemsJson),
|
||||
taxRate: {{ $invoice->tax_rate }},
|
||||
get subtotal() { return this.items.reduce((s, i) => s + (i.quantity * i.unit_price), 0); },
|
||||
get taxAmount() { return Math.round(this.subtotal * this.taxRate / 100); },
|
||||
get total() { return this.subtotal + this.taxAmount; },
|
||||
addItem() { this.items.push({ description: '', quantity: 1, unit_price: 0 }); },
|
||||
get subtotal() {
|
||||
return this.items.reduce((s, i) => s + (i.quantity * i.unit_price), 0);
|
||||
},
|
||||
get taxAmount() {
|
||||
const taxable = this.items
|
||||
.filter(i => i.is_taxable)
|
||||
.reduce((s, i) => s + (i.quantity * i.unit_price), 0);
|
||||
return Math.round(taxable * this.taxRate / 100);
|
||||
},
|
||||
get total() { return this.subtotal; },
|
||||
addItem() { this.items.push({ description: '', quantity: 1, unit_price: 0, is_taxable: true }); },
|
||||
removeItem(i) { if (this.items.length > 1) this.items.splice(i, 1); },
|
||||
recalc() {},
|
||||
formatNum(n) { return Number(n).toLocaleString('id-ID'); },
|
||||
|
||||
@@ -18,7 +18,13 @@
|
||||
</a>
|
||||
@endforeach
|
||||
</div>
|
||||
<a href="{{ route('invoices.create') }}" class="btn-sakura text-sm shrink-0">+ New Invoice</a>
|
||||
<div class="flex gap-2 shrink-0">
|
||||
<a href="{{ route('invoice-settings.edit') }}"
|
||||
class="text-xs px-3 py-2 rounded-full border border-gray-200 text-gray-500 hover:bg-gray-50 flex items-center gap-1">
|
||||
⚙️ Settings
|
||||
</a>
|
||||
<a href="{{ route('invoices.create') }}" class="btn-sakura text-sm">+ New Invoice</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- Mobile card list --}}
|
||||
@@ -41,6 +47,7 @@
|
||||
<a href="{{ route('invoices.show', $invoice) }}" class="flex-1 text-center text-xs py-1.5 px-3 rounded-full border border-pink-200 text-pink-600 hover:bg-pink-50">View</a>
|
||||
<a href="{{ route('invoices.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
|
||||
@@ -85,6 +92,7 @@
|
||||
<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>
|
||||
@@ -100,4 +108,5 @@
|
||||
</div>
|
||||
|
||||
<div class="mt-4">{{ $invoices->links() }}</div>
|
||||
{{-- Share scripts disabled --}}
|
||||
@endsection
|
||||
|
||||
@@ -38,9 +38,15 @@
|
||||
<body>
|
||||
|
||||
<div class="header">
|
||||
<div>
|
||||
<div class="logo">🐱 KOL Manager</div>
|
||||
<div class="logo-sub">Personal Talent Assistant</div>
|
||||
<div style="display:flex; align-items:center; gap:12px;">
|
||||
@if($invoiceSettings->header_logo && file_exists(storage_path('app/public/' . $invoiceSettings->header_logo)))
|
||||
<img src="{{ storage_path('app/public/' . $invoiceSettings->header_logo) }}"
|
||||
style="width:52px; height:52px; object-fit:cover; border-radius:12px;" alt="Logo">
|
||||
@endif
|
||||
<div>
|
||||
<div class="logo">{{ $invoiceSettings->header_name ?: 'KOL Manager' }}</div>
|
||||
<div class="logo-sub">{{ $invoiceSettings->header_title ?: 'Personal Talent Assistant' }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="text-align:right">
|
||||
<div class="inv-number">{{ $invoice->invoice_number }}</div>
|
||||
@@ -97,15 +103,21 @@
|
||||
<div class="totals">
|
||||
<div class="totals-box">
|
||||
<div class="totals-row"><span>Subtotal</span><span>Rp {{ number_format($invoice->subtotal, 0, ',', '.') }}</span></div>
|
||||
<div class="totals-row"><span>Tax ({{ $invoice->tax_rate }}%)</span><span>Rp {{ number_format($invoice->tax_amount, 0, ',', '.') }}</span></div>
|
||||
<div class="totals-row total"><span>Total</span><span>{{ $invoice->formatted_total }}</span></div>
|
||||
@if($invoice->tax_rate > 0)
|
||||
<div class="totals-row" style="color:#D97706"><span>Tax ({{ $invoice->tax_rate }}% — paid by client)</span><span>Rp {{ number_format($invoice->tax_amount, 0, ',', '.') }}</span></div>
|
||||
@endif
|
||||
<div class="totals-row total"><span>Total (you receive)</span><span>{{ $invoice->formatted_total }}</span></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if($invoice->bank_name)
|
||||
<div class="bank-box">
|
||||
<div class="bank-title">💳 Payment Information</div>
|
||||
<div class="bank-detail">{{ $invoice->bank_name }} · {{ $invoice->bank_account }} · a/n {{ $invoice->bank_holder }}</div>
|
||||
<div class="bank-title">Payment Information</div>
|
||||
<div class="bank-detail">
|
||||
{{ $invoice->bank_name }}
|
||||
@if($invoice->branch_name) · {{ $invoice->branch_name }} @endif
|
||||
· {{ $invoice->bank_account }} · a/n {{ $invoice->bank_holder }}
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
|
||||
175
resources/views/invoices/settings.blade.php
Normal file
175
resources/views/invoices/settings.blade.php
Normal file
@@ -0,0 +1,175 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('title', 'Invoice Settings')
|
||||
@section('page-title', 'Invoice Settings 🧾')
|
||||
@section('page-subtitle', 'Customize number format, header, and invoice defaults')
|
||||
|
||||
@section('content')
|
||||
<div class="max-w-2xl mx-auto">
|
||||
<div class="flex items-center gap-3 mb-5">
|
||||
<a href="{{ route('invoices.index') }}"
|
||||
class="text-xs px-3 py-2 rounded-full border border-pink-200 text-gray-500 hover:bg-pink-50">
|
||||
← Back to Invoices
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@if(session('success'))
|
||||
<div x-data="{ show: true }" x-show="show" x-init="setTimeout(() => show = false, 4000)"
|
||||
class="flex items-center justify-between gap-3 bg-green-50 border border-green-200 rounded-2xl px-4 py-3 text-sm text-green-700 mb-4">
|
||||
<span>{{ session('success') }}</span>
|
||||
<button @click="show = false" class="text-green-500 hover:text-green-700 text-lg leading-none">✕</button>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<form action="{{ route('invoice-settings.update') }}" method="POST" enctype="multipart/form-data"
|
||||
class="space-y-5">
|
||||
@csrf
|
||||
|
||||
{{-- Number Format --}}
|
||||
<div class="cat-card p-5">
|
||||
<h2 class="text-sm font-bold text-gray-700 mb-4 flex items-center gap-2">🔢 Invoice Number Format</h2>
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">
|
||||
Prefix <span class="text-pink-400">*</span>
|
||||
</label>
|
||||
<input type="text" name="invoice_prefix"
|
||||
value="{{ old('invoice_prefix', $settings->invoice_prefix) }}"
|
||||
class="input-soft text-sm" placeholder="INV-EA" required
|
||||
id="prefix-input" oninput="updatePreview()">
|
||||
<p class="text-xs text-gray-400 mt-1">e.g. <code>INV-EA</code> → <strong>INV-EA-001</strong></p>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">
|
||||
Next Number <span class="text-pink-400">*</span>
|
||||
</label>
|
||||
<input type="number" name="invoice_next_number"
|
||||
value="{{ old('invoice_next_number', $settings->invoice_next_number) }}"
|
||||
class="input-soft text-sm" min="1" required
|
||||
id="number-input" oninput="updatePreview()">
|
||||
<p class="text-xs text-gray-400 mt-1">Used for the next new invoice</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-3 bg-pink-50 rounded-xl px-4 py-2.5 text-sm text-gray-600">
|
||||
Preview: <strong class="text-pink-600" id="number-preview">
|
||||
{{ rtrim(old('invoice_prefix', $settings->invoice_prefix), '-') }}-{{ str_pad((string) (old('invoice_next_number', $settings->invoice_next_number) ?? 1), 3, '0', STR_PAD_LEFT) }}
|
||||
</strong>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- Header / Branding --}}
|
||||
<div class="cat-card p-5">
|
||||
<h2 class="text-sm font-bold text-gray-700 mb-4 flex items-center gap-2">🎨 Invoice Header</h2>
|
||||
|
||||
@if($settings->header_logo)
|
||||
<div class="mb-3 flex items-center gap-3">
|
||||
<img src="{{ asset('storage/' . $settings->header_logo) }}"
|
||||
alt="Logo" class="h-16 w-16 object-cover rounded-2xl border border-pink-100">
|
||||
<div>
|
||||
<p class="text-xs font-semibold text-gray-600">Current Logo</p>
|
||||
<p class="text-xs text-gray-400 mt-0.5">Upload a new file to replace it</p>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
||||
<div class="sm:col-span-2">
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Logo / Profile Picture</label>
|
||||
<input type="file" name="header_logo" accept="image/*"
|
||||
class="w-full text-sm text-gray-600
|
||||
file:mr-3 file:py-1.5 file:px-4
|
||||
file:rounded-full file:border-0
|
||||
file:text-xs file:font-semibold
|
||||
file:bg-pink-50 file:text-pink-600
|
||||
hover:file:bg-pink-100 cursor-pointer">
|
||||
<p class="text-xs text-gray-400 mt-1">Max 2 MB. Shown at the top-left of your invoice.</p>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Talent / Business Name</label>
|
||||
<input type="text" name="header_name"
|
||||
value="{{ old('header_name', $settings->header_name) }}"
|
||||
class="input-soft text-sm" placeholder="Your name or brand">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Title / Tagline</label>
|
||||
<input type="text" name="header_title"
|
||||
value="{{ old('header_title', $settings->header_title) }}"
|
||||
class="input-soft text-sm" placeholder="Content Creator · KOL">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- Invoice Defaults --}}
|
||||
<div class="cat-card p-5">
|
||||
<h2 class="text-sm font-bold text-gray-700 mb-4 flex items-center gap-2">📋 Invoice Defaults</h2>
|
||||
<p class="text-xs text-gray-400 mb-4">These values will pre-fill every new invoice you create.</p>
|
||||
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Default Tax Rate (%)</label>
|
||||
<input type="number" name="default_tax_rate" step="0.01" min="0" max="100"
|
||||
value="{{ old('default_tax_rate', $settings->default_tax_rate ?? 11) }}"
|
||||
class="input-soft text-sm" placeholder="11">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Default Currency</label>
|
||||
<select name="default_currency" class="input-soft text-sm">
|
||||
@foreach(['IDR' => 'IDR (Rupiah)', 'USD' => 'USD (Dollar)', 'SGD' => 'SGD', 'MYR' => 'MYR (Ringgit)'] as $code => $label)
|
||||
<option value="{{ $code }}" {{ old('default_currency', $settings->default_currency ?? 'IDR') === $code ? 'selected' : '' }}>
|
||||
{{ $label }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="sm:col-span-2">
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Default Service Description</label>
|
||||
<input type="text" name="default_service_description"
|
||||
value="{{ old('default_service_description', $settings->default_service_description) }}"
|
||||
class="input-soft text-sm" placeholder="e.g. Instagram Feed Post — 1 carousel">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Default Bank Name</label>
|
||||
<input type="text" name="default_bank_name"
|
||||
value="{{ old('default_bank_name', $settings->default_bank_name) }}"
|
||||
class="input-soft text-sm" placeholder="BCA, Mandiri…">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Default Branch Name</label>
|
||||
<input type="text" name="default_branch_name"
|
||||
value="{{ old('default_branch_name', $settings->default_branch_name) }}"
|
||||
class="input-soft text-sm" placeholder="KCP Sudirman">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Default Account Number</label>
|
||||
<input type="text" name="default_bank_account"
|
||||
value="{{ old('default_bank_account', $settings->default_bank_account) }}"
|
||||
class="input-soft text-sm" placeholder="1234567890">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Default Account Holder</label>
|
||||
<input type="text" name="default_bank_holder"
|
||||
value="{{ old('default_bank_holder', $settings->default_bank_holder) }}"
|
||||
class="input-soft text-sm" placeholder="Your full name">
|
||||
</div>
|
||||
<div class="sm:col-span-2">
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Default Notes / Payment Terms</label>
|
||||
<textarea name="default_notes" rows="2" class="input-soft text-sm resize-none"
|
||||
placeholder="e.g. Payment due within 14 days from invoice date.">{{ old('default_notes', $settings->default_notes) }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn-sakura w-full py-3">💾 Save Settings</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@push('scripts')
|
||||
<script>
|
||||
function updatePreview() {
|
||||
const prefix = document.getElementById('prefix-input').value.replace(/-+$/, '') || 'INV';
|
||||
const num = parseInt(document.getElementById('number-input').value) || 1;
|
||||
document.getElementById('number-preview').textContent = prefix + '-' + String(num).padStart(3, '0');
|
||||
}
|
||||
</script>
|
||||
@endpush
|
||||
@endsection
|
||||
@@ -18,9 +18,19 @@
|
||||
<div class="cat-card p-8">
|
||||
{{-- Invoice Header --}}
|
||||
<div class="flex justify-between items-start mb-8">
|
||||
<div>
|
||||
<div class="text-2xl font-extrabold text-pink-500 flex items-center gap-2">🐱 KOL Manager</div>
|
||||
<div class="text-sm text-gray-400 mt-1">Personal Talent Assistant</div>
|
||||
<div class="flex items-center gap-3">
|
||||
@if($invoiceSettings->header_logo)
|
||||
<img src="{{ asset('storage/' . $invoiceSettings->header_logo) }}"
|
||||
alt="Logo" class="h-14 w-14 object-cover rounded-2xl border border-pink-100 shrink-0">
|
||||
@endif
|
||||
<div>
|
||||
<div class="text-xl font-extrabold text-pink-500">
|
||||
{{ $invoiceSettings->header_name ?: '🐱 KOL Manager' }}
|
||||
</div>
|
||||
<div class="text-sm text-gray-400 mt-0.5">
|
||||
{{ $invoiceSettings->header_title ?: 'Personal Talent Assistant' }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-right">
|
||||
<div class="text-2xl font-bold text-gray-800">{{ $invoice->invoice_number }}</div>
|
||||
@@ -75,15 +85,18 @@
|
||||
|
||||
{{-- Totals --}}
|
||||
<div class="flex justify-end mb-8">
|
||||
<div class="w-64 space-y-2 text-sm">
|
||||
<div class="w-72 space-y-2 text-sm">
|
||||
<div class="flex justify-between text-gray-500">
|
||||
<span>Subtotal</span><span class="font-medium">Rp {{ number_format($invoice->subtotal, 0, ',', '.') }}</span>
|
||||
</div>
|
||||
<div class="flex justify-between text-gray-500">
|
||||
<span>Tax ({{ $invoice->tax_rate }}%)</span><span class="font-medium">Rp {{ number_format($invoice->tax_amount, 0, ',', '.') }}</span>
|
||||
@if($invoice->tax_rate > 0)
|
||||
<div class="flex justify-between text-amber-600">
|
||||
<span>Tax ({{ $invoice->tax_rate }}% — paid by client)</span>
|
||||
<span class="font-medium">Rp {{ number_format($invoice->tax_amount, 0, ',', '.') }}</span>
|
||||
</div>
|
||||
@endif
|
||||
<div class="flex justify-between text-base font-bold text-pink-600 pt-2 border-t border-pink-200">
|
||||
<span>Total</span><span>{{ $invoice->formatted_total }}</span>
|
||||
<span>Total (you receive)</span><span>{{ $invoice->formatted_total }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -92,7 +105,11 @@
|
||||
@if($invoice->bank_name)
|
||||
<div class="bg-pink-50 rounded-2xl p-4 text-sm">
|
||||
<div class="font-semibold text-gray-700 mb-2">💳 Payment Info</div>
|
||||
<div class="text-gray-600">{{ $invoice->bank_name }} · {{ $invoice->bank_account }} · {{ $invoice->bank_holder }}</div>
|
||||
<div class="text-gray-600">
|
||||
{{ $invoice->bank_name }}
|
||||
@if($invoice->branch_name) · {{ $invoice->branch_name }} @endif
|
||||
· {{ $invoice->bank_account }} · a/n {{ $invoice->bank_holder }}
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
|
||||
@@ -75,6 +75,18 @@
|
||||
<span class="text-lg shrink-0">👥</span> Clients / CRM
|
||||
</a>
|
||||
|
||||
<a href="{{ route('client-categories.index') }}"
|
||||
@click="sidebarOpen = false"
|
||||
class="nav-item {{ request()->routeIs('client-categories.*') ? 'active' : '' }}">
|
||||
<span class="text-lg shrink-0">🏷️</span> Categories
|
||||
</a>
|
||||
|
||||
<a href="{{ route('contracts.index') }}"
|
||||
@click="sidebarOpen = false"
|
||||
class="nav-item {{ request()->routeIs('contracts.*') ? 'active' : '' }}">
|
||||
<span class="text-lg shrink-0">📋</span> Brand Contracts
|
||||
</a>
|
||||
|
||||
<a href="{{ route('social-hub.index') }}"
|
||||
@click="sidebarOpen = false"
|
||||
class="nav-item {{ request()->routeIs('social-hub.*') ? 'active' : '' }}">
|
||||
|
||||
@@ -5,11 +5,21 @@
|
||||
@section('page-subtitle', 'Manage your service pricing')
|
||||
|
||||
@section('content')
|
||||
<div class="flex flex-col sm:flex-row sm:items-center justify-between gap-3 mb-5">
|
||||
<a href="{{ route('rate-cards.public') }}" target="_blank"
|
||||
class="text-sm text-pink-500 hover:underline flex items-center gap-1">
|
||||
🔗 View Public Page →
|
||||
</a>
|
||||
<div class="flex flex-wrap items-center justify-between gap-3 mb-5">
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<a href="{{ route('rate-cards.public') }}" target="_blank"
|
||||
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">
|
||||
🔗 Public Page
|
||||
</a>
|
||||
<a href="{{ route('rate-cards.pdf') }}"
|
||||
class="text-xs px-3 py-2 rounded-full border border-blue-200 text-blue-500 hover:bg-blue-50 flex items-center gap-1">
|
||||
📄 PDF
|
||||
</a>
|
||||
<a href="{{ route('rate-cards.profile') }}"
|
||||
class="text-xs px-3 py-2 rounded-full border border-purple-200 text-purple-500 hover:bg-purple-50 flex items-center gap-1">
|
||||
🎨 Profile
|
||||
</a>
|
||||
</div>
|
||||
<a href="{{ route('rate-cards.create') }}" class="btn-sakura text-sm shrink-0">+ Add Service</a>
|
||||
</div>
|
||||
|
||||
@@ -57,11 +67,12 @@
|
||||
class="flex-1 text-center text-xs py-2 rounded-full border border-pink-200 text-gray-600 hover:bg-pink-50 font-medium">
|
||||
Edit
|
||||
</a>
|
||||
{{-- Share button disabled --}}
|
||||
<form action="{{ route('rate-cards.destroy', $card) }}" method="POST"
|
||||
onsubmit="return confirm('Delete this entry?')">
|
||||
@csrf @method('DELETE')
|
||||
<button class="text-xs py-2 px-4 rounded-full border border-red-100 text-red-400 hover:bg-red-50">
|
||||
Delete
|
||||
<button class="text-xs py-2 px-3 rounded-full border border-red-100 text-red-400 hover:bg-red-50">
|
||||
✕
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
@@ -79,4 +90,5 @@
|
||||
<a href="{{ route('rate-cards.create') }}" class="btn-sakura mt-4 inline-block">Add your first service!</a>
|
||||
</div>
|
||||
@endif
|
||||
{{-- Share scripts disabled --}}
|
||||
@endsection
|
||||
|
||||
142
resources/views/rate-cards/pdf.blade.php
Normal file
142
resources/views/rate-cards/pdf.blade.php
Normal file
@@ -0,0 +1,142 @@
|
||||
@php
|
||||
// Convert hex accent color to rgb for rgba() usage in dompdf
|
||||
$accent = ltrim($profile->accent_color ?? '#FFB7C5', '#');
|
||||
$ar = hexdec(substr($accent, 0, 2));
|
||||
$ag = hexdec(substr($accent, 2, 2));
|
||||
$ab = hexdec(substr($accent, 4, 2));
|
||||
$accentRgb = "{$ar},{$ag},{$ab}";
|
||||
|
||||
$bg = $profile->bg_color ?? '#FFFBFE';
|
||||
$text = $profile->text_color ?? '#374151';
|
||||
$accentHex = '#' . $accent;
|
||||
@endphp
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Rate Card — {{ $profile->owner_name }}</title>
|
||||
<style>
|
||||
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
body {
|
||||
font-family: 'DejaVu Sans', sans-serif;
|
||||
background: {{ $bg }};
|
||||
color: {{ $text }};
|
||||
padding: 36px 32px;
|
||||
font-size: 12px;
|
||||
}
|
||||
.header {
|
||||
text-align: center;
|
||||
margin-bottom: 32px;
|
||||
padding-bottom: 20px;
|
||||
border-bottom: 2px solid {{ $accentHex }};
|
||||
}
|
||||
.logo-img { max-height: 72px; max-width: 140px; margin: 0 auto 10px; display: block; }
|
||||
.name { font-size: 24px; font-weight: 700; color: {{ $accentHex }}; }
|
||||
.tagline { color: #9CA3AF; margin-top: 4px; font-size: 11px; }
|
||||
.contacts { margin-top: 10px; font-size: 10px; color: #6B7280; }
|
||||
.contacts span { margin: 0 6px; }
|
||||
.platform-section { margin-bottom: 22px; }
|
||||
.platform-title {
|
||||
font-size: 13px; font-weight: 700;
|
||||
color: {{ $text }};
|
||||
margin-bottom: 8px;
|
||||
padding: 5px 10px;
|
||||
background-color: rgba({{ $accentRgb }}, 0.1);
|
||||
border-left: 4px solid {{ $accentHex }};
|
||||
}
|
||||
table { width: 100%; border-collapse: collapse; }
|
||||
th {
|
||||
text-align: left; padding: 7px 10px;
|
||||
background-color: rgba({{ $accentRgb }}, 0.08);
|
||||
color: #6B7280; font-size: 9px;
|
||||
text-transform: uppercase; letter-spacing: 0.05em;
|
||||
border-bottom: 1px solid rgba({{ $accentRgb }}, 0.25);
|
||||
}
|
||||
td { padding: 8px 10px; border-bottom: 1px solid #F3F4F6; vertical-align: top; }
|
||||
tr:last-child td { border-bottom: none; }
|
||||
.service-name { font-weight: 600; color: {{ $text }}; }
|
||||
.content-type {
|
||||
display: inline-block; font-size: 9px;
|
||||
background-color: rgba({{ $accentRgb }}, 0.1);
|
||||
color: {{ $accentHex }};
|
||||
padding: 1px 7px; border-radius: 10px; margin-top: 2px;
|
||||
}
|
||||
.desc { color: #9CA3AF; font-size: 10px; margin-top: 3px; }
|
||||
.price { font-weight: 700; color: {{ $accentHex }}; font-size: 13px; }
|
||||
.price-unit { color: #9CA3AF; font-size: 9px; }
|
||||
.negotiable { color: #F59E0B; font-size: 9px; font-weight: 600; }
|
||||
.footer { text-align: center; margin-top: 36px; color: #D1D5DB; font-size: 9px; border-top: 1px solid #F3F4F6; padding-top: 14px; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="header">
|
||||
@if($profile->logo_path && file_exists(storage_path('app/private/' . $profile->logo_path)))
|
||||
<img src="{{ storage_path('app/private/' . $profile->logo_path) }}" class="logo-img" alt="{{ $profile->owner_name }}">
|
||||
@endif
|
||||
<div class="name">{{ $profile->owner_name }}</div>
|
||||
@if($profile->tagline)
|
||||
<div class="tagline">{{ $profile->tagline }}</div>
|
||||
@endif
|
||||
<div class="contacts">
|
||||
@if($profile->email)<span>✉ {{ $profile->email }}</span>@endif
|
||||
@if($profile->whatsapp)<span>· {{ $profile->whatsapp }}</span>@endif
|
||||
@if($profile->ig_handle)<span>· @{{ $profile->ig_handle }}</span>@endif
|
||||
@if($profile->tiktok_handle)<span>· @{{ $profile->tiktok_handle }}</span>@endif
|
||||
@if($profile->youtube_handle)<span>· {{ $profile->youtube_handle }}</span>@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@foreach($rateCards as $platform => $cards)
|
||||
<div class="platform-section">
|
||||
<div class="platform-title">
|
||||
@php $icons = ['instagram' => 'Instagram', 'tiktok' => 'TikTok', 'youtube' => 'YouTube', 'general' => 'General']; @endphp
|
||||
{{ $icons[$platform] ?? ucfirst($platform) }}
|
||||
</div>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width:38%">Service</th>
|
||||
<th style="width:37%">Description</th>
|
||||
<th style="width:25%; text-align:right">Price</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($cards as $card)
|
||||
<tr>
|
||||
<td>
|
||||
<div class="service-name">{{ $card->service_name }}</div>
|
||||
@if($card->content_type)
|
||||
<span class="content-type">{{ $card->content_type }}</span>
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
@if($card->description)
|
||||
<div class="desc">{{ $card->description }}</div>
|
||||
@endif
|
||||
</td>
|
||||
<td style="text-align:right">
|
||||
@if($profile->show_prices)
|
||||
<div class="price">{{ $card->formatted_price }}</div>
|
||||
<div class="price-unit">{{ str_replace('_', ' ', $card->price_unit) }}</div>
|
||||
@else
|
||||
<div class="price" style="font-size:11px">On Request</div>
|
||||
@endif
|
||||
@if($card->is_negotiable)
|
||||
<div class="negotiable">Negotiable</div>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@endforeach
|
||||
|
||||
<div class="footer">
|
||||
{{ $profile->custom_footer ?: 'Prices may vary. Contact for custom packages.' }}
|
||||
· Generated {{ now()->format('d M Y') }}
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
172
resources/views/rate-cards/profile.blade.php
Normal file
172
resources/views/rate-cards/profile.blade.php
Normal file
@@ -0,0 +1,172 @@
|
||||
@extends('layouts.app')
|
||||
@section('title', 'Rate Card Profile')
|
||||
@section('page-title', '🎨 Rate Card Profile')
|
||||
@section('page-subtitle', 'Customise your public rate card page')
|
||||
|
||||
@section('content')
|
||||
<div class="max-w-3xl mx-auto space-y-5">
|
||||
|
||||
@if(session('success'))
|
||||
<div x-data="{ show: true }" x-show="show" x-init="setTimeout(() => show = false, 4000)"
|
||||
class="flex items-center justify-between gap-3 bg-green-50 border border-green-200 rounded-2xl px-4 py-3 text-sm text-green-700">
|
||||
<span>{{ session('success') }}</span>
|
||||
<button @click="show = false" class="text-green-500 hover:text-green-700 text-lg leading-none">✕</button>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<form action="{{ route('rate-cards.profile.update') }}" method="POST" enctype="multipart/form-data"
|
||||
class="space-y-5">
|
||||
@csrf
|
||||
|
||||
{{-- Identity --}}
|
||||
<div class="cat-card overflow-hidden">
|
||||
<div class="flex items-center gap-3 px-5 py-4 border-b border-pink-50">
|
||||
<span class="text-xl">👤</span>
|
||||
<h2 class="font-bold text-gray-700">Identity</h2>
|
||||
</div>
|
||||
<div class="p-5 grid grid-cols-1 sm:grid-cols-2 gap-4">
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Display Name <span class="text-pink-400">*</span></label>
|
||||
<input type="text" name="owner_name" required
|
||||
value="{{ old('owner_name', $profile->owner_name) }}"
|
||||
class="input-soft" placeholder="e.g. Sakura KOL">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Tagline</label>
|
||||
<input type="text" name="tagline"
|
||||
value="{{ old('tagline', $profile->tagline) }}"
|
||||
class="input-soft" placeholder="e.g. Lifestyle & Beauty Creator">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Email</label>
|
||||
<input type="email" name="email"
|
||||
value="{{ old('email', $profile->email) }}"
|
||||
class="input-soft" placeholder="hi@example.com">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">WhatsApp Number</label>
|
||||
<input type="text" name="whatsapp"
|
||||
value="{{ old('whatsapp', $profile->whatsapp) }}"
|
||||
class="input-soft" placeholder="+6012-345-6789">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Instagram Handle</label>
|
||||
<div class="relative">
|
||||
<span class="absolute left-3 top-1/2 -translate-y-1/2 text-gray-400 text-sm pointer-events-none">@</span>
|
||||
<input type="text" name="ig_handle"
|
||||
value="{{ old('ig_handle', $profile->ig_handle) }}"
|
||||
class="input-soft pl-7" placeholder="yourhandle">
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">TikTok Handle</label>
|
||||
<div class="relative">
|
||||
<span class="absolute left-3 top-1/2 -translate-y-1/2 text-gray-400 text-sm pointer-events-none">@</span>
|
||||
<input type="text" name="tiktok_handle"
|
||||
value="{{ old('tiktok_handle', $profile->tiktok_handle) }}"
|
||||
class="input-soft pl-7" placeholder="yourhandle">
|
||||
</div>
|
||||
</div>
|
||||
<div class="sm:col-span-2">
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">YouTube Handle / Channel</label>
|
||||
<input type="text" name="youtube_handle"
|
||||
value="{{ old('youtube_handle', $profile->youtube_handle) }}"
|
||||
class="input-soft" placeholder="@yourchannel">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- Appearance --}}
|
||||
<div class="cat-card overflow-hidden">
|
||||
<div class="flex items-center gap-3 px-5 py-4 border-b border-pink-50">
|
||||
<span class="text-xl">🎨</span>
|
||||
<h2 class="font-bold text-gray-700">Appearance</h2>
|
||||
</div>
|
||||
<div class="p-5 grid grid-cols-1 sm:grid-cols-2 gap-4">
|
||||
<div class="sm:col-span-2">
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Logo / Profile Image</label>
|
||||
@if($profile->logo_path)
|
||||
<div class="flex items-center gap-3 mb-2">
|
||||
<img src="{{ route('files.serve-profile-logo') }}" alt="Logo"
|
||||
class="w-16 h-16 object-cover rounded-2xl border border-pink-100">
|
||||
<span class="text-xs text-gray-400">Current logo</span>
|
||||
</div>
|
||||
@endif
|
||||
<input type="file" name="logo" accept="image/*"
|
||||
class="w-full text-sm text-gray-600
|
||||
file:mr-3 file:py-2 file:px-4 file:rounded-full file:border-0
|
||||
file:text-xs file:font-semibold file:bg-pink-50 file:text-pink-600
|
||||
hover:file:bg-pink-100 cursor-pointer">
|
||||
<p class="text-xs text-gray-400 mt-1">Max 2MB. PNG/JPG/WebP.</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Background Color</label>
|
||||
<div class="flex items-center gap-2">
|
||||
<input type="color" name="bg_color" value="{{ old('bg_color', $profile->bg_color) }}"
|
||||
class="h-10 w-16 rounded-2xl border border-pink-200 cursor-pointer p-1 bg-white shrink-0"
|
||||
oninput="document.getElementById('bg_text').value=this.value">
|
||||
<input type="text" id="bg_text" value="{{ old('bg_color', $profile->bg_color) }}"
|
||||
class="input-soft text-sm flex-1" readonly>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Accent Color</label>
|
||||
<div class="flex items-center gap-2">
|
||||
<input type="color" name="accent_color" value="{{ old('accent_color', $profile->accent_color) }}"
|
||||
class="h-10 w-16 rounded-2xl border border-pink-200 cursor-pointer p-1 bg-white shrink-0"
|
||||
oninput="document.getElementById('accent_text').value=this.value">
|
||||
<input type="text" id="accent_text" value="{{ old('accent_color', $profile->accent_color) }}"
|
||||
class="input-soft text-sm flex-1" readonly>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Text Color</label>
|
||||
<div class="flex items-center gap-2">
|
||||
<input type="color" name="text_color" value="{{ old('text_color', $profile->text_color) }}"
|
||||
class="h-10 w-16 rounded-2xl border border-pink-200 cursor-pointer p-1 bg-white shrink-0"
|
||||
oninput="document.getElementById('text_text').value=this.value">
|
||||
<input type="text" id="text_text" value="{{ old('text_color', $profile->text_color) }}"
|
||||
class="input-soft text-sm flex-1" readonly>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Custom Footer</label>
|
||||
<input type="text" name="custom_footer"
|
||||
value="{{ old('custom_footer', $profile->custom_footer) }}"
|
||||
class="input-soft"
|
||||
placeholder="e.g. Prices valid until Dec 2025 · DM for bundles">
|
||||
</div>
|
||||
<div class="sm:col-span-2">
|
||||
<label class="flex items-start gap-3 cursor-pointer">
|
||||
<input type="checkbox" name="show_prices" value="1"
|
||||
class="w-4 h-4 accent-pink-400 mt-0.5 shrink-0"
|
||||
{{ old('show_prices', $profile->show_prices) ? 'checked' : '' }}>
|
||||
<div>
|
||||
<span class="text-sm font-medium text-gray-700">Show prices publicly</span>
|
||||
<p class="text-xs text-gray-400">Uncheck to show "On Request" instead of actual prices</p>
|
||||
</div>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- Actions --}}
|
||||
<div class="flex flex-wrap items-center gap-3">
|
||||
<button type="submit" class="btn-sakura px-6 py-2.5">💾 Save Profile</button>
|
||||
<a href="{{ route('rate-cards.public') }}" target="_blank"
|
||||
class="text-xs px-4 py-2.5 rounded-full border border-pink-200 text-pink-500 hover:bg-pink-50">
|
||||
👁️ Preview Public Page
|
||||
</a>
|
||||
<a href="{{ route('rate-cards.pdf') }}"
|
||||
class="text-xs px-4 py-2.5 rounded-full border border-blue-200 text-blue-500 hover:bg-blue-50">
|
||||
📄 Download PDF
|
||||
</a>
|
||||
<a href="{{ route('rate-cards.index') }}"
|
||||
class="text-xs px-4 py-2.5 rounded-full border border-gray-200 text-gray-500 hover:bg-gray-50">
|
||||
← Back to Rate Cards
|
||||
</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@endsection
|
||||
@@ -3,36 +3,80 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Rate Card — KOL Manager</title>
|
||||
<title>Rate Card — {{ $profile->owner_name }}</title>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&display=swap" rel="stylesheet">
|
||||
<style>
|
||||
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
body { font-family: 'Nunito', sans-serif; background: #FFF8F0; color: #374151; padding: 40px 20px; }
|
||||
.container { max-width: 800px; margin: 0 auto; }
|
||||
body { font-family: 'Nunito', sans-serif; background: {{ $profile->bg_color }}; color: {{ $profile->text_color }}; padding: 40px 20px; }
|
||||
.container { max-width: 820px; margin: 0 auto; }
|
||||
.header { text-align: center; margin-bottom: 48px; }
|
||||
.logo { font-size: 48px; margin-bottom: 12px; }
|
||||
.title { font-size: 32px; font-weight: 900; color: #FFB7C5; }
|
||||
.subtitle { color: #9CA3AF; margin-top: 6px; font-size: 14px; }
|
||||
.logo-img { max-height: 100px; max-width: 200px; margin: 0 auto 16px; display: block; border-radius: 16px; }
|
||||
.title { font-size: 32px; font-weight: 900; color: {{ $profile->accent_color }}; }
|
||||
.tagline { color: #9CA3AF; margin-top: 6px; font-size: 14px; }
|
||||
.contacts { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px 20px; margin-top: 16px; }
|
||||
.contact-pill {
|
||||
display: inline-flex; align-items: center; gap-6px;
|
||||
background: white; border: 1px solid {{ $profile->accent_color }}44;
|
||||
border-radius: 99px; padding: 6px 14px; font-size: 12px; color: {{ $profile->text_color }};
|
||||
text-decoration: none; transition: background 0.2s;
|
||||
}
|
||||
.contact-pill:hover { background: {{ $profile->accent_color }}18; }
|
||||
.platform-section { margin-bottom: 32px; }
|
||||
.platform-title { font-size: 18px; font-weight: 800; color: #374151; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
|
||||
.platform-title { font-size: 18px; font-weight: 800; color: {{ $profile->text_color }}; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
|
||||
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
|
||||
.card { background: white; border-radius: 24px; padding: 20px; border: 1px solid #FFE4EC; box-shadow: 0 2px 8px rgba(255,183,197,0.15); }
|
||||
.card { background: white; border-radius: 24px; padding: 20px; border: 1px solid {{ $profile->accent_color }}33; box-shadow: 0 2px 8px {{ $profile->accent_color }}22; }
|
||||
.service { font-weight: 700; color: #1F2937; margin-bottom: 6px; }
|
||||
.type { display: inline-block; background: #FFF0F5; color: #FFB7C5; font-size: 11px; font-weight: 600; padding: 2px 10px; border-radius: 20px; margin-bottom: 8px; }
|
||||
.type { display: inline-block; background: {{ $profile->accent_color }}18; color: {{ $profile->accent_color }}; font-size: 11px; font-weight: 600; padding: 2px 10px; border-radius: 20px; margin-bottom: 8px; }
|
||||
.desc { font-size: 12px; color: #9CA3AF; margin-bottom: 12px; line-height: 1.5; }
|
||||
.price { font-size: 22px; font-weight: 900; color: #FFB7C5; }
|
||||
.price { font-size: 22px; font-weight: 900; color: {{ $profile->accent_color }}; }
|
||||
.price-meta { font-size: 11px; color: #D1D5DB; margin-top: 2px; }
|
||||
.negotiable { font-size: 11px; color: #F59E0B; font-weight: 600; }
|
||||
.footer { text-align: center; margin-top: 60px; color: #D1D5DB; font-size: 12px; }
|
||||
@media print { body { background: white; } .card { break-inside: avoid; } }
|
||||
.pdf-btn {
|
||||
display: inline-flex; align-items: center; gap: 6px;
|
||||
background: {{ $profile->accent_color }}; color: white;
|
||||
border: none; border-radius: 99px; padding: 10px 24px;
|
||||
font-size: 14px; font-weight: 700; cursor: pointer;
|
||||
text-decoration: none; transition: opacity 0.2s;
|
||||
}
|
||||
.pdf-btn:hover { opacity: 0.9; }
|
||||
@media print { body { background: white; } .card { break-inside: avoid; } .pdf-btn { display: none; } }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="header">
|
||||
<div class="logo">🐱</div>
|
||||
<div class="title">Rate Card</div>
|
||||
<div class="subtitle">Services & Pricing · {{ now()->format('Y') }}</div>
|
||||
@if($profile->logo_path)
|
||||
<img src="{{ route('files.serve-profile-logo') }}" alt="{{ $profile->owner_name }}" class="logo-img">
|
||||
@else
|
||||
<div style="font-size:56px; margin-bottom:12px;">🐱</div>
|
||||
@endif
|
||||
<div class="title">{{ $profile->owner_name }}</div>
|
||||
@if($profile->tagline)
|
||||
<div class="tagline">{{ $profile->tagline }}</div>
|
||||
@endif
|
||||
|
||||
<div class="contacts" style="margin-top:14px">
|
||||
@if($profile->whatsappUrl)
|
||||
<a href="{{ $profile->whatsappUrl }}" target="_blank" class="contact-pill">📱 WhatsApp</a>
|
||||
@endif
|
||||
@if($profile->ig_handle)
|
||||
<a href="https://instagram.com/{{ ltrim($profile->ig_handle, '@') }}" target="_blank" class="contact-pill">📸 @{{ $profile->ig_handle }}</a>
|
||||
@endif
|
||||
@if($profile->tiktok_handle)
|
||||
<a href="https://tiktok.com/@{{ ltrim($profile->tiktok_handle, '@') }}" target="_blank" class="contact-pill">🎵 @{{ $profile->tiktok_handle }}</a>
|
||||
@endif
|
||||
@if($profile->youtube_handle)
|
||||
<a href="https://youtube.com/{{ $profile->youtube_handle }}" target="_blank" class="contact-pill">▶️ {{ $profile->youtube_handle }}</a>
|
||||
@endif
|
||||
@if($profile->email)
|
||||
<a href="mailto:{{ $profile->email }}" class="contact-pill">✉️ {{ $profile->email }}</a>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div style="margin-top:20px">
|
||||
<a href="{{ route('rate-cards.pdf') }}" class="pdf-btn">📄 Download PDF</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@forelse($rateCards as $platform => $cards)
|
||||
@@ -51,8 +95,12 @@
|
||||
@if($card->description)
|
||||
<div class="desc">{{ $card->description }}</div>
|
||||
@endif
|
||||
@if($profile->show_prices)
|
||||
<div class="price">{{ $card->formatted_price }}</div>
|
||||
<div class="price-meta">{{ str_replace('_', ' ', $card->price_unit) }}</div>
|
||||
@else
|
||||
<div class="price" style="font-size:16px">On Request</div>
|
||||
@endif
|
||||
@if($card->is_negotiable)
|
||||
<div class="negotiable">✦ Negotiable</div>
|
||||
@endif
|
||||
@@ -65,7 +113,8 @@
|
||||
@endforelse
|
||||
|
||||
<div class="footer">
|
||||
Generated by KOL Manager · Prices may vary. Contact for custom packages. 🐾
|
||||
{{ $profile->custom_footer ?: 'Prices may vary. Contact for custom packages. 🐾' }}
|
||||
<br>Generated by KOL Manager · {{ now()->format('Y') }}
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
</div>
|
||||
|
||||
{{-- Client --}}
|
||||
<div class="sm:col-span-2">
|
||||
<div>
|
||||
<label class="block text-sm font-semibold text-gray-700 mb-1">Client</label>
|
||||
<select name="client_id" class="input-soft">
|
||||
<option value="">— None —</option>
|
||||
@@ -65,6 +65,26 @@
|
||||
</select>
|
||||
</div>
|
||||
|
||||
{{-- Category --}}
|
||||
<div>
|
||||
<label class="block text-sm font-semibold text-gray-700 mb-1">Category</label>
|
||||
<select name="category_id" class="input-soft">
|
||||
<option value="">— None —</option>
|
||||
@foreach($categoryTree as $parent)
|
||||
<option value="{{ $parent->id }}"
|
||||
{{ old('category_id', $event->category_id) == $parent->id ? 'selected' : '' }}>
|
||||
{{ $parent->icon }} {{ $parent->name }}
|
||||
</option>
|
||||
@foreach($parent->children as $child)
|
||||
<option value="{{ $child->id }}"
|
||||
{{ old('category_id', $event->category_id) == $child->id ? 'selected' : '' }}>
|
||||
↳ {{ $child->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
{{-- Start Date --}}
|
||||
<div>
|
||||
<label class="block text-sm font-semibold text-gray-700 mb-1">
|
||||
|
||||
@@ -16,7 +16,9 @@
|
||||
|
||||
<form x-show="open" x-transition action="{{ route('schedule.store') }}" method="POST"
|
||||
class="mt-4 grid grid-cols-1 sm:grid-cols-2 gap-3"
|
||||
id="new-event-form">
|
||||
id="new-event-form"
|
||||
x-data="contractCheck('{{ route('contracts.check') }}')"
|
||||
@submit.prevent="submitIfClear($el)">
|
||||
@csrf
|
||||
{{-- Hidden combined datetime fields --}}
|
||||
<input type="hidden" name="start_time" id="start_time_hidden">
|
||||
@@ -37,13 +39,31 @@
|
||||
</div>
|
||||
<div>
|
||||
<label class="text-xs font-semibold text-gray-600">Client</label>
|
||||
<select name="client_id" class="input-soft mt-1">
|
||||
<select name="client_id" class="input-soft mt-1" x-model="clientId" @change="checkContract()">
|
||||
<option value="">— None —</option>
|
||||
@foreach($clients as $client)
|
||||
<option value="{{ $client->id }}">{{ $client->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label class="text-xs font-semibold text-gray-600">Category</label>
|
||||
<select name="category_id" class="input-soft mt-1" x-model="categoryId" @change="checkContract()">
|
||||
<option value="">— None —</option>
|
||||
@foreach($categoryTree as $parent)
|
||||
<option value="{{ $parent->id }}">{{ $parent->icon }} {{ $parent->name }}</option>
|
||||
@foreach($parent->children as $child)
|
||||
<option value="{{ $child->id }}"> ↳ {{ $child->name }}</option>
|
||||
@endforeach
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
{{-- Contract warning --}}
|
||||
<div x-show="contractWarning" x-transition class="sm:col-span-2 rounded-2xl bg-amber-50 border border-amber-200 px-4 py-3 text-sm" style="display:none">
|
||||
<div class="font-semibold text-amber-700 mb-1">⚠️ Exclusive Contract Active</div>
|
||||
<p class="text-amber-600 text-xs" x-text="contractMessage"></p>
|
||||
</div>
|
||||
|
||||
{{-- Start: date + time side by side --}}
|
||||
<div>
|
||||
@@ -86,7 +106,10 @@
|
||||
<textarea name="notes" rows="2" class="input-soft mt-1 resize-none text-sm"></textarea>
|
||||
</div>
|
||||
<div class="sm:col-span-2">
|
||||
<button type="submit" class="btn-sakura w-full">🐾 Schedule It!</button>
|
||||
<button type="submit" class="btn-sakura w-full"
|
||||
:class="{ 'opacity-50 cursor-not-allowed': contractWarning }">
|
||||
🐾 Schedule It!
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@@ -209,8 +232,9 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
<div class="flex gap-2"><span class="text-gray-400 w-16 shrink-0">Start</span><span>${e.start?.toLocaleString()}</span></div>
|
||||
${e.end ? `<div class="flex gap-2"><span class="text-gray-400 w-16 shrink-0">End</span><span>${e.end.toLocaleString()}</span></div>` : ''}
|
||||
`;
|
||||
const editUrl = `/schedule/${e.id}/edit`;
|
||||
document.getElementById('modal-actions').innerHTML = `
|
||||
<a href="/schedule/${e.id}/edit" class="btn-sakura text-sm flex-1 text-center py-2">Edit</a>
|
||||
<a href="${editUrl}" class="btn-sakura text-sm flex-1 text-center py-2">Edit</a>
|
||||
<form method="POST" action="/schedule/${e.id}" onsubmit="return confirm('Delete?')" class="flex-1">
|
||||
<input type="hidden" name="_method" value="DELETE">
|
||||
<input type="hidden" name="_token" value="${document.querySelector('meta[name=csrf-token]').content}">
|
||||
@@ -248,5 +272,37 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
{{-- Share scripts disabled --}}
|
||||
|
||||
<script>
|
||||
function contractCheck(checkUrl) {
|
||||
return {
|
||||
categoryId: '',
|
||||
clientId: '',
|
||||
contractWarning: false,
|
||||
contractMessage: '',
|
||||
async checkContract() {
|
||||
if (!this.categoryId) { this.contractWarning = false; return; }
|
||||
const params = new URLSearchParams({ category_id: this.categoryId, client_id: this.clientId || '' });
|
||||
const res = await fetch(checkUrl + '?' + params);
|
||||
const data = await res.json();
|
||||
if (data) {
|
||||
this.contractWarning = true;
|
||||
this.contractMessage = `"${data.title}" — ${data.client_name} holds exclusive rights in the ${data.category} category until ${data.end_date} (${data.days_left} days left).`;
|
||||
} else {
|
||||
this.contractWarning = false;
|
||||
this.contractMessage = '';
|
||||
}
|
||||
},
|
||||
submitIfClear(form) {
|
||||
if (this.contractWarning) {
|
||||
if (!confirm('⚠️ An exclusive contract is active for this category.\n\nAre you sure you want to proceed?')) return;
|
||||
}
|
||||
form.submit();
|
||||
}
|
||||
};
|
||||
}
|
||||
</script>
|
||||
@endpush
|
||||
@endsection
|
||||
|
||||
@@ -134,11 +134,12 @@
|
||||
</div>
|
||||
@elseif($setting->channel === 'whatsapp')
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3">
|
||||
<div>
|
||||
<label class="text-xs font-semibold text-gray-600 block mb-1">WAHA URL</label>
|
||||
<input type="url" name="config[waha_url]"
|
||||
value="{{ $setting->config['waha_url'] ?? '' }}"
|
||||
class="input-soft text-sm" placeholder="http://localhost:3000">
|
||||
<div class="sm:col-span-2">
|
||||
<label class="text-xs font-semibold text-gray-600 block mb-1">WAHA Endpoint</label>
|
||||
<input type="url" name="config[waha_endpoint]"
|
||||
value="{{ $setting->config['waha_endpoint'] ?? '' }}"
|
||||
class="input-soft text-sm" placeholder="http://localhost:3000/api/sendText">
|
||||
<p class="text-xs text-gray-400 mt-1">Full URL to the sendText endpoint</p>
|
||||
</div>
|
||||
<div>
|
||||
<label class="text-xs font-semibold text-gray-600 block mb-1">Session Name</label>
|
||||
@@ -146,11 +147,21 @@
|
||||
value="{{ $setting->config['waha_session'] ?? 'default' }}"
|
||||
class="input-soft text-sm" placeholder="default">
|
||||
</div>
|
||||
<div>
|
||||
<label class="text-xs font-semibold text-gray-600 block mb-1">API Key
|
||||
<span class="font-normal text-gray-400">(if required)</span>
|
||||
</label>
|
||||
<input type="text" name="config[api_key]"
|
||||
value="{{ $setting->config['api_key'] ?? '' }}"
|
||||
class="input-soft text-sm" placeholder="your-waha-api-key">
|
||||
<p class="text-xs text-gray-400 mt-1">Sent as <code>X-Api-Key</code> header. Leave blank if WAHA has no auth.</p>
|
||||
</div>
|
||||
<div class="sm:col-span-2">
|
||||
<label class="text-xs font-semibold text-gray-600 block mb-1">Phone Number</label>
|
||||
<input type="text" name="config[phone]"
|
||||
value="{{ $setting->config['phone'] ?? '' }}"
|
||||
class="input-soft text-sm" placeholder="628123456789">
|
||||
<label class="text-xs font-semibold text-gray-600 block mb-1">Chat ID</label>
|
||||
<input type="text" name="config[chat_id]"
|
||||
value="{{ $setting->config['chat_id'] ?? '' }}"
|
||||
class="input-soft text-sm" placeholder="628123456789@c.us or 120363xxx@g.us">
|
||||
<p class="text-xs text-gray-400 mt-1">Individual: <code>628xxx@c.us</code> · Group: <code>120363xxx@g.us</code></p>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
@@ -238,20 +249,29 @@
|
||||
|
||||
{{-- WhatsApp / WAHA --}}
|
||||
<div x-show="channel === 'whatsapp'" x-transition class="grid grid-cols-1 sm:grid-cols-2 gap-3">
|
||||
<div>
|
||||
<label class="text-xs font-semibold text-gray-600 block mb-1">WAHA API URL <span class="text-pink-400">*</span></label>
|
||||
<input type="url" name="config[waha_url]" class="input-soft text-sm"
|
||||
placeholder="http://localhost:3000">
|
||||
<p class="text-xs text-gray-400 mt-1">Your self-hosted WAHA instance</p>
|
||||
<div class="sm:col-span-2">
|
||||
<label class="text-xs font-semibold text-gray-600 block mb-1">WAHA Endpoint <span class="text-pink-400">*</span></label>
|
||||
<input type="url" name="config[waha_endpoint]" class="input-soft text-sm"
|
||||
placeholder="http://localhost:3000/api/sendText">
|
||||
<p class="text-xs text-gray-400 mt-1">Full URL to the sendText endpoint of your WAHA instance</p>
|
||||
</div>
|
||||
<div>
|
||||
<label class="text-xs font-semibold text-gray-600 block mb-1">Session Name</label>
|
||||
<input type="text" name="config[waha_session]" value="default" class="input-soft text-sm">
|
||||
</div>
|
||||
<div>
|
||||
<label class="text-xs font-semibold text-gray-600 block mb-1">API Key
|
||||
<span class="font-normal text-gray-400">(if required)</span>
|
||||
</label>
|
||||
<input type="text" name="config[api_key]" class="input-soft text-sm"
|
||||
placeholder="your-waha-api-key">
|
||||
<p class="text-xs text-gray-400 mt-1">Sent as <code class="bg-gray-100 px-1 rounded">X-Api-Key</code> header. Leave blank if WAHA has no auth.</p>
|
||||
</div>
|
||||
<div class="sm:col-span-2">
|
||||
<label class="text-xs font-semibold text-gray-600 block mb-1">Phone Number <span class="text-pink-400">*</span></label>
|
||||
<input type="text" name="config[phone]" class="input-soft text-sm"
|
||||
placeholder="628123456789 (country code, no +)">
|
||||
<label class="text-xs font-semibold text-gray-600 block mb-1">Chat ID <span class="text-pink-400">*</span></label>
|
||||
<input type="text" name="config[chat_id]" class="input-soft text-sm"
|
||||
placeholder="628123456789@c.us or 120363xxx@g.us">
|
||||
<p class="text-xs text-gray-400 mt-1">Individual: <code class="bg-gray-100 px-1 rounded">628xxx@c.us</code> · Group: <code class="bg-gray-100 px-1 rounded">120363xxx@g.us</code></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user