Compare commits
20 Commits
86176c99c7
...
Cathy's-Ap
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0e6726b0a6 | ||
|
|
737ba24293 | ||
|
|
a72eec3ead | ||
|
|
1c73279e52 | ||
|
|
47dfc7cc95 | ||
|
|
59a2724057 | ||
|
|
1c2c10d253 | ||
|
|
d6b10f725b | ||
|
|
ed9e7dc0fd | ||
|
|
12d44cbecc | ||
|
|
64092d3abc | ||
|
|
8b5992b7ce | ||
|
|
5656dc1f3a | ||
|
|
1e7a35ad4f | ||
|
|
79f2f22e5d | ||
|
|
15c8d3ae7c | ||
|
|
a0b294fa1c | ||
|
|
3f18dbaadf | ||
|
|
1b90f730a6 | ||
|
|
5748b163b6 |
@@ -29,6 +29,9 @@ database/database.sqlite
|
|||||||
public/build
|
public/build
|
||||||
public/hot
|
public/hot
|
||||||
|
|
||||||
|
# ── Local storage symlink (recreated by entrypoint.sh) ──
|
||||||
|
public/storage
|
||||||
|
|
||||||
# ── Tests / dev tooling ──────────────────────
|
# ── Tests / dev tooling ──────────────────────
|
||||||
tests
|
tests
|
||||||
phpunit.xml
|
phpunit.xml
|
||||||
@@ -44,7 +47,6 @@ Thumbs.db
|
|||||||
# ── Docker config itself ─────────────────────
|
# ── Docker config itself ─────────────────────
|
||||||
Dockerfile
|
Dockerfile
|
||||||
docker-compose*.yml
|
docker-compose*.yml
|
||||||
docker/
|
|
||||||
|
|
||||||
# ── Claude / project meta ────────────────────
|
# ── Claude / project meta ────────────────────
|
||||||
.claude
|
.claude
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
APP_NAME=Laravel
|
APP_NAME="KOL-Manager"
|
||||||
APP_ENV=local
|
APP_ENV=local
|
||||||
APP_KEY=
|
APP_KEY=
|
||||||
APP_DEBUG=true
|
APP_DEBUG=true
|
||||||
APP_URL=http://localhost
|
APP_URL=http://localhost
|
||||||
|
|
||||||
|
# ── App Gate Password ─────────────────────────────────────────────────────────
|
||||||
|
APP_PASSWORD=admin123
|
||||||
|
|
||||||
APP_LOCALE=en
|
APP_LOCALE=en
|
||||||
APP_FALLBACK_LOCALE=en
|
APP_FALLBACK_LOCALE=en
|
||||||
APP_FAKER_LOCALE=en_US
|
APP_FAKER_LOCALE=en_US
|
||||||
|
|||||||
15
Dockerfile
15
Dockerfile
@@ -24,12 +24,14 @@ RUN apk add --no-cache \
|
|||||||
nginx \
|
nginx \
|
||||||
supervisor \
|
supervisor \
|
||||||
sqlite \
|
sqlite \
|
||||||
|
sqlite-dev \
|
||||||
curl \
|
curl \
|
||||||
git \
|
git \
|
||||||
unzip \
|
unzip \
|
||||||
libpng-dev \
|
libpng-dev \
|
||||||
libjpeg-turbo-dev \
|
libjpeg-turbo-dev \
|
||||||
freetype-dev \
|
freetype-dev \
|
||||||
|
libwebp-dev \
|
||||||
libxml2-dev \
|
libxml2-dev \
|
||||||
libzip-dev \
|
libzip-dev \
|
||||||
icu-dev \
|
icu-dev \
|
||||||
@@ -40,6 +42,7 @@ RUN apk add --no-cache \
|
|||||||
RUN docker-php-ext-configure gd \
|
RUN docker-php-ext-configure gd \
|
||||||
--with-freetype \
|
--with-freetype \
|
||||||
--with-jpeg \
|
--with-jpeg \
|
||||||
|
--with-webp \
|
||||||
&& docker-php-ext-install -j"$(nproc)" \
|
&& docker-php-ext-install -j"$(nproc)" \
|
||||||
pdo \
|
pdo \
|
||||||
pdo_sqlite \
|
pdo_sqlite \
|
||||||
@@ -83,17 +86,20 @@ RUN chmod +x /entrypoint.sh
|
|||||||
|
|
||||||
# ── File system ──────────────────────────────
|
# ── File system ──────────────────────────────
|
||||||
RUN mkdir -p \
|
RUN mkdir -p \
|
||||||
|
storage/app/public \
|
||||||
storage/app/private/talent-assets \
|
storage/app/private/talent-assets \
|
||||||
storage/logs \
|
storage/logs \
|
||||||
storage/framework/cache \
|
storage/framework/cache \
|
||||||
storage/framework/sessions \
|
storage/framework/sessions \
|
||||||
storage/framework/views \
|
storage/framework/views \
|
||||||
|
storage \
|
||||||
bootstrap/cache \
|
bootstrap/cache \
|
||||||
database \
|
database \
|
||||||
&& chown -R www-data:www-data \
|
&& chown -R www-data:www-data \
|
||||||
storage \
|
storage \
|
||||||
bootstrap/cache \
|
bootstrap/cache \
|
||||||
database \
|
database \
|
||||||
|
/var/lib/nginx \
|
||||||
&& chmod -R 775 \
|
&& chmod -R 775 \
|
||||||
storage \
|
storage \
|
||||||
bootstrap/cache \
|
bootstrap/cache \
|
||||||
@@ -103,7 +109,7 @@ RUN mkdir -p \
|
|||||||
RUN sed -i 's/user = www-data/user = www-data/' /usr/local/etc/php-fpm.d/www.conf 2>/dev/null || true \
|
RUN sed -i 's/user = www-data/user = www-data/' /usr/local/etc/php-fpm.d/www.conf 2>/dev/null || true \
|
||||||
&& sed -i 's/group = www-data/group = www-data/' /usr/local/etc/php-fpm.d/www.conf 2>/dev/null || true
|
&& sed -i 's/group = www-data/group = www-data/' /usr/local/etc/php-fpm.d/www.conf 2>/dev/null || true
|
||||||
|
|
||||||
# ── OPcache tuning ───────────────────────────
|
# ── PHP Tuning & Upload Limits ─────────────────
|
||||||
RUN { \
|
RUN { \
|
||||||
echo "opcache.enable=1"; \
|
echo "opcache.enable=1"; \
|
||||||
echo "opcache.memory_consumption=128"; \
|
echo "opcache.memory_consumption=128"; \
|
||||||
@@ -113,6 +119,13 @@ RUN { \
|
|||||||
echo "opcache.fast_shutdown=1"; \
|
echo "opcache.fast_shutdown=1"; \
|
||||||
} > /usr/local/etc/php/conf.d/opcache.ini
|
} > /usr/local/etc/php/conf.d/opcache.ini
|
||||||
|
|
||||||
|
RUN { \
|
||||||
|
echo "upload_max_filesize = 500M"; \
|
||||||
|
echo "post_max_size = 500M"; \
|
||||||
|
echo "memory_limit = 512M"; \
|
||||||
|
echo "max_execution_time = 300"; \
|
||||||
|
} > /usr/local/etc/php/conf.d/uploads.ini
|
||||||
|
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
|
|||||||
12
How-To.txt
12
How-To.txt
@@ -1,6 +1,14 @@
|
|||||||
git clone this repository
|
# On local machine
|
||||||
|
#git clone this repository
|
||||||
composer install
|
composer install
|
||||||
#php artisan key:generate
|
php artisan key:generate
|
||||||
touch database/database.sqlite && php artisan migrate
|
touch database/database.sqlite && php artisan migrate
|
||||||
npm install
|
npm install
|
||||||
npm run build
|
npm run build
|
||||||
|
|
||||||
|
# On Docker
|
||||||
|
cp .env.example .env.docker
|
||||||
|
docker compose build
|
||||||
|
docker compose up -d
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -88,21 +88,17 @@ class BrandContractController extends Controller
|
|||||||
{
|
{
|
||||||
$categoryId = $request->integer('category_id');
|
$categoryId = $request->integer('category_id');
|
||||||
$clientId = $request->integer('client_id');
|
$clientId = $request->integer('client_id');
|
||||||
|
$dateStr = $request->input('date');
|
||||||
|
|
||||||
if (! $categoryId) {
|
if (! $categoryId || empty($dateStr)) {
|
||||||
return response()->json(null);
|
return response()->json(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Collect the category and its parent chain (so blocking a parent also blocks children)
|
$date = $dateStr ? \Carbon\Carbon::parse($dateStr) : today();
|
||||||
$category = ClientCategory::find($categoryId);
|
|
||||||
$checkIds = [$categoryId];
|
|
||||||
if ($category?->parent_id) {
|
|
||||||
$checkIds[] = $category->parent_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
$contract = BrandContract::with(['client', 'category'])
|
$contract = BrandContract::with(['client', 'category'])
|
||||||
->active()
|
->active($date)
|
||||||
->whereIn('category_id', $checkIds)
|
->where('category_id', $categoryId)
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
if (! $contract) {
|
if (! $contract) {
|
||||||
|
|||||||
@@ -46,6 +46,22 @@ class ClientCategoryController extends Controller
|
|||||||
return back()->with('success', '🏷️ Category added!');
|
return back()->with('success', '🏷️ Category added!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function quickStore(Request $request): \Illuminate\Http\JsonResponse
|
||||||
|
{
|
||||||
|
$validated = $request->validate([
|
||||||
|
'name' => 'required|string|max:100',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$validated['slug'] = \Illuminate\Support\Str::slug($validated['name']);
|
||||||
|
if (ClientCategory::where('slug', $validated['slug'])->exists()) {
|
||||||
|
$validated['slug'] .= '-' . substr(uniqid(), -4);
|
||||||
|
}
|
||||||
|
|
||||||
|
$category = ClientCategory::create($validated);
|
||||||
|
|
||||||
|
return response()->json(['id' => $category->id, 'name' => $category->name, 'icon' => '🏷️']);
|
||||||
|
}
|
||||||
|
|
||||||
public function update(Request $request, ClientCategory $category): RedirectResponse
|
public function update(Request $request, ClientCategory $category): RedirectResponse
|
||||||
{
|
{
|
||||||
$validated = $request->validate([
|
$validated = $request->validate([
|
||||||
|
|||||||
@@ -7,8 +7,10 @@ namespace App\Http\Controllers;
|
|||||||
use App\Enums\ClientStatus;
|
use App\Enums\ClientStatus;
|
||||||
use App\Models\Client;
|
use App\Models\Client;
|
||||||
use App\Models\ClientCategory;
|
use App\Models\ClientCategory;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
use Illuminate\Http\RedirectResponse;
|
use Illuminate\Http\RedirectResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
use Illuminate\View\View;
|
use Illuminate\View\View;
|
||||||
|
|
||||||
class ClientController extends Controller
|
class ClientController extends Controller
|
||||||
@@ -36,7 +38,7 @@ class ClientController extends Controller
|
|||||||
public function index(Request $request): View
|
public function index(Request $request): View
|
||||||
{
|
{
|
||||||
$query = Client::with('category')
|
$query = Client::with('category')
|
||||||
->withCount(['invoices', 'events', 'contentBriefs'])
|
->withCount(['invoices', 'events', 'contentBriefs', 'mediaFiles'])
|
||||||
->latest();
|
->latest();
|
||||||
|
|
||||||
if ($request->filled('category')) {
|
if ($request->filled('category')) {
|
||||||
@@ -92,13 +94,11 @@ class ClientController extends Controller
|
|||||||
|
|
||||||
public function show(Client $client): View
|
public function show(Client $client): View
|
||||||
{
|
{
|
||||||
$client->load([
|
$client->load('category');
|
||||||
'category',
|
$client->setRelation('events', $client->events()->latest()->limit(5)->get());
|
||||||
'events' => fn ($q) => $q->latest()->limit(5),
|
$client->setRelation('invoices', $client->invoices()->latest()->limit(5)->get());
|
||||||
'invoices' => fn ($q) => $q->latest()->limit(5),
|
$client->setRelation('contentBriefs', $client->contentBriefs()->latest()->limit(5)->get());
|
||||||
'contentBriefs'=> fn ($q) => $q->latest()->limit(5),
|
$client->setRelation('mediaFiles', $client->mediaFiles()->latest()->limit(10)->get());
|
||||||
'mediaFiles' => fn ($q) => $q->latest()->limit(10),
|
|
||||||
]);
|
|
||||||
|
|
||||||
return view('clients.show', compact('client'));
|
return view('clients.show', compact('client'));
|
||||||
}
|
}
|
||||||
@@ -146,4 +146,42 @@ class ClientController extends Controller
|
|||||||
return redirect()->route('clients.index')
|
return redirect()->route('clients.index')
|
||||||
->with('success', '🐱 Client removed.');
|
->with('success', '🐱 Client removed.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function quickStore(Request $request): JsonResponse
|
||||||
|
{
|
||||||
|
$validated = $request->validate([
|
||||||
|
'name' => 'required|string|max:255',
|
||||||
|
'email' => 'nullable|email|unique:clients,email',
|
||||||
|
'phone' => 'nullable|string|max:50',
|
||||||
|
'company' => 'nullable|string|max:255',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$client = Client::create(array_merge($validated, ['status' => 'active']));
|
||||||
|
|
||||||
|
return response()->json(['id' => $client->id, 'name' => $client->name]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function uploadAvatar(Request $request, Client $client): JsonResponse
|
||||||
|
{
|
||||||
|
$request->validate(['avatar' => 'required|image|max:2048']);
|
||||||
|
|
||||||
|
if ($client->avatar) {
|
||||||
|
Storage::disk('public')->delete($client->avatar);
|
||||||
|
}
|
||||||
|
|
||||||
|
$path = $request->file('avatar')->store('client-avatars', 'public');
|
||||||
|
$client->update(['avatar' => $path]);
|
||||||
|
|
||||||
|
return response()->json(['url' => asset('storage/' . $path)]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteAvatar(Client $client): JsonResponse
|
||||||
|
{
|
||||||
|
if ($client->avatar) {
|
||||||
|
Storage::disk('public')->delete($client->avatar);
|
||||||
|
$client->update(['avatar' => null]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return response()->json(['ok' => true]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,13 +4,17 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Enums\ContentStatus;
|
||||||
use App\Enums\EventStatus;
|
use App\Enums\EventStatus;
|
||||||
|
use App\Models\BrandContract;
|
||||||
use App\Models\Client;
|
use App\Models\Client;
|
||||||
use App\Models\ClientCategory;
|
use App\Models\ClientCategory;
|
||||||
|
use App\Models\ContentBrief;
|
||||||
use App\Models\Event;
|
use App\Models\Event;
|
||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
use Illuminate\Http\RedirectResponse;
|
use Illuminate\Http\RedirectResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
use Illuminate\View\View;
|
use Illuminate\View\View;
|
||||||
|
|
||||||
class EventController extends Controller
|
class EventController extends Controller
|
||||||
@@ -23,18 +27,34 @@ class EventController extends Controller
|
|||||||
->get();
|
->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function create(): View
|
||||||
|
{
|
||||||
|
$clients = Client::where('status', 'active')->orderBy('name')->get();
|
||||||
|
$categoryTree = $this->categoryTree();
|
||||||
|
|
||||||
|
return view('schedule.create', compact('clients', 'categoryTree'));
|
||||||
|
}
|
||||||
|
|
||||||
public function index(): View
|
public function index(): View
|
||||||
{
|
{
|
||||||
$events = Event::with('client')->orderBy('start_time')->get();
|
$events = Event::with('client')->orderBy('start_time')->get();
|
||||||
$clients = Client::where('status', 'active')->orderBy('name')->get();
|
$clients = Client::where('status', 'active')->orderBy('name')->get();
|
||||||
$categoryTree = $this->categoryTree();
|
$categoryTree = $this->categoryTree();
|
||||||
|
|
||||||
|
$contracts = BrandContract::select('client_id', 'title')->get();
|
||||||
|
$contents = ContentBrief::select('client_id', 'title')->get();
|
||||||
|
|
||||||
|
foreach ($events as $e) {
|
||||||
|
$e->has_contract = $e->client_id && $contracts->contains(fn($c) => $c->client_id === $e->client_id && stripos($c->title, $e->title) !== false);
|
||||||
|
$e->has_content = $e->client_id && $contents->contains(fn($c) => $c->client_id === $e->client_id && stripos($c->title, $e->title) !== false);
|
||||||
|
}
|
||||||
|
|
||||||
// Format for FullCalendar
|
// Format for FullCalendar
|
||||||
$calendarEvents = $events->map(fn (Event $e) => [
|
$calendarEvents = $events->map(fn (Event $e) => [
|
||||||
'id' => $e->id,
|
'id' => $e->id,
|
||||||
'title' => ($e->is_priority ? '⭐ ' : '') . $e->title,
|
'title' => ($e->is_priority ? '⭐ ' : '') . $e->title,
|
||||||
'start' => $e->start_time->toIso8601String(),
|
'start' => $e->start_time->format('Y-m-d\TH:i:s'),
|
||||||
'end' => $e->end_time?->toIso8601String(),
|
'end' => $e->end_time?->format('Y-m-d\TH:i:s'),
|
||||||
'backgroundColor' => $e->color,
|
'backgroundColor' => $e->color,
|
||||||
'borderColor' => $e->color,
|
'borderColor' => $e->color,
|
||||||
'extendedProps' => [
|
'extendedProps' => [
|
||||||
@@ -42,10 +62,23 @@ class EventController extends Controller
|
|||||||
'client' => $e->client?->name,
|
'client' => $e->client?->name,
|
||||||
'type' => $e->event_type,
|
'type' => $e->event_type,
|
||||||
'priority' => $e->is_priority,
|
'priority' => $e->is_priority,
|
||||||
|
'location' => $e->location,
|
||||||
|
'description' => $e->description,
|
||||||
|
'notes' => $e->notes,
|
||||||
|
'has_contract' => $e->has_contract,
|
||||||
|
'has_content' => $e->has_content,
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return view('schedule.index', compact('events', 'clients', 'calendarEvents', 'categoryTree'));
|
$holidays = \Illuminate\Support\Facades\Cache::remember('indonesian_holidays', 86400, function() {
|
||||||
|
$url = "https://libur.deno.dev/api";
|
||||||
|
$response = @file_get_contents($url);
|
||||||
|
if ($response === false) return [];
|
||||||
|
$data = json_decode($response, true);
|
||||||
|
return is_array($data) ? $data : [];
|
||||||
|
});
|
||||||
|
|
||||||
|
return view('schedule.index', compact('events', 'clients', 'calendarEvents', 'categoryTree', 'holidays'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function store(Request $request): RedirectResponse
|
public function store(Request $request): RedirectResponse
|
||||||
@@ -63,12 +96,47 @@ class EventController extends Controller
|
|||||||
'is_all_day' => 'boolean',
|
'is_all_day' => 'boolean',
|
||||||
'color' => 'nullable|string|max:20',
|
'color' => 'nullable|string|max:20',
|
||||||
'notes' => 'nullable|string',
|
'notes' => 'nullable|string',
|
||||||
|
'create_brand_contract' => 'nullable|boolean',
|
||||||
|
'contract_title' => 'nullable|string|max:255',
|
||||||
|
'contract_start_date' => 'nullable|date',
|
||||||
|
'contract_end_date' => 'nullable|date|after_or_equal:contract_start_date',
|
||||||
|
'add_to_content_board' => 'nullable|boolean',
|
||||||
|
'content_platform' => 'nullable|string|max:50',
|
||||||
|
'content_type' => 'nullable|string|max:50',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$validated['is_priority'] = $request->boolean('is_priority');
|
$validated['is_priority'] = $request->boolean('is_priority');
|
||||||
$validated['is_all_day'] = $request->boolean('is_all_day');
|
$validated['is_all_day'] = $request->boolean('is_all_day');
|
||||||
|
|
||||||
Event::create($validated);
|
$event = Event::create(Arr::except($validated, [
|
||||||
|
'create_brand_contract', 'contract_title', 'contract_start_date', 'contract_end_date',
|
||||||
|
'add_to_content_board', 'content_platform', 'content_type',
|
||||||
|
]));
|
||||||
|
|
||||||
|
if ($request->boolean('create_brand_contract') && $event->client_id) {
|
||||||
|
BrandContract::create([
|
||||||
|
'title' => $request->input('contract_title') ?: $event->title,
|
||||||
|
'client_id' => $event->client_id,
|
||||||
|
'category_id' => $event->category_id,
|
||||||
|
'start_date' => $request->input('contract_start_date') ?? $event->start_time->toDateString(),
|
||||||
|
'end_date' => $request->input('contract_end_date') ?? ($event->end_time?->toDateString() ?? $event->start_time->toDateString()),
|
||||||
|
'is_active' => true,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($request->boolean('add_to_content_board')) {
|
||||||
|
ContentBrief::create([
|
||||||
|
'title' => $event->title,
|
||||||
|
'client_id' => $event->client_id,
|
||||||
|
'category_id' => $event->category_id,
|
||||||
|
'platform' => $request->input('content_platform', 'instagram'),
|
||||||
|
'content_type' => $request->input('content_type', 'post'),
|
||||||
|
'status' => ContentStatus::Drafting,
|
||||||
|
'target_date' => $event->start_time->toDateString(),
|
||||||
|
'notes' => $event->notes,
|
||||||
|
'body' => $event->description,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
return redirect()->route('schedule.index')
|
return redirect()->route('schedule.index')
|
||||||
->with('success', '🐾 Event scheduled!');
|
->with('success', '🐾 Event scheduled!');
|
||||||
@@ -98,10 +166,27 @@ class EventController extends Controller
|
|||||||
'status' => 'required|in:pending,in_progress,completed,cancelled',
|
'status' => 'required|in:pending,in_progress,completed,cancelled',
|
||||||
'color' => 'nullable|string|max:20',
|
'color' => 'nullable|string|max:20',
|
||||||
'notes' => 'nullable|string',
|
'notes' => 'nullable|string',
|
||||||
|
'create_brand_contract' => 'nullable|boolean',
|
||||||
|
'contract_title' => 'nullable|string|max:255',
|
||||||
|
'contract_start_date' => 'nullable|date',
|
||||||
|
'contract_end_date' => 'nullable|date|after_or_equal:contract_start_date',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$validated['is_priority'] = $request->boolean('is_priority');
|
$validated['is_priority'] = $request->boolean('is_priority');
|
||||||
$event->update($validated);
|
$event->update(Arr::except($validated, [
|
||||||
|
'create_brand_contract', 'contract_title', 'contract_start_date', 'contract_end_date',
|
||||||
|
]));
|
||||||
|
|
||||||
|
if ($request->boolean('create_brand_contract') && $event->client_id) {
|
||||||
|
BrandContract::create([
|
||||||
|
'title' => $request->input('contract_title') ?: $event->title,
|
||||||
|
'client_id' => $event->client_id,
|
||||||
|
'category_id' => $event->category_id,
|
||||||
|
'start_date' => $request->input('contract_start_date') ?? $event->start_time->toDateString(),
|
||||||
|
'end_date' => $request->input('contract_end_date') ?? ($event->end_time?->toDateString() ?? $event->start_time->toDateString()),
|
||||||
|
'is_active' => true,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
return redirect()->route('schedule.index')
|
return redirect()->route('schedule.index')
|
||||||
->with('success', '🐾 Event updated!');
|
->with('success', '🐾 Event updated!');
|
||||||
@@ -129,11 +214,19 @@ class EventController extends Controller
|
|||||||
|
|
||||||
public function apiList(): JsonResponse
|
public function apiList(): JsonResponse
|
||||||
{
|
{
|
||||||
$events = Event::with('client')->get()->map(fn (Event $e) => [
|
$eventsList = Event::with('client')->get();
|
||||||
|
$contracts = BrandContract::select('client_id', 'title')->get();
|
||||||
|
$contents = ContentBrief::select('client_id', 'title')->get();
|
||||||
|
|
||||||
|
$events = $eventsList->map(function (Event $e) use ($contracts, $contents) {
|
||||||
|
$hasContract = $e->client_id && $contracts->contains(fn($c) => $c->client_id === $e->client_id && stripos($c->title, $e->title) !== false);
|
||||||
|
$hasContent = $e->client_id && $contents->contains(fn($c) => $c->client_id === $e->client_id && stripos($c->title, $e->title) !== false);
|
||||||
|
|
||||||
|
return [
|
||||||
'id' => $e->id,
|
'id' => $e->id,
|
||||||
'title' => ($e->is_priority ? '⭐ ' : '') . $e->title,
|
'title' => ($e->is_priority ? '⭐ ' : '') . $e->title,
|
||||||
'start' => $e->start_time->toIso8601String(),
|
'start' => $e->start_time->format('Y-m-d\TH:i:s'),
|
||||||
'end' => $e->end_time?->toIso8601String(),
|
'end' => $e->end_time?->format('Y-m-d\TH:i:s'),
|
||||||
'backgroundColor' => $e->color,
|
'backgroundColor' => $e->color,
|
||||||
'borderColor' => $e->color,
|
'borderColor' => $e->color,
|
||||||
'allDay' => $e->is_all_day,
|
'allDay' => $e->is_all_day,
|
||||||
@@ -142,8 +235,14 @@ class EventController extends Controller
|
|||||||
'client' => $e->client?->name,
|
'client' => $e->client?->name,
|
||||||
'type' => $e->event_type,
|
'type' => $e->event_type,
|
||||||
'priority' => $e->is_priority,
|
'priority' => $e->is_priority,
|
||||||
|
'location' => $e->location,
|
||||||
|
'description' => $e->description,
|
||||||
|
'notes' => $e->notes,
|
||||||
|
'has_contract' => $hasContract,
|
||||||
|
'has_content' => $hasContent,
|
||||||
],
|
],
|
||||||
]);
|
];
|
||||||
|
});
|
||||||
|
|
||||||
return response()->json($events);
|
return response()->json($events);
|
||||||
}
|
}
|
||||||
|
|||||||
44
app/Http/Controllers/GateController.php
Normal file
44
app/Http/Controllers/GateController.php
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\RedirectResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\View\View;
|
||||||
|
|
||||||
|
class GateController extends Controller
|
||||||
|
{
|
||||||
|
public function login(): View
|
||||||
|
{
|
||||||
|
return view('gate.login');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function attempt(Request $request): RedirectResponse
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'password' => 'required|string',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$expected = config('app.password');
|
||||||
|
|
||||||
|
if (! $expected || $request->input('password') !== $expected) {
|
||||||
|
return back()->withErrors(['password' => 'Wrong password. Please try again.']);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Store flag in session; expires with session lifetime (24 h in .env)
|
||||||
|
$request->session()->put('gate_authenticated', true);
|
||||||
|
$request->session()->regenerate();
|
||||||
|
|
||||||
|
return redirect()->intended(route('dashboard'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function logout(Request $request): RedirectResponse
|
||||||
|
{
|
||||||
|
$request->session()->forget('gate_authenticated');
|
||||||
|
$request->session()->regenerate();
|
||||||
|
|
||||||
|
return redirect()->route('gate.login');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -30,8 +30,7 @@ class InvoiceController extends Controller
|
|||||||
{
|
{
|
||||||
$clients = Client::where('status', 'active')->orderBy('name')->get();
|
$clients = Client::where('status', 'active')->orderBy('name')->get();
|
||||||
$statuses = InvoiceStatus::cases();
|
$statuses = InvoiceStatus::cases();
|
||||||
$invoiceSettings = InvoiceSettings::instance();
|
return view('invoices.create', compact('clients', 'statuses'));
|
||||||
return view('invoices.create', compact('clients', 'statuses', 'invoiceSettings'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function store(Request $request): RedirectResponse
|
public function store(Request $request): RedirectResponse
|
||||||
@@ -45,6 +44,9 @@ class InvoiceController extends Controller
|
|||||||
'issue_date' => 'required|date',
|
'issue_date' => 'required|date',
|
||||||
'due_date' => 'required|date|after_or_equal:issue_date',
|
'due_date' => 'required|date|after_or_equal:issue_date',
|
||||||
'notes' => 'nullable|string',
|
'notes' => 'nullable|string',
|
||||||
|
'signature_image' => 'nullable|image|max:2048',
|
||||||
|
'signer_name' => 'nullable|string|max:255',
|
||||||
|
'signer_title' => 'nullable|string|max:255',
|
||||||
'bank_name' => 'nullable|string|max:100',
|
'bank_name' => 'nullable|string|max:100',
|
||||||
'bank_account' => 'nullable|string|max:50',
|
'bank_account' => 'nullable|string|max:50',
|
||||||
'bank_holder' => 'nullable|string|max:100',
|
'bank_holder' => 'nullable|string|max:100',
|
||||||
@@ -54,12 +56,26 @@ class InvoiceController extends Controller
|
|||||||
'items.*.quantity' => 'required|integer|min:1',
|
'items.*.quantity' => 'required|integer|min:1',
|
||||||
'items.*.unit_price' => 'required|numeric|min:0',
|
'items.*.unit_price' => 'required|numeric|min:0',
|
||||||
'items.*.is_taxable' => 'nullable|boolean',
|
'items.*.is_taxable' => 'nullable|boolean',
|
||||||
|
'items.*.is_discountable' => 'nullable|boolean',
|
||||||
|
'discount_rate' => 'nullable|integer|min:0|max:100',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$items = $validated['items'];
|
$items = $validated['items'];
|
||||||
unset($validated['items']);
|
unset($validated['items']);
|
||||||
$validated['status'] = InvoiceStatus::Draft->value;
|
$validated['status'] = InvoiceStatus::Draft->value;
|
||||||
|
|
||||||
|
if ($request->hasFile('signature_image')) {
|
||||||
|
$validated['signature_image'] = $request->file('signature_image')->store('invoice-signatures', 'public');
|
||||||
|
} else {
|
||||||
|
// Fallback to settings signature if none provided at creation
|
||||||
|
$settings = InvoiceSettings::instance();
|
||||||
|
if ($settings->signature_image) {
|
||||||
|
// We reference the same image path, or copy it.
|
||||||
|
// Assuming referencing the same public image is fine.
|
||||||
|
$validated['signature_image'] = $settings->signature_image;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$invoice = $this->invoiceService->create($validated, $items);
|
$invoice = $this->invoiceService->create($validated, $items);
|
||||||
|
|
||||||
return redirect()->route('invoices.show', $invoice)
|
return redirect()->route('invoices.show', $invoice)
|
||||||
@@ -69,17 +85,15 @@ class InvoiceController extends Controller
|
|||||||
public function show(Invoice $invoice): View
|
public function show(Invoice $invoice): View
|
||||||
{
|
{
|
||||||
$invoice->load('client', 'items');
|
$invoice->load('client', 'items');
|
||||||
$invoiceSettings = InvoiceSettings::instance();
|
return view('invoices.show', compact('invoice'));
|
||||||
return view('invoices.show', compact('invoice', 'invoiceSettings'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function edit(Invoice $invoice): View
|
public function edit(Invoice $invoice): View
|
||||||
{
|
{
|
||||||
$clients = Client::where('status', 'active')->orderBy('name')->get();
|
$clients = Client::where('status', 'active')->orderBy('name')->get();
|
||||||
$statuses = InvoiceStatus::cases();
|
$statuses = InvoiceStatus::cases();
|
||||||
$invoiceSettings = InvoiceSettings::instance();
|
|
||||||
$invoice->load('client', 'items');
|
$invoice->load('client', 'items');
|
||||||
return view('invoices.edit', compact('invoice', 'clients', 'statuses', 'invoiceSettings'));
|
return view('invoices.edit', compact('invoice', 'clients', 'statuses'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update(Request $request, Invoice $invoice): RedirectResponse
|
public function update(Request $request, Invoice $invoice): RedirectResponse
|
||||||
@@ -94,6 +108,9 @@ class InvoiceController extends Controller
|
|||||||
'due_date' => 'required|date',
|
'due_date' => 'required|date',
|
||||||
'paid_date' => 'nullable|date',
|
'paid_date' => 'nullable|date',
|
||||||
'notes' => 'nullable|string',
|
'notes' => 'nullable|string',
|
||||||
|
'signature_image' => 'nullable|image|max:2048',
|
||||||
|
'signer_name' => 'nullable|string|max:255',
|
||||||
|
'signer_title' => 'nullable|string|max:255',
|
||||||
'bank_name' => 'nullable|string|max:100',
|
'bank_name' => 'nullable|string|max:100',
|
||||||
'bank_account' => 'nullable|string|max:50',
|
'bank_account' => 'nullable|string|max:50',
|
||||||
'bank_holder' => 'nullable|string|max:100',
|
'bank_holder' => 'nullable|string|max:100',
|
||||||
@@ -103,11 +120,25 @@ class InvoiceController extends Controller
|
|||||||
'items.*.quantity' => 'required|integer|min:1',
|
'items.*.quantity' => 'required|integer|min:1',
|
||||||
'items.*.unit_price' => 'required|numeric|min:0',
|
'items.*.unit_price' => 'required|numeric|min:0',
|
||||||
'items.*.is_taxable' => 'nullable|boolean',
|
'items.*.is_taxable' => 'nullable|boolean',
|
||||||
|
'items.*.is_discountable' => 'nullable|boolean',
|
||||||
|
'discount_rate' => 'nullable|integer|min:0|max:100',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$items = $validated['items'];
|
$items = $validated['items'];
|
||||||
unset($validated['items']);
|
unset($validated['items']);
|
||||||
|
|
||||||
|
if ($request->hasFile('signature_image')) {
|
||||||
|
if ($invoice->signature_image && \Illuminate\Support\Facades\Storage::disk('public')->exists($invoice->signature_image)) {
|
||||||
|
\Illuminate\Support\Facades\Storage::disk('public')->delete($invoice->signature_image);
|
||||||
|
}
|
||||||
|
$validated['signature_image'] = $request->file('signature_image')->store('invoice-signatures', 'public');
|
||||||
|
} elseif ($request->boolean('remove_signature')) {
|
||||||
|
if ($invoice->signature_image && \Illuminate\Support\Facades\Storage::disk('public')->exists($invoice->signature_image)) {
|
||||||
|
\Illuminate\Support\Facades\Storage::disk('public')->delete($invoice->signature_image);
|
||||||
|
}
|
||||||
|
$validated['signature_image'] = null;
|
||||||
|
}
|
||||||
|
|
||||||
$this->invoiceService->update($invoice, $validated, $items);
|
$this->invoiceService->update($invoice, $validated, $items);
|
||||||
|
|
||||||
return redirect()->route('invoices.show', $invoice)
|
return redirect()->route('invoices.show', $invoice)
|
||||||
@@ -124,4 +155,9 @@ class InvoiceController extends Controller
|
|||||||
{
|
{
|
||||||
return $this->invoiceService->generatePdf($invoice);
|
return $this->invoiceService->generatePdf($invoice);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function pdfLegacy(Invoice $invoice): Response
|
||||||
|
{
|
||||||
|
return $this->invoiceService->generateLegacyPdf($invoice);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\Models\InvoiceSettings;
|
use App\Models\InvoiceSettings;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
use Illuminate\Http\RedirectResponse;
|
use Illuminate\Http\RedirectResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
@@ -26,6 +27,7 @@ class InvoiceSettingsController extends Controller
|
|||||||
'header_name' => 'nullable|string|max:100',
|
'header_name' => 'nullable|string|max:100',
|
||||||
'header_title' => 'nullable|string|max:150',
|
'header_title' => 'nullable|string|max:150',
|
||||||
'header_logo' => 'nullable|image|max:2048',
|
'header_logo' => 'nullable|image|max:2048',
|
||||||
|
'accent_color' => 'nullable|string|max:20',
|
||||||
'default_tax_rate' => 'nullable|numeric|min:0|max:100',
|
'default_tax_rate' => 'nullable|numeric|min:0|max:100',
|
||||||
'default_currency' => 'nullable|string|max:10',
|
'default_currency' => 'nullable|string|max:10',
|
||||||
'default_service_description'=> 'nullable|string|max:255',
|
'default_service_description'=> 'nullable|string|max:255',
|
||||||
@@ -34,22 +36,100 @@ class InvoiceSettingsController extends Controller
|
|||||||
'default_bank_account' => 'nullable|string|max:50',
|
'default_bank_account' => 'nullable|string|max:50',
|
||||||
'default_bank_holder' => 'nullable|string|max:100',
|
'default_bank_holder' => 'nullable|string|max:100',
|
||||||
'default_notes' => 'nullable|string|max:1000',
|
'default_notes' => 'nullable|string|max:1000',
|
||||||
|
'signature_image' => 'nullable|image|max:2048',
|
||||||
|
'signer_name' => 'nullable|string|max:100',
|
||||||
|
'signer_title' => 'nullable|string|max:100',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$settings = InvoiceSettings::instance();
|
$settings = InvoiceSettings::instance();
|
||||||
|
|
||||||
if ($request->hasFile('header_logo')) {
|
if ($request->hasFile('header_logo')) {
|
||||||
// Delete old logo if exists
|
// Delete old logo if exists
|
||||||
if ($settings->header_logo) {
|
if ($settings->header_logo && Storage::disk('public')->exists($settings->header_logo)) {
|
||||||
Storage::disk('public')->delete($settings->header_logo);
|
Storage::disk('public')->delete($settings->header_logo);
|
||||||
}
|
}
|
||||||
$path = $request->file('header_logo')->store('invoice-logos', 'public');
|
$path = $request->file('header_logo')->store('invoice-logos', 'public');
|
||||||
$validated['header_logo'] = $path;
|
$validated['header_logo'] = $path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($request->hasFile('signature_image')) {
|
||||||
|
if ($settings->signature_image && Storage::disk('public')->exists($settings->signature_image)) {
|
||||||
|
Storage::disk('public')->delete($settings->signature_image);
|
||||||
|
}
|
||||||
|
$validated['signature_image'] = $request->file('signature_image')->store('invoice-signatures', 'public');
|
||||||
|
} elseif ($request->boolean('remove_signature')) {
|
||||||
|
if ($settings->signature_image && Storage::disk('public')->exists($settings->signature_image)) {
|
||||||
|
Storage::disk('public')->delete($settings->signature_image);
|
||||||
|
}
|
||||||
|
$validated['signature_image'] = null;
|
||||||
|
}
|
||||||
|
|
||||||
$settings->update($validated);
|
$settings->update($validated);
|
||||||
|
|
||||||
return redirect()->route('invoice-settings.edit')
|
return redirect()->route('invoice-settings.edit')
|
||||||
->with('success', '🧾 Invoice settings saved!');
|
->with('success', '🧾 Invoice settings saved!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function uploadLogo(Request $request): JsonResponse
|
||||||
|
{
|
||||||
|
$request->validate(['header_logo' => 'required|image|max:2048']);
|
||||||
|
|
||||||
|
$settings = InvoiceSettings::instance();
|
||||||
|
|
||||||
|
if ($settings->header_logo) {
|
||||||
|
Storage::disk('public')->delete($settings->header_logo);
|
||||||
|
}
|
||||||
|
|
||||||
|
$path = $request->file('header_logo')->store('invoice-logos', 'public');
|
||||||
|
$settings->update(['header_logo' => $path]);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'url' => '/storage/' . $path,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteLogo(): RedirectResponse
|
||||||
|
{
|
||||||
|
$settings = InvoiceSettings::instance();
|
||||||
|
|
||||||
|
if ($settings->header_logo) {
|
||||||
|
Storage::disk('public')->delete($settings->header_logo);
|
||||||
|
$settings->update(['header_logo' => null]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return redirect()->route('invoice-settings.edit')
|
||||||
|
->with('success', '🗑️ Logo removed.');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function uploadSignature(Request $request): JsonResponse
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'signature_image' => 'required|image|max:2048',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$settings = InvoiceSettings::instance();
|
||||||
|
|
||||||
|
// Delete old signature if exists
|
||||||
|
if ($settings->signature_image && Storage::disk('public')->exists($settings->signature_image)) {
|
||||||
|
Storage::disk('public')->delete($settings->signature_image);
|
||||||
|
}
|
||||||
|
|
||||||
|
$path = $request->file('signature_image')->store('invoice-signatures', 'public');
|
||||||
|
$settings->update(['signature_image' => $path]);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'url' => '/storage/' . $path,
|
||||||
|
'path' => $path
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteSignature(Request $request): JsonResponse
|
||||||
|
{
|
||||||
|
$settings = InvoiceSettings::instance();
|
||||||
|
if ($settings->signature_image && Storage::disk('public')->exists($settings->signature_image)) {
|
||||||
|
Storage::disk('public')->delete($settings->signature_image);
|
||||||
|
}
|
||||||
|
$settings->update(['signature_image' => null]);
|
||||||
|
return response()->json(['message' => 'Signature deleted']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ class MediaFileController extends Controller
|
|||||||
$this->fileService->uploadAsset(
|
$this->fileService->uploadAsset(
|
||||||
$request->file('file'),
|
$request->file('file'),
|
||||||
$request->input('folder'),
|
$request->input('folder'),
|
||||||
$request->input('client_id')
|
$request->filled('client_id') ? (int) $request->input('client_id') : null
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($request->expectsJson() || $request->ajax()) {
|
if ($request->expectsJson() || $request->ajax()) {
|
||||||
|
|||||||
64
app/Http/Controllers/NoteController.php
Normal file
64
app/Http/Controllers/NoteController.php
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\Note;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\View\View;
|
||||||
|
|
||||||
|
class NoteController extends Controller
|
||||||
|
{
|
||||||
|
public function index(): View
|
||||||
|
{
|
||||||
|
$notes = Note::orderByDesc('is_pinned')
|
||||||
|
->orderByDesc('updated_at')
|
||||||
|
->get();
|
||||||
|
|
||||||
|
return view('notes.index', compact('notes'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request): JsonResponse
|
||||||
|
{
|
||||||
|
$data = $request->validate([
|
||||||
|
'title' => 'required|string|max:255',
|
||||||
|
'content' => 'nullable|array',
|
||||||
|
'color' => 'nullable|string|max:20',
|
||||||
|
'is_pinned' => 'boolean',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$note = Note::create($data);
|
||||||
|
|
||||||
|
return response()->json($note, 201);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(Request $request, Note $note): JsonResponse
|
||||||
|
{
|
||||||
|
$data = $request->validate([
|
||||||
|
'title' => 'required|string|max:255',
|
||||||
|
'content' => 'nullable|array',
|
||||||
|
'color' => 'nullable|string|max:20',
|
||||||
|
'is_pinned' => 'boolean',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$note->update($data);
|
||||||
|
|
||||||
|
return response()->json($note);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy(Note $note): JsonResponse
|
||||||
|
{
|
||||||
|
$note->delete();
|
||||||
|
|
||||||
|
return response()->json(['ok' => true]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function togglePin(Note $note): JsonResponse
|
||||||
|
{
|
||||||
|
$note->update(['is_pinned' => ! $note->is_pinned]);
|
||||||
|
|
||||||
|
return response()->json($note);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,8 +17,7 @@ class RateCardController extends Controller
|
|||||||
public function index(): View
|
public function index(): View
|
||||||
{
|
{
|
||||||
$rateCards = RateCard::orderBy('sort_order')->orderBy('platform')->get();
|
$rateCards = RateCard::orderBy('sort_order')->orderBy('platform')->get();
|
||||||
$profile = RateCardProfile::getSingleton();
|
return view('rate-cards.index', compact('rateCards'));
|
||||||
return view('rate-cards.index', compact('rateCards', 'profile'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function create(): View
|
public function create(): View
|
||||||
@@ -88,22 +87,21 @@ class RateCardController extends Controller
|
|||||||
|
|
||||||
public function public(): View
|
public function public(): View
|
||||||
{
|
{
|
||||||
$profile = RateCardProfile::getSingleton();
|
|
||||||
$rateCards = RateCard::where('is_active', true)
|
$rateCards = RateCard::where('is_active', true)
|
||||||
->orderBy('sort_order')
|
->orderBy('sort_order')
|
||||||
->orderBy('platform')
|
->orderBy('platform')
|
||||||
->get()
|
->get()
|
||||||
->groupBy('platform');
|
->groupBy('platform');
|
||||||
|
|
||||||
return view('rate-cards.public', compact('rateCards', 'profile'));
|
return view('rate-cards.public', compact('rateCards'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── Profile Settings ─────────────────────────────────────────
|
// ── Profile Settings ─────────────────────────────────────────
|
||||||
|
|
||||||
public function profilePage(): View
|
public function profilePage(): View
|
||||||
{
|
{
|
||||||
$profile = RateCardProfile::getSingleton();
|
$mediaFiles = \App\Models\MediaFile::latest()->get();
|
||||||
return view('rate-cards.profile', compact('profile'));
|
return view('rate-cards.profile', compact('mediaFiles'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function profileUpdate(Request $request): RedirectResponse
|
public function profileUpdate(Request $request): RedirectResponse
|
||||||
@@ -119,9 +117,19 @@ class RateCardController extends Controller
|
|||||||
'bg_color' => 'nullable|string|max:20',
|
'bg_color' => 'nullable|string|max:20',
|
||||||
'accent_color' => 'nullable|string|max:20',
|
'accent_color' => 'nullable|string|max:20',
|
||||||
'text_color' => 'nullable|string|max:20',
|
'text_color' => 'nullable|string|max:20',
|
||||||
'custom_footer' => 'nullable|string|max:500',
|
'custom_footer' => 'nullable|string|max:255',
|
||||||
'show_prices' => 'boolean',
|
'show_prices' => 'nullable|boolean',
|
||||||
|
'terms_and_conditions' => 'nullable|string',
|
||||||
|
'brand_logo_size' => 'nullable|in:small,medium,large',
|
||||||
|
'contact_person_html' => 'nullable|string',
|
||||||
'logo' => 'nullable|image|max:2048',
|
'logo' => 'nullable|image|max:2048',
|
||||||
|
'content_showcase' => 'nullable|array',
|
||||||
|
'content_showcase.*.file_id' => 'required_with:content_showcase|string',
|
||||||
|
'content_showcase.*.name' => 'required_with:content_showcase|string|max:255',
|
||||||
|
'content_showcase.*.url' => 'nullable|url',
|
||||||
|
'content_showcase.*.thumbnail_path' => 'nullable|string',
|
||||||
|
'content_showcase.*.show_on_public' => 'nullable',
|
||||||
|
'content_showcase.*.show_on_pdf' => 'nullable',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$profile = RateCardProfile::getSingleton();
|
$profile = RateCardProfile::getSingleton();
|
||||||
@@ -131,7 +139,13 @@ class RateCardController extends Controller
|
|||||||
$validated['logo_path'] = $path;
|
$validated['logo_path'] = $path;
|
||||||
}
|
}
|
||||||
|
|
||||||
$validated['show_prices'] = $request->boolean('show_prices');
|
$validated['show_prices'] = $request->has('show_prices');
|
||||||
|
$contentShowcase = $validated['content_showcase'] ?? [];
|
||||||
|
foreach ($contentShowcase as &$item) {
|
||||||
|
$item['show_on_public'] = filter_var($item['show_on_public'] ?? true, FILTER_VALIDATE_BOOLEAN);
|
||||||
|
$item['show_on_pdf'] = filter_var($item['show_on_pdf'] ?? true, FILTER_VALIDATE_BOOLEAN);
|
||||||
|
}
|
||||||
|
$validated['content_showcase'] = $contentShowcase;
|
||||||
unset($validated['logo']);
|
unset($validated['logo']);
|
||||||
|
|
||||||
$profile->update($validated);
|
$profile->update($validated);
|
||||||
@@ -139,6 +153,70 @@ class RateCardController extends Controller
|
|||||||
return back()->with('success', '🎨 Profile updated!');
|
return back()->with('success', '🎨 Profile updated!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function uploadLogo(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'logo' => 'required|image|max:2048',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$profile = RateCardProfile::getSingleton();
|
||||||
|
|
||||||
|
if ($profile->logo_path) {
|
||||||
|
\Storage::disk('private')->delete($profile->logo_path);
|
||||||
|
}
|
||||||
|
|
||||||
|
$path = $request->file('logo')->store('profile', 'private');
|
||||||
|
$profile->update(['logo_path' => $path]);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'url' => route('files.serve-profile-logo'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteLogo()
|
||||||
|
{
|
||||||
|
$profile = RateCardProfile::getSingleton();
|
||||||
|
|
||||||
|
if ($profile->logo_path) {
|
||||||
|
\Storage::disk('private')->delete($profile->logo_path);
|
||||||
|
$profile->update(['logo_path' => null]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return response()->json(['success' => true]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function uploadBrandLogo(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate(['logo' => 'required|image|max:2048']);
|
||||||
|
$profile = RateCardProfile::getSingleton();
|
||||||
|
$path = $request->file('logo')->store('brands', 'public');
|
||||||
|
|
||||||
|
$brands = $profile->past_brands ?? [];
|
||||||
|
$brands[] = $path;
|
||||||
|
$profile->update(['past_brands' => $brands]);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'path' => $path,
|
||||||
|
'url' => asset('storage/' . $path)
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteBrandLogo(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate(['path' => 'required|string']);
|
||||||
|
$path = $request->input('path');
|
||||||
|
$profile = RateCardProfile::getSingleton();
|
||||||
|
$brands = $profile->past_brands ?? [];
|
||||||
|
|
||||||
|
if (($key = array_search($path, $brands)) !== false) {
|
||||||
|
unset($brands[$key]);
|
||||||
|
$profile->update(['past_brands' => array_values($brands)]);
|
||||||
|
Storage::disk('public')->delete($path);
|
||||||
|
}
|
||||||
|
|
||||||
|
return response()->json(['success' => true]);
|
||||||
|
}
|
||||||
|
|
||||||
public function serveProfileLogo(): Response
|
public function serveProfileLogo(): Response
|
||||||
{
|
{
|
||||||
$profile = RateCardProfile::getSingleton();
|
$profile = RateCardProfile::getSingleton();
|
||||||
@@ -155,6 +233,17 @@ class RateCardController extends Controller
|
|||||||
|
|
||||||
// ── PDF Download ─────────────────────────────────────────────
|
// ── PDF Download ─────────────────────────────────────────────
|
||||||
|
|
||||||
|
public function uploadShowcaseThumbnail(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate(['thumbnail' => 'required|image|max:2048']);
|
||||||
|
$path = $request->file('thumbnail')->store('showcase', 'public');
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'path' => $path,
|
||||||
|
'url' => asset('storage/' . $path)
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
public function pdf(): \Illuminate\Http\Response
|
public function pdf(): \Illuminate\Http\Response
|
||||||
{
|
{
|
||||||
$profile = RateCardProfile::getSingleton();
|
$profile = RateCardProfile::getSingleton();
|
||||||
@@ -165,7 +254,7 @@ class RateCardController extends Controller
|
|||||||
->groupBy('platform');
|
->groupBy('platform');
|
||||||
|
|
||||||
$pdf = Pdf::loadView('rate-cards.pdf', compact('rateCards', 'profile'))
|
$pdf = Pdf::loadView('rate-cards.pdf', compact('rateCards', 'profile'))
|
||||||
->setPaper('a4', 'portrait');
|
->setPaper('a4', 'landscape');
|
||||||
|
|
||||||
$filename = 'rate-card-' . now()->format('Y-m-d') . '.pdf';
|
$filename = 'rate-card-' . now()->format('Y-m-d') . '.pdf';
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ class SearchController extends Controller
|
|||||||
{
|
{
|
||||||
public function index(Request $request): View
|
public function index(Request $request): View
|
||||||
{
|
{
|
||||||
$q = trim($request->get('q', ''));
|
$q = trim((string) $request->get('q', ''));
|
||||||
$results = $q ? $this->search($q) : [];
|
$results = $q ? $this->search($q) : [];
|
||||||
|
|
||||||
return view('search.index', compact('q', 'results'));
|
return view('search.index', compact('q', 'results'));
|
||||||
@@ -26,7 +26,7 @@ class SearchController extends Controller
|
|||||||
/** Quick AJAX endpoint — returns grouped results for the dropdown */
|
/** Quick AJAX endpoint — returns grouped results for the dropdown */
|
||||||
public function quick(Request $request): JsonResponse
|
public function quick(Request $request): JsonResponse
|
||||||
{
|
{
|
||||||
$q = trim($request->get('q', ''));
|
$q = trim((string) $request->get('q', ''));
|
||||||
|
|
||||||
if (strlen($q) < 2) {
|
if (strlen($q) < 2) {
|
||||||
return response()->json([]);
|
return response()->json([]);
|
||||||
@@ -138,6 +138,24 @@ class SearchController extends Controller
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ── Notes ───────────────────────────────────────────
|
||||||
|
$notes = \App\Models\Note::where('title', 'LIKE', $like)
|
||||||
|
->orWhere('content', 'LIKE', $like)
|
||||||
|
->limit($limit)->get();
|
||||||
|
|
||||||
|
if ($notes->isNotEmpty()) {
|
||||||
|
$groups[] = [
|
||||||
|
'type' => 'notes',
|
||||||
|
'label' => '📝 Notes',
|
||||||
|
'items' => $notes->map(fn ($n) => [
|
||||||
|
'icon' => '📝',
|
||||||
|
'title' => $n->title ?: 'Untitled',
|
||||||
|
'subtitle' => 'Notes Management',
|
||||||
|
'url' => route('notes.index'),
|
||||||
|
])->values()->all(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
return $groups;
|
return $groups;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
26
app/Http/Middleware/GateAuth.php
Normal file
26
app/Http/Middleware/GateAuth.php
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
|
||||||
|
class GateAuth
|
||||||
|
{
|
||||||
|
public function handle(Request $request, Closure $next): Response
|
||||||
|
{
|
||||||
|
// Allow the login routes through without auth check
|
||||||
|
if ($request->routeIs('gate.login', 'gate.attempt', 'gate.logout', 'rate-cards.public')) {
|
||||||
|
return $next($request);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $request->session()->get('gate_authenticated')) {
|
||||||
|
return redirect()->route('gate.login');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $next($request);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -34,11 +34,12 @@ class BrandContract extends Model
|
|||||||
|
|
||||||
// ── Scopes ───────────────────────────────────────────────────
|
// ── Scopes ───────────────────────────────────────────────────
|
||||||
|
|
||||||
public function scopeActive($query)
|
public function scopeActive($query, $date = null)
|
||||||
{
|
{
|
||||||
|
$date = $date ?? today();
|
||||||
return $query->where('is_active', true)
|
return $query->where('is_active', true)
|
||||||
->where('start_date', '<=', today())
|
->where('start_date', '<=', $date)
|
||||||
->where('end_date', '>=', today());
|
->where('end_date', '>=', $date);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── Helpers ──────────────────────────────────────────────────
|
// ── Helpers ──────────────────────────────────────────────────
|
||||||
|
|||||||
@@ -57,14 +57,19 @@ class Client extends Model
|
|||||||
|
|
||||||
public function getFullAddressAttribute(): string
|
public function getFullAddressAttribute(): string
|
||||||
{
|
{
|
||||||
|
$line3_parts = array_filter([$this->city, $this->state]);
|
||||||
|
$country_part = array_filter([$this->postal_code, $this->country]);
|
||||||
|
$country_str = implode(' - ', $country_part);
|
||||||
|
if ($country_str) {
|
||||||
|
$line3_parts[] = $country_str;
|
||||||
|
}
|
||||||
|
$line3 = implode(', ', $line3_parts);
|
||||||
|
|
||||||
return collect([
|
return collect([
|
||||||
$this->address_line1,
|
$this->address_line1,
|
||||||
$this->address_line2,
|
$this->address_line2,
|
||||||
$this->city,
|
$line3
|
||||||
$this->state,
|
])->filter()->implode("\n");
|
||||||
$this->postal_code,
|
|
||||||
$this->country,
|
|
||||||
])->filter()->implode(', ');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getInitialsAttribute(): string
|
public function getInitialsAttribute(): string
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ class Invoice extends Model
|
|||||||
'subtotal', 'tax_rate', 'tax_amount', 'total', 'currency',
|
'subtotal', 'tax_rate', 'tax_amount', 'total', 'currency',
|
||||||
'status', 'issue_date', 'due_date', 'paid_date', 'notes',
|
'status', 'issue_date', 'due_date', 'paid_date', 'notes',
|
||||||
'bank_name', 'bank_account', 'bank_holder', 'branch_name',
|
'bank_name', 'bank_account', 'bank_holder', 'branch_name',
|
||||||
|
'signature_image', 'signer_name', 'signer_title', 'discount_rate',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
@@ -46,14 +47,32 @@ class Invoice extends Model
|
|||||||
|
|
||||||
public function recalculate(): void
|
public function recalculate(): void
|
||||||
{
|
{
|
||||||
// Total of all items (what the creator receives)
|
// Total of all items
|
||||||
$this->subtotal = $this->items->sum('total');
|
$this->subtotal = $this->items->sum('total');
|
||||||
|
|
||||||
// Tax is calculated only on taxable items, but paid by the client on top
|
$discountAmount = 0;
|
||||||
$taxableSubtotal = $this->items->where('is_taxable', true)->sum('total');
|
if ($this->discount_rate > 0) {
|
||||||
|
$discountableSubtotal = $this->items->where('is_discountable', true)->sum('total');
|
||||||
|
$discountAmount = round((float) $discountableSubtotal * ($this->discount_rate / 100), 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->subtotal = $this->subtotal - $discountAmount;
|
||||||
|
|
||||||
|
// Tax is calculated only on taxable items
|
||||||
|
$taxableSubtotal = 0;
|
||||||
|
foreach ($this->items as $item) {
|
||||||
|
if ($item->is_taxable) {
|
||||||
|
if ($this->discount_rate > 0 && $item->is_discountable) {
|
||||||
|
$taxableSubtotal += $item->total * (1 - $this->discount_rate / 100);
|
||||||
|
} else {
|
||||||
|
$taxableSubtotal += $item->total;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$this->tax_amount = round((float) $taxableSubtotal * ($this->tax_rate / 100), 2);
|
$this->tax_amount = round((float) $taxableSubtotal * ($this->tax_rate / 100), 2);
|
||||||
|
|
||||||
// Grand total = subtotal (creator's fee, pre-tax — tax is borne by client separately)
|
// Grand total = subtotal (tax is borne by client separately)
|
||||||
$this->total = $this->subtotal;
|
$this->total = $this->subtotal;
|
||||||
$this->save();
|
$this->save();
|
||||||
}
|
}
|
||||||
@@ -63,6 +82,14 @@ class Invoice extends Model
|
|||||||
return 'Rp ' . number_format((float) $this->total, 0, ',', '.');
|
return 'Rp ' . number_format((float) $this->total, 0, ',', '.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getDiscountAmountAttribute(): float
|
||||||
|
{
|
||||||
|
if ($this->discount_rate <= 0) return 0.0;
|
||||||
|
|
||||||
|
$discountableSubtotal = $this->items->where('is_discountable', true)->sum('total');
|
||||||
|
return round((float) $discountableSubtotal * ($this->discount_rate / 100), 2);
|
||||||
|
}
|
||||||
|
|
||||||
public static function generateNumber(): string
|
public static function generateNumber(): string
|
||||||
{
|
{
|
||||||
return InvoiceSettings::generateNumber();
|
return InvoiceSettings::generateNumber();
|
||||||
|
|||||||
@@ -9,12 +9,13 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|||||||
|
|
||||||
class InvoiceItem extends Model
|
class InvoiceItem extends Model
|
||||||
{
|
{
|
||||||
protected $fillable = ['invoice_id', 'description', 'quantity', 'unit_price', 'total', 'is_taxable'];
|
protected $fillable = ['invoice_id', 'description', 'quantity', 'unit_price', 'total', 'is_taxable', 'is_discountable'];
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'unit_price' => 'decimal:2',
|
'unit_price' => 'decimal:2',
|
||||||
'total' => 'decimal:2',
|
'total' => 'decimal:2',
|
||||||
'is_taxable' => 'boolean',
|
'is_taxable' => 'boolean',
|
||||||
|
'is_discountable' => 'boolean',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function invoice(): BelongsTo
|
public function invoice(): BelongsTo
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ class InvoiceSettings extends Model
|
|||||||
'header_name',
|
'header_name',
|
||||||
'header_title',
|
'header_title',
|
||||||
'header_logo',
|
'header_logo',
|
||||||
|
'accent_color',
|
||||||
'default_tax_rate',
|
'default_tax_rate',
|
||||||
'default_currency',
|
'default_currency',
|
||||||
'default_service_description',
|
'default_service_description',
|
||||||
@@ -24,6 +25,9 @@ class InvoiceSettings extends Model
|
|||||||
'default_bank_account',
|
'default_bank_account',
|
||||||
'default_bank_holder',
|
'default_bank_holder',
|
||||||
'default_notes',
|
'default_notes',
|
||||||
|
'signature_image',
|
||||||
|
'signer_name',
|
||||||
|
'signer_title',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
@@ -31,24 +35,39 @@ class InvoiceSettings extends Model
|
|||||||
'default_tax_rate' => 'decimal:2',
|
'default_tax_rate' => 'decimal:2',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
protected static ?self $instance = null;
|
||||||
|
|
||||||
/** Always return the single settings row, creating it if absent. */
|
/** Always return the single settings row, creating it if absent. */
|
||||||
public static function instance(): self
|
public static function instance(): self
|
||||||
{
|
{
|
||||||
return static::firstOrCreate([], [
|
if (self::$instance) {
|
||||||
'invoice_prefix' => 'INV',
|
return self::$instance;
|
||||||
'invoice_next_number' => 1,
|
}
|
||||||
'default_tax_rate' => 11,
|
|
||||||
'default_currency' => 'IDR',
|
self::$instance = static::firstOrCreate([], [
|
||||||
]);
|
'invoice_prefix' => 'INV',
|
||||||
|
'invoice_next_number' => 1,
|
||||||
|
'accent_color' => '#FFB7C5',
|
||||||
|
'default_tax_rate' => 2.5,
|
||||||
|
'default_currency' => 'IDR',
|
||||||
|
]);
|
||||||
|
|
||||||
|
return self::$instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static function booted()
|
||||||
|
{
|
||||||
|
static::saved(fn ($model) => self::$instance = $model);
|
||||||
|
static::deleted(fn () => self::$instance = null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Generate the next invoice number and increment the counter. */
|
|
||||||
public static function generateNumber(): string
|
public static function generateNumber(): string
|
||||||
{
|
{
|
||||||
$settings = static::instance();
|
$settings = static::instance();
|
||||||
$prefix = rtrim($settings->invoice_prefix, '-');
|
$prefix = rtrim($settings->invoice_prefix, '-');
|
||||||
$number = str_pad((string) $settings->invoice_next_number, 3, '0', STR_PAD_LEFT);
|
$number = str_pad((string) $settings->invoice_next_number, 3, '0', STR_PAD_LEFT);
|
||||||
$settings->increment('invoice_next_number');
|
$settings->increment('invoice_next_number');
|
||||||
|
\Illuminate\Support\Facades\Cache::forget('invoice_settings');
|
||||||
return $prefix . '-' . $number;
|
return $prefix . '-' . $number;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,6 +41,11 @@ class MediaFile extends Model
|
|||||||
return str_starts_with($this->mime_type, 'image/');
|
return str_starts_with($this->mime_type, 'image/');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getIsVideoAttribute(): bool
|
||||||
|
{
|
||||||
|
return str_starts_with($this->mime_type, 'video/');
|
||||||
|
}
|
||||||
|
|
||||||
public function getIconAttribute(): string
|
public function getIconAttribute(): string
|
||||||
{
|
{
|
||||||
if ($this->is_image) return '🖼️';
|
if ($this->is_image) return '🖼️';
|
||||||
|
|||||||
22
app/Models/Note.php
Normal file
22
app/Models/Note.php
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Note extends Model
|
||||||
|
{
|
||||||
|
protected $fillable = [
|
||||||
|
'title',
|
||||||
|
'content',
|
||||||
|
'color',
|
||||||
|
'is_pinned',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'content' => 'array',
|
||||||
|
'is_pinned' => 'boolean',
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -13,22 +13,43 @@ class RateCardProfile extends Model
|
|||||||
'ig_handle', 'tiktok_handle', 'youtube_handle', 'email',
|
'ig_handle', 'tiktok_handle', 'youtube_handle', 'email',
|
||||||
'logo_path', 'bg_color', 'accent_color', 'text_color',
|
'logo_path', 'bg_color', 'accent_color', 'text_color',
|
||||||
'custom_footer', 'show_prices', 'access_token',
|
'custom_footer', 'show_prices', 'access_token',
|
||||||
|
'terms_and_conditions',
|
||||||
|
'past_brands',
|
||||||
|
'brand_logo_size',
|
||||||
|
'contact_person_html',
|
||||||
|
'content_showcase',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'show_prices' => 'boolean',
|
'show_prices' => 'boolean',
|
||||||
|
'past_brands' => 'array',
|
||||||
|
'content_showcase' => 'array',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
protected static ?self $instance = null;
|
||||||
|
|
||||||
/** Get the singleton profile, creating defaults if needed */
|
/** Get the singleton profile, creating defaults if needed */
|
||||||
public static function getSingleton(): self
|
public static function getSingleton(): self
|
||||||
{
|
{
|
||||||
return static::firstOrCreate([], [
|
if (self::$instance) {
|
||||||
'owner_name' => config('app.name', 'KOL Manager'),
|
return self::$instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
self::$instance = static::firstOrCreate([], [
|
||||||
|
'owner_name' => config('app.name', 'Cathy Page'),
|
||||||
'bg_color' => '#FFF8F0',
|
'bg_color' => '#FFF8F0',
|
||||||
'accent_color' => '#FFB7C5',
|
'accent_color' => '#FFB7C5',
|
||||||
'text_color' => '#374151',
|
'text_color' => '#374151',
|
||||||
'show_prices' => true,
|
'show_prices' => true,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
return self::$instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static function booted()
|
||||||
|
{
|
||||||
|
static::saved(fn ($model) => self::$instance = $model);
|
||||||
|
static::deleted(fn () => self::$instance = null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getWhatsappUrlAttribute(): ?string
|
public function getWhatsappUrlAttribute(): ?string
|
||||||
|
|||||||
@@ -16,6 +16,13 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
{
|
{
|
||||||
// Inject alert badge count into all views
|
// Inject alert badge count into all views
|
||||||
View::composer('*', function (\Illuminate\View\View $view): void {
|
View::composer('*', function (\Illuminate\View\View $view): void {
|
||||||
|
if (!$view->offsetExists('profile')) {
|
||||||
|
$view->with('profile', \App\Models\RateCardProfile::getSingleton());
|
||||||
|
}
|
||||||
|
if (!$view->offsetExists('invoiceSettings')) {
|
||||||
|
$view->with('invoiceSettings', \App\Models\InvoiceSettings::instance());
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$alertCount = Event::upcoming(24)->count();
|
$alertCount = Event::upcoming(24)->count();
|
||||||
} catch (\Throwable) {
|
} catch (\Throwable) {
|
||||||
|
|||||||
@@ -59,4 +59,15 @@ final class InvoiceService
|
|||||||
|
|
||||||
return $pdf->download("invoice-{$invoice->invoice_number}.pdf");
|
return $pdf->download("invoice-{$invoice->invoice_number}.pdf");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function generateLegacyPdf(Invoice $invoice): Response
|
||||||
|
{
|
||||||
|
$invoice->load('client', 'items');
|
||||||
|
$invoiceSettings = InvoiceSettings::instance();
|
||||||
|
|
||||||
|
$pdf = Pdf::loadView('invoices.pdf-legacy', compact('invoice', 'invoiceSettings'));
|
||||||
|
$pdf->setPaper('A4', 'portrait');
|
||||||
|
|
||||||
|
return $pdf->download("invoice-{$invoice->invoice_number}-legacy.pdf");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class EmailNotifier
|
|||||||
|
|
||||||
Mail::raw($combined, function ($mail) use ($toEmail, $setting): void {
|
Mail::raw($combined, function ($mail) use ($toEmail, $setting): void {
|
||||||
$mail->to($toEmail)
|
$mail->to($toEmail)
|
||||||
->subject("🐱 KOL Manager — {$setting->name} Notifications");
|
->subject("🐱 Cathy's App — {$setting->name} Notifications");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class WahaNotifier
|
|||||||
{
|
{
|
||||||
$this->send(
|
$this->send(
|
||||||
$setting,
|
$setting,
|
||||||
"🐱 *KOL Manager — Test Notification*\n\nYour WhatsApp channel is configured correctly! 🎉"
|
"🐱 *Cathy's App — Test Notification*\n\nYour WhatsApp channel is configured correctly! 🎉"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use App\Http\Middleware\GateAuth;
|
||||||
use Illuminate\Foundation\Application;
|
use Illuminate\Foundation\Application;
|
||||||
use Illuminate\Foundation\Configuration\Exceptions;
|
use Illuminate\Foundation\Configuration\Exceptions;
|
||||||
use Illuminate\Foundation\Configuration\Middleware;
|
use Illuminate\Foundation\Configuration\Middleware;
|
||||||
@@ -11,7 +12,9 @@ return Application::configure(basePath: dirname(__DIR__))
|
|||||||
health: '/up',
|
health: '/up',
|
||||||
)
|
)
|
||||||
->withMiddleware(function (Middleware $middleware): void {
|
->withMiddleware(function (Middleware $middleware): void {
|
||||||
//
|
$middleware->web(append: [
|
||||||
|
GateAuth::class,
|
||||||
|
]);
|
||||||
})
|
})
|
||||||
->withExceptions(function (Exceptions $exceptions): void {
|
->withExceptions(function (Exceptions $exceptions): void {
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ return [
|
|||||||
|
|
||||||
'name' => env('APP_NAME', 'Laravel'),
|
'name' => env('APP_NAME', 'Laravel'),
|
||||||
|
|
||||||
|
'password' => env('APP_PASSWORD'),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Application Environment
|
| Application Environment
|
||||||
|
|||||||
@@ -38,6 +38,13 @@ return [
|
|||||||
'report' => false,
|
'report' => false,
|
||||||
],
|
],
|
||||||
|
|
||||||
|
'private' => [
|
||||||
|
'driver' => 'local',
|
||||||
|
'root' => storage_path('app/private'),
|
||||||
|
'serve' => false,
|
||||||
|
'throw' => false,
|
||||||
|
],
|
||||||
|
|
||||||
'public' => [
|
'public' => [
|
||||||
'driver' => 'local',
|
'driver' => 'local',
|
||||||
'root' => storage_path('app/public'),
|
'root' => storage_path('app/public'),
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('invoice_settings', function (Blueprint $table) {
|
||||||
|
$table->string('accent_color', 20)->default('#FFB7C5')->after('header_logo');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('invoice_settings', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('accent_color');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
25
database/migrations/2026_04_02_000000_create_notes_table.php
Normal file
25
database/migrations/2026_04_02_000000_create_notes_table.php
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('notes', function (Blueprint $table): void {
|
||||||
|
$table->id();
|
||||||
|
$table->string('title')->default('Untitled Note');
|
||||||
|
$table->json('content')->nullable(); // array of block objects
|
||||||
|
$table->string('color', 20)->default('#FFFFFF');
|
||||||
|
$table->boolean('is_pinned')->default(false);
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('notes');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('invoice_settings', function (Blueprint $table) {
|
||||||
|
$table->string('signature_image')->nullable()->after('header_logo');
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::table('invoices', function (Blueprint $table) {
|
||||||
|
$table->string('signature_image')->nullable()->after('notes');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('invoice_settings', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('signature_image');
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::table('invoices', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('signature_image');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('invoice_settings', function (Blueprint $table) {
|
||||||
|
$table->string('signer_name')->nullable()->after('signature_image');
|
||||||
|
$table->string('signer_title')->nullable()->after('signer_name');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('invoice_settings', function (Blueprint $table) {
|
||||||
|
$table->dropColumn(['signer_name', 'signer_title']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('invoices', function (Blueprint $table) {
|
||||||
|
$table->string('signer_name')->nullable()->after('signature_image');
|
||||||
|
$table->string('signer_title')->nullable()->after('signer_name');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('invoices', function (Blueprint $table) {
|
||||||
|
$table->dropColumn(['signer_name', 'signer_title']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('rate_card_profiles', function (Blueprint $table) {
|
||||||
|
$table->text('terms_and_conditions')->nullable();
|
||||||
|
$table->json('past_brands')->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('rate_card_profiles', function (Blueprint $table) {
|
||||||
|
$table->dropColumn(['terms_and_conditions', 'past_brands']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('rate_card_profiles', function (Blueprint $table) {
|
||||||
|
$table->text('contact_person_html')->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('rate_card_profiles', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('contact_person_html');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('rate_card_profiles', function (Blueprint $table) {
|
||||||
|
$table->string('brand_logo_size')->default('medium')->after('past_brands');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('rate_card_profiles', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('brand_logo_size');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('rate_card_profiles', function (Blueprint $table) {
|
||||||
|
$table->json('content_showcase')->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('rate_card_profiles', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('content_showcase');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('invoices', function (Blueprint $table) {
|
||||||
|
if (!Schema::hasColumn('invoices', 'discount_rate')) {
|
||||||
|
$table->integer('discount_rate')->default(0);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::table('invoice_items', function (Blueprint $table) {
|
||||||
|
if (!Schema::hasColumn('invoice_items', 'is_discountable')) {
|
||||||
|
$table->boolean('is_discountable')->default(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('invoices', function (Blueprint $table) {
|
||||||
|
if (Schema::hasColumn('invoices', 'discount_rate')) {
|
||||||
|
$table->dropColumn('discount_rate');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::table('invoice_items', function (Blueprint $table) {
|
||||||
|
if (Schema::hasColumn('invoice_items', 'is_discountable')) {
|
||||||
|
$table->dropColumn('is_discountable');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -7,8 +7,8 @@ services:
|
|||||||
container_name: kol-manager
|
container_name: kol-manager
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
ports:
|
# ports:
|
||||||
- "${APP_PORT:-8080}:80"
|
# - "${APP_PORT:-8080}:80"
|
||||||
|
|
||||||
# Mount .env.docker as the runtime .env
|
# Mount .env.docker as the runtime .env
|
||||||
env_file:
|
env_file:
|
||||||
@@ -22,7 +22,7 @@ services:
|
|||||||
- kol_storage:/var/www/html/storage
|
- kol_storage:/var/www/html/storage
|
||||||
|
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "curl", "-f", "http://localhost/up"]
|
test: [ "CMD", "curl", "-f", "http://localhost/up" ]
|
||||||
interval: 30s
|
interval: 30s
|
||||||
timeout: 10s
|
timeout: 10s
|
||||||
retries: 3
|
retries: 3
|
||||||
|
|||||||
@@ -20,11 +20,27 @@ if [ ! -f .env ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# ── 2. Generate APP_KEY if empty ────────────
|
# ── 2. Generate APP_KEY if empty ────────────
|
||||||
if grep -qE '^APP_KEY=$' .env 2>/dev/null; then
|
if ! grep -qE '^APP_KEY=base64:' .env 2>/dev/null; then
|
||||||
echo "[key] Generating application key…"
|
echo "[key] Generating application key directly…"
|
||||||
php artisan key:generate --force --quiet
|
|
||||||
|
# 2a. Clear cached configs that might cause MissingAppKeyException
|
||||||
|
php artisan config:clear --quiet 2>/dev/null || true
|
||||||
|
|
||||||
|
# 2b. Generate native base64 key
|
||||||
|
NEW_KEY="base64:$(php -r 'echo base64_encode(random_bytes(32));')"
|
||||||
|
|
||||||
|
if grep -q '^APP_KEY=' .env 2>/dev/null; then
|
||||||
|
# Replace existing empty/invalid APP_KEY safely
|
||||||
|
sed -i "s|^APP_KEY=.*|APP_KEY=$NEW_KEY|" .env
|
||||||
|
else
|
||||||
|
# Append nicely
|
||||||
|
echo "APP_KEY=$NEW_KEY" >> .env
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# 2c. Force Laravel to read from .env by ditching Docker's empty OS injection
|
||||||
|
unset APP_KEY
|
||||||
|
|
||||||
# ── 3. Ensure SQLite database file exists ───
|
# ── 3. Ensure SQLite database file exists ───
|
||||||
if [ ! -f database/database.sqlite ]; then
|
if [ ! -f database/database.sqlite ]; then
|
||||||
echo "[db] Creating SQLite database file…"
|
echo "[db] Creating SQLite database file…"
|
||||||
@@ -41,11 +57,19 @@ chmod -R 775 \
|
|||||||
bootstrap/cache \
|
bootstrap/cache \
|
||||||
database
|
database
|
||||||
|
|
||||||
# ── 5. Run migrations ────────────────────────
|
# ── 5. Discover packages (composer --no-scripts skips this) ──
|
||||||
|
echo "[packages] Discovering service providers…"
|
||||||
|
php artisan package:discover --ansi 2>/dev/null || true
|
||||||
|
|
||||||
|
# ── 6. Run migrations ─────────────────────────
|
||||||
echo "[migrate] Running database migrations…"
|
echo "[migrate] Running database migrations…"
|
||||||
php artisan migrate --force --no-interaction
|
php artisan migrate --force --no-interaction
|
||||||
|
|
||||||
# ── 6. Cache config / routes / views ────────
|
# ── 7. Create public storage symlink ──────────
|
||||||
|
echo "[storage] Creating public storage symlink…"
|
||||||
|
php artisan storage:link --quiet 2>/dev/null || true
|
||||||
|
|
||||||
|
# ── 8. Cache config / routes / views ─────────
|
||||||
echo "[optimize] Caching configuration…"
|
echo "[optimize] Caching configuration…"
|
||||||
php artisan config:cache --quiet
|
php artisan config:cache --quiet
|
||||||
php artisan route:cache --quiet
|
php artisan route:cache --quiet
|
||||||
@@ -55,5 +79,5 @@ echo "────────────────────────
|
|||||||
echo " All checks passed. Starting services…"
|
echo " All checks passed. Starting services…"
|
||||||
echo "──────────────────────────────────────────"
|
echo "──────────────────────────────────────────"
|
||||||
|
|
||||||
# ── 7. Hand off to Supervisor ────────────────
|
# ── 9. Hand off to Supervisor ────────────────
|
||||||
exec supervisord -c /etc/supervisord.conf
|
exec supervisord -c /etc/supervisord.conf
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ http {
|
|||||||
gzip_types text/plain text/css application/json application/javascript text/xml application/xml;
|
gzip_types text/plain text/css application/json application/javascript text/xml application/xml;
|
||||||
|
|
||||||
# Upload size limit (matches file uploads in the app)
|
# Upload size limit (matches file uploads in the app)
|
||||||
client_max_body_size 64M;
|
client_max_body_size 500M;
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
|
|||||||
@@ -14,18 +14,7 @@ serverurl=unix:///run/supervisor.sock
|
|||||||
[rpcinterface:supervisor]
|
[rpcinterface:supervisor]
|
||||||
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
|
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
|
||||||
|
|
||||||
; ── Nginx ─────────────────────────────────────────────────────────────────
|
; ── PHP-FPM ───────────────────────────────────────────────────────────────────
|
||||||
[program:nginx]
|
|
||||||
command=nginx -g "daemon off;"
|
|
||||||
autostart=true
|
|
||||||
autorestart=true
|
|
||||||
priority=10
|
|
||||||
stdout_logfile=/dev/stdout
|
|
||||||
stdout_logfile_maxbytes=0
|
|
||||||
stderr_logfile=/dev/stderr
|
|
||||||
stderr_logfile_maxbytes=0
|
|
||||||
|
|
||||||
; ── PHP-FPM ───────────────────────────────────────────────────────────────
|
|
||||||
[program:php-fpm]
|
[program:php-fpm]
|
||||||
command=php-fpm --nodaemonize
|
command=php-fpm --nodaemonize
|
||||||
autostart=true
|
autostart=true
|
||||||
@@ -36,13 +25,20 @@ stdout_logfile_maxbytes=0
|
|||||||
stderr_logfile=/dev/stderr
|
stderr_logfile=/dev/stderr
|
||||||
stderr_logfile_maxbytes=0
|
stderr_logfile_maxbytes=0
|
||||||
|
|
||||||
; ── Laravel Queue Worker ──────────────────────────────────────────────────
|
; ── Nginx ─────────────────────────────────────────────────────────────────────
|
||||||
|
[program:nginx]
|
||||||
|
command=nginx -g "daemon off;"
|
||||||
|
autostart=true
|
||||||
|
autorestart=true
|
||||||
|
priority=10
|
||||||
|
stdout_logfile=/dev/stdout
|
||||||
|
stdout_logfile_maxbytes=0
|
||||||
|
stderr_logfile=/dev/stderr
|
||||||
|
stderr_logfile_maxbytes=0
|
||||||
|
|
||||||
|
; ── Laravel Queue Worker ──────────────────────────────────────────────────────
|
||||||
[program:queue]
|
[program:queue]
|
||||||
command=php /var/www/html/artisan queue:work \
|
command=php /var/www/html/artisan queue:work --sleep=3 --tries=3 --max-time=3600 --queue=default
|
||||||
--sleep=3 \
|
|
||||||
--tries=3 \
|
|
||||||
--max-time=3600 \
|
|
||||||
--queue=default
|
|
||||||
directory=/var/www/html
|
directory=/var/www/html
|
||||||
user=www-data
|
user=www-data
|
||||||
autostart=true
|
autostart=true
|
||||||
|
|||||||
2
package-lock.json
generated
2
package-lock.json
generated
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "KOL-Manager",
|
"name": "app",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
@extends('layouts.app')
|
@extends('layouts.app')
|
||||||
@section('title', 'Categories')
|
@section('title', 'Categories')
|
||||||
@section('page-title', '🏷️ Category Management')
|
@section('page-title', 'Category Management 🏷️')
|
||||||
@section('page-subtitle', 'Organise clients, schedules & content by category')
|
@section('page-subtitle', 'Organise clients, schedules & content by category')
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<div class="max-w-4xl mx-auto space-y-5">
|
<div class="max-w-4xl mx-auto space-y-5">
|
||||||
|
|
||||||
@if(session('success'))
|
@if(session('success'))
|
||||||
<div x-data="{ show: true }" x-show="show" x-init="setTimeout(() => show = false, 4000)"
|
<div x-data="{ show: true }" x-show="show" x-init="setTimeout(() => show = false, 4000)"
|
||||||
@@ -15,18 +15,21 @@
|
|||||||
@endif
|
@endif
|
||||||
|
|
||||||
{{-- Add form --}}
|
{{-- Add form --}}
|
||||||
<div class="cat-card overflow-hidden">
|
<div class="cat-card overflow-hidden" x-data="{ open: {{ $errors->any() ? 'true' : 'false' }} }">
|
||||||
<div class="flex items-center gap-3 px-5 py-4 border-b border-pink-50">
|
<div class="flex items-center gap-3 px-5 py-4 border-b border-pink-50">
|
||||||
<span class="text-xl">➕</span>
|
<button type="button" @click="open = !open" class="btn-sakura text-xs"
|
||||||
<h2 class="font-bold text-gray-700">Add New Category</h2>
|
x-text="open ? '✕ Close' : '+ Add Category'">
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div x-show="open" x-transition style="display:none">
|
||||||
<form action="{{ route('client-categories.store') }}" method="POST"
|
<form action="{{ route('client-categories.store') }}" method="POST"
|
||||||
class="p-5 grid grid-cols-2 sm:grid-cols-4 gap-3 items-end">
|
class="p-5 grid grid-cols-2 sm:grid-cols-4 gap-3 items-end border-b border-pink-50">
|
||||||
@csrf
|
@csrf
|
||||||
<div>
|
<div>
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Name <span class="text-pink-400">*</span></label>
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Name <span
|
||||||
<input type="text" name="name" required maxlength="100"
|
class="text-pink-400">*</span></label>
|
||||||
placeholder="e.g. Energy Drinks"
|
<input type="text" name="name" required maxlength="100" placeholder="e.g. Susu Formula"
|
||||||
class="input-soft" value="{{ old('name') }}">
|
class="input-soft" value="{{ old('name') }}">
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@@ -42,8 +45,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Icon (emoji)</label>
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Icon (emoji)</label>
|
||||||
<input type="text" name="icon" maxlength="10" placeholder="🏷️"
|
<input type="text" name="icon" maxlength="10" placeholder="🏷️" class="input-soft"
|
||||||
class="input-soft" value="{{ old('icon') }}">
|
value="{{ old('icon') }}">
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-end gap-2">
|
<div class="flex items-end gap-2">
|
||||||
<div class="flex-1">
|
<div class="flex-1">
|
||||||
@@ -55,6 +58,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
{{-- List --}}
|
{{-- List --}}
|
||||||
<div class="cat-card overflow-hidden">
|
<div class="cat-card overflow-hidden">
|
||||||
@@ -66,6 +70,7 @@
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
@php $roots = $categories->whereNull('parent_id'); @endphp
|
@php $roots = $categories->whereNull('parent_id'); @endphp
|
||||||
|
|
||||||
@forelse($roots as $root)
|
@forelse($roots as $root)
|
||||||
@@ -78,7 +83,8 @@
|
|||||||
@endif
|
@endif
|
||||||
<div class="flex-1 min-w-0">
|
<div class="flex-1 min-w-0">
|
||||||
<div class="font-semibold text-gray-700 text-sm">{{ $root->name }}</div>
|
<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 class="text-xs text-gray-400">{{ $root->children->count() }} sub · {{ $root->clients_count }}
|
||||||
|
client(s)</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex gap-2 shrink-0">
|
<div class="flex gap-2 shrink-0">
|
||||||
<button @click="editing = !editing"
|
<button @click="editing = !editing"
|
||||||
@@ -89,7 +95,8 @@
|
|||||||
<form action="{{ route('client-categories.destroy', $root) }}" method="POST"
|
<form action="{{ route('client-categories.destroy', $root) }}" method="POST"
|
||||||
onsubmit="return confirm('Remove this category? Its children will be promoted.')">
|
onsubmit="return confirm('Remove this category? Its children will be promoted.')">
|
||||||
@csrf @method('DELETE')
|
@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
|
||||||
|
class="text-xs px-3 py-1.5 rounded-full border border-red-100 text-red-400 hover:bg-red-50">
|
||||||
🗑️
|
🗑️
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
@@ -138,7 +145,8 @@
|
|||||||
{{-- Children --}}
|
{{-- Children --}}
|
||||||
@foreach($root->children as $child)
|
@foreach($root->children as $child)
|
||||||
<div x-data="{ editingC: false }">
|
<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">
|
<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>
|
<span class="text-base w-6 text-center shrink-0">{{ $child->icon ?: '↳' }}</span>
|
||||||
@if($child->color)
|
@if($child->color)
|
||||||
<span class="w-2.5 h-2.5 rounded-full shrink-0" style="background:{{ $child->color }}"></span>
|
<span class="w-2.5 h-2.5 rounded-full shrink-0" style="background:{{ $child->color }}"></span>
|
||||||
@@ -156,7 +164,8 @@
|
|||||||
<form action="{{ route('client-categories.destroy', $child) }}" method="POST"
|
<form action="{{ route('client-categories.destroy', $child) }}" method="POST"
|
||||||
onsubmit="return confirm('Remove subcategory?')">
|
onsubmit="return confirm('Remove subcategory?')">
|
||||||
@csrf @method('DELETE')
|
@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
|
||||||
|
class="text-xs px-2.5 py-1 rounded-full border border-red-100 text-red-400 hover:bg-red-50">
|
||||||
🗑️
|
🗑️
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
@@ -209,5 +218,5 @@
|
|||||||
</div>
|
</div>
|
||||||
@endforelse
|
@endforelse
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@endsection
|
@endsection
|
||||||
@@ -1,17 +1,17 @@
|
|||||||
@extends('layouts.app')
|
@extends('layouts.app')
|
||||||
|
|
||||||
@section('title', 'Clients')
|
@section('title', 'Clients')
|
||||||
@section('page-title', 'Clients / CRM 👥')
|
@section('page-title', 'Clients👥')
|
||||||
@section('page-subtitle', 'Manage your brand partners and contacts')
|
@section('page-subtitle', 'Manage your brand partners and contacts')
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
|
|
||||||
{{-- ── Toolbar + collapsible filter ───────────────────────── --}}
|
{{-- ── Toolbar + collapsible filter ───────────────────────── --}}
|
||||||
<div x-data="{ open: {{ request('category') || request('status') ? 'true' : 'false' }} }">
|
<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 justify-between gap-2 mb-3">
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex items-center gap-2">
|
||||||
<a href="{{ route('clients.create') }}" class="btn-sakura text-sm">+ Add</a>
|
<a href="{{ route('clients.create') }}" class="btn-sakura text-sm">+ Add Client</a>
|
||||||
@if(request('category') || request('status'))
|
@if(request('category') || request('status'))
|
||||||
<a href="{{ route('clients.index') }}"
|
<a href="{{ route('clients.index') }}"
|
||||||
class="text-xs px-3 py-2 rounded-full border border-gray-200 text-gray-500 hover:bg-gray-50 flex items-center gap-1">
|
class="text-xs px-3 py-2 rounded-full border border-gray-200 text-gray-500 hover:bg-gray-50 flex items-center gap-1">
|
||||||
@@ -22,49 +22,49 @@
|
|||||||
<button @click="open = !open"
|
<button @click="open = !open"
|
||||||
class="flex items-center gap-1.5 text-xs px-3 py-2 rounded-full border transition-colors"
|
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'">
|
: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">
|
<svg xmlns="http://www.w3.org/2000/svg" class="w-3.5 h-3.5" fill="none" viewBox="0 0 24 24"
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" d="M3 4h18M7 10h10M11 16h2"/>
|
stroke="currentColor" stroke-width="2">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" d="M3 4h18M7 10h10M11 16h2" />
|
||||||
</svg>
|
</svg>
|
||||||
Filter
|
Filter
|
||||||
@if(request('category') || request('status'))
|
@if(request('category') || request('status'))
|
||||||
<span class="w-2 h-2 rounded-full bg-pink-400 inline-block ml-0.5"></span>
|
<span class="w-2 h-2 rounded-full bg-pink-400 inline-block ml-0.5"></span>
|
||||||
@endif
|
@endif
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{-- ── Filters panel (collapsible) ────────────────────────── --}}
|
{{-- ── Filters panel (collapsible) ────────────────────────── --}}
|
||||||
<div x-show="open" x-transition.duration.150ms>
|
<div x-show="open" x-transition.duration.150ms>
|
||||||
<form method="GET" action="{{ route('clients.index') }}" id="filter-form" class="cat-card p-3 mb-4">
|
<form method="GET" action="{{ route('clients.index') }}" id="filter-form" class="cat-card p-3 mb-4">
|
||||||
{{-- Row 1: search + dropdowns --}}
|
{{-- Row 1: search + dropdowns --}}
|
||||||
<div class="flex flex-col sm:flex-row sm:items-center gap-2">
|
<div class="grid grid-cols-1 sm:grid-cols-12 gap-3 items-center">
|
||||||
{{-- Search (fills remaining space on desktop) --}}
|
{{-- Search --}}
|
||||||
<div class="relative flex-1 min-w-0">
|
<div class="relative sm:col-span-5 lg:col-span-6 w-full">
|
||||||
<span class="absolute left-3 top-1/2 -translate-y-1/2 text-gray-400 text-sm pointer-events-none">🔍</span>
|
<span class="absolute left-3 top-1/2 -translate-y-1/2 text-gray-400 text-sm pointer-events-none"></span>
|
||||||
<input type="text" placeholder="Filter by name…" class="input-soft pl-9 text-sm py-2 w-full"
|
<input type="text" placeholder="🔍 Filter by name…" class="input-soft pl-9 text-sm py-2 w-full"
|
||||||
oninput="filterClients(this.value)" id="search-input">
|
oninput="filterClients(this.value)" id="search-input">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{-- Category dropdown --}}
|
{{-- Category dropdown --}}
|
||||||
<select name="category" class="input-soft text-sm py-2 sm:w-48 shrink-0"
|
<div class="sm:col-span-4 lg:col-span-3 w-full">
|
||||||
onchange="this.form.submit()">
|
<select name="category" class="input-soft text-sm py-2 w-full" onchange="this.form.submit()">
|
||||||
<option value="">All Categories</option>
|
<option value="">All Categories</option>
|
||||||
@foreach($categories as $parent)
|
@foreach($categories as $parent)
|
||||||
<option value="{{ $parent->id }}"
|
<option value="{{ $parent->id }}" {{ request('category') == $parent->id ? 'selected' : '' }}>
|
||||||
{{ request('category') == $parent->id ? 'selected' : '' }}>
|
|
||||||
{{ $parent->icon }} {{ $parent->name }}
|
{{ $parent->icon }} {{ $parent->name }}
|
||||||
</option>
|
</option>
|
||||||
@foreach($parent->children as $child)
|
@foreach($parent->children as $child)
|
||||||
<option value="{{ $child->id }}"
|
<option value="{{ $child->id }}" {{ request('category') == $child->id ? 'selected' : '' }}>
|
||||||
{{ request('category') == $child->id ? 'selected' : '' }}>
|
|
||||||
↳ {{ $child->name }}
|
↳ {{ $child->name }}
|
||||||
</option>
|
</option>
|
||||||
@endforeach
|
@endforeach
|
||||||
@endforeach
|
@endforeach
|
||||||
</select>
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
{{-- Status dropdown --}}
|
{{-- Status dropdown --}}
|
||||||
<select name="status" class="input-soft text-sm py-2 sm:w-36 shrink-0"
|
<div class="sm:col-span-3 lg:col-span-3 w-full">
|
||||||
onchange="this.form.submit()">
|
<select name="status" class="input-soft text-sm py-2 w-full" onchange="this.form.submit()">
|
||||||
<option value="">All Statuses</option>
|
<option value="">All Statuses</option>
|
||||||
@foreach($statuses as $s)
|
@foreach($statuses as $s)
|
||||||
<option value="{{ $s->value }}" {{ request('status') === $s->value ? 'selected' : '' }}>
|
<option value="{{ $s->value }}" {{ request('status') === $s->value ? 'selected' : '' }}>
|
||||||
@@ -73,22 +73,30 @@
|
|||||||
@endforeach
|
@endforeach
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>{{-- end x-data --}}
|
</div>{{-- end x-data --}}
|
||||||
|
|
||||||
{{-- ── Client grid ─────────────────────────────────────────── --}}
|
{{-- ── Client grid ─────────────────────────────────────────── --}}
|
||||||
<div class="grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-3 gap-4" id="clients-grid">
|
<div class="grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-3 gap-4" id="clients-grid">
|
||||||
@forelse($clients as $client)
|
@forelse($clients as $client)
|
||||||
<div class="cat-card p-4 flex flex-col gap-3 hover:shadow-md transition-shadow duration-200"
|
<div class="cat-card p-4 flex flex-col gap-3 hover:shadow-md transition-shadow duration-200"
|
||||||
data-name="{{ strtolower($client->name) }} {{ strtolower($client->company ?? '') }}">
|
data-name="{{ strtolower($client->name) }} {{ strtolower($client->company ?? '') }}">
|
||||||
|
|
||||||
<div class="flex items-start gap-3">
|
<div class="flex items-start gap-3">
|
||||||
|
@if($client->avatar)
|
||||||
|
<div class="w-11 h-11 rounded-2xl overflow-hidden shrink-0 shadow-sm ring-2 ring-pink-100">
|
||||||
|
<img src="{{ \Illuminate\Support\Facades\Storage::url($client->avatar) }}" alt="{{ $client->name }}"
|
||||||
|
class="w-full h-full object-cover">
|
||||||
|
</div>
|
||||||
|
@else
|
||||||
<div class="w-11 h-11 rounded-2xl flex items-center justify-center text-white font-bold text-base shadow-sm shrink-0"
|
<div class="w-11 h-11 rounded-2xl flex items-center justify-center text-white font-bold text-base shadow-sm shrink-0"
|
||||||
style="background: linear-gradient(135deg, {{ $client->category?->color ?? '#FFB7C5' }}, #E8D5F5);">
|
style="background: linear-gradient(135deg, {{ $client->category?->color ?? '#FFB7C5' }}, #E8D5F5);">
|
||||||
{{ $client->initials }}
|
{{ $client->initials }}
|
||||||
</div>
|
</div>
|
||||||
|
@endif
|
||||||
<div class="flex-1 min-w-0">
|
<div class="flex-1 min-w-0">
|
||||||
<div class="flex items-center gap-2 flex-wrap">
|
<div class="flex items-center gap-2 flex-wrap">
|
||||||
<h3 class="font-bold text-gray-800 text-sm truncate">{{ $client->name }}</h3>
|
<h3 class="font-bold text-gray-800 text-sm truncate">{{ $client->name }}</h3>
|
||||||
@@ -100,7 +108,8 @@
|
|||||||
<div class="text-xs text-gray-400 truncate">{{ $client->company }}</div>
|
<div class="text-xs text-gray-400 truncate">{{ $client->company }}</div>
|
||||||
@endif
|
@endif
|
||||||
@if($client->category)
|
@if($client->category)
|
||||||
<div class="text-xs mt-0.5" style="color: {{ $client->category->color === '#FDFD96' ? '#8B8000' : $client->category->color }}">
|
<div class="text-xs mt-0.5"
|
||||||
|
style="color: {{ $client->category->color === '#FDFD96' ? '#8B8000' : $client->category->color }}">
|
||||||
{{ $client->category->icon }} {{ $client->category->name }}
|
{{ $client->category->icon }} {{ $client->category->name }}
|
||||||
@if($client->category->parent)
|
@if($client->category->parent)
|
||||||
<span class="text-gray-300 mx-0.5">·</span>
|
<span class="text-gray-300 mx-0.5">·</span>
|
||||||
@@ -116,10 +125,12 @@
|
|||||||
<span class="text-xs bg-pink-50 text-pink-600 px-2 py-0.5 rounded-full">📸 {{ $client->ig_handle }}</span>
|
<span class="text-xs bg-pink-50 text-pink-600 px-2 py-0.5 rounded-full">📸 {{ $client->ig_handle }}</span>
|
||||||
@endif
|
@endif
|
||||||
@if($client->tiktok_handle)
|
@if($client->tiktok_handle)
|
||||||
<span class="text-xs bg-purple-50 text-purple-600 px-2 py-0.5 rounded-full">🎵 {{ $client->tiktok_handle }}</span>
|
<span class="text-xs bg-purple-50 text-purple-600 px-2 py-0.5 rounded-full">🎵
|
||||||
|
{{ $client->tiktok_handle }}</span>
|
||||||
@endif
|
@endif
|
||||||
@if($client->youtube_handle)
|
@if($client->youtube_handle)
|
||||||
<span class="text-xs bg-red-50 text-red-600 px-2 py-0.5 rounded-full">▶️ {{ $client->youtube_handle }}</span>
|
<span class="text-xs bg-red-50 text-red-600 px-2 py-0.5 rounded-full">▶️
|
||||||
|
{{ $client->youtube_handle }}</span>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -127,12 +138,15 @@
|
|||||||
<span>📅 {{ $client->events_count }}</span>
|
<span>📅 {{ $client->events_count }}</span>
|
||||||
<span>🧾 {{ $client->invoices_count }}</span>
|
<span>🧾 {{ $client->invoices_count }}</span>
|
||||||
<span>🎬 {{ $client->content_briefs_count }}</span>
|
<span>🎬 {{ $client->content_briefs_count }}</span>
|
||||||
|
<span>📁 {{ $client->media_files_count ?? 0 }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@if($client->email || $client->city)
|
@if($client->email || $client->city)
|
||||||
<div class="text-xs text-gray-400 space-y-0.5">
|
<div class="text-xs text-gray-400 space-y-0.5">
|
||||||
@if($client->email) <div class="truncate">✉️ {{ $client->email }}</div> @endif
|
@if($client->email)
|
||||||
@if($client->city) <div>📍 {{ $client->city }}{{ $client->country ? ', '.$client->country : '' }}</div> @endif
|
<div class="truncate">✉️ {{ $client->email }}</div> @endif
|
||||||
|
@if($client->city)
|
||||||
|
<div>📍 {{ $client->city }}{{ $client->country ? ', ' . $client->country : '' }}</div> @endif
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@@ -163,17 +177,17 @@
|
|||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
@endforelse
|
@endforelse
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{ $clients->links() }}
|
{{ $clients->links() }}
|
||||||
|
|
||||||
@push('scripts')
|
@push('scripts')
|
||||||
<script>
|
<script>
|
||||||
function filterClients(query) {
|
function filterClients(query) {
|
||||||
document.querySelectorAll('#clients-grid > div[data-name]').forEach(card => {
|
document.querySelectorAll('#clients-grid > div[data-name]').forEach(card => {
|
||||||
card.style.display = card.dataset.name.includes(query.toLowerCase()) ? '' : 'none';
|
card.style.display = card.dataset.name.includes(query.toLowerCase()) ? '' : 'none';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@endpush
|
@endpush
|
||||||
@endsection
|
@endsection
|
||||||
@@ -8,12 +8,83 @@
|
|||||||
<div class="max-w-5xl mx-auto">
|
<div class="max-w-5xl mx-auto">
|
||||||
|
|
||||||
{{-- Profile Header --}}
|
{{-- Profile Header --}}
|
||||||
<div class="cat-card p-4 mb-4">
|
<div class="cat-card p-4 mb-4"
|
||||||
|
x-data="{
|
||||||
|
avatarUrl: '{{ $client->avatar ? asset('storage/' . $client->avatar) : '' }}',
|
||||||
|
uploading: false,
|
||||||
|
async pickAvatar(input) {
|
||||||
|
if (!input.files.length) return;
|
||||||
|
this.uploading = true;
|
||||||
|
const fd = new FormData();
|
||||||
|
fd.append('avatar', input.files[0]);
|
||||||
|
fd.append('_token', document.querySelector('meta[name=csrf-token]').content);
|
||||||
|
try {
|
||||||
|
const res = await fetch('{{ route('clients.upload-avatar', $client->id, false) }}', {
|
||||||
|
method: 'POST',
|
||||||
|
body: fd,
|
||||||
|
headers: { 'Accept': 'application/json' }
|
||||||
|
});
|
||||||
|
const data = await res.json();
|
||||||
|
if (res.ok) {
|
||||||
|
this.avatarUrl = data.url + '?t=' + Date.now();
|
||||||
|
} else {
|
||||||
|
alert(data.message || 'Upload failed');
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Avatar upload error:', err);
|
||||||
|
alert('Network Error. Could not upload.');
|
||||||
|
}
|
||||||
|
this.uploading = false;
|
||||||
|
input.value = '';
|
||||||
|
},
|
||||||
|
async removeAvatar() {
|
||||||
|
if (!confirm('Remove profile picture?')) return;
|
||||||
|
const fd = new FormData();
|
||||||
|
fd.append('_token', document.querySelector('meta[name=csrf-token]').content);
|
||||||
|
fd.append('_method', 'DELETE');
|
||||||
|
try {
|
||||||
|
await fetch('{{ route('clients.delete-avatar', $client->id, false) }}', {
|
||||||
|
method: 'POST',
|
||||||
|
body: fd,
|
||||||
|
headers: { 'Accept': 'application/json' }
|
||||||
|
});
|
||||||
|
this.avatarUrl = '';
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}">
|
||||||
<div class="flex items-start gap-4">
|
<div class="flex items-start gap-4">
|
||||||
<div class="w-14 h-14 rounded-3xl flex items-center justify-center text-white font-bold text-xl shadow shrink-0"
|
{{-- Avatar with upload overlay --}}
|
||||||
|
<div class="relative shrink-0 group">
|
||||||
|
<template x-if="avatarUrl">
|
||||||
|
<img :src="avatarUrl" alt="{{ $client->name }}"
|
||||||
|
class="w-16 h-16 rounded-3xl object-cover shadow border border-pink-100">
|
||||||
|
</template>
|
||||||
|
<template x-if="!avatarUrl">
|
||||||
|
<div class="w-16 h-16 rounded-3xl flex items-center justify-center text-white font-bold text-xl shadow"
|
||||||
style="background: linear-gradient(135deg, #FFB7C5, #E8D5F5);">
|
style="background: linear-gradient(135deg, #FFB7C5, #E8D5F5);">
|
||||||
{{ $client->initials }}
|
{{ $client->initials }}
|
||||||
</div>
|
</div>
|
||||||
|
</template>
|
||||||
|
{{-- Upload overlay --}}
|
||||||
|
<label class="absolute inset-0 rounded-3xl bg-black/30 flex items-center justify-center
|
||||||
|
opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer"
|
||||||
|
:class="{ 'opacity-100': uploading }"
|
||||||
|
title="Change photo">
|
||||||
|
<span x-show="!uploading" class="text-white text-lg">📷</span>
|
||||||
|
<span x-show="uploading" class="text-white text-xs">…</span>
|
||||||
|
<input type="file" accept="image/*" class="hidden" @change="pickAvatar($event.target)">
|
||||||
|
</label>
|
||||||
|
|
||||||
|
{{-- Remove Photo Button (Top Left) --}}
|
||||||
|
<button x-show="avatarUrl" @click.prevent="removeAvatar()"
|
||||||
|
class="absolute -top-2 -left-2 bg-red-100 text-red-500 rounded-full w-6 h-6 flex items-center justify-center hover:bg-red-200 shadow text-xs z-10 border border-white"
|
||||||
|
title="Remove Photo">
|
||||||
|
✕
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="flex-1 min-w-0">
|
<div class="flex-1 min-w-0">
|
||||||
<h2 class="text-lg font-bold text-gray-800 leading-tight">{{ $client->name }}</h2>
|
<h2 class="text-lg font-bold text-gray-800 leading-tight">{{ $client->name }}</h2>
|
||||||
@if($client->company) <p class="text-sm text-gray-500">{{ $client->company }}</p> @endif
|
@if($client->company) <p class="text-sm text-gray-500">{{ $client->company }}</p> @endif
|
||||||
@@ -31,8 +102,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{-- Action buttons below on mobile, inline on larger screens --}}
|
|
||||||
<div class="flex gap-2 mt-3">
|
<div class="flex gap-2 mt-3 flex-wrap">
|
||||||
<a href="{{ route('clients.edit', $client) }}" class="btn-sakura text-sm px-4 py-2">Edit</a>
|
<a href="{{ route('clients.edit', $client) }}" class="btn-sakura text-sm px-4 py-2">Edit</a>
|
||||||
<a href="{{ route('invoices.create') }}?client={{ $client->id }}"
|
<a href="{{ route('invoices.create') }}?client={{ $client->id }}"
|
||||||
class="text-sm px-4 py-2 rounded-full border border-pink-200 text-gray-600 hover:bg-pink-50 font-semibold">
|
class="text-sm px-4 py-2 rounded-full border border-pink-200 text-gray-600 hover:bg-pink-50 font-semibold">
|
||||||
@@ -62,7 +133,7 @@
|
|||||||
@if($client->full_address)
|
@if($client->full_address)
|
||||||
<div class="flex gap-2 items-start">
|
<div class="flex gap-2 items-start">
|
||||||
<span class="text-gray-400 shrink-0">📍</span>
|
<span class="text-gray-400 shrink-0">📍</span>
|
||||||
<span class="text-gray-600">{{ $client->full_address }}</span>
|
<span class="text-gray-600">{!! nl2br(e($client->full_address)) !!}</span>
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
@if($client->notes)
|
@if($client->notes)
|
||||||
@@ -134,5 +205,29 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
{{-- Uploaded Files --}}
|
||||||
|
@if($client->mediaFiles->isNotEmpty())
|
||||||
|
<div class="cat-card p-4 mt-4">
|
||||||
|
<div class="flex items-center justify-between mb-3">
|
||||||
|
<h3 class="font-bold text-gray-700 text-sm flex items-center gap-2">📁 Files</h3>
|
||||||
|
<a href="{{ route('files.index') }}?client_id={{ $client->id }}" class="text-xs text-pink-500">All Files →</a>
|
||||||
|
</div>
|
||||||
|
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3">
|
||||||
|
@foreach($client->mediaFiles as $file)
|
||||||
|
<a href="{{ route('files.serve', $file) }}" target="_blank"
|
||||||
|
class="bg-blue-50 rounded-2xl p-3 hover:bg-blue-100 transition-colors flex items-center gap-3">
|
||||||
|
<div class="shrink-0 text-xl border border-blue-200 rounded-lg w-10 h-10 flex items-center justify-center bg-white">
|
||||||
|
📄
|
||||||
|
</div>
|
||||||
|
<div class="min-w-0 flex-1">
|
||||||
|
<div class="font-semibold text-gray-700 text-sm truncate" title="{{ $file->name }}">{{ $file->name }}</div>
|
||||||
|
<div class="text-xs text-gray-400 mt-0.5">{{ number_format($file->size / 1024, 1) }} KB</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
@endforeach
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
</div>
|
</div>
|
||||||
@endsection
|
@endsection
|
||||||
|
|||||||
@@ -62,7 +62,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label class="block text-sm font-semibold text-gray-700 mb-1">Target Date</label>
|
<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">
|
<input type="date" name="target_date" value="{{ old('target_date') }}" class="input-soft" @change="checkContract()">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -116,7 +116,8 @@
|
|||||||
|
|
||||||
<div class="flex flex-col sm:flex-row gap-3 pt-1">
|
<div class="flex flex-col sm:flex-row gap-3 pt-1">
|
||||||
<button type="submit" class="btn-sakura flex-1 py-3"
|
<button type="submit" class="btn-sakura flex-1 py-3"
|
||||||
:class="{ 'opacity-50 cursor-not-allowed': contractWarning }">🎬 Create Brief</button>
|
:class="{ 'opacity-50 cursor-not-allowed': contractWarning }"
|
||||||
|
:disabled="contractWarning">🎬 Create Brief</button>
|
||||||
<a href="{{ route('content.index') }}"
|
<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">
|
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
|
Cancel
|
||||||
@@ -135,16 +136,35 @@ function contractCheck(checkUrl) {
|
|||||||
contractMessage: '',
|
contractMessage: '',
|
||||||
async checkContract() {
|
async checkContract() {
|
||||||
if (!this.categoryId) { this.contractWarning = false; return; }
|
if (!this.categoryId) { this.contractWarning = false; return; }
|
||||||
const params = new URLSearchParams({ category_id: this.categoryId, client_id: this.clientId || '' });
|
let dateVal = '';
|
||||||
|
const targetDateEl = document.querySelector('input[name="target_date"]');
|
||||||
|
if (targetDateEl && targetDateEl.value) {
|
||||||
|
dateVal = targetDateEl.value;
|
||||||
|
}
|
||||||
|
if (!dateVal) {
|
||||||
|
this.contractWarning = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const params = new URLSearchParams({
|
||||||
|
category_id: this.categoryId,
|
||||||
|
client_id: this.clientId || '',
|
||||||
|
date: dateVal
|
||||||
|
});
|
||||||
|
try {
|
||||||
const res = await fetch(checkUrl + '?' + params);
|
const res = await fetch(checkUrl + '?' + params);
|
||||||
|
if (!res.ok) throw new Error('Network error');
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
if (data) {
|
if (data && data.title) {
|
||||||
this.contractWarning = true;
|
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).`;
|
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 {
|
} else {
|
||||||
this.contractWarning = false;
|
this.contractWarning = false;
|
||||||
this.contractMessage = '';
|
this.contractMessage = '';
|
||||||
}
|
}
|
||||||
|
} catch (e) {
|
||||||
|
this.contractWarning = false;
|
||||||
|
this.contractMessage = '';
|
||||||
|
}
|
||||||
},
|
},
|
||||||
submitIfClear(form) {
|
submitIfClear(form) {
|
||||||
if (this.contractWarning) {
|
if (this.contractWarning) {
|
||||||
|
|||||||
@@ -5,37 +5,37 @@
|
|||||||
@section('page-subtitle', 'Drag cards between columns to update status')
|
@section('page-subtitle', 'Drag cards between columns to update status')
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<div class="flex flex-col sm:flex-row sm:items-center justify-between gap-3 mb-5">
|
<div class="flex flex-col sm:flex-row sm:items-center justify-between gap-3 mb-5">
|
||||||
<div class="flex gap-2 flex-wrap">
|
<div class="flex gap-2 flex-wrap">
|
||||||
@foreach(['instagram','tiktok','youtube'] as $p)
|
|
||||||
<a href="{{ request()->fullUrlWithQuery(['platform' => $p]) }}"
|
|
||||||
class="px-3 py-1.5 rounded-full text-xs font-semibold transition-colors
|
|
||||||
{{ request('platform') === $p ? 'text-white' : 'bg-white text-gray-500 hover:bg-pink-50 border border-pink-100' }}"
|
|
||||||
style="{{ request('platform') === $p ? 'background:#FFB7C5' : '' }}">
|
|
||||||
{{ ['instagram'=>'📸','tiktok'=>'🎵','youtube'=>'▶️'][$p] }} {{ ucfirst($p) }}
|
|
||||||
</a>
|
|
||||||
@endforeach
|
|
||||||
@if(request('platform'))
|
|
||||||
<a href="{{ route('content.index') }}" class="px-3 py-1.5 rounded-full text-xs text-gray-400 hover:text-gray-600 border border-gray-200 bg-white">✕ Clear</a>
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
<a href="{{ route('content.create') }}" class="btn-sakura text-sm shrink-0">+ New Brief</a>
|
<a href="{{ route('content.create') }}" class="btn-sakura text-sm shrink-0">+ New Brief</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{--
|
</div>
|
||||||
|
|
||||||
|
{{--
|
||||||
Mobile : grid grid-cols-1 → columns stack vertically, each full width
|
Mobile : grid grid-cols-1 → columns stack vertically, each full width
|
||||||
Desktop : flex flex-nowrap → columns in a single horizontal row, each flex-1
|
Desktop : flex flex-nowrap → columns in a single horizontal row, each flex-1
|
||||||
x-sort:group is on the INNER items div (not the column div) to avoid
|
x-sort:group is on the INNER items div (not the column div) to avoid
|
||||||
SortableJS mutating the outer layout container.
|
SortableJS mutating the outer layout container.
|
||||||
--}}
|
--}}
|
||||||
<div class="grid grid-cols-1 gap-4 lg:flex lg:flex-nowrap lg:gap-4"
|
<div class="grid grid-cols-1 gap-4 lg:flex lg:flex-nowrap lg:gap-4" x-data="kanban()">
|
||||||
x-data="kanban()">
|
|
||||||
@foreach($columns as $col)
|
@foreach($columns as $col)
|
||||||
@php $status = $col['status']; @endphp
|
@php $status = $col['status']; @endphp
|
||||||
|
|
||||||
{{-- Column shell — layout only, NOT the sort target --}}
|
{{-- Column shell — layout only, NOT the sort target --}}
|
||||||
|
@php
|
||||||
|
$bgColors = [
|
||||||
|
'drafting' => '#f2f2f2',
|
||||||
|
'filming' => 'rgba(251, 189, 35, 0.2)',
|
||||||
|
'editing' => 'rgba(58, 191, 248, 0.2)',
|
||||||
|
'review' => 'rgba(240, 0, 184, 0.2)',
|
||||||
|
'posted' => 'rgba(54, 211, 153, 0.2)',
|
||||||
|
'archived' => 'rgba(42, 50, 60, 0.2)',
|
||||||
|
];
|
||||||
|
$bgStyle = isset($bgColors[$status->value]) ? 'background-color: ' . $bgColors[$status->value] . ';' : '';
|
||||||
|
@endphp
|
||||||
<div class="{{ $status->colorClass() }} flex flex-col w-full lg:flex-1 lg:min-w-36 rounded-2xl p-3"
|
<div class="{{ $status->colorClass() }} flex flex-col w-full lg:flex-1 lg:min-w-36 rounded-2xl p-3"
|
||||||
data-status="{{ $status->value }}">
|
style="{{ $bgStyle }}" data-status="{{ $status->value }}">
|
||||||
|
|
||||||
{{-- Column header --}}
|
{{-- Column header --}}
|
||||||
<div class="flex items-center justify-between mb-3">
|
<div class="flex items-center justify-between mb-3">
|
||||||
@@ -43,23 +43,30 @@
|
|||||||
<span class="text-base">{{ $status->icon() }}</span>
|
<span class="text-base">{{ $status->icon() }}</span>
|
||||||
<span class="font-bold text-gray-700 text-sm">{{ $status->label() }}</span>
|
<span class="font-bold text-gray-700 text-sm">{{ $status->label() }}</span>
|
||||||
</div>
|
</div>
|
||||||
<span class="text-xs bg-white rounded-full px-2 py-0.5 font-bold text-gray-500 shadow-sm">{{ count($col['items']) }}</span>
|
<span
|
||||||
|
class="text-xs bg-white rounded-full px-2 py-0.5 font-bold text-gray-500 shadow-sm">{{ count($col['items']) }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{-- Sortable items container --}}
|
{{-- Sortable items container --}}
|
||||||
<div class="flex flex-col gap-2 flex-1 min-h-12"
|
<div class="flex flex-col gap-2 flex-1 min-h-12 kanban-column" data-col-status="{{ $status->value }}">
|
||||||
x-sort:group="kanban"
|
|
||||||
@sort="moved($event, '{{ $status->value }}')"
|
|
||||||
data-col-status="{{ $status->value }}">
|
|
||||||
|
|
||||||
@foreach($col['items'] as $brief)
|
@foreach($col['items'] as $brief)
|
||||||
<div class="bg-white rounded-2xl p-3 shadow-sm border border-pink-50 select-none
|
<div class="bg-white rounded-2xl p-3 shadow-sm border border-pink-50 select-none
|
||||||
cursor-grab active:cursor-grabbing hover:shadow-md transition-shadow"
|
cursor-grab active:cursor-grabbing hover:shadow-md transition-shadow kanban-item"
|
||||||
x-sort:item="{{ $brief->id }}"
|
|
||||||
data-id="{{ $brief->id }}">
|
data-id="{{ $brief->id }}">
|
||||||
<div class="flex items-start gap-2 mb-1.5">
|
<div class="flex items-start gap-2 mb-1.5">
|
||||||
<span class="text-sm shrink-0">{{ $brief->platform_icon }}</span>
|
<span class="text-sm shrink-0">{{ $brief->platform_icon }}</span>
|
||||||
<a href="{{ route('content.show', $brief) }}"
|
<a href="#" data-brief="{{ json_encode([
|
||||||
|
'id' => $brief->id,
|
||||||
|
'title' => $brief->title,
|
||||||
|
'platform' => $brief->platform_icon . ' ' . ucfirst($brief->platform),
|
||||||
|
'status' => $brief->status->label(),
|
||||||
|
'client' => $brief->client?->name,
|
||||||
|
'target_date' => $brief->target_date?->format('d M Y'),
|
||||||
|
'hook' => $brief->hook,
|
||||||
|
'body' => $brief->body,
|
||||||
|
'notes' => $brief->notes
|
||||||
|
]) }}" @click.prevent="openModal(JSON.parse($el.dataset.brief))"
|
||||||
class="font-semibold text-gray-800 text-xs leading-tight hover:text-pink-500 line-clamp-2 flex-1">
|
class="font-semibold text-gray-800 text-xs leading-tight hover:text-pink-500 line-clamp-2 flex-1">
|
||||||
{{ $brief->title }}
|
{{ $brief->title }}
|
||||||
</a>
|
</a>
|
||||||
@@ -68,12 +75,14 @@
|
|||||||
<div class="text-xs text-gray-400 mb-1">👥 {{ $brief->client->name }}</div>
|
<div class="text-xs text-gray-400 mb-1">👥 {{ $brief->client->name }}</div>
|
||||||
@endif
|
@endif
|
||||||
@if($brief->target_date)
|
@if($brief->target_date)
|
||||||
<div class="text-xs {{ $brief->target_date->isPast() && $brief->status->value !== 'posted' ? 'text-red-400 font-bold' : 'text-gray-400' }}">
|
<div
|
||||||
|
class="text-xs {{ $brief->target_date->isPast() && $brief->status->value !== 'posted' ? 'text-red-400 font-bold' : 'text-gray-400' }}">
|
||||||
📅 {{ $brief->target_date->format('d M') }}
|
📅 {{ $brief->target_date->format('d M') }}
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
<div class="flex justify-end mt-1.5">
|
<div class="flex justify-end mt-1.5">
|
||||||
<a href="{{ route('content.edit', $brief) }}" class="text-xs text-gray-400 hover:text-pink-500">Edit</a>
|
<a href="{{ route('content.edit', $brief) }}"
|
||||||
|
class="text-xs text-gray-400 hover:text-pink-500">Edit</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@endforeach
|
@endforeach
|
||||||
@@ -87,26 +96,120 @@
|
|||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
@endforeach
|
@endforeach
|
||||||
</div>
|
|
||||||
|
|
||||||
@push('scripts')
|
{{-- Content Detail Request Modal --}}
|
||||||
<script>
|
<div x-show="modalOpen" class="fixed inset-0 z-[60] flex items-center justify-center bg-black/40 backdrop-blur-sm"
|
||||||
function kanban() {
|
style="display: none;" x-transition>
|
||||||
|
<div @click.outside="modalOpen = false"
|
||||||
|
class="bg-white p-5 w-full max-w-lg rounded-3xl shadow-xl mx-4 max-h-[90vh] flex flex-col relative"
|
||||||
|
x-transition:enter="transition ease-out duration-300" x-transition:enter-start="opacity-0 translate-y-4"
|
||||||
|
x-transition:enter-end="opacity-100 translate-y-0" x-transition:leave="transition ease-in duration-200"
|
||||||
|
x-transition:leave-start="opacity-100 translate-y-0" x-transition:leave-end="opacity-0 translate-y-4">
|
||||||
|
<div class="flex items-center justify-between mb-4 border-b border-pink-50 pb-3 shrink-0">
|
||||||
|
<h3 class="font-extrabold text-gray-800 text-xl truncate pr-4" x-text="activeBrief?.title"></h3>
|
||||||
|
<button @click="modalOpen = false"
|
||||||
|
class="text-gray-400 hover:text-pink-500 hover:bg-pink-50 w-8 h-8 rounded-full flex items-center justify-center transition-colors">✕</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="text-sm text-gray-600 space-y-4 flex-1 overflow-y-auto pr-2 custom-scrollbar">
|
||||||
|
<div class="flex gap-3"><span class="text-gray-400 w-20 shrink-0 font-medium">Platform</span><span
|
||||||
|
class="font-bold text-gray-800" x-text="activeBrief?.platform"></span></div>
|
||||||
|
<div class="flex gap-3"><span class="text-gray-400 w-20 shrink-0 font-medium">Status</span><span
|
||||||
|
class="font-bold badge bg-pink-100 text-pink-700 rounded-full px-2 py-0.5"
|
||||||
|
x-text="activeBrief?.status"></span></div>
|
||||||
|
<template x-if="activeBrief?.client">
|
||||||
|
<div class="flex gap-3 items-center"><span
|
||||||
|
class="text-gray-400 w-20 shrink-0 font-medium">Client</span><span
|
||||||
|
class="font-semibold text-pink-500" x-text="activeBrief?.client"></span></div>
|
||||||
|
</template>
|
||||||
|
<template x-if="activeBrief?.target_date">
|
||||||
|
<div class="flex gap-3"><span class="text-gray-400 w-20 shrink-0 font-medium">Target</span><span
|
||||||
|
class="font-medium" x-text="activeBrief?.target_date"></span></div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template x-if="activeBrief?.hook">
|
||||||
|
<div class="flex flex-col gap-1 mt-4">
|
||||||
|
<span class="text-gray-400 font-medium">🎣 Hook</span>
|
||||||
|
<div class="whitespace-pre-wrap bg-pink-50/50 border border-pink-100 p-3 rounded-2xl text-gray-700 leading-relaxed"
|
||||||
|
x-text="activeBrief?.hook"></div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template x-if="activeBrief?.body">
|
||||||
|
<div class="flex flex-col gap-1 mt-4">
|
||||||
|
<span class="text-gray-400 font-medium">📖 Body</span>
|
||||||
|
<div class="whitespace-pre-wrap bg-gray-50 border border-gray-100 p-3 rounded-2xl text-gray-700 leading-relaxed"
|
||||||
|
x-text="activeBrief?.body"></div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template x-if="activeBrief?.notes">
|
||||||
|
<div class="flex flex-col gap-1 mt-4">
|
||||||
|
<span class="text-gray-400 font-medium">📝 Notes</span>
|
||||||
|
<div class="whitespace-pre-wrap bg-yellow-50/50 border border-yellow-100 p-3 rounded-2xl text-gray-700 leading-relaxed"
|
||||||
|
x-text="activeBrief?.notes"></div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex gap-3 mt-5 pt-4 border-t border-pink-50 shrink-0">
|
||||||
|
<a :href="`/content/${activeBrief?.id}/edit`" class="btn-sakura text-sm flex-1 text-center py-2.5">Edit
|
||||||
|
Brief</a>
|
||||||
|
<a :href="`/content/${activeBrief?.id}`"
|
||||||
|
class="py-2.5 rounded-full border border-pink-200 text-pink-500 text-sm hover:bg-pink-50 flex-1 text-center font-bold bg-white transition-colors">Details
|
||||||
|
Page</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@push('scripts')
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/sortablejs@1.15.2/Sortable.min.js"></script>
|
||||||
|
<script>
|
||||||
|
function kanban() {
|
||||||
return {
|
return {
|
||||||
moved(event, targetStatus) {
|
modalOpen: false,
|
||||||
const id = event.item?.dataset?.id;
|
activeBrief: null,
|
||||||
if (!id) return;
|
init() {
|
||||||
|
// Start Sortable once script loads
|
||||||
|
const initSort = () => {
|
||||||
|
if (typeof Sortable !== 'undefined') {
|
||||||
|
document.querySelectorAll('.kanban-column').forEach(el => {
|
||||||
|
Sortable.create(el, {
|
||||||
|
group: 'kanban-board',
|
||||||
|
animation: 150,
|
||||||
|
onEnd: (evt) => {
|
||||||
|
const id = evt.item.dataset.id;
|
||||||
|
const targetCol = evt.to.dataset.colStatus;
|
||||||
|
if (!id || !targetCol) return;
|
||||||
|
|
||||||
|
// If dropped in same column identically, skip fetch
|
||||||
|
if (evt.from === evt.to && evt.oldIndex === evt.newIndex) return;
|
||||||
|
|
||||||
fetch(`/content/${id}/status`, {
|
fetch(`/content/${id}/status`, {
|
||||||
method: 'PATCH',
|
method: 'PATCH',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').content,
|
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').content,
|
||||||
},
|
},
|
||||||
body: JSON.stringify({ status: targetStatus }),
|
body: JSON.stringify({ status: targetCol }),
|
||||||
}).then(r => { if (r.ok) window.KolManager.notify('Status updated! 🎬'); });
|
}).then(r => {
|
||||||
},
|
if (r.ok) window.KolManager.notify('Status updated! 🎬');
|
||||||
|
else window.KolManager.notify('❌ Failed to update status');
|
||||||
|
}).catch(() => window.KolManager.notify('❌ Network error!'));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
setTimeout(initSort, 100);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
initSort();
|
||||||
</script>
|
},
|
||||||
@endpush
|
openModal(brief) {
|
||||||
|
this.activeBrief = brief;
|
||||||
|
this.modalOpen = true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
@endpush
|
||||||
@endsection
|
@endsection
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
@extends('layouts.app')
|
@extends('layouts.app')
|
||||||
@section('title', 'Brand Contracts')
|
@section('title', 'Brand Contracts')
|
||||||
@section('page-title', '📋 Brand Contracts')
|
@section('page-title', 'Brand Contracts 📋')
|
||||||
@section('page-subtitle', 'Manage exclusive brand agreements per category')
|
@section('page-subtitle', 'Manage exclusive brand agreements per category')
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
@@ -15,18 +15,22 @@
|
|||||||
@endif
|
@endif
|
||||||
|
|
||||||
{{-- Add Contract --}}
|
{{-- Add Contract --}}
|
||||||
<div class="cat-card overflow-hidden">
|
<div class="cat-card overflow-hidden" x-data="{ open: {{ $errors->any() ? 'true' : 'false' }} }">
|
||||||
<div class="flex items-center gap-3 px-5 py-4 border-b border-pink-50">
|
<div class="flex items-center gap-3 px-5 py-4 border-b border-pink-50">
|
||||||
<span class="text-xl">➕</span>
|
<button type="button" @click="open = !open"
|
||||||
<h2 class="font-bold text-gray-700">Add New Contract</h2>
|
class="btn-sakura text-xs"
|
||||||
|
x-text="open ? '✕ Close' : '+ Add Contract'">
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div x-show="open" x-transition style="display:none">
|
||||||
<form action="{{ route('contracts.store') }}" method="POST"
|
<form action="{{ route('contracts.store') }}" method="POST"
|
||||||
class="p-5 grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4">
|
class="p-5 grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4 border-b border-pink-50">
|
||||||
@csrf
|
@csrf
|
||||||
<div>
|
<div>
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Contract Title <span class="text-pink-400">*</span></label>
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Contract Title <span class="text-pink-400">*</span></label>
|
||||||
<input type="text" name="title" required maxlength="255"
|
<input type="text" name="title" required maxlength="255"
|
||||||
placeholder="e.g. Exclusive – Energy Drinks 2025"
|
placeholder="e.g. Exclusive – Susu Formula 2026"
|
||||||
class="input-soft" value="{{ old('title') }}">
|
class="input-soft" value="{{ old('title') }}">
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@@ -76,12 +80,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
{{-- Contracts List --}}
|
{{-- Contracts List --}}
|
||||||
<div class="cat-card overflow-hidden">
|
<div class="cat-card overflow-hidden">
|
||||||
<div class="flex items-center gap-3 px-5 py-4 border-b border-pink-50">
|
<div class="flex items-center gap-3 px-5 py-4 border-b border-pink-50">
|
||||||
<span class="text-xl">📋</span>
|
<span class="text-xl">📋</span>
|
||||||
<h2 class="font-bold text-gray-700">Active & Upcoming Contracts</h2>
|
<h2 class="font-bold text-gray-700">All Contracts</h2>
|
||||||
<span class="ml-auto text-xs bg-pink-100 text-pink-600 font-semibold px-2.5 py-0.5 rounded-full">
|
<span class="ml-auto text-xs bg-pink-100 text-pink-600 font-semibold px-2.5 py-0.5 rounded-full">
|
||||||
{{ $contracts->count() }} total
|
{{ $contracts->count() }} total
|
||||||
</span>
|
</span>
|
||||||
@@ -204,6 +209,7 @@
|
|||||||
<li>🔒 When a contract is <strong>Active</strong>, creating schedules or content for a competing brand in the same category will show a warning.</li>
|
<li>🔒 When a contract is <strong>Active</strong>, creating schedules or content for a competing brand in the same category will show a warning.</li>
|
||||||
<li>✅ The contracted brand itself is always allowed — no warning shown.</li>
|
<li>✅ The contracted brand itself is always allowed — no warning shown.</li>
|
||||||
<li>🏷️ Blocking a <strong>parent category</strong> also blocks all its subcategories.</li>
|
<li>🏷️ Blocking a <strong>parent category</strong> also blocks all its subcategories.</li>
|
||||||
|
<li>🏷️ Blocking a <strong>child category</strong> does not block the parent category.</li>
|
||||||
<li>📅 Contracts only block during their active date range. Expired contracts are ignored automatically.</li>
|
<li>📅 Contracts only block during their active date range. Expired contracts are ignored automatically.</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
|
|
||||||
{{-- ── Today's Schedule (TOP) ───────────────────────────────── --}}
|
{{-- ── Today's Schedule (TOP) ───────────────────────────────── --}}
|
||||||
<div class="cat-card p-4 lg:p-6 mb-4">
|
<div class="cat-card p-4 lg:p-6 mb-4">
|
||||||
<div class="flex items-center justify-between mb-4">
|
<div class="flex items-center justify-between mb-4">
|
||||||
<h2 class="text-sm lg:text-base font-bold text-gray-700 flex items-center gap-2">
|
<h2 class="text-sm lg:text-base font-bold text-gray-700 flex items-center gap-2">
|
||||||
<span>📅</span> Today's Schedule
|
<span>📅</span> Today's Schedule
|
||||||
@@ -23,7 +23,8 @@
|
|||||||
@if($activity['priority'])<span class="text-amber-400 text-xs">⭐</span>@endif
|
@if($activity['priority'])<span class="text-amber-400 text-xs">⭐</span>@endif
|
||||||
<span class="text-base shrink-0">{{ $activity['icon'] }}</span>
|
<span class="text-base shrink-0">{{ $activity['icon'] }}</span>
|
||||||
<span class="font-semibold text-gray-800 text-sm truncate">{{ $activity['title'] }}</span>
|
<span class="font-semibold text-gray-800 text-sm truncate">{{ $activity['title'] }}</span>
|
||||||
<span class="text-xs px-2 py-0.5 rounded-full bg-pink-50 text-pink-600 shrink-0 capitalize">{{ $activity['label'] }}</span>
|
<span
|
||||||
|
class="text-xs px-2 py-0.5 rounded-full bg-pink-50 text-pink-600 shrink-0 capitalize">{{ $activity['label'] }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="text-xs text-gray-500 mt-0.5">{{ $activity['subtitle'] }}</div>
|
<div class="text-xs text-gray-500 mt-0.5">{{ $activity['subtitle'] }}</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -42,10 +43,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@endforelse
|
@endforelse
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{-- ── Stat Pills (BELOW schedule) ─────────────────────────── --}}
|
{{-- ── Stat Pills (BELOW schedule) ─────────────────────────── --}}
|
||||||
<div class="grid grid-cols-2 sm:grid-cols-4 gap-3 mb-4">
|
<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">
|
<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-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 lg:text-sm font-semibold text-gray-600">Total Clients</div>
|
||||||
@@ -68,10 +69,10 @@
|
|||||||
<div class="text-xs lg:text-sm font-semibold text-gray-600">Revenue (Paid)</div>
|
<div class="text-xs lg:text-sm font-semibold text-gray-600">Revenue (Paid)</div>
|
||||||
<div class="text-xs text-gray-400">All time</div>
|
<div class="text-xs text-gray-400">All time</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{-- ── Secondary Stats ──────────────────────────────────────── --}}
|
{{-- ── Secondary Stats ──────────────────────────────────────── --}}
|
||||||
<div class="grid grid-cols-3 gap-3 mb-4">
|
<div class="grid grid-cols-3 gap-3 mb-4">
|
||||||
<a href="{{ route('client-categories.index') }}" class="stat-pill hover:shadow-md transition-shadow">
|
<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-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 font-semibold text-gray-600">Categories</div>
|
||||||
@@ -87,11 +88,11 @@
|
|||||||
<div class="text-xs font-semibold text-gray-600">Files Saved</div>
|
<div class="text-xs font-semibold text-gray-600">Files Saved</div>
|
||||||
<div class="text-xs text-gray-400">In file manager</div>
|
<div class="text-xs text-gray-400">In file manager</div>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{-- ── Bottom Row ───────────────────────────────────────────── --}}
|
|
||||||
<div class="grid grid-cols-1 lg:grid-cols-3 gap-4">
|
|
||||||
|
|
||||||
|
{{-- ── Bottom Row ───────────────────────────────────────────── --}}
|
||||||
|
<div class="grid grid-cols-1 lg:grid-cols-3 gap-4">
|
||||||
|
<!--
|
||||||
{{-- Social Stats --}}
|
{{-- Social Stats --}}
|
||||||
<div class="cat-card p-4 lg:p-5">
|
<div class="cat-card p-4 lg:p-5">
|
||||||
<h2 class="text-sm font-bold text-gray-700 flex items-center gap-2 mb-3">
|
<h2 class="text-sm font-bold text-gray-700 flex items-center gap-2 mb-3">
|
||||||
@@ -118,7 +119,7 @@
|
|||||||
</p>
|
</p>
|
||||||
@endforelse
|
@endforelse
|
||||||
</div>
|
</div>
|
||||||
|
-->
|
||||||
{{-- Recent Invoices --}}
|
{{-- Recent Invoices --}}
|
||||||
<div class="cat-card p-4 lg:p-5">
|
<div class="cat-card p-4 lg:p-5">
|
||||||
<div class="flex items-center justify-between mb-3">
|
<div class="flex items-center justify-between mb-3">
|
||||||
@@ -153,6 +154,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<a href="{{ route('content.create') }}" class="btn-sakura text-xs w-full text-center mt-2">+ New Brief</a>
|
<a href="{{ route('content.create') }}" class="btn-sakura text-xs w-full text-center mt-2">+ New Brief</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@include('layouts.fab')
|
||||||
|
|
||||||
@endsection
|
@endsection
|
||||||
@@ -6,8 +6,53 @@
|
|||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
|
|
||||||
|
{{-- ── Video Player Modal ───────────────────────────────────── --}}
|
||||||
|
<div id="video-player-modal"
|
||||||
|
class="fixed inset-0 z-50 flex items-center justify-center bg-black/80 hidden"
|
||||||
|
onclick="if(event.target===this)closeVideoModal()">
|
||||||
|
<div class="relative w-full max-w-3xl mx-4">
|
||||||
|
<div class="flex items-center justify-between mb-3 px-1">
|
||||||
|
<p class="text-white text-sm font-semibold truncate" id="vpm-title"></p>
|
||||||
|
<button onclick="closeVideoModal()"
|
||||||
|
class="text-white/70 hover:text-white text-2xl leading-none ml-4 shrink-0">✕</button>
|
||||||
|
</div>
|
||||||
|
<video id="vpm-player"
|
||||||
|
class="w-full rounded-2xl bg-black shadow-2xl"
|
||||||
|
controls controlsList="nodownload"
|
||||||
|
style="max-height:70vh">
|
||||||
|
</video>
|
||||||
|
<div class="flex items-center justify-between mt-3 px-1 text-xs text-white/60">
|
||||||
|
<span id="vpm-meta"></span>
|
||||||
|
<a id="vpm-dl" href="#" target="_blank"
|
||||||
|
class="text-pink-300 hover:text-pink-200 font-medium">⬇️ Download</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- ── File Detail Popup Modal ──────────────────────────────── --}}
|
||||||
|
<div id="file-detail-modal"
|
||||||
|
class="fixed inset-0 z-50 flex items-end sm:items-center justify-center bg-black/40 hidden"
|
||||||
|
onclick="if(event.target===this)this.classList.add('hidden')">
|
||||||
|
<div class="cat-card p-5 w-full sm:max-w-sm rounded-b-none sm:rounded-3xl shadow-xl mx-0 sm:mx-4">
|
||||||
|
<div class="w-10 h-1 bg-gray-200 rounded-full mx-auto mb-4 sm:hidden"></div>
|
||||||
|
<div class="flex items-center justify-between mb-3">
|
||||||
|
<h3 class="font-bold text-gray-800 text-base" id="fdm-name">File</h3>
|
||||||
|
<button onclick="document.getElementById('file-detail-modal').classList.add('hidden')"
|
||||||
|
class="text-gray-400 hover:text-gray-600 text-xl leading-none">✕</button>
|
||||||
|
</div>
|
||||||
|
<div id="fdm-preview" class="mb-3 flex justify-center"></div>
|
||||||
|
<div class="text-sm text-gray-600 space-y-1.5" id="fdm-body"></div>
|
||||||
|
<div class="flex gap-2 mt-4">
|
||||||
|
<a id="fdm-view-btn" href="#" target="_blank"
|
||||||
|
class="btn-sakura flex-1 text-center py-2 text-sm">View / Download</a>
|
||||||
|
<button onclick="document.getElementById('file-detail-modal').classList.add('hidden')"
|
||||||
|
class="flex-1 py-2 rounded-full border border-pink-200 text-gray-600 text-sm hover:bg-pink-50">Close</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
{{-- ── Upload Form (collapsible) ────────────────────────────── --}}
|
{{-- ── Upload Form (collapsible) ────────────────────────────── --}}
|
||||||
<div class="cat-card p-4 mb-4"
|
<div class="cat-card p-4 mb-4" id="upload-panel"
|
||||||
x-data="{
|
x-data="{
|
||||||
open: false,
|
open: false,
|
||||||
uploading: false,
|
uploading: false,
|
||||||
@@ -169,15 +214,37 @@
|
|||||||
<div class="grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 gap-3">
|
<div class="grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 gap-3">
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
@php $fileData = ['name' => $file->name ?: $file->original_name, 'url' => $file->url, 'size' => $file->human_size, 'folder' => $file->folder, 'client' => $file->client?->name, 'is_image' => $file->is_image, 'is_video' => $file->is_video, 'icon' => $file->icon, 'created_at' => $file->created_at->format('d M Y')] @endphp
|
||||||
<div class="cat-card p-3 flex flex-col gap-2">
|
<div class="cat-card p-3 flex flex-col gap-2">
|
||||||
{{-- Preview / Icon --}}
|
{{-- Preview / Icon --}}
|
||||||
@if($file->is_image)
|
@if($file->is_image)
|
||||||
<div class="w-full aspect-square rounded-2xl overflow-hidden bg-pink-50">
|
<div class="w-full aspect-square rounded-2xl overflow-hidden bg-pink-50 cursor-pointer"
|
||||||
|
onclick="showFileDetail({{ json_encode($fileData) }})">
|
||||||
<img src="{{ $file->url }}" alt="{{ $file->name }}"
|
<img src="{{ $file->url }}" alt="{{ $file->name }}"
|
||||||
class="w-full h-full object-cover">
|
class="w-full h-full object-cover">
|
||||||
</div>
|
</div>
|
||||||
|
@elseif($file->is_video)
|
||||||
|
<div class="w-full aspect-square rounded-2xl overflow-hidden bg-gray-900 relative cursor-pointer group"
|
||||||
|
onclick="openVideoPlayer({{ json_encode($fileData) }})">
|
||||||
|
{{-- Native video poster (browser generates a frame) --}}
|
||||||
|
<video src="{{ $file->url }}"
|
||||||
|
class="w-full h-full object-cover opacity-80"
|
||||||
|
preload="metadata"
|
||||||
|
muted playsinline
|
||||||
|
style="pointer-events:none">
|
||||||
|
</video>
|
||||||
|
{{-- Play overlay --}}
|
||||||
|
<div class="absolute inset-0 flex items-center justify-center
|
||||||
|
bg-black/20 group-hover:bg-black/40 transition-colors">
|
||||||
|
<div class="w-12 h-12 rounded-full bg-white/90 flex items-center justify-center shadow-lg
|
||||||
|
group-hover:scale-110 transition-transform">
|
||||||
|
<span class="text-gray-800 text-xl ml-0.5">▶</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@else
|
@else
|
||||||
<div class="w-full aspect-square rounded-2xl bg-pink-50 flex items-center justify-center text-4xl">
|
<div class="w-full aspect-square rounded-2xl bg-pink-50 flex items-center justify-center text-4xl cursor-pointer"
|
||||||
|
onclick="showFileDetail({{ json_encode($fileData) }})">
|
||||||
{{ $file->icon }}
|
{{ $file->icon }}
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
@@ -219,11 +286,66 @@
|
|||||||
<div class="text-center py-16 text-gray-400">
|
<div class="text-center py-16 text-gray-400">
|
||||||
<span class="text-5xl block mb-3">📁</span>
|
<span class="text-5xl block mb-3">📁</span>
|
||||||
<p class="text-sm">No files yet.</p>
|
<p class="text-sm">No files yet.</p>
|
||||||
<button onclick="document.querySelector('[x-data]').__x.$data.open = true"
|
<button onclick="document.getElementById('upload-panel')._x_dataStack[0].open = true; document.getElementById('upload-panel').scrollIntoView({behavior:'smooth'})"
|
||||||
class="btn-sakura mt-4 inline-block text-sm">Upload your first file</button>
|
class="btn-sakura mt-4 inline-block text-sm">Upload your first file</button>
|
||||||
</div>
|
</div>
|
||||||
@endforelse
|
@endforelse
|
||||||
|
|
||||||
<div class="mt-4">{{ $files->links() }}</div>
|
<div class="mt-4">{{ $files->links() }}</div>
|
||||||
|
|
||||||
|
@push('scripts')
|
||||||
|
<script>
|
||||||
|
function showFileDetail(file) {
|
||||||
|
document.getElementById('fdm-name').textContent = file.name;
|
||||||
|
document.getElementById('fdm-view-btn').href = file.url;
|
||||||
|
|
||||||
|
const preview = document.getElementById('fdm-preview');
|
||||||
|
if (file.is_image) {
|
||||||
|
preview.innerHTML = `<img src="${file.url}" alt="${file.name}" class="max-h-48 rounded-2xl object-contain border border-pink-100">`;
|
||||||
|
} else {
|
||||||
|
preview.innerHTML = `<span class="text-6xl">${file.icon}</span>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
const rows = [
|
||||||
|
['Size', file.size],
|
||||||
|
['Folder', file.folder],
|
||||||
|
file.client ? ['Client', file.client] : null,
|
||||||
|
['Uploaded', file.created_at],
|
||||||
|
].filter(Boolean);
|
||||||
|
|
||||||
|
document.getElementById('fdm-body').innerHTML = rows.map(([label, value]) =>
|
||||||
|
`<div class="flex gap-2"><span class="text-gray-400 w-16 shrink-0">${label}</span><span class="font-medium text-gray-700 truncate">${value}</span></div>`
|
||||||
|
).join('');
|
||||||
|
|
||||||
|
document.getElementById('file-detail-modal').classList.remove('hidden');
|
||||||
|
}
|
||||||
|
|
||||||
|
function openVideoPlayer(file) {
|
||||||
|
const player = document.getElementById('vpm-player');
|
||||||
|
player.src = file.url;
|
||||||
|
player.load();
|
||||||
|
|
||||||
|
document.getElementById('vpm-title').textContent = file.name;
|
||||||
|
document.getElementById('vpm-meta').textContent = file.size + (file.client ? ' · ' + file.client : '');
|
||||||
|
document.getElementById('vpm-dl').href = file.url;
|
||||||
|
|
||||||
|
document.getElementById('video-player-modal').classList.remove('hidden');
|
||||||
|
document.body.style.overflow = 'hidden';
|
||||||
|
}
|
||||||
|
|
||||||
|
function closeVideoModal() {
|
||||||
|
const player = document.getElementById('vpm-player');
|
||||||
|
player.pause();
|
||||||
|
player.src = '';
|
||||||
|
document.getElementById('video-player-modal').classList.add('hidden');
|
||||||
|
document.body.style.overflow = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Close video modal on Escape
|
||||||
|
document.addEventListener('keydown', e => {
|
||||||
|
if (e.key === 'Escape') closeVideoModal();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
@endpush
|
||||||
|
|
||||||
@endsection
|
@endsection
|
||||||
|
|||||||
111
resources/views/gate/login.blade.php
Normal file
111
resources/views/gate/login.blade.php
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en" data-theme="light">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta name="theme-color" content="#FFB7C5">
|
||||||
|
<title>Cathy's App - Login</title>
|
||||||
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Nunito:wght@400;500;600;700;800&display=swap" rel="stylesheet">
|
||||||
|
@vite(['resources/css/app.css', 'resources/js/app.js'])
|
||||||
|
</head>
|
||||||
|
<body class="bg-cream font-sans antialiased min-h-screen flex items-center justify-center px-4"
|
||||||
|
x-data="{ show: false, shaking: false }">
|
||||||
|
|
||||||
|
{{-- ── Decorative blobs ───────────────────────────────────────── --}}
|
||||||
|
<div class="fixed inset-0 overflow-hidden pointer-events-none select-none" aria-hidden="true">
|
||||||
|
<div class="absolute -top-32 -left-32 w-96 h-96 rounded-full opacity-20"
|
||||||
|
style="background: radial-gradient(circle, #FFB7C5, transparent)"></div>
|
||||||
|
<div class="absolute -bottom-32 -right-32 w-96 h-96 rounded-full opacity-20"
|
||||||
|
style="background: radial-gradient(circle, #E8D5F5, transparent)"></div>
|
||||||
|
<div class="absolute top-1/2 left-1/4 w-48 h-48 rounded-full opacity-10"
|
||||||
|
style="background: radial-gradient(circle, #FFC8DD, transparent)"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- ── Login card ─────────────────────────────────────────────── --}}
|
||||||
|
<div class="relative z-10 w-full max-w-sm">
|
||||||
|
|
||||||
|
{{-- Logo / header --}}
|
||||||
|
<div class="text-center mb-8 select-none">
|
||||||
|
<div class="text-7xl mb-3 inline-block animate-bounce" style="animation-duration:2s">🐱</div>
|
||||||
|
<h1 class="text-2xl font-extrabold text-pink-500 leading-tight">Cathy's App</h1>
|
||||||
|
<p class="text-sm text-gray-400 mt-1">Your Purr-fect Assistant</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Card --}}
|
||||||
|
<div class="bg-white rounded-3xl shadow-xl border border-pink-100 p-8">
|
||||||
|
|
||||||
|
<h2 class="text-base font-bold text-gray-700 mb-1">Welcome back 👋</h2>
|
||||||
|
<p class="text-xs text-gray-400 mb-6">Enter the app password to continue.</p>
|
||||||
|
|
||||||
|
{{-- Error --}}
|
||||||
|
@error('password')
|
||||||
|
<div class="flex items-center gap-2 bg-red-50 border border-red-200 text-red-600 text-xs px-4 py-3 rounded-2xl mb-4"
|
||||||
|
x-data x-init="$el.closest('[x-data]').shaking = true; setTimeout(() => $el.closest('[x-data]').shaking = false, 500)">
|
||||||
|
<span class="text-base">😿</span>
|
||||||
|
<span>{{ $message }}</span>
|
||||||
|
</div>
|
||||||
|
@enderror
|
||||||
|
|
||||||
|
<form method="POST" action="{{ route('gate.attempt') }}"
|
||||||
|
:class="shaking ? 'animate-[shake_0.4s_ease-in-out]' : ''">
|
||||||
|
@csrf
|
||||||
|
|
||||||
|
{{-- Password field --}}
|
||||||
|
<div class="relative mb-5">
|
||||||
|
<label for="password" class="block text-xs font-semibold text-gray-500 mb-1.5">
|
||||||
|
Password
|
||||||
|
</label>
|
||||||
|
<div class="relative">
|
||||||
|
<input
|
||||||
|
:type="show ? 'text' : 'password'"
|
||||||
|
id="password"
|
||||||
|
name="password"
|
||||||
|
autocomplete="current-password"
|
||||||
|
autofocus
|
||||||
|
placeholder="Enter password…"
|
||||||
|
class="w-full rounded-2xl border border-pink-100 bg-pink-50/40 px-4 py-3 pr-11 text-sm text-gray-700
|
||||||
|
placeholder-gray-300 outline-none transition
|
||||||
|
focus:border-pink-300 focus:ring-2 focus:ring-pink-100
|
||||||
|
@error('password') border-red-300 bg-red-50/40 @enderror"
|
||||||
|
>
|
||||||
|
{{-- Show/hide toggle --}}
|
||||||
|
<button type="button"
|
||||||
|
@click="show = !show"
|
||||||
|
class="absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-pink-400 transition-colors select-none"
|
||||||
|
tabindex="-1"
|
||||||
|
:title="show ? 'Hide password' : 'Show password'">
|
||||||
|
<span x-text="show ? '🙈' : '👁️'" class="text-base leading-none"></span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Submit --}}
|
||||||
|
<button type="submit"
|
||||||
|
class="w-full py-3 rounded-2xl font-bold text-sm text-white shadow-md
|
||||||
|
transition-all duration-200 active:scale-95 hover:shadow-lg hover:brightness-105"
|
||||||
|
style="background: linear-gradient(135deg, #FFB7C5, #E8A0B4)">
|
||||||
|
🐾 Enter the App
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Footer hint --}}
|
||||||
|
<p class="text-center text-xs text-gray-400 mt-5">
|
||||||
|
<!-- Session lasts 24 hours after login. -->
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Shake keyframe --}}
|
||||||
|
<style>
|
||||||
|
@keyframes shake {
|
||||||
|
0%, 100% { transform: translateX(0); }
|
||||||
|
20% { transform: translateX(-6px); }
|
||||||
|
40% { transform: translateX(6px); }
|
||||||
|
60% { transform: translateX(-4px); }
|
||||||
|
80% { transform: translateX(4px); }
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -5,15 +5,16 @@
|
|||||||
@section('page-subtitle', 'Fill in the invoice details')
|
@section('page-subtitle', 'Fill in the invoice details')
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<div class="max-w-3xl mx-auto">
|
<div class="max-w-3xl mx-auto">
|
||||||
<div class="cat-card p-4 lg:p-8" x-data="invoiceForm()">
|
<div class="cat-card p-4 lg:p-8" x-data="invoiceForm()">
|
||||||
<form action="{{ route('invoices.store') }}" method="POST">
|
<form action="{{ route('invoices.store') }}" method="POST" enctype="multipart/form-data">
|
||||||
@csrf
|
@csrf
|
||||||
|
|
||||||
{{-- Header fields --}}
|
{{-- Header fields --}}
|
||||||
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3 mb-5">
|
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3 mb-5">
|
||||||
<div class="sm:col-span-2">
|
<div class="sm:col-span-2">
|
||||||
<label class="block text-sm font-semibold text-gray-700 mb-1">Invoice Title <span class="text-pink-400">*</span></label>
|
<label class="block text-sm font-semibold text-gray-700 mb-1">Invoice Title <span
|
||||||
|
class="text-pink-400">*</span></label>
|
||||||
<input type="text" name="title" value="{{ old('title') }}" class="input-soft" required
|
<input type="text" name="title" value="{{ old('title') }}" class="input-soft" required
|
||||||
placeholder="e.g. Instagram Collaboration - Brand X">
|
placeholder="e.g. Instagram Collaboration - Brand X">
|
||||||
</div>
|
</div>
|
||||||
@@ -44,13 +45,13 @@
|
|||||||
<div>
|
<div>
|
||||||
<label class="block text-sm font-semibold text-gray-700 mb-1">Due Date</label>
|
<label class="block text-sm font-semibold text-gray-700 mb-1">Due Date</label>
|
||||||
<input type="date" name="due_date"
|
<input type="date" name="due_date"
|
||||||
value="{{ old('due_date', today()->addDays(14)->toDateString()) }}"
|
value="{{ old('due_date', today()->addDays(14)->toDateString()) }}" class="input-soft" required>
|
||||||
class="input-soft" required>
|
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label class="block text-sm font-semibold text-gray-700 mb-1">Tax Rate (%)</label>
|
<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()"
|
<input type="number" name="tax_rate" x-model="taxRate" @input="recalc()"
|
||||||
value="{{ old('tax_rate', $invoiceSettings->default_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>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -65,10 +66,8 @@
|
|||||||
<template x-for="(item, index) in items" :key="index">
|
<template x-for="(item, index) in items" :key="index">
|
||||||
<div class="bg-pink-50 rounded-2xl p-3">
|
<div class="bg-pink-50 rounded-2xl p-3">
|
||||||
{{-- Description full width --}}
|
{{-- Description full width --}}
|
||||||
<input type="text" :name="`items[${index}][description]`"
|
<input type="text" :name="`items[${index}][description]`" x-model="item.description"
|
||||||
x-model="item.description"
|
class="input-soft text-sm mb-2 bg-white" placeholder="Service description" required>
|
||||||
class="input-soft text-sm mb-2 bg-white"
|
|
||||||
placeholder="Service description" required>
|
|
||||||
{{-- Qty / Price / Total in a row --}}
|
{{-- Qty / Price / Total in a row --}}
|
||||||
<div class="flex gap-2 items-center">
|
<div class="flex gap-2 items-center">
|
||||||
<div class="w-16 shrink-0">
|
<div class="w-16 shrink-0">
|
||||||
@@ -79,10 +78,16 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="flex-1">
|
<div class="flex-1">
|
||||||
<label class="text-xs text-gray-400 block mb-0.5">Unit Price</label>
|
<label class="text-xs text-gray-400 block mb-0.5">Unit Price</label>
|
||||||
<input type="number" :name="`items[${index}][unit_price]`"
|
<input type="hidden" :name="`items[${index}][unit_price]`" :value="item.unit_price">
|
||||||
x-model.number="item.unit_price" @input="recalc()"
|
<input type="text"
|
||||||
class="input-soft text-sm bg-white" min="0" step="1000"
|
:value="item.unit_price ? formatNum(item.unit_price) : ''"
|
||||||
placeholder="0">
|
@input="
|
||||||
|
let raw = $event.target.value.replace(/\D/g, '');
|
||||||
|
item.unit_price = raw ? parseInt(raw, 10) : 0;
|
||||||
|
$event.target.value = item.unit_price ? formatNum(item.unit_price) : '';
|
||||||
|
recalc();
|
||||||
|
"
|
||||||
|
class="input-soft text-sm bg-white" placeholder="0">
|
||||||
</div>
|
</div>
|
||||||
<div class="w-24 shrink-0 text-right">
|
<div class="w-24 shrink-0 text-right">
|
||||||
<label class="text-xs text-gray-400 block mb-0.5">Total</label>
|
<label class="text-xs text-gray-400 block mb-0.5">Total</label>
|
||||||
@@ -93,18 +98,29 @@
|
|||||||
<button type="button" @click="removeItem(index)"
|
<button type="button" @click="removeItem(index)"
|
||||||
class="text-red-400 hover:text-red-600 text-lg shrink-0 pt-4">✕</button>
|
class="text-red-400 hover:text-red-600 text-lg shrink-0 pt-4">✕</button>
|
||||||
</div>
|
</div>
|
||||||
{{-- Taxable checkbox --}}
|
{{-- Taxable and Discount checkboxes --}}
|
||||||
<div class="mt-2 flex items-center gap-2">
|
<div class="mt-2 flex items-center gap-4">
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
<input type="hidden" :name="`items[${index}][is_taxable]`" value="0">
|
<input type="hidden" :name="`items[${index}][is_taxable]`" value="0">
|
||||||
<input type="checkbox" :name="`items[${index}][is_taxable]`"
|
<input type="checkbox" :name="`items[${index}][is_taxable]`" :id="`taxable_${index}`"
|
||||||
:id="`taxable_${index}`"
|
x-model="item.is_taxable" @change="recalc()" value="1"
|
||||||
x-model="item.is_taxable" @change="recalc()"
|
|
||||||
value="1"
|
|
||||||
class="w-3.5 h-3.5 accent-pink-400">
|
class="w-3.5 h-3.5 accent-pink-400">
|
||||||
<label :for="`taxable_${index}`" class="text-xs text-gray-500 cursor-pointer select-none">
|
<label :for="`taxable_${index}`"
|
||||||
|
class="text-xs text-gray-500 cursor-pointer select-none">
|
||||||
Taxable
|
Taxable
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="flex items-center gap-2" x-show="addDiscount">
|
||||||
|
<input type="hidden" :name="`items[${index}][is_discountable]`" value="0">
|
||||||
|
<input type="checkbox" :name="`items[${index}][is_discountable]`" :id="`discountable_${index}`"
|
||||||
|
x-model="item.is_discountable" @change="recalc()" value="1"
|
||||||
|
class="w-3.5 h-3.5 accent-pink-400">
|
||||||
|
<label :for="`discountable_${index}`"
|
||||||
|
class="text-xs text-gray-500 cursor-pointer select-none">
|
||||||
|
Discount
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
@@ -112,27 +128,50 @@
|
|||||||
|
|
||||||
{{-- Totals --}}
|
{{-- Totals --}}
|
||||||
<div class="bg-pink-50 rounded-2xl p-4 mb-5">
|
<div class="bg-pink-50 rounded-2xl p-4 mb-5">
|
||||||
|
<div class="mb-3 border-b border-pink-100 pb-3 flex flex-col sm:flex-row sm:items-center gap-y-2 gap-x-4 min-h-[32px]">
|
||||||
|
<label class="flex items-center gap-2 cursor-pointer shrink-0 w-max">
|
||||||
|
<input type="checkbox" x-model="addDiscount" @change="toggleDiscount()" class="w-4 h-4 accent-pink-400">
|
||||||
|
<span class="text-sm font-bold text-gray-700">Add Discount</span>
|
||||||
|
</label>
|
||||||
|
<div x-show="addDiscount" class="flex items-center gap-3 flex-1 overflow-hidden" style="display: none;">
|
||||||
|
<input type="range" name="discount_rate" min="5" max="90" step="5" x-model.number="discountRate" @input="recalc()" class="w-32 sm:w-48 accent-pink-500 h-2 bg-pink-100 rounded-lg appearance-none cursor-pointer shrink-0 hover:accent-pink-600 transition-all">
|
||||||
|
<span class="font-bold text-pink-600 text-sm shrink-0 w-8 text-right"><span x-text="discountRate"></span>%</span>
|
||||||
|
<span class="text-xs text-pink-500 font-medium tracking-wide truncate border-l border-pink-200 pl-3" x-text="getDiscountLabel()"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="flex justify-between text-sm py-1">
|
<div class="flex justify-between text-sm py-1">
|
||||||
<span class="text-gray-500">Subtotal (all items)</span>
|
<span class="text-gray-500">Subtotal (all items)</span>
|
||||||
<span class="font-semibold">Rp <span x-text="formatNum(subtotal)"></span></span>
|
<span class="font-semibold">Rp <span x-text="formatNum(subtotal)"></span></span>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="flex justify-between text-sm py-1 text-pink-500" x-show="addDiscount && discountAmount > 0">
|
||||||
|
<span>Discount (<span x-text="discountRate"></span>%)</span>
|
||||||
|
<span class="font-semibold">- Rp <span x-text="formatNum(discountAmount)"></span></span>
|
||||||
|
</div>
|
||||||
<div class="flex justify-between text-sm py-1 text-amber-600">
|
<div class="flex justify-between text-sm py-1 text-amber-600">
|
||||||
<span>Tax (<span x-text="taxRate"></span>% — paid by client)</span>
|
<span>Tax (<span x-text="taxRate"></span>% — paid by client)</span>
|
||||||
<span class="font-semibold">Rp <span x-text="formatNum(taxAmount)"></span></span>
|
<span class="font-semibold">Rp <span x-text="formatNum(taxAmount)"></span></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex justify-between text-base font-bold py-2 mt-1 border-t border-pink-200">
|
<div class="flex justify-between text-base font-bold py-2 mt-1 border-t border-pink-200">
|
||||||
<span class="text-gray-700">Total (you receive)</span>
|
<span class="text-gray-700">Grand Total</span>
|
||||||
<span class="text-pink-600">Rp <span x-text="formatNum(total)"></span></span>
|
<span class="text-pink-600">Rp <span x-text="formatNum(total)"></span></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-5 flex items-center gap-2 bg-pink-50/50 p-4 rounded-2xl border border-pink-100">
|
||||||
|
<input type="hidden" name="use_custom_fields" value="0">
|
||||||
|
<input type="checkbox" id="useCustomFields" name="use_custom_fields" value="1" x-model="showCustomFields" class="w-4 h-4 text-pink-600 bg-white border-pink-300 rounded focus:ring-pink-500 cursor-pointer">
|
||||||
|
<label for="useCustomFields" class="text-sm font-bold text-gray-700 cursor-pointer select-none">Show Custom Bank & Signature Settings</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div x-show="showCustomFields" x-collapse>
|
||||||
{{-- Bank Info --}}
|
{{-- Bank Info --}}
|
||||||
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3 mb-5">
|
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3 mb-5">
|
||||||
<div>
|
<div>
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Bank Name</label>
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Bank Name</label>
|
||||||
<input type="text" name="bank_name"
|
<input type="text" name="bank_name"
|
||||||
value="{{ old('bank_name', $invoiceSettings->default_bank_name) }}"
|
value="{{ old('bank_name', $invoiceSettings->default_bank_name) }}" class="input-soft text-sm"
|
||||||
class="input-soft text-sm" placeholder="BCA, Mandiri...">
|
placeholder="BCA, Mandiri...">
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Branch Name</label>
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Branch Name</label>
|
||||||
@@ -154,8 +193,32 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{{-- Custom Signature Text --}}
|
||||||
|
<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">Signer Name</label>
|
||||||
|
<input type="text" name="signer_name" value="{{ old('signer_name') }}" class="input-soft text-sm" placeholder="e.g. Cathy">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Signer Title</label>
|
||||||
|
<input type="text" name="signer_title" value="{{ old('signer_title') }}" class="input-soft text-sm" placeholder="e.g. Director">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="mb-5">
|
<div class="mb-5">
|
||||||
<label class="block text-sm font-semibold text-gray-700 mb-1">Notes</label>
|
<label class="block text-sm font-semibold text-gray-700 mb-1">Custom Signature Image (Optional)</label>
|
||||||
|
<p class="text-xs text-gray-400 mb-2">Leave blank to use your default signature from settings.</p>
|
||||||
|
<input type="file" name="signature_image" 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">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-5">
|
||||||
|
<label class="block text-sm font-semibold text-gray-700 mb-1">Notes / Payment Terms</label>
|
||||||
<textarea name="notes" rows="2" class="input-soft resize-none"
|
<textarea name="notes" rows="2" class="input-soft resize-none"
|
||||||
placeholder="Payment terms, etc.">{{ old('notes', $invoiceSettings->default_notes) }}</textarea>
|
placeholder="Payment terms, etc.">{{ old('notes', $invoiceSettings->default_notes) }}</textarea>
|
||||||
</div>
|
</div>
|
||||||
@@ -169,30 +232,80 @@
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@push('scripts')
|
@push('scripts')
|
||||||
<script>
|
<script>
|
||||||
function invoiceForm() {
|
function invoiceForm() {
|
||||||
return {
|
return {
|
||||||
items: [{ description: @json($invoiceSettings->default_service_description ?? ''), quantity: 1, unit_price: 0, is_taxable: true }],
|
showCustomFields: {{ old('use_custom_fields', false) ? 'true' : 'false' }},
|
||||||
|
addDiscount: false,
|
||||||
|
discountRate: 5,
|
||||||
|
items: [{ description: @json($invoiceSettings->default_service_description ?? ''), quantity: 1, unit_price: 0, is_taxable: true, is_discountable: false }],
|
||||||
taxRate: {{ $invoiceSettings->default_tax_rate ?? 11 }},
|
taxRate: {{ $invoiceSettings->default_tax_rate ?? 11 }},
|
||||||
get subtotal() {
|
get subtotal() {
|
||||||
return this.items.reduce((s, i) => s + (i.quantity * i.unit_price), 0);
|
return this.items.reduce((s, i) => s + (i.quantity * i.unit_price), 0);
|
||||||
},
|
},
|
||||||
|
get discountAmount() {
|
||||||
|
if (!this.addDiscount) return 0;
|
||||||
|
const discountable = this.items
|
||||||
|
.filter(i => i.is_discountable)
|
||||||
|
.reduce((s, i) => s + (i.quantity * i.unit_price), 0);
|
||||||
|
return Math.round(discountable * (this.discountRate / 100));
|
||||||
|
},
|
||||||
|
get totalSubtotal() {
|
||||||
|
return this.subtotal - this.discountAmount;
|
||||||
|
},
|
||||||
get taxAmount() {
|
get taxAmount() {
|
||||||
const taxable = this.items
|
const taxable = this.items
|
||||||
.filter(i => i.is_taxable)
|
.filter(i => i.is_taxable)
|
||||||
.reduce((s, i) => s + (i.quantity * i.unit_price), 0);
|
.reduce((s, i) => {
|
||||||
|
let itemTotal = i.quantity * i.unit_price;
|
||||||
|
if (this.addDiscount && i.is_discountable) {
|
||||||
|
itemTotal -= itemTotal * (this.discountRate / 100);
|
||||||
|
}
|
||||||
|
return s + itemTotal;
|
||||||
|
}, 0);
|
||||||
return Math.round(taxable * this.taxRate / 100);
|
return Math.round(taxable * this.taxRate / 100);
|
||||||
},
|
},
|
||||||
get total() { return this.subtotal; }, // grand total = pre-tax (tax borne by client)
|
get total() { return this.totalSubtotal; }, // grand total = pre-tax
|
||||||
addItem() { this.items.push({ description: '', quantity: 1, unit_price: 0, is_taxable: true }); },
|
getDiscountLabel() {
|
||||||
|
const labels = {
|
||||||
|
5: 'Small thank-you discount 🙏',
|
||||||
|
10: 'Appreciation bonus ✨',
|
||||||
|
15: 'Loyalty perk unlocked 🤝',
|
||||||
|
20: 'Client appreciation deal 💼',
|
||||||
|
25: 'Special partner discount ⭐',
|
||||||
|
30: 'Valued client offer 🎯',
|
||||||
|
35: 'Priority client savings 📌',
|
||||||
|
40: 'Strong appreciation rate 💎',
|
||||||
|
45: 'Preferred client pricing 🏅',
|
||||||
|
50: 'Half-off partner special 🎉',
|
||||||
|
55: 'Premium loyalty reward 🧩',
|
||||||
|
60: 'Major appreciation offer 🚀',
|
||||||
|
65: 'VIP-level savings 🏆',
|
||||||
|
70: 'Elite client advantage 👑',
|
||||||
|
75: 'Strategic partner bonus 🤝✨',
|
||||||
|
80: 'Executive-tier discount 💼🔥',
|
||||||
|
85: 'Signature client reward 🖋️',
|
||||||
|
90: 'Ultimate partnership rate 🌟'
|
||||||
|
};
|
||||||
|
return labels[this.discountRate] || '';
|
||||||
|
},
|
||||||
|
toggleDiscount() {
|
||||||
|
if (this.addDiscount) {
|
||||||
|
this.items.forEach(i => i.is_discountable = true);
|
||||||
|
} else {
|
||||||
|
// We can leave them checked or uncheck them, usually uncheck
|
||||||
|
this.items.forEach(i => i.is_discountable = false);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
addItem() { this.items.push({ description: '', quantity: 1, unit_price: 0, is_taxable: true, is_discountable: this.addDiscount }); },
|
||||||
removeItem(i) { if (this.items.length > 1) this.items.splice(i, 1); },
|
removeItem(i) { if (this.items.length > 1) this.items.splice(i, 1); },
|
||||||
recalc() {},
|
recalc() { },
|
||||||
formatNum(n) { return Number(n).toLocaleString('id-ID'); },
|
formatNum(n) { return Number(n).toLocaleString('id-ID'); },
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@endpush
|
@endpush
|
||||||
@endsection
|
@endsection
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
@section('content')
|
@section('content')
|
||||||
<div class="max-w-3xl mx-auto">
|
<div class="max-w-3xl mx-auto">
|
||||||
<div class="cat-card p-4 lg:p-8" x-data="invoiceEditForm()">
|
<div class="cat-card p-4 lg:p-8" x-data="invoiceEditForm()">
|
||||||
<form action="{{ route('invoices.update', $invoice) }}" method="POST">
|
<form action="{{ route('invoices.update', $invoice) }}" method="POST" enctype="multipart/form-data">
|
||||||
@csrf @method('PUT')
|
@csrf @method('PUT')
|
||||||
|
|
||||||
{{-- Header fields --}}
|
{{-- Header fields --}}
|
||||||
@@ -75,9 +75,16 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="flex-1">
|
<div class="flex-1">
|
||||||
<label class="text-xs text-gray-400 block mb-0.5">Unit Price</label>
|
<label class="text-xs text-gray-400 block mb-0.5">Unit Price</label>
|
||||||
<input type="number" :name="`items[${index}][unit_price]`"
|
<input type="hidden" :name="`items[${index}][unit_price]`" :value="item.unit_price">
|
||||||
x-model.number="item.unit_price" @input="recalc()"
|
<input type="text"
|
||||||
class="input-soft text-sm bg-white" min="0" step="1000">
|
:value="item.unit_price ? formatNum(item.unit_price) : ''"
|
||||||
|
@input="
|
||||||
|
let raw = $event.target.value.replace(/\D/g, '');
|
||||||
|
item.unit_price = raw ? parseInt(raw, 10) : 0;
|
||||||
|
$event.target.value = item.unit_price ? formatNum(item.unit_price) : '';
|
||||||
|
recalc();
|
||||||
|
"
|
||||||
|
class="input-soft text-sm bg-white" placeholder="0">
|
||||||
</div>
|
</div>
|
||||||
<div class="w-24 shrink-0 text-right">
|
<div class="w-24 shrink-0 text-right">
|
||||||
<label class="text-xs text-gray-400 block mb-0.5">Total</label>
|
<label class="text-xs text-gray-400 block mb-0.5">Total</label>
|
||||||
@@ -88,8 +95,9 @@
|
|||||||
<button type="button" @click="removeItem(index)"
|
<button type="button" @click="removeItem(index)"
|
||||||
class="text-red-400 hover:text-red-600 text-lg shrink-0 pt-4">✕</button>
|
class="text-red-400 hover:text-red-600 text-lg shrink-0 pt-4">✕</button>
|
||||||
</div>
|
</div>
|
||||||
{{-- Taxable checkbox --}}
|
{{-- Taxable and Discount checkboxes --}}
|
||||||
<div class="mt-2 flex items-center gap-2">
|
<div class="mt-2 flex items-center gap-4">
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
<input type="hidden" :name="`items[${index}][is_taxable]`" value="0">
|
<input type="hidden" :name="`items[${index}][is_taxable]`" value="0">
|
||||||
<input type="checkbox" :name="`items[${index}][is_taxable]`"
|
<input type="checkbox" :name="`items[${index}][is_taxable]`"
|
||||||
:id="`taxable_${index}`"
|
:id="`taxable_${index}`"
|
||||||
@@ -100,6 +108,18 @@
|
|||||||
Taxable
|
Taxable
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="flex items-center gap-2" x-show="addDiscount">
|
||||||
|
<input type="hidden" :name="`items[${index}][is_discountable]`" value="0">
|
||||||
|
<input type="checkbox" :name="`items[${index}][is_discountable]`"
|
||||||
|
:id="`discountable_${index}`"
|
||||||
|
x-model="item.is_discountable" @change="recalc()"
|
||||||
|
value="1"
|
||||||
|
class="w-3.5 h-3.5 accent-pink-400">
|
||||||
|
<label :for="`discountable_${index}`" class="text-xs text-gray-500 cursor-pointer select-none">
|
||||||
|
Discount
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
@@ -107,20 +127,43 @@
|
|||||||
|
|
||||||
{{-- Totals --}}
|
{{-- Totals --}}
|
||||||
<div class="bg-pink-50 rounded-2xl p-4 mb-5">
|
<div class="bg-pink-50 rounded-2xl p-4 mb-5">
|
||||||
|
<div class="mb-3 border-b border-pink-100 pb-3 flex flex-col sm:flex-row sm:items-center gap-y-2 gap-x-4 min-h-[32px]">
|
||||||
|
<label class="flex items-center gap-2 cursor-pointer shrink-0 w-max">
|
||||||
|
<input type="checkbox" x-model="addDiscount" @change="toggleDiscount()" class="w-4 h-4 accent-pink-400">
|
||||||
|
<span class="text-sm font-bold text-gray-700">Add Discount</span>
|
||||||
|
</label>
|
||||||
|
<div x-show="addDiscount" class="flex items-center gap-3 flex-1 overflow-hidden" style="display: none;">
|
||||||
|
<input type="range" name="discount_rate" min="5" max="90" step="5" x-model.number="discountRate" @input="recalc()" class="w-32 sm:w-48 accent-pink-500 h-2 bg-pink-100 rounded-lg appearance-none cursor-pointer shrink-0 hover:accent-pink-600 transition-all">
|
||||||
|
<span class="font-bold text-pink-600 text-sm shrink-0 w-8 text-right"><span x-text="discountRate"></span>%</span>
|
||||||
|
<span class="text-xs text-pink-500 font-medium tracking-wide truncate border-l border-pink-200 pl-3" x-text="getDiscountLabel()"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="flex justify-between text-sm py-1">
|
<div class="flex justify-between text-sm py-1">
|
||||||
<span class="text-gray-500">Subtotal (all items)</span>
|
<span class="text-gray-500">Subtotal (all items)</span>
|
||||||
<span class="font-semibold">Rp <span x-text="formatNum(subtotal)"></span></span>
|
<span class="font-semibold">Rp <span x-text="formatNum(subtotal)"></span></span>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="flex justify-between text-sm py-1 text-pink-500" x-show="addDiscount && discountAmount > 0">
|
||||||
|
<span>Discount (<span x-text="discountRate"></span>%)</span>
|
||||||
|
<span class="font-semibold">- Rp <span x-text="formatNum(discountAmount)"></span></span>
|
||||||
|
</div>
|
||||||
<div class="flex justify-between text-sm py-1 text-amber-600">
|
<div class="flex justify-between text-sm py-1 text-amber-600">
|
||||||
<span>Tax (<span x-text="taxRate"></span>% — paid by client)</span>
|
<span>Tax (<span x-text="taxRate"></span>% — paid by client)</span>
|
||||||
<span class="font-semibold">Rp <span x-text="formatNum(taxAmount)"></span></span>
|
<span class="font-semibold">Rp <span x-text="formatNum(taxAmount)"></span></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex justify-between text-base font-bold py-2 mt-1 border-t border-pink-200">
|
<div class="flex justify-between text-base font-bold py-2 mt-1 border-t border-pink-200">
|
||||||
<span class="text-gray-700">Total (you receive)</span>
|
<span class="text-gray-700">Grand Total</span>
|
||||||
<span class="text-pink-600">Rp <span x-text="formatNum(total)"></span></span>
|
<span class="text-pink-600">Rp <span x-text="formatNum(total)"></span></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-5 flex items-center gap-2 bg-pink-50/50 p-4 rounded-2xl border border-pink-100">
|
||||||
|
<input type="hidden" name="use_custom_fields" value="0">
|
||||||
|
<input type="checkbox" id="useCustomFields" name="use_custom_fields" value="1" x-model="showCustomFields" class="w-4 h-4 text-pink-600 bg-white border-pink-300 rounded focus:ring-pink-500 cursor-pointer">
|
||||||
|
<label for="useCustomFields" class="text-sm font-bold text-gray-700 cursor-pointer select-none">Show Custom Bank & Signature Settings</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div x-show="showCustomFields" x-collapse>
|
||||||
{{-- Bank Info --}}
|
{{-- Bank Info --}}
|
||||||
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3 mb-5">
|
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3 mb-5">
|
||||||
<div>
|
<div>
|
||||||
@@ -145,8 +188,51 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{{-- Custom Signature Text --}}
|
||||||
|
<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">Signer Name</label>
|
||||||
|
<input type="text" name="signer_name" value="{{ old('signer_name', $invoice->signer_name) }}" class="input-soft text-sm" placeholder="e.g. Cathy">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Signer Title</label>
|
||||||
|
<input type="text" name="signer_title" value="{{ old('signer_title', $invoice->signer_title) }}" class="input-soft text-sm" placeholder="e.g. Director">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-5" x-data="{
|
||||||
|
removeSign() {
|
||||||
|
if (!confirm('Remove the signature from this invoice?')) return;
|
||||||
|
$refs.removeSignInput.value = '1';
|
||||||
|
this.$el.closest('form').submit();
|
||||||
|
}
|
||||||
|
}">
|
||||||
|
<label class="block text-sm font-semibold text-gray-700 mb-1">Custom Signature Image (Optional)</label>
|
||||||
|
<p class="text-xs text-gray-400 mb-3">Upload a specific signature for this invoice. Leave blank to keep the current one.</p>
|
||||||
|
|
||||||
|
@if($invoice->signature_image)
|
||||||
|
<div class="flex items-center gap-4 mb-3 p-3 bg-white rounded-xl border border-pink-100">
|
||||||
|
<img src="{{ '/storage/' . $invoice->signature_image }}" alt="Signature" class="h-16 object-contain">
|
||||||
|
<div>
|
||||||
|
<input type="hidden" name="remove_signature" value="0" x-ref="removeSignInput">
|
||||||
|
<button type="button" @click="removeSign()" class="text-xs px-3 py-1.5 rounded-full border border-red-200 text-red-400 hover:bg-red-50">
|
||||||
|
🗑️ Remove
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<input type="file" name="signature_image" 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">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="mb-5">
|
<div class="mb-5">
|
||||||
<label class="block text-sm font-semibold text-gray-700 mb-1">Notes</label>
|
<label class="block text-sm font-semibold text-gray-700 mb-1">Notes / Payment Terms</label>
|
||||||
<textarea name="notes" rows="2" class="input-soft resize-none">{{ old('notes', $invoice->notes) }}</textarea>
|
<textarea name="notes" rows="2" class="input-soft resize-none">{{ old('notes', $invoice->notes) }}</textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -166,23 +252,72 @@
|
|||||||
function invoiceEditForm() {
|
function invoiceEditForm() {
|
||||||
@php
|
@php
|
||||||
$itemsJson = $invoice->items->map(function($i) {
|
$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];
|
return ['description' => $i->description, 'quantity' => $i->quantity, 'unit_price' => (float)$i->unit_price, 'is_taxable' => (bool)$i->is_taxable, 'is_discountable' => (bool)$i->is_discountable];
|
||||||
});
|
});
|
||||||
@endphp
|
@endphp
|
||||||
return {
|
return {
|
||||||
|
showCustomFields: {{ old('use_custom_fields', ($invoice->bank_name || $invoice->signature_image || $invoice->signer_name || $invoice->signer_title) ? true : false) ? 'true' : 'false' }},
|
||||||
|
addDiscount: {{ $invoice->discount_rate > 0 ? 'true' : 'false' }},
|
||||||
|
discountRate: {{ $invoice->discount_rate ?: 5 }},
|
||||||
items: @json($itemsJson),
|
items: @json($itemsJson),
|
||||||
taxRate: {{ $invoice->tax_rate }},
|
taxRate: {{ $invoice->tax_rate }},
|
||||||
get subtotal() {
|
get subtotal() {
|
||||||
return this.items.reduce((s, i) => s + (i.quantity * i.unit_price), 0);
|
return this.items.reduce((s, i) => s + (i.quantity * i.unit_price), 0);
|
||||||
},
|
},
|
||||||
|
get discountAmount() {
|
||||||
|
if (!this.addDiscount) return 0;
|
||||||
|
const discountable = this.items
|
||||||
|
.filter(i => i.is_discountable)
|
||||||
|
.reduce((s, i) => s + (i.quantity * i.unit_price), 0);
|
||||||
|
return Math.round(discountable * (this.discountRate / 100));
|
||||||
|
},
|
||||||
|
get totalSubtotal() {
|
||||||
|
return this.subtotal - this.discountAmount;
|
||||||
|
},
|
||||||
get taxAmount() {
|
get taxAmount() {
|
||||||
const taxable = this.items
|
const taxable = this.items
|
||||||
.filter(i => i.is_taxable)
|
.filter(i => i.is_taxable)
|
||||||
.reduce((s, i) => s + (i.quantity * i.unit_price), 0);
|
.reduce((s, i) => {
|
||||||
|
let itemTotal = i.quantity * i.unit_price;
|
||||||
|
if (this.addDiscount && i.is_discountable) {
|
||||||
|
itemTotal -= itemTotal * (this.discountRate / 100);
|
||||||
|
}
|
||||||
|
return s + itemTotal;
|
||||||
|
}, 0);
|
||||||
return Math.round(taxable * this.taxRate / 100);
|
return Math.round(taxable * this.taxRate / 100);
|
||||||
},
|
},
|
||||||
get total() { return this.subtotal; },
|
get total() { return this.totalSubtotal; }, // grand total = pre-tax
|
||||||
addItem() { this.items.push({ description: '', quantity: 1, unit_price: 0, is_taxable: true }); },
|
getDiscountLabel() {
|
||||||
|
const labels = {
|
||||||
|
5: 'Small thank-you discount 🙏',
|
||||||
|
10: 'Appreciation bonus ✨',
|
||||||
|
15: 'Loyalty perk unlocked 🤝',
|
||||||
|
20: 'Client appreciation deal 💼',
|
||||||
|
25: 'Special partner discount ⭐',
|
||||||
|
30: 'Valued client offer 🎯',
|
||||||
|
35: 'Priority client savings 📌',
|
||||||
|
40: 'Strong appreciation rate 💎',
|
||||||
|
45: 'Preferred client pricing 🏅',
|
||||||
|
50: 'Half-off partner special 🎉',
|
||||||
|
55: 'Premium loyalty reward 🧩',
|
||||||
|
60: 'Major appreciation offer 🚀',
|
||||||
|
65: 'VIP-level savings 🏆',
|
||||||
|
70: 'Elite client advantage 👑',
|
||||||
|
75: 'Strategic partner bonus 🤝✨',
|
||||||
|
80: 'Executive-tier discount 💼🔥',
|
||||||
|
85: 'Signature client reward 🖋️',
|
||||||
|
90: 'Ultimate partnership rate 🌟'
|
||||||
|
};
|
||||||
|
return labels[this.discountRate] || '';
|
||||||
|
},
|
||||||
|
toggleDiscount() {
|
||||||
|
if (this.addDiscount) {
|
||||||
|
this.items.forEach(i => i.is_discountable = true);
|
||||||
|
} else {
|
||||||
|
this.items.forEach(i => i.is_discountable = false);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
addItem() { this.items.push({ description: '', quantity: 1, unit_price: 0, is_taxable: true, is_discountable: this.addDiscount }); },
|
||||||
removeItem(i) { if (this.items.length > 1) this.items.splice(i, 1); },
|
removeItem(i) { if (this.items.length > 1) this.items.splice(i, 1); },
|
||||||
recalc() {},
|
recalc() {},
|
||||||
formatNum(n) { return Number(n).toLocaleString('id-ID'); },
|
formatNum(n) { return Number(n).toLocaleString('id-ID'); },
|
||||||
|
|||||||
@@ -5,30 +5,19 @@
|
|||||||
@section('page-subtitle', 'Manage your brand deal payments')
|
@section('page-subtitle', 'Manage your brand deal payments')
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<div class="flex flex-col sm:flex-row sm:items-center justify-between gap-3 mb-5">
|
<div class="flex flex-col sm:flex-row sm:items-center justify-between gap-3 mb-5">
|
||||||
<div class="flex gap-2 flex-wrap">
|
|
||||||
@foreach(['all','draft','sent','paid','overdue'] as $s)
|
|
||||||
<a href="{{ request()->fullUrlWithQuery(['status' => $s]) }}"
|
|
||||||
class="px-3 py-1.5 rounded-full text-xs font-semibold transition-colors
|
|
||||||
{{ request('status', 'all') === $s
|
|
||||||
? 'text-white'
|
|
||||||
: 'bg-white text-gray-500 hover:bg-pink-50 border border-pink-100' }}"
|
|
||||||
style="{{ request('status', 'all') === $s ? 'background:#FFB7C5' : '' }}">
|
|
||||||
{{ ucfirst($s) }}
|
|
||||||
</a>
|
|
||||||
@endforeach
|
|
||||||
</div>
|
|
||||||
<div class="flex gap-2 shrink-0">
|
<div class="flex gap-2 shrink-0">
|
||||||
|
<a href="{{ route('invoices.create') }}" class="btn-sakura text-sm">+ New Invoice</a>
|
||||||
<a href="{{ route('invoice-settings.edit') }}"
|
<a href="{{ route('invoice-settings.edit') }}"
|
||||||
class="text-xs px-3 py-2 rounded-full border border-gray-200 text-gray-500 hover:bg-gray-50 flex items-center gap-1">
|
class="btn-sakura text-sm px-3 py-2 rounded-full border border-gray-200 text-gray-500 hover:bg-gray-50 flex items-center gap-1">
|
||||||
⚙️ Settings
|
⚙️ Settings
|
||||||
</a>
|
</a>
|
||||||
<a href="{{ route('invoices.create') }}" class="btn-sakura text-sm">+ New Invoice</a>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{-- Mobile card list --}}
|
{{-- Mobile card list --}}
|
||||||
<div class="flex flex-col gap-3 sm:hidden">
|
<div class="flex flex-col gap-3 sm:hidden">
|
||||||
@forelse($invoices as $invoice)
|
@forelse($invoices as $invoice)
|
||||||
<div class="cat-card p-4">
|
<div class="cat-card p-4">
|
||||||
<div class="flex items-start justify-between gap-2 mb-2">
|
<div class="flex items-start justify-between gap-2 mb-2">
|
||||||
@@ -44,22 +33,26 @@
|
|||||||
<span class="font-bold text-gray-800">{{ $invoice->formatted_total }}</span>
|
<span class="font-bold text-gray-800">{{ $invoice->formatted_total }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex gap-2 mt-3 pt-3 border-t border-pink-50">
|
<div class="flex gap-2 mt-3 pt-3 border-t border-pink-50">
|
||||||
<a href="{{ route('invoices.show', $invoice) }}" class="flex-1 text-center text-xs py-1.5 px-3 rounded-full border border-pink-200 text-pink-600 hover:bg-pink-50">View</a>
|
<a href="{{ route('invoices.show', $invoice) }}"
|
||||||
<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>
|
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.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>
|
<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 --}}
|
{{-- Share button disabled --}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@empty
|
@empty
|
||||||
<div class="text-center py-16 text-gray-400">
|
<div class="text-center py-16 text-gray-400">
|
||||||
<span class="text-5xl block mb-2">🧾</span>
|
<span class="text-5xl block mb-2">🧾</span>
|
||||||
<p>No invoices yet. <a href="{{ route('invoices.create') }}" class="text-pink-500 hover:underline">Create one!</a></p>
|
<p>No invoices yet. <a href="{{ route('invoices.create') }}" class="text-pink-500 hover:underline">Create
|
||||||
|
one!</a></p>
|
||||||
</div>
|
</div>
|
||||||
@endforelse
|
@endforelse
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{-- Desktop table --}}
|
{{-- Desktop table --}}
|
||||||
<div class="cat-card overflow-hidden hidden sm:block">
|
<div class="cat-card overflow-hidden hidden sm:block">
|
||||||
<div class="overflow-x-auto">
|
<div class="overflow-x-auto">
|
||||||
<table class="table w-full">
|
<table class="table w-full">
|
||||||
<thead class="bg-pink-50">
|
<thead class="bg-pink-50">
|
||||||
@@ -76,7 +69,8 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
@forelse($invoices as $invoice)
|
@forelse($invoices as $invoice)
|
||||||
<tr class="border-b border-pink-50 hover:bg-pink-50/50 transition-colors">
|
<tr class="border-b border-pink-50 hover:bg-pink-50/50 transition-colors">
|
||||||
<td class="px-5 py-4 font-mono text-sm font-semibold text-gray-700">{{ $invoice->invoice_number }}</td>
|
<td class="px-5 py-4 font-mono text-sm font-semibold text-gray-700">{{ $invoice->invoice_number }}
|
||||||
|
</td>
|
||||||
<td class="px-5 py-4 text-sm text-gray-600">{{ $invoice->client?->name ?? '—' }}</td>
|
<td class="px-5 py-4 text-sm text-gray-600">{{ $invoice->client?->name ?? '—' }}</td>
|
||||||
<td class="px-5 py-4 text-sm text-gray-700 max-w-xs truncate">{{ $invoice->title }}</td>
|
<td class="px-5 py-4 text-sm text-gray-700 max-w-xs truncate">{{ $invoice->title }}</td>
|
||||||
<td class="px-5 py-4 font-bold text-gray-800 text-sm">{{ $invoice->formatted_total }}</td>
|
<td class="px-5 py-4 font-bold text-gray-800 text-sm">{{ $invoice->formatted_total }}</td>
|
||||||
@@ -86,27 +80,36 @@
|
|||||||
<span class="text-red-400 text-xs block">Overdue!</span>
|
<span class="text-red-400 text-xs block">Overdue!</span>
|
||||||
@endif
|
@endif
|
||||||
</td>
|
</td>
|
||||||
<td class="px-5 py-4"><span class="badge {{ $invoice->status->badgeClass() }}">{{ $invoice->status->label() }}</span></td>
|
<td class="px-5 py-4"><span
|
||||||
|
class="badge {{ $invoice->status->badgeClass() }}">{{ $invoice->status->label() }}</span>
|
||||||
|
</td>
|
||||||
<td class="px-5 py-4">
|
<td class="px-5 py-4">
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex items-center gap-2">
|
||||||
<a href="{{ route('invoices.show', $invoice) }}" class="text-xs text-pink-500 hover:underline">View</a>
|
<a href="{{ route('invoices.show', $invoice) }}"
|
||||||
<a href="{{ route('invoices.pdf', $invoice) }}" class="text-xs text-pink-500 hover:underline" target="_blank">PDF</a>
|
class="text-xs text-pink-500 hover:underline">View</a>
|
||||||
<a href="{{ route('invoices.edit', $invoice) }}" class="text-xs text-gray-500 hover:underline">Edit</a>
|
<a href="{{ route('invoices.pdf', $invoice) }}"
|
||||||
|
class="text-xs text-pink-500 hover:underline" target="_blank">PDF</a>
|
||||||
|
<a href="{{ route('invoices.pdf-legacy', $invoice) }}"
|
||||||
|
class="text-xs text-pink-500 hover:underline" target="_blank">PDF (Legacy)</a>
|
||||||
|
<a href="{{ route('invoices.edit', $invoice) }}"
|
||||||
|
class="text-xs text-gray-500 hover:underline">Edit</a>
|
||||||
{{-- Share button disabled --}}
|
{{-- Share button disabled --}}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@empty
|
@empty
|
||||||
<tr><td colspan="7" class="text-center py-16 text-gray-400">
|
<tr>
|
||||||
|
<td colspan="7" class="text-center py-16 text-gray-400">
|
||||||
<span class="text-4xl block mb-2">🧾</span>
|
<span class="text-4xl block mb-2">🧾</span>
|
||||||
No invoices yet.
|
No invoices yet.
|
||||||
</td></tr>
|
</td>
|
||||||
|
</tr>
|
||||||
@endforelse
|
@endforelse
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mt-4">{{ $invoices->links() }}</div>
|
<div class="mt-4">{{ $invoices->links() }}</div>
|
||||||
{{-- Share scripts disabled --}}
|
{{-- Share scripts disabled --}}
|
||||||
@endsection
|
@endsection
|
||||||
373
resources/views/invoices/pdf-legacy.blade.php
Normal file
373
resources/views/invoices/pdf-legacy.blade.php
Normal file
@@ -0,0 +1,373 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<style>
|
||||||
|
* {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-family: 'Helvetica', Arial, sans-serif;
|
||||||
|
color: #000;
|
||||||
|
font-size: 11px;
|
||||||
|
padding: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-wrap {
|
||||||
|
margin-bottom: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title-block {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title-line {
|
||||||
|
flex-grow: 1;
|
||||||
|
height: 1px;
|
||||||
|
background: #000;
|
||||||
|
margin-right: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title {
|
||||||
|
font-size: 32px;
|
||||||
|
letter-spacing: 12px;
|
||||||
|
font-weight: 300;
|
||||||
|
}
|
||||||
|
|
||||||
|
.info-table {
|
||||||
|
width: 100%;
|
||||||
|
margin-bottom: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.info-table td {
|
||||||
|
vertical-align: top;
|
||||||
|
}
|
||||||
|
|
||||||
|
.label {
|
||||||
|
font-size: 9px;
|
||||||
|
color: #666;
|
||||||
|
text-transform: uppercase;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.val-bold {
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 13px;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.val {
|
||||||
|
font-size: 11px;
|
||||||
|
color: #444;
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
|
||||||
|
.details-table {
|
||||||
|
border-collapse: collapse;
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.details-table td {
|
||||||
|
padding: 3px 0;
|
||||||
|
font-size: 11px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.details-table .lbl {
|
||||||
|
color: #666;
|
||||||
|
text-align: right;
|
||||||
|
padding-right: 15px;
|
||||||
|
font-weight: bold;
|
||||||
|
width: 80px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.details-table .val-dt {
|
||||||
|
font-weight: bold;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.items {
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.items th,
|
||||||
|
.items td {
|
||||||
|
padding: 8px 0;
|
||||||
|
font-size: 11px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.items th {
|
||||||
|
text-align: left;
|
||||||
|
text-transform: uppercase;
|
||||||
|
font-weight: bold;
|
||||||
|
border-top: 1px solid #000;
|
||||||
|
border-bottom: 1px solid #000;
|
||||||
|
font-size: 9px;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.items td {
|
||||||
|
border-bottom: 1px solid #ddd;
|
||||||
|
}
|
||||||
|
|
||||||
|
.items tr:last-child td {
|
||||||
|
border-bottom: 1px solid #000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.items .td-right {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.items .td-center {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.totals-wrapper {
|
||||||
|
width: 100%;
|
||||||
|
margin-bottom: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.totals-wrapper::after {
|
||||||
|
content: "";
|
||||||
|
display: table;
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
|
||||||
|
.totals {
|
||||||
|
float: right;
|
||||||
|
border-collapse: collapse;
|
||||||
|
min-width: 250px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.totals td {
|
||||||
|
padding: 3px 0;
|
||||||
|
font-size: 11px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.totals .lbl {
|
||||||
|
text-align: right;
|
||||||
|
padding-right: 35px;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
font-size: 9px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.totals .val {
|
||||||
|
text-align: right;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bank-info {
|
||||||
|
margin-bottom: 60px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bank-info .label {
|
||||||
|
margin-bottom: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bank-info p {
|
||||||
|
font-size: 11px;
|
||||||
|
line-height: 1.6;
|
||||||
|
color: #444;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer {
|
||||||
|
width: 100%;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.signature {
|
||||||
|
display: inline-block;
|
||||||
|
text-align: center;
|
||||||
|
width: 200px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sig-date {
|
||||||
|
font-size: 11px;
|
||||||
|
color: #444;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sig-img {
|
||||||
|
max-height: 60px;
|
||||||
|
max-width: 180px;
|
||||||
|
object-fit: contain;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sig-name {
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: bold;
|
||||||
|
text-transform: uppercase;
|
||||||
|
margin-bottom: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sig-title {
|
||||||
|
font-size: 9px;
|
||||||
|
color: #666;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<table style="width:100%; margin-bottom: 30px;" cellpadding="0" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td style="width:50%; vertical-align:middle; padding-right:20px;">
|
||||||
|
<div style="height:1px; background:#000; width:100%;"></div>
|
||||||
|
</td>
|
||||||
|
<td style="vertical-align:middle; text-align:right;">
|
||||||
|
<div class="title">I N V O I C E</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<table class="info-table" cellpadding="0" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td style="width:50%; padding-right:20px;">
|
||||||
|
<div class="label">BILLING TO:</div>
|
||||||
|
@if($invoice->client)
|
||||||
|
<div class="val-bold">{{ $invoice->client->company }}</div>
|
||||||
|
<!-- @if($invoice->client->company)
|
||||||
|
<div class="val">{{ $invoice->client->company }}</div>@endif -->
|
||||||
|
@if($invoice->client->full_address)
|
||||||
|
<div class="val">{!! nl2br(e($invoice->client->full_address)) !!}</div>@endif
|
||||||
|
@else
|
||||||
|
<div class="val">—</div>
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
|
<td style="width:50%; text-align:right;">
|
||||||
|
<table class="details-table" align="right" cellpadding="0" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="lbl">Invoice No:</td>
|
||||||
|
<td class="val-dt">{{ $invoice->invoice_number }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="lbl">Date:</td>
|
||||||
|
<td class="val-dt">{{ $invoice->issue_date->format('d.m.Y') }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="lbl">Due Date:</td>
|
||||||
|
<td class="val-dt">{{ $invoice->due_date->format('d.m.Y') }}</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<div style="margin-bottom: 30px;">
|
||||||
|
<div class="label">FROM:</div>
|
||||||
|
<div class="val-bold">
|
||||||
|
{{ $invoiceSettings->header_name ?: 'Cathy' }}
|
||||||
|
@if($invoiceSettings->header_title)
|
||||||
|
<span style="font-weight: normal; color: #444;"> ( {{ $invoiceSettings->header_title }} )</span>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<table class="items" cellpadding="0" cellspacing="0">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th style="width:45%;">DESCRIPTION</th>
|
||||||
|
<th class="td-right" style="width:25%;">PRICE</th>
|
||||||
|
<th class="td-center" style="width:10%;">QTY</th>
|
||||||
|
<th class="td-right" style="width:20%;">TOTAL</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach($invoice->items as $item)
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
{{ $item->description }}
|
||||||
|
@if(!$item->is_taxable)
|
||||||
|
<span
|
||||||
|
style="margin-left:6px; font-size:8px; border:1px solid #999; color:#666; padding:1px 4px; border-radius:3px; text-transform:uppercase; letter-spacing:0.5px;">Non-Taxable</span>
|
||||||
|
@endif
|
||||||
|
@if($invoice->discount_rate > 0 && !$item->is_discountable)
|
||||||
|
<span
|
||||||
|
style="margin-left:6px; font-size:8px; border:1px solid #999; color:#666; padding:1px 4px; border-radius:3px; text-transform:uppercase; letter-spacing:0.5px;">No
|
||||||
|
Discount</span>
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
|
<td class="td-right">Rp {{ number_format($item->unit_price, 0, ',', '.') }}</td>
|
||||||
|
<td class="td-center">{{ $item->quantity }}</td>
|
||||||
|
<td class="td-right">Rp {{ number_format($item->total, 0, ',', '.') }}</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<div class="totals-wrapper">
|
||||||
|
<table class="totals" cellpadding="0" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="lbl" style="font-weight: normal;">SUBTOTAL</td>
|
||||||
|
<td class="val" style="font-weight: normal;">Rp
|
||||||
|
{{ number_format($invoice->subtotal + $invoice->discount_amount, 0, ',', '.') }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@if($invoice->discount_amount > 0)
|
||||||
|
<tr>
|
||||||
|
<td class="lbl" style="font-weight: normal; color:#666;">DISCOUNT ({{ $invoice->discount_rate }}%)</td>
|
||||||
|
<td class="val" style="font-weight: normal; color:#666;">- Rp
|
||||||
|
{{ number_format($invoice->discount_amount, 0, ',', '.') }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@endif
|
||||||
|
@if($invoice->tax_rate > 0)
|
||||||
|
<tr>
|
||||||
|
<td class="lbl" style="font-weight: normal; color:#666;">TAX ({{ $invoice->tax_rate }}%)</td>
|
||||||
|
<td class="val" style="font-weight: normal; color:#666;">Rp
|
||||||
|
{{ number_format($invoice->tax_amount, 0, ',', '.') }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@endif
|
||||||
|
<tr>
|
||||||
|
<td class="lbl" style="padding-top:10px;">GRAND TOTAL</td>
|
||||||
|
<td class="val" style="padding-top:10px;">{{ $invoice->formatted_total }}</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if($invoice->bank_name)
|
||||||
|
<div class="bank-info">
|
||||||
|
<div class="label"><b>PAYMENT ABOVE SHOULD BE MADE TO:</b></div>
|
||||||
|
<p>
|
||||||
|
{{ $invoice->bank_name }}<br>
|
||||||
|
A/N {{ $invoice->bank_holder }}<br>
|
||||||
|
{{ $invoice->bank_account }}
|
||||||
|
@if($invoice->branch_name)<br>KCP: {{ $invoice->branch_name }}@endif
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<div class="footer">
|
||||||
|
@if($invoice->signature_image && file_exists(storage_path('app/public/' . $invoice->signature_image)))
|
||||||
|
<div class="signature">
|
||||||
|
<div class="sig-date">Jakarta, {{ $invoice->issue_date->format('d F Y') }}</div>
|
||||||
|
<img src="{{ storage_path('app/public/' . $invoice->signature_image) }}" class="sig-img">
|
||||||
|
<div class="sig-name">
|
||||||
|
{{ $invoice->signer_name ?: ($invoiceSettings->signer_name ?: ($invoiceSettings->header_name ?: 'Signature')) }}
|
||||||
|
</div>
|
||||||
|
<div class="sig-title">
|
||||||
|
{{ $invoice->signer_title ?: ($invoiceSettings->signer_title ?: $invoiceSettings->header_title) }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
@@ -1,131 +1,404 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
|
@php
|
||||||
|
$accent = $invoiceSettings->accent_color ?? '#FFB7C5';
|
||||||
|
$hex = ltrim($accent, '#');
|
||||||
|
$r = hexdec(substr($hex, 0, 2));
|
||||||
|
$g = hexdec(substr($hex, 2, 2));
|
||||||
|
$b = hexdec(substr($hex, 4, 2));
|
||||||
|
// 92% white + 8% accent → very light tint
|
||||||
|
$tint = sprintf(
|
||||||
|
'#%02X%02X%02X',
|
||||||
|
(int) (255 * 0.92 + $r * 0.08),
|
||||||
|
(int) (255 * 0.92 + $g * 0.08),
|
||||||
|
(int) (255 * 0.92 + $b * 0.08)
|
||||||
|
);
|
||||||
|
// 80% white + 20% accent → medium-light tint (for borders)
|
||||||
|
$tintMid = sprintf(
|
||||||
|
'#%02X%02X%02X',
|
||||||
|
(int) (255 * 0.80 + $r * 0.20),
|
||||||
|
(int) (255 * 0.80 + $g * 0.20),
|
||||||
|
(int) (255 * 0.80 + $b * 0.20)
|
||||||
|
);
|
||||||
|
@endphp
|
||||||
<style>
|
<style>
|
||||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
* {
|
||||||
body { font-family: 'Helvetica', Arial, sans-serif; color: #374151; font-size: 13px; padding: 40px; }
|
margin: 0;
|
||||||
.header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 40px; }
|
padding: 0;
|
||||||
.logo { font-size: 22px; font-weight: 900; color: #FFB7C5; }
|
box-sizing: border-box;
|
||||||
.logo-sub { font-size: 11px; color: #9CA3AF; margin-top: 2px; }
|
}
|
||||||
.inv-number { font-size: 22px; font-weight: 700; color: #1F2937; text-align: right; }
|
|
||||||
.badge { display: inline-block; padding: 3px 12px; border-radius: 20px; font-size: 11px; font-weight: 700; background: #FDE68A; color: #92400E; }
|
body {
|
||||||
.section-title { font-size: 10px; font-weight: 700; color: #9CA3AF; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 6px; }
|
font-family: 'Helvetica', Arial, sans-serif;
|
||||||
.billing-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-bottom: 32px; }
|
color: #374151;
|
||||||
.billing-name { font-weight: 700; font-size: 15px; color: #111827; }
|
font-size: 13px;
|
||||||
.billing-detail { font-size: 12px; color: #6B7280; margin-top: 2px; }
|
padding: 40px;
|
||||||
.detail-table { width: 100%; font-size: 12px; }
|
}
|
||||||
.detail-table td { padding: 3px 0; }
|
|
||||||
.detail-table td:first-child { color: #9CA3AF; }
|
/* ── Header ───────────────────────────────── */
|
||||||
.detail-table td:last-child { font-weight: 600; text-align: right; }
|
.header-table {
|
||||||
table.items { width: 100%; border-collapse: collapse; margin-bottom: 24px; }
|
width: 100%;
|
||||||
table.items thead { background: #FFF0F5; }
|
margin-bottom: 36px;
|
||||||
table.items th { padding: 10px 12px; text-align: left; font-size: 10px; font-weight: 700; color: #9CA3AF; text-transform: uppercase; }
|
}
|
||||||
table.items th:last-child, table.items td:last-child { text-align: right; }
|
|
||||||
table.items th:nth-child(2), table.items td:nth-child(2) { text-align: center; }
|
.logo-name {
|
||||||
table.items td { padding: 10px 12px; border-bottom: 1px solid #FDE8F0; font-size: 12px; }
|
font-size: 22px;
|
||||||
.totals { display: flex; justify-content: flex-end; margin-bottom: 24px; }
|
font-weight: 900;
|
||||||
.totals-box { width: 260px; }
|
color:
|
||||||
.totals-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 12px; }
|
{{ $accent }}
|
||||||
.totals-row.total { border-top: 2px solid #FFB7C5; margin-top: 6px; padding-top: 8px; font-size: 15px; font-weight: 800; color: #FFB7C5; }
|
;
|
||||||
.bank-box { background: #FFF5F7; border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; }
|
}
|
||||||
.bank-title { font-weight: 700; font-size: 12px; color: #374151; margin-bottom: 4px; }
|
|
||||||
.bank-detail { font-size: 12px; color: #6B7280; }
|
.logo-sub {
|
||||||
.notes { font-size: 11px; color: #9CA3AF; font-style: italic; }
|
font-size: 11px;
|
||||||
.footer { margin-top: 40px; text-align: center; font-size: 11px; color: #D1D5DB; }
|
color: #9CA3AF;
|
||||||
|
margin-top: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.inv-number {
|
||||||
|
font-size: 22px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #1F2937;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ── Billing grid ─────────────────────────── */
|
||||||
|
.billing-table {
|
||||||
|
width: 100%;
|
||||||
|
margin-bottom: 28px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-title {
|
||||||
|
font-size: 10px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #9CA3AF;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
margin-bottom: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.billing-name {
|
||||||
|
font-weight: 700;
|
||||||
|
font-size: 15px;
|
||||||
|
color: #111827;
|
||||||
|
}
|
||||||
|
|
||||||
|
.billing-detail {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #6B7280;
|
||||||
|
margin-top: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-table {
|
||||||
|
font-size: 12px;
|
||||||
|
width: auto;
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-table td {
|
||||||
|
padding: 3px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-table .lbl {
|
||||||
|
color: #9CA3AF;
|
||||||
|
padding-right: 16px;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-table .val {
|
||||||
|
font-weight: 600;
|
||||||
|
text-align: right;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Line items ───────────────────────────── */
|
||||||
|
table.items {
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.items thead td {
|
||||||
|
background:
|
||||||
|
{{ $tint }}
|
||||||
|
;
|
||||||
|
padding: 10px 12px;
|
||||||
|
font-size: 10px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #9CA3AF;
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.items tbody td {
|
||||||
|
padding: 10px 12px;
|
||||||
|
border-bottom: 1px solid
|
||||||
|
{{ $tintMid }}
|
||||||
|
;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.td-right {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.td-center {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Totals ───────────────────────────────── */
|
||||||
|
.totals-wrap {
|
||||||
|
width: 100%;
|
||||||
|
margin-bottom: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.totals-inner {
|
||||||
|
width: 260px;
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.totals-inner table {
|
||||||
|
width: 100%;
|
||||||
|
font-size: 12px;
|
||||||
|
border-collapse: collapse;
|
||||||
|
}
|
||||||
|
|
||||||
|
.totals-inner table td {
|
||||||
|
padding: 4px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.totals-inner table td.amount {
|
||||||
|
text-align: right;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.totals-total td {
|
||||||
|
border-top: 2px solid
|
||||||
|
{{ $accent }}
|
||||||
|
;
|
||||||
|
padding-top: 8px !important;
|
||||||
|
margin-top: 6px;
|
||||||
|
font-size: 15px;
|
||||||
|
font-weight: 800;
|
||||||
|
color:
|
||||||
|
{{ $accent }}
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
.clearfix::after {
|
||||||
|
content: "";
|
||||||
|
display: table;
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Payment info ─────────────────────────── */
|
||||||
|
.bank-box {
|
||||||
|
background:
|
||||||
|
{{ $tint }}
|
||||||
|
;
|
||||||
|
border-radius: 10px;
|
||||||
|
padding: 14px 16px;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bank-title {
|
||||||
|
font-weight: 700;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #374151;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bank-detail {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #6B7280;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notes {
|
||||||
|
font-size: 11px;
|
||||||
|
color: #9CA3AF;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer {
|
||||||
|
margin-top: 40px;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 11px;
|
||||||
|
color: #D1D5DB;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="header">
|
{{-- ── Header ─────────────────────────────────────────────────── --}}
|
||||||
<div style="display:flex; align-items:center; gap:12px;">
|
<table class="header-table" cellpadding="0" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td style="vertical-align:middle;">
|
||||||
|
<table cellpadding="0" cellspacing="0">
|
||||||
|
<tr>
|
||||||
@if($invoiceSettings->header_logo && file_exists(storage_path('app/public/' . $invoiceSettings->header_logo)))
|
@if($invoiceSettings->header_logo && file_exists(storage_path('app/public/' . $invoiceSettings->header_logo)))
|
||||||
|
<td style="vertical-align:middle; padding-right:12px; width:64px;">
|
||||||
<img src="{{ storage_path('app/public/' . $invoiceSettings->header_logo) }}"
|
<img src="{{ storage_path('app/public/' . $invoiceSettings->header_logo) }}"
|
||||||
style="width:52px; height:52px; object-fit:cover; border-radius:12px;" alt="Logo">
|
style="width:52px; height:52px; object-fit:cover; border-radius:12px; display:block;"
|
||||||
|
alt="Logo">
|
||||||
|
</td>
|
||||||
@endif
|
@endif
|
||||||
<div>
|
<td style="vertical-align:middle;">
|
||||||
<div class="logo">{{ $invoiceSettings->header_name ?: 'KOL Manager' }}</div>
|
<div class="logo-name">{{ $invoiceSettings->header_name ?: 'Cathy' }}</div>
|
||||||
<div class="logo-sub">{{ $invoiceSettings->header_title ?: 'Personal Talent Assistant' }}</div>
|
<div class="logo-sub">{{ $invoiceSettings->header_title ?: 'Personal Talent Assistant' }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</td>
|
||||||
<div style="text-align:right">
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
<td style="text-align:right; vertical-align:top;">
|
||||||
<div class="inv-number">{{ $invoice->invoice_number }}</div>
|
<div class="inv-number">{{ $invoice->invoice_number }}</div>
|
||||||
<div style="margin-top:4px"><span class="badge">{{ $invoice->status->label() }}</span></div>
|
</td>
|
||||||
</div>
|
</tr>
|
||||||
</div>
|
</table>
|
||||||
|
|
||||||
<div class="billing-grid">
|
{{-- ── Billing Info ─────────────────────────────────────────────── --}}
|
||||||
<div>
|
<table class="billing-table" cellpadding="0" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td style="width:50%; vertical-align:top; padding-right:24px;">
|
||||||
<div class="section-title">Bill To</div>
|
<div class="section-title">Bill To</div>
|
||||||
@if($invoice->client)
|
@if($invoice->client)
|
||||||
<div class="billing-name">{{ $invoice->client->name }}</div>
|
<div class="billing-name">{{ $invoice->client->name }}</div>
|
||||||
@if($invoice->client->company) <div class="billing-detail">{{ $invoice->client->company }}</div> @endif
|
@if($invoice->client->company)
|
||||||
@if($invoice->client->email) <div class="billing-detail">{{ $invoice->client->email }}</div> @endif
|
<div class="billing-detail">{{ $invoice->client->company }}</div> @endif
|
||||||
@if($invoice->client->full_address) <div class="billing-detail">{{ $invoice->client->full_address }}</div> @endif
|
@if($invoice->client->email)
|
||||||
|
<div class="billing-detail">{{ $invoice->client->email }}</div> @endif
|
||||||
|
@if($invoice->client->full_address)
|
||||||
|
<div class="billing-detail">{!! nl2br(e($invoice->client->full_address)) !!}</div> @endif
|
||||||
@else
|
@else
|
||||||
<div class="billing-detail">—</div>
|
<div class="billing-detail">—</div>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</td>
|
||||||
<div style="text-align:right">
|
<td style="width:50%; vertical-align:top; text-align:right;">
|
||||||
<div class="section-title">Invoice Details</div>
|
<div class="section-title">Invoice Details</div>
|
||||||
<table class="detail-table">
|
<table class="detail-table" cellpadding="0" cellspacing="0">
|
||||||
<tr><td>Issue Date</td><td>{{ $invoice->issue_date->format('d M Y') }}</td></tr>
|
<tr>
|
||||||
<tr><td>Due Date</td><td>{{ $invoice->due_date->format('d M Y') }}</td></tr>
|
<td class="lbl">Issue Date</td>
|
||||||
|
<td class="val">{{ $invoice->issue_date->format('d M Y') }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="lbl">Due Date</td>
|
||||||
|
<td class="val">{{ $invoice->due_date->format('d M Y') }}</td>
|
||||||
|
</tr>
|
||||||
@if($invoice->paid_date)
|
@if($invoice->paid_date)
|
||||||
<tr><td>Paid Date</td><td>{{ $invoice->paid_date->format('d M Y') }}</td></tr>
|
<tr>
|
||||||
|
<td class="lbl">Paid Date</td>
|
||||||
|
<td class="val">{{ $invoice->paid_date->format('d M Y') }}</td>
|
||||||
|
</tr>
|
||||||
@endif
|
@endif
|
||||||
<tr><td>Currency</td><td>{{ $invoice->currency }}</td></tr>
|
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</td>
|
||||||
</div>
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
<table class="items">
|
{{-- ── Line Items ───────────────────────────────────────────────── --}}
|
||||||
|
<table class="items" cellpadding="0" cellspacing="0">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Description</th>
|
<td style="width:50%;">Description</td>
|
||||||
<th>Qty</th>
|
<td class="td-right" style="width:20%;">Unit Price</td>
|
||||||
<th style="text-align:right">Unit Price</th>
|
<td class="td-center" style="width:10%;">Qty</td>
|
||||||
<th>Total</th>
|
<td class="td-right" style="width:20%;">Total</td>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@foreach($invoice->items as $item)
|
@foreach($invoice->items as $item)
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ $item->description }}</td>
|
<td>
|
||||||
<td style="text-align:center">{{ $item->quantity }}</td>
|
{{ $item->description }}
|
||||||
<td style="text-align:right">Rp {{ number_format($item->unit_price, 0, ',', '.') }}</td>
|
@if(!$item->is_taxable)
|
||||||
<td style="text-align:right; font-weight:600">Rp {{ number_format($item->total, 0, ',', '.') }}</td>
|
<span
|
||||||
|
style="margin-left:6px; font-size:10px; background:#F3F4F6; color:#6B7280; padding:2px 8px; border-radius:10px; font-weight:600;">Non-Taxable</span>
|
||||||
|
@endif
|
||||||
|
@if($invoice->discount_rate > 0 && !$item->is_discountable)
|
||||||
|
<span
|
||||||
|
style="margin-left:6px; font-size:10px; background:#FDF2F8; color:#EC4899; padding:2px 8px; border-radius:10px; font-weight:600;">No Discount</span>
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
|
<td class="td-right">Rp {{ number_format($item->unit_price, 0, ',', '.') }}</td>
|
||||||
|
<td class="td-center">{{ $item->quantity }}</td>
|
||||||
|
<td class="td-right" style="font-weight:600;">Rp {{ number_format($item->total, 0, ',', '.') }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<div class="totals">
|
{{-- ── Totals ───────────────────────────────────────────────────── --}}
|
||||||
<div class="totals-box">
|
<div class="totals-wrap clearfix">
|
||||||
<div class="totals-row"><span>Subtotal</span><span>Rp {{ number_format($invoice->subtotal, 0, ',', '.') }}</span></div>
|
<div class="totals-inner">
|
||||||
@if($invoice->tax_rate > 0)
|
<table cellpadding="0" cellspacing="0">
|
||||||
<div class="totals-row" style="color:#D97706"><span>Tax ({{ $invoice->tax_rate }}% — paid by client)</span><span>Rp {{ number_format($invoice->tax_amount, 0, ',', '.') }}</span></div>
|
<tr>
|
||||||
|
<td style="color:#6B7280;">Subtotal</td>
|
||||||
|
<td class="amount">Rp {{ number_format($invoice->subtotal + $invoice->discount_amount, 0, ',', '.') }}</td>
|
||||||
|
</tr>
|
||||||
|
@if($invoice->discount_amount > 0)
|
||||||
|
<tr>
|
||||||
|
<td style="color:#EC4899;">Discount ({{ $invoice->discount_rate }}%)</td>
|
||||||
|
<td class="amount" style="color:#EC4899;">- Rp {{ number_format($invoice->discount_amount, 0, ',', '.') }}</td>
|
||||||
|
</tr>
|
||||||
@endif
|
@endif
|
||||||
<div class="totals-row total"><span>Total (you receive)</span><span>{{ $invoice->formatted_total }}</span></div>
|
@if($invoice->tax_rate > 0)
|
||||||
|
<tr>
|
||||||
|
<td style="color:#D97706;">Tax ({{ $invoice->tax_rate }}% — paid by client)</td>
|
||||||
|
<td class="amount" style="color:#D97706;">Rp {{ number_format($invoice->tax_amount, 0, ',', '.') }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@endif
|
||||||
|
<tr class="totals-total">
|
||||||
|
<td>Grand Total</td>
|
||||||
|
<td class="amount">{{ $invoice->formatted_total }}</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
@if($invoice->bank_name)
|
{{-- ── Payment Info ──────────────────────────────────────────────── --}}
|
||||||
<div class="bank-box">
|
@if($invoice->bank_name)
|
||||||
|
<div class="bank-box">
|
||||||
<div class="bank-title">Payment Information</div>
|
<div class="bank-title">Payment Information</div>
|
||||||
<div class="bank-detail">
|
<div class="bank-detail">
|
||||||
{{ $invoice->bank_name }}
|
{{ $invoice->bank_name }}
|
||||||
@if($invoice->branch_name) · {{ $invoice->branch_name }} @endif
|
@if($invoice->branch_name) · {{ $invoice->branch_name }} @endif
|
||||||
· {{ $invoice->bank_account }} · a/n {{ $invoice->bank_holder }}
|
· {{ $invoice->bank_account }} · a/n {{ $invoice->bank_holder }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@if($invoice->notes)
|
@if($invoice->notes)
|
||||||
<div class="notes">{{ $invoice->notes }}</div>
|
<div class="notes" style="margin-bottom: 24px;">{{ $invoice->notes }}</div>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
<div class="footer">Generated by KOL Manager · Thank you for the collaboration! 🐱</div>
|
<div style="margin-top: 40px;">
|
||||||
|
@if($invoice->signature_image && file_exists(storage_path('app/public/' . $invoice->signature_image)))
|
||||||
|
<div style="width: 200px; float: right; text-align: center;">
|
||||||
|
<div style="font-size: 11px; color: #374151; margin-bottom: 12px;">
|
||||||
|
Jakarta, {{ $invoice->issue_date->format('d F Y') }}
|
||||||
|
</div>
|
||||||
|
<img src="{{ storage_path('app/public/' . $invoice->signature_image) }}"
|
||||||
|
style="max-height: 80px; max-width: 180px; object-fit: contain; margin-bottom: 8px;">
|
||||||
|
<div style="font-size: 12px; font-weight: 800; color: #111827; text-transform: uppercase;">
|
||||||
|
{{ $invoice->signer_name ?: ($invoiceSettings->signer_name ?: ($invoiceSettings->header_name ?: 'Signature')) }}
|
||||||
|
</div>
|
||||||
|
@if($invoice->signer_title || $invoiceSettings->signer_title || $invoiceSettings->header_title)
|
||||||
|
<div style="font-size: 10px; color: #6B7280; text-transform: uppercase; margin-top: 3px;">
|
||||||
|
{{ $invoice->signer_title ?: ($invoiceSettings->signer_title ?: $invoiceSettings->header_title) }}
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<div style="clear: both;"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- <div class="footer">Thank you for the collaboration!</div> -->
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
@@ -5,10 +5,10 @@
|
|||||||
@section('page-subtitle', 'Customize number format, header, and invoice defaults')
|
@section('page-subtitle', 'Customize number format, header, and invoice defaults')
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<div class="max-w-2xl mx-auto">
|
<div class="max-w-2xl mx-auto">
|
||||||
<div class="flex items-center gap-3 mb-5">
|
<div class="flex items-center gap-3 mb-5">
|
||||||
<a href="{{ route('invoices.index') }}"
|
<a href="{{ route('invoices.index') }}"
|
||||||
class="text-xs px-3 py-2 rounded-full border border-pink-200 text-gray-500 hover:bg-pink-50">
|
class="btn-sakura text-sm px-3 py-2 rounded-full border border-pink-200 text-gray-500 hover:bg-pink-50">
|
||||||
← Back to Invoices
|
← Back to Invoices
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
@@ -21,8 +21,7 @@
|
|||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
<form action="{{ route('invoice-settings.update') }}" method="POST" enctype="multipart/form-data"
|
<form action="{{ route('invoice-settings.update') }}" method="POST" enctype="multipart/form-data" class="space-y-5">
|
||||||
class="space-y-5">
|
|
||||||
@csrf
|
@csrf
|
||||||
|
|
||||||
{{-- Number Format --}}
|
{{-- Number Format --}}
|
||||||
@@ -34,9 +33,8 @@
|
|||||||
Prefix <span class="text-pink-400">*</span>
|
Prefix <span class="text-pink-400">*</span>
|
||||||
</label>
|
</label>
|
||||||
<input type="text" name="invoice_prefix"
|
<input type="text" name="invoice_prefix"
|
||||||
value="{{ old('invoice_prefix', $settings->invoice_prefix) }}"
|
value="{{ old('invoice_prefix', $settings->invoice_prefix) }}" class="input-soft text-sm"
|
||||||
class="input-soft text-sm" placeholder="INV-EA" required
|
placeholder="INV-EA" required id="prefix-input" oninput="updatePreview()">
|
||||||
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>
|
<p class="text-xs text-gray-400 mt-1">e.g. <code>INV-EA</code> → <strong>INV-EA-001</strong></p>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@@ -45,8 +43,7 @@
|
|||||||
</label>
|
</label>
|
||||||
<input type="number" name="invoice_next_number"
|
<input type="number" name="invoice_next_number"
|
||||||
value="{{ old('invoice_next_number', $settings->invoice_next_number) }}"
|
value="{{ old('invoice_next_number', $settings->invoice_next_number) }}"
|
||||||
class="input-soft text-sm" min="1" required
|
class="input-soft text-sm" min="1" required id="number-input" oninput="updatePreview()">
|
||||||
id="number-input" oninput="updatePreview()">
|
|
||||||
<p class="text-xs text-gray-400 mt-1">Used for the next new invoice</p>
|
<p class="text-xs text-gray-400 mt-1">Used for the next new invoice</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -61,41 +58,104 @@
|
|||||||
<div class="cat-card p-5">
|
<div class="cat-card p-5">
|
||||||
<h2 class="text-sm font-bold text-gray-700 mb-4 flex items-center gap-2">🎨 Invoice Header</h2>
|
<h2 class="text-sm font-bold text-gray-700 mb-4 flex items-center gap-2">🎨 Invoice Header</h2>
|
||||||
|
|
||||||
@if($settings->header_logo)
|
{{-- Logo auto-upload (independent of main Save form) --}}
|
||||||
<div class="mb-3 flex items-center gap-3">
|
<div class="mb-4" x-data="{
|
||||||
<img src="{{ asset('storage/' . $settings->header_logo) }}"
|
uploading: false,
|
||||||
alt="Logo" class="h-16 w-16 object-cover rounded-2xl border border-pink-100">
|
errorMsg: '',
|
||||||
<div>
|
logoUrl: '{{ $settings->header_logo ? '/storage/' . $settings->header_logo : '' }}',
|
||||||
<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>
|
async pickFile(input) {
|
||||||
</div>
|
if (!input.files.length) return;
|
||||||
</div>
|
this.uploading = true;
|
||||||
@endif
|
this.errorMsg = '';
|
||||||
|
const fd = new FormData();
|
||||||
|
fd.append('header_logo', input.files[0]);
|
||||||
|
fd.append('_token', document.querySelector('meta[name=csrf-token]').content);
|
||||||
|
try {
|
||||||
|
const res = await fetch('{{ route('invoice-settings.upload-logo', [], false) }}', {
|
||||||
|
method: 'POST',
|
||||||
|
body: fd,
|
||||||
|
headers: {
|
||||||
|
'Accept': 'application/json'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const data = await res.json();
|
||||||
|
if (res.ok) {
|
||||||
|
this.logoUrl = data.url + '?t=' + Date.now();
|
||||||
|
} else {
|
||||||
|
this.errorMsg = data.message ?? 'Upload failed.';
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err);
|
||||||
|
this.errorMsg = 'Network error. Please try again.';
|
||||||
|
}
|
||||||
|
this.uploading = false;
|
||||||
|
input.value = '';
|
||||||
|
},
|
||||||
|
|
||||||
|
async removeLogo() {
|
||||||
|
if (!confirm('Remove this logo?')) return;
|
||||||
|
const fd = new FormData();
|
||||||
|
fd.append('_token', document.querySelector('meta[name=csrf-token]').content);
|
||||||
|
fd.append('_method', 'DELETE');
|
||||||
|
await fetch('{{ route('invoice-settings.delete-logo', [], false) }}', {
|
||||||
|
method: 'POST',
|
||||||
|
body: fd,
|
||||||
|
headers: { 'Accept': 'application/json' }
|
||||||
|
});
|
||||||
|
this.logoUrl = '';
|
||||||
|
}
|
||||||
|
}">
|
||||||
|
|
||||||
|
{{-- Current logo preview --}}
|
||||||
|
<template x-if="logoUrl">
|
||||||
|
<div class="flex items-center gap-3 mb-3">
|
||||||
|
<img :src="logoUrl" alt="Logo"
|
||||||
|
class="h-16 w-16 object-cover rounded-2xl border border-pink-100 shrink-0">
|
||||||
|
<div class="flex-1 min-w-0">
|
||||||
|
<p class="text-xs font-semibold text-gray-600">Current Logo</p>
|
||||||
|
<p class="text-xs text-gray-400 mt-0.5">Choose a new file to replace it</p>
|
||||||
|
</div>
|
||||||
|
<button type="button" @click="removeLogo()"
|
||||||
|
class="text-xs px-3 py-1.5 rounded-full border border-red-200 text-red-400 hover:bg-red-50 shrink-0">
|
||||||
|
🗑️ Remove
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
|
||||||
<div class="sm:col-span-2">
|
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Logo / Profile Picture</label>
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Logo / Profile Picture</label>
|
||||||
<input type="file" name="header_logo" accept="image/*"
|
<div class="relative">
|
||||||
class="w-full text-sm text-gray-600
|
<input type="file" accept="image/*" @change="pickFile($event.target)" class="w-full text-sm text-gray-600
|
||||||
file:mr-3 file:py-1.5 file:px-4
|
file:mr-3 file:py-1.5 file:px-4
|
||||||
file:rounded-full file:border-0
|
file:rounded-full file:border-0
|
||||||
file:text-xs file:font-semibold
|
file:text-xs file:font-semibold
|
||||||
file:bg-pink-50 file:text-pink-600
|
file:bg-pink-50 file:text-pink-600
|
||||||
hover:file:bg-pink-100 cursor-pointer">
|
hover:file:bg-pink-100 cursor-pointer" :disabled="uploading">
|
||||||
<p class="text-xs text-gray-400 mt-1">Max 2 MB. Shown at the top-left of your invoice.</p>
|
<span x-show="uploading" class="text-xs text-pink-500 mt-1 block">Uploading…</span>
|
||||||
|
<span x-show="errorMsg" x-text="errorMsg" class="text-xs text-red-500 mt-1 block"></span>
|
||||||
</div>
|
</div>
|
||||||
|
<p class="text-xs text-gray-400 mt-1">Max 2 MB. Uploads immediately on file selection.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
||||||
<div>
|
<div>
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Talent / Business Name</label>
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Talent / Business Name</label>
|
||||||
<input type="text" name="header_name"
|
<input type="text" name="header_name" value="{{ old('header_name', $settings->header_name) }}"
|
||||||
value="{{ old('header_name', $settings->header_name) }}"
|
|
||||||
class="input-soft text-sm" placeholder="Your name or brand">
|
class="input-soft text-sm" placeholder="Your name or brand">
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Title / Tagline</label>
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Title / Tagline</label>
|
||||||
<input type="text" name="header_title"
|
<input type="text" name="header_title" value="{{ old('header_title', $settings->header_title) }}"
|
||||||
value="{{ old('header_title', $settings->header_title) }}"
|
|
||||||
class="input-soft text-sm" placeholder="Content Creator · KOL">
|
class="input-soft text-sm" placeholder="Content Creator · KOL">
|
||||||
</div>
|
</div>
|
||||||
|
<div x-data="{ color: '{{ old('accent_color', $settings->accent_color ?? '#FFB7C5') }}' }">
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Accent Color</label>
|
||||||
|
<div class="flex items-center gap-3 mt-1">
|
||||||
|
<input type="color" name="accent_color" x-model="color"
|
||||||
|
class="w-10 h-10 rounded-xl cursor-pointer border-2 border-pink-100 p-0.5">
|
||||||
|
</div>
|
||||||
|
<p class="text-xs text-gray-400 mt-1.5">Applied to your invoice header name and totals.</p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -130,8 +190,8 @@
|
|||||||
<div>
|
<div>
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Default Bank Name</label>
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Default Bank Name</label>
|
||||||
<input type="text" name="default_bank_name"
|
<input type="text" name="default_bank_name"
|
||||||
value="{{ old('default_bank_name', $settings->default_bank_name) }}"
|
value="{{ old('default_bank_name', $settings->default_bank_name) }}" class="input-soft text-sm"
|
||||||
class="input-soft text-sm" placeholder="BCA, Mandiri…">
|
placeholder="BCA, Mandiri…">
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Default Branch Name</label>
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Default Branch Name</label>
|
||||||
@@ -156,20 +216,107 @@
|
|||||||
<textarea name="default_notes" rows="2" class="input-soft text-sm resize-none"
|
<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>
|
placeholder="e.g. Payment due within 14 days from invoice date.">{{ old('default_notes', $settings->default_notes) }}</textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="sm:col-span-2 mt-2 pt-4 border-t border-gray-100">
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Default Signature Image</label>
|
||||||
|
<p class="text-xs text-gray-400 mb-3">Upload your signature here so it appears automatically on all new invoices.</p>
|
||||||
|
|
||||||
|
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4 mb-4">
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Signer Name</label>
|
||||||
|
<input type="text" name="signer_name" placeholder="e.g. {{ $settings->header_name ?: 'John Doe' }}" value="{{ old('signer_name', $settings->signer_name) }}" class="input-soft text-sm">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Signer Title</label>
|
||||||
|
<input type="text" name="signer_title" placeholder="e.g. {{ $settings->header_title ?: 'Manager' }}" value="{{ old('signer_title', $settings->signer_title) }}" class="input-soft text-sm">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div x-data="{
|
||||||
|
uploading: false,
|
||||||
|
errorMsg: '',
|
||||||
|
signatureUrl: '{{ $settings->signature_image ? '/storage/' . $settings->signature_image : '' }}',
|
||||||
|
|
||||||
|
async pickFile(input) {
|
||||||
|
if (!input.files.length) return;
|
||||||
|
this.uploading = true;
|
||||||
|
this.errorMsg = '';
|
||||||
|
const fd = new FormData();
|
||||||
|
fd.append('signature_image', input.files[0]);
|
||||||
|
fd.append('_token', document.querySelector('meta[name=csrf-token]').content);
|
||||||
|
try {
|
||||||
|
const res = await fetch('{{ route('invoice-settings.upload-signature', [], false) }}', {
|
||||||
|
method: 'POST',
|
||||||
|
body: fd,
|
||||||
|
headers: {
|
||||||
|
'Accept': 'application/json'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const data = await res.json();
|
||||||
|
if (res.ok) {
|
||||||
|
this.signatureUrl = data.url + '?t=' + Date.now();
|
||||||
|
} else {
|
||||||
|
this.errorMsg = data.message ?? 'Upload failed.';
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err);
|
||||||
|
this.errorMsg = 'Network error. Please try again.';
|
||||||
|
}
|
||||||
|
this.uploading = false;
|
||||||
|
input.value = '';
|
||||||
|
},
|
||||||
|
|
||||||
|
async removeSignature() {
|
||||||
|
if (!confirm('Remove this signature?')) return;
|
||||||
|
const fd = new FormData();
|
||||||
|
fd.append('_token', document.querySelector('meta[name=csrf-token]').content);
|
||||||
|
fd.append('_method', 'DELETE');
|
||||||
|
await fetch('{{ route('invoice-settings.delete-signature', [], false) }}', {
|
||||||
|
method: 'POST',
|
||||||
|
body: fd,
|
||||||
|
headers: { 'Accept': 'application/json' }
|
||||||
|
});
|
||||||
|
this.signatureUrl = '';
|
||||||
|
}
|
||||||
|
}">
|
||||||
|
|
||||||
|
<template x-if="signatureUrl">
|
||||||
|
<div class="flex items-center gap-4 mb-3 p-3 bg-white rounded-xl border border-pink-100">
|
||||||
|
<img :src="signatureUrl" alt="Signature preview" class="h-16 object-contain">
|
||||||
|
<div>
|
||||||
|
<button type="button" @click="removeSignature()" class="text-xs px-3 py-1.5 rounded-full border border-red-200 text-red-400 hover:bg-red-50">
|
||||||
|
🗑️ Remove
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<div class="relative">
|
||||||
|
<input type="file" accept="image/*" @change="pickFile($event.target)" class="w-full text-sm text-gray-600
|
||||||
|
file:mr-3 file:py-1.5 file:px-4
|
||||||
|
file:rounded-full file:border-0
|
||||||
|
file:text-xs file:font-semibold
|
||||||
|
file:bg-pink-50 file:text-pink-600
|
||||||
|
hover:file:bg-pink-100 cursor-pointer" :disabled="uploading">
|
||||||
|
<span x-show="uploading" class="text-xs text-pink-500 mt-1 block">Uploading…</span>
|
||||||
|
<span x-show="errorMsg" x-text="errorMsg" class="text-xs text-red-500 mt-1 block"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button type="submit" class="btn-sakura w-full py-3">💾 Save Settings</button>
|
<button type="submit" class="btn-sakura w-full py-3">💾 Save Settings</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@push('scripts')
|
@push('scripts')
|
||||||
<script>
|
<script>
|
||||||
function updatePreview() {
|
function updatePreview() {
|
||||||
const prefix = document.getElementById('prefix-input').value.replace(/-+$/, '') || 'INV';
|
const prefix = document.getElementById('prefix-input').value.replace(/-+$/, '') || 'INV';
|
||||||
const num = parseInt(document.getElementById('number-input').value) || 1;
|
const num = parseInt(document.getElementById('number-input').value) || 1;
|
||||||
document.getElementById('number-preview').textContent = prefix + '-' + String(num).padStart(3, '0');
|
document.getElementById('number-preview').textContent = prefix + '-' + String(num).padStart(3, '0');
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@endpush
|
@endpush
|
||||||
@endsection
|
@endsection
|
||||||
@@ -5,13 +5,20 @@
|
|||||||
@section('page-subtitle', $invoice->title)
|
@section('page-subtitle', $invoice->title)
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<div class="max-w-3xl mx-auto">
|
<div class="max-w-3xl mx-auto">
|
||||||
<div class="flex gap-3 mb-6">
|
<div class="flex gap-3 mb-6">
|
||||||
<a href="{{ route('invoices.edit', $invoice) }}" class="btn-sakura">Edit</a>
|
<a href="{{ route('invoices.edit', $invoice) }}" class="btn-sakura">Edit</a>
|
||||||
<a href="{{ route('invoices.pdf', $invoice) }}" target="_blank" class="btn btn-outline rounded-full text-pink-500 border-pink-300">📥 Download PDF</a>
|
<a href="{{ route('invoices.pdf', $invoice) }}" target="_blank"
|
||||||
<form action="{{ route('invoices.destroy', $invoice) }}" method="POST" onsubmit="return confirm('Delete this invoice?')">
|
class="btn-sakura text-sm px-4 py-2.5 rounded-full border border-pink-200 text-pink-500 hover:bg-pink-50">📥
|
||||||
|
Download PDF</a>
|
||||||
|
<a href="{{ route('invoices.pdf-legacy', $invoice) }}" target="_blank"
|
||||||
|
class="btn-sakura text-sm px-4 py-2.5 rounded-full border border-gray-200 text-gray-500 hover:bg-gray-50">📥
|
||||||
|
PDF (Legacy)</a>
|
||||||
|
<form action="{{ route('invoices.destroy', $invoice) }}" method="POST"
|
||||||
|
onsubmit="return confirm('Delete this invoice?')">
|
||||||
@csrf @method('DELETE')
|
@csrf @method('DELETE')
|
||||||
<button class="btn btn-ghost rounded-full text-error">Delete</button>
|
<button
|
||||||
|
class="btn-sakura text-sm px-4 py-2.5 rounded-full border border-red-200 text-red-500 hover:bg-red-50">Delete</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -20,12 +27,12 @@
|
|||||||
<div class="flex justify-between items-start mb-8">
|
<div class="flex justify-between items-start mb-8">
|
||||||
<div class="flex items-center gap-3">
|
<div class="flex items-center gap-3">
|
||||||
@if($invoiceSettings->header_logo)
|
@if($invoiceSettings->header_logo)
|
||||||
<img src="{{ asset('storage/' . $invoiceSettings->header_logo) }}"
|
<img src="{{ asset('storage/' . $invoiceSettings->header_logo) }}" alt="Logo"
|
||||||
alt="Logo" class="h-14 w-14 object-cover rounded-2xl border border-pink-100 shrink-0">
|
class="h-14 w-14 object-cover rounded-2xl border border-pink-100 shrink-0">
|
||||||
@endif
|
@endif
|
||||||
<div>
|
<div>
|
||||||
<div class="text-xl font-extrabold text-pink-500">
|
<div class="text-xl font-extrabold" style="color:{{ $invoiceSettings->accent_color ?? '#FFB7C5' }}">
|
||||||
{{ $invoiceSettings->header_name ?: '🐱 KOL Manager' }}
|
{{ $invoiceSettings->header_name ?: '🐱 Cathy' }}
|
||||||
</div>
|
</div>
|
||||||
<div class="text-sm text-gray-400 mt-0.5">
|
<div class="text-sm text-gray-400 mt-0.5">
|
||||||
{{ $invoiceSettings->header_title ?: 'Personal Talent Assistant' }}
|
{{ $invoiceSettings->header_title ?: 'Personal Talent Assistant' }}
|
||||||
@@ -44,9 +51,12 @@
|
|||||||
<h4 class="text-xs font-bold text-gray-400 uppercase mb-2">Bill To</h4>
|
<h4 class="text-xs font-bold text-gray-400 uppercase mb-2">Bill To</h4>
|
||||||
@if($invoice->client)
|
@if($invoice->client)
|
||||||
<div class="font-semibold text-gray-800">{{ $invoice->client->name }}</div>
|
<div class="font-semibold text-gray-800">{{ $invoice->client->name }}</div>
|
||||||
@if($invoice->client->company) <div class="text-sm text-gray-500">{{ $invoice->client->company }}</div> @endif
|
@if($invoice->client->company)
|
||||||
@if($invoice->client->email) <div class="text-sm text-gray-500">{{ $invoice->client->email }}</div> @endif
|
<div class="text-sm text-gray-500">{{ $invoice->client->company }}</div> @endif
|
||||||
@if($invoice->client->full_address) <div class="text-sm text-gray-400">{{ $invoice->client->full_address }}</div> @endif
|
@if($invoice->client->email)
|
||||||
|
<div class="text-sm text-gray-500">{{ $invoice->client->email }}</div> @endif
|
||||||
|
@if($invoice->client->full_address)
|
||||||
|
<div class="text-sm text-gray-400">{!! nl2br(e($invoice->client->full_address)) !!}</div> @endif
|
||||||
@else
|
@else
|
||||||
<div class="text-gray-500 text-sm">No client</div>
|
<div class="text-gray-500 text-sm">No client</div>
|
||||||
@endif
|
@endif
|
||||||
@@ -55,29 +65,58 @@
|
|||||||
<div class="text-xs font-bold text-gray-400 uppercase mb-2">Invoice Details</div>
|
<div class="text-xs font-bold text-gray-400 uppercase mb-2">Invoice Details</div>
|
||||||
<div class="text-sm space-y-1">
|
<div class="text-sm space-y-1">
|
||||||
<div><span class="text-gray-400">Issue:</span> {{ $invoice->issue_date->format('d M Y') }}</div>
|
<div><span class="text-gray-400">Issue:</span> {{ $invoice->issue_date->format('d M Y') }}</div>
|
||||||
<div><span class="text-gray-400">Due:</span> <span class="{{ $invoice->due_date->isPast() && $invoice->status->value !== 'paid' ? 'text-red-500 font-bold' : '' }}">{{ $invoice->due_date->format('d M Y') }}</span></div>
|
<div><span class="text-gray-400">Due:</span> <span
|
||||||
@if($invoice->paid_date) <div><span class="text-gray-400">Paid:</span> {{ $invoice->paid_date->format('d M Y') }}</div> @endif
|
class="{{ $invoice->due_date->isPast() && $invoice->status->value !== 'paid' ? 'text-red-500 font-bold' : '' }}">{{ $invoice->due_date->format('d M Y') }}</span>
|
||||||
|
</div>
|
||||||
|
@if($invoice->paid_date)
|
||||||
|
<div><span class="text-gray-400">Paid:</span> {{ $invoice->paid_date->format('d M Y') }}</div>
|
||||||
|
@endif
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{-- Line Items --}}
|
{{-- Line Items --}}
|
||||||
|
@php
|
||||||
|
$accent = $invoiceSettings->accent_color ?? '#FFB7C5';
|
||||||
|
$hex = ltrim($accent, '#');
|
||||||
|
$r = hexdec(substr($hex, 0, 2));
|
||||||
|
$g = hexdec(substr($hex, 2, 2));
|
||||||
|
$b = hexdec(substr($hex, 4, 2));
|
||||||
|
$tint = sprintf(
|
||||||
|
'#%02X%02X%02X',
|
||||||
|
(int) (255 * 0.92 + $r * 0.08),
|
||||||
|
(int) (255 * 0.92 + $g * 0.08),
|
||||||
|
(int) (255 * 0.92 + $b * 0.08)
|
||||||
|
);
|
||||||
|
@endphp
|
||||||
<table class="w-full mb-6">
|
<table class="w-full mb-6">
|
||||||
<thead class="bg-pink-50">
|
<thead>
|
||||||
<tr class="text-xs text-gray-500 uppercase">
|
<tr class="text-xs text-gray-500 uppercase" style="background:{{ $tint }}">
|
||||||
<th class="text-left py-3 px-4 rounded-l-2xl">Description</th>
|
<th class="text-left py-3 px-4 rounded-l-2xl">Description</th>
|
||||||
<th class="text-center py-3 px-4">Qty</th>
|
|
||||||
<th class="text-right py-3 px-4">Unit Price</th>
|
<th class="text-right py-3 px-4">Unit Price</th>
|
||||||
|
<th class="text-center py-3 px-4">Qty</th>
|
||||||
<th class="text-right py-3 px-4 rounded-r-2xl">Total</th>
|
<th class="text-right py-3 px-4 rounded-r-2xl">Total</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@foreach($invoice->items as $item)
|
@foreach($invoice->items as $item)
|
||||||
<tr class="border-b border-pink-50">
|
<tr class="border-b border-pink-50">
|
||||||
<td class="py-3 px-4 text-sm text-gray-700">{{ $item->description }}</td>
|
<td class="py-3 px-4 text-sm text-gray-700">
|
||||||
|
{{ $item->description }}
|
||||||
|
@if(!$item->is_taxable)
|
||||||
|
<span
|
||||||
|
class="ml-1.5 text-xs bg-gray-100 text-gray-500 px-2 py-0.5 rounded-full font-medium">Non-Taxable</span>
|
||||||
|
@endif
|
||||||
|
@if($invoice->discount_rate > 0 && !$item->is_discountable)
|
||||||
|
<span
|
||||||
|
class="ml-1.5 text-xs bg-pink-50 text-pink-500 px-2 py-0.5 rounded-full font-medium">No Discount</span>
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
|
<td class="py-3 px-4 text-sm text-right text-gray-600">Rp
|
||||||
|
{{ number_format($item->unit_price, 0, ',', '.') }}</td>
|
||||||
<td class="py-3 px-4 text-sm text-center text-gray-600">{{ $item->quantity }}</td>
|
<td class="py-3 px-4 text-sm text-center text-gray-600">{{ $item->quantity }}</td>
|
||||||
<td class="py-3 px-4 text-sm text-right text-gray-600">Rp {{ number_format($item->unit_price, 0, ',', '.') }}</td>
|
<td class="py-3 px-4 text-sm text-right font-semibold text-gray-800">Rp
|
||||||
<td class="py-3 px-4 text-sm text-right font-semibold text-gray-800">Rp {{ number_format($item->total, 0, ',', '.') }}</td>
|
{{ number_format($item->total, 0, ',', '.') }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
</tbody>
|
</tbody>
|
||||||
@@ -87,23 +126,31 @@
|
|||||||
<div class="flex justify-end mb-8">
|
<div class="flex justify-end mb-8">
|
||||||
<div class="w-72 space-y-2 text-sm">
|
<div class="w-72 space-y-2 text-sm">
|
||||||
<div class="flex justify-between text-gray-500">
|
<div class="flex justify-between text-gray-500">
|
||||||
<span>Subtotal</span><span class="font-medium">Rp {{ number_format($invoice->subtotal, 0, ',', '.') }}</span>
|
<span>Subtotal</span><span class="font-medium">Rp
|
||||||
|
{{ number_format($invoice->subtotal + $invoice->discount_amount, 0, ',', '.') }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
@if($invoice->discount_amount > 0)
|
||||||
|
<div class="flex justify-between text-pink-500">
|
||||||
|
<span>Discount ({{ $invoice->discount_rate }}%)</span>
|
||||||
|
<span class="font-medium">- Rp {{ number_format($invoice->discount_amount, 0, ',', '.') }}</span>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
@if($invoice->tax_rate > 0)
|
@if($invoice->tax_rate > 0)
|
||||||
<div class="flex justify-between text-amber-600">
|
<div class="flex justify-between text-amber-600">
|
||||||
<span>Tax ({{ $invoice->tax_rate }}% — paid by client)</span>
|
<span>Tax ({{ $invoice->tax_rate }}% — paid by client)</span>
|
||||||
<span class="font-medium">Rp {{ number_format($invoice->tax_amount, 0, ',', '.') }}</span>
|
<span class="font-medium">Rp {{ number_format($invoice->tax_amount, 0, ',', '.') }}</span>
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
<div class="flex justify-between text-base font-bold text-pink-600 pt-2 border-t border-pink-200">
|
<div class="flex justify-between text-base font-bold pt-2 border-t border-pink-200"
|
||||||
<span>Total (you receive)</span><span>{{ $invoice->formatted_total }}</span>
|
style="color:{{ $invoiceSettings->accent_color ?? '#FFB7C5' }}">
|
||||||
|
<span>Grand Total</span><span>{{ $invoice->formatted_total }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{-- Bank Info --}}
|
{{-- Bank Info --}}
|
||||||
@if($invoice->bank_name)
|
@if($invoice->bank_name)
|
||||||
<div class="bg-pink-50 rounded-2xl p-4 text-sm">
|
<div class="rounded-2xl p-4 text-sm mb-4" style="background:{{ $tint }}">
|
||||||
<div class="font-semibold text-gray-700 mb-2">💳 Payment Info</div>
|
<div class="font-semibold text-gray-700 mb-2">💳 Payment Info</div>
|
||||||
<div class="text-gray-600">
|
<div class="text-gray-600">
|
||||||
{{ $invoice->bank_name }}
|
{{ $invoice->bank_name }}
|
||||||
@@ -114,8 +161,27 @@
|
|||||||
@endif
|
@endif
|
||||||
|
|
||||||
@if($invoice->notes)
|
@if($invoice->notes)
|
||||||
<div class="mt-4 text-sm text-gray-500 italic">{{ $invoice->notes }}</div>
|
<div class="text-sm text-gray-500 italic mb-8">{{ $invoice->notes }}</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<div class="flex justify-end mt-10">
|
||||||
|
@if($invoice->signature_image)
|
||||||
|
<div class="shrink-0 text-center w-full sm:w-auto">
|
||||||
|
<div class="text-sm text-gray-500 mb-3">
|
||||||
|
Jakarta, {{ $invoice->issue_date->format('d F Y') }}
|
||||||
|
</div>
|
||||||
|
<img src="{{ '/storage/' . $invoice->signature_image }}" alt="Signature" class="h-20 object-contain mb-3 mx-auto">
|
||||||
|
<div class="text-sm font-extrabold text-gray-800 uppercase tracking-wide">
|
||||||
|
{{ $invoice->signer_name ?: ($invoiceSettings->signer_name ?: ($invoiceSettings->header_name ?: 'Signature')) }}
|
||||||
|
</div>
|
||||||
|
@if($invoice->signer_title || $invoiceSettings->signer_title || $invoiceSettings->header_title)
|
||||||
|
<div class="text-xs text-gray-400 uppercase mt-0.5 tracking-wider">
|
||||||
|
{{ $invoice->signer_title ?: ($invoiceSettings->signer_title ?: $invoiceSettings->header_title) }}
|
||||||
|
</div>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
</div>
|
@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@endsection
|
@endsection
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en" data-theme="light">
|
<html lang="en" data-theme="light">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">
|
||||||
@@ -15,170 +16,160 @@
|
|||||||
<link href="https://fonts.googleapis.com/css2?family=Nunito:wght@400;500;600;700;800&display=swap" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css2?family=Nunito:wght@400;500;600;700;800&display=swap" rel="stylesheet">
|
||||||
@vite(['resources/css/app.css', 'resources/js/app.js'])
|
@vite(['resources/css/app.css', 'resources/js/app.js'])
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="bg-cream font-sans antialiased" x-data="appShell()">
|
<body class="bg-cream font-sans antialiased" x-data="appShell()">
|
||||||
|
|
||||||
{{-- ── Backdrop (mobile only) ─────────────────────────────────── --}}
|
{{-- ── Backdrop (mobile only) ─────────────────────────────────── --}}
|
||||||
<div
|
<div x-show="sidebarOpen" x-transition:enter="transition-opacity duration-300" x-transition:enter-start="opacity-0"
|
||||||
x-show="sidebarOpen"
|
x-transition:enter-end="opacity-100" x-transition:leave="transition-opacity duration-300"
|
||||||
x-transition:enter="transition-opacity duration-300"
|
x-transition:leave-start="opacity-100" x-transition:leave-end="opacity-0" @click="sidebarOpen = false"
|
||||||
x-transition:enter-start="opacity-0"
|
class="fixed inset-0 z-30 bg-black/40 lg:hidden" style="display:none"></div>
|
||||||
x-transition:enter-end="opacity-100"
|
|
||||||
x-transition:leave="transition-opacity duration-300"
|
|
||||||
x-transition:leave-start="opacity-100"
|
|
||||||
x-transition:leave-end="opacity-0"
|
|
||||||
@click="sidebarOpen = false"
|
|
||||||
class="fixed inset-0 z-30 bg-black/40 lg:hidden"
|
|
||||||
style="display:none"
|
|
||||||
></div>
|
|
||||||
|
|
||||||
{{-- ── Sidebar ─────────────────────────────────────────────────── --}}
|
{{-- ── Sidebar ─────────────────────────────────────────────────── --}}
|
||||||
<aside
|
<aside :class="sidebarOpen ? 'translate-x-0' : '-translate-x-full'" class="fixed inset-y-0 left-0 z-40 w-64 bg-white border-r border-pink-100 shadow-lg
|
||||||
:class="sidebarOpen ? 'translate-x-0' : '-translate-x-full'"
|
|
||||||
class="fixed inset-y-0 left-0 z-40 w-64 bg-white border-r border-pink-100 shadow-lg
|
|
||||||
flex flex-col py-6 px-4
|
flex flex-col py-6 px-4
|
||||||
transition-transform duration-300 ease-in-out
|
transition-transform duration-300 ease-in-out
|
||||||
lg:translate-x-0"
|
lg:translate-x-0">
|
||||||
>
|
|
||||||
{{-- Logo --}}
|
{{-- Logo --}}
|
||||||
<div class="flex items-center justify-between gap-3 mb-8 px-2">
|
<div class="flex items-center justify-between gap-3 mb-8 px-2">
|
||||||
<a href="{{ route('dashboard') }}" @click="sidebarOpen = false"
|
<a href="{{ route('dashboard') }}" @click="sidebarOpen = false"
|
||||||
class="flex items-center gap-3 group focus:outline-none">
|
class="flex items-center gap-3 group focus:outline-none">
|
||||||
<span class="text-3xl transition-transform duration-200 group-hover:scale-110 group-active:scale-95 select-none">🐱</span>
|
<span
|
||||||
|
class="text-3xl transition-transform duration-200 group-hover:scale-110 group-active:scale-95 select-none">🐱</span>
|
||||||
<div class="text-left">
|
<div class="text-left">
|
||||||
<div class="text-lg font-extrabold text-pink-500 leading-tight">KOL Manager</div>
|
<div class="text-lg font-extrabold text-pink-500 leading-tight">Cathy's App</div>
|
||||||
<div class="text-xs text-gray-400">Your Purr-fect Assistant</div>
|
<div class="text-xs text-gray-400">Your Purr-fect Assistant</div>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
<button @click="sidebarOpen = false" class="lg:hidden text-gray-400 hover:text-pink-500 text-xl leading-none" aria-label="Close">✕</button>
|
<button @click="sidebarOpen = false"
|
||||||
|
class="lg:hidden text-gray-400 hover:text-pink-500 text-xl leading-none" aria-label="Close">✕</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{-- Nav --}}
|
{{-- Nav --}}
|
||||||
<nav class="flex flex-col gap-1 flex-1 overflow-y-auto">
|
<nav class="flex flex-col gap-1 flex-1 overflow-y-auto">
|
||||||
<a href="{{ route('dashboard') }}"
|
<a href="{{ route('dashboard') }}" @click="sidebarOpen = false"
|
||||||
@click="sidebarOpen = false"
|
|
||||||
class="nav-item {{ request()->routeIs('dashboard') ? 'active' : '' }}">
|
class="nav-item {{ request()->routeIs('dashboard') ? 'active' : '' }}">
|
||||||
<span class="text-lg shrink-0">🏠</span> Dashboard
|
<span class="text-lg shrink-0">🏠</span> Dashboard
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<div class="text-xs font-bold text-gray-400 uppercase tracking-wider mt-4 mb-1 px-2">Manage</div>
|
<div class="text-xs font-bold text-gray-400 uppercase tracking-wider mt-4 mb-1 px-2">Manage</div>
|
||||||
|
|
||||||
<a href="{{ route('schedule.index') }}"
|
<a href="{{ route('schedule.index') }}" @click="sidebarOpen = false"
|
||||||
@click="sidebarOpen = false"
|
|
||||||
class="nav-item {{ request()->routeIs('schedule.*') ? 'active' : '' }}">
|
class="nav-item {{ request()->routeIs('schedule.*') ? 'active' : '' }}">
|
||||||
<span class="text-lg shrink-0">📅</span>
|
<span class="text-lg shrink-0">📅</span>
|
||||||
<span class="flex-1">Schedule</span>
|
<span class="flex-1">Schedule</span>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<a href="{{ route('clients.index') }}"
|
<a href="{{ route('clients.index') }}" @click="sidebarOpen = false"
|
||||||
@click="sidebarOpen = false"
|
|
||||||
class="nav-item {{ request()->routeIs('clients.*') ? 'active' : '' }}">
|
class="nav-item {{ request()->routeIs('clients.*') ? 'active' : '' }}">
|
||||||
<span class="text-lg shrink-0">👥</span> Clients / CRM
|
<span class="text-lg shrink-0">👥</span> Clients
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<a href="{{ route('client-categories.index') }}"
|
<a href="{{ route('contracts.index') }}" @click="sidebarOpen = false"
|
||||||
@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' : '' }}">
|
class="nav-item {{ request()->routeIs('contracts.*') ? 'active' : '' }}">
|
||||||
<span class="text-lg shrink-0">📋</span> Brand Contracts
|
<span class="text-lg shrink-0">📋</span> Contracts
|
||||||
</a>
|
</a>
|
||||||
|
<!--
|
||||||
<a href="{{ route('social-hub.index') }}"
|
<a href="{{ route('social-hub.index') }}"
|
||||||
@click="sidebarOpen = false"
|
@click="sidebarOpen = false"
|
||||||
class="nav-item {{ request()->routeIs('social-hub.*') ? 'active' : '' }}">
|
class="nav-item {{ request()->routeIs('social-hub.*') ? 'active' : '' }}">
|
||||||
<span class="text-lg shrink-0">📱</span> Social Hub
|
<span class="text-lg shrink-0">📱</span> Social Hub
|
||||||
</a>
|
</a>
|
||||||
|
-->
|
||||||
<div class="text-xs font-bold text-gray-400 uppercase tracking-wider mt-4 mb-1 px-2">Finance</div>
|
<div class="text-xs font-bold text-gray-400 uppercase tracking-wider mt-4 mb-1 px-2">Finance</div>
|
||||||
|
|
||||||
<a href="{{ route('invoices.index') }}"
|
<a href="{{ route('invoices.index') }}" @click="sidebarOpen = false"
|
||||||
@click="sidebarOpen = false"
|
|
||||||
class="nav-item {{ request()->routeIs('invoices.*') ? 'active' : '' }}">
|
class="nav-item {{ request()->routeIs('invoices.*') ? 'active' : '' }}">
|
||||||
<span class="text-lg shrink-0">🧾</span> Invoices
|
<span class="text-lg shrink-0">🧾</span> Invoices
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<a href="{{ route('rate-cards.index') }}"
|
<a href="{{ route('rate-cards.index') }}" @click="sidebarOpen = false"
|
||||||
@click="sidebarOpen = false"
|
|
||||||
class="nav-item {{ request()->routeIs('rate-cards.*') ? 'active' : '' }}">
|
class="nav-item {{ request()->routeIs('rate-cards.*') ? 'active' : '' }}">
|
||||||
<span class="text-lg shrink-0">💰</span> Rate Cards
|
<span class="text-lg shrink-0">💰</span> Rate Cards
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<div class="text-xs font-bold text-gray-400 uppercase tracking-wider mt-4 mb-1 px-2">Content</div>
|
<div class="text-xs font-bold text-gray-400 uppercase tracking-wider mt-4 mb-1 px-2">Content</div>
|
||||||
|
|
||||||
<a href="{{ route('content.index') }}"
|
<a href="{{ route('content.index') }}" @click="sidebarOpen = false"
|
||||||
@click="sidebarOpen = false"
|
|
||||||
class="nav-item {{ request()->routeIs('content.*') ? 'active' : '' }}">
|
class="nav-item {{ request()->routeIs('content.*') ? 'active' : '' }}">
|
||||||
<span class="text-lg shrink-0">🎬</span> Content Board
|
<span class="text-lg shrink-0">🎬</span> Content Board
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<a href="{{ route('files.index') }}"
|
<a href="{{ route('files.index') }}" @click="sidebarOpen = false"
|
||||||
@click="sidebarOpen = false"
|
|
||||||
class="nav-item {{ request()->routeIs('files.*') ? 'active' : '' }}">
|
class="nav-item {{ request()->routeIs('files.*') ? 'active' : '' }}">
|
||||||
<span class="text-lg shrink-0">📁</span> Files
|
<span class="text-lg shrink-0">📁</span> Files
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
<a href="{{ route('notes.index') }}" @click="sidebarOpen = false"
|
||||||
|
class="nav-item {{ request()->routeIs('notes.*') ? 'active' : '' }}">
|
||||||
|
<span class="text-lg shrink-0">📝</span> Notes
|
||||||
|
</a>
|
||||||
|
|
||||||
<div class="text-xs font-bold text-gray-400 uppercase tracking-wider mt-4 mb-1 px-2">Settings</div>
|
<div class="text-xs font-bold text-gray-400 uppercase tracking-wider mt-4 mb-1 px-2">Settings</div>
|
||||||
|
|
||||||
<a href="{{ route('settings.notifications') }}"
|
<a href="{{ route('client-categories.index') }}" @click="sidebarOpen = false"
|
||||||
@click="sidebarOpen = false"
|
class="nav-item {{ request()->routeIs('client-categories.*') ? 'active' : '' }}">
|
||||||
|
<span class="text-lg shrink-0">🏷️</span> Categories
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<a href="{{ route('settings.notifications') }}" @click="sidebarOpen = false"
|
||||||
class="nav-item {{ request()->routeIs('settings.*') ? 'active' : '' }}">
|
class="nav-item {{ request()->routeIs('settings.*') ? 'active' : '' }}">
|
||||||
<span class="text-lg shrink-0">🔔</span> Notifications
|
<span class="text-lg shrink-0">🔔</span> Notifications
|
||||||
</a>
|
</a>
|
||||||
</nav>
|
|
||||||
</aside>
|
|
||||||
|
|
||||||
{{-- ── Main wrapper ─────────────────────────────────────────────── --}}
|
{{-- Logout --}}
|
||||||
<div class="min-h-screen flex flex-col lg:ml-64">
|
<form method="POST" action="{{ route('gate.logout') }}" class="mt-auto pt-4">
|
||||||
|
@csrf
|
||||||
|
<button type="submit"
|
||||||
|
class="nav-item w-full text-left text-gray-400 hover:text-red-400 hover:bg-red-50 transition-colors">
|
||||||
|
<span class="text-lg shrink-0">🚪</span> Lock App
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</nav>
|
||||||
|
</aside>
|
||||||
|
|
||||||
|
{{-- ── Main wrapper ─────────────────────────────────────────────── --}}
|
||||||
|
<div class="min-h-screen flex flex-col lg:ml-64">
|
||||||
|
|
||||||
<div class="flex-1 flex flex-col min-w-0">
|
<div class="flex-1 flex flex-col min-w-0">
|
||||||
|
|
||||||
{{-- ── Topbar ───────────────────────────────────────────── --}}
|
{{-- ── Topbar ───────────────────────────────────────────── --}}
|
||||||
<header class="sticky top-0 z-20 bg-white border-b border-pink-100 px-4 lg:px-8 py-3 lg:py-4 flex items-center gap-3 shadow-sm">
|
<header
|
||||||
|
class="sticky top-0 z-20 bg-white border-b border-pink-100 px-4 lg:px-8 py-3 lg:py-4 flex items-center gap-3 shadow-sm">
|
||||||
|
|
||||||
{{-- Hamburger (mobile) --}}
|
{{-- Hamburger (mobile) --}}
|
||||||
<button
|
<button @click="sidebarOpen = true"
|
||||||
@click="sidebarOpen = true"
|
|
||||||
class="lg:hidden text-2xl transition-transform duration-150 active:scale-90 focus:outline-none select-none"
|
class="lg:hidden text-2xl transition-transform duration-150 active:scale-90 focus:outline-none select-none"
|
||||||
aria-label="Open menu"
|
aria-label="Open menu">🐱</button>
|
||||||
>🐱</button>
|
|
||||||
|
|
||||||
{{-- Page title (hidden when search open) --}}
|
{{-- Page title (hidden when search open) --}}
|
||||||
<div class="flex-1 min-w-0" x-show="!searchOpen" x-transition>
|
<div class="flex-1 min-w-0" x-show="!searchOpen" x-transition>
|
||||||
<h1 class="text-base lg:text-xl font-bold text-gray-800 truncate">@yield('page-title', 'Dashboard')</h1>
|
<h1 class="text-base lg:text-xl font-bold text-gray-800 truncate">@yield('page-title', 'Dashboard')
|
||||||
<p class="text-xs lg:text-sm text-gray-400 hidden sm:block">@yield('page-subtitle', today()->format('l, d F Y'))</p>
|
</h1>
|
||||||
|
<p class="text-xs lg:text-sm text-gray-400 hidden sm:block">
|
||||||
|
@yield('page-subtitle', today()->format('l, d F Y'))</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{-- ── Global Search bar ─────────────────────────── --}}
|
{{-- ── Global Search bar ─────────────────────────── --}}
|
||||||
<div class="flex-1 min-w-0" x-show="searchOpen" x-transition style="display:none">
|
<div class="flex-1 min-w-0" x-show="searchOpen" x-transition style="display:none">
|
||||||
<div class="relative">
|
<div class="relative">
|
||||||
<span class="absolute left-3 top-1/2 -translate-y-1/2 text-gray-400 text-sm pointer-events-none">🔍</span>
|
<span
|
||||||
<input
|
class="absolute left-3 top-1/2 -translate-y-1/2 text-gray-400 text-sm pointer-events-none"></span>
|
||||||
id="global-search-input"
|
<input id="global-search-input" type="text" placeholder="Search clients, events, invoices…"
|
||||||
type="text"
|
class="input-soft pl-9 pr-4 py-2 text-sm w-full" x-model="searchQuery"
|
||||||
placeholder="Search clients, events, invoices…"
|
@input.debounce.300ms="doSearch()" @keydown.escape="closeSearch()" x-ref="searchInput">
|
||||||
class="input-soft pl-9 pr-4 py-2 text-sm w-full"
|
|
||||||
x-model="searchQuery"
|
|
||||||
@input.debounce.300ms="doSearch()"
|
|
||||||
@keydown.escape="closeSearch()"
|
|
||||||
x-ref="searchInput"
|
|
||||||
>
|
|
||||||
{{-- Search results dropdown --}}
|
{{-- Search results dropdown --}}
|
||||||
<div
|
<div x-show="searchResults.length > 0 || (searchQuery.length >= 2 && !searchLoading)"
|
||||||
x-show="searchResults.length > 0 || (searchQuery.length >= 2 && !searchLoading)"
|
|
||||||
class="absolute top-full left-0 right-0 mt-2 bg-white rounded-2xl shadow-xl border border-pink-100 z-50 max-h-80 overflow-y-auto"
|
class="absolute top-full left-0 right-0 mt-2 bg-white rounded-2xl shadow-xl border border-pink-100 z-50 max-h-80 overflow-y-auto"
|
||||||
@click.outside="searchResults = []"
|
@click.outside="searchResults = []">
|
||||||
>
|
|
||||||
<template x-if="searchLoading">
|
<template x-if="searchLoading">
|
||||||
<div class="px-4 py-3 text-sm text-gray-400 flex items-center gap-2">
|
<div class="px-4 py-3 text-sm text-gray-400 flex items-center gap-2">
|
||||||
<span class="animate-spin">🐾</span> Searching…
|
<span class="animate-spin">🐾</span> Searching…
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template x-if="!searchLoading && searchResults.length === 0 && searchQuery.length >= 2">
|
<template x-if="!searchLoading && searchResults.length === 0 && searchQuery.length >= 2">
|
||||||
<div class="px-4 py-3 text-sm text-gray-400">No results for "<span x-text="searchQuery"></span>"</div>
|
<div class="px-4 py-3 text-sm text-gray-400">No results for "<span
|
||||||
|
x-text="searchQuery"></span>"</div>
|
||||||
</template>
|
</template>
|
||||||
<template x-for="group in searchResults" :key="group.type">
|
<template x-for="group in searchResults" :key="group.type">
|
||||||
<div>
|
<div>
|
||||||
@@ -190,17 +181,18 @@
|
|||||||
@click="closeSearch()">
|
@click="closeSearch()">
|
||||||
<span class="text-lg shrink-0" x-text="item.icon"></span>
|
<span class="text-lg shrink-0" x-text="item.icon"></span>
|
||||||
<div class="min-w-0">
|
<div class="min-w-0">
|
||||||
<div class="text-sm font-semibold text-gray-700 truncate" x-text="item.title"></div>
|
<div class="text-sm font-semibold text-gray-700 truncate"
|
||||||
<div class="text-xs text-gray-400 truncate" x-text="item.subtitle"></div>
|
x-text="item.title"></div>
|
||||||
|
<div class="text-xs text-gray-400 truncate" x-text="item.subtitle">
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<div class="border-t border-pink-50 px-4 py-2">
|
<div class="border-t border-pink-50 px-4 py-2">
|
||||||
<a :href="'/search?q=' + encodeURIComponent(searchQuery)"
|
<a :href="`/search?q=${encodeURIComponent(searchQuery)}`"
|
||||||
class="text-xs text-pink-500 hover:text-pink-700 font-medium flex items-center gap-1"
|
class="text-xs text-pink-500 hover:text-pink-700 font-medium flex items-center gap-1">
|
||||||
@click="closeSearch()">
|
|
||||||
🔍 See all results for "<span x-text="searchQuery"></span>"
|
🔍 See all results for "<span x-text="searchQuery"></span>"
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
@@ -211,20 +203,19 @@
|
|||||||
{{-- Right actions --}}
|
{{-- Right actions --}}
|
||||||
<div class="flex items-center gap-2 shrink-0">
|
<div class="flex items-center gap-2 shrink-0">
|
||||||
{{-- Search toggle --}}
|
{{-- Search toggle --}}
|
||||||
<button
|
<button @click="toggleSearch()"
|
||||||
@click="toggleSearch()"
|
|
||||||
class="w-8 h-8 lg:w-9 lg:h-9 rounded-full flex items-center justify-center hover:bg-pink-50 transition-colors text-gray-500 hover:text-pink-500"
|
class="w-8 h-8 lg:w-9 lg:h-9 rounded-full flex items-center justify-center hover:bg-pink-50 transition-colors text-gray-500 hover:text-pink-500"
|
||||||
:title="searchOpen ? 'Close search' : 'Search'"
|
:title="searchOpen ? 'Close search' : 'Search'" aria-label="Toggle search">
|
||||||
aria-label="Toggle search"
|
|
||||||
>
|
|
||||||
<span x-text="searchOpen ? '✕' : '🔍'" class="text-sm lg:text-base"></span>
|
<span x-text="searchOpen ? '✕' : '🔍'" class="text-sm lg:text-base"></span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
<!--
|
||||||
{{-- Avatar --}}
|
{{-- Avatar --}}
|
||||||
<div class="w-8 h-8 lg:w-9 lg:h-9 rounded-full flex items-center justify-center text-white font-bold text-xs lg:text-sm shadow-sm"
|
<div class="w-8 h-8 lg:w-9 lg:h-9 rounded-full flex items-center justify-center text-white font-bold text-xs lg:text-sm shadow-sm"
|
||||||
style="background: linear-gradient(135deg, #FFB7C5, #E8D5F5);">
|
style="background: linear-gradient(135deg, #FFB7C5, #E8D5F5);">
|
||||||
KOL
|
FUN
|
||||||
</div>
|
</div>
|
||||||
|
-->
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
@@ -250,12 +241,12 @@
|
|||||||
@yield('content')
|
@yield('content')
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@stack('scripts')
|
@stack('scripts')
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
function appShell() {
|
function appShell() {
|
||||||
return {
|
return {
|
||||||
sidebarOpen: false,
|
sidebarOpen: false,
|
||||||
searchOpen: false,
|
searchOpen: false,
|
||||||
@@ -292,7 +283,8 @@ function appShell() {
|
|||||||
this.searchLoading = false;
|
this.searchLoading = false;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
57
resources/views/layouts/fab.blade.php
Normal file
57
resources/views/layouts/fab.blade.php
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
<div x-data="{ open: false }" class="fixed bottom-6 right-6 z-50 flex flex-col items-end">
|
||||||
|
{{-- Menu items (hidden by default) --}}
|
||||||
|
<div x-show="open" x-transition:enter="transition ease-out duration-200"
|
||||||
|
x-transition:enter-start="opacity-0 translate-y-4 scale-95"
|
||||||
|
x-transition:enter-end="opacity-100 translate-y-0 scale-100"
|
||||||
|
x-transition:leave="transition ease-in duration-150"
|
||||||
|
x-transition:leave-start="opacity-100 translate-y-0 scale-100"
|
||||||
|
x-transition:leave-end="opacity-0 translate-y-4 scale-95"
|
||||||
|
@click.away="open = false"
|
||||||
|
class="flex flex-col items-end gap-3 mb-4" style="display: none;">
|
||||||
|
|
||||||
|
<a href="{{ route('files.index') }}" class="flex items-center gap-3 group">
|
||||||
|
<span class="bg-gray-800 text-white font-medium text-xs px-3 py-2 rounded-lg shadow-xl min-w-max hidden lg:block opacity-0 translate-x-4 group-hover:opacity-100 group-hover:translate-x-0 transition-all duration-300 ease-out">Upload File</span>
|
||||||
|
<div class="w-12 h-12 rounded-full bg-teal-500 text-white flex items-center justify-center shadow hover:scale-110 transition-transform duration-200 text-lg">📁</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<a href="{{ route('notes.index') }}" class="flex items-center gap-3 group">
|
||||||
|
<span class="bg-gray-800 text-white font-medium text-xs px-3 py-2 rounded-lg shadow-xl min-w-max hidden lg:block opacity-0 translate-x-4 group-hover:opacity-100 group-hover:translate-x-0 transition-all duration-300 ease-out">Add Notes</span>
|
||||||
|
<div class="w-12 h-12 rounded-full bg-yellow-400 text-white flex items-center justify-center shadow hover:scale-110 transition-transform duration-200 text-lg">📝</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<a href="{{ route('content.create') }}" class="flex items-center gap-3 group">
|
||||||
|
<span class="bg-gray-800 text-white font-medium text-xs px-3 py-2 rounded-lg shadow-xl min-w-max hidden lg:block opacity-0 translate-x-4 group-hover:opacity-100 group-hover:translate-x-0 transition-all duration-300 ease-out">New Board</span>
|
||||||
|
<div class="w-12 h-12 rounded-full bg-purple-500 text-white flex items-center justify-center shadow hover:scale-110 transition-transform duration-200 text-lg">🎬</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<a href="{{ route('contracts.index') }}" class="flex items-center gap-3 group">
|
||||||
|
<span class="bg-gray-800 text-white font-medium text-xs px-3 py-2 rounded-lg shadow-xl min-w-max hidden lg:block opacity-0 translate-x-4 group-hover:opacity-100 group-hover:translate-x-0 transition-all duration-300 ease-out">New Contract</span>
|
||||||
|
<div class="w-12 h-12 rounded-full bg-rose-500 text-white flex items-center justify-center shadow hover:scale-110 transition-transform duration-200 text-lg">📄</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<a href="{{ route('invoices.create') }}" class="flex items-center gap-3 group">
|
||||||
|
<span class="bg-gray-800 text-white font-medium text-xs px-3 py-2 rounded-lg shadow-xl min-w-max hidden lg:block opacity-0 translate-x-4 group-hover:opacity-100 group-hover:translate-x-0 transition-all duration-300 ease-out">New Invoice</span>
|
||||||
|
<div class="w-12 h-12 rounded-full bg-amber-500 text-white flex items-center justify-center shadow hover:scale-110 transition-transform duration-200 text-lg">🧾</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<a href="{{ route('clients.create') }}" class="flex items-center gap-3 group">
|
||||||
|
<span class="bg-gray-800 text-white font-medium text-xs px-3 py-2 rounded-lg shadow-xl min-w-max hidden lg:block opacity-0 translate-x-4 group-hover:opacity-100 group-hover:translate-x-0 transition-all duration-300 ease-out">Add Client</span>
|
||||||
|
<div class="w-12 h-12 rounded-full bg-emerald-500 text-white flex items-center justify-center shadow hover:scale-110 transition-transform duration-200 text-lg">👥</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<a href="{{ route('schedule.create') }}" class="flex items-center gap-3 group">
|
||||||
|
<span class="bg-gray-800 text-white font-medium text-xs px-3 py-2 rounded-lg shadow-xl min-w-max hidden lg:block opacity-0 translate-x-4 group-hover:opacity-100 group-hover:translate-x-0 transition-all duration-300 ease-out">Add Event</span>
|
||||||
|
<div class="w-12 h-12 rounded-full bg-blue-500 text-white flex items-center justify-center shadow hover:scale-110 transition-transform duration-200 text-lg">📅</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Main FAB button --}}
|
||||||
|
<button @click="open = !open"
|
||||||
|
class="w-16 h-16 rounded-full bg-pink-500 hover:bg-pink-600 text-white flex items-center justify-center shadow-lg shadow-pink-500/40 hover:shadow-2xl hover:shadow-pink-500/50 transition-all duration-300 hover:-translate-y-1 hover:scale-105 active:scale-95 z-50 transform"
|
||||||
|
:class="{'rotate-45 bg-pink-600': open}">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" class="h-8 w-8 transition-transform duration-300" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="3">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" d="M12 4v16m8-8H4" />
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
449
resources/views/notes/index.blade.php
Normal file
449
resources/views/notes/index.blade.php
Normal file
@@ -0,0 +1,449 @@
|
|||||||
|
@extends('layouts.app')
|
||||||
|
|
||||||
|
@section('title', 'Notes')
|
||||||
|
@section('page-title', 'Notes Management 📝')
|
||||||
|
@section('page-subtitle', 'Quick notes, checklists & reminders')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
|
||||||
|
<div x-data="notesApp({{ json_encode($notes) }})" x-cloak>
|
||||||
|
|
||||||
|
{{-- ── Toolbar ──────────────────────────────────────────────── --}}
|
||||||
|
<div class="flex items-center justify-between mb-4">
|
||||||
|
<button @click="openNew()" class="btn-sakura text-sm px-4 py-2 flex items-center gap-1.5 shrink-0">
|
||||||
|
+ New Note
|
||||||
|
</button>
|
||||||
|
|
||||||
|
{{-- Count --}}
|
||||||
|
<span class="text-xs text-gray-400 shrink-0"
|
||||||
|
x-text="notes.length + ' note' + (notes.length !== 1 ? 's' : '')"></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- ── Pinned section ───────────────────────────────────────── --}}
|
||||||
|
<template x-if="filteredPinned.length > 0">
|
||||||
|
<div class="mb-5">
|
||||||
|
<div class="text-xs font-bold text-gray-400 uppercase tracking-wider mb-2 flex items-center gap-1.5">
|
||||||
|
📌 Pinned
|
||||||
|
</div>
|
||||||
|
<div class="grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 gap-3">
|
||||||
|
<template x-for="note in filteredPinned" :key="note.id">
|
||||||
|
<div class="rounded-3xl p-4 flex flex-col gap-2 shadow-sm border border-black/5 cursor-pointer
|
||||||
|
hover:shadow-md transition-shadow duration-200 group relative"
|
||||||
|
:style="`background:${note.color || '#FFFFFF'}`" @click="openEdit(note)">
|
||||||
|
|
||||||
|
{{-- Pin badge --}}
|
||||||
|
<div
|
||||||
|
class="absolute top-2.5 right-2.5 text-xs text-amber-400 opacity-60 group-hover:opacity-100">
|
||||||
|
📌</div>
|
||||||
|
|
||||||
|
{{-- Title --}}
|
||||||
|
<p class="font-bold text-gray-800 text-sm leading-snug pr-5 line-clamp-2"
|
||||||
|
x-text="note.title || 'Untitled'"></p>
|
||||||
|
|
||||||
|
{{-- Content preview --}}
|
||||||
|
<div class="flex-1 text-xs text-gray-500 space-y-0.5 line-clamp-4">
|
||||||
|
<template x-for="(block, i) in (note.content || []).slice(0, 4)" :key="i">
|
||||||
|
<div class="flex items-start gap-1.5 min-w-0">
|
||||||
|
<template x-if="block.type === 'bullet'">
|
||||||
|
<span class="shrink-0 text-gray-400 mt-px">•</span>
|
||||||
|
</template>
|
||||||
|
<template x-if="block.type === 'checkbox'">
|
||||||
|
<span class="shrink-0 mt-px" x-text="block.checked ? '☑' : '☐'"></span>
|
||||||
|
</template>
|
||||||
|
<span class="truncate"
|
||||||
|
:class="block.type === 'checkbox' && block.checked ? 'line-through text-gray-400' : ''"
|
||||||
|
x-text="block.text || '…'"></span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Footer --}}
|
||||||
|
<div class="flex items-center justify-between mt-1">
|
||||||
|
<span class="text-xs text-gray-400" x-text="formatDate(note.updated_at)"></span>
|
||||||
|
<button @click.stop="deleteNote(note)"
|
||||||
|
class="opacity-0 group-hover:opacity-100 text-xs text-red-400 hover:text-red-600 transition-opacity leading-none px-1">✕</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
{{-- ── All / Other notes ────────────────────────────────────── --}}
|
||||||
|
<template x-if="filteredUnpinned.length > 0 || (filteredPinned.length > 0)">
|
||||||
|
<div>
|
||||||
|
<template x-if="filteredPinned.length > 0 && filteredUnpinned.length > 0">
|
||||||
|
<div class="text-xs font-bold text-gray-400 uppercase tracking-wider mb-2">Others</div>
|
||||||
|
</template>
|
||||||
|
<div class="grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 gap-3">
|
||||||
|
<template x-for="note in filteredUnpinned" :key="note.id">
|
||||||
|
<div class="rounded-3xl p-4 flex flex-col gap-2 shadow-sm border border-black/5 cursor-pointer
|
||||||
|
hover:shadow-md transition-shadow duration-200 group"
|
||||||
|
:style="`background:${note.color || '#FFFFFF'}`" @click="openEdit(note)">
|
||||||
|
|
||||||
|
{{-- Title --}}
|
||||||
|
<p class="font-bold text-gray-800 text-sm leading-snug line-clamp-2"
|
||||||
|
x-text="note.title || 'Untitled'"></p>
|
||||||
|
|
||||||
|
{{-- Content preview --}}
|
||||||
|
<div class="flex-1 text-xs text-gray-500 space-y-0.5">
|
||||||
|
<template x-for="(block, i) in (note.content || []).slice(0, 4)" :key="i">
|
||||||
|
<div class="flex items-start gap-1.5 min-w-0">
|
||||||
|
<template x-if="block.type === 'bullet'">
|
||||||
|
<span class="shrink-0 text-gray-400 mt-px">•</span>
|
||||||
|
</template>
|
||||||
|
<template x-if="block.type === 'checkbox'">
|
||||||
|
<span class="shrink-0 mt-px" x-text="block.checked ? '☑' : '☐'"></span>
|
||||||
|
</template>
|
||||||
|
<span class="truncate"
|
||||||
|
:class="block.type === 'checkbox' && block.checked ? 'line-through text-gray-400' : ''"
|
||||||
|
x-text="block.text || '…'"></span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Footer --}}
|
||||||
|
<div class="flex items-center justify-between mt-1">
|
||||||
|
<span class="text-xs text-gray-400" x-text="formatDate(note.updated_at)"></span>
|
||||||
|
<button @click.stop="deleteNote(note)"
|
||||||
|
class="opacity-0 group-hover:opacity-100 text-xs text-red-400 hover:text-red-600 transition-opacity leading-none px-1">✕</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
{{-- Empty state is only when NO notes exist --}}
|
||||||
|
<template x-if="notes.length === 0">
|
||||||
|
<div class="text-center py-20 text-gray-400">
|
||||||
|
<span class="text-5xl block mb-3">📝</span>
|
||||||
|
<p class="text-sm font-medium mb-4">No notes yet.</p>
|
||||||
|
<button @click="openNew()" class="btn-sakura text-sm">Write your first note</button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
{{-- ════════════════════════════════════════════════════════════
|
||||||
|
Note Editor Modal
|
||||||
|
════════════════════════════════════════════════════════════ --}}
|
||||||
|
<div x-show="showModal" x-transition:enter="transition ease-out duration-200" x-transition:enter-start="opacity-0"
|
||||||
|
x-transition:enter-end="opacity-100" x-transition:leave="transition ease-in duration-150"
|
||||||
|
x-transition:leave-start="opacity-100" x-transition:leave-end="opacity-0"
|
||||||
|
class="fixed inset-0 z-50 flex items-end sm:items-center justify-center bg-black/40 px-0 sm:px-4"
|
||||||
|
style="display:none" @keydown.escape.window="showModal = false">
|
||||||
|
|
||||||
|
<div class="w-full sm:max-w-lg rounded-t-3xl sm:rounded-3xl shadow-2xl flex flex-col overflow-hidden"
|
||||||
|
:style="`background:${editorColor || '#FFFFFF'}`" style="max-height:90vh" @click.stop>
|
||||||
|
|
||||||
|
{{-- ── Modal Header ─────────────────────────────── --}}
|
||||||
|
<div class="flex items-center gap-2 px-4 pt-4 pb-3 border-b border-black/5 shrink-0">
|
||||||
|
|
||||||
|
{{-- Color swatches --}}
|
||||||
|
<div class="flex gap-1.5 flex-wrap">
|
||||||
|
<template x-for="c in noteColors" :key="c">
|
||||||
|
<button @click="editorColor = c" type="button"
|
||||||
|
class="w-5 h-5 rounded-full border-2 transition-transform hover:scale-110 shrink-0"
|
||||||
|
:style="`background:${c}`"
|
||||||
|
:class="editorColor === c ? 'border-gray-500 scale-110' : 'border-gray-200'">
|
||||||
|
</button>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Pin toggle --}}
|
||||||
|
<button @click="editorPinned = !editorPinned" type="button"
|
||||||
|
class="ml-auto text-sm px-2.5 py-1 rounded-full border transition-colors shrink-0"
|
||||||
|
:class="editorPinned ? 'border-amber-300 bg-amber-50 text-amber-600' : 'border-gray-200 text-gray-400 hover:border-amber-200 hover:text-amber-400'">
|
||||||
|
📌 <span x-text="editorPinned ? 'Pinned' : 'Pin'"></span>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
{{-- Close --}}
|
||||||
|
<button @click="showModal = false" type="button"
|
||||||
|
class="text-gray-400 hover:text-gray-600 text-xl leading-none shrink-0 ml-1">✕</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- ── Scrollable Body ──────────────────────────── --}}
|
||||||
|
<div class="flex-1 overflow-y-auto px-4 py-3 space-y-1">
|
||||||
|
|
||||||
|
{{-- Title --}}
|
||||||
|
<input type="text" x-model="editorTitle" x-ref="titleInput" placeholder="Note title…"
|
||||||
|
class="w-full bg-transparent border-none outline-none font-bold text-gray-800 text-lg placeholder-gray-300 mb-2"
|
||||||
|
@keydown.enter.prevent="focusFirstBlock()">
|
||||||
|
|
||||||
|
{{-- Blocks --}}
|
||||||
|
<template x-for="(block, idx) in editorBlocks" :key="block.id">
|
||||||
|
<div class="flex items-center gap-2 group/block py-0.5">
|
||||||
|
|
||||||
|
{{-- Left side: bullet / checkbox / empty --}}
|
||||||
|
<template x-if="block.type === 'bullet'">
|
||||||
|
<span class="text-gray-400 text-sm shrink-0 select-none mt-px">•</span>
|
||||||
|
</template>
|
||||||
|
<template x-if="block.type === 'checkbox'">
|
||||||
|
<input type="checkbox" x-model="block.checked"
|
||||||
|
class="w-4 h-4 accent-pink-400 shrink-0 cursor-pointer mt-px" @click.stop>
|
||||||
|
</template>
|
||||||
|
<template x-if="block.type === 'paragraph'">
|
||||||
|
<span class="w-4 shrink-0"></span>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
{{-- Text input --}}
|
||||||
|
<input type="text" x-model="block.text"
|
||||||
|
:placeholder="block.type === 'paragraph' ? 'Add text…' : block.type === 'bullet' ? 'List item…' : 'To-do item…'"
|
||||||
|
:class="block.type === 'checkbox' && block.checked ? 'line-through text-gray-400' : 'text-gray-700'"
|
||||||
|
class="flex-1 bg-transparent border-none outline-none text-sm placeholder-gray-300 py-0.5"
|
||||||
|
:data-block-id="block.id" @keydown.enter.prevent="insertBlockAfter(idx)"
|
||||||
|
@keydown.backspace="handleBackspace($event, block, idx)">
|
||||||
|
|
||||||
|
{{-- Block type switcher (hover) --}}
|
||||||
|
<div class="flex gap-0.5 opacity-0 group-hover/block:opacity-100 transition-opacity shrink-0">
|
||||||
|
<button @click.stop="changeType(idx, 'paragraph')" type="button"
|
||||||
|
:class="block.type === 'paragraph' ? 'text-pink-500' : 'text-gray-300 hover:text-gray-500'"
|
||||||
|
class="text-xs px-1 leading-none" title="Text">T</button>
|
||||||
|
<button @click.stop="changeType(idx, 'bullet')" type="button"
|
||||||
|
:class="block.type === 'bullet' ? 'text-pink-500' : 'text-gray-300 hover:text-gray-500'"
|
||||||
|
class="text-xs px-1 leading-none" title="Bullet">•</button>
|
||||||
|
<button @click.stop="changeType(idx, 'checkbox')" type="button"
|
||||||
|
:class="block.type === 'checkbox' ? 'text-pink-500' : 'text-gray-300 hover:text-gray-500'"
|
||||||
|
class="text-xs px-1 leading-none" title="Checkbox">☐</button>
|
||||||
|
<button @click.stop="removeBlock(idx)" type="button"
|
||||||
|
class="text-xs px-1 leading-none text-gray-300 hover:text-red-400 ml-1"
|
||||||
|
title="Remove">✕</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
{{-- Add block toolbar --}}
|
||||||
|
<div class="flex gap-2 pt-3 border-t border-black/5 mt-2">
|
||||||
|
<button @click="addBlock('paragraph')" type="button"
|
||||||
|
class="flex items-center gap-1 text-xs px-3 py-1.5 rounded-full border border-gray-200 text-gray-500 hover:bg-white/60 hover:border-gray-300 transition-colors">
|
||||||
|
<span class="font-semibold">T</span> Text
|
||||||
|
</button>
|
||||||
|
<button @click="addBlock('bullet')" type="button"
|
||||||
|
class="flex items-center gap-1 text-xs px-3 py-1.5 rounded-full border border-gray-200 text-gray-500 hover:bg-white/60 hover:border-gray-300 transition-colors">
|
||||||
|
• Bullet
|
||||||
|
</button>
|
||||||
|
<button @click="addBlock('checkbox')" type="button"
|
||||||
|
class="flex items-center gap-1 text-xs px-3 py-1.5 rounded-full border border-gray-200 text-gray-500 hover:bg-white/60 hover:border-gray-300 transition-colors">
|
||||||
|
☐ Checkbox
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- ── Modal Footer ─────────────────────────────── --}}
|
||||||
|
<div class="flex gap-2 px-4 pb-5 pt-3 border-t border-black/5 shrink-0">
|
||||||
|
<button @click="saveNote()" type="button"
|
||||||
|
class="btn-sakura flex-1 py-2.5 text-sm flex items-center justify-center gap-2" :disabled="saving">
|
||||||
|
<span x-show="!saving">💾 Save Note</span>
|
||||||
|
<span x-show="saving" class="flex items-center gap-1.5"><span
|
||||||
|
class="animate-spin inline-block">🐾</span> Saving…</span>
|
||||||
|
</button>
|
||||||
|
<button @click="showModal = false" type="button"
|
||||||
|
class="flex-1 py-2.5 rounded-full border border-pink-200 text-gray-600 text-sm hover:bg-pink-50 transition-colors">
|
||||||
|
Cancel
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>{{-- end x-data --}}
|
||||||
|
|
||||||
|
@push('scripts')
|
||||||
|
<script>
|
||||||
|
function notesApp(initialNotes) {
|
||||||
|
return {
|
||||||
|
notes: initialNotes,
|
||||||
|
showModal: false,
|
||||||
|
editing: null,
|
||||||
|
|
||||||
|
// editor state
|
||||||
|
editorTitle: '',
|
||||||
|
editorBlocks: [],
|
||||||
|
editorColor: '#FFFFFF',
|
||||||
|
editorPinned: false,
|
||||||
|
saving: false,
|
||||||
|
nextBlockId: 1,
|
||||||
|
searchQuery: '',
|
||||||
|
|
||||||
|
noteColors: [
|
||||||
|
'#FFFFFF', '#FFE4E8', '#FFF9C4', '#E8F5E9',
|
||||||
|
'#E3F2FD', '#F3E5F5', '#FFF3E0', '#E0F7FA'
|
||||||
|
],
|
||||||
|
|
||||||
|
// ── Computed / Filtered ───────────────────────────────
|
||||||
|
get filteredPinned() {
|
||||||
|
return this.notes.filter(n => n.is_pinned);
|
||||||
|
},
|
||||||
|
|
||||||
|
get filteredUnpinned() {
|
||||||
|
return this.notes.filter(n => !n.is_pinned);
|
||||||
|
},
|
||||||
|
|
||||||
|
// ── Modal open/close ─────────────────────────────────
|
||||||
|
openNew() {
|
||||||
|
this.editing = null;
|
||||||
|
this.editorTitle = '';
|
||||||
|
this.editorBlocks = [this.makeBlock('paragraph')];
|
||||||
|
this.editorColor = '#FFFFFF';
|
||||||
|
this.editorPinned = false;
|
||||||
|
this.showModal = true;
|
||||||
|
this.$nextTick(() => this.$refs.titleInput?.focus());
|
||||||
|
},
|
||||||
|
|
||||||
|
openEdit(note) {
|
||||||
|
this.editing = note;
|
||||||
|
this.editorTitle = note.title || '';
|
||||||
|
this.editorBlocks = (note.content && note.content.length)
|
||||||
|
? note.content.map(b => ({ ...b, id: this.nextBlockId++ }))
|
||||||
|
: [this.makeBlock('paragraph')];
|
||||||
|
this.editorColor = note.color || '#FFFFFF';
|
||||||
|
this.editorPinned = !!note.is_pinned;
|
||||||
|
this.showModal = true;
|
||||||
|
this.$nextTick(() => this.$refs.titleInput?.focus());
|
||||||
|
},
|
||||||
|
|
||||||
|
// ── CRUD ─────────────────────────────────────────────
|
||||||
|
async saveNote() {
|
||||||
|
if (!this.editorTitle.trim()) {
|
||||||
|
this.$refs.titleInput?.focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.saving = true;
|
||||||
|
const csrfToken = document.querySelector('meta[name=csrf-token]').content;
|
||||||
|
|
||||||
|
const payload = {
|
||||||
|
title: this.editorTitle.trim(),
|
||||||
|
content: this.editorBlocks.map(({ type, text, checked }) => ({ type, text: text || '', checked: !!checked })),
|
||||||
|
color: this.editorColor,
|
||||||
|
is_pinned: this.editorPinned,
|
||||||
|
};
|
||||||
|
|
||||||
|
const url = this.editing ? `/notes/${this.editing.id}` : '/notes';
|
||||||
|
const method = this.editing ? 'PUT' : 'POST';
|
||||||
|
|
||||||
|
try {
|
||||||
|
const res = await fetch(url, {
|
||||||
|
method,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'Accept': 'application/json',
|
||||||
|
'X-CSRF-TOKEN': csrfToken,
|
||||||
|
},
|
||||||
|
body: JSON.stringify(payload),
|
||||||
|
});
|
||||||
|
const saved = await res.json();
|
||||||
|
|
||||||
|
if (this.editing) {
|
||||||
|
const idx = this.notes.findIndex(n => n.id === this.editing.id);
|
||||||
|
if (idx !== -1) this.notes.splice(idx, 1, saved);
|
||||||
|
} else {
|
||||||
|
this.notes.unshift(saved);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.showModal = false;
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Save failed', err);
|
||||||
|
}
|
||||||
|
this.saving = false;
|
||||||
|
},
|
||||||
|
|
||||||
|
async deleteNote(note) {
|
||||||
|
if (!confirm(`Delete "${note.title || 'this note'}"?`)) return;
|
||||||
|
const csrfToken = document.querySelector('meta[name=csrf-token]').content;
|
||||||
|
|
||||||
|
const res = await fetch(`/notes/${note.id}`, {
|
||||||
|
method: 'DELETE',
|
||||||
|
headers: { 'Accept': 'application/json', 'X-CSRF-TOKEN': csrfToken },
|
||||||
|
});
|
||||||
|
if (res.ok) {
|
||||||
|
this.notes = this.notes.filter(n => n.id !== note.id);
|
||||||
|
if (this.editing && this.editing.id === note.id) {
|
||||||
|
this.showModal = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
async togglePin(note) {
|
||||||
|
const csrfToken = document.querySelector('meta[name=csrf-token]').content;
|
||||||
|
const res = await fetch(`/notes/${note.id}/pin`, {
|
||||||
|
method: 'PATCH',
|
||||||
|
headers: { 'Accept': 'application/json', 'X-CSRF-TOKEN': csrfToken },
|
||||||
|
});
|
||||||
|
if (res.ok) {
|
||||||
|
const updated = await res.json();
|
||||||
|
const idx = this.notes.findIndex(n => n.id === note.id);
|
||||||
|
if (idx !== -1) this.notes.splice(idx, 1, updated);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// ── Block editor helpers ──────────────────────────────
|
||||||
|
makeBlock(type = 'paragraph') {
|
||||||
|
return { id: this.nextBlockId++, type, text: '', checked: false };
|
||||||
|
},
|
||||||
|
|
||||||
|
insertBlockAfter(idx) {
|
||||||
|
const currentType = this.editorBlocks[idx]?.type ?? 'paragraph';
|
||||||
|
const newBlock = this.makeBlock(currentType);
|
||||||
|
this.editorBlocks.splice(idx + 1, 0, newBlock);
|
||||||
|
this.$nextTick(() => {
|
||||||
|
document.querySelector(`[data-block-id="${newBlock.id}"]`)?.focus();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
handleBackspace(e, block, idx) {
|
||||||
|
if (block.text === '' && this.editorBlocks.length > 1) {
|
||||||
|
e.preventDefault();
|
||||||
|
this.editorBlocks.splice(idx, 1);
|
||||||
|
this.$nextTick(() => {
|
||||||
|
const target = this.editorBlocks[Math.max(0, idx - 1)];
|
||||||
|
if (target) document.querySelector(`[data-block-id="${target.id}"]`)?.focus();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
addBlock(type) {
|
||||||
|
const nb = this.makeBlock(type);
|
||||||
|
this.editorBlocks.push(nb);
|
||||||
|
this.$nextTick(() => {
|
||||||
|
document.querySelector(`[data-block-id="${nb.id}"]`)?.focus();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
removeBlock(idx) {
|
||||||
|
if (this.editorBlocks.length > 1) {
|
||||||
|
this.editorBlocks.splice(idx, 1);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
changeType(idx, type) {
|
||||||
|
this.editorBlocks[idx].type = type;
|
||||||
|
},
|
||||||
|
|
||||||
|
focusFirstBlock() {
|
||||||
|
const first = this.editorBlocks[0];
|
||||||
|
if (first) {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
document.querySelector(`[data-block-id="${first.id}"]`)?.focus();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// ── Utilities ─────────────────────────────────────────
|
||||||
|
formatDate(dt) {
|
||||||
|
if (!dt) return '';
|
||||||
|
const d = new Date(dt);
|
||||||
|
const now = new Date();
|
||||||
|
const diff = now - d;
|
||||||
|
|
||||||
|
if (diff < 60000) return 'just now';
|
||||||
|
if (diff < 3600000) return Math.floor(diff / 60000) + 'm ago';
|
||||||
|
if (diff < 86400000) return Math.floor(diff / 3600000) + 'h ago';
|
||||||
|
if (diff < 604800000) return Math.floor(diff / 86400000) + 'd ago';
|
||||||
|
|
||||||
|
return d.toLocaleDateString('en-GB', { day: 'numeric', month: 'short' });
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
@endpush
|
||||||
|
|
||||||
|
@endsection
|
||||||
@@ -33,10 +33,19 @@
|
|||||||
<input type="text" name="content_type" value="{{ old('content_type') }}" class="input-soft"
|
<input type="text" name="content_type" value="{{ old('content_type') }}" class="input-soft"
|
||||||
placeholder="Reel, Story, Feed...">
|
placeholder="Reel, Story, Feed...">
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div x-data="{
|
||||||
|
rawPrice: '{{ old('price', '') }}',
|
||||||
|
get formattedPrice() {
|
||||||
|
if (!this.rawPrice) return '';
|
||||||
|
return parseInt(this.rawPrice).toLocaleString('id-ID');
|
||||||
|
},
|
||||||
|
set formattedPrice(val) {
|
||||||
|
this.rawPrice = val.replace(/\D/g, '');
|
||||||
|
}
|
||||||
|
}">
|
||||||
<label class="block text-sm font-semibold text-gray-700 mb-1">Price <span class="text-pink-400">*</span></label>
|
<label class="block text-sm font-semibold text-gray-700 mb-1">Price <span class="text-pink-400">*</span></label>
|
||||||
<input type="number" name="price" value="{{ old('price') }}" class="input-soft"
|
<input type="hidden" name="price" :value="rawPrice">
|
||||||
min="0" step="100000" required placeholder="0">
|
<input type="text" x-model="formattedPrice" class="input-soft" required placeholder="0">
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label class="block text-sm font-semibold text-gray-700 mb-1">Currency</label>
|
<label class="block text-sm font-semibold text-gray-700 mb-1">Currency</label>
|
||||||
|
|||||||
@@ -33,10 +33,19 @@
|
|||||||
<input type="text" name="content_type" value="{{ old('content_type', $rateCard->content_type) }}"
|
<input type="text" name="content_type" value="{{ old('content_type', $rateCard->content_type) }}"
|
||||||
class="input-soft" placeholder="Reel, Story...">
|
class="input-soft" placeholder="Reel, Story...">
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div x-data="{
|
||||||
|
rawPrice: '{{ old('price', $rateCard->price) }}',
|
||||||
|
get formattedPrice() {
|
||||||
|
if (!this.rawPrice) return '';
|
||||||
|
return parseInt(this.rawPrice).toLocaleString('id-ID');
|
||||||
|
},
|
||||||
|
set formattedPrice(val) {
|
||||||
|
this.rawPrice = val.replace(/\D/g, '');
|
||||||
|
}
|
||||||
|
}">
|
||||||
<label class="block text-sm font-semibold text-gray-700 mb-1">Price</label>
|
<label class="block text-sm font-semibold text-gray-700 mb-1">Price</label>
|
||||||
<input type="number" name="price" value="{{ old('price', $rateCard->price) }}"
|
<input type="hidden" name="price" :value="rawPrice">
|
||||||
class="input-soft" min="0" step="100000">
|
<input type="text" x-model="formattedPrice" class="input-soft" placeholder="0">
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label class="block text-sm font-semibold text-gray-700 mb-1">Currency</label>
|
<label class="block text-sm font-semibold text-gray-700 mb-1">Currency</label>
|
||||||
|
|||||||
@@ -5,30 +5,30 @@
|
|||||||
@section('page-subtitle', 'Manage your service pricing')
|
@section('page-subtitle', 'Manage your service pricing')
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<div class="flex flex-wrap items-center justify-between gap-3 mb-5">
|
<div class="flex flex-wrap items-center justify-between gap-3 mb-5">
|
||||||
<div class="flex flex-wrap items-center gap-2">
|
<div class="flex flex-wrap items-center gap-2 w-full">
|
||||||
|
<a href="{{ route('rate-cards.create') }}" class="btn-sakura text-xs sm:text-sm shrink-0 px-3 py-1.5 sm:px-4 sm:py-2 flex items-center gap-1">+ Add Service</a>
|
||||||
<a href="{{ route('rate-cards.public') }}" target="_blank"
|
<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">
|
class="bg-white text-xs sm:text-sm px-3 py-1.5 sm:px-4 sm:py-2 rounded-full border border-pink-200 text-pink-600 hover:bg-pink-50 flex items-center gap-1 shadow-sm shrink-0">
|
||||||
🔗 Public Page
|
🔗 Public Page
|
||||||
</a>
|
</a>
|
||||||
<a href="{{ route('rate-cards.pdf') }}"
|
<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">
|
class="bg-white text-xs sm:text-sm px-3 py-1.5 sm:px-4 sm:py-2 rounded-full border border-blue-200 text-blue-600 hover:bg-blue-50 flex items-center gap-1 shadow-sm shrink-0">
|
||||||
📄 PDF
|
📄 PDF
|
||||||
</a>
|
</a>
|
||||||
<a href="{{ route('rate-cards.profile') }}"
|
<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">
|
class="bg-white text-xs sm:text-sm px-3 py-1.5 sm:px-4 sm:py-2 rounded-full border border-purple-200 text-purple-600 hover:bg-purple-50 flex items-center gap-1 shadow-sm shrink-0">
|
||||||
🎨 Profile
|
🎨 Profile
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<a href="{{ route('rate-cards.create') }}" class="btn-sakura text-sm shrink-0">+ Add Service</a>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
@php
|
@php
|
||||||
$grouped = $rateCards->groupBy('platform');
|
$grouped = $rateCards->groupBy('platform');
|
||||||
$platformOrder = ['general', 'instagram', 'tiktok', 'youtube'];
|
$platformOrder = ['general', 'instagram', 'tiktok', 'youtube'];
|
||||||
@endphp
|
@endphp
|
||||||
|
|
||||||
@foreach($platformOrder as $platform)
|
@foreach($platformOrder as $platform)
|
||||||
@if($grouped->has($platform))
|
@if($grouped->has($platform))
|
||||||
<div class="mb-6">
|
<div class="mb-6">
|
||||||
<h2 class="text-sm font-bold text-gray-700 mb-3 flex items-center gap-2">
|
<h2 class="text-sm font-bold text-gray-700 mb-3 flex items-center gap-2">
|
||||||
@@ -43,10 +43,12 @@
|
|||||||
<div class="min-w-0">
|
<div class="min-w-0">
|
||||||
<h3 class="font-bold text-gray-800 text-sm leading-tight">{{ $card->service_name }}</h3>
|
<h3 class="font-bold text-gray-800 text-sm leading-tight">{{ $card->service_name }}</h3>
|
||||||
@if($card->content_type)
|
@if($card->content_type)
|
||||||
<span class="text-xs bg-pink-50 text-pink-600 px-2 py-0.5 rounded-full inline-block mt-1">{{ $card->content_type }}</span>
|
<span
|
||||||
|
class="text-xs bg-pink-50 text-pink-600 px-2 py-0.5 rounded-full inline-block mt-1">{{ $card->content_type }}</span>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
<span class="text-xs px-2 py-1 rounded-full shrink-0
|
<span
|
||||||
|
class="text-xs px-2 py-1 rounded-full shrink-0
|
||||||
{{ $card->is_active ? 'bg-green-100 text-green-600' : 'bg-gray-100 text-gray-400' }}">
|
{{ $card->is_active ? 'bg-green-100 text-green-600' : 'bg-gray-100 text-gray-400' }}">
|
||||||
{{ $card->is_active ? 'Active' : 'Hidden' }}
|
{{ $card->is_active ? 'Active' : 'Hidden' }}
|
||||||
</span>
|
</span>
|
||||||
@@ -81,14 +83,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
@endforeach
|
@endforeach
|
||||||
|
|
||||||
@if($rateCards->isEmpty())
|
@if($rateCards->isEmpty())
|
||||||
<div class="text-center py-20 text-gray-400">
|
<div class="text-center py-20 text-gray-400">
|
||||||
<span class="text-5xl block mb-3">💰</span>
|
<span class="text-5xl block mb-3">💰</span>
|
||||||
<p class="text-sm">No rate cards yet.</p>
|
<p class="text-sm">No rate cards yet.</p>
|
||||||
<a href="{{ route('rate-cards.create') }}" class="btn-sakura mt-4 inline-block">Add your first service!</a>
|
<a href="{{ route('rate-cards.create') }}" class="btn-sakura mt-4 inline-block">Add your first service!</a>
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
{{-- Share scripts disabled --}}
|
{{-- Share scripts disabled --}}
|
||||||
@endsection
|
@endsection
|
||||||
@@ -12,83 +12,225 @@
|
|||||||
@endphp
|
@endphp
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>Rate Card — {{ $profile->owner_name }}</title>
|
<title>Rate Card — {{ $profile->owner_name }}</title>
|
||||||
<style>
|
<style>
|
||||||
* { box-sizing: border-box; margin: 0; padding: 0; }
|
* {
|
||||||
|
box-sizing: border-box;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
font-family: 'DejaVu Sans', sans-serif;
|
font-family: 'DejaVu Sans', sans-serif;
|
||||||
background: {{ $bg }};
|
background:
|
||||||
color: {{ $text }};
|
{{ $bg }}
|
||||||
|
;
|
||||||
|
color:
|
||||||
|
{{ $text }}
|
||||||
|
;
|
||||||
padding: 36px 32px;
|
padding: 36px 32px;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.footer {
|
||||||
|
margin-top: 40px;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 11px;
|
||||||
|
color: #D1D5DB;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Quill WYSIWYG Compatibility */
|
||||||
|
.ql-align-center {
|
||||||
|
text-align: center !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ql-align-right {
|
||||||
|
text-align: right !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ql-align-justify {
|
||||||
|
text-align: justify !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ql-size-small {
|
||||||
|
font-size: 0.75em !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ql-size-large {
|
||||||
|
font-size: 1.5em !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ql-size-huge {
|
||||||
|
font-size: 2.5em !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.contact-person-page,
|
||||||
|
.terms-and-conditions-page {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.header {
|
.header {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
margin-bottom: 32px;
|
margin-bottom: 32px;
|
||||||
padding-bottom: 20px;
|
padding-bottom: 20px;
|
||||||
border-bottom: 2px solid {{ $accentHex }};
|
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 }}; }
|
.logo-img {
|
||||||
.tagline { color: #9CA3AF; margin-top: 4px; font-size: 11px; }
|
max-height: 72px;
|
||||||
.contacts { margin-top: 10px; font-size: 10px; color: #6B7280; }
|
max-width: 140px;
|
||||||
.contacts span { margin: 0 6px; }
|
margin: 0 auto 10px;
|
||||||
.platform-section { margin-bottom: 22px; }
|
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 {
|
.platform-title {
|
||||||
font-size: 13px; font-weight: 700;
|
font-size: 13px;
|
||||||
color: {{ $text }};
|
font-weight: 700;
|
||||||
|
color:
|
||||||
|
{{ $text }}
|
||||||
|
;
|
||||||
margin-bottom: 8px;
|
margin-bottom: 8px;
|
||||||
padding: 5px 10px;
|
padding: 5px 10px;
|
||||||
background-color: rgba({{ $accentRgb }}, 0.1);
|
background-color: rgba({{ $accentRgb }}, 0.1);
|
||||||
border-left: 4px solid {{ $accentHex }};
|
border-left: 4px solid
|
||||||
|
{{ $accentHex }}
|
||||||
|
;
|
||||||
}
|
}
|
||||||
table { width: 100%; border-collapse: collapse; }
|
|
||||||
|
table {
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
}
|
||||||
|
|
||||||
th {
|
th {
|
||||||
text-align: left; padding: 7px 10px;
|
text-align: left;
|
||||||
|
padding: 7px 10px;
|
||||||
background-color: rgba({{ $accentRgb }}, 0.08);
|
background-color: rgba({{ $accentRgb }}, 0.08);
|
||||||
color: #6B7280; font-size: 9px;
|
color: #6B7280;
|
||||||
text-transform: uppercase; letter-spacing: 0.05em;
|
font-size: 9px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.05em;
|
||||||
border-bottom: 1px solid rgba({{ $accentRgb }}, 0.25);
|
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; }
|
td {
|
||||||
.service-name { font-weight: 600; color: {{ $text }}; }
|
padding: 8px 10px;
|
||||||
.content-type {
|
border-bottom: 1px solid #F3F4F6;
|
||||||
display: inline-block; font-size: 9px;
|
vertical-align: top;
|
||||||
background-color: rgba({{ $accentRgb }}, 0.1);
|
}
|
||||||
color: {{ $accentHex }};
|
|
||||||
padding: 1px 7px; border-radius: 10px; margin-top: 2px;
|
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;
|
||||||
}
|
}
|
||||||
.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>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="header">
|
<div class="header">
|
||||||
@if($profile->logo_path && file_exists(storage_path('app/private/' . $profile->logo_path)))
|
@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 }}">
|
<img src="{{ storage_path('app/private/' . $profile->logo_path) }}" class="logo-img"
|
||||||
|
alt="{{ $profile->owner_name }}">
|
||||||
@endif
|
@endif
|
||||||
<div class="name">{{ $profile->owner_name }}</div>
|
<div class="name">{{ $profile->owner_name }}</div>
|
||||||
@if($profile->tagline)
|
@if($profile->tagline)
|
||||||
<div class="tagline">{{ $profile->tagline }}</div>
|
<div class="tagline">{{ $profile->tagline }}</div>
|
||||||
@endif
|
@endif
|
||||||
<div class="contacts">
|
<div class="contacts">
|
||||||
@if($profile->email)<span>✉ {{ $profile->email }}</span>@endif
|
@if($profile->ig_handle)<span>· {{ '@' . ltrim($profile->ig_handle, '@') }}</span>@endif
|
||||||
@if($profile->whatsapp)<span>· {{ $profile->whatsapp }}</span>@endif
|
@if($profile->tiktok_handle)<span>· {{ '@' . ltrim($profile->tiktok_handle, '@') }}</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
|
@if($profile->youtube_handle)<span>· {{ $profile->youtube_handle }}</span>@endif
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@foreach($rateCards as $platform => $cards)
|
@foreach($rateCards as $platform => $cards)
|
||||||
<div class="platform-section">
|
<div class="platform-section">
|
||||||
<div class="platform-title">
|
<div class="platform-title">
|
||||||
@php $icons = ['instagram' => 'Instagram', 'tiktok' => 'TikTok', 'youtube' => 'YouTube', 'general' => 'General']; @endphp
|
@php $icons = ['instagram' => 'Instagram', 'tiktok' => 'TikTok', 'youtube' => 'YouTube', 'general' => 'General']; @endphp
|
||||||
{{ $icons[$platform] ?? ucfirst($platform) }}
|
{{ $icons[$platform] ?? ucfirst($platform) }}
|
||||||
@@ -130,13 +272,132 @@
|
|||||||
@endforeach
|
@endforeach
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
@endforeach
|
</div>
|
||||||
|
@endforeach
|
||||||
|
|
||||||
<div class="footer">
|
@if(!empty($profile->past_brands))
|
||||||
|
@php
|
||||||
|
$logoSizesPdf = [
|
||||||
|
'small' => 'max-height:30px; max-width:60px;',
|
||||||
|
'medium' => 'max-height:45px; max-width:90px;',
|
||||||
|
'large' => 'max-height:65px; max-width:130px;',
|
||||||
|
];
|
||||||
|
$sizeStylePdf = $logoSizesPdf[$profile->brand_logo_size ?? 'medium'] ?? $logoSizesPdf['medium'];
|
||||||
|
@endphp
|
||||||
|
<div style="page-break-before: always;"></div>
|
||||||
|
<div class="platform-section" style="margin-top:20px; page-break-inside:avoid;">
|
||||||
|
<div class="platform-title" style="text-align:center;">Brand Collaborations</div>
|
||||||
|
<div style="text-align:center; padding-top:10px;">
|
||||||
|
@foreach($profile->past_brands as $brandPath)
|
||||||
|
@if(file_exists(storage_path('app/public/' . $brandPath)))
|
||||||
|
<img src="{{ storage_path('app/public/' . $brandPath) }}"
|
||||||
|
style="{{ $sizeStylePdf }} object-fit:contain; margin:0 10px; display:inline-block; vertical-align:middle;">
|
||||||
|
@endif
|
||||||
|
@endforeach
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
@php
|
||||||
|
$pdfShowcase = array_filter($profile->content_showcase ?? [], function($item) {
|
||||||
|
return !isset($item['show_on_pdf']) || $item['show_on_pdf'];
|
||||||
|
});
|
||||||
|
@endphp
|
||||||
|
@if(!empty($pdfShowcase))
|
||||||
|
<div style="page-break-before: always;"></div>
|
||||||
|
<div class="platform-section" style="margin-top:20px; page-break-inside:avoid;">
|
||||||
|
<div class="platform-title" style="text-align:center;">Content Showcase</div>
|
||||||
|
<div style="text-align:center; padding-top:10px;">
|
||||||
|
@foreach($pdfShowcase as $item)
|
||||||
|
@php
|
||||||
|
$isUrl = ($item['file_id'] === 'url');
|
||||||
|
$file = !$isUrl ? \App\Models\MediaFile::find($item['file_id']) : null;
|
||||||
|
@endphp
|
||||||
|
@if($file || $isUrl)
|
||||||
|
<div style="display:inline-block; width:135px; margin:10px; border:1px solid rgba(0,0,0,0.1); border-radius:8px; overflow:hidden; vertical-align:top; background:#ffffff;">
|
||||||
|
<div style="height:240px; background:#F9FAFB; border-bottom:1px solid rgba(0,0,0,0.05); position:relative; text-align:center;">
|
||||||
|
@if(!empty($item['thumbnail_path']) && file_exists(storage_path('app/public/' . $item['thumbnail_path'])))
|
||||||
|
<a href="{{ $isUrl ? $item['url'] : $file->url }}" target="_blank" style="display:block; text-decoration:none; position:relative;">
|
||||||
|
<div style="width:100%; height:240px; background-image:url('{{ storage_path('app/public/' . $item['thumbnail_path']) }}'); background-size:cover; background-position:center; background-repeat:no-repeat;"></div>
|
||||||
|
@if(!$isUrl && $file->is_video)
|
||||||
|
<div style="position:absolute; inset:0; display:flex; align-items:center; justify-content:center; background:rgba(0,0,0,0.2);">
|
||||||
|
<div style="width:30px; height:30px; background:rgba(255,255,255,0.8); border-radius:50%; text-align:center; line-height:30px; color:{{ $accentHex }}; font-size:16px;">▶</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
</a>
|
||||||
|
@elseif(!$isUrl && $file->is_image && file_exists(storage_path('app/private/' . $file->path)))
|
||||||
|
<a href="{{ $file->url }}" target="_blank" style="display:block; text-decoration:none;">
|
||||||
|
<div style="width:100%; height:240px; background-image:url('{{ storage_path('app/private/' . $file->path) }}'); background-size:cover; background-position:center; background-repeat:no-repeat;"></div>
|
||||||
|
</a>
|
||||||
|
@else
|
||||||
|
<a href="{{ $isUrl ? $item['url'] : $file->url }}" target="_blank" style="display:block; text-decoration:none; color:{{ $accentHex }}; padding-top:90px; font-weight:bold;">
|
||||||
|
<span style="font-size:30px; display:block;">{{ $isUrl ? '🌐' : ($file->is_video ? '🎬' : '📁') }}</span>
|
||||||
|
{{ $isUrl ? 'Open Link' : 'View File' }}
|
||||||
|
</a>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
<div style="padding:10px; text-align:center;">
|
||||||
|
<div style="font-weight:700; font-size:11px;">{{ $item['name'] }}</div>
|
||||||
|
<div style="font-size:9px; color:#9CA3AF; margin-top:4px;">
|
||||||
|
{{ $isUrl ? 'External Link' : ($file->is_video ? 'Video' : ($file->is_image ? 'Image' : 'Document')) }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
@endforeach
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
@if($profile->terms_and_conditions)
|
||||||
|
<div style="page-break-before: always;"></div>
|
||||||
|
<div class="platform-section" style="margin-top:20px; page-break-inside:avoid;">
|
||||||
|
<div class="platform-title">Terms & Conditions</div>
|
||||||
|
<div style="font-size:10px; color:#6B7280; line-height:1.5; padding:0 10px;">
|
||||||
|
{!! $profile->terms_and_conditions !!}</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<div style="page-break-before: always;"></div>
|
||||||
|
@if($profile->contact_person_html)
|
||||||
|
<div class="contact-person-page">
|
||||||
|
{!! $profile->contact_person_html !!}
|
||||||
|
</div>
|
||||||
|
@else
|
||||||
|
<div style="text-align: center; margin-top: 40px;">
|
||||||
|
<h1
|
||||||
|
style="font-family: 'Comic Sans MS', sans-serif; font-size: 32px; font-weight: 900; letter-spacing: 4px; color: #111827; margin-bottom: 30px; text-transform: uppercase;">
|
||||||
|
CONTACT PERSON</h1>
|
||||||
|
@if($profile->whatsapp)
|
||||||
|
<div
|
||||||
|
style="font-family: 'Comic Sans MS', sans-serif; font-size: 36px; font-weight: 900; color: #14b8a6; margin-bottom: 5px;">
|
||||||
|
{{ $profile->whatsapp }}</div>
|
||||||
|
<div
|
||||||
|
style="font-family: 'Comic Sans MS', sans-serif; font-size: 20px; font-weight: 800; color: #14b8a6; margin-bottom: 30px; letter-spacing: 2px;">
|
||||||
|
(WHATS APP)</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
@if($profile->email)
|
||||||
|
<div
|
||||||
|
style="font-family: 'Comic Sans MS', sans-serif; font-size: 14px; font-weight: 800; color: #f97316; margin-bottom: 10px; letter-spacing: 2px;">
|
||||||
|
EMAIL</div>
|
||||||
|
<div
|
||||||
|
style="font-family: 'Comic Sans MS', sans-serif; font-size: 32px; font-weight: 900; color: #ef4444; margin-bottom: 40px; letter-spacing: 2px;">
|
||||||
|
{{ strtoupper($profile->email) }}</div>
|
||||||
|
@endif
|
||||||
|
<div
|
||||||
|
style="font-size: 11px; font-weight: 900; color: #111827; line-height: 1.5; max-width: 80%; margin: 0 auto; text-transform: uppercase;">
|
||||||
|
Kami tidak bertanggung jawab atas segala bentuk kerjasama yg timbul dengan pihak selain dari kontak diatas
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<div class="footer">
|
||||||
{{ $profile->custom_footer ?: 'Prices may vary. Contact for custom packages.' }}
|
{{ $profile->custom_footer ?: 'Prices may vary. Contact for custom packages.' }}
|
||||||
· Generated {{ now()->format('d M Y') }}
|
· Generated {{ now()->format('d M Y') }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
@@ -4,7 +4,9 @@
|
|||||||
@section('page-subtitle', 'Customise your public rate card page')
|
@section('page-subtitle', 'Customise your public rate card page')
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<div class="max-w-3xl mx-auto space-y-5">
|
<link href="https://cdn.quilljs.com/1.3.6/quill.snow.css" rel="stylesheet">
|
||||||
|
<script src="https://cdn.quilljs.com/1.3.6/quill.min.js"></script>
|
||||||
|
<div class="max-w-3xl mx-auto space-y-5">
|
||||||
|
|
||||||
@if(session('success'))
|
@if(session('success'))
|
||||||
<div x-data="{ show: true }" x-show="show" x-init="setTimeout(() => show = false, 4000)"
|
<div x-data="{ show: true }" x-show="show" x-init="setTimeout(() => show = false, 4000)"
|
||||||
@@ -26,52 +28,50 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="p-5 grid grid-cols-1 sm:grid-cols-2 gap-4">
|
<div class="p-5 grid grid-cols-1 sm:grid-cols-2 gap-4">
|
||||||
<div>
|
<div>
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Display Name <span class="text-pink-400">*</span></label>
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Display Name <span
|
||||||
<input type="text" name="owner_name" required
|
class="text-pink-400">*</span></label>
|
||||||
value="{{ old('owner_name', $profile->owner_name) }}"
|
<input type="text" name="owner_name" required value="{{ old('owner_name', $profile->owner_name) }}"
|
||||||
class="input-soft" placeholder="e.g. Sakura KOL">
|
class="input-soft" placeholder="e.g. Sakura KOL">
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Tagline</label>
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Tagline</label>
|
||||||
<input type="text" name="tagline"
|
<input type="text" name="tagline" value="{{ old('tagline', $profile->tagline) }}" class="input-soft"
|
||||||
value="{{ old('tagline', $profile->tagline) }}"
|
placeholder="e.g. Lifestyle & Beauty Creator">
|
||||||
class="input-soft" placeholder="e.g. Lifestyle & Beauty Creator">
|
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Email</label>
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Email</label>
|
||||||
<input type="email" name="email"
|
<input type="email" name="email" value="{{ old('email', $profile->email) }}" class="input-soft"
|
||||||
value="{{ old('email', $profile->email) }}"
|
placeholder="hi@example.com">
|
||||||
class="input-soft" placeholder="hi@example.com">
|
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">WhatsApp Number</label>
|
<label class="block text-xs font-semibold text-gray-600 mb-1">WhatsApp Number</label>
|
||||||
<input type="text" name="whatsapp"
|
<input type="text" name="whatsapp" value="{{ old('whatsapp', $profile->whatsapp) }}"
|
||||||
value="{{ old('whatsapp', $profile->whatsapp) }}"
|
|
||||||
class="input-soft" placeholder="+6012-345-6789">
|
class="input-soft" placeholder="+6012-345-6789">
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Instagram Handle</label>
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Instagram Handle</label>
|
||||||
<div class="relative">
|
<div class="relative">
|
||||||
<span class="absolute left-3 top-1/2 -translate-y-1/2 text-gray-400 text-sm pointer-events-none">@</span>
|
<span
|
||||||
<input type="text" name="ig_handle"
|
class="absolute left-3 top-1/2 -translate-y-1/2 text-gray-400 text-sm pointer-events-none"></span>
|
||||||
value="{{ old('ig_handle', $profile->ig_handle) }}"
|
<input type="text" name="ig_handle" value="{{ old('ig_handle', $profile->ig_handle) }}"
|
||||||
class="input-soft pl-7" placeholder="yourhandle">
|
class="input-soft pl-7" placeholder="@yourhandle">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">TikTok Handle</label>
|
<label class="block text-xs font-semibold text-gray-600 mb-1">TikTok Handle</label>
|
||||||
<div class="relative">
|
<div class="relative">
|
||||||
<span class="absolute left-3 top-1/2 -translate-y-1/2 text-gray-400 text-sm pointer-events-none">@</span>
|
<span
|
||||||
|
class="absolute left-3 top-1/2 -translate-y-1/2 text-gray-400 text-sm pointer-events-none"></span>
|
||||||
<input type="text" name="tiktok_handle"
|
<input type="text" name="tiktok_handle"
|
||||||
value="{{ old('tiktok_handle', $profile->tiktok_handle) }}"
|
value="{{ old('tiktok_handle', $profile->tiktok_handle) }}" class="input-soft pl-7"
|
||||||
class="input-soft pl-7" placeholder="yourhandle">
|
placeholder="@yourhandle">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="sm:col-span-2">
|
<div class="sm:col-span-2">
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">YouTube Handle / Channel</label>
|
<label class="block text-xs font-semibold text-gray-600 mb-1">YouTube Handle / Channel</label>
|
||||||
<input type="text" name="youtube_handle"
|
<input type="text" name="youtube_handle"
|
||||||
value="{{ old('youtube_handle', $profile->youtube_handle) }}"
|
value="{{ old('youtube_handle', $profile->youtube_handle) }}" class="input-soft"
|
||||||
class="input-soft" placeholder="@yourchannel">
|
placeholder="@yourchannel">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -83,21 +83,79 @@
|
|||||||
<h2 class="font-bold text-gray-700">Appearance</h2>
|
<h2 class="font-bold text-gray-700">Appearance</h2>
|
||||||
</div>
|
</div>
|
||||||
<div class="p-5 grid grid-cols-1 sm:grid-cols-2 gap-4">
|
<div class="p-5 grid grid-cols-1 sm:grid-cols-2 gap-4">
|
||||||
<div class="sm:col-span-2">
|
<div class="sm:col-span-2" x-data="{
|
||||||
|
uploading: false,
|
||||||
|
errorMsg: '',
|
||||||
|
logoUrl: '{{ $profile->logo_path ? route('files.serve-profile-logo') : '' }}',
|
||||||
|
|
||||||
|
async pickFile(input) {
|
||||||
|
if (!input.files.length) return;
|
||||||
|
this.uploading = true;
|
||||||
|
this.errorMsg = '';
|
||||||
|
const fd = new FormData();
|
||||||
|
fd.append('logo', input.files[0]);
|
||||||
|
fd.append('_token', document.querySelector('meta[name=csrf-token]').content);
|
||||||
|
try {
|
||||||
|
const res = await fetch('{{ route('rate-cards.profile.upload-logo', [], false) }}', {
|
||||||
|
method: 'POST',
|
||||||
|
body: fd,
|
||||||
|
headers: {
|
||||||
|
'Accept': 'application/json'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const data = await res.json();
|
||||||
|
if (res.ok) {
|
||||||
|
this.logoUrl = data.url + '?t=' + Date.now();
|
||||||
|
} else {
|
||||||
|
this.errorMsg = data.message ?? 'Upload failed.';
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err);
|
||||||
|
this.errorMsg = 'Network error. Please try again.';
|
||||||
|
}
|
||||||
|
this.uploading = false;
|
||||||
|
input.value = '';
|
||||||
|
},
|
||||||
|
|
||||||
|
async removeLogo() {
|
||||||
|
if (!confirm('Remove this logo?')) return;
|
||||||
|
const fd = new FormData();
|
||||||
|
fd.append('_token', document.querySelector('meta[name=csrf-token]').content);
|
||||||
|
fd.append('_method', 'DELETE');
|
||||||
|
await fetch('{{ route('rate-cards.profile.delete-logo', [], false) }}', {
|
||||||
|
method: 'POST',
|
||||||
|
body: fd,
|
||||||
|
headers: { 'Accept': 'application/json' }
|
||||||
|
});
|
||||||
|
this.logoUrl = '';
|
||||||
|
}
|
||||||
|
}">
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Logo / Profile Image</label>
|
<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">
|
<template x-if="logoUrl">
|
||||||
<img src="{{ route('files.serve-profile-logo') }}" alt="Logo"
|
<div class="flex items-center gap-3 mb-3">
|
||||||
class="w-16 h-16 object-cover rounded-2xl border border-pink-100">
|
<img :src="logoUrl" alt="Logo"
|
||||||
<span class="text-xs text-gray-400">Current logo</span>
|
class="w-16 h-16 object-cover rounded-2xl border border-pink-100 shrink-0">
|
||||||
|
<div class="flex-1 min-w-0">
|
||||||
|
<p class="text-xs font-semibold text-gray-600">Current Logo</p>
|
||||||
|
<p class="text-xs text-gray-400 mt-0.5">Choose a new file to replace it</p>
|
||||||
</div>
|
</div>
|
||||||
@endif
|
<button type="button" @click="removeLogo()"
|
||||||
<input type="file" name="logo" accept="image/*"
|
class="text-xs px-3 py-1.5 rounded-full border border-red-200 text-red-400 hover:bg-red-50 shrink-0">
|
||||||
class="w-full text-sm text-gray-600
|
🗑️ Remove
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<div class="relative">
|
||||||
|
<input type="file" accept="image/*" @change="pickFile($event.target)" class="w-full text-sm text-gray-600
|
||||||
file:mr-3 file:py-2 file:px-4 file:rounded-full file:border-0
|
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
|
file:text-xs file:font-semibold file:bg-pink-50 file:text-pink-600
|
||||||
hover:file:bg-pink-100 cursor-pointer">
|
hover:file:bg-pink-100 cursor-pointer" :disabled="uploading">
|
||||||
<p class="text-xs text-gray-400 mt-1">Max 2MB. PNG/JPG/WebP.</p>
|
<span x-show="uploading" class="text-xs text-pink-500 mt-1 block">Uploading…</span>
|
||||||
|
<span x-show="errorMsg" x-text="errorMsg" class="text-xs text-red-500 mt-1 block"></span>
|
||||||
|
</div>
|
||||||
|
<p class="text-xs text-gray-400 mt-1">Max 2MB. Uploads immediately on file selection.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
@@ -113,7 +171,8 @@
|
|||||||
<div>
|
<div>
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Accent Color</label>
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Accent Color</label>
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex items-center gap-2">
|
||||||
<input type="color" name="accent_color" value="{{ old('accent_color', $profile->accent_color) }}"
|
<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"
|
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">
|
oninput="document.getElementById('accent_text').value=this.value">
|
||||||
<input type="text" id="accent_text" value="{{ old('accent_color', $profile->accent_color) }}"
|
<input type="text" id="accent_text" value="{{ old('accent_color', $profile->accent_color) }}"
|
||||||
@@ -130,18 +189,90 @@
|
|||||||
class="input-soft text-sm flex-1" readonly>
|
class="input-soft text-sm flex-1" readonly>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div class="sm:col-span-2" x-data="{
|
||||||
|
init() {
|
||||||
|
var quill = new Quill(this.$refs.editor, {
|
||||||
|
theme: 'snow',
|
||||||
|
placeholder: 'e.g. 1. 50% down payment required. 2. Rates valid for 30 days.',
|
||||||
|
modules: {
|
||||||
|
toolbar: [
|
||||||
|
[{ 'size': ['small', false, 'large', 'huge'] }],
|
||||||
|
['bold', 'italic', 'underline', 'strike'],
|
||||||
|
[{ 'color': [] }, { 'background': [] }],
|
||||||
|
[{ 'list': 'ordered'}, { 'list': 'bullet' }],
|
||||||
|
['clean']
|
||||||
|
]
|
||||||
|
}
|
||||||
|
});
|
||||||
|
quill.on('text-change', () => {
|
||||||
|
this.$refs.input.value = quill.root.innerHTML;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}">
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Terms & Conditions</label>
|
||||||
|
<input type="hidden" name="terms_and_conditions" x-ref="input"
|
||||||
|
value="{{ old('terms_and_conditions', $profile->terms_and_conditions) }}">
|
||||||
|
<div class="bg-white rounded-lg border border-pink-200">
|
||||||
|
<div x-ref="editor" style="min-height: 120px;">
|
||||||
|
{!! old('terms_and_conditions', $profile->terms_and_conditions) !!}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="sm:col-span-2" x-data="{
|
||||||
|
init() {
|
||||||
|
var quill = new Quill(this.$refs.editor, {
|
||||||
|
theme: 'snow',
|
||||||
|
placeholder: 'Customize your Contact Person Page formatting...',
|
||||||
|
modules: {
|
||||||
|
toolbar: [
|
||||||
|
[{ 'size': ['small', false, 'large', 'huge'] }],
|
||||||
|
['bold', 'italic', 'underline', 'strike'],
|
||||||
|
[{ 'color': [] }, { 'background': [] }],
|
||||||
|
[{ 'align': [] }],
|
||||||
|
['clean']
|
||||||
|
]
|
||||||
|
}
|
||||||
|
});
|
||||||
|
quill.on('text-change', () => {
|
||||||
|
this.$refs.input.value = quill.root.innerHTML;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}">
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Contact Person Page (PDF)</label>
|
||||||
|
@php
|
||||||
|
$defaultContactHtml = '<div style="text-align: center; margin-top: 40px;">
|
||||||
|
<h1 style="font-family: \'Comic Sans MS\', sans-serif; font-size: 32px; font-weight: 900; letter-spacing: 4px; color: #111827; margin-bottom: 30px; text-transform: uppercase;">CONTACT PERSON</h1>';
|
||||||
|
if ($profile->whatsapp) {
|
||||||
|
$defaultContactHtml .= '<div style="font-family: \'Comic Sans MS\', sans-serif; font-size: 36px; font-weight: 900; color: #14b8a6; margin-bottom: 5px;">' . $profile->whatsapp . '</div>
|
||||||
|
<div style="font-family: \'Comic Sans MS\', sans-serif; font-size: 20px; font-weight: 800; color: #14b8a6; margin-bottom: 30px; letter-spacing: 2px;">(WHATS APP)</div>';
|
||||||
|
}
|
||||||
|
if ($profile->email) {
|
||||||
|
$defaultContactHtml .= '<div style="font-family: \'Comic Sans MS\', sans-serif; font-size: 14px; font-weight: 800; color: #f97316; margin-bottom: 10px; letter-spacing: 2px;">EMAIL</div>
|
||||||
|
<div style="font-family: \'Comic Sans MS\', sans-serif; font-size: 32px; font-weight: 900; color: #ef4444; margin-bottom: 40px; letter-spacing: 2px;">' . strtoupper($profile->email) . '</div>';
|
||||||
|
}
|
||||||
|
$defaultContactHtml .= '<div style="font-size: 11px; font-weight: 900; color: #111827; line-height: 1.5; max-width: 80%; margin: 0 auto; text-transform: uppercase;">
|
||||||
|
Kami tidak bertanggung jawab atas segala bentuk kerjasama yg timbul dengan pihak selain dari kontak diatas
|
||||||
|
</div>
|
||||||
|
</div>';
|
||||||
|
@endphp
|
||||||
|
<input type="hidden" name="contact_person_html" x-ref="input"
|
||||||
|
value="{{ old('contact_person_html', $profile->contact_person_html) }}">
|
||||||
|
<div class="bg-white rounded-lg border border-pink-200">
|
||||||
|
<div x-ref="editor" style="min-height: 120px;">
|
||||||
|
{!! old('contact_person_html', $profile->contact_person_html ?: $defaultContactHtml) !!}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="sm:col-span-2">
|
||||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Custom Footer</label>
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Custom Footer</label>
|
||||||
<input type="text" name="custom_footer"
|
<input type="text" name="custom_footer" value="{{ old('custom_footer', $profile->custom_footer) }}"
|
||||||
value="{{ old('custom_footer', $profile->custom_footer) }}"
|
class="input-soft" placeholder="e.g. Prices valid until Dec 2025 · DM for bundles">
|
||||||
class="input-soft"
|
|
||||||
placeholder="e.g. Prices valid until Dec 2025 · DM for bundles">
|
|
||||||
</div>
|
</div>
|
||||||
<div class="sm:col-span-2">
|
<div class="sm:col-span-2">
|
||||||
<label class="flex items-start gap-3 cursor-pointer">
|
<label class="flex items-start gap-3 cursor-pointer">
|
||||||
<input type="checkbox" name="show_prices" value="1"
|
<input type="checkbox" name="show_prices" value="1"
|
||||||
class="w-4 h-4 accent-pink-400 mt-0.5 shrink-0"
|
class="w-4 h-4 accent-pink-400 mt-0.5 shrink-0" {{ old('show_prices', $profile->show_prices) ? 'checked' : '' }}>
|
||||||
{{ old('show_prices', $profile->show_prices) ? 'checked' : '' }}>
|
|
||||||
<div>
|
<div>
|
||||||
<span class="text-sm font-medium text-gray-700">Show prices publicly</span>
|
<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>
|
<p class="text-xs text-gray-400">Uncheck to show "On Request" instead of actual prices</p>
|
||||||
@@ -151,22 +282,232 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{{-- Past Brands --}}
|
||||||
|
<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">Brand Collaborations Logo</h2>
|
||||||
|
</div>
|
||||||
|
<div class="p-5" x-data="{
|
||||||
|
uploading: false,
|
||||||
|
brands: {{ Illuminate\Support\Js::from($profile->past_brands ?? []) }},
|
||||||
|
async pickBrand(input) {
|
||||||
|
if (!input.files.length) return;
|
||||||
|
this.uploading = true;
|
||||||
|
const fd = new FormData();
|
||||||
|
for (let i = 0; i < input.files.length; i++) {
|
||||||
|
fd.set('logo', input.files[i]);
|
||||||
|
fd.set('_token', document.querySelector('meta[name=csrf-token]').content);
|
||||||
|
try {
|
||||||
|
const res = await fetch('{{ route('rate-cards.profile.upload-brand-logo', [], false) }}', { method: 'POST', body: fd, headers: { 'Accept': 'application/json' } });
|
||||||
|
const data = await res.json();
|
||||||
|
if (res.ok) this.brands.push(data.path);
|
||||||
|
} catch (e) { console.error(e); }
|
||||||
|
}
|
||||||
|
this.uploading = false;
|
||||||
|
input.value = '';
|
||||||
|
},
|
||||||
|
async removeBrand(path, index) {
|
||||||
|
if(!confirm('Remove this brand?')) return;
|
||||||
|
const fd = new FormData();
|
||||||
|
fd.append('_token', document.querySelector('meta[name=csrf-token]').content);
|
||||||
|
fd.append('_method', 'DELETE');
|
||||||
|
fd.append('path', path);
|
||||||
|
await fetch('{{ route('rate-cards.profile.delete-brand-logo', [], false) }}', { method: 'POST', body: fd, headers: {'Accept': 'application/json'} });
|
||||||
|
this.brands.splice(index, 1);
|
||||||
|
}
|
||||||
|
}">
|
||||||
|
<div class="flex items-center justify-between mb-2">
|
||||||
|
<label class="block text-xs font-semibold text-gray-600">Brand Logos</label>
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<span class="text-[10px] text-gray-500 uppercase tracking-widest font-semibold">Display Size on
|
||||||
|
PDF:</span>
|
||||||
|
<select name="brand_logo_size"
|
||||||
|
class="text-xs border-pink-200 rounded-md py-1 pr-8 pl-2 focus:ring-pink-500 focus:border-pink-500 bg-white">
|
||||||
|
<option value="small" {{ old('brand_logo_size', $profile->brand_logo_size ?? 'medium') == 'small' ? 'selected' : '' }}>Small</option>
|
||||||
|
<option value="medium" {{ old('brand_logo_size', $profile->brand_logo_size ?? 'medium') == 'medium' ? 'selected' : '' }}>Medium</option>
|
||||||
|
<option value="large" {{ old('brand_logo_size', $profile->brand_logo_size ?? 'medium') == 'large' ? 'selected' : '' }}>Large</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="flex flex-wrap gap-4 mb-3">
|
||||||
|
<template x-for="(path, index) in brands" :key="index">
|
||||||
|
<div class="relative rounded-2xl border border-pink-100 p-2 flex items-center justify-center bg-white group shrink-0"
|
||||||
|
style="width: 100px; height: 100px;">
|
||||||
|
<img :src="'/storage/' + path" class="max-w-full max-h-full object-contain">
|
||||||
|
<button type="button" @click="removeBrand(path, index)"
|
||||||
|
class="absolute -bottom-2 -right-2 bg-red-100 text-red-500 rounded-full w-6 h-6 flex items-center justify-center hover:bg-red-200 shadow text-[10px] z-10 transition-colors">🗑️</button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<label
|
||||||
|
class="rounded-2xl border-2 border-dashed border-pink-200 flex items-center justify-center text-pink-300 hover:bg-pink-50 hover:text-pink-400 cursor-pointer transition-colors shrink-0"
|
||||||
|
style="width: 100px; height: 100px;" :class="{'opacity-50 pointer-events-none': uploading}">
|
||||||
|
<span x-show="!uploading" class="text-2xl">+</span>
|
||||||
|
<span x-show="uploading" class="text-xs">...</span>
|
||||||
|
<input type="file" multiple accept="image/*" class="hidden" @change="pickBrand($event.target)">
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<p class="text-xs text-gray-400 mt-1">Upload brand logos you've worked with. They will be displayed on
|
||||||
|
your rate
|
||||||
|
cards.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Content Showcase --}}
|
||||||
|
<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">Content Showcase</h2>
|
||||||
|
</div>
|
||||||
|
<div class="p-5" x-data="{
|
||||||
|
items: {{ Illuminate\Support\Js::from(old('content_showcase', $profile->content_showcase ?? [])) }}.map(i => ({ file_id: i.file_id || '', name: i.name || '', url: i.url || '', thumbnail_path: i.thumbnail_path || '', show_on_public: i.show_on_public ?? true, show_on_pdf: i.show_on_pdf ?? true, uploading: false })),
|
||||||
|
addItem() {
|
||||||
|
this.items.push({ file_id: '', name: '', url: '', thumbnail_path: '', show_on_public: true, show_on_pdf: true, uploading: false });
|
||||||
|
},
|
||||||
|
removeItem(index) {
|
||||||
|
this.items.splice(index, 1);
|
||||||
|
},
|
||||||
|
async uploadThumb(input, item) {
|
||||||
|
if (!input.files.length) return;
|
||||||
|
item.uploading = true;
|
||||||
|
const fd = new FormData();
|
||||||
|
fd.append('thumbnail', input.files[0]);
|
||||||
|
fd.append('_token', document.querySelector('meta[name=csrf-token]').content);
|
||||||
|
try {
|
||||||
|
const res = await fetch('{{ route('rate-cards.profile.upload-showcase-thumbnail', [], false) }}', { method: 'POST', body: fd, headers: { 'Accept': 'application/json' } });
|
||||||
|
const data = await res.json();
|
||||||
|
if (res.ok) {
|
||||||
|
item.thumbnail_path = data.path;
|
||||||
|
} else {
|
||||||
|
alert(data.message || 'Upload failed');
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
alert('Network Error. Please try again.');
|
||||||
|
}
|
||||||
|
item.uploading = false;
|
||||||
|
input.value = '';
|
||||||
|
}
|
||||||
|
}">
|
||||||
|
|
||||||
|
<template x-for="(item, index) in items" :key="index">
|
||||||
|
<div class="flex flex-col gap-3 mb-4 bg-pink-50/30 p-3 rounded-2xl border border-pink-100 relative">
|
||||||
|
<div class="flex flex-col sm:flex-row gap-3 items-start w-full">
|
||||||
|
<div class="flex-1 w-full">
|
||||||
|
<label class="block text-[10px] font-semibold text-gray-600 mb-1">Select File <span
|
||||||
|
class="text-pink-400">*</span></label>
|
||||||
|
<select :name="'content_showcase['+index+'][file_id]'" x-model="item.file_id" required
|
||||||
|
class="input-soft w-full py-1.5 text-xs">
|
||||||
|
<option value="">-- Choose a File --</option>
|
||||||
|
<option value="url" class="font-bold text-pink-600">+ External Link</option>
|
||||||
|
@foreach($mediaFiles as $file)
|
||||||
|
<option value="{{ $file->id }}">{{ $file->name }}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="flex-1 w-full">
|
||||||
|
<label class="block text-[10px] font-semibold text-gray-600 mb-1">Custom Display Name
|
||||||
|
<span class="text-pink-400">*</span></label>
|
||||||
|
<input type="text" :name="'content_showcase['+index+'][name]'" x-model="item.name"
|
||||||
|
required class="input-soft w-full py-1.5 text-xs" placeholder="e.g. Viral Vlog">
|
||||||
|
</div>
|
||||||
|
<div class="shrink-0 flex items-end pt-5">
|
||||||
|
<button type="button" @click="removeItem(index)"
|
||||||
|
class="bg-red-100 text-red-500 rounded-lg px-3 py-1.5 hover:bg-red-200 transition-colors text-[10px] font-semibold">
|
||||||
|
Remove
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<template x-if="item.file_id">
|
||||||
|
<div class="w-full">
|
||||||
|
<div class="w-full border-t border-pink-100 pt-3 flex flex-wrap gap-3 items-center">
|
||||||
|
<div class="shrink-0 flex items-center justify-center">
|
||||||
|
<input type="hidden" :name="'content_showcase['+index+'][thumbnail_path]'"
|
||||||
|
x-model="item.thumbnail_path">
|
||||||
|
|
||||||
|
<template x-if="item.thumbnail_path">
|
||||||
|
<div class="relative rounded-xl border border-pink-100 p-1 flex items-center justify-center bg-white group shrink-0"
|
||||||
|
style="width: 54px; height: 54px;">
|
||||||
|
<img :src="'/storage/' + item.thumbnail_path"
|
||||||
|
class="max-w-full max-h-full object-contain rounded">
|
||||||
|
<button type="button" @click="item.thumbnail_path = ''"
|
||||||
|
class="absolute -top-2 -right-2 bg-red-100 text-red-500 rounded-full w-5 h-5 flex items-center justify-center hover:bg-red-200 shadow text-[9px] z-10 transition-colors">🗑️</button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template x-if="!item.thumbnail_path">
|
||||||
|
<label
|
||||||
|
class="rounded-xl border-2 border-dashed border-pink-200 flex items-center justify-center text-pink-300 hover:bg-pink-50 hover:text-pink-400 cursor-pointer transition-colors shrink-0"
|
||||||
|
style="width: 54px; height: 54px;"
|
||||||
|
:class="{'opacity-50 pointer-events-none': item.uploading}"
|
||||||
|
title="Upload Thumbnail (Optional)">
|
||||||
|
<span x-show="!item.uploading"
|
||||||
|
class="text-xl font-light leading-none mb-1">+</span>
|
||||||
|
<span x-show="item.uploading" class="text-[10px]">...</span>
|
||||||
|
<input type="file" accept="image/*" class="hidden"
|
||||||
|
@change="uploadThumb($event.target, item)">
|
||||||
|
</label>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<template x-if="item.file_id === 'url'">
|
||||||
|
<div class="flex-1 min-w-[200px]">
|
||||||
|
<input type="url" :name="'content_showcase['+index+'][url]'" x-model="item.url"
|
||||||
|
class="input-soft w-full py-2 px-3 text-xs"
|
||||||
|
placeholder="URL (https://instagram.com/p/...)" required>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template x-if="item.file_id !== 'url'">
|
||||||
|
<div class="flex-1 text-xs text-gray-400">
|
||||||
|
Uploaded Thumbnail: Use this to override the default display icon for videos and documents.
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
<div class="w-full border-t border-pink-100 pt-3 flex flex-wrap gap-4 items-center mt-2">
|
||||||
|
<label class="flex items-center gap-2 cursor-pointer text-[11px] font-semibold text-gray-600">
|
||||||
|
<input type="hidden" :name="'content_showcase['+index+'][show_on_public]'" value="0">
|
||||||
|
<input type="checkbox" :name="'content_showcase['+index+'][show_on_public]'" value="1" x-model="item.show_on_public" class="w-4 h-4 accent-pink-400 rounded cursor-pointer shrink-0">
|
||||||
|
Show on Public Page
|
||||||
|
</label>
|
||||||
|
<label class="flex items-center gap-2 cursor-pointer text-[11px] font-semibold text-gray-600">
|
||||||
|
<input type="hidden" :name="'content_showcase['+index+'][show_on_pdf]'" value="0">
|
||||||
|
<input type="checkbox" :name="'content_showcase['+index+'][show_on_pdf]'" value="1" x-model="item.show_on_pdf" class="w-4 h-4 accent-pink-400 rounded cursor-pointer shrink-0">
|
||||||
|
Show on PDF
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<button type="button" @click="addItem()"
|
||||||
|
class="text-sm px-4 py-2 rounded-full border border-pink-200 text-pink-500 hover:bg-pink-50 font-semibold bg-white mb-2 shadow-sm">
|
||||||
|
+ Add Content to Showcase
|
||||||
|
</button>
|
||||||
|
<p class="text-xs text-gray-400 mt-1">Select files you've uploaded in the Files page to feature them
|
||||||
|
directly on your public rate card.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
{{-- Actions --}}
|
{{-- Actions --}}
|
||||||
<div class="flex flex-wrap items-center gap-3">
|
<div class="flex flex-wrap items-center gap-2 w-full">
|
||||||
<button type="submit" class="btn-sakura px-6 py-2.5">💾 Save Profile</button>
|
<button type="submit" class="btn-sakura text-xs sm:text-sm shrink-0 px-4 py-2 sm:px-6 sm:py-2.5">💾 Save
|
||||||
|
Profile</button>
|
||||||
<a href="{{ route('rate-cards.public') }}" target="_blank"
|
<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">
|
class="bg-white text-xs sm:text-sm px-3 py-1.5 sm:px-4 sm:py-2 rounded-full border border-pink-200 text-pink-600 hover:bg-pink-50 shadow-sm shrink-0">
|
||||||
👁️ Preview Public Page
|
👁️ Preview
|
||||||
</a>
|
</a>
|
||||||
<a href="{{ route('rate-cards.pdf') }}"
|
<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">
|
class="bg-white text-xs sm:text-sm px-3 py-1.5 sm:px-4 sm:py-2 rounded-full border border-blue-200 text-blue-600 hover:bg-blue-50 shadow-sm shrink-0">
|
||||||
📄 Download PDF
|
📄 Download PDF
|
||||||
</a>
|
</a>
|
||||||
<a href="{{ route('rate-cards.index') }}"
|
<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">
|
class="bg-white text-xs sm:text-sm px-3 py-1.5 sm:px-4 sm:py-2 rounded-full border border-gray-200 text-gray-600 hover:bg-gray-50 shadow-sm shrink-0">
|
||||||
← Back to Rate Cards
|
← Back
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
@endsection
|
@endsection
|
||||||
@@ -1,50 +1,316 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Rate Card — {{ $profile->owner_name }}</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">
|
<link href="https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&display=swap" rel="stylesheet">
|
||||||
|
<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script>
|
||||||
<style>
|
<style>
|
||||||
* { box-sizing: border-box; margin: 0; padding: 0; }
|
* {
|
||||||
body { font-family: 'Nunito', sans-serif; background: {{ $profile->bg_color }}; color: {{ $profile->text_color }}; padding: 40px 20px; }
|
box-sizing: border-box;
|
||||||
.container { max-width: 820px; margin: 0 auto; }
|
margin: 0;
|
||||||
.header { text-align: center; margin-bottom: 48px; }
|
padding: 0;
|
||||||
.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; }
|
body {
|
||||||
.contacts { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px 20px; margin-top: 16px; }
|
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-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 {
|
.contact-pill {
|
||||||
display: inline-flex; align-items: center; gap-6px;
|
display: inline-flex;
|
||||||
background: white; border: 1px solid {{ $profile->accent_color }}44;
|
align-items: center;
|
||||||
border-radius: 99px; padding: 6px 14px; font-size: 12px; color: {{ $profile->text_color }};
|
gap-6px;
|
||||||
text-decoration: none; transition: background 0.2s;
|
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; }
|
.contact-pill:hover {
|
||||||
.platform-title { font-size: 18px; font-weight: 800; color: {{ $profile->text_color }}; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
|
background:
|
||||||
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
|
{{ $profile->accent_color }}
|
||||||
.card { background: white; border-radius: 24px; padding: 20px; border: 1px solid {{ $profile->accent_color }}33; box-shadow: 0 2px 8px {{ $profile->accent_color }}22; }
|
18;
|
||||||
.service { font-weight: 700; color: #1F2937; margin-bottom: 6px; }
|
}
|
||||||
.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; }
|
.platform-section {
|
||||||
.price { font-size: 22px; font-weight: 900; color: {{ $profile->accent_color }}; }
|
margin-bottom: 32px;
|
||||||
.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; }
|
.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;
|
||||||
|
}
|
||||||
|
|
||||||
|
.carousel-wrapper {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.carousel-track {
|
||||||
|
display: flex;
|
||||||
|
overflow-x: auto;
|
||||||
|
scroll-snap-type: x mandatory;
|
||||||
|
gap: 14px;
|
||||||
|
padding-bottom: 10px;
|
||||||
|
scrollbar-width: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.carousel-track::-webkit-scrollbar {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.carousel-slide {
|
||||||
|
flex: 0 0 220px;
|
||||||
|
scroll-snap-align: start;
|
||||||
|
}
|
||||||
|
|
||||||
|
.carousel-btn {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
width: 40px;
|
||||||
|
height: 40px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: white;
|
||||||
|
border: 1px solid rgba(0,0,0,0.05);
|
||||||
|
box-shadow: 0 4px 10px rgba(0,0,0,0.1);
|
||||||
|
color:
|
||||||
|
{{ $profile->accent_color }}
|
||||||
|
;
|
||||||
|
font-size: 20px;
|
||||||
|
font-weight: 900;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
cursor: pointer;
|
||||||
|
z-index: 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
.carousel-btn:hover {
|
||||||
|
background: #fdfdfd;
|
||||||
|
box-shadow: 0 6px 14px rgba(0,0,0,0.15);
|
||||||
|
}
|
||||||
|
|
||||||
|
.carousel-btn.prev {
|
||||||
|
left: -20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.carousel-btn.next {
|
||||||
|
right: -20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card {
|
||||||
|
background: white;
|
||||||
|
border-radius: 24px;
|
||||||
|
padding: 20px;
|
||||||
|
border: 1px solid
|
||||||
|
{{ $profile->accent_color }}
|
||||||
|
33;
|
||||||
|
box-shadow: 0 2px 8px
|
||||||
|
{{ $profile->accent_color }}
|
||||||
|
22;
|
||||||
|
}
|
||||||
|
|
||||||
|
.popup-modal {
|
||||||
|
position: fixed;
|
||||||
|
inset: 0;
|
||||||
|
background: rgba(0, 0, 0, 0.8);
|
||||||
|
z-index: 9999;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.service {
|
||||||
|
font-weight: 700;
|
||||||
|
color: #1F2937;
|
||||||
|
margin-bottom: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.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:
|
||||||
|
{{ $profile->accent_color }}
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
.price-meta {
|
||||||
|
font-size: 11px;
|
||||||
|
color: #D1D5DB;
|
||||||
|
margin-top: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.negotiable {
|
||||||
|
font-size: 11px;
|
||||||
|
color: #F59E0B;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer {
|
||||||
|
margin-top: 40px;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #D1D5DB;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Quill WYSIWYG Compatibility */
|
||||||
|
.ql-align-center {
|
||||||
|
text-align: center !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ql-align-right {
|
||||||
|
text-align: right !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ql-align-justify {
|
||||||
|
text-align: justify !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ql-size-small {
|
||||||
|
font-size: 0.75em !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ql-size-large {
|
||||||
|
font-size: 1.5em !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ql-size-huge {
|
||||||
|
font-size: 2.5em !important;
|
||||||
|
}
|
||||||
|
|
||||||
.pdf-btn {
|
.pdf-btn {
|
||||||
display: inline-flex; align-items: center; gap: 6px;
|
display: inline-flex;
|
||||||
background: {{ $profile->accent_color }}; color: white;
|
align-items: center;
|
||||||
border: none; border-radius: 99px; padding: 10px 24px;
|
gap: 6px;
|
||||||
font-size: 14px; font-weight: 700; cursor: pointer;
|
background:
|
||||||
text-decoration: none; transition: opacity 0.2s;
|
{{ $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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.pdf-btn:hover { opacity: 0.9; }
|
|
||||||
@media print { body { background: white; } .card { break-inside: avoid; } .pdf-btn { display: none; } }
|
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
|
||||||
<div class="container">
|
<body x-data="{ popupOpen: false, popupImage: '' }">
|
||||||
|
<div class="container">
|
||||||
<div class="header">
|
<div class="header">
|
||||||
@if($profile->logo_path)
|
@if($profile->logo_path)
|
||||||
<img src="{{ route('files.serve-profile-logo') }}" alt="{{ $profile->owner_name }}" class="logo-img">
|
<img src="{{ route('files.serve-profile-logo') }}" alt="{{ $profile->owner_name }}" class="logo-img">
|
||||||
@@ -61,22 +327,21 @@
|
|||||||
<a href="{{ $profile->whatsappUrl }}" target="_blank" class="contact-pill">📱 WhatsApp</a>
|
<a href="{{ $profile->whatsappUrl }}" target="_blank" class="contact-pill">📱 WhatsApp</a>
|
||||||
@endif
|
@endif
|
||||||
@if($profile->ig_handle)
|
@if($profile->ig_handle)
|
||||||
<a href="https://instagram.com/{{ ltrim($profile->ig_handle, '@') }}" target="_blank" class="contact-pill">📸 @{{ $profile->ig_handle }}</a>
|
<a href="https://instagram.com/{{ ltrim($profile->ig_handle, '@') }}" target="_blank"
|
||||||
|
class="contact-pill">📸 {{ '@' . ltrim($profile->ig_handle, '@') }}</a>
|
||||||
@endif
|
@endif
|
||||||
@if($profile->tiktok_handle)
|
@if($profile->tiktok_handle)
|
||||||
<a href="https://tiktok.com/@{{ ltrim($profile->tiktok_handle, '@') }}" target="_blank" class="contact-pill">🎵 @{{ $profile->tiktok_handle }}</a>
|
<a href="https://tiktok.com/{{ ltrim($profile->tiktok_handle, '@') }}" target="_blank"
|
||||||
|
class="contact-pill">🎵 {{ '@' . ltrim($profile->tiktok_handle, '@') }}</a>
|
||||||
@endif
|
@endif
|
||||||
@if($profile->youtube_handle)
|
@if($profile->youtube_handle)
|
||||||
<a href="https://youtube.com/{{ $profile->youtube_handle }}" target="_blank" class="contact-pill">▶️ {{ $profile->youtube_handle }}</a>
|
<a href="https://youtube.com/{{ $profile->youtube_handle }}" target="_blank" class="contact-pill">▶️
|
||||||
|
{{ $profile->youtube_handle }}</a>
|
||||||
@endif
|
@endif
|
||||||
@if($profile->email)
|
@if($profile->email)
|
||||||
<a href="mailto:{{ $profile->email }}" class="contact-pill">✉️ {{ $profile->email }}</a>
|
<a href="mailto:{{ $profile->email }}" class="contact-pill">✉️ {{ $profile->email }}</a>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style="margin-top:20px">
|
|
||||||
<a href="{{ route('rate-cards.pdf') }}" class="pdf-btn">📄 Download PDF</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@forelse($rateCards as $platform => $cards)
|
@forelse($rateCards as $platform => $cards)
|
||||||
@@ -112,10 +377,151 @@
|
|||||||
<p style="text-align:center; color:#9CA3AF; padding: 60px 0;">No rate cards published yet.</p>
|
<p style="text-align:center; color:#9CA3AF; padding: 60px 0;">No rate cards published yet.</p>
|
||||||
@endforelse
|
@endforelse
|
||||||
|
|
||||||
<div class="footer">
|
@if(!empty($profile->past_brands))
|
||||||
{{ $profile->custom_footer ?: 'Prices may vary. Contact for custom packages. 🐾' }}
|
@php
|
||||||
<br>Generated by KOL Manager · {{ now()->format('Y') }}
|
$logoSizesPublic = [
|
||||||
|
'small' => 'max-height:45px; max-width:90px;',
|
||||||
|
'medium' => 'max-height:60px; max-width:120px;',
|
||||||
|
'large' => 'max-height:80px; max-width:160px;',
|
||||||
|
];
|
||||||
|
$sizeStylePublic = $logoSizesPublic[$profile->brand_logo_size ?? 'medium'] ?? $logoSizesPublic['medium'];
|
||||||
|
@endphp
|
||||||
|
<div class="platform-section" style="margin-top:40px;">
|
||||||
|
<div class="platform-title" style="justify-content:center;">Brand Collaborations</div>
|
||||||
|
<div style="display:flex; flex-wrap:wrap; justify-content:center; gap:24px; margin-top:20px;">
|
||||||
|
@foreach($profile->past_brands as $brandPath)
|
||||||
|
<img src="{{ asset('storage/' . $brandPath) }}"
|
||||||
|
style="{{ $sizeStylePublic }} object-fit:contain; border-radius:8px;">
|
||||||
|
@endforeach
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
@php
|
||||||
|
$publicShowcase = array_filter($profile->content_showcase ?? [], function($item) {
|
||||||
|
return !isset($item['show_on_public']) || $item['show_on_public'];
|
||||||
|
});
|
||||||
|
@endphp
|
||||||
|
@if(!empty($publicShowcase))
|
||||||
|
<div class="platform-section" style="margin-top:40px;">
|
||||||
|
<div class="platform-title" style="justify-content:center;">Content Showcase</div>
|
||||||
|
@php
|
||||||
|
$isCarousel = count($publicShowcase) >= 3;
|
||||||
|
$renderShowcase = $isCarousel ? array_merge($publicShowcase, $publicShowcase) : $publicShowcase;
|
||||||
|
@endphp
|
||||||
|
@if($isCarousel)
|
||||||
|
<div class="carousel-wrapper" x-data="{
|
||||||
|
scrollTimeout: null,
|
||||||
|
scrollPrev() {
|
||||||
|
const slider = this.$refs.slider;
|
||||||
|
const el = slider.lastElementChild;
|
||||||
|
const dist = el.offsetWidth + 14;
|
||||||
|
slider.insertBefore(el, slider.firstElementChild);
|
||||||
|
slider.scrollLeft += dist;
|
||||||
|
void slider.offsetWidth;
|
||||||
|
slider.scrollBy({left: -dist, behavior: 'smooth'});
|
||||||
|
},
|
||||||
|
scrollNext() {
|
||||||
|
const slider = this.$refs.slider;
|
||||||
|
const el = slider.firstElementChild;
|
||||||
|
const dist = el.offsetWidth + 14;
|
||||||
|
slider.scrollBy({left: dist, behavior: 'smooth'});
|
||||||
|
|
||||||
|
if (this.scrollTimeout) clearTimeout(this.scrollTimeout);
|
||||||
|
this.scrollTimeout = setTimeout(() => {
|
||||||
|
while (slider.scrollLeft >= slider.firstElementChild.offsetWidth + 10) {
|
||||||
|
const first = slider.firstElementChild;
|
||||||
|
const moveDist = first.offsetWidth + 14;
|
||||||
|
slider.appendChild(first);
|
||||||
|
slider.scrollLeft -= moveDist;
|
||||||
|
}
|
||||||
|
}, 400);
|
||||||
|
}
|
||||||
|
}">
|
||||||
|
<button type="button" class="carousel-btn prev" @click="scrollPrev()">❮</button>
|
||||||
|
<div class="carousel-track" x-ref="slider" style="overflow-anchor: none;">
|
||||||
|
@else
|
||||||
|
<div class="cards">
|
||||||
|
@endif
|
||||||
|
@foreach($renderShowcase as $item)
|
||||||
|
@php
|
||||||
|
$isUrl = ($item['file_id'] === 'url');
|
||||||
|
$file = !$isUrl ? \App\Models\MediaFile::find($item['file_id']) : null;
|
||||||
|
@endphp
|
||||||
|
@if($file || $isUrl)
|
||||||
|
<div class="card {{ $isCarousel ? 'carousel-slide' : '' }}" style="padding:0; overflow:hidden; display:flex; flex-direction:column;">
|
||||||
|
<div style="flex:1; background:#F9FAFB; display:flex; align-items:center; justify-content:center; position:relative;">
|
||||||
|
@if(!empty($item['thumbnail_path']))
|
||||||
|
@if(!$isUrl && $file->is_image)
|
||||||
|
<div style="width:100%; aspect-ratio:9/16; cursor:pointer; position:relative;" @click="popupImage = '{{ $file->url }}'; popupOpen = true;">
|
||||||
|
<img src="{{ asset('storage/' . $item['thumbnail_path']) }}" style="width:100%; height:100%; object-fit:cover; display:block;">
|
||||||
|
</div>
|
||||||
|
@else
|
||||||
|
<a href="{{ $isUrl ? ($item['url'] ?? '#') : $file->url }}" target="_blank" style="display:block; width:100%; aspect-ratio:9/16; position:relative;">
|
||||||
|
<img src="{{ asset('storage/' . $item['thumbnail_path']) }}" style="width:100%; height:100%; object-fit:cover; display:block;">
|
||||||
|
@if(!$isUrl && $file->is_video)
|
||||||
|
<div style="position:absolute; inset:0; display:flex; align-items:center; justify-content:center; background:rgba(0,0,0,0.2);">
|
||||||
|
<div style="width:48px; height:48px; background:rgba(255,255,255,0.8); border-radius:50%; display:flex; align-items:center; justify-content:center; color:{{ $profile->accent_color }}; font-size:24px;">▶</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
</a>
|
||||||
|
@endif
|
||||||
|
@elseif($isUrl)
|
||||||
|
<div style="aspect-ratio:9/16; display:flex; flex-direction:column; align-items:center; justify-content:center; padding:20px; text-align:center;">
|
||||||
|
<span style="font-size:48px;">🌐</span>
|
||||||
|
<a href="{{ $item['url'] ?? '#' }}" target="_blank" style="margin-top:10px; font-size:12px; color:{{ $profile->accent_color }}; text-decoration:none; font-weight:700;">Open Link</a>
|
||||||
|
</div>
|
||||||
|
@else
|
||||||
|
@if($file->is_image)
|
||||||
|
<div style="width:100%; aspect-ratio:9/16; cursor:pointer;" @click="popupImage = '{{ $file->url }}'; popupOpen = true;">
|
||||||
|
<img src="{{ $file->url }}" style="width:100%; height:100%; object-fit:cover; display:block;">
|
||||||
|
</div>
|
||||||
|
@elseif($file->is_video)
|
||||||
|
<video src="{{ $file->url }}" style="width:100%; aspect-ratio:9/16; object-fit:cover; display:block;" controls></video>
|
||||||
|
@else
|
||||||
|
<div style="aspect-ratio:9/16; display:flex; flex-direction:column; align-items:center; justify-content:center; padding:20px; text-align:center;">
|
||||||
|
<span style="font-size:48px;">{{ $file->icon }}</span>
|
||||||
|
<a href="{{ $file->url }}" target="_blank" style="margin-top:10px; font-size:12px; color:{{ $profile->accent_color }}; text-decoration:none; font-weight:700;">View File</a>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
<div style="padding:16px;">
|
||||||
|
<div class="service" style="margin-bottom:0; text-align:center; font-weight:700;">{{ $item['name'] }}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
@endforeach
|
||||||
|
@if($isCarousel)
|
||||||
|
</div>
|
||||||
|
<button type="button" class="carousel-btn next" @click="scrollNext()">❯</button>
|
||||||
|
</div>
|
||||||
|
@else
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
@if($profile->terms_and_conditions)
|
||||||
|
<div class="platform-section" style="margin-top:40px;">
|
||||||
|
<div class="platform-title" style="justify-content:center;">Terms & Conditions</div>
|
||||||
|
<div class="card" style="font-size:13px; color:#6B7280; line-height:1.6;">
|
||||||
|
{!! $profile->terms_and_conditions !!}</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<div class="footer">
|
||||||
|
{{ $profile->custom_footer ?: 'Prices may vary. Contact for custom packages.' }}
|
||||||
|
<!--<br>Generated by Cathy's App · {{ now()->format('Y-M-D') }}-->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Image Popup Modal -->
|
||||||
|
<div x-show="popupOpen" x-transition.opacity style="display:none;" class="popup-modal">
|
||||||
|
<div style="position:absolute; inset:0; cursor:pointer;" @click="popupOpen = false"></div>
|
||||||
|
<img :src="popupImage" style="max-width:100%; max-height:100%; object-fit:contain; position:relative; z-index:10000; border-radius:12px; box-shadow:0 10px 25px rgba(0,0,0,0.5);">
|
||||||
|
<button @click="popupOpen = false" style="position:absolute; top:20px; right:20px; background:rgba(255,255,255,0.2); border:none; color:white; font-size:30px; width:40px; height:40px; border-radius:50%; cursor:pointer; z-index:10001; display:flex; align-items:center; justify-content:center;">×</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
452
resources/views/schedule/create.blade.php
Normal file
452
resources/views/schedule/create.blade.php
Normal file
@@ -0,0 +1,452 @@
|
|||||||
|
@extends('layouts.app')
|
||||||
|
|
||||||
|
@section('title', 'Add Event')
|
||||||
|
@section('page-title', 'Add Event 📅')
|
||||||
|
@section('page-subtitle', 'Schedule a new task, meeting, or posting')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<div class="max-w-2xl mx-auto">
|
||||||
|
<div class="flex items-center gap-3 mb-5">
|
||||||
|
<a href="{{ route('schedule.index') }}" class="btn-sakura text-sm px-5 py-2">
|
||||||
|
← Back to Schedule
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="cat-card p-4 lg:p-8">
|
||||||
|
<form action="{{ route('schedule.store') }}" method="POST" id="create-event-form"
|
||||||
|
x-data="contractCheck('{{ route('contracts.check', [], false) }}')" class="space-y-5">
|
||||||
|
@csrf
|
||||||
|
<input type="hidden" name="start_time" id="start_time_hidden">
|
||||||
|
<input type="hidden" name="end_time" id="end_time_hidden">
|
||||||
|
|
||||||
|
{{-- Title --}}
|
||||||
|
<div>
|
||||||
|
<label class="block text-sm font-semibold text-gray-700 mb-1">
|
||||||
|
Title <span class="text-pink-400">*</span>
|
||||||
|
</label>
|
||||||
|
<input type="text" name="title" value="{{ old('title') }}" class="input-soft" placeholder="Event title"
|
||||||
|
required>
|
||||||
|
@error('title') <p class="text-xs text-red-500 mt-1">{{ $message }}</p> @enderror
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4" x-data="{
|
||||||
|
isNew: false,
|
||||||
|
saving: false,
|
||||||
|
newName: '', newEmail: '', newPhone: '', newCompany: '',
|
||||||
|
errMsg: '',
|
||||||
|
isNewCat: false,
|
||||||
|
savingCat: false,
|
||||||
|
newCatName: '',
|
||||||
|
catErrMsg: '',
|
||||||
|
onClientChange(e) {
|
||||||
|
this.isNew = (e.target.value === '__new__');
|
||||||
|
if (!this.isNew) {
|
||||||
|
this.clientId = e.target.value;
|
||||||
|
$dispatch('contract-check');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async saveNewClient() {
|
||||||
|
if (!this.newName.trim()) { this.errMsg = 'Name is required.'; return; }
|
||||||
|
this.saving = true; this.errMsg = '';
|
||||||
|
const fd = new FormData();
|
||||||
|
fd.append('name', this.newName);
|
||||||
|
fd.append('email', this.newEmail);
|
||||||
|
fd.append('phone', this.newPhone);
|
||||||
|
fd.append('company', this.newCompany);
|
||||||
|
fd.append('_token', document.querySelector('meta[name=csrf-token]').content);
|
||||||
|
try {
|
||||||
|
const res = await fetch('{{ route('clients.quick-store', [], false) }}', {
|
||||||
|
method:'POST',
|
||||||
|
body: fd,
|
||||||
|
headers: {
|
||||||
|
'Accept': 'application/json',
|
||||||
|
'X-Requested-With': 'XMLHttpRequest'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const data = await res.json();
|
||||||
|
if (res.ok) {
|
||||||
|
// Add new option & select it
|
||||||
|
const sel = document.getElementById('client-select');
|
||||||
|
const opt = new Option(data.name, data.id, true, true);
|
||||||
|
sel.add(opt, sel.options[1]);
|
||||||
|
sel.value = data.id;
|
||||||
|
sel.dispatchEvent(new Event('change'));
|
||||||
|
this.isNew = false;
|
||||||
|
this.newName = this.newEmail = this.newPhone = this.newCompany = '';
|
||||||
|
} else {
|
||||||
|
this.errMsg = data.message || 'Could not create client.';
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
this.errMsg = 'An unexpected error occurred.';
|
||||||
|
} finally {
|
||||||
|
this.saving = false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onCategoryChange(e) {
|
||||||
|
this.isNewCat = (e.target.value === '__new__');
|
||||||
|
if (!this.isNewCat) {
|
||||||
|
this.categoryId = e.target.value;
|
||||||
|
this.checkContract();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async saveNewCategory() {
|
||||||
|
if (!this.newCatName.trim()) { this.catErrMsg = 'Category name is required.'; return; }
|
||||||
|
this.savingCat = true; this.catErrMsg = '';
|
||||||
|
const fd = new FormData();
|
||||||
|
fd.append('name', this.newCatName);
|
||||||
|
fd.append('_token', document.querySelector('meta[name=csrf-token]').content);
|
||||||
|
try {
|
||||||
|
const res = await fetch('{{ route('client-categories.quick-store', [], false) }}', {
|
||||||
|
method:'POST',
|
||||||
|
body: fd,
|
||||||
|
headers: {
|
||||||
|
'Accept': 'application/json',
|
||||||
|
'X-Requested-With': 'XMLHttpRequest'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const data = await res.json();
|
||||||
|
if (res.ok) {
|
||||||
|
const sel = document.getElementById('category-select');
|
||||||
|
const opt = new Option(data.icon + ' ' + data.name, data.id, true, true);
|
||||||
|
sel.add(opt, sel.options[1]);
|
||||||
|
sel.value = data.id;
|
||||||
|
sel.dispatchEvent(new Event('change'));
|
||||||
|
this.isNewCat = false;
|
||||||
|
this.newCatName = '';
|
||||||
|
} else {
|
||||||
|
this.catErrMsg = data.message || 'Could not create category.';
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
this.catErrMsg = 'An unexpected error occurred.';
|
||||||
|
} finally {
|
||||||
|
this.savingCat = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}">
|
||||||
|
{{-- Type --}}
|
||||||
|
<div>
|
||||||
|
<label class="block text-sm font-semibold text-gray-700 mb-1">Type</label>
|
||||||
|
<select name="event_type" class="input-soft">
|
||||||
|
@foreach(['task' => '📋 Task', 'meeting' => '🤝 Meeting', 'deadline' => '⏰ Deadline', 'posting' => '📸 Posting'] as $val => $label)
|
||||||
|
<option value="{{ $val }}" {{ old('event_type') === $val ? 'selected' : '' }}>
|
||||||
|
{{ $label }}
|
||||||
|
</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Client --}}
|
||||||
|
<div>
|
||||||
|
<label class="block text-sm font-semibold text-gray-700 mb-1">Client</label>
|
||||||
|
<select name="client_id" id="client-select" class="input-soft" x-model="clientId"
|
||||||
|
@change="onClientChange($event); if($event.target.value !== '__new__') checkContract()">
|
||||||
|
<option value="">— None —</option>
|
||||||
|
<option value="__new__" class="font-semibold text-pink-600">+ Create New Client…</option>
|
||||||
|
@foreach($clients as $client)
|
||||||
|
<option value="{{ $client->id }}" {{ old('client_id') == $client->id ? 'selected' : '' }}>
|
||||||
|
{{ $client->name }}
|
||||||
|
</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Quick New Client mini-form --}}
|
||||||
|
<div x-show="isNew" x-transition style="display: none;"
|
||||||
|
class="sm:col-span-2 bg-purple-50 rounded-2xl p-4 space-y-3 border border-purple-100">
|
||||||
|
<p class="text-xs font-bold text-purple-700">🐱 New Client Basic Info</p>
|
||||||
|
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3">
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Name <span
|
||||||
|
class="text-pink-400">*</span></label>
|
||||||
|
<input type="text" x-model="newName" class="input-soft text-sm"
|
||||||
|
placeholder="Client / brand name">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Company</label>
|
||||||
|
<input type="text" x-model="newCompany" class="input-soft text-sm"
|
||||||
|
placeholder="Company name">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Email</label>
|
||||||
|
<input type="email" x-model="newEmail" class="input-soft text-sm"
|
||||||
|
placeholder="contact@brand.com">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Phone</label>
|
||||||
|
<input type="text" x-model="newPhone" class="input-soft text-sm" placeholder="+62 …">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<p x-show="errMsg" x-text="errMsg" class="text-xs text-red-500"></p>
|
||||||
|
<div class="flex gap-2 pt-1">
|
||||||
|
<button type="button" @click="saveNewClient()" :disabled="saving"
|
||||||
|
class="btn-sakura text-sm px-4 py-2"
|
||||||
|
x-text="saving ? 'Saving…' : '✓ Add & Select'"></button>
|
||||||
|
<button type="button"
|
||||||
|
@click="isNew = false; document.getElementById('client-select').value = ''"
|
||||||
|
class="text-sm px-4 py-2 rounded-full border border-pink-200 text-gray-500 hover:bg-pink-50">
|
||||||
|
Cancel
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<p class="text-xs text-purple-400">Status will be set to Active automatically.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Category --}}
|
||||||
|
<div class="sm:col-span-2">
|
||||||
|
<label class="block text-sm font-semibold text-gray-700 mb-1">Category</label>
|
||||||
|
<select name="category_id" id="category-select" class="input-soft" x-model="categoryId"
|
||||||
|
@change="onCategoryChange($event)">
|
||||||
|
<option value="">— None —</option>
|
||||||
|
<option value="__new__" class="font-semibold text-pink-600">+ Create New 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>
|
||||||
|
|
||||||
|
{{-- Quick New Category mini-form --}}
|
||||||
|
<div x-show="isNewCat" x-transition style="display: none;"
|
||||||
|
class="sm:col-span-2 bg-pink-50 rounded-2xl p-4 space-y-3 border border-pink-100">
|
||||||
|
<p class="text-xs font-bold text-pink-700">🏷️ New Category</p>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Category Name <span
|
||||||
|
class="text-pink-400">*</span></label>
|
||||||
|
<input type="text" x-model="newCatName" class="input-soft text-sm" placeholder="e.g. Susu UHT">
|
||||||
|
</div>
|
||||||
|
<p x-show="catErrMsg" x-text="catErrMsg" class="text-xs text-red-500"></p>
|
||||||
|
<div class="flex gap-2 pt-1">
|
||||||
|
<button type="button" @click="saveNewCategory()" :disabled="savingCat"
|
||||||
|
class="btn-sakura text-sm px-4 py-2"
|
||||||
|
x-text="savingCat ? 'Saving…' : '✓ Add & Select'"></button>
|
||||||
|
<button type="button"
|
||||||
|
@click="isNewCat = false; document.getElementById('category-select').value = ''"
|
||||||
|
class="text-sm px-4 py-2 rounded-full border border-pink-200 text-gray-500 hover:bg-pink-50">
|
||||||
|
Cancel
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Contract warning --}}
|
||||||
|
<div x-show="contractWarning" x-transition
|
||||||
|
class="sm:col-span-2 rounded-2xl bg-amber-50 border border-amber-200 px-4 py-3 text-sm"
|
||||||
|
style="display:none">
|
||||||
|
<div class="font-semibold text-amber-700 mb-1">⚠️ Exclusive Contract Active</div>
|
||||||
|
<p class="text-amber-600 text-xs" x-text="contractMessage"></p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Start Date --}}
|
||||||
|
<div>
|
||||||
|
<label class="block text-sm font-semibold text-gray-700 mb-1">
|
||||||
|
Start Date <span class="text-pink-400">*</span>
|
||||||
|
</label>
|
||||||
|
<input type="date" id="start_date" class="input-soft" value="{{ old('_start_date') }}" required
|
||||||
|
@change="checkContract()">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-sm font-semibold text-gray-700 mb-1">Start Time</label>
|
||||||
|
<input type="time" id="start_time_input" class="input-soft" value="09:00">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- End Date --}}
|
||||||
|
<div>
|
||||||
|
<label class="block text-sm font-semibold text-gray-700 mb-1">End Date</label>
|
||||||
|
<input type="date" id="end_date" class="input-soft" value="{{ old('_end_date') }}">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-sm font-semibold text-gray-700 mb-1">End Time</label>
|
||||||
|
<input type="time" id="end_time_input" class="input-soft" value="18:00">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Location --}}
|
||||||
|
<div class="sm:col-span-2">
|
||||||
|
<label class="block text-sm font-semibold text-gray-700 mb-1">Location</label>
|
||||||
|
<input type="text" name="location" value="{{ old('location') }}" class="input-soft"
|
||||||
|
placeholder="Online / venue address">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Description --}}
|
||||||
|
<div>
|
||||||
|
<label class="block text-sm font-semibold text-gray-700 mb-1">Description</label>
|
||||||
|
<textarea name="description" rows="2" class="input-soft resize-none"
|
||||||
|
placeholder="Brief description…">{{ old('description') }}</textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Color --}}
|
||||||
|
<div x-data="{ color: '{{ old('color', '#FFB7C5') }}' }">
|
||||||
|
<label class="block text-sm font-semibold text-gray-700 mb-2">Color</label>
|
||||||
|
<input type="hidden" name="color" :value="color">
|
||||||
|
<div class="flex items-center gap-3">
|
||||||
|
<input type="color" x-model="color"
|
||||||
|
class="w-10 h-10 rounded-xl cursor-pointer border-2 border-pink-100 p-0.5 shrink-0">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Priority --}}
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<input type="checkbox" name="is_priority" value="1" id="priority" class="w-4 h-4 accent-pink-400" {{ old('is_priority') ? 'checked' : '' }}>
|
||||||
|
<label for="priority" class="text-sm text-gray-600 cursor-pointer">⭐ Mark as Priority</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Notes --}}
|
||||||
|
<div>
|
||||||
|
<label class="block text-sm font-semibold text-gray-700 mb-1">Notes</label>
|
||||||
|
<textarea name="notes" rows="3" class="input-soft resize-none"
|
||||||
|
placeholder="Additional notes…">{{ old('notes') }}</textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- ── Add to Content Board ──────────────────────────────── --}}
|
||||||
|
<div x-data="{ addToBoard: {{ old('add_to_content_board') ? 'true' : 'false' }} }">
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<input type="checkbox" name="add_to_content_board" value="1" id="add_to_content_board"
|
||||||
|
class="w-4 h-4 accent-pink-400" x-model="addToBoard">
|
||||||
|
<label for="add_to_content_board" class="text-sm text-gray-600 cursor-pointer">
|
||||||
|
🗂️ Also add to Content Board as a Drafting card
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div x-show="addToBoard" x-transition
|
||||||
|
class="mt-3 grid grid-cols-1 sm:grid-cols-2 gap-3 bg-purple-50 rounded-2xl p-4">
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Platform</label>
|
||||||
|
<select name="content_platform" class="input-soft text-sm">
|
||||||
|
<option value="instagram" {{ old('content_platform') === 'instagram' ? 'selected' : '' }}>📸
|
||||||
|
Instagram</option>
|
||||||
|
<option value="tiktok" {{ old('content_platform') === 'tiktok' ? 'selected' : '' }}>🎵 TikTok
|
||||||
|
</option>
|
||||||
|
<option value="youtube" {{ old('content_platform') === 'youtube' ? 'selected' : '' }}>▶️
|
||||||
|
YouTube</option>
|
||||||
|
<option value="other" {{ old('content_platform') === 'other' ? 'selected' : '' }}>📱 Other
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Content Type</label>
|
||||||
|
<select name="content_type" class="input-soft text-sm">
|
||||||
|
<option value="post" {{ old('content_type') === 'post' ? 'selected' : '' }}>Post / Feed
|
||||||
|
</option>
|
||||||
|
<option value="reel" {{ old('content_type') === 'reel' ? 'selected' : '' }}>Reel / Short
|
||||||
|
</option>
|
||||||
|
<option value="story" {{ old('content_type') === 'story' ? 'selected' : '' }}>Story</option>
|
||||||
|
<option value="video" {{ old('content_type') === 'video' ? 'selected' : '' }}>Long Video
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<p class="sm:col-span-2 text-xs text-purple-500">
|
||||||
|
A Drafting card will be created in your Content Board with this event's title and date.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- ── Brand Contract ────────────────────────────────────── --}}
|
||||||
|
<div x-data="{ createContract: {{ old('create_brand_contract') ? 'true' : 'false' }} }">
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<input type="checkbox" name="create_brand_contract" value="1" id="create_contract"
|
||||||
|
class="w-4 h-4 accent-pink-400" x-model="createContract">
|
||||||
|
<label for="create_contract" class="text-sm text-gray-600 cursor-pointer">
|
||||||
|
📄 Also create a Brand Contract for this event
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div x-show="createContract" x-transition
|
||||||
|
class="mt-3 grid grid-cols-1 sm:grid-cols-2 gap-3 bg-pink-50 rounded-2xl p-4">
|
||||||
|
<div class="sm:col-span-2">
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Contract Title</label>
|
||||||
|
<input type="text" name="contract_title" class="input-soft text-sm"
|
||||||
|
placeholder="e.g. Exclusive Posting Contract — BrandX" value="{{ old('contract_title') }}">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Contract Start</label>
|
||||||
|
<input type="date" name="contract_start_date" class="input-soft text-sm"
|
||||||
|
value="{{ old('contract_start_date') }}">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Contract End</label>
|
||||||
|
<input type="date" name="contract_end_date" class="input-soft text-sm"
|
||||||
|
value="{{ old('contract_end_date') }}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex flex-col sm:flex-row gap-3 pt-1">
|
||||||
|
<button type="submit" class="btn-sakura flex-1 py-3"
|
||||||
|
:class="{ 'opacity-50 cursor-not-allowed': contractWarning }" :disabled="contractWarning">
|
||||||
|
🐾 Schedule It!
|
||||||
|
</button>
|
||||||
|
<a href="{{ route('schedule.index') }}"
|
||||||
|
class="flex-1 py-3 text-center rounded-full border border-pink-200 text-gray-600 hover:bg-pink-50 font-semibold text-sm">
|
||||||
|
Cancel
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@push('scripts')
|
||||||
|
<script>
|
||||||
|
function contractCheck(checkUrl) {
|
||||||
|
return {
|
||||||
|
categoryId: '',
|
||||||
|
clientId: '',
|
||||||
|
contractWarning: false,
|
||||||
|
contractMessage: '',
|
||||||
|
async checkContract() {
|
||||||
|
if (!this.categoryId) { this.contractWarning = false; return; }
|
||||||
|
let dateVal = '';
|
||||||
|
const startDateEl = document.getElementById('start_date');
|
||||||
|
if (startDateEl && startDateEl.value) {
|
||||||
|
dateVal = startDateEl.value;
|
||||||
|
}
|
||||||
|
if (!dateVal) {
|
||||||
|
this.contractWarning = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const params = new URLSearchParams({
|
||||||
|
category_id: this.categoryId,
|
||||||
|
client_id: this.clientId || '',
|
||||||
|
date: dateVal
|
||||||
|
});
|
||||||
|
try {
|
||||||
|
const res = await fetch(checkUrl + '?' + params);
|
||||||
|
if (!res.ok) throw new Error('Network error');
|
||||||
|
const data = await res.json();
|
||||||
|
if (data && data.title) {
|
||||||
|
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 = '';
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
this.contractWarning = false;
|
||||||
|
this.contractMessage = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
document.getElementById('create-event-form').addEventListener('submit', function (e) {
|
||||||
|
const startDate = document.getElementById('start_date').value;
|
||||||
|
const startTime = document.getElementById('start_time_input').value || '00:00';
|
||||||
|
const endDate = document.getElementById('end_date').value;
|
||||||
|
const endTime = document.getElementById('end_time_input').value || '00:00';
|
||||||
|
|
||||||
|
if (!startDate) {
|
||||||
|
e.preventDefault();
|
||||||
|
alert('Please select a start date.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
document.getElementById('start_time_hidden').value = startDate + 'T' + startTime;
|
||||||
|
if (endDate) {
|
||||||
|
document.getElementById('end_time_hidden').value = endDate + 'T' + endTime;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
@endpush
|
||||||
|
@endsection
|
||||||
@@ -131,17 +131,12 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{-- Color --}}
|
{{-- Color --}}
|
||||||
<div>
|
<div x-data="{ color: '{{ old('color', $event->color ?? '#FFB7C5') }}' }">
|
||||||
<label class="block text-sm font-semibold text-gray-700 mb-2">Color</label>
|
<label class="block text-sm font-semibold text-gray-700 mb-2">Color</label>
|
||||||
<div class="flex gap-2 flex-wrap">
|
<input type="hidden" name="color" :value="color">
|
||||||
@foreach(['#FFB7C5','#B5EAD7','#FDFD96','#E8D5F5','#FFD5B8','#AEC6CF'] as $hex)
|
<div class="flex items-center gap-3">
|
||||||
<label class="cursor-pointer">
|
<input type="color" x-model="color"
|
||||||
<input type="radio" name="color" value="{{ $hex }}" class="sr-only peer"
|
class="w-10 h-10 rounded-xl cursor-pointer border-2 border-pink-100 p-0.5 shrink-0">
|
||||||
{{ old('color', $event->color) === $hex ? 'checked' : '' }}>
|
|
||||||
<span class="w-8 h-8 rounded-full block ring-2 ring-transparent peer-checked:ring-gray-500 peer-checked:ring-offset-1 transition-all"
|
|
||||||
style="background:{{ $hex }};"></span>
|
|
||||||
</label>
|
|
||||||
@endforeach
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -159,6 +154,35 @@
|
|||||||
placeholder="Additional notes…">{{ old('notes', $event->notes) }}</textarea>
|
placeholder="Additional notes…">{{ old('notes', $event->notes) }}</textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{{-- Active Contract checkbox --}}
|
||||||
|
<div x-data="{ createContract: false }">
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<input type="checkbox" name="create_brand_contract" value="1" id="edit_create_contract"
|
||||||
|
class="w-4 h-4 accent-pink-400" x-model="createContract">
|
||||||
|
<label for="edit_create_contract" class="text-sm text-gray-600 cursor-pointer">
|
||||||
|
📄 Also create a Brand Contract for this event
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div x-show="createContract" x-transition class="mt-3 grid grid-cols-1 sm:grid-cols-2 gap-3 bg-pink-50 rounded-2xl p-4">
|
||||||
|
<div class="sm:col-span-2">
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Contract Title</label>
|
||||||
|
<input type="text" name="contract_title" class="input-soft text-sm"
|
||||||
|
placeholder="e.g. Exclusive Posting Contract — BrandX"
|
||||||
|
value="{{ old('contract_title', $event->title) }}">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Contract Start</label>
|
||||||
|
<input type="date" name="contract_start_date" class="input-soft text-sm"
|
||||||
|
value="{{ old('contract_start_date', $event->start_time->format('Y-m-d')) }}">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-xs font-semibold text-gray-600 mb-1">Contract End</label>
|
||||||
|
<input type="date" name="contract_end_date" class="input-soft text-sm"
|
||||||
|
value="{{ old('contract_end_date', $event->end_time?->format('Y-m-d') ?? '') }}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="flex flex-col sm:flex-row gap-3 pt-1">
|
<div class="flex flex-col sm:flex-row gap-3 pt-1">
|
||||||
<button type="submit" class="btn-sakura flex-1 py-3">💾 Save Changes</button>
|
<button type="submit" class="btn-sakura flex-1 py-3">💾 Save Changes</button>
|
||||||
<a href="{{ route('schedule.index') }}"
|
<a href="{{ route('schedule.index') }}"
|
||||||
|
|||||||
@@ -6,122 +6,26 @@
|
|||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
|
|
||||||
{{-- ── Add Event Form (always accessible, collapsible) ─────── --}}
|
{{-- ── Add Event Button ─────────────────────────────────────── --}}
|
||||||
<div class="cat-card p-4 mb-4" x-data="{ open: false }">
|
<div class="flex items-center justify-between mb-4">
|
||||||
<div class="flex items-center justify-between">
|
<a href="{{ route('schedule.create') }}" class="btn-sakura text-sm px-5 py-2">+ Add Event</a>
|
||||||
<h3 class="text-sm font-bold text-gray-700 flex items-center gap-2">➕ New Event</h3>
|
|
||||||
<button class="btn-sakura text-xs px-4 py-1.5" @click="open = !open"
|
|
||||||
x-text="open ? '✕ Close' : '+ Add Event'"></button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<form x-show="open" x-transition action="{{ route('schedule.store') }}" method="POST"
|
|
||||||
class="mt-4 grid grid-cols-1 sm:grid-cols-2 gap-3"
|
|
||||||
id="new-event-form"
|
|
||||||
x-data="contractCheck('{{ route('contracts.check') }}')"
|
|
||||||
@submit.prevent="submitIfClear($el)">
|
|
||||||
@csrf
|
|
||||||
{{-- Hidden combined datetime fields --}}
|
|
||||||
<input type="hidden" name="start_time" id="start_time_hidden">
|
|
||||||
<input type="hidden" name="end_time" id="end_time_hidden">
|
|
||||||
|
|
||||||
<div class="sm:col-span-2">
|
|
||||||
<label class="text-xs font-semibold text-gray-600">Title <span class="text-pink-400">*</span></label>
|
|
||||||
<input type="text" name="title" class="input-soft mt-1" placeholder="Event title" required>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<label class="text-xs font-semibold text-gray-600">Type</label>
|
|
||||||
<select name="event_type" class="input-soft mt-1">
|
|
||||||
<option value="task">📋 Task</option>
|
|
||||||
<option value="meeting">🤝 Meeting</option>
|
|
||||||
<option value="deadline">⏰ Deadline</option>
|
|
||||||
<option value="posting">📸 Posting</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<label class="text-xs font-semibold text-gray-600">Client</label>
|
|
||||||
<select name="client_id" class="input-soft mt-1" x-model="clientId" @change="checkContract()">
|
|
||||||
<option value="">— None —</option>
|
|
||||||
@foreach($clients as $client)
|
|
||||||
<option value="{{ $client->id }}">{{ $client->name }}</option>
|
|
||||||
@endforeach
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<label class="text-xs font-semibold text-gray-600">Category</label>
|
|
||||||
<select name="category_id" class="input-soft mt-1" x-model="categoryId" @change="checkContract()">
|
|
||||||
<option value="">— None —</option>
|
|
||||||
@foreach($categoryTree as $parent)
|
|
||||||
<option value="{{ $parent->id }}">{{ $parent->icon }} {{ $parent->name }}</option>
|
|
||||||
@foreach($parent->children as $child)
|
|
||||||
<option value="{{ $child->id }}"> ↳ {{ $child->name }}</option>
|
|
||||||
@endforeach
|
|
||||||
@endforeach
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{-- Contract warning --}}
|
|
||||||
<div x-show="contractWarning" x-transition class="sm:col-span-2 rounded-2xl bg-amber-50 border border-amber-200 px-4 py-3 text-sm" style="display:none">
|
|
||||||
<div class="font-semibold text-amber-700 mb-1">⚠️ Exclusive Contract Active</div>
|
|
||||||
<p class="text-amber-600 text-xs" x-text="contractMessage"></p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{-- Start: date + time side by side --}}
|
|
||||||
<div>
|
|
||||||
<label class="text-xs font-semibold text-gray-600">Start Date <span class="text-pink-400">*</span></label>
|
|
||||||
<input type="date" id="start_date" class="input-soft mt-1" required>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<label class="text-xs font-semibold text-gray-600">Start Time</label>
|
|
||||||
<input type="time" id="start_time_input" class="input-soft mt-1" value="09:00">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{-- End: date + time side by side --}}
|
|
||||||
<div>
|
|
||||||
<label class="text-xs font-semibold text-gray-600">End Date</label>
|
|
||||||
<input type="date" id="end_date" class="input-soft mt-1">
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<label class="text-xs font-semibold text-gray-600">End Time</label>
|
|
||||||
<input type="time" id="end_time_input" class="input-soft mt-1" value="18:00">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<label class="text-xs font-semibold text-gray-600">Color</label>
|
|
||||||
<div class="flex gap-2 mt-1 flex-wrap">
|
|
||||||
@foreach(['#FFB7C5','#B5EAD7','#FDFD96','#E8D5F5','#FFD5B8','#AEC6CF'] as $hex)
|
|
||||||
<label class="cursor-pointer">
|
|
||||||
<input type="radio" name="color" value="{{ $hex }}" class="sr-only peer" {{ $loop->first ? 'checked' : '' }}>
|
|
||||||
<span class="w-7 h-7 rounded-full block ring-2 ring-transparent peer-checked:ring-gray-500 peer-checked:ring-offset-1 transition-all"
|
|
||||||
style="background:{{ $hex }};"></span>
|
|
||||||
</label>
|
|
||||||
@endforeach
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="flex items-center gap-2 mt-1">
|
|
||||||
<input type="checkbox" name="is_priority" value="1" id="priority" class="w-4 h-4 accent-pink-400">
|
|
||||||
<label for="priority" class="text-xs text-gray-600 cursor-pointer">⭐ Priority</label>
|
|
||||||
</div>
|
|
||||||
<div class="sm:col-span-2">
|
|
||||||
<label class="text-xs font-semibold text-gray-600">Notes</label>
|
|
||||||
<textarea name="notes" rows="2" class="input-soft mt-1 resize-none text-sm"></textarea>
|
|
||||||
</div>
|
|
||||||
<div class="sm:col-span-2">
|
|
||||||
<button type="submit" class="btn-sakura w-full"
|
|
||||||
:class="{ 'opacity-50 cursor-not-allowed': contractWarning }">
|
|
||||||
🐾 Schedule It!
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{-- ── Upcoming Alert Strip ─────────────────────────────────── --}}
|
{{-- ── Upcoming Alert Strip ─────────────────────────────────── --}}
|
||||||
@php
|
@php
|
||||||
$upcomingList = $events->filter(fn($e) => $e->start_time->isFuture() && $e->start_time->diffInHours(now()) <= 24);
|
$startOfMonth = now()->startOfMonth();
|
||||||
|
$endOfMonth = now()->endOfMonth();
|
||||||
|
$upcomingList = $events->filter(function($e) use ($startOfMonth, $endOfMonth) {
|
||||||
|
$start = $e->start_time;
|
||||||
|
$end = $e->end_time ?: $e->start_time;
|
||||||
|
return $start->lte($endOfMonth) && $end->gte($startOfMonth);
|
||||||
|
});
|
||||||
@endphp
|
@endphp
|
||||||
@if($upcomingList->isNotEmpty())
|
@if($upcomingList->isNotEmpty())
|
||||||
<div class="flex gap-2 overflow-x-auto pb-2 mb-4 -mx-4 px-4 lg:mx-0 lg:px-0">
|
<div class="flex gap-2 overflow-x-auto pb-2 mb-4 -mx-4 px-4 lg:mx-0 lg:px-0">
|
||||||
@foreach($upcomingList->take(6) as $event)
|
@foreach($upcomingList as $event)
|
||||||
<div class="shrink-0 flex items-center gap-2 bg-white rounded-2xl border border-pink-100 px-3 py-2 shadow-sm">
|
<div class="shrink-0 flex items-center gap-2 bg-white rounded-2xl border border-pink-100 px-3 py-2 shadow-sm cursor-pointer hover:border-pink-300 transition-colors"
|
||||||
|
onclick="openAlertEventModal({{ json_encode(['id' => $event->id, 'title' => $event->title, 'type' => $event->event_type, 'status' => $event->status->value, 'client' => $event->client?->name, 'start' => $event->start_time->format('d M Y H:i'), 'end' => $event->end_time?->format('d M Y H:i'), 'location' => $event->location, 'description' => $event->description, 'notes' => $event->notes, 'has_contract' => $event->has_contract, 'has_content' => $event->has_content]) }})">
|
||||||
<div class="w-1.5 h-8 rounded-full shrink-0" style="background:{{ $event->color }}"></div>
|
<div class="w-1.5 h-8 rounded-full shrink-0" style="background:{{ $event->color }}"></div>
|
||||||
<div>
|
<div>
|
||||||
<div class="text-xs font-semibold text-gray-700 whitespace-nowrap">{{ $event->title }}</div>
|
<div class="text-xs font-semibold text-gray-700 whitespace-nowrap">{{ $event->title }}</div>
|
||||||
@@ -187,7 +91,7 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
headerToolbar: {
|
headerToolbar: {
|
||||||
left: 'prev,next today',
|
left: 'prev,next today',
|
||||||
center: 'title',
|
center: 'title',
|
||||||
right: isMobile ? 'listWeek,timeGridDay' : 'dayGridMonth,timeGridWeek,listWeek',
|
right: isMobile ? 'dayGridMonth,listWeek,timeGridDay' : 'dayGridMonth,timeGridWeek,listWeek',
|
||||||
},
|
},
|
||||||
editable: !isMobile,
|
editable: !isMobile,
|
||||||
selectable: true,
|
selectable: true,
|
||||||
@@ -195,11 +99,48 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
height: 'auto',
|
height: 'auto',
|
||||||
windowResize(view) {
|
windowResize(view) {
|
||||||
const mob = window.innerWidth < 640;
|
const mob = window.innerWidth < 640;
|
||||||
if (mob && calendar.view.type !== 'listWeek' && calendar.view.type !== 'timeGridDay') {
|
if (mob && calendar.view.type !== 'listWeek' && calendar.view.type !== 'timeGridDay' && calendar.view.type !== 'dayGridMonth') {
|
||||||
calendar.changeView('listWeek');
|
calendar.changeView('listWeek');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
dayCellDidMount(info) {
|
||||||
|
const holidays = @json($holidays ?? []);
|
||||||
|
const holidayMap = {};
|
||||||
|
holidays.forEach(h => holidayMap[h.date] = h.name);
|
||||||
|
|
||||||
|
const year = info.date.getFullYear();
|
||||||
|
const month = String(info.date.getMonth() + 1).padStart(2, '0');
|
||||||
|
const day = String(info.date.getDate()).padStart(2, '0');
|
||||||
|
const dateStr = `${year}-${month}-${day}`;
|
||||||
|
|
||||||
|
if (holidayMap[dateStr]) {
|
||||||
|
const frame = info.el.querySelector('.fc-daygrid-day-frame');
|
||||||
|
if (frame) {
|
||||||
|
// Update background color for the highlighted box
|
||||||
|
frame.style.backgroundColor = '#fff0f0'; // Light red highlighted box
|
||||||
|
frame.style.position = 'relative'; // Required for absolute positioning of text
|
||||||
|
|
||||||
|
// Add the holiday text to the top-left corner
|
||||||
|
const holidayEl = document.createElement('div');
|
||||||
|
holidayEl.textContent = holidayMap[dateStr];
|
||||||
|
holidayEl.style.position = 'absolute';
|
||||||
|
holidayEl.style.top = '4px';
|
||||||
|
holidayEl.style.left = '4px';
|
||||||
|
holidayEl.style.color = '#ef4444'; // Red text
|
||||||
|
holidayEl.style.fontSize = '0.70rem'; // Small text
|
||||||
|
holidayEl.style.fontWeight = '600';
|
||||||
|
holidayEl.style.whiteSpace = 'nowrap';
|
||||||
|
holidayEl.style.overflow = 'hidden';
|
||||||
|
holidayEl.style.textOverflow = 'ellipsis';
|
||||||
|
holidayEl.style.maxWidth = '75%'; // Prevent it from overlapping with the date number (usually on right)
|
||||||
|
holidayEl.style.zIndex = '1';
|
||||||
|
|
||||||
|
frame.appendChild(holidayEl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
eventDrop(info) {
|
eventDrop(info) {
|
||||||
fetch(`/schedule/${info.event.id}/dates`, {
|
fetch(`/schedule/${info.event.id}/dates`, {
|
||||||
method: 'PATCH',
|
method: 'PATCH',
|
||||||
@@ -208,8 +149,8 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').content,
|
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').content,
|
||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
start_time: info.event.startStr,
|
start_time: info.event.startStr ? info.event.startStr.substring(0, 19) : null,
|
||||||
end_time: info.event.endStr || null,
|
end_time: info.event.endStr ? info.event.endStr.substring(0, 19) : null,
|
||||||
}),
|
}),
|
||||||
}).then(r => r.ok ? window.KolManager.notify('Event rescheduled! 🐾') : info.revert());
|
}).then(r => r.ok ? window.KolManager.notify('Event rescheduled! 🐾') : info.revert());
|
||||||
},
|
},
|
||||||
@@ -226,11 +167,16 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
const e = info.event, p = e.extendedProps;
|
const e = info.event, p = e.extendedProps;
|
||||||
document.getElementById('modal-title').textContent = e.title;
|
document.getElementById('modal-title').textContent = e.title;
|
||||||
document.getElementById('modal-body').innerHTML = `
|
document.getElementById('modal-body').innerHTML = `
|
||||||
<div class="flex gap-2"><span class="text-gray-400 w-16 shrink-0">Type</span><span>${p.type}</span></div>
|
<div class="flex gap-2"><span class="text-gray-400 w-24 shrink-0">Type</span><span>${p.type}</span></div>
|
||||||
<div class="flex gap-2"><span class="text-gray-400 w-16 shrink-0">Status</span><span>${p.status}</span></div>
|
<div class="flex gap-2"><span class="text-gray-400 w-24 shrink-0">Status</span><span>${p.status}</span></div>
|
||||||
${p.client ? `<div class="flex gap-2"><span class="text-gray-400 w-16 shrink-0">Client</span><span>${p.client}</span></div>` : ''}
|
${p.client ? `<div class="flex gap-2"><span class="text-gray-400 w-24 shrink-0">Client</span><span>${p.client}</span></div>` : ''}
|
||||||
<div class="flex gap-2"><span class="text-gray-400 w-16 shrink-0">Start</span><span>${e.start?.toLocaleString()}</span></div>
|
${p.location ? `<div class="flex gap-2"><span class="text-gray-400 w-24 shrink-0">Location</span><span>${p.location}</span></div>` : ''}
|
||||||
${e.end ? `<div class="flex gap-2"><span class="text-gray-400 w-16 shrink-0">End</span><span>${e.end.toLocaleString()}</span></div>` : ''}
|
<div class="flex gap-2"><span class="text-gray-400 w-24 shrink-0">Start</span><span>${e.start?.toLocaleString()}</span></div>
|
||||||
|
${e.end ? `<div class="flex gap-2"><span class="text-gray-400 w-24 shrink-0">End</span><span>${e.end.toLocaleString()}</span></div>` : ''}
|
||||||
|
${p.description ? `<div class="flex gap-2"><span class="text-gray-400 w-24 shrink-0">Description</span><div class="flex-1 break-words whitespace-pre-wrap overflow-y-auto max-h-20 pr-1">${p.description}</div></div>` : ''}
|
||||||
|
${p.notes ? `<div class="flex gap-2"><span class="text-gray-400 w-24 shrink-0">Notes</span><div class="flex-1 break-words whitespace-pre-wrap overflow-y-auto max-h-20 pr-1">${p.notes}</div></div>` : ''}
|
||||||
|
${p.has_contract ? `<div class="flex gap-2"><span class="text-gray-400 w-24 shrink-0">Contract</span><span class="text-pink-500 font-semibold">Yes</span></div>` : ''}
|
||||||
|
${p.has_content ? `<div class="flex gap-2"><span class="text-gray-400 w-24 shrink-0">Content Bd</span><span class="text-pink-500 font-semibold">Yes</span></div>` : ''}
|
||||||
`;
|
`;
|
||||||
const editUrl = `/schedule/${e.id}/edit`;
|
const editUrl = `/schedule/${e.id}/edit`;
|
||||||
document.getElementById('modal-actions').innerHTML = `
|
document.getElementById('modal-actions').innerHTML = `
|
||||||
@@ -255,6 +201,33 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
// Note: datetime hidden fields are populated in contractCheck's submitIfClear()
|
// Note: datetime hidden fields are populated in contractCheck's submitIfClear()
|
||||||
// since @submit.prevent is used on the form (form.submit() bypasses native submit event)
|
// since @submit.prevent is used on the form (form.submit() bypasses native submit event)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function openAlertEventModal(e) {
|
||||||
|
document.getElementById('modal-title').textContent = e.title;
|
||||||
|
const startStr = e.start ? e.start : '—';
|
||||||
|
const endStr = e.end ? e.end : null;
|
||||||
|
document.getElementById('modal-body').innerHTML = `
|
||||||
|
<div class="flex gap-2"><span class="text-gray-400 w-24 shrink-0">Type</span><span>${e.type}</span></div>
|
||||||
|
<div class="flex gap-2"><span class="text-gray-400 w-24 shrink-0">Status</span><span>${e.status}</span></div>
|
||||||
|
${e.client ? `<div class="flex gap-2"><span class="text-gray-400 w-24 shrink-0">Client</span><span>${e.client}</span></div>` : ''}
|
||||||
|
${e.location ? `<div class="flex gap-2"><span class="text-gray-400 w-24 shrink-0">Location</span><span>${e.location}</span></div>` : ''}
|
||||||
|
<div class="flex gap-2"><span class="text-gray-400 w-24 shrink-0">Start</span><span>${startStr}</span></div>
|
||||||
|
${endStr ? `<div class="flex gap-2"><span class="text-gray-400 w-24 shrink-0">End</span><span>${endStr}</span></div>` : ''}
|
||||||
|
${e.description ? `<div class="flex gap-2"><span class="text-gray-400 w-24 shrink-0">Description</span><div class="flex-1 break-words whitespace-pre-wrap overflow-y-auto max-h-20 pr-1">${e.description}</div></div>` : ''}
|
||||||
|
${e.notes ? `<div class="flex gap-2"><span class="text-gray-400 w-24 shrink-0">Notes</span><div class="flex-1 break-words whitespace-pre-wrap overflow-y-auto max-h-20 pr-1">${e.notes}</div></div>` : ''}
|
||||||
|
${e.has_contract ? `<div class="flex gap-2"><span class="text-gray-400 w-24 shrink-0">Contract</span><span class="text-pink-500 font-semibold">Yes</span></div>` : ''}
|
||||||
|
${e.has_content ? `<div class="flex gap-2"><span class="text-gray-400 w-24 shrink-0">Content Bd</span><span class="text-pink-500 font-semibold">Yes</span></div>` : ''}
|
||||||
|
`;
|
||||||
|
document.getElementById('modal-actions').innerHTML = `
|
||||||
|
<a href="/schedule/${e.id}/edit" class="btn-sakura text-sm flex-1 text-center py-2">Edit</a>
|
||||||
|
<form method="POST" action="/schedule/${e.id}" onsubmit="return confirm('Delete?')" class="flex-1">
|
||||||
|
<input type="hidden" name="_method" value="DELETE">
|
||||||
|
<input type="hidden" name="_token" value="${document.querySelector('meta[name=csrf-token]').content}">
|
||||||
|
<button class="w-full py-2 rounded-full border border-red-200 text-red-400 text-sm hover:bg-red-50">Delete</button>
|
||||||
|
</form>
|
||||||
|
`;
|
||||||
|
document.getElementById('event-modal').classList.remove('hidden');
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{{-- Share scripts disabled --}}
|
{{-- Share scripts disabled --}}
|
||||||
|
|||||||
@@ -6,33 +6,19 @@
|
|||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
|
|
||||||
<form method="GET" action="{{ route('search.index') }}" class="mb-6">
|
@if(!$q)
|
||||||
<div class="relative max-w-xl">
|
|
||||||
<span class="absolute left-4 top-1/2 -translate-y-1/2 text-gray-400">🔍</span>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
name="q"
|
|
||||||
value="{{ e($q) }}"
|
|
||||||
placeholder="Search clients, events, invoices, content…"
|
|
||||||
class="input-soft pl-11 py-3 text-base w-full"
|
|
||||||
autofocus
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
@if(! $q)
|
|
||||||
<div class="text-center py-20 text-gray-400">
|
<div class="text-center py-20 text-gray-400">
|
||||||
<span class="text-5xl block mb-3">🔍</span>
|
<span class="text-5xl block mb-3">🔍</span>
|
||||||
<p class="text-base font-medium">Start typing to search across everything</p>
|
<p class="text-base font-medium">Start typing to search across everything</p>
|
||||||
<p class="text-sm mt-1">Clients, events, invoices, content briefs, rate cards</p>
|
<p class="text-sm mt-1">Clients, events, invoices, content briefs, rate cards</p>
|
||||||
</div>
|
</div>
|
||||||
@elseif(empty($results))
|
@elseif(empty($results))
|
||||||
<div class="text-center py-20 text-gray-400">
|
<div class="text-center py-20 text-gray-400">
|
||||||
<span class="text-5xl block mb-3">😿</span>
|
<span class="text-5xl block mb-3">😿</span>
|
||||||
<p class="text-base font-medium">No results for "{{ e($q) }}"</p>
|
<p class="text-base font-medium">No results for "{{ e($q) }}"</p>
|
||||||
<p class="text-sm mt-1">Try a different keyword</p>
|
<p class="text-sm mt-1">Try a different keyword</p>
|
||||||
</div>
|
</div>
|
||||||
@else
|
@else
|
||||||
<div class="space-y-6">
|
<div class="space-y-6">
|
||||||
@foreach($results as $group)
|
@foreach($results as $group)
|
||||||
<div class="cat-card overflow-hidden">
|
<div class="cat-card overflow-hidden">
|
||||||
@@ -57,6 +43,6 @@
|
|||||||
</div>
|
</div>
|
||||||
@endforeach
|
@endforeach
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@endsection
|
@endsection
|
||||||
File diff suppressed because one or more lines are too long
@@ -14,7 +14,7 @@ Artisan::command('notifications:dispatch', function () {
|
|||||||
$dispatcher = app(NotificationDispatcher::class);
|
$dispatcher = app(NotificationDispatcher::class);
|
||||||
$dispatcher->dispatchAll();
|
$dispatcher->dispatchAll();
|
||||||
$this->info('🔔 Notifications dispatched.');
|
$this->info('🔔 Notifications dispatched.');
|
||||||
})->purpose('Send all pending KOL Manager notifications');
|
})->purpose('Send all pending Cathy notifications');
|
||||||
|
|
||||||
// Run every hour automatically
|
// Run every hour automatically
|
||||||
Schedule::command('notifications:dispatch')->hourly();
|
Schedule::command('notifications:dispatch')->hourly();
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use App\Http\Controllers\BrandContractController;
|
use App\Http\Controllers\BrandContractController;
|
||||||
|
use App\Http\Controllers\GateController;
|
||||||
|
use App\Http\Controllers\NoteController;
|
||||||
use App\Http\Controllers\ClientCategoryController;
|
use App\Http\Controllers\ClientCategoryController;
|
||||||
use App\Http\Controllers\ClientController;
|
use App\Http\Controllers\ClientController;
|
||||||
use App\Http\Controllers\ContentBriefController;
|
use App\Http\Controllers\ContentBriefController;
|
||||||
@@ -17,13 +19,22 @@ use App\Http\Controllers\SearchController;
|
|||||||
use App\Http\Controllers\SocialHubController;
|
use App\Http\Controllers\SocialHubController;
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
|
// ── Gate Authentication ───────────────────────────────────────────────────────
|
||||||
|
Route::get('/login', [GateController::class, 'login'])->name('gate.login');
|
||||||
|
Route::post('/login', [GateController::class, 'attempt'])->name('gate.attempt');
|
||||||
|
Route::post('/logout', [GateController::class, 'logout'])->name('gate.logout');
|
||||||
|
|
||||||
Route::get('/', [DashboardController::class, 'index'])->name('dashboard');
|
Route::get('/', [DashboardController::class, 'index'])->name('dashboard');
|
||||||
|
|
||||||
// CRM – Clients
|
// CRM – Clients
|
||||||
|
Route::post('/clients/quick', [ClientController::class, 'quickStore'])->name('clients.quick-store');
|
||||||
Route::resource('clients', ClientController::class);
|
Route::resource('clients', ClientController::class);
|
||||||
|
Route::post('/clients/{client}/avatar', [ClientController::class, 'uploadAvatar'])->name('clients.upload-avatar');
|
||||||
|
Route::delete('/clients/{client}/avatar', [ClientController::class, 'deleteAvatar'])->name('clients.delete-avatar');
|
||||||
|
|
||||||
// Client Categories
|
// Client Categories
|
||||||
Route::prefix('client-categories')->name('client-categories.')->group(function (): void {
|
Route::prefix('client-categories')->name('client-categories.')->group(function (): void {
|
||||||
|
Route::post('/quick', [ClientCategoryController::class, 'quickStore'])->name('quick-store');
|
||||||
Route::get('/', [ClientCategoryController::class, 'index'])->name('index');
|
Route::get('/', [ClientCategoryController::class, 'index'])->name('index');
|
||||||
Route::post('/', [ClientCategoryController::class, 'store'])->name('store');
|
Route::post('/', [ClientCategoryController::class, 'store'])->name('store');
|
||||||
Route::put('/{category}', [ClientCategoryController::class, 'update'])->name('update');
|
Route::put('/{category}', [ClientCategoryController::class, 'update'])->name('update');
|
||||||
@@ -43,6 +54,7 @@ Route::prefix('contracts')->name('contracts.')->group(function (): void {
|
|||||||
// Schedule & Calendar
|
// Schedule & Calendar
|
||||||
Route::prefix('schedule')->name('schedule.')->group(function (): void {
|
Route::prefix('schedule')->name('schedule.')->group(function (): void {
|
||||||
Route::get('/', [EventController::class, 'index'])->name('index');
|
Route::get('/', [EventController::class, 'index'])->name('index');
|
||||||
|
Route::get('/create', [EventController::class, 'create'])->name('create');
|
||||||
Route::post('/', [EventController::class, 'store'])->name('store');
|
Route::post('/', [EventController::class, 'store'])->name('store');
|
||||||
Route::get('/{event}/edit', [EventController::class, 'edit'])->name('edit');
|
Route::get('/{event}/edit', [EventController::class, 'edit'])->name('edit');
|
||||||
Route::put('/{event}', [EventController::class, 'update'])->name('update');
|
Route::put('/{event}', [EventController::class, 'update'])->name('update');
|
||||||
@@ -60,14 +72,24 @@ Route::prefix('social-hub')->name('social-hub.')->group(function (): void {
|
|||||||
// Financial – Invoices
|
// Financial – Invoices
|
||||||
Route::resource('invoices', InvoiceController::class);
|
Route::resource('invoices', InvoiceController::class);
|
||||||
Route::get('/invoices/{invoice}/pdf', [InvoiceController::class, 'pdf'])->name('invoices.pdf');
|
Route::get('/invoices/{invoice}/pdf', [InvoiceController::class, 'pdf'])->name('invoices.pdf');
|
||||||
|
Route::get('/invoices/{invoice}/pdf-legacy', [InvoiceController::class, 'pdfLegacy'])->name('invoices.pdf-legacy');
|
||||||
Route::get('/invoice-settings', [InvoiceSettingsController::class, 'edit'])->name('invoice-settings.edit');
|
Route::get('/invoice-settings', [InvoiceSettingsController::class, 'edit'])->name('invoice-settings.edit');
|
||||||
Route::post('/invoice-settings', [InvoiceSettingsController::class, 'update'])->name('invoice-settings.update');
|
Route::post('/invoice-settings', [InvoiceSettingsController::class, 'update'])->name('invoice-settings.update');
|
||||||
|
Route::post('/invoice-settings/logo', [InvoiceSettingsController::class, 'uploadLogo'])->name('invoice-settings.upload-logo');
|
||||||
|
Route::delete('/invoice-settings/logo', [InvoiceSettingsController::class, 'deleteLogo'])->name('invoice-settings.delete-logo');
|
||||||
|
Route::post('/invoice-settings/signature', [InvoiceSettingsController::class, 'uploadSignature'])->name('invoice-settings.upload-signature');
|
||||||
|
Route::delete('/invoice-settings/signature', [InvoiceSettingsController::class, 'deleteSignature'])->name('invoice-settings.delete-signature');
|
||||||
|
|
||||||
// Financial – Rate Cards
|
// Financial – Rate Cards
|
||||||
Route::get('/rate-cards/public', [RateCardController::class, 'public'])->name('rate-cards.public');
|
Route::get('/rate-cards/public', [RateCardController::class, 'public'])->name('rate-cards.public');
|
||||||
Route::get('/rate-cards/pdf', [RateCardController::class, 'pdf'])->name('rate-cards.pdf');
|
Route::get('/rate-cards/pdf', [RateCardController::class, 'pdf'])->name('rate-cards.pdf');
|
||||||
Route::get('/rate-cards/profile', [RateCardController::class, 'profilePage'])->name('rate-cards.profile');
|
Route::get('/rate-cards/profile', [RateCardController::class, 'profilePage'])->name('rate-cards.profile');
|
||||||
Route::post('/rate-cards/profile', [RateCardController::class, 'profileUpdate'])->name('rate-cards.profile.update');
|
Route::post('/rate-cards/profile', [RateCardController::class, 'profileUpdate'])->name('rate-cards.profile.update');
|
||||||
|
Route::post('/rate-cards/profile/logo', [RateCardController::class, 'uploadLogo'])->name('rate-cards.profile.upload-logo');
|
||||||
|
Route::delete('/rate-cards/profile/logo', [RateCardController::class, 'deleteLogo'])->name('rate-cards.profile.delete-logo');
|
||||||
|
Route::post('/rate-cards/profile/brand-logo', [RateCardController::class, 'uploadBrandLogo'])->name('rate-cards.profile.upload-brand-logo');
|
||||||
|
Route::delete('/rate-cards/profile/brand-logo', [RateCardController::class, 'deleteBrandLogo'])->name('rate-cards.profile.delete-brand-logo');
|
||||||
|
Route::post('/rate-cards/profile/content-thumbnail', [RateCardController::class, 'uploadShowcaseThumbnail'])->name('rate-cards.profile.upload-showcase-thumbnail');
|
||||||
Route::get('/files/profile-logo', [RateCardController::class, 'serveProfileLogo'])->name('files.serve-profile-logo');
|
Route::get('/files/profile-logo', [RateCardController::class, 'serveProfileLogo'])->name('files.serve-profile-logo');
|
||||||
Route::resource('rate-cards', RateCardController::class)->except(['show']);
|
Route::resource('rate-cards', RateCardController::class)->except(['show']);
|
||||||
|
|
||||||
@@ -97,6 +119,15 @@ Route::prefix('search')->name('search.')->group(function (): void {
|
|||||||
Route::get('/quick', [SearchController::class, 'quick'])->name('quick');
|
Route::get('/quick', [SearchController::class, 'quick'])->name('quick');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Notes
|
||||||
|
Route::prefix('notes')->name('notes.')->group(function (): void {
|
||||||
|
Route::get('/', [NoteController::class, 'index'])->name('index');
|
||||||
|
Route::post('/', [NoteController::class, 'store'])->name('store');
|
||||||
|
Route::put('/{note}', [NoteController::class, 'update'])->name('update');
|
||||||
|
Route::delete('/{note}', [NoteController::class, 'destroy'])->name('destroy');
|
||||||
|
Route::patch('/{note}/pin', [NoteController::class, 'togglePin'])->name('toggle-pin');
|
||||||
|
});
|
||||||
|
|
||||||
// Settings
|
// Settings
|
||||||
Route::prefix('settings')->name('settings.')->group(function (): void {
|
Route::prefix('settings')->name('settings.')->group(function (): void {
|
||||||
Route::get('/notifications', [NotificationSettingController::class, 'index'])->name('notifications');
|
Route::get('/notifications', [NotificationSettingController::class, 'index'])->name('notifications');
|
||||||
|
|||||||
Reference in New Issue
Block a user