@extends('layouts.app') @section('title', 'Payroll') @php $reopen = old('_form'); $old = fn ($form, $k, $d = null) => $reopen === $form ? old($k, $d) : $d; @endphp @section('content')
@foreach ([ ['Last net pay', '₦' . number_format($stats['lastNet'], 2), 'bi-wallet2', '#e0f2fe', '#0369a1', $stats['lastPeriod'] ?? 'Nothing posted yet'], ['Gross payroll ' . today()->year, '₦' . number_format($stats['ytdGross'], 2), 'bi-cash-stack', '#dcfce7', '#15803d', 'Posted runs, year to date'], ['Statutory ' . today()->year, '₦' . number_format($stats['ytdStatutory'], 2), 'bi-bank', '#fef3c7', '#b45309', 'PAYE + pension to remit'], ['Drafts in progress', number_format($stats['drafts']), 'bi-pencil-square', '#eef2ff', '#4f46e5', $stats['drafts'] ? 'Not yet posted' : 'All runs posted'], ] as [$label, $value, $icon, $bg, $fg, $hint])
{{ $value }} {{ $label }} {{ $hint }}
@endforeach
@if ($can['create'])

Start a payroll run

Every active employee in scope is added with their current pay.

@csrf @if ($branches->isNotEmpty())
Pay everyone in one run, or each branch separately — not both for the same month.
@endif
@if ($activeEmployees === 0)
No active employees in this scope yet — add your staff first.
@endif
{{ $activeEmployees }} active {{ \Illuminate\Support\Str::plural('employee', $activeEmployees) }} in {{ $activeBranchId ? 'this branch' : 'the company' }}
@endif

Pension & PAYE

Worked out on pensionable earnings ({{ $pensionable ?: 'none set' }}).

@csrf
From the Nigerian tax bands for each run's pay period. Off: PAYE is typed in (or worked out with the Calculate PAYE button on a draft).
@if ($can['edit']) @endif PAYE calculator

Payroll runs @if ($runs->total()){{ $runs->total() }}@endif

{{ $activeBranchId ? 'This branch\'s runs and company-wide ones.' : 'Every run, company-wide and per branch.' }}

@forelse ($runs as $r) @empty @endforelse
PeriodScopeStaffGrossNet payStatus
{{ $r->periodLabel(short: true) }}
Pay date {{ $r->pay_date->format('M d') }}
{{ $r->scopeLabel() }} {{ $r->items_count }} ₦{{ number_format((float) $r->total_gross, 2) }} ₦{{ number_format((float) $r->total_net, 2) }} @if ($r->isDraft()) Draft @else Posted @endif
{{ $runs->total() ? 'No runs on this page.' : 'No payroll runs yet.' }}
@include('partials.list-pager', ['page' => $runs, 'noun' => 'run'])
@endsection