2023-02-19 23:56:05 +01:00
|
|
|
{% extends 'base.html' %}
|
2023-02-20 11:31:10 +01:00
|
|
|
{% load static %}
|
2023-04-15 13:16:40 +02:00
|
|
|
{% load crispy_forms_tags %}
|
2023-02-19 23:56:05 +01:00
|
|
|
{% block title %}Offers{% endblock %}
|
|
|
|
{% block content %}
|
2023-04-15 13:16:40 +02:00
|
|
|
<h1 class="mt-3">
|
|
|
|
Offers
|
|
|
|
<button class="btn btn-pfl"
|
|
|
|
type="button"
|
|
|
|
data-bs-toggle="collapse"
|
|
|
|
data-bs-target="#filterCollapse"
|
|
|
|
aria-expanded="true"
|
|
|
|
aria-controls="filterCollapse">
|
|
|
|
<i class="fa-solid fa-filter"></i> Filter
|
|
|
|
</button>
|
|
|
|
</h1>
|
|
|
|
<form method="post"
|
|
|
|
enctype="multipart/form-data"
|
|
|
|
class="collapse"
|
|
|
|
id="filterCollapse">
|
|
|
|
{% csrf_token %}
|
|
|
|
{{ form|crispy }}
|
|
|
|
<button type="submit" class="btn btn-pfl">Filter</button>
|
|
|
|
</form>
|
2023-02-20 11:31:10 +01:00
|
|
|
{% if offers %}
|
2023-04-15 13:16:40 +02:00
|
|
|
<div class="row row-cols-1 row-cols-md-2 row-cols-xl-3 mt-3 mb-3 row-gap-5">
|
2023-02-19 23:56:05 +01:00
|
|
|
{% for offer in offers %}
|
2023-02-20 11:31:10 +01:00
|
|
|
<div class="col">
|
|
|
|
<div class="card h-100 p-0">
|
|
|
|
<a href="{% url 'offer_detail' offer.id %}">
|
|
|
|
{% if offer.image %}
|
|
|
|
<img class="card-img-top offer-img" src="{{ offer.image.url }}"/>
|
2023-02-19 23:56:05 +01:00
|
|
|
{% else %}
|
2023-02-20 11:31:10 +01:00
|
|
|
<img class="card-img-top offer-img" src="{% static 'placeholder.jpg' %}" />
|
2023-02-19 23:56:05 +01:00
|
|
|
{% endif %}
|
|
|
|
<div class="card-body">
|
2023-02-20 11:31:10 +01:00
|
|
|
<h5 class="h5">{{ offer.title }}</h5>
|
2023-02-19 23:56:05 +01:00
|
|
|
</div>
|
|
|
|
</a>
|
2023-02-20 11:31:10 +01:00
|
|
|
<div class="card-footer d-flex justify-content-between">
|
2023-04-02 22:47:04 +02:00
|
|
|
<a href="{% url 'user_detail' offer.user.id %}">
|
2023-02-20 11:31:10 +01:00
|
|
|
<i class="fas fa-user mt-3"></i> {{ offer.user.username }}
|
2023-02-19 23:56:05 +01:00
|
|
|
</a>
|
|
|
|
<p class="zip">
|
2023-02-20 11:31:10 +01:00
|
|
|
<i class="fas fa-map-marker-alt mt-3"></i> {{ offer.zipcode }}
|
2023-02-19 23:56:05 +01:00
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% endfor %}
|
|
|
|
</div>
|
|
|
|
{% else %}
|
|
|
|
<div class="alert alert-warning" role="alert">There are no active offers with the current filter.</div>
|
|
|
|
{% endif %}
|
|
|
|
{% endblock %}
|