list users offers

This commit is contained in:
Jannis Portmann 2021-05-09 11:20:19 +02:00
parent 185bede2b7
commit 19d2bfbcc3
2 changed files with 45 additions and 0 deletions

View file

@ -36,6 +36,17 @@ class UserController extends AbstractController
]); ]);
} }
#[Route('/user/offers', name: 'user_offers')]
public function userOffers(OfferingRepository $offeringRepository): Response
{
$user = $this->getUser();
return $this->render('user/offers.html.twig', [
'user' => $user,
'offers' => $offeringRepository->findByUser($user),
]);
}
#[Route('/user/{id}', name: 'public_wishlist')] #[Route('/user/{id}', name: 'public_wishlist')]
public function show_user(User $user, WishRepository $wishRepository): Response public function show_user(User $user, WishRepository $wishRepository): Response
{ {

View file

@ -0,0 +1,34 @@
{% extends 'base.html.twig' %}
{% block title %}My offers{% endblock %}
{% block body %}
{% for message in app.flashes('success') %}
<div class="alert alert-success" role="alert">
{{ message }}
</div>
{% endfor %}
<h1>Offers</h1>
{% if offers|length > 0 %}
<div class="card-deck d-flex justify-content-around justify-content-sm-around justify-content-md-between flex-wrap">
{% for offer in offers %}
<div class="card offer h-100">
{% if offer.photoFilename %}
<img class="card-img-top" src="{{ asset('uploads/photos/' ~ offer.photofilename) }}" />
{% endif %}
<div class="card-body">
<h5 class="card-title">{{ offer.title }}</h5>
<p class="card-text">{{ offer.description }}</p>
</div>
<div class="card-footer offer-footer">
<a href=" {{ path('show_offer', { id: offer.id }) }}" class="btn btn-primary"><i class="fas fa-external-link-alt"></i></a>
<a href="#" class="btn btn-info"><i class="fas fa-pen"></i></a>
<a href="#" class="btn btn-danger"><i class="fas fa-trash-alt"></i></a>
</div>
</div>
{% endfor %}
</div>
{% else %}
<div class="alert alert-warning" role="alert">There are currently no active offers.</div>
{% endif %}
{% endblock %}