@php use App\Services\Employee\PayrollPayslipReleaseService; use App\Support\Navigation\WorkspaceEmbed; $period = $period ?? $line->period ?? null; $payslipRelease = app(PayrollPayslipReleaseService::class); $user = auth()->user(); $canViewPayslip = $period && $payslipRelease->canView($user, $period, $line); $canDownloadPdf = $period && $payslipRelease->canDownloadPdf($user, $period, $line); $canEmailPayslip = $period && $payslipRelease->canEmailLine($user, $period, $line); $employeeEmail = trim((string) ($line->employee?->email ?? '')); $turboFrame = WorkspaceEmbed::INNER_FRAME; $showBreakdown = (bool) ($showBreakdown ?? false); $showPeriodLink = (bool) ($showPeriodLink ?? true); $showEdit = (bool) ($showEdit ?? false); $canManualEditLines = (bool) ($canManualEditLines ?? false); $hasActions = $canViewPayslip || $canDownloadPdf || $canEmailPayslip || $showBreakdown || $showEdit || $showPeriodLink || $line->employee; $menuItemCount = (int) $showBreakdown + (int) $canViewPayslip + (int) $canDownloadPdf + (int) ($canEmailPayslip || $line->email_sent_at) + (int) $showPeriodLink + (int) (bool) $line->employee + ($showEdit && $canManualEditLines ? 2 : 0); @endphp @if (! $hasActions) — @else @if ($showBreakdown) View breakdown @endif @if ($canViewPayslip) Preview payslip @endif @if ($canDownloadPdf) Download PDF @endif @if ($canEmailPayslip)
@csrf @elseif ($line->email_sent_at) Emailed {{ $line->email_sent_at->format('M j, g:i A') }} @endif @if ($showPeriodLink) Open payroll run @endif @if ($line->employee) Employee profile @endif @if ($showEdit && $canManualEditLines) Edit line
@csrf @method('delete') @endif
@endif