@props(['invoice']) @php // Download link for an invoice PDF. When the invoice has refunds, clicking // opens a modal asking whether the downloaded PDF should reflect them: // "Yes" appends ?refunds=1 (refunded amount + adjusted net total in the // totals box), "No" downloads the plain invoice. With no refunds it is a // normal download link. $plain = route('invoices.pdf', $invoice); $withRefunds = route('invoices.pdf', ['invoice' => $invoice, 'refunds' => 1]); $refunded = (float) $invoice->refunded_total; $hasRefunds = $refunded > 0; $amountLabel = trim(($invoice->currency_code ?: '') . ' ' . number_format($refunded, 2)); @endphp @if ($hasRefunds) {{ $slot }} @else {{ $slot }} @endif