{% extends "base.html" %}

{% block content %}
<div class="container mt-5">
    <div class="card mb-4">
        <div class="card-header">
            <h1 class="card-title">{{ tender.title }}</h1>
        </div>
        <div class="card-body">
            <p><strong>Company:</strong> {{ tender.company.name }}</p>
            <p><strong>Description:</strong></p>
            <p>{{ tender.description }}</p>
            <p><strong>Deadline:</strong> {{ tender.deadline }}</p>
        </div>
        <div class="card-footer">
            <a href="{% url 'tender_list' tender.company.id %}" class="btn btn-secondary">Back to Tenders</a>
        </div>
    </div>

    <div class="card">
        <div class="card-header d-flex justify-content-between align-items-center">
            <h2 class="h4">Bids</h2>
            <a href="{% url 'create_bid' tender.id %}" class="btn btn-primary">Create Bid</a>
        </div>
        <div class="card-body">
            {% if bids %}
                <ul class="list-group">
                    {% for bid in bids %}
                        <li class="list-group-item d-flex justify-content-between align-items-center">
                            <span>{{ bid.company.name }} - ${{ bid.amount }}</span>
                        </li>
                    {% endfor %}
                </ul>
            {% else %}
                <p>No bids yet.</p>
            {% endif %}
        </div>
    </div>
</div>
{% endblock %}
