@extends('layouts.app') @section('title', 'Add Person') @section('content') {{-- Unified "Add Person" form. Replaces the three separate creation flows: • Admin Users → Add User • HR → Add Staff • Locum → Register Locum The receptionist / admin picks an Employment Type up top. Sections fade in / out based on that choice — Personal Info and System Access are always shown, while Statutory & Payroll (permanent) and Payment & Rate (locum) appear conditionally. Behind the scenes one POST hits PersonOnboardingService which writes the right combination of users / staff_records / locums rows in a single transaction. --}}
@if($errors->any())

Please fix the following:

@endif @if(session('error'))
{{ session('error') }}
@endif
@csrf

Add Person

One form for permanent staff, locums, volunteers, and back-office system users. The right records are created for you based on the employment type.

{{-- ─── Section 1: Employment Type ───────────────────────── Pivot for the whole form. Changing this hides/shows the conditional sections below. --}}

1. Employment Type *

@php $types = [ 'permanent' => ['label' => 'Permanent Staff', 'hint' => 'Payroll + benefits', 'icon' => '👤'], 'locum' => ['label' => 'Locum', 'hint' => 'Casual, paid per shift', 'icon' => '🧑‍⚕️'], 'volunteer' => ['label' => 'Volunteer', 'hint' => 'Unpaid, light record', 'icon' => '🙋'], 'system_user'=> ['label' => 'System User Only', 'hint' => 'Login but no payroll', 'icon' => '💻'], ]; $selected = old('employment_type', $defaultType); @endphp @foreach($types as $val => $meta) @endforeach
{{-- ─── Section 2: Personal Info (always shown) ──────────── --}}

2. Personal Information

{{-- ─── Section 3: Role & Department (always shown) ──────── --}}

3. Role & Department

Permission group. One canonical list used everywhere.

Free-text job title.

{{-- ─── Section 4: System Access (always shown, conditional content) ─── --}}

4. System Access

@php // Compute the initial state of the checkbox: defaults // match what PersonOnboardingService::onboard() // would compute server-side, so the form mirrors // back-end behaviour and the user is never surprised. $createLoginInitial = old('create_login', in_array($selected, ['permanent', 'system_user'], true) ? 1 : 0); @endphp

Tick this for anyone who needs to sign in to the HMIS. Permanent staff and system users default to having a login; locums and volunteers default to no login (their work is logged by the receptionist or admin who books their shifts).

Leave blank to auto-generate.

Leave blank to auto-generate a 14-character random password. User will be forced to change it on first login. Manual passwords must be ≥10 chars with upper, lower, digit, and symbol.

{{-- ─── Section 5: Statutory & Tax (permanent staff only) ── --}}

5. Statutory & Tax (Permanent staff)

Auto-generated on save

Salary, allowances, and payment method are set after creation from the staff profile or the Payroll module.

{{-- ─── Section 6: KRA / Statutory (locum only — minimal) ── --}}

5. Statutory (Locum)

{{-- ─── Section 7: Payment & Rate (locum only) ───────────── --}}

6. Payment & Rate (Locum)

KES per shift, or % of procedure

{{-- ─── Section 8: License (permanent + locum only) ──────── --}}

Professional License (optional)

{{-- ─── Section 9: Emergency Contact (permanent + locum) ── --}}

Emergency Contact

{{-- Submit --}}
Cancel
@push('scripts') @endpush @endsection