{{-- Transaction Info Partial - Optimized with date helpers --}} @php // Keep Carbon instances for calculations and formatted strings for display $registrationCarbon = $invoice->date ? \Carbon\Carbon::parse($invoice->date) : null; $dueCarbon = $invoice->due_date ? \Carbon\Carbon::parse($invoice->due_date) : null; $registrationDate = $registrationCarbon ? $registrationCarbon->format('d/m/Y') : 'N/A'; $dueDate = $dueCarbon ? $dueCarbon->format('d/m/Y') : 'N/A'; $totalAmount = number_format($invoice->total ?? 0, 0, ',', '.'); $isExpired = $invoice->status == 1; // Precompute days remaining (use 'N/A' when dates are missing) $daysRemaining = $dueCarbon && $registrationCarbon ? $dueCarbon->diffInDays($registrationCarbon) : 'N/A'; @endphp