{% extends "base.html" %}
{% load static %}
{% block title %}Add Back to Base Entry{% endblock %}

{% block content %}
<div class="page-breadcrumb d-none d-sm-flex align-items-center mb-3">
    <div class="breadcrumb-title pe-3">Add Back to Base Entry</div>
    <div class="ms-auto">
        <a href="{% url 'back-to-base-list' %}" class="btn btn-secondary">Cancel</a>
    </div>
</div>

<div class="row">
    <div class="col-md-8 mx-auto">
        <div class="card">
            <div class="card-body">
                <form method="post">
                    {% csrf_token %}
                    
                    <div class="mb-3">
                        <label class="form-label">Select Booking</label>
                        <select name="booking" class="form-select" required>
                            <option value="">-- Select Booking --</option>
                            {% for booking in bookings %}
                            <option value="{{ booking.id }}">
                                {{ booking.booking_id }} - {{ booking.user.first_name }} ({{ booking.get_booking_status_display }})
                            </option>
                            {% endfor %}
                        </select>
                        <div class="form-text">Showing recent active bookings.</div>
                    </div>

                    <div class="mb-3">
                        <label class="form-label">Point of Contact Name (Optional)</label>
                        <input type="text" name="poc_name" class="form-control" placeholder="e.g. Neighbor, Security Guard">
                    </div>

                    <div class="mb-3">
                        <label class="form-label">Point of Contact Mobile (Optional)</label>
                        <input type="text" name="poc_mobile" class="form-control" placeholder="Mobile Number">
                    </div>

                    <div class="mb-3">
                        <label class="form-label">Reason (Optional)</label>
                        <textarea name="reason" class="form-control" rows="3" placeholder="Why was it returned to base?"></textarea>
                    </div>

                    <div class="d-grid">
                        <button type="submit" class="btn btn-primary">Save Entry</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
{% endblock %}
