Add contract management and invoice settings pages
- Created a new Blade view for managing brand contracts with forms for adding and editing contracts, including client and category selection. - Implemented success message notifications for contract actions. - Added a new Blade view for invoice settings, allowing customization of invoice number format, header branding, and default values for new invoices. - Introduced a new PDF view for generating rate cards with customizable styles based on user profile settings. - Developed a profile management page for rate cards, enabling users to update their identity, appearance, and visibility settings.
This commit is contained in:
@@ -31,9 +31,9 @@
|
||||
<div>
|
||||
<label class="block text-sm font-semibold text-gray-700 mb-1">Currency</label>
|
||||
<select name="currency" class="input-soft">
|
||||
<option value="IDR" selected>IDR (Rupiah)</option>
|
||||
<option value="USD">USD (Dollar)</option>
|
||||
<option value="SGD">SGD</option>
|
||||
@foreach(['IDR' => 'IDR (Rupiah)', 'USD' => 'USD (Dollar)', 'SGD' => 'SGD', 'MYR' => 'MYR (Ringgit)'] as $code => $label)
|
||||
<option value="{{ $code }}" {{ old('currency', $invoiceSettings->default_currency ?? 'IDR') === $code ? 'selected' : '' }}>{{ $label }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
@@ -50,7 +50,7 @@
|
||||
<div>
|
||||
<label class="block text-sm font-semibold text-gray-700 mb-1">Tax Rate (%)</label>
|
||||
<input type="number" name="tax_rate" x-model="taxRate" @input="recalc()"
|
||||
value="{{ old('tax_rate', 11) }}" class="input-soft" step="0.01">
|
||||
value="{{ old('tax_rate', $invoiceSettings->default_tax_rate ?? 11) }}" class="input-soft" step="0.01">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -93,6 +93,18 @@
|
||||
<button type="button" @click="removeItem(index)"
|
||||
class="text-red-400 hover:text-red-600 text-lg shrink-0 pt-4">✕</button>
|
||||
</div>
|
||||
{{-- Taxable checkbox --}}
|
||||
<div class="mt-2 flex items-center gap-2">
|
||||
<input type="hidden" :name="`items[${index}][is_taxable]`" value="0">
|
||||
<input type="checkbox" :name="`items[${index}][is_taxable]`"
|
||||
:id="`taxable_${index}`"
|
||||
x-model="item.is_taxable" @change="recalc()"
|
||||
value="1"
|
||||
class="w-3.5 h-3.5 accent-pink-400">
|
||||
<label :for="`taxable_${index}`" class="text-xs text-gray-500 cursor-pointer select-none">
|
||||
Taxable
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
@@ -101,34 +113,43 @@
|
||||
{{-- Totals --}}
|
||||
<div class="bg-pink-50 rounded-2xl p-4 mb-5">
|
||||
<div class="flex justify-between text-sm py-1">
|
||||
<span class="text-gray-500">Subtotal</span>
|
||||
<span class="text-gray-500">Subtotal (all items)</span>
|
||||
<span class="font-semibold">Rp <span x-text="formatNum(subtotal)"></span></span>
|
||||
</div>
|
||||
<div class="flex justify-between text-sm py-1">
|
||||
<span class="text-gray-500">Tax (<span x-text="taxRate"></span>%)</span>
|
||||
<div class="flex justify-between text-sm py-1 text-amber-600">
|
||||
<span>Tax (<span x-text="taxRate"></span>% — paid by client)</span>
|
||||
<span class="font-semibold">Rp <span x-text="formatNum(taxAmount)"></span></span>
|
||||
</div>
|
||||
<div class="flex justify-between text-base font-bold py-2 mt-1 border-t border-pink-200">
|
||||
<span class="text-gray-700">Total</span>
|
||||
<span class="text-gray-700">Total (you receive)</span>
|
||||
<span class="text-pink-600">Rp <span x-text="formatNum(total)"></span></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- Bank Info --}}
|
||||
<div class="grid grid-cols-1 sm:grid-cols-3 gap-3 mb-5">
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3 mb-5">
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Bank Name</label>
|
||||
<input type="text" name="bank_name" value="{{ old('bank_name') }}"
|
||||
<input type="text" name="bank_name"
|
||||
value="{{ old('bank_name', $invoiceSettings->default_bank_name) }}"
|
||||
class="input-soft text-sm" placeholder="BCA, Mandiri...">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Branch Name</label>
|
||||
<input type="text" name="branch_name"
|
||||
value="{{ old('branch_name', $invoiceSettings->default_branch_name) }}"
|
||||
class="input-soft text-sm" placeholder="e.g. KCP Sudirman">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Account Number</label>
|
||||
<input type="text" name="bank_account" value="{{ old('bank_account') }}"
|
||||
<input type="text" name="bank_account"
|
||||
value="{{ old('bank_account', $invoiceSettings->default_bank_account) }}"
|
||||
class="input-soft text-sm">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Account Holder</label>
|
||||
<input type="text" name="bank_holder" value="{{ old('bank_holder') }}"
|
||||
<input type="text" name="bank_holder"
|
||||
value="{{ old('bank_holder', $invoiceSettings->default_bank_holder) }}"
|
||||
class="input-soft text-sm">
|
||||
</div>
|
||||
</div>
|
||||
@@ -136,7 +157,7 @@
|
||||
<div class="mb-5">
|
||||
<label class="block text-sm font-semibold text-gray-700 mb-1">Notes</label>
|
||||
<textarea name="notes" rows="2" class="input-soft resize-none"
|
||||
placeholder="Payment terms, etc.">{{ old('notes') }}</textarea>
|
||||
placeholder="Payment terms, etc.">{{ old('notes', $invoiceSettings->default_notes) }}</textarea>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col sm:flex-row gap-3">
|
||||
@@ -154,15 +175,22 @@
|
||||
<script>
|
||||
function invoiceForm() {
|
||||
return {
|
||||
items: [{ description: '', quantity: 1, unit_price: 0 }],
|
||||
taxRate: 11,
|
||||
get subtotal() { return this.items.reduce((s, i) => s + (i.quantity * i.unit_price), 0); },
|
||||
get taxAmount() { return Math.round(this.subtotal * this.taxRate / 100); },
|
||||
get total() { return this.subtotal + this.taxAmount; },
|
||||
addItem() { this.items.push({ description: '', quantity: 1, unit_price: 0 }); },
|
||||
removeItem(i) { if (this.items.length > 1) this.items.splice(i, 1); },
|
||||
recalc() {},
|
||||
formatNum(n) { return Number(n).toLocaleString('id-ID'); },
|
||||
items: [{ description: '{{ addslashes($invoiceSettings->default_service_description ?? '') }}', quantity: 1, unit_price: 0, is_taxable: true }],
|
||||
taxRate: {{ $invoiceSettings->default_tax_rate ?? 11 }},
|
||||
get subtotal() {
|
||||
return this.items.reduce((s, i) => s + (i.quantity * i.unit_price), 0);
|
||||
},
|
||||
get taxAmount() {
|
||||
const taxable = this.items
|
||||
.filter(i => i.is_taxable)
|
||||
.reduce((s, i) => s + (i.quantity * i.unit_price), 0);
|
||||
return Math.round(taxable * this.taxRate / 100);
|
||||
},
|
||||
get total() { return this.subtotal; }, // grand total = pre-tax (tax borne by client)
|
||||
addItem() { this.items.push({ description: '', quantity: 1, unit_price: 0, is_taxable: true }); },
|
||||
removeItem(i) { if (this.items.length > 1) this.items.splice(i, 1); },
|
||||
recalc() {},
|
||||
formatNum(n) { return Number(n).toLocaleString('id-ID'); },
|
||||
};
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -88,6 +88,18 @@
|
||||
<button type="button" @click="removeItem(index)"
|
||||
class="text-red-400 hover:text-red-600 text-lg shrink-0 pt-4">✕</button>
|
||||
</div>
|
||||
{{-- Taxable checkbox --}}
|
||||
<div class="mt-2 flex items-center gap-2">
|
||||
<input type="hidden" :name="`items[${index}][is_taxable]`" value="0">
|
||||
<input type="checkbox" :name="`items[${index}][is_taxable]`"
|
||||
:id="`taxable_${index}`"
|
||||
x-model="item.is_taxable" @change="recalc()"
|
||||
value="1"
|
||||
class="w-3.5 h-3.5 accent-pink-400">
|
||||
<label :for="`taxable_${index}`" class="text-xs text-gray-500 cursor-pointer select-none">
|
||||
Taxable
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
@@ -96,26 +108,31 @@
|
||||
{{-- Totals --}}
|
||||
<div class="bg-pink-50 rounded-2xl p-4 mb-5">
|
||||
<div class="flex justify-between text-sm py-1">
|
||||
<span class="text-gray-500">Subtotal</span>
|
||||
<span class="text-gray-500">Subtotal (all items)</span>
|
||||
<span class="font-semibold">Rp <span x-text="formatNum(subtotal)"></span></span>
|
||||
</div>
|
||||
<div class="flex justify-between text-sm py-1">
|
||||
<span class="text-gray-500">Tax (<span x-text="taxRate"></span>%)</span>
|
||||
<div class="flex justify-between text-sm py-1 text-amber-600">
|
||||
<span>Tax (<span x-text="taxRate"></span>% — paid by client)</span>
|
||||
<span class="font-semibold">Rp <span x-text="formatNum(taxAmount)"></span></span>
|
||||
</div>
|
||||
<div class="flex justify-between text-base font-bold py-2 mt-1 border-t border-pink-200">
|
||||
<span class="text-gray-700">Total</span>
|
||||
<span class="text-gray-700">Total (you receive)</span>
|
||||
<span class="text-pink-600">Rp <span x-text="formatNum(total)"></span></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- Bank Info --}}
|
||||
<div class="grid grid-cols-1 sm:grid-cols-3 gap-3 mb-5">
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3 mb-5">
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Bank Name</label>
|
||||
<input type="text" name="bank_name" value="{{ old('bank_name', $invoice->bank_name) }}"
|
||||
class="input-soft text-sm">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Branch Name</label>
|
||||
<input type="text" name="branch_name" value="{{ old('branch_name', $invoice->branch_name) }}"
|
||||
class="input-soft text-sm" placeholder="e.g. KCP Sudirman">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Account Number</label>
|
||||
<input type="text" name="bank_account" value="{{ old('bank_account', $invoice->bank_account) }}"
|
||||
@@ -147,13 +164,25 @@
|
||||
@push('scripts')
|
||||
<script>
|
||||
function invoiceEditForm() {
|
||||
@php
|
||||
$itemsJson = $invoice->items->map(function($i) {
|
||||
return ['description' => $i->description, 'quantity' => $i->quantity, 'unit_price' => (float)$i->unit_price, 'is_taxable' => (bool)$i->is_taxable];
|
||||
});
|
||||
@endphp
|
||||
return {
|
||||
items: @json($invoice->items->map(fn($i) => ['description' => $i->description, 'quantity' => $i->quantity, 'unit_price' => (float)$i->unit_price])),
|
||||
items: @json($itemsJson),
|
||||
taxRate: {{ $invoice->tax_rate }},
|
||||
get subtotal() { return this.items.reduce((s, i) => s + (i.quantity * i.unit_price), 0); },
|
||||
get taxAmount() { return Math.round(this.subtotal * this.taxRate / 100); },
|
||||
get total() { return this.subtotal + this.taxAmount; },
|
||||
addItem() { this.items.push({ description: '', quantity: 1, unit_price: 0 }); },
|
||||
get subtotal() {
|
||||
return this.items.reduce((s, i) => s + (i.quantity * i.unit_price), 0);
|
||||
},
|
||||
get taxAmount() {
|
||||
const taxable = this.items
|
||||
.filter(i => i.is_taxable)
|
||||
.reduce((s, i) => s + (i.quantity * i.unit_price), 0);
|
||||
return Math.round(taxable * this.taxRate / 100);
|
||||
},
|
||||
get total() { return this.subtotal; },
|
||||
addItem() { this.items.push({ description: '', quantity: 1, unit_price: 0, is_taxable: true }); },
|
||||
removeItem(i) { if (this.items.length > 1) this.items.splice(i, 1); },
|
||||
recalc() {},
|
||||
formatNum(n) { return Number(n).toLocaleString('id-ID'); },
|
||||
|
||||
@@ -18,7 +18,13 @@
|
||||
</a>
|
||||
@endforeach
|
||||
</div>
|
||||
<a href="{{ route('invoices.create') }}" class="btn-sakura text-sm shrink-0">+ New Invoice</a>
|
||||
<div class="flex gap-2 shrink-0">
|
||||
<a href="{{ route('invoice-settings.edit') }}"
|
||||
class="text-xs px-3 py-2 rounded-full border border-gray-200 text-gray-500 hover:bg-gray-50 flex items-center gap-1">
|
||||
⚙️ Settings
|
||||
</a>
|
||||
<a href="{{ route('invoices.create') }}" class="btn-sakura text-sm">+ New Invoice</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- Mobile card list --}}
|
||||
@@ -41,6 +47,7 @@
|
||||
<a href="{{ route('invoices.show', $invoice) }}" class="flex-1 text-center text-xs py-1.5 px-3 rounded-full border border-pink-200 text-pink-600 hover:bg-pink-50">View</a>
|
||||
<a href="{{ route('invoices.pdf', $invoice) }}" target="_blank" class="flex-1 text-center text-xs py-1.5 px-3 rounded-full border border-pink-200 text-pink-600 hover:bg-pink-50">PDF</a>
|
||||
<a href="{{ route('invoices.edit', $invoice) }}" class="flex-1 text-center text-xs py-1.5 px-3 rounded-full border border-pink-200 text-gray-600 hover:bg-pink-50">Edit</a>
|
||||
{{-- Share button disabled --}}
|
||||
</div>
|
||||
</div>
|
||||
@empty
|
||||
@@ -85,6 +92,7 @@
|
||||
<a href="{{ route('invoices.show', $invoice) }}" class="text-xs text-pink-500 hover:underline">View</a>
|
||||
<a href="{{ route('invoices.pdf', $invoice) }}" class="text-xs text-pink-500 hover:underline" target="_blank">PDF</a>
|
||||
<a href="{{ route('invoices.edit', $invoice) }}" class="text-xs text-gray-500 hover:underline">Edit</a>
|
||||
{{-- Share button disabled --}}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -100,4 +108,5 @@
|
||||
</div>
|
||||
|
||||
<div class="mt-4">{{ $invoices->links() }}</div>
|
||||
{{-- Share scripts disabled --}}
|
||||
@endsection
|
||||
|
||||
@@ -38,9 +38,15 @@
|
||||
<body>
|
||||
|
||||
<div class="header">
|
||||
<div>
|
||||
<div class="logo">🐱 KOL Manager</div>
|
||||
<div class="logo-sub">Personal Talent Assistant</div>
|
||||
<div style="display:flex; align-items:center; gap:12px;">
|
||||
@if($invoiceSettings->header_logo && file_exists(storage_path('app/public/' . $invoiceSettings->header_logo)))
|
||||
<img src="{{ storage_path('app/public/' . $invoiceSettings->header_logo) }}"
|
||||
style="width:52px; height:52px; object-fit:cover; border-radius:12px;" alt="Logo">
|
||||
@endif
|
||||
<div>
|
||||
<div class="logo">{{ $invoiceSettings->header_name ?: 'KOL Manager' }}</div>
|
||||
<div class="logo-sub">{{ $invoiceSettings->header_title ?: 'Personal Talent Assistant' }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="text-align:right">
|
||||
<div class="inv-number">{{ $invoice->invoice_number }}</div>
|
||||
@@ -97,15 +103,21 @@
|
||||
<div class="totals">
|
||||
<div class="totals-box">
|
||||
<div class="totals-row"><span>Subtotal</span><span>Rp {{ number_format($invoice->subtotal, 0, ',', '.') }}</span></div>
|
||||
<div class="totals-row"><span>Tax ({{ $invoice->tax_rate }}%)</span><span>Rp {{ number_format($invoice->tax_amount, 0, ',', '.') }}</span></div>
|
||||
<div class="totals-row total"><span>Total</span><span>{{ $invoice->formatted_total }}</span></div>
|
||||
@if($invoice->tax_rate > 0)
|
||||
<div class="totals-row" style="color:#D97706"><span>Tax ({{ $invoice->tax_rate }}% — paid by client)</span><span>Rp {{ number_format($invoice->tax_amount, 0, ',', '.') }}</span></div>
|
||||
@endif
|
||||
<div class="totals-row total"><span>Total (you receive)</span><span>{{ $invoice->formatted_total }}</span></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if($invoice->bank_name)
|
||||
<div class="bank-box">
|
||||
<div class="bank-title">💳 Payment Information</div>
|
||||
<div class="bank-detail">{{ $invoice->bank_name }} · {{ $invoice->bank_account }} · a/n {{ $invoice->bank_holder }}</div>
|
||||
<div class="bank-title">Payment Information</div>
|
||||
<div class="bank-detail">
|
||||
{{ $invoice->bank_name }}
|
||||
@if($invoice->branch_name) · {{ $invoice->branch_name }} @endif
|
||||
· {{ $invoice->bank_account }} · a/n {{ $invoice->bank_holder }}
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
|
||||
175
resources/views/invoices/settings.blade.php
Normal file
175
resources/views/invoices/settings.blade.php
Normal file
@@ -0,0 +1,175 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('title', 'Invoice Settings')
|
||||
@section('page-title', 'Invoice Settings 🧾')
|
||||
@section('page-subtitle', 'Customize number format, header, and invoice defaults')
|
||||
|
||||
@section('content')
|
||||
<div class="max-w-2xl mx-auto">
|
||||
<div class="flex items-center gap-3 mb-5">
|
||||
<a href="{{ route('invoices.index') }}"
|
||||
class="text-xs px-3 py-2 rounded-full border border-pink-200 text-gray-500 hover:bg-pink-50">
|
||||
← Back to Invoices
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@if(session('success'))
|
||||
<div x-data="{ show: true }" x-show="show" x-init="setTimeout(() => show = false, 4000)"
|
||||
class="flex items-center justify-between gap-3 bg-green-50 border border-green-200 rounded-2xl px-4 py-3 text-sm text-green-700 mb-4">
|
||||
<span>{{ session('success') }}</span>
|
||||
<button @click="show = false" class="text-green-500 hover:text-green-700 text-lg leading-none">✕</button>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<form action="{{ route('invoice-settings.update') }}" method="POST" enctype="multipart/form-data"
|
||||
class="space-y-5">
|
||||
@csrf
|
||||
|
||||
{{-- Number Format --}}
|
||||
<div class="cat-card p-5">
|
||||
<h2 class="text-sm font-bold text-gray-700 mb-4 flex items-center gap-2">🔢 Invoice Number Format</h2>
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">
|
||||
Prefix <span class="text-pink-400">*</span>
|
||||
</label>
|
||||
<input type="text" name="invoice_prefix"
|
||||
value="{{ old('invoice_prefix', $settings->invoice_prefix) }}"
|
||||
class="input-soft text-sm" placeholder="INV-EA" required
|
||||
id="prefix-input" oninput="updatePreview()">
|
||||
<p class="text-xs text-gray-400 mt-1">e.g. <code>INV-EA</code> → <strong>INV-EA-001</strong></p>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">
|
||||
Next Number <span class="text-pink-400">*</span>
|
||||
</label>
|
||||
<input type="number" name="invoice_next_number"
|
||||
value="{{ old('invoice_next_number', $settings->invoice_next_number) }}"
|
||||
class="input-soft text-sm" min="1" required
|
||||
id="number-input" oninput="updatePreview()">
|
||||
<p class="text-xs text-gray-400 mt-1">Used for the next new invoice</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-3 bg-pink-50 rounded-xl px-4 py-2.5 text-sm text-gray-600">
|
||||
Preview: <strong class="text-pink-600" id="number-preview">
|
||||
{{ rtrim(old('invoice_prefix', $settings->invoice_prefix), '-') }}-{{ str_pad((string) (old('invoice_next_number', $settings->invoice_next_number) ?? 1), 3, '0', STR_PAD_LEFT) }}
|
||||
</strong>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- Header / Branding --}}
|
||||
<div class="cat-card p-5">
|
||||
<h2 class="text-sm font-bold text-gray-700 mb-4 flex items-center gap-2">🎨 Invoice Header</h2>
|
||||
|
||||
@if($settings->header_logo)
|
||||
<div class="mb-3 flex items-center gap-3">
|
||||
<img src="{{ asset('storage/' . $settings->header_logo) }}"
|
||||
alt="Logo" class="h-16 w-16 object-cover rounded-2xl border border-pink-100">
|
||||
<div>
|
||||
<p class="text-xs font-semibold text-gray-600">Current Logo</p>
|
||||
<p class="text-xs text-gray-400 mt-0.5">Upload a new file to replace it</p>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
||||
<div class="sm:col-span-2">
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Logo / Profile Picture</label>
|
||||
<input type="file" name="header_logo" accept="image/*"
|
||||
class="w-full text-sm text-gray-600
|
||||
file:mr-3 file:py-1.5 file:px-4
|
||||
file:rounded-full file:border-0
|
||||
file:text-xs file:font-semibold
|
||||
file:bg-pink-50 file:text-pink-600
|
||||
hover:file:bg-pink-100 cursor-pointer">
|
||||
<p class="text-xs text-gray-400 mt-1">Max 2 MB. Shown at the top-left of your invoice.</p>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Talent / Business Name</label>
|
||||
<input type="text" name="header_name"
|
||||
value="{{ old('header_name', $settings->header_name) }}"
|
||||
class="input-soft text-sm" placeholder="Your name or brand">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Title / Tagline</label>
|
||||
<input type="text" name="header_title"
|
||||
value="{{ old('header_title', $settings->header_title) }}"
|
||||
class="input-soft text-sm" placeholder="Content Creator · KOL">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- Invoice Defaults --}}
|
||||
<div class="cat-card p-5">
|
||||
<h2 class="text-sm font-bold text-gray-700 mb-4 flex items-center gap-2">📋 Invoice Defaults</h2>
|
||||
<p class="text-xs text-gray-400 mb-4">These values will pre-fill every new invoice you create.</p>
|
||||
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Default Tax Rate (%)</label>
|
||||
<input type="number" name="default_tax_rate" step="0.01" min="0" max="100"
|
||||
value="{{ old('default_tax_rate', $settings->default_tax_rate ?? 11) }}"
|
||||
class="input-soft text-sm" placeholder="11">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Default Currency</label>
|
||||
<select name="default_currency" class="input-soft text-sm">
|
||||
@foreach(['IDR' => 'IDR (Rupiah)', 'USD' => 'USD (Dollar)', 'SGD' => 'SGD', 'MYR' => 'MYR (Ringgit)'] as $code => $label)
|
||||
<option value="{{ $code }}" {{ old('default_currency', $settings->default_currency ?? 'IDR') === $code ? 'selected' : '' }}>
|
||||
{{ $label }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="sm:col-span-2">
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Default Service Description</label>
|
||||
<input type="text" name="default_service_description"
|
||||
value="{{ old('default_service_description', $settings->default_service_description) }}"
|
||||
class="input-soft text-sm" placeholder="e.g. Instagram Feed Post — 1 carousel">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Default Bank Name</label>
|
||||
<input type="text" name="default_bank_name"
|
||||
value="{{ old('default_bank_name', $settings->default_bank_name) }}"
|
||||
class="input-soft text-sm" placeholder="BCA, Mandiri…">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Default Branch Name</label>
|
||||
<input type="text" name="default_branch_name"
|
||||
value="{{ old('default_branch_name', $settings->default_branch_name) }}"
|
||||
class="input-soft text-sm" placeholder="KCP Sudirman">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Default Account Number</label>
|
||||
<input type="text" name="default_bank_account"
|
||||
value="{{ old('default_bank_account', $settings->default_bank_account) }}"
|
||||
class="input-soft text-sm" placeholder="1234567890">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Default Account Holder</label>
|
||||
<input type="text" name="default_bank_holder"
|
||||
value="{{ old('default_bank_holder', $settings->default_bank_holder) }}"
|
||||
class="input-soft text-sm" placeholder="Your full name">
|
||||
</div>
|
||||
<div class="sm:col-span-2">
|
||||
<label class="block text-xs font-semibold text-gray-600 mb-1">Default Notes / Payment Terms</label>
|
||||
<textarea name="default_notes" rows="2" class="input-soft text-sm resize-none"
|
||||
placeholder="e.g. Payment due within 14 days from invoice date.">{{ old('default_notes', $settings->default_notes) }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn-sakura w-full py-3">💾 Save Settings</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@push('scripts')
|
||||
<script>
|
||||
function updatePreview() {
|
||||
const prefix = document.getElementById('prefix-input').value.replace(/-+$/, '') || 'INV';
|
||||
const num = parseInt(document.getElementById('number-input').value) || 1;
|
||||
document.getElementById('number-preview').textContent = prefix + '-' + String(num).padStart(3, '0');
|
||||
}
|
||||
</script>
|
||||
@endpush
|
||||
@endsection
|
||||
@@ -18,9 +18,19 @@
|
||||
<div class="cat-card p-8">
|
||||
{{-- Invoice Header --}}
|
||||
<div class="flex justify-between items-start mb-8">
|
||||
<div>
|
||||
<div class="text-2xl font-extrabold text-pink-500 flex items-center gap-2">🐱 KOL Manager</div>
|
||||
<div class="text-sm text-gray-400 mt-1">Personal Talent Assistant</div>
|
||||
<div class="flex items-center gap-3">
|
||||
@if($invoiceSettings->header_logo)
|
||||
<img src="{{ asset('storage/' . $invoiceSettings->header_logo) }}"
|
||||
alt="Logo" class="h-14 w-14 object-cover rounded-2xl border border-pink-100 shrink-0">
|
||||
@endif
|
||||
<div>
|
||||
<div class="text-xl font-extrabold text-pink-500">
|
||||
{{ $invoiceSettings->header_name ?: '🐱 KOL Manager' }}
|
||||
</div>
|
||||
<div class="text-sm text-gray-400 mt-0.5">
|
||||
{{ $invoiceSettings->header_title ?: 'Personal Talent Assistant' }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-right">
|
||||
<div class="text-2xl font-bold text-gray-800">{{ $invoice->invoice_number }}</div>
|
||||
@@ -75,15 +85,18 @@
|
||||
|
||||
{{-- Totals --}}
|
||||
<div class="flex justify-end mb-8">
|
||||
<div class="w-64 space-y-2 text-sm">
|
||||
<div class="w-72 space-y-2 text-sm">
|
||||
<div class="flex justify-between text-gray-500">
|
||||
<span>Subtotal</span><span class="font-medium">Rp {{ number_format($invoice->subtotal, 0, ',', '.') }}</span>
|
||||
</div>
|
||||
<div class="flex justify-between text-gray-500">
|
||||
<span>Tax ({{ $invoice->tax_rate }}%)</span><span class="font-medium">Rp {{ number_format($invoice->tax_amount, 0, ',', '.') }}</span>
|
||||
@if($invoice->tax_rate > 0)
|
||||
<div class="flex justify-between text-amber-600">
|
||||
<span>Tax ({{ $invoice->tax_rate }}% — paid by client)</span>
|
||||
<span class="font-medium">Rp {{ number_format($invoice->tax_amount, 0, ',', '.') }}</span>
|
||||
</div>
|
||||
@endif
|
||||
<div class="flex justify-between text-base font-bold text-pink-600 pt-2 border-t border-pink-200">
|
||||
<span>Total</span><span>{{ $invoice->formatted_total }}</span>
|
||||
<span>Total (you receive)</span><span>{{ $invoice->formatted_total }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -92,7 +105,11 @@
|
||||
@if($invoice->bank_name)
|
||||
<div class="bg-pink-50 rounded-2xl p-4 text-sm">
|
||||
<div class="font-semibold text-gray-700 mb-2">💳 Payment Info</div>
|
||||
<div class="text-gray-600">{{ $invoice->bank_name }} · {{ $invoice->bank_account }} · {{ $invoice->bank_holder }}</div>
|
||||
<div class="text-gray-600">
|
||||
{{ $invoice->bank_name }}
|
||||
@if($invoice->branch_name) · {{ $invoice->branch_name }} @endif
|
||||
· {{ $invoice->bank_account }} · a/n {{ $invoice->bank_holder }}
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user