@php $period = $accounting_payroll_period ?? null; $exportRoute = $period ? route('loan.accounting.payroll.period.export', $period) : null; $items = []; if ($exportRoute) { $csv = fn (string $type) => [ 'label' => match ($type) { 'lines' => 'Lines (CSV)', 'statutory' => 'Statutory (CSV)', 'payment_register' => 'Payment register (CSV)', 'gl_reconciliation' => 'GL reconciliation (CSV)', 'recoveries' => 'Recoveries (CSV)', 'audit_log' => 'Audit log (CSV)', default => strtoupper($type).' (CSV)', }, 'href' => $exportRoute.'?'.http_build_query(['type' => $type, 'format' => 'csv']), 'native' => true, ]; $items[] = $csv('lines'); $items[] = $csv('statutory'); if ($canExportPaymentRegister ?? false) { $items[] = $csv('payment_register'); } if ($canExportGlReconciliation ?? false) { $items[] = $csv('gl_reconciliation'); } $items[] = $csv('recoveries'); if ($canExportAudit ?? false) { $items[] = $csv('audit_log'); } } @endphp @if (($canExportPayroll ?? false) && count($items) > 0) @endif