{% extends 'base.html' %}
{% block title %}Request Repair{% endblock %}

{% block content %}
<div class="container page-container">

    <div class="page-header mb-3">
        <h4><i class="bi bi-tools"></i> Request Repair</h4>
    </div>

    <div class="card shadow-sm p-3">
        <form method="post" enctype="multipart/form-data">
            {% csrf_token %}

            <!-- ✅ NEW: UNIT -->
            <div class="mb-3">
                <label class="form-label">Unit</label>
                <select name="unit" class="form-select" required>
                    <option value="">Select Unit</option>
                    {% for unit in request.user.units.all %}
                        <option value="{{ unit.id }}">{{ unit.name }}</option>
                    {% endfor %}
                </select>
            </div>

            <div class="mb-3">
                <label class="form-label">Issue Description</label>
                <textarea name="issue" class="form-control" rows="4" required></textarea>
            </div>

            <div class="mb-3">
                <label class="form-label">Upload Image (Optional)</label>
                <input type="file" name="image" class="form-control">
            </div>

            <button type="submit" class="btn btn-dark w-100">
                <i class="bi bi-upload"></i> Submit Request
            </button>
        </form>
    </div>

</div>
{% endblock %}