From 354e36068482d84785dcbc53350f8bc3c696eae4 Mon Sep 17 00:00:00 2001
From: YvanSv <yvan.savergne@gmail.com>
Date: Wed, 3 Apr 2024 18:17:27 +0200
Subject: [PATCH] =?UTF-8?q?verification=20que=20l'utilisateur=20ait=20la?=
 =?UTF-8?q?=20monnaie=20n=C3=A9cessaire=20pour=20payer?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 assets/styles/app.css                      | 11 +++++++++++
 templates/annonce_detail/annonce.html.twig | 14 +++++++++++---
 2 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/assets/styles/app.css b/assets/styles/app.css
index e40715f4..7148b334 100644
--- a/assets/styles/app.css
+++ b/assets/styles/app.css
@@ -170,6 +170,17 @@ button {
     font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
 }
 
+.btn-pauvre {
+    color: white;
+    width: 500px;
+    background-color: rgb(85, 85, 85);
+    border-radius: 5px;
+    font-size: 20px;
+    padding: 15px;
+    margin: 5px;
+    font-family: "Trebuchet MS",sans-serif;
+}
+
 .annonce {
     position: relative;
 }
diff --git a/templates/annonce_detail/annonce.html.twig b/templates/annonce_detail/annonce.html.twig
index c7cb063c..c0cdff42 100644
--- a/templates/annonce_detail/annonce.html.twig
+++ b/templates/annonce_detail/annonce.html.twig
@@ -66,12 +66,20 @@
                         {% else %}
                             {% if annonce.type == "Pret" %}
                                 {% if user.statusAbonnement() == "0" %}
-                                    <a href="{{ path('app_modif_user_abonnement') }}"><button class="btn-connexion" id="btnRepondre">Améliorer mon abonnement</button></a>
+                                    <a href="{{ path('app_modif_user_abonnement') }}"><button class="btn-connexion2" id="btnRepondre">Améliorer mon abonnement</button></a>
                                 {% else %}
-                                    <a href="{{ path('app_reserver_prestation', {'id': annonce.id, 'interet': true}) }}"><button class="btn-connexion" id="btnRepondre">Répondre à l'annonce</button></a>
+                                    {% if user.NbFlorains() >= annonce.CoutPrestation %}
+                                        <a href="{{ path('app_reserver_prestation', {'id': annonce.id, 'interet': true}) }}"><button class="btn-connexion" id="btnRepondre">Répondre à l'annonce</button></a>
+                                    {% else %}
+                                        <a href=""><button class="btn-pauvre" id="btnRepondre">Trop pauvre pour payer</button></a>
+                                    {% endif %}
                                 {% endif %}
                             {% else %}
-                                <a href="{{ path('app_reserver_prestation', {'id': annonce.id, 'interet': true}) }}"><button class="btn-connexion" id="btnRepondre">Répondre à l'annonce</button></a>
+                                {% if user.nb_florains >= annonce.cout_prestation %}
+                                    <a href="{{ path('app_reserver_prestation', {'id': annonce.id, 'interet': true}) }}"><button class="btn-connexion" id="btnRepondre">Répondre à l'annonce</button></a>
+                                {% else %}
+                                    <a href=""><button class="btn-connexion" id="btnRepondre">Trop pauvre pour payer</button></a>
+                                {% endif %}
                             {% endif %}
                         {% endif %}
                     {% endif %}    
-- 
GitLab