{% extends "base.html" %}

{% block title %}Register Farmer | NAIMS Namibia{% endblock %}

{% block content %}
<section class="container my-5">
    <div class="row justify-content-center">
        <div class="col-lg-10">
            <div class="mb-4 d-flex justify-content-between align-items-center">
                <div>
                    <h2 class="fw-bold mb-0">Farmer Registration</h2>
                    <p class="text-muted mb-0">Enroll a new farmer and their holding into the national database.</p>
                </div>
                <a href="{% url 'farmer_list' %}" class="btn btn-outline-secondary px-4 fw-bold shadow-none">Back to List</a>
            </div>

            <form method="POST" class="needs-validation" novalidate>
                {% csrf_token %}
                <div class="row g-4">
                    <!-- Farmer Personal Info -->
                    <div class="col-md-6">
                        <div class="card h-100 shadow-sm border-0">
                            <div class="card-body p-4">
                                <h5 class="fw-bold mb-4 border-bottom pb-2">Personal Information</h5>
                                
                                <div class="mb-3">
                                    <label class="form-label fw-bold small text-uppercase">Full Name</label>
                                    {{ f_form.name }}
                                </div>
                                <div class="mb-3">
                                    <label class="form-label fw-bold small text-uppercase">National ID / Passport</label>
                                    {{ f_form.id_number }}
                                </div>
                                <div class="mb-3">
                                    <label class="form-label fw-bold small text-uppercase">Contact Number</label>
                                    {{ f_form.phone_number }}
                                </div>
                                <div class="mb-3">
                                    <label class="form-label fw-bold small text-uppercase">Constituency</label>
                                    {{ f_form.constituency }}
                                    <small class="text-muted">Select the constituency where the farmer is based.</small>
                                </div>
                            </div>
                        </div>
                    </div>

                    <!-- Holding Information -->
                    <div class="col-md-6">
                        <div class="card h-100 shadow-sm border-0">
                            <div class="card-body p-4">
                                <h5 class="fw-bold mb-4 border-bottom pb-2">Initial Holding Details</h5>
                                
                                <div class="mb-3">
                                    <label class="form-label fw-bold small text-uppercase">Holding Size (Hectares)</label>
                                    {{ h_form.size_hectares }}
                                </div>
                                <div class="mb-3">
                                    <label class="form-label fw-bold small text-uppercase">Primary Farming Activity</label>
                                    {{ h_form.primary_activity }}
                                </div>
                                <div class="mb-3">
                                    <label class="form-label fw-bold small text-uppercase">Location / Description</label>
                                    {{ h_form.location_description }}
                                </div>
                                
                                <div class="alert alert-info py-2 px-3 mb-0 border-0 shadow-none">
                                    <small class="fw-bold"><i class="bi bi-info-circle"></i> Note:</small>
                                    <small class="d-block">More holdings can be added later from the farmer's profile page.</small>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="mt-5 text-center">
                    <button type="submit" class="btn btn-success btn-lg px-5 fw-bold shadow-sm">
                        Complete Registration & Save to National Registry
                    </button>
                    <p class="mt-3 text-muted small">By registering, you confirm the data matches official government records.</p>
                </div>
            </form>
        </div>
    </div>
</section>
{% endblock %}
