Don't use primary key for offers

This commit is contained in:
Jannis Portmann 2022-01-17 19:11:00 +01:00
parent 539b7edffe
commit d190971718
8 changed files with 65 additions and 15 deletions

View file

@ -47,7 +47,7 @@
</div>
{% if offer.byUser == user %}
<a href="{{ path('edit_offer', {'id': offer.id}) }}" class="btn btn-info mb-3"><i class="fas fa-pen"></i></a>
<a href="{{ path('edit_offer', {'urlId': offer.urlId}) }}" class="btn btn-info mb-3"><i class="fas fa-pen"></i></a>
<button type="button" class="btn btn-danger mb-3" data-toggle="modal" data-target="#exampleModal"><i class="fas fa-trash-alt"></i></button>
<!-- Modal -->
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
@ -64,7 +64,7 @@
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
<a type="button" class="btn btn-danger" href="{{ path('delete_offer', {'id': offer.id}) }}">Delete</a>
<a type="button" class="btn btn-danger" href="{{ path('delete_offer', {'urlId': offer.urlId}) }}">Delete</a>
</div>
</div>
</div>
@ -85,6 +85,6 @@
</ul>
{% endif %}
</div>
<a class="btn btn-primary mb-3" href="{{ path('trade', {'id': offer.id}) }}">Offer trade</a>
<a class="btn btn-primary mb-3" href="{{ path('trade', {'urlId': offer.urlId}) }}">Offer trade</a>
{% endif %}
{% endblock %}

View file

@ -30,7 +30,7 @@
{% for offer in offers %}
<div class="mb-5">
<div class="card offer h-100">
<a href="{{ path('show_offer', {'id': offer.id }) }}">
<a href="{{ path('show_offer', {'urlId': offer.urlId }) }}">
{% if offer.photoFilename %}
<img class="card-img-top offer-img" src="{{ asset('uploads/photos/' ~ offer.photofilename) }}" />
{% else %}

View file

@ -14,7 +14,7 @@
{% for offer in offers %}
<div class="mb-5">
<div class="card offer h-100">
<a href="{{ path('show_offer', {'id': offer.id }) }}">
<a href="{{ path('show_offer', {'urlId': offer.urlId }) }}">
{% if offer.photoFilename %}
<img class="card-img-top offer-img" src="{{ asset('uploads/photos/' ~ offer.photofilename) }}" />
{% else %}
@ -26,12 +26,12 @@
</div>
</a>
<div class="card-footer offer-footer">
<a href="{{ path('edit_offer', {'id': offer.id}) }}" class="btn btn-info"><i class="fas fa-pen"></i></a>
<button type="button" class="btn btn-danger" data-toggle="modal" data-target="#offer-modal-{{ offer.id }}"><i class="fas fa-trash-alt"></i></button>
<a href="{{ path('edit_offer', {'urlId': offer.urlId}) }}" class="btn btn-info"><i class="fas fa-pen"></i></a>
<button type="button" class="btn btn-danger" data-toggle="modal" data-target="#offer-modal-{{ offer.urlId }}"><i class="fas fa-trash-alt"></i></button>
</div>
</div>
<!-- Modal -->
<div class="modal fade" id="offer-modal-{{ offer.id }}" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal fade" id="offer-modal-{{ offer.urlId }}" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
@ -45,7 +45,7 @@
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
<a type="button" class="btn btn-danger" href="{{ path('delete_offer', {'id': offer.id}) }}">Delete</a>
<a type="button" class="btn btn-danger" href="{{ path('delete_offer', {'urlId': offer.urlId}) }}">Delete</a>
</div>
</div>
</div>

View file

@ -36,7 +36,7 @@
{% for offer in offers %}
<div class="mb-5">
<div class="card offer h-100">
<a href="{{ path('show_offer', {'id': offer.id }) }}">
<a href="{{ path('show_offer', {'urlId': offer.urlId }) }}">
{% if offer.photoFilename %}
<img class="card-img-top offer-img" src="{{ asset('uploads/photos/' ~ offer.photofilename) }}" />
{% else %}