Skip to content
Snippets Groups Projects
Commit b80d2a7c authored by AKIFI NAIL's avatar AKIFI NAIL
Browse files

beaucoup de truc

parent d6616c37
Branches
No related merge requests found
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20240326163419 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE produits ADD buycount INT DEFAULT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE produits DROP buycount');
}
}
public/images/ch.png

51.4 KiB

......@@ -19,7 +19,7 @@ body {
position: fixed;
font-family: "Ubuntu", sans-serif;
top: 0;
z-index: 999999999999999999999999999999999999999;
z-index: 9;
transition: background-color 0.3s ease;
}
......@@ -337,7 +337,7 @@ body {
.article-content {
height: 160px;
margin-top: 3%;
z-index: 10;
z-index: 8;
}
.article-content:hover .article-left {
......@@ -477,7 +477,7 @@ body {
}
.img-double {
z-index: 99999;
z-index: 8;
}
.swooshDouble {
......@@ -507,7 +507,7 @@ body {
}
.right-seller {
z-index: 99999;
z-index: 8;
}
.marque img{
......@@ -861,7 +861,7 @@ aside{
z-index: 0;
}
.img-double{
z-index: 99999;
z-index: 8;
margin-left: 6rem;
}
}
......@@ -1208,7 +1208,7 @@ aside article{
}
.chaussure-show{
z-index: 999999;
z-index: 8;
transform: rotate(-25deg);
margin-top: 8rem;
height: 230px;
......@@ -1248,4 +1248,68 @@ aside article{
.show-content{
margin-top: 10rem;
}
\ No newline at end of file
}
.btnsave2{
height: 30px;
width: 130px;
margin: auto;
border: 3px solid #39c0fd;
border-radius: 5px;
color: white;
font-weight: bold;
transition: all .4s ease;
background-color: #39c0fd;
font-size: 1rem;
}
.btnsave2:hover{
background-color: skyblue;
border: 3px solid skyblue;
transition: all .4s ease;
cursor: pointer;
}
.img_panier{
height: 100px;
}
.w-s{
white-space: nowrap;
}
.gap-big9{
gap: 10em;
}
.mt--3{
margin-top: -1rem;
}
.mt-4{
margin-top: 3rem;
}
.btnsave3{
height: 30px;
width: 220px;
margin: auto;
border: 3px solid #39c0fd;
border-radius: 5px;
color: white;
font-weight: bold;
transition: all .4s ease;
background-color: #39c0fd;
font-size: 1rem;
}
.btnsave3:hover{
background-color: skyblue;
border: 3px solid skyblue;
transition: all .4s ease;
cursor: pointer;
}
.toast-container {
position: fixed;
z-index: 999999;
z-index: 999999999999999999999999999999999999999999999999999999999999999999999;
pointer-events: none;
line-height: normal;
line-height: initial;
......
......@@ -200,4 +200,12 @@ ul{
width: 100%;
display: flex;
margin-top: 1rem;
}
\ No newline at end of file
}
.mt-9{
margin-top: 15rem;
}
.mt-8{
margin-top: 10rem;
}
......@@ -23,29 +23,11 @@ class PanierController extends AbstractController
]);
}
#[Route('/new', name: 'app_panier_new', methods: ['GET', 'POST'])]
public function new(Request $request, EntityManagerInterface $entityManager): Response
{
$panier = new Panier();
$form = $this->createForm(PanierType::class, $panier);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$entityManager->persist($panier);
$entityManager->flush();
return $this->redirectToRoute('app_panier_index', [], Response::HTTP_SEE_OTHER);
}
return $this->render('panier/new.html.twig', [
'panier' => $panier,
'form' => $form,
]);
}
#[Route('/{id}', name: 'app_panier_show', methods: ['GET'])]
public function show(Panier $panier): Response
{
return $this->render('panier/show.html.twig', [
'panier' => $panier,
]);
......@@ -114,14 +96,34 @@ class PanierController extends AbstractController
$entityManager->flush();
// Ajoutez un message flash pour informer l'utilisateur de la réussite de l'ajout
$this->addFlash('success', 'Le produit a été ajouté à votre panier.');
$this->addFlash('success3', 'Le produit a été ajouté à votre panier.');
// Redirigez l'utilisateur vers la page du panier ou vers la page du produit
return $this->redirectToRoute('app_panier_show', ['id' => $panier->getId()]);
}
#[Route('/{id}/commande', name: 'app_panier_buy', methods: ['GET'])]
public function buy(Panier $panier, EntityManagerInterface $entityManager): Response
{
$allInPanier = $panier->getProduitId();
// Parcourir tous les produits dans le panier
foreach ($allInPanier as $produit) {
// Incrémenter le compteur de commande (buycount)
$produit->setBuycount($produit->getBuycount() + 1);
// Sauvegarder les changements dans la base de données
$entityManager->persist($produit);
$panier->removeProduitId($produit);
}
// Appliquer les changements dans la base de données
$entityManager->flush();
return $this->render('panier/valid.html.twig', [
'panier' => $panier,
'o' => $allInPanier
]);
}
}
......@@ -81,4 +81,6 @@ class Panier
return $this;
}
}
......@@ -45,6 +45,9 @@ class Produits
#[ORM\ManyToMany(targetEntity: Panier::class, mappedBy: 'produit_id')]
private Collection $paniers;
#[ORM\Column(nullable: true)]
private ?int $buycount = null;
public function __construct()
{
$this->sexe = new ArrayCollection();
......@@ -192,4 +195,16 @@ class Produits
return $this;
}
public function getBuycount(): ?int
{
return $this->buycount;
}
public function setBuycount(?int $buycount): static
{
$this->buycount = $buycount;
return $this;
}
}
......@@ -3,17 +3,45 @@
{% block title %}Détails du Panier{% endblock %}
{% block body %}
<h1>Détails du Panier</h1>
{% if panier.produitId %}
<ul>
{% for produit in panier.produitId %}
<li>{{ produit.nom }} - {{ produit.prix }}</li>
{% endfor %}
</ul>
{% else %}
<p>Le panier est vide.</p>
{% if app.flashes('success3') %}
<script>
document.addEventListener('DOMContentLoaded', function() {
// Création d'une nouvelle instance de Toasty
var myToasty = new Toasty();
// Afficher un toast de succès
myToasty.success( "Le produit a été ajouté avec succés.", 4000);
});
</script>
{% endif %}
<a href="{{ path('app_panier_index') }}">Retour à la liste</a>
{% if panier.produitId is empty %}
<div class="column jc-c ai-c mt-9">
<h1 class="text-c">Votre panier est vide 😞</h1>
<a href="/produits" class="btnsave3 row jc-c"> Faire des achats </a>
</div>
{% else %}
<h1 class="text-c mt-8">Votre panier contient {{ panier.produitId|length }} articles</h1>
{% for produit in panier.produitId %}
<article class="row gap-small mt-2 jc-c">
<div class="">
<img src="{{ asset('uploads/'~produit.img) }}" class="img_panier">
</div>
<div class="column ">
<div class="row gap-big9">
<h3 class="w-s">{{ produit.nom }}</h3>
<h3>${{ produit.prix }}</h3>
</div>
<p class="mt--3">Une chaussure de qualité et belle </p>
<p>x1</p>
</div>
</article>
{% endfor %}
<a href="{{ path('app_panier_buy' , {'id': app.user.panier.id} )}}" class="btnsave2 row jc-c mt-4">Acheter</a>
{% endif %}
{% endblock %}
\ No newline at end of file
{% extends 'base.html.twig' %}
{% block title %}Confirm{% endblock %}
{% block body %}
<div class="row jc-c">
<img src="{{ asset('images/ch.png') }}" >
</div>
<h2 class="text-c">Votre achat a bien été effectué !</h2>
<a href="{{ path('app_produits_index') }}" class="btnsave3 row jc-c">Retour à la boutique</a>
{% endblock %}
\ No newline at end of file
......@@ -23,11 +23,20 @@
{% endif %}
<h1 class="h3 mb-3 font-weight-normal">Please sign in</h1>
<h1 class="text-c mt-8">Content de vous revoir !</h1>
<div class="logo-content f jc-c">
<img src="{{ asset('images/logo.png') }}" class="top_logo">
</div>
<article class="my-form">
<div class="form-field">
<label for="username">Email</label>
<input type="email" value="{{ last_username }}" name="_username" id="username" class="form-control" autocomplete="email" required autofocus>
<input type="email" value="{{ last_username }}" name="_username" id="username" class="form-control email-input" autocomplete="email" required autofocus>
</div>
<div class="form-field">
<label for="password">Password</label>
<input type="password" name="_password" id="password" class="form-control" autocomplete="current-password" required>
<input type="password" name="_password" id="password" class="form-control password-input " autocomplete="current-password" required>
</div>
</article>
<input type="hidden" name="_csrf_token"
value="{{ csrf_token('authenticate') }}"
......@@ -44,9 +53,9 @@
</div>
#}
<button class="btn btn-lg btn-primary" type="submit">
Sign in
<button class="btn btn-lg btn-primary btnsave2 row jc-c" type="submit">
Se connecter
</button>
<a href="{{ path('app_user_new') }}" >Crée un compte</a>
<p class="row jc-c">Vous n'avez pas de compte ? &nbsp &nbsp <a href="{{ path('app_user_new') }}" >Crée un compte</a></p>
</form>
{% endblock %}
......@@ -3,9 +3,12 @@
{% block title %}New User{% endblock %}
{% block body %}
<h1>Create new User</h1>
<h1 class="text-c mt-9">Créez votre compte !</h1>
<div class="logo-content f jc-c">
<img src="{{ asset('images/logo.png') }}" class="top_logo">
</div>
{{ include('user/_form.html.twig') }}
<a href="{{ path('app_login') }}" >Se connecter</a>
<p class="row jc-c">Vous avez déja un compte ? &nbsp &nbsp <a href="{{ path('app_login') }}" >Se connecter</a></p>
{% endblock %}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment