@php $isDebit = $type === 'debit_note'; $navLabel = $isDebit ? trans('dashboard.nav_debit_notes') : trans('dashboard.nav_credit_notes'); $actionLabel = $isDebit ? trans('dashboard.new_debit_note_btn') : trans('dashboard.new_credit_note_btn'); $reasonPlaceholder = $isDebit ? trans('dashboard.debit_note_reason_placeholder') : trans('dashboard.credit_note_reason_placeholder'); $recentInvoicesData = $originals->map(fn ($orig) => [ 'uuid' => $orig->uuid, 'invoice_number' => $orig->invoice_number, 'buyer_name' => $orig->buyer_name, 'total' => (float) $orig->total, 'subtotal' => (float) $orig->subtotal, 'vat_amount' => (float) $orig->vat_amount, 'currency' => $orig->currency ?: 'SAR', 'has_previous_notes' => false, 'remaining_balance' => (float) $orig->subtotal, 'lines' => $orig->invoice_data['lines'] ?? [], 'buyer' => $orig->invoice_data['buyer'] ?? ['name' => $orig->buyer_name], 'device_uuid' => $orig->device?->uuid, ])->values()->all(); @endphp