FIX: saving new invoices was broken because changing a customer would only store billingData, but not a customerId
This commit is contained in:
@@ -20,7 +20,7 @@ public function up(): void
|
|||||||
$table->date('service_end_date')->nullable();
|
$table->date('service_end_date')->nullable();
|
||||||
$table->boolean('is_recurring')->default(false);
|
$table->boolean('is_recurring')->default(false);
|
||||||
$table->boolean('is_partial_service')->default(false);
|
$table->boolean('is_partial_service')->default(false);
|
||||||
$table->foreignId('customer_id')->constrained()->onDelete('cascade');
|
$table->foreignId('customer_id')->nullable()->constrained()->onDelete('cascade');
|
||||||
$table->string('payment_status')->default('draft');
|
$table->string('payment_status')->default('draft');
|
||||||
$table->decimal('total_amount', 10, 2);
|
$table->decimal('total_amount', 10, 2);
|
||||||
$table->text('title')->nullable();
|
$table->text('title')->nullable();
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ const saveInvoice = async (updatedInvoice: Invoice) => {
|
|||||||
totalAmount: updatedInvoice.totalAmount,
|
totalAmount: updatedInvoice.totalAmount,
|
||||||
title: updatedInvoice.title,
|
title: updatedInvoice.title,
|
||||||
text: updatedInvoice.text,
|
text: updatedInvoice.text,
|
||||||
customer: updatedInvoice.customer,
|
customerId: updatedInvoice.customer ? updatedInvoice.customer.id : null,
|
||||||
billingData: {
|
billingData: {
|
||||||
companyName: updatedInvoice.billingData?.companyName,
|
companyName: updatedInvoice.billingData?.companyName,
|
||||||
vatId: updatedInvoice.billingData?.vatId,
|
vatId: updatedInvoice.billingData?.vatId,
|
||||||
|
|||||||
@@ -77,7 +77,11 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th>Rechnungs-Nr.</th>
|
<th>Rechnungs-Nr.</th>
|
||||||
<td>
|
<td>
|
||||||
|
@if($invoice['paymentStatus'] == 'draft')
|
||||||
|
Entwurf
|
||||||
|
@else
|
||||||
{{ $invoice['nr'] }}
|
{{ $invoice['nr'] }}
|
||||||
|
@endif
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@if($invoice['customer']['customerNr'])
|
@if($invoice['customer']['customerNr'])
|
||||||
@@ -127,7 +131,7 @@
|
|||||||
|
|
||||||
@if($invoice['text'])
|
@if($invoice['text'])
|
||||||
<div class="text">
|
<div class="text">
|
||||||
{{ $invoice['text'] }}
|
{!! nl2br(e($invoice['text'])) !!}
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user