Skip to content

Commit

Permalink
Refonte visuelle
Browse files Browse the repository at this point in the history
  • Loading branch information
Nour-Dev-Paris committed Mar 8, 2021
1 parent c98807d commit 6200b4f
Show file tree
Hide file tree
Showing 51 changed files with 922 additions and 102 deletions.
2 changes: 1 addition & 1 deletion config/packages/security.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ security:
# Easy way to control access for large sections of your site
# Note: Only the *first* access control that matches will be used
access_control:
# - { path: ^/admin, roles: ROLE_ADMIN }
- { path: ^/admin, roles: ROLE_ADMIN }
- { path: ^/compte, roles: ROLE_USER }
- { path: ^/commande, roles: ROLE_USER }
31 changes: 31 additions & 0 deletions migrations/Version20210305080729.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?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 Version20210305080729 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 product ADD is_best TINYINT(1) NOT NULL');
}

public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE product DROP is_best');
}
}
31 changes: 31 additions & 0 deletions migrations/Version20210305085248.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?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 Version20210305085248 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('CREATE TABLE header (id INT AUTO_INCREMENT NOT NULL, title VARCHAR(255) NOT NULL, content LONGTEXT NOT NULL, btn_title VARCHAR(255) NOT NULL, btn_url VARCHAR(255) NOT NULL, illustration VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
}

public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE header');
}
}
32 changes: 32 additions & 0 deletions migrations/Version20210305110044.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?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 Version20210305110044 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('CREATE TABLE reset_password (id INT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, token VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL, INDEX IDX_B9983CE5A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE reset_password ADD CONSTRAINT FK_B9983CE5A76ED395 FOREIGN KEY (user_id) REFERENCES `user` (id)');
}

public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE reset_password');
}
}
27 changes: 24 additions & 3 deletions public/assets/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,27 @@ body {
margin-top: 22px;
}

a.action-updateDelivery {
margin-right: 20px;
}
/* .action-icon .fas .fa-truck {
margin-right: 20px !important;
} */

.account-item {
background-color: #ecf0f1;
color: white;
padding: 70px;
text-align: center;
}

.account-item a{
color: #2c3e50;
text-decoration: none;
text-transform: uppercase;
font-size: 0.8em;
font-weight: bold;
}

.account-item a:hover{
color:#7f8c8d;
font-size: 0.9em;
font-weight: bold;
}
Binary file added public/assets/img/book.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/img/first.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/img/password.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/img/second.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/assets/img/shopping-cart.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/Controller/Admin/CarrierCrudController.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ public static function getEntityFqcn(): string
public function configureFields(string $pageName): iterable
{
return [
TextField::new('name'),
TextField::new('name', 'Nom'),
TextareaField::new('description'),
MoneyField::new('price')->setCurrency('EUR')
MoneyField::new('price', 'Prix')->setCurrency('EUR')
];
}

Expand Down
2 changes: 2 additions & 0 deletions src/Controller/Admin/DashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use App\Entity\User;
use App\Entity\Order;
use App\Entity\Header;
use App\Entity\Carrier;
use App\Entity\Product;
use App\Entity\Category;
Expand Down Expand Up @@ -41,5 +42,6 @@ public function configureMenuItems(): iterable
yield MenuItem::linkToCrud('Catégories', 'fas fa-list', Category::class);
yield MenuItem::linkToCrud('Produits', 'fas fa-tag', Product::class);
yield MenuItem::linkToCrud('Transporteur', 'fas fa-truck', Carrier::class);
yield MenuItem::linkToCrud('Bannière', 'fas fa-desktop', Header::class);
}
}
34 changes: 34 additions & 0 deletions src/Controller/Admin/HeaderCrudController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

namespace App\Controller\Admin;

use App\Entity\Header;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use EasyCorp\Bundle\EasyAdminBundle\Field\ImageField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextareaField;
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController;

class HeaderCrudController extends AbstractCrudController
{
public static function getEntityFqcn(): string
{
return Header::class;
}


public function configureFields(string $pageName): iterable
{
return [
TextField::new('title', 'Titre de la bannière'),
TextareaField::new('content', 'Contenu de la bannière'),
TextField::new('btnTitle', 'Titre de notre bouton'),
TextField::new('btnUrl', 'Lien de destination de notre bouton'),
ImageField::new('illustration')
->setBasePath('uploads/')
->setUploadDir('public/uploads')
->setUploadedFileNamePattern('[randomhash].[extension]')
->setRequired(false),
];
}

}
10 changes: 6 additions & 4 deletions src/Controller/Admin/ProductCrudController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use EasyCorp\Bundle\EasyAdminBundle\Field\ImageField;
use EasyCorp\Bundle\EasyAdminBundle\Field\MoneyField;
use EasyCorp\Bundle\EasyAdminBundle\Field\BooleanField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextareaField;
use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField;
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController;
Expand All @@ -22,17 +23,18 @@ public static function getEntityFqcn(): string
public function configureFields(string $pageName): iterable
{
return [
TextField::new('name'),
TextField::new('name', 'Nom'),
SlugField::new('slug')->setTargetFieldName('name'),
ImageField::new('illustration')
->setBasePath('uploads/')
->setUploadDir('public/uploads')
->setUploadedFileNamePattern('[randomhash].[extension]')
->setRequired(false),
TextField::new('subtitle'),
TextField::new('subtitle', 'Sous-titre'),
TextareaField::new('description'),
MoneyField::new('price')->setCurrency('EUR'),
AssociationField::new('category')
BooleanField::new('isBest', 'Produit en avant'),
MoneyField::new('price', 'Prix')->setCurrency('EUR'),
AssociationField::new('category', 'Catégorie')
];
}

Expand Down
46 changes: 46 additions & 0 deletions src/Controller/ContactController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

namespace App\Controller;

use App\Classe\Mail;
use App\Form\ContactType;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;

class ContactController extends AbstractController
{
/**
* @Route("/nous-contacter", name="contact")
*/
public function index(Request $request): Response
{
$form = $this->createForm(ContactType::class);

$form->handleRequest($request);

if ($form->isSubmitted() && $form->isValid()) {
$this->addFlash('notice', 'Merci de nous a voir contacté. Notre équipe va vous répondre dans les plus brefs délais.');

// dd($name);

$mail = new Mail();

$content = "Vous avez reçu un message de la boutique eCommerce de la part de <br>" . $form->get('prenom')->getData() . ' ' . $form->get('nom')->getData() . ' : <br>' . $form->get('content')->getData();

$name = $form->get('prenom')->getData() . ' ' . $form->get('nom')->getData();

$mail->send(
'[email protected]',
'La boutique eCommerce',
'Message reçu de la boutique eCommerce - ' . $name,
$content
);
}

return $this->render('contact/index.html.twig', [
'form' => $form->createView()
]);
}
}
18 changes: 17 additions & 1 deletion src/Controller/HomeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,41 @@
namespace App\Controller;

use App\Classe\Mail;
use App\Entity\Header;
use App\Entity\Product;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;

class HomeController extends AbstractController
{
private $entityManager;

public function __construct(EntityManagerInterface $entityManager)
{
$this->entityManager = $entityManager;
}

/**
* @Route("/", name="home")
*/
public function index(SessionInterface $session): Response
{
$products = $this->entityManager->getRepository(Product::class)->findByIsBest(1);
$hearders = $this->entityManager->getRepository(Header::class)->findAll();

$session->remove('cart');

$cart = $session->get('cart');

// $mail = new Mail();
// $mail->send('[email protected]', 'Yoka', 'Mon premier mail', 'Mon premier super mail de folie dingue dingue !');

return $this->render('home/index.html.twig');
return $this->render('home/index.html.twig', [
'products' => $products,
'headers' => $hearders
]);
}
}
5 changes: 4 additions & 1 deletion src/Controller/ProductController.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,16 @@ public function show($slug): Response
{

$product = $this->entityManager->getRepository(Product::class)->findOneBySlug($slug);

$products = $this->entityManager->getRepository(Product::class)->findByIsBest(1);

if (!$product) {
return $this->redirectToRoute('products');
}

return $this->render('product/show.html.twig', [
'product' => $product
'product' => $product,
'products' => $products
]);
}
}
Loading

0 comments on commit 6200b4f

Please sign in to comment.