pflaenz.li/pflaenzli/pflaenzli/templates/offer/search.html

62 lines
2.4 KiB
HTML
Raw Normal View History

2023-02-19 23:56:05 +01:00
{% extends 'base.html' %}
2023-02-20 11:31:10 +01:00
{% load static %}
2023-05-16 23:36:40 +02:00
{% load i18n %}
2023-04-15 13:16:40 +02:00
{% load crispy_forms_tags %}
2023-05-16 23:36:40 +02:00
{% block title %}
2023-05-18 15:50:48 +02:00
{% trans 'Offers' %}
{% endblock %}
{% block meta %}
<meta name="description" content="{% trans 'Search for offers' %}">
2023-05-16 23:36:40 +02:00
{% endblock %}
2023-02-19 23:56:05 +01:00
{% block content %}
2023-04-15 13:16:40 +02:00
<h1 class="mt-3">
2023-05-17 15:48:23 +02:00
{% trans "Offers" %}
2023-04-15 13:16:40 +02:00
<button class="btn btn-pfl"
type="button"
data-bs-toggle="collapse"
data-bs-target="#filterCollapse"
aria-expanded="true"
aria-controls="filterCollapse">
2023-05-16 23:36:40 +02:00
<i class="fa-solid fa-filter"></i> {% trans 'Filter' %}
2023-04-15 13:16:40 +02:00
</button>
</h1>
<form method="post"
enctype="multipart/form-data"
class="collapse"
id="filterCollapse">
{% csrf_token %}
{{ form|crispy }}
2023-05-16 23:36:40 +02:00
<button type="submit" class="btn btn-pfl">{% trans 'Filter' %}</button>
2023-04-15 13:16:40 +02:00
</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 %}
2023-05-16 23:36:40 +02:00
<div class="alert alert-warning" role="alert">{% trans 'There are no active offers with the current filter.' %}</div>
2023-02-19 23:56:05 +01:00
{% endif %}
{% endblock %}