diff --git a/app/Http/Controllers/InvoiceController.php b/app/Http/Controllers/InvoiceController.php index edc1771..785953f 100644 --- a/app/Http/Controllers/InvoiceController.php +++ b/app/Http/Controllers/InvoiceController.php @@ -46,6 +46,8 @@ class InvoiceController extends Controller 'due_date' => 'required|date|after_or_equal:issue_date', '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_account' => 'nullable|string|max:50', 'bank_holder' => 'nullable|string|max:100', @@ -108,6 +110,8 @@ class InvoiceController extends Controller 'paid_date' => 'nullable|date', '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_account' => 'nullable|string|max:50', 'bank_holder' => 'nullable|string|max:100', diff --git a/app/Models/Invoice.php b/app/Models/Invoice.php index cd1b2fb..0551896 100644 --- a/app/Models/Invoice.php +++ b/app/Models/Invoice.php @@ -21,7 +21,7 @@ class Invoice extends Model 'subtotal', 'tax_rate', 'tax_amount', 'total', 'currency', 'status', 'issue_date', 'due_date', 'paid_date', 'notes', 'bank_name', 'bank_account', 'bank_holder', 'branch_name', - 'signature_image', + 'signature_image', 'signer_name', 'signer_title', ]; protected $casts = [ diff --git a/database/migrations/2026_04_05_000002_add_signer_details_to_invoices.php b/database/migrations/2026_04_05_000002_add_signer_details_to_invoices.php new file mode 100644 index 0000000..509ddfc --- /dev/null +++ b/database/migrations/2026_04_05_000002_add_signer_details_to_invoices.php @@ -0,0 +1,23 @@ +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']); + }); + } +}; diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 7e9527d..cd43334 100644 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -20,11 +20,27 @@ if [ ! -f .env ]; then fi # ── 2. Generate APP_KEY if empty ──────────── -if grep -qE '^APP_KEY=$' .env 2>/dev/null; then - echo "[key] Generating application key…" - php artisan key:generate --force --quiet +if ! grep -qE '^APP_KEY=base64:' .env 2>/dev/null; then + echo "[key] Generating application key directly…" + + # 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 +# 2c. Force Laravel to read from .env by ditching Docker's empty OS injection +unset APP_KEY + # ── 3. Ensure SQLite database file exists ─── if [ ! -f database/database.sqlite ]; then echo "[db] Creating SQLite database file…" diff --git a/resources/views/invoices/create.blade.php b/resources/views/invoices/create.blade.php index 49bb966..3a611f2 100644 --- a/resources/views/invoices/create.blade.php +++ b/resources/views/invoices/create.blade.php @@ -123,31 +123,62 @@ - {{-- Bank Info --}} -
-
- - +
+ + + +
+ +
+ {{-- Bank Info --}} +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
-
- - + + {{-- Custom Signature Text --}} +
+
+ + +
+
+ + +
-
- - -
-
- - + +
+ +

Leave blank to use your default signature from settings.

+
@@ -157,17 +188,6 @@ placeholder="Payment terms, etc.">{{ old('notes', $invoiceSettings->default_notes) }}
-
- -

Leave blank to use your default signature from settings.

- -
-
- {{-- Bank Info --}} -
-
- - +
+ + + +
+ +
+ {{-- Bank Info --}} +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
-
- - + + {{-- Custom Signature Text --}} +
+
+ + +
+
+ + +
-
- - -
-
- - + +
+ +

Upload a specific signature for this invoice. Leave blank to keep the current one.

+ + @if($invoice->signature_image) +
+ Signature +
+ + +
+
+ @endif + +
@@ -149,36 +199,6 @@
- -
- -

Upload a specific signature for this invoice. Leave blank to keep the current one.

- - @if($invoice->signature_image) -
- Signature -
- - -
-
- @endif - - -
@@ -200,6 +220,7 @@ function invoiceEditForm() { }); @endphp return { + showCustomFields: {{ old('use_custom_fields', ($invoice->bank_name || $invoice->signature_image || $invoice->signer_name || $invoice->signer_title) ? true : false) ? 'true' : 'false' }}, items: @json($itemsJson), taxRate: {{ $invoice->tax_rate }}, get subtotal() { diff --git a/resources/views/invoices/pdf.blade.php b/resources/views/invoices/pdf.blade.php index f96bf0e..0b2bce7 100644 --- a/resources/views/invoices/pdf.blade.php +++ b/resources/views/invoices/pdf.blade.php @@ -373,11 +373,11 @@
- {{ $invoiceSettings->signer_name ?: ($invoiceSettings->header_name ?: 'Signature') }} + {{ $invoice->signer_name ?: ($invoiceSettings->signer_name ?: ($invoiceSettings->header_name ?: 'Signature')) }}
- @if($invoiceSettings->signer_title || $invoiceSettings->header_title) + @if($invoice->signer_title || $invoiceSettings->signer_title || $invoiceSettings->header_title)
- {{ $invoiceSettings->signer_title ?: $invoiceSettings->header_title }} + {{ $invoice->signer_title ?: ($invoiceSettings->signer_title ?: $invoiceSettings->header_title) }}
@endif
diff --git a/resources/views/invoices/show.blade.php b/resources/views/invoices/show.blade.php index 1b62137..6027b3f 100644 --- a/resources/views/invoices/show.blade.php +++ b/resources/views/invoices/show.blade.php @@ -160,11 +160,11 @@
Signature
- {{ $invoiceSettings->signer_name ?: ($invoiceSettings->header_name ?: 'Signature') }} + {{ $invoice->signer_name ?: ($invoiceSettings->signer_name ?: ($invoiceSettings->header_name ?: 'Signature')) }}
- @if($invoiceSettings->signer_title || $invoiceSettings->header_title) + @if($invoice->signer_title || $invoiceSettings->signer_title || $invoiceSettings->header_title)
- {{ $invoiceSettings->signer_title ?: $invoiceSettings->header_title }} + {{ $invoice->signer_title ?: ($invoiceSettings->signer_title ?: $invoiceSettings->header_title) }}
@endif