{% extends "base.html" %}
{% load static %}
{% block title %}Edit 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">Edit 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">
                <div class="mb-4">
                    <h5>Booking: {{ entry.booking.booking_id }}</h5>
                    <p class="text-muted">
                        Customer: {{ entry.customer.first_name }} {{ entry.customer.last_name }}<br>
                        Rider: {{ entry.rider.full_name|default:"Unassigned" }}
                    </p>
                </div>

                <form method="post">
                    {% csrf_token %}
                    
                    <div class="mb-3">
                        <label class="form-label">Point of Contact Name (Optional)</label>
                        <input type="text" name="poc_name" class="form-control" value="{{ entry.poc_name|default:'' }}" 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" value="{{ entry.poc_mobile|default:'' }}" 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?">{{ entry.reason|default:'' }}</textarea>
                    </div>

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