@php $inFormModal = request()->header('Turbo-Frame') === 'loan-form-modal'; $initialStep = 1; if ($errors->any()) { $bag = $errors->keys(); $step3Keys = ['loan_branch_id', 'assigned_employee_id', 'notes', 'referral', 'referrer_type', 'referrer_loan_client_id', 'referrer_name', 'referrer_phone', 'referral_notes']; $step2Keys = array_filter($bag, static fn ($k) => str_starts_with((string) $k, 'biodata_meta') || str_starts_with((string) $k, 'biodata_files')); if (array_intersect($bag, $step3Keys) !== []) { $initialStep = 3; } elseif ($step2Keys !== []) { $initialStep = 2; } else { $initialStep = 1; } } @endphp Back to list @include('loan.clients.partials.identity-flashes')
$inFormModal, 'max-w-7xl grid-cols-1 xl:grid-cols-[minmax(0,1fr)_320px]' => ! $inFormModal, ]) x-data="clientCreateForm({{ (int) $initialStep }})" >
@csrf
{{-- Mobile / modal step chrome --}}

Step of

{{-- Step 1: Personal details --}}

Personal details

Identity and contact information for this client.

Auto-assigned when you save
@include('loan.clients.partials.spouse-fields', ['fullWidth' => true])
{{ old('address') }}
{{-- Step 2: Economic profile --}}

Economic profile

Complete these details before starting a loan application to avoid blockers later.

@include('loan.clients.partials.lending-profile-fields', ['client' => null]) @include('loan.clients.partials.additional-biodata-fields', ['client' => null])
{{-- Step 3: Assignment --}}

Assignment and status

Branch, officer, status, notes, and referral.

@php $defaultBranchId = old('loan_branch_id', $defaultLoanBranchId ?? ''); $branchLocked = (bool) ($lockClientBranch ?? false) && filled($defaultLoanBranchId); $selectedBranch = ($directoryBranches ?? collect())->first( fn ($branch) => (string) $branch->id === (string) ($defaultBranchId ?: $defaultLoanBranchId) ); @endphp @if ($branchLocked)
{{ $selectedBranch->name ?? 'Your branch' }}

Assigned to your branch automatically.

@else @include('loan.clients.partials.branch-select-with-modal', [ 'fieldId' => 'loan_branch_id', 'selectedBranchId' => $defaultBranchId, 'directoryBranches' => $directoryBranches ?? collect(), 'label' => 'Branch', 'placeholder' => 'Select branch...', ]) @if (filled($defaultLoanBranchId))

Defaults to your branch. Change only if onboarding for another branch.

@endif @endif
@php $canAssignClientToOtherOfficers = (bool) ($canAssignClientToOtherOfficers ?? false); $defaultOfficerId = old('assigned_employee_id', $defaultAssignedEmployeeId ?? ''); $officerLocked = (bool) ($lockAssignedEmployee ?? false) && filled($defaultAssignedEmployeeId); $selectedOfficer = $employees->first( fn ($employee) => (string) $employee->id === (string) ($defaultOfficerId ?: $defaultAssignedEmployeeId) ); @endphp @if ($officerLocked)
{{ $selectedOfficer->full_name ?? 'Current loan officer' }}

Assigned to you automatically as the officer adding this client.

@else @if ($canAssignClientToOtherOfficers)

Only active loan officers in your branch are listed. The selected officer owns the client (including drafts) on their register and can complete or delete the draft.

@elseif (filled($defaultAssignedEmployeeId))

Defaults to the officer currently signed in.

@endif @endif

Lifecycle status

Assigned automatically by the system. Active clients have an open loan balance; dormant clients appear on the dormant register after the idle threshold.

@if(auth()->user()?->hasLoanPermission('referrals.capture'))
@include('loan.clients.partials.referral-form-fields')
@endif
{{-- Step 4: Review --}}

Review

Confirm details before saving. Use Edit to jump back to a section.

Client form preview

Uploaded images
{{-- /.client-form-scroll --}} {{-- Pinned action bar (outside scroll so it never covers fields) --}}
{{ __('Save draft') }}
{{ __('Save as draft') }} {{ __('Save client') }}
{{-- Desktop sidebar preview (full-page only) --}} @unless ($inFormModal) @endunless