@php
    $record = $record ?? null;
@endphp
<h4 class="mb-3">Personal Information</h4>
<div class="row">
    <div class="col-md-6 mb-3">
        <label class="form-label">Name of Applicant</label>
        <input type="text" name="applicant_name" class="form-control @error('applicant_name') is-invalid @enderror" value="{{ old('applicant_name', $record->applicant_name ?? '') }}" required>
        @error('applicant_name')<div class="invalid-feedback">{{ $message }}</div>@enderror
    </div>
    <div class="col-md-6 mb-3">
        <label class="form-label">Designation</label>
        <input type="text" name="designation" class="form-control" value="{{ old('designation', $record->designation ?? '') }}">
    </div>
    <div class="col-md-6 mb-3">
        <label class="form-label">Address: Building No/Name</label>
        <input type="text" name="building" class="form-control" value="{{ old('building', $record->building ?? '') }}">
    </div>
    <div class="col-md-6 mb-3">
        <label class="form-label">Street</label>
        <input type="text" name="street" class="form-control" value="{{ old('street', $record->street ?? '') }}">
    </div>
    <div class="col-md-6 mb-3">
        <label class="form-label">City</label>
        <input type="text" name="city" class="form-control" value="{{ old('city', $record->city ?? '') }}">
    </div>
    <div class="col-md-6 mb-3">
        <label class="form-label">State</label>
        <input type="text" name="state" class="form-control" value="{{ old('state', $record->state ?? '') }}">
    </div>
    <div class="col-md-6 mb-3">
        <label class="form-label">Postal code</label>
        <input type="text" name="postal_code" class="form-control" value="{{ old('postal_code', $record->postal_code ?? '') }}">
    </div>
    <div class="col-md-6 mb-3">
        <label class="form-label">Country</label>
        <input type="text" name="country" class="form-control" value="{{ old('country', $record->country ?? '') }}">
    </div>
    <div class="col-md-6 mb-3">
        <label class="form-label">Email (login)</label>
        <input type="email" name="email" class="form-control @error('email') is-invalid @enderror" value="{{ old('email', $record->email ?? '') }}" required autocomplete="email" autocapitalize="none" spellcheck="false">
        @error('email')<div class="invalid-feedback">{{ $message }}</div>@enderror
    </div>
    <div class="col-md-6 mb-3">
        <label class="form-label">Phone Number with Country Code</label>
        <input type="text" name="phone" class="form-control" value="{{ old('phone', $record->phone ?? '') }}">
    </div>
    <div class="col-md-6 mb-3">
        <label class="form-label">Upload Applicant Photo</label>
        <input type="file" name="photo" class="form-control @error('photo') is-invalid @enderror" accept="image/*">
        @error('photo')<div class="invalid-feedback">{{ $message }}</div>@enderror
        @if (!empty($record?->photo_path))
            <small class="text-muted">Current file is already uploaded.</small>
        @endif
    </div>
    <div class="col-md-6 mb-3">
        <label class="form-label">Upload Applicant ID Proof</label>
        <input type="file" name="id_proof" class="form-control @error('id_proof') is-invalid @enderror">
        @error('id_proof')<div class="invalid-feedback">{{ $message }}</div>@enderror
        @if (!empty($record?->id_proof_path))
            <small class="text-muted">Current file is already uploaded.</small>
        @endif
    </div>
    <div class="col-md-6">
        @include('iqec.partials.password-field', [
            'name' => 'password',
            'label' => 'Password '.($record ? '(leave blank to keep)' : ''),
            'required' => ! $record,
            'autocomplete' => 'new-password',
        ])
    </div>
    <div class="col-md-6">
        @include('iqec.partials.password-field', [
            'name' => 'password_confirmation',
            'label' => 'Confirm Password',
            'required' => ! $record,
            'autocomplete' => 'new-password',
        ])
    </div>
</div>
