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

96 lines
4.1 KiB
HTML
Raw Normal View History

2023-02-19 23:56:05 +01:00
{% extends 'base.html' %}
2023-05-16 23:36:40 +02:00
{% load i18n %}
2023-02-19 23:56:05 +01:00
{% block title %}Offer: {{ offer.title }}{% endblock %}
{% block meta %}
<meta name="description"
content="{{ offer.user.username }} offers {{ offer.title }}!">
<meta name="author" content="{{ offer.user.username }}">
{% endblock %}
2023-02-19 21:37:53 +01:00
{% block content %}
2023-05-16 23:36:40 +02:00
{% if offer.user == request.user %}
<div class="alert alert-info" role="alert">{% trans "This is your offer!" %}</div>
{% endif %}
2023-03-31 23:56:46 +02:00
<div class="show-offer-container row gx-5">
<div class="show-img-container col-12 col-md-6">
2023-02-19 23:56:05 +01:00
<img class="mb-3 img-fluid rounded"
alt="Generic placeholder image"
src="{{ offer.image.url }}">
</div>
2023-03-31 23:56:46 +02:00
<div class="show-offer-info col-12 col-md-6">
2023-02-19 23:56:05 +01:00
<h1 class="mb-3">{{ offer.title }}</h1>
2023-02-20 11:31:10 +01:00
<div class="mb-3 d-flex column-gap-2">
<p class="mr-3">
2023-02-19 23:56:05 +01:00
<i class="fas fa-user"></i>
{% if offer.user == user %}
2023-05-16 23:36:40 +02:00
{% trans "You" %}
2023-02-19 23:56:05 +01:00
{% else %}
{{ offer.user.username }}
{% endif %}
</p>
2023-02-20 11:31:10 +01:00
<p class="mr-3">
2023-02-19 23:56:05 +01:00
<i class="fas fa-map-marker-alt"></i> {{ offer.zipcode }}
</p>
2023-04-09 13:07:50 +02:00
{% if dist %}
2023-02-19 23:56:05 +01:00
<p class="pr-3">
2023-04-09 13:07:50 +02:00
<i class="fas fa-map-signs mr-1"></i> ca. {{ dist }} km
2023-02-19 23:56:05 +01:00
</p>
{% endif %}
2023-02-19 21:37:53 +01:00
</div>
2023-05-16 23:36:40 +02:00
<h3>{% trans "Description" %}</h3>
2023-02-19 23:56:05 +01:00
<p>{{ offer.description }}</p>
</div>
2023-02-19 21:37:53 +01:00
</div>
2023-02-19 23:56:05 +01:00
{% if offer.user == user %}
2023-03-31 23:56:46 +02:00
<a href="{% url 'offer_edit' offer.id %}" class="btn btn-pfl"><i class="fas fa-pen"></i></a>
2023-03-31 18:10:38 +02:00
<!-- Button trigger modal -->
2023-02-19 23:56:05 +01:00
<button type="button"
2023-03-31 18:10:38 +02:00
class="btn btn-danger"
data-bs-toggle="modal"
data-bs-target="#exampleModal">
2023-02-19 23:56:05 +01:00
<i class="fas fa-trash-alt"></i>
</button>
<!-- Modal -->
<div class="modal fade"
id="exampleModal"
tabindex="-1"
aria-labelledby="exampleModalLabel"
aria-hidden="true">
2023-03-31 18:10:38 +02:00
<div class="modal-dialog">
2023-02-19 23:56:05 +01:00
<div class="modal-content">
<div class="modal-header">
2023-05-16 23:36:40 +02:00
<h1 class="modal-title fs-5" id="exampleModalLabel">{% trans "Delete offer" %}</h1>
2023-03-31 18:10:38 +02:00
<button type="button"
class="btn-close"
data-bs-dismiss="modal"
2023-05-16 23:36:40 +02:00
aria-label="{% trans 'Close' %}"></button>
2023-02-19 23:56:05 +01:00
</div>
2023-05-16 23:36:40 +02:00
<div class="modal-body">{% trans "Do you really want to delete this offer? This can't be undone." %}</div>
2023-02-19 23:56:05 +01:00
<div class="modal-footer">
2023-05-16 23:36:40 +02:00
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">{% trans "Cancel" %}</button>
2023-03-31 18:10:38 +02:00
<a href="{% url 'offer_delete' offer.id %}"
type="button"
2023-05-16 23:36:40 +02:00
class="btn btn-danger">{% trans "Delete" %}</a>
2023-02-19 21:37:53 +01:00
</div>
</div>
2023-02-19 23:56:05 +01:00
</div>
2023-02-19 21:37:53 +01:00
</div>
{% else %}
2023-05-16 23:36:40 +02:00
<h3>{% trans "Wishes" %}</h3>
<p>{{ offer.user.username }} {% trans "would like some of the following in return" %}:</p>
2023-02-19 23:56:05 +01:00
<div class="mb-3">
{% if wishes %}
<ul class="list-group">
{% for wish in wishes %}<li class="list-group-item">{{ wish.title }}</li>{% endfor %}
</ul>
2023-04-09 13:00:40 +02:00
{% else %}
2023-05-16 23:36:40 +02:00
<div class="alert alert-warning" role="alert">{% trans "There are currently no wishes!" %}</div>
2023-02-19 23:56:05 +01:00
{% endif %}
</div>
2023-05-18 14:24:47 +02:00
<form method="post" action="{% url 'offer_trade' %}">
{% csrf_token %}
<input type="hidden" name="offer" value="{{ offer.id }}"/>
<button class="btn btn-pfl mb-3" data-umami-event="Trade offer">{% trans "Offer trade" %}</button>
</form>
2023-02-19 21:37:53 +01:00
{% endif %}
{% endblock %}