diff --git a/src/Controller/OfferController.php b/src/Controller/OfferController.php index 2feeaa0..9f487e2 100644 --- a/src/Controller/OfferController.php +++ b/src/Controller/OfferController.php @@ -6,6 +6,8 @@ use App\Entity\Offering; use App\Form\OfferingFormType; use App\Repository\OfferingRepository; +use App\Repository\WishRepository; + use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; @@ -70,10 +72,11 @@ class OfferController extends AbstractController } #[Route('/offer/{id}', name: 'show_offer')] - public function show_offer(Offering $offering): Response + public function show_offer(Offering $offering, WishRepository $wishRepository): Response { return $this->render('app/offer.html.twig', [ 'offer' => $offering, + 'wishes' => $wishRepository->findByUser($offering->getByUser()), ]); } } diff --git a/src/Controller/UserController.php b/src/Controller/UserController.php index cb57846..b593bfa 100644 --- a/src/Controller/UserController.php +++ b/src/Controller/UserController.php @@ -3,6 +3,7 @@ namespace App\Controller; use App\Entity\Wish; +use App\Entity\User; use App\Form\WishFormType; use App\Repository\WishRepository; @@ -56,4 +57,14 @@ class UserController extends AbstractController 'wish_form' => $form->createView(), ]); } + + #[Route('/user/{id}', name: 'public_wishlist')] + public function show_user(User $user, WishRepository $wishRepository): Response + { + return $this->render('user/public_wishlist.html.twig', [ + 'username' => $user->getUsername(), + 'wishes' => $wishRepository->findByUser($user), + ]); + } + } diff --git a/templates/app/offer.html.twig b/templates/app/offer.html.twig index ef68c8e..4f22e69 100644 --- a/templates/app/offer.html.twig +++ b/templates/app/offer.html.twig @@ -16,6 +16,21 @@ From

{{ offer.byUser }} in {{ offer.zipCode }}

+

Wishes

+

{{ offer.byUser }} would like some of the following in return:

+
+ {% if wishes == [] %} + + {% else %} + + {% endif %} +
{% endblock %} \ No newline at end of file diff --git a/templates/user/public_wishlist.html.twig b/templates/user/public_wishlist.html.twig new file mode 100644 index 0000000..1237d1e --- /dev/null +++ b/templates/user/public_wishlist.html.twig @@ -0,0 +1,29 @@ +{% extends 'base.html.twig' %} + +{% block title %}Whishlist{% endblock %} + +{% block body %} + {% for message in app.flashes('success') %} + + {% endfor %} + +
+

{{ username }}'s' Wishlist

+
+ +
+ {% if wishes == [] %} + + {% else %} + + {% endif %} +
+{% endblock %} \ No newline at end of file