Browse Source

début travaux sur page utilisateur

garthh 1 day ago
parent
commit
cadc371c0e

+ 1 - 1
.env.dev

@@ -6,4 +6,4 @@ APP_SECRET=9444953c16af07ebd200c01d4daf96a4
 ### Spécifiques à l'application ###
 # Adresse de courriel pour l'envoi des messages
 CONTACT_EMAIL=no-reply@mail.com
-CONTACT_NAME=Orgasso
+CONTACT_NAME=Orgasso

+ 2 - 0
.gitignore

@@ -23,9 +23,11 @@
 /public/images/gamemasters/*.png
 /public/images/gamemasters/*.jpg
 /public/images/gamemasters/*.jpeg
+/public/images/gamemasters/*.webp
 /public/images/games/*.png
 /public/images/games/*.jpg
 /public/images/games/*.jpeg
+/public/images/games/*.webp
 /public/pages/*.md
 /database.db
 /some_datas.sql

+ 26 - 0
src/Controller/ProfileController.php

@@ -0,0 +1,26 @@
+<?php
+
+namespace App\Controller;
+
+use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
+use Symfony\Component\HttpFoundation\Response;
+use Symfony\Component\Routing\Attribute\Route;
+
+final class ProfileController extends AbstractController
+{
+    #[Route('/profile', name: 'app_profile')]
+    public function index(): Response
+    {
+        return $this->render('profile/index.html.twig', [
+            'controller_name' => 'ProfileController',
+        ]);
+    }
+
+    #[Route('/profile/reservation', name: 'app_profile_reservations')]
+    public function reservations(): Response
+    {
+        return $this->render('profile/index.html.twig', [
+            'controller_name' => 'ProfileController'
+        ]);
+    }
+}

+ 4 - 0
src/Controller/RegistrationController.php

@@ -28,6 +28,10 @@ class RegistrationController extends AbstractController
     #[Route('/register', name: 'app_register')]
     public function register(Request $request, UserPasswordHasherInterface $userPasswordHasher, EntityManagerInterface $entityManager, MailerInterface $mailer): Response
     {
+        if (strtolower($_ENV['APP_ALLOW_REGISTER']) != "true") {
+            $this->addFlash('info', 'Les créations de comptes sont désactivées sur cette plateforme. Contactez les administrateurs.');
+            return $this->redirectToRoute('app_main');
+        }
 
         // SI l'utilisateur est déjà connecté, rediriger vers la page d'accueil
         if ($this->getUser()) {

+ 1 - 0
src/Controller/SecurityController.php

@@ -25,6 +25,7 @@ class SecurityController extends AbstractController
 
         return $this->render('security/login.html.twig', [
             'last_username' => $lastUsername,
+            'account_creation' => strtolower($_ENV['APP_ALLOW_REGISTER'])
         ]);
     }
 

+ 2 - 1
src/Form/GamemasterType.php

@@ -11,6 +11,7 @@ use Symfony\Component\Form\FormBuilderInterface;
 use Symfony\Component\OptionsResolver\OptionsResolver;
 use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
 use Symfony\Component\Form\Extension\Core\Type\FileType;
+use App\Repository\UserRepository;
 
 class GamemasterType extends AbstractType
 {
@@ -112,7 +113,7 @@ class GamemasterType extends AbstractType
                 'required' => false,
                 'row_attr' => ['class' => 'field'],
                 'help_attr' => ['class' => 'help'],
-                'help' => 'Sélectionner le compte à lier à ce MJ.'
+                'help' => 'Sélectionner le compte à lier à ce MJ.',
             ])
         ;
     }

+ 11 - 0
src/Repository/UserRepository.php

@@ -58,6 +58,17 @@ class UserRepository extends ServiceEntityRepository implements PasswordUpgrader
             ;    
     }
 
+    public function findAllNonGM(): array
+    {
+        $qb = $this->createQueryBuilder('u')
+          ->where('g.linkToGamemaster IS null')
+          ->getQuery()
+          ->getResult();
+        
+        return $qb;
+
+    }
+
     //    /**
     //     * @return User[] Returns an array of User objects
     //     */

+ 4 - 0
templates/admin/game/index.html.twig

@@ -28,6 +28,8 @@
             <thead>
             <tr>
                 <th>Nom du jeu</th>
+                <th>Description</th>
+                <th>Genres</th>
                 <th>Validé?</th>
                 <th>Actions</th>
             </tr>
@@ -36,6 +38,8 @@
             {% for game in games %}
                 <tr>
                     <td><a href="{{ path('app_admin_game_edit', {id: game.id}) }}">{{ game.name }}</a></td>
+                    <td>{{ game.description }}</td>
+                    <td>{% for genre in game.genre %}<span class="tag is-info is-light">{{ genre.genre }}</span> {% endfor %}</td>
                     <td>{% if game.isValidByAdmin %}<span class="icon"><twig:ux:icon name="bi:check"/></span>{% else %}<a href="{{ path('app_admin_game_valid', {id: game.id}) }}" class="button">Valider</a>{%endif%}</td>
                     <td>
                         <a class="button" href="{{ path('app_admin_game_edit', {id: game.id}) }}">Éditer</a>

+ 1 - 1
templates/bulma.html.twig

@@ -51,7 +51,7 @@
               <div class="navbar-item has-dropdown is-hoverable">
                 <a class="navbar-link">{{ app.user.firstName }}</a>
                 <div class="navbar-dropdown is-right">
-                  <a class="navbar-item" href="#" class="">Mon compte</a>
+                  <a class="navbar-item" href="{{ path('app_profile') }}" class="">Mon compte</a>
                   <a class="navbar-item" href="#">Mes réservations</a>
                   {% if is_granted('ROLE_ADMIN') %}
                   <hr class="navbar-divider" />

+ 27 - 0
templates/profile/index.html.twig

@@ -0,0 +1,27 @@
+{% extends 'bulma.html.twig' %}
+
+{% block title %}Compte{% endblock %}
+
+{% block content %}
+
+    <nav class="breadcrumb has-arrow-separator" aria-label="breadcrumbs">
+      <ul>
+        <li><a href="{{ path('app_main') }}">Accueil</a></li>
+        <li class="is-active"><a href="{{ path('app_profile') }}">Compte</a></li>
+      </ul>
+    </nav>
+
+    <div class="tabs is-boxed">
+        <ul>
+            <li class="is-active"><a>Compte utilisateur(rice)</a></li>
+            {% if app.user.linkToGamemaster %}
+            <li><a>Meneur(euse) de jeu</a></li>
+            <li><a>Liste des jeux</a></lI>
+            <li><a>Proposer un jeu</a></li>
+            {% endif %}
+        </ul>
+    </div>
+
+
+
+{% endblock %}

+ 1 - 0
templates/registration/register.html.twig

@@ -3,6 +3,7 @@
 {% block title %}S'enregistrer{% endblock %}
 
 {% block content %}
+
     <div class="content">
         <div class="container">
             <div class="columns is-centered">

+ 2 - 2
templates/security/login.html.twig

@@ -55,8 +55,8 @@
           </div>
 
           <p class="has-text-centered mt-3">
-            <a href="{{ path('app_forgot_password_request') }}">Mot de passe oublié</a> |
-            <a href="{{ path('app_register') }}">Créer un compte</a>
+            <a href="{{ path('app_forgot_password_request') }}">Mot de passe oublié</a>{% if account_creation == "true" %} |
+            <a href="{{ path('app_register') }}">Créer un compte</a>{% endif %}
           </p>
 
           <p class="has-text-centered mt-4">