feat: Enhance ServiceClientResource and InvoiceRepository with additional data fields; remove unused SVG icons
This commit is contained in:
@@ -35,6 +35,8 @@ class InvoiceRepository extends BaseApiRepository implements InvoiceRepositoryIn
|
||||
|
||||
public function createFromOrder(Order $order): Invoice
|
||||
{
|
||||
$maxMonths = $order->orderItems->max(fn($item) => $this->cycleToMonths($item->billing_cycle)) ?? 1;
|
||||
|
||||
$invoice = $this->model->create([
|
||||
'invoice_number' => OrderHelper::generateOrderNumber('INV'),
|
||||
'customer_id' => $order->customer_id,
|
||||
@@ -45,7 +47,7 @@ class InvoiceRepository extends BaseApiRepository implements InvoiceRepositoryIn
|
||||
'tax' => 0,
|
||||
'total' => $order->total,
|
||||
'status' => InvoiceStatus::UNPAID->value,
|
||||
'due_date' => now()->addDays(3)->toDateString(),
|
||||
'due_date' => now()->addMonths($maxMonths)->toDateString(),
|
||||
]);
|
||||
|
||||
// Create one invoice_item per order_item line
|
||||
|
||||
Reference in New Issue
Block a user