Commit a5e24d39 authored by Mahmoud Aglan's avatar Mahmoud Aglan

Fix: pre-fill payment amount when invoice is selected via radio button

The radio input uses wire:model.live which only sets the property but
doesn't call selectInvoice(). Added updatedSelectedInvoiceId hook so
the amount defaults to the full balance due whenever an invoice is picked.
Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
parent 13b485e0
......@@ -231,6 +231,16 @@ private function advanceEnrollmentBillingDate(Enrollment $enrollment): void
$enrollment->update(['next_billing_date' => $next->toDateString()]);
}
public function updatedSelectedInvoiceId(): void
{
if ($this->selected_invoice_id) {
$invoice = Invoice::find($this->selected_invoice_id);
if ($invoice) {
$this->payment_amount_display = number_format($invoice->due_amount / 100, 2, '.', '');
}
}
}
public function selectInvoice(int $id): void
{
$this->selected_invoice_id = $id;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment