{% extends "base.html" %}

{% block content %}
    <h1>Edit Client</h1>
    <form method="POST">
        <div class="form-group">
            <label for="name">Name</label>
            <input type="text" id="name" name="name" class="form-control" value="{{ client.name }}" required>
        </div>
        <div class="form-group">
            <label for="email">Email</label>
            <input type="email" id="email" name="email" class="form-control" value="{{ client.email }}" readonly>
            <small class="form-text text-muted">Email cannot be changed.</small>
        </div>
        <div class="form-group">
            <label for="date_of_birth">Date of Birth</label>
            <input type="date" id="date_of_birth" name="date_of_birth" class="form-control" value="{{ client.date_of_birth.isoformat() if client.date_of_birth else '' }}" required>
        </div>
        <div class="form-group">
            <label for="phone_number">Phone Number</label>
            <input type="tel" id="phone_number" name="phone_number" class="form-control" value="{{ client.phone_number }}" readonly>
            <small class="form-text text-muted">Phone number cannot be changed.</small>
        </div>
        <div class="form-group">
            <label for="gender">Gender</label>
            <select id="gender" name="gender" class="form-control" required>
                <option value="" disabled>Select Gender</option>
                <option value="Male" {% if client.gender == 'Male' %}selected{% endif %}>Male</option>
                <option value="Female" {% if client.gender == 'Female' %}selected{% endif %}>Female</option>
                <option value="Other" {% if client.gender == 'Other' %}selected{% endif %}>Other</option>
            </select>
        </div>
        <div class="form-group form-check">
            <input type="checkbox" class="form-check-input" id="skip_details_collection" name="skip_details_collection" {% if client.skip_details_collection %}checked{% endif %}>
            <label class="form-check-label" for="skip_details_collection">Client details are final (skip confirmation before assessment)</label>
        </div>
        <button type="submit" class="btn btn-primary">Update Client</button>
        <a href="{{ url_for('consultant.my_clients') }}" class="btn btn-secondary">Cancel</a>
    </form>
{% endblock %}