From e60d88b2c8303b377af0af533cff4f6b9851db87 Mon Sep 17 00:00:00 2001 From: Zahdi <ZahdiMohcine20@gmail.com> Date: Sun, 23 Mar 2025 23:09:23 +0100 Subject: [PATCH] [Progress] adding the main template for the wishlists --- .gitignore | 3 +- public/.gitignore | 1 - public/css/style.css | 121 ++++++++++++++++++++++++++ src/Controller/WishlistController.php | 11 ++- templates/wishlist/index.html.twig | 80 +++++++++-------- 5 files changed, 177 insertions(+), 39 deletions(-) delete mode 100644 public/.gitignore diff --git a/.gitignore b/.gitignore index 8ec591f0..b52c7fba 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,5 @@ var/ vendor/ docker/ .idea/ -migrations/ \ No newline at end of file +migrations/ +public/uploads \ No newline at end of file diff --git a/public/.gitignore b/public/.gitignore deleted file mode 100644 index fd1f3363..00000000 --- a/public/.gitignore +++ /dev/null @@ -1 +0,0 @@ -uploads/ \ No newline at end of file diff --git a/public/css/style.css b/public/css/style.css index 5ecfcbfb..d99f15ed 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -167,3 +167,124 @@ h1 a { background-color: #0099B8; } +* { + box-sizing: border-box; + font-family: Helvetica, Arial, sans-serif; +} + +body { + margin: 0; + background: #f4f4f4; +} + +header { + display: flex; + align-items: center; + background: #00B8DE; + color: white; + padding: 10px; + gap: 15px; +} + +.user-icon { + width: 40px; + height: 40px; + background: #ccc; + border-radius: 50%; +} + +h1 { + margin: 0; + font-size: 18px; + font-weight: bold; +} + +.search-bar { + margin-left: auto; + padding: 5px; + border-radius: 5px; + border: none; +} + +.navbar { + background: white; + padding: 10px; + display: flex; + justify-content: center; + border-bottom: 2px solid #ccc; +} + +.add-wishlist-btn { + padding: 8px 15px; + background: #00B8DE; + color: white; + border: none; + border-radius: 5px; + cursor: pointer; +} + +.add-wishlist-btn:hover { + background: #0099B8; +} + +.container { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + gap: 20px; + margin-top: 20px; +} + +.wishlist { + background: white; + border: 2px solid #99CC33; + border-radius: 10px; + padding: 15px; + width: 50%; + position: relative; +} + +.wishlist h2 { + margin: 0; + font-size: 16px; + color: blue; + cursor: pointer; +} + +.wishlist-items { + display: flex; + gap: 10px; + margin-top: 10px; +} + +.wishlist-item { + width: 50px; + height: 50px; + background: #ddd; + display: flex; + justify-content: center; + align-items: center; + border-radius: 5px; +} + +.wishlist-footer { + margin-top: 10px; + font-size: 12px; +} + +.wishlist-actions { + position: absolute; + top: 10px; + right: 10px; + display: flex; + gap: 5px; +} + +.wishlist-actions button { + background: white; + border: 1px solid black; + border-radius: 3px; + padding: 5px; + cursor: pointer; +} \ No newline at end of file diff --git a/src/Controller/WishlistController.php b/src/Controller/WishlistController.php index ebc8c3e7..1a39ebad 100644 --- a/src/Controller/WishlistController.php +++ b/src/Controller/WishlistController.php @@ -61,7 +61,12 @@ final class WishlistController extends AbstractController #[Route('/{id}/edit', name: 'app_wishlist_edit', methods: ['GET', 'POST'])] public function edit(Request $request, Wishlist $wishlist, EntityManagerInterface $entityManager): Response { - $form = $this->createForm(WishlistType::class, $wishlist); + $wishlist->setName($request->get('name')); + $wishlist->setDeadline($request->get('deadline')) ; + $entityManager->persist($wishlist); + $entityManager->flush(); + return new Response('wishlist was modified successfully ', Response::HTTP_ACCEPTED) ; +/* $form = $this->createForm(WishlistType::class, $wishlist); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { @@ -73,7 +78,7 @@ final class WishlistController extends AbstractController return $this->render('wishlist/edit.html.twig', [ 'wishlist' => $wishlist, 'form' => $form, - ]); + ]); */ } #[Route('/{id}', name: 'app_wishlist_delete', methods: ['POST'])] @@ -86,4 +91,6 @@ final class WishlistController extends AbstractController return $this->redirectToRoute('app_wishlist_index', [], Response::HTTP_SEE_OTHER); } + + } diff --git a/templates/wishlist/index.html.twig b/templates/wishlist/index.html.twig index ecf8ee42..e363ce0d 100644 --- a/templates/wishlist/index.html.twig +++ b/templates/wishlist/index.html.twig @@ -1,39 +1,49 @@ -{% extends 'base.html.twig' %} -{% block title %}Wishlist index{% endblock %} +{% extends 'base.html.twig' %} -{% block body %} - <h1>Wishlist index</h1> +{% block title %} My Wishlists {% endblock %} - <table class="table"> - <thead> - <tr> - <th>Id</th> - <th>Name</th> - <th>Deadline</th> - <th>IsDisabled</th> - <th>actions</th> - </tr> - </thead> - <tbody> - {% for wishlist in wishlists %} - <tr> - <td>{{ wishlist.id }}</td> - <td>{{ wishlist.name }}</td> - <td>{{ wishlist.deadline ? wishlist.deadline|date('Y-m-d H:i:s') : '' }}</td> - <td>{{ wishlist.isDisabled ? 'Yes' : 'No' }}</td> - <td> - <a href="{{ path('app_wishlist_show', {'id': wishlist.id}) }}">show</a> - <a href="{{ path('app_wishlist_edit', {'id': wishlist.id}) }}">edit</a> - </td> - </tr> - {% else %} - <tr> - <td colspan="5">no records found</td> - </tr> - {% endfor %} - </tbody> - </table> - <a href="{{ path('app_wishlist_new') }}">Create new</a> -{% endblock %} +{% block body %} + <header> + <div class="user-icon"></div> + <h1>My Wishlists</h1> + <input type="text" class="search-bar" placeholder="Search..."> + </header> + + <div class="navbar"> + <button class="add-wishlist-btn">Add wishlist</button> + </div> + + <div class="container"> + <div class="wishlist"> + <h2>wish list 1 title</h2> + <div class="wishlist-items"> + <div class="wishlist-item">📷</div> + <div class="wishlist-item">📷</div> + <div class="wishlist-item">📷</div> + </div> + <p class="wishlist-footer">Authors: name1, name2</p> + <div class="wishlist-actions"> + <button title="Share wishlist">↗</button> + <button title="Edit title">✏</button> + <button title="Delete wishlist">🗑</button> + </div> + </div> + + <div class="wishlist"> + <h2>wish list 2 title</h2> + <div class="wishlist-items"> + <div class="wishlist-item">📷</div> + <div class="wishlist-item">📷</div> + <div class="wishlist-item">📷</div> + </div> + <p class="wishlist-footer">Authors: name1</p> + <div class="wishlist-actions"> + <button title="Share wishlist">↗</button> + <button title="Edit title">✏</button> + <button title="Delete wishlist">🗑</button> + </div> + </div> + </div> + {% endblock %} -- GitLab