From 0381d8953e25081fd3f89876656388fae9e54a25 Mon Sep 17 00:00:00 2001
From: mohamed <mohamed.oun@imt-atlantique.fr>
Date: Wed, 26 Mar 2025 01:43:41 +0100
Subject: [PATCH] minore

---
 src/Form/ItemType.php        | 16 ++++++++--------
 templates/item/new.html.twig | 23 ++++++++++++++---------
 2 files changed, 22 insertions(+), 17 deletions(-)

diff --git a/src/Form/ItemType.php b/src/Form/ItemType.php
index a54aba61..864d946e 100644
--- a/src/Form/ItemType.php
+++ b/src/Form/ItemType.php
@@ -20,11 +20,11 @@ class ItemType extends AbstractType
             ->add('price', NumberType::class, ['label' => 'Price'])
             ->add('description', TextType::class, ['label' => 'Description'])
             ->add('imageFile', VichImageType::class, [
-                'label' => 'Upload a new image', // ✅ Change le label pour éviter la confusion
-                'required' => false, // ✅ Permet de ne pas forcer un nouvel upload
-                'allow_delete' => false, // ✅ Désactive la suppression automatique
-                'download_uri' => false, // ✅ Désactive le lien de téléchargement
-                'image_uri' => false, // ✅ Empêche l'affichage de l'image dans l'input
+                'label' => 'Upload a new image',
+                'required' => false,
+                'allow_delete' => false,
+                'download_uri' => false,
+                'image_uri' => false,
             ]);
     }
 
@@ -32,9 +32,9 @@ class ItemType extends AbstractType
     {
         $resolver->setDefaults([
             'data_class' => Item::class,
-            'csrf_protection' => true, // ✅ Active la protection CSRF
-            'csrf_field_name' => '_token', // ✅ Définit le nom du champ CSRF
-            'csrf_token_id'   => 'submit', // ✅ Identifie le token
+            'csrf_protection' => true,
+            'csrf_field_name' => '_token',
+            'csrf_token_id'   => 'submit',
         ]);
     }
 }
diff --git a/templates/item/new.html.twig b/templates/item/new.html.twig
index 0009c339..f987ca28 100644
--- a/templates/item/new.html.twig
+++ b/templates/item/new.html.twig
@@ -62,6 +62,7 @@
             font-size: 1rem;
             cursor: pointer;
             transition: 0.3s;
+            margin-top: 15px;
         }
         .btn:hover {
             background-color: #99CC33;
@@ -87,15 +88,19 @@
         <div class="container">
             <section class="form-section">
                 {{ form_start(form, {'attr': {'class': 'input-box'}}) }}
-                {{ form_row(form.title, {'attr': {'class': 'form-control'}}) }}
-                {{ form_row(form.url, {'attr': {'class': 'form-control'}}) }}
-                {{ form_row(form.price, {'attr': {'class': 'form-control'}}) }}
-                {{ form_row(form.description, {'attr': {'class': 'form-control'}}) }}
-                
-                <h3>Item Image</h3>
-                {{ form_row(form.imageFile, {'attr': {'class': 'form-control'}}) }}
-                
-                <button class="btn">Confirm</button>
+
+                    {{ form_row(form.title, {'attr': {'class': 'form-control'}}) }}
+                    {{ form_row(form.url, {'attr': {'class': 'form-control'}}) }}
+                    {{ form_row(form.price, {'attr': {'class': 'form-control'}}) }}
+                    {{ form_row(form.description, {'attr': {'class': 'form-control'}}) }}
+
+                    <h3 style="margin-top: 20px;">Item Image</h3>
+                    {{ form_row(form.imageFile, {'attr': {'class': 'form-control'}}) }}
+
+                    {{ form_rest(form) }} {# ✅ Inclut le token CSRF ici #}
+
+                    <button class="btn" type="submit">Confirm</button>
+
                 {{ form_end(form) }}
             </section>
         </div>
-- 
GitLab