Skip to content

Commit

Permalink
correctioon
Browse files Browse the repository at this point in the history
  • Loading branch information
CedricBds committed Jan 27, 2022
1 parent da69840 commit f0e6399
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
10 changes: 8 additions & 2 deletions src/Controller/PanierSessionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ public function confirm(SessionInterface $session, ProBundlesRepository $proBund

//On enregistre les données en base

$userType = "";

$dataPanier = [];
$total = 0;
foreach ($panier as $id => $quantite) {
Expand Down Expand Up @@ -145,7 +147,7 @@ public function confirm(SessionInterface $session, ProBundlesRepository $proBund
} else {
$orderData->setIdUtilisateur('VISITEUR');
}

$userType = $orderData->getIdUtilisateur();
$manager->persist($orderData);

// //save donnés
Expand All @@ -156,7 +158,11 @@ public function confirm(SessionInterface $session, ProBundlesRepository $proBund
//On clear les donnés du panier
$session->remove("panier");

return $this->render('cart/confirm.html.twig',);
return $this->render(
'cart/confirm.html.twig',
['userType' => $userType]

);
}


Expand Down
22 changes: 13 additions & 9 deletions templates/cart/confirm.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,24 @@
{% block body %}


<div class="container mt-5">

<div class="container mt-5">

<div class="alert alert-success" role="alert">
<h4 class="alert-heading">Bravo !</h4>
<p>Votre panier à bien été enregistré.</p>
<hr>
<p class="mb-0">Vous pouvez le confirmer à tout moment depuis votre profil.</p>
{% if userType == "VISITEUR" %}
<a href="/login" class="btn btn-warning">Veuillez vous connecter pour effectuer le paiement</a>

<div class="alert alert-success" role="alert">
<h4 class="alert-heading">Bravo !</h4>
<p>Votre panier à bien été enregistré.</p>
<hr>
<p class="mb-0">Vous pouvez le confirmer à tout moment depuis votre profil.</p>
</div>

{% endif %}

</div>
</div>


{% endblock %}
</div>


{% endblock %}

0 comments on commit f0e6399

Please sign in to comment.