@extends('admin.layouts.app', ['head' => 'headForm', 'foot' => 'footForm']) @section('title') {{ __('Payroll Details') }} @stop @section('head_content') @include('admin.layouts.components.head', ['back_url' => route('admin.payrolls.index')]) @stop @section('content') @include('admin.errors.alerts') {{-- Header card: employee info + status + key dates --}}

@include('admin.payrolls.components.employee-link', ['employee' => $payroll->employee, 'year' => $payroll->year, 'month' => $payroll->month])

@php $statusColor = match ($payroll->status?->value) { 'paid' => 'success', 'processed' => 'info', default => 'secondary', }; @endphp {{ $payroll->status?->label() }} @if ($payroll->paid_at) @endif @if ($payroll->notes) @endif
{{ __('Employee') }} {{ $payroll->employee?->code }} @if ($payroll->employee?->jobTitle) · {{ $payroll->employee->jobTitle->nameLang() }} @endif @if ($payroll->employee?->department) · {{ $payroll->employee->department->nameLang() }} @endif
{{ __('Pay period') }} {{ $payroll->period_start?->format('d') }}–{{ $payroll->period_end?->format('d') }} {{ $payroll->period_start?->translatedFormat('F Y') }}
{{ __('Payment date') }} {{ $payroll->paid_at->translatedFormat('d F Y') }}
{{ __('Notes') }} {{ $payroll->notes }}
{{ __('Review payroll') }} {{-- Download payslip (print-friendly) --}} {{ __('Download Payslip') }} @if (! $payroll->isFinalized() && $payroll->hasPeriodEnded())
@csrf
@endif
{{-- Earnings & Deductions --}}
{{-- Earnings --}}
{{ __('Earnings') }}
{{-- Basic salary always first --}} @foreach ($earnings as $item) @endforeach
{{ __('Description') }} {{ __('Amount') }}
{{ __('Basic Salary') }} {{ number_format((float) $payroll->basic_salary, 2) }}
@include('admin.payrolls.components.item-link', ['payroll' => $payroll, 'item' => $item]) {{ number_format((float) $item->amount, 2) }}
{{ __('Gross Salary') }} {{ number_format((float) $payroll->basic_salary + (float) $payroll->total_additions, 2) }}
{{-- Deductions --}}
{{ __('Deductions') }}
@forelse ($deductions as $item) @empty @endforelse
{{ __('Description') }} {{ __('Amount') }}
@include('admin.payrolls.components.item-link', ['payroll' => $payroll, 'item' => $item]) {{ number_format((float) $item->amount, 2) }}
{{ __('No deductions') }}
{{ __('Total Deductions') }} {{ number_format((float) $payroll->total_deductions, 2) }}
{{ __('Net Salary') }} {{ number_format((float) $payroll->net_salary, 2) }}
{{-- Attendance summary --}}
{{ __('Attendance Summary') }}
@foreach ([ ['value' => $payroll->present_days ?? 0, 'label' => __('Present days'), 'class' => '', 'section' => null], ['value' => $payroll->absent_days ?? 0, 'label' => __('Absent days'), 'class' => 'text-danger', 'section' => 'absence'], ['value' => $payroll->holiday_days ?? 0, 'label' => __('Holiday days'), 'class' => 'text-info', 'section' => null], ['value' => ($payroll->paid_holiday_days + 0).' / '.($payroll->unpaid_leave_days + 0), 'label' => __('Leave (paid / unpaid)'), 'class' => 'text-warning', 'section' => 'leave'], ['value' => $payroll->total_overtime_minutes ?? 0, 'label' => __('Overtime (min)'), 'class' => 'text-success', 'section' => 'overtime'], ['value' => $payroll->total_late_minutes ?? 0, 'label' => __('Late (min)'), 'class' => 'text-danger', 'section' => 'late'], ['value' => $payroll->permission_minutes ?? 0, 'label' => __('Permissions (min)'), 'class' => '', 'section' => 'permissions'], ] as $box)
@if ($box['section']) @include('admin.payrolls.components.detail-link', ['payroll' => $payroll, 'section' => $box['section'], 'label' => $box['value'], 'title' => $box['label']]) @else {{ $box['value'] }} @endif
{{ $box['label'] }}
@endforeach
{{-- Actions: a run is never edited by hand; an unfinalized one may be deleted and generated again. --}} @unless ($payroll->isFinalized()) @can('payrolls.destroy')
@csrf @method('DELETE')
@endcan @endunless @stop @section('after_foot') @include('admin.layouts.components.detail-modal') @stop