@extends('layouts.app', ['pageTitle' => 'Payroll', 'pageSubtitle' => 'Prepare payroll records and track payment status'])
@section('content')
<div class="card"><h3 class="section-title">Create Payroll Record</h3><form method="POST" action="{{ route('admin.payroll.store') }}" class="form-grid">@csrf
<div class="field"><label>Staff</label><select name="user_id" required>@foreach($users as $u)<option value="{{ $u->id }}">{{ $u->name }}</option>@endforeach</select></div><div class="field"><label>Pay Period</label><input name="pay_period" placeholder="May 2026" required></div><div class="field"><label>Payment Date</label><input type="date" name="payment_date"></div><div class="field"><label>Gross Pay</label><input type="number" step="0.01" name="gross_pay" required></div><div class="field"><label>Deductions</label><input type="number" step="0.01" name="deductions" value="0"></div><div class="field"><label>Tax Amount</label><input type="number" step="0.01" name="tax_amount" value="0"></div><div class="field"><label>Notes</label><input name="notes"></div><div><button class="btn" type="submit">Create Payroll</button></div></form></div>
<div class="card"><h3 class="section-title">Payroll Records</h3><div class="table-wrap"><table><thead><tr><th>No</th><th>Staff</th><th>Period</th><th>Gross</th><th>Deductions</th><th>Tax</th><th>Net</th><th>Status</th></tr></thead><tbody>@foreach($records as $r)<tr><td>{{ $r->payroll_number }}</td><td>{{ $r->user_name }}</td><td>{{ $r->pay_period }}</td><td>₦{{ number_format($r->gross_pay,2) }}</td><td>₦{{ number_format($r->deductions,2) }}</td><td>₦{{ number_format($r->tax_amount,2) }}</td><td>₦{{ number_format($r->net_pay,2) }}</td><td>{{ $r->status }}</td></tr>@endforeach</tbody></table></div></div>
@endsection
