Compare commits

...

No commits in common. "master" and "feature/Index" have entirely different histories.

64 changed files with 5603 additions and 508 deletions

View File

@ -1,6 +0,0 @@
# define your env variables for the test env here
KERNEL_CLASS='App\Kernel'
APP_SECRET='$ecretf0rt3st'
SYMFONY_DEPRECATIONS_HELPER=999999
PANTHER_APP_ENV=panther
PANTHER_ERROR_SCREENSHOT_DIR=./var/error-screenshots

3
.gitignore vendored
View File

@ -187,5 +187,6 @@ fabric.properties
/web/js/
# End of https://www.toptal.com/developers/gitignore/api/symfony,phpstorm,git
.idea/
/vendor/
.idea/
.env.local

View File

@ -1,3 +1 @@
body {
background-color: skyblue;
}

84
assets/styles/login.css Normal file
View File

@ -0,0 +1,84 @@
html {
background-image: url("asset/image/BackgroundLogin.jpg"); background-repeat: no-repeat; background-size: cover;
height: 100%;
width: 100%;
}
body {
height: 100%;
width: 100%;
}
.Login {
width: 100%;
height: 100%;
}
.Circle {
background: #db5559;
width: 41%;
height: 80%;
margin: 0 auto;
border-style: solid;
border-radius: 50%;
border-color: white;
border-width: 5px;
}
.Form {
background: #791c1c;
height: 40%;
width: 55%;
margin: auto;
border-style: solid;
border-radius: 50px;
border-color: white;
border-width: 2px;
text-align: center;
font-family: "Qwitcher Grypen", cursive;
font-size: 40px;
font-style: italic;
color: white;
padding-bottom: 0;
}
.Logo {
display: flex;
margin: auto;
margin-top: 8%;
}
.Title1 {
margin: 0;
padding: 0;
}
.Title2 {
display: grid;
place-items: center;
height: 7vh;
color: black;
font-family: "Qwitcher Grypen", cursive;
font-size: 40px;
margin: 0;
}
.form-group{
display: grid;
place-items: center;
height: 7vh;
align-items: center;
text-align: center;
/*margin-bottom: 10px;*/
}
.form-control{
background-color: #f19595;
margin-left: 10px;
border-radius: 5px;
}
.btn{
background-color: #279b63;
border-radius: 6px;
height: 30px;
}

View File

@ -1,23 +0,0 @@
#!/usr/bin/env php
<?php
if (!ini_get('date.timezone')) {
ini_set('date.timezone', 'UTC');
}
if (is_file(dirname(__DIR__).'/vendor/phpunit/phpunit/phpunit')) {
if (PHP_VERSION_ID >= 80000) {
require dirname(__DIR__).'/vendor/phpunit/phpunit/phpunit';
} else {
define('PHPUNIT_COMPOSER_INSTALL', dirname(__DIR__).'/vendor/autoload.php');
require PHPUNIT_COMPOSER_INSTALL;
PHPUnit\TextUI\Command::main();
}
} else {
if (!is_file(dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php')) {
echo "Unable to find the `simple-phpunit.php` script in `vendor/symfony/phpunit-bridge/bin/`.\n";
exit(1);
}
require dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php';
}

View File

@ -7,6 +7,7 @@
"php": ">=8.2",
"ext-ctype": "*",
"ext-iconv": "*",
"amphp/http-client": "4.2.1",
"doctrine/dbal": "^3",
"doctrine/doctrine-bundle": "^2.13",
"doctrine/doctrine-migrations-bundle": "^3.3",
@ -38,6 +39,7 @@
"symfony/string": "7.1.*",
"symfony/translation": "7.1.*",
"symfony/twig-bundle": "7.1.*",
"symfony/ux-icons": "^2.21",
"symfony/ux-turbo": "^2.20",
"symfony/validator": "7.1.*",
"symfony/web-link": "7.1.*",

2315
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -13,4 +13,5 @@ return [
Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
Symfony\UX\Icons\UXIconsBundle::class => ['all' => true],
];

View File

@ -2,38 +2,54 @@ security:
# https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords
password_hashers:
Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto'
# https://symfony.com/doc/current/security.html#loading-the-user-the-user-provider
providers:
users_in_memory: { memory: null }
app_user_provider:
entity:
class: App\Entity\Utilisateurs
property: Mail
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
main:
lazy: true
provider: users_in_memory
provider: app_user_provider
form_login:
login_path: app_login
check_path: app_login
custom_authenticator: App\Security\LoginAuthenticator
entry_point: App\Security\LoginAuthenticator
# activate different ways to authenticate
# https://symfony.com/doc/current/security.html#the-firewall
logout:
path: app_logout
target: app_login
# https://symfony.com/doc/current/security/impersonating_user.html
# switch_user: true
# Easy way to control access for large sections of your site
# Note: Only the *first* access control that matches will be used
role_hierarchy:
ROLE_SUPER_ADMIN: [ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
ROLE_CUISINIER: ROLE_CUISINIER
ROLE_SERVEUR: ROLE_SERVEUR
access_control:
# - { path: ^/admin, roles: ROLE_ADMIN }
# - { path: ^/profile, roles: ROLE_USER }
# - { path: ^/, roles: ROLE_USER }
- { path: ^/login, roles: PUBLIC_ACCESS }
- { path: ^/logout, roles: ROLE_USER }
- { path: ^/index, roles: [ROLE_ADMIN, ROLE_CUISINIER, ROLE_SERVEUR]}
- { path: ^/user, roles: ROLE_ADMIN }
when@test:
security:
password_hashers:
# By default, password hashers are resource intensive and take time. This is
# important to generate secure password hashes. In tests however, secure hashes
# are not important, waste resources and increase test times. The following
# reduces the work factor to the lowest possible values.
Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface:
algorithm: auto
cost: 4 # Lowest possible value for bcrypt
time_cost: 3 # Lowest possible value for argon
memory_cost: 10 # Lowest possible value for argon
#when@test:
# security:
# password_hashers:
# # By default, password hashers are resource intensive and take time. This is
# # important to generate secure password hashes. In tests however, secure hashes
# # are not important, waste resources and increase test times. The following
# # reduces the work factor to the lowest possible values.
# Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface:
# algorithm: auto
# cost: 4 # Lowest possible value for bcrypt
# time_cost: 3 # Lowest possible value for argon
# memory_cost: 10 # Lowest possible value for argon

View File

@ -0,0 +1,56 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations\Latest;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20241017131649 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('DROP SEQUENCE customer_id_seq CASCADE');
$this->addSql('DROP SEQUENCE discount_id_seq CASCADE');
$this->addSql('DROP SEQUENCE dishes_id_seq CASCADE');
$this->addSql('DROP SEQUENCE order_id_seq CASCADE');
$this->addSql('DROP SEQUENCE order_detail_id_seq CASCADE');
$this->addSql('DROP SEQUENCE reservation_id_seq CASCADE');
$this->addSql('DROP SEQUENCE status_order_id_seq CASCADE');
$this->addSql('DROP SEQUENCE status_table_id_seq CASCADE');
$this->addSql('DROP SEQUENCE table_id_seq CASCADE');
$this->addSql('DROP SEQUENCE user_id_seq CASCADE');
$this->addSql('ALTER TABLE utilisateurs ADD tabl_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE utilisateurs ADD CONSTRAINT FK_497B315E4DE1870D FOREIGN KEY (tabl_id) REFERENCES tables (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('CREATE INDEX IDX_497B315E4DE1870D ON utilisateurs (tabl_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
$this->addSql('CREATE SEQUENCE customer_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE discount_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE dishes_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE order_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE order_detail_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE reservation_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE status_order_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE status_table_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE table_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE user_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('ALTER TABLE utilisateurs DROP CONSTRAINT FK_497B315E4DE1870D');
$this->addSql('DROP INDEX IDX_497B315E4DE1870D');
$this->addSql('ALTER TABLE utilisateurs DROP tabl_id');
}
}

View File

@ -0,0 +1,37 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations\Latest;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20241017131858 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 SEQUENCE statut_tables_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE TABLE statut_tables (id INT NOT NULL, tabl_id INT DEFAULT NULL, libellé VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_33C8A3754DE1870D ON statut_tables (tabl_id)');
$this->addSql('ALTER TABLE statut_tables ADD CONSTRAINT FK_33C8A3754DE1870D FOREIGN KEY (tabl_id) REFERENCES tables (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
$this->addSql('DROP SEQUENCE statut_tables_id_seq CASCADE');
$this->addSql('ALTER TABLE statut_tables DROP CONSTRAINT FK_33C8A3754DE1870D');
$this->addSql('DROP TABLE statut_tables');
}
}

View File

@ -0,0 +1,41 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations\Latest;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20241017132345 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 SEQUENCE commandes_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE statut_commandes_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE TABLE commandes (id INT NOT NULL, date_heure TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, statut BOOLEAN NOT NULL, total DOUBLE PRECISION NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE statut_commandes (id INT NOT NULL, commande_id INT DEFAULT NULL, libellé VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_947ABDEE82EA2E54 ON statut_commandes (commande_id)');
$this->addSql('ALTER TABLE statut_commandes ADD CONSTRAINT FK_947ABDEE82EA2E54 FOREIGN KEY (commande_id) REFERENCES commandes (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
$this->addSql('DROP SEQUENCE commandes_id_seq CASCADE');
$this->addSql('DROP SEQUENCE statut_commandes_id_seq CASCADE');
$this->addSql('ALTER TABLE statut_commandes DROP CONSTRAINT FK_947ABDEE82EA2E54');
$this->addSql('DROP TABLE commandes');
$this->addSql('DROP TABLE statut_commandes');
}
}

View File

@ -0,0 +1,45 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations\Latest;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20241017132656 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 SEQUENCE details_commande_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE TABLE commandes_clients (commandes_id INT NOT NULL, clients_id INT NOT NULL, PRIMARY KEY(commandes_id, clients_id))');
$this->addSql('CREATE INDEX IDX_C665A6248BF5C2E6 ON commandes_clients (commandes_id)');
$this->addSql('CREATE INDEX IDX_C665A624AB014612 ON commandes_clients (clients_id)');
$this->addSql('CREATE TABLE details_commande (id INT NOT NULL, commande_id INT DEFAULT NULL, quantite INT NOT NULL, prix_unitaire DOUBLE PRECISION NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_4BCD5F682EA2E54 ON details_commande (commande_id)');
$this->addSql('ALTER TABLE commandes_clients ADD CONSTRAINT FK_C665A6248BF5C2E6 FOREIGN KEY (commandes_id) REFERENCES commandes (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE commandes_clients ADD CONSTRAINT FK_C665A624AB014612 FOREIGN KEY (clients_id) REFERENCES clients (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE details_commande ADD CONSTRAINT FK_4BCD5F682EA2E54 FOREIGN KEY (commande_id) REFERENCES commandes (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
$this->addSql('DROP SEQUENCE details_commande_id_seq CASCADE');
$this->addSql('ALTER TABLE commandes_clients DROP CONSTRAINT FK_C665A6248BF5C2E6');
$this->addSql('ALTER TABLE commandes_clients DROP CONSTRAINT FK_C665A624AB014612');
$this->addSql('ALTER TABLE details_commande DROP CONSTRAINT FK_4BCD5F682EA2E54');
$this->addSql('DROP TABLE commandes_clients');
$this->addSql('DROP TABLE details_commande');
}
}

View File

@ -0,0 +1,49 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations\Latest;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20241017133242 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 SEQUENCE plats_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE reductions_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE TABLE plats (id INT NOT NULL, reduction_id INT DEFAULT NULL, nom VARCHAR(255) NOT NULL, description VARCHAR(255) NOT NULL, prix DOUBLE PRECISION NOT NULL, categorie VARCHAR(255) NOT NULL, statut BOOLEAN NOT NULL, nb_de_commande INT NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_854A620AC03CB092 ON plats (reduction_id)');
$this->addSql('CREATE TABLE plats_commandes (plats_id INT NOT NULL, commandes_id INT NOT NULL, PRIMARY KEY(plats_id, commandes_id))');
$this->addSql('CREATE INDEX IDX_7F8CABAAAA14E1C8 ON plats_commandes (plats_id)');
$this->addSql('CREATE INDEX IDX_7F8CABAA8BF5C2E6 ON plats_commandes (commandes_id)');
$this->addSql('CREATE TABLE reductions (id INT NOT NULL, description VARCHAR(255) NOT NULL, prix DOUBLE PRECISION NOT NULL, pourcentage INT NOT NULL, montant_fixe VARCHAR(255) NOT NULL, date_debut TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, date_fin TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, PRIMARY KEY(id))');
$this->addSql('ALTER TABLE plats ADD CONSTRAINT FK_854A620AC03CB092 FOREIGN KEY (reduction_id) REFERENCES reductions (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE plats_commandes ADD CONSTRAINT FK_7F8CABAAAA14E1C8 FOREIGN KEY (plats_id) REFERENCES plats (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE plats_commandes ADD CONSTRAINT FK_7F8CABAA8BF5C2E6 FOREIGN KEY (commandes_id) REFERENCES commandes (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
$this->addSql('DROP SEQUENCE plats_id_seq CASCADE');
$this->addSql('DROP SEQUENCE reductions_id_seq CASCADE');
$this->addSql('ALTER TABLE plats DROP CONSTRAINT FK_854A620AC03CB092');
$this->addSql('ALTER TABLE plats_commandes DROP CONSTRAINT FK_7F8CABAAAA14E1C8');
$this->addSql('ALTER TABLE plats_commandes DROP CONSTRAINT FK_7F8CABAA8BF5C2E6');
$this->addSql('DROP TABLE plats');
$this->addSql('DROP TABLE plats_commandes');
$this->addSql('DROP TABLE reductions');
}
}

View File

@ -0,0 +1,44 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations\Latest;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20241017141106 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 tables_tables (tables_source INT NOT NULL, tables_target INT NOT NULL, PRIMARY KEY(tables_source, tables_target))');
$this->addSql('CREATE INDEX IDX_D19ED3B4A53AEE6 ON tables_tables (tables_source)');
$this->addSql('CREATE INDEX IDX_D19ED3B413B6FE69 ON tables_tables (tables_target)');
$this->addSql('ALTER TABLE tables_tables ADD CONSTRAINT FK_D19ED3B4A53AEE6 FOREIGN KEY (tables_source) REFERENCES tables (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE tables_tables ADD CONSTRAINT FK_D19ED3B413B6FE69 FOREIGN KEY (tables_target) REFERENCES tables (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE utilisateurs DROP CONSTRAINT fk_497b315e4de1870d');
$this->addSql('DROP INDEX idx_497b315e4de1870d');
$this->addSql('ALTER TABLE utilisateurs DROP tabl_id');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
$this->addSql('ALTER TABLE tables_tables DROP CONSTRAINT FK_D19ED3B4A53AEE6');
$this->addSql('ALTER TABLE tables_tables DROP CONSTRAINT FK_D19ED3B413B6FE69');
$this->addSql('DROP TABLE tables_tables');
$this->addSql('ALTER TABLE utilisateurs ADD tabl_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE utilisateurs ADD CONSTRAINT fk_497b315e4de1870d FOREIGN KEY (tabl_id) REFERENCES tables (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('CREATE INDEX idx_497b315e4de1870d ON utilisateurs (tabl_id)');
}
}

View File

@ -0,0 +1,46 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations\Latest;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20241017141339 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 utilisateurs_tables (utilisateurs_id INT NOT NULL, tables_id INT NOT NULL, PRIMARY KEY(utilisateurs_id, tables_id))');
$this->addSql('CREATE INDEX IDX_A9A665291E969C5 ON utilisateurs_tables (utilisateurs_id)');
$this->addSql('CREATE INDEX IDX_A9A6652985405FD2 ON utilisateurs_tables (tables_id)');
$this->addSql('ALTER TABLE utilisateurs_tables ADD CONSTRAINT FK_A9A665291E969C5 FOREIGN KEY (utilisateurs_id) REFERENCES utilisateurs (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE utilisateurs_tables ADD CONSTRAINT FK_A9A6652985405FD2 FOREIGN KEY (tables_id) REFERENCES tables (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE tables_tables DROP CONSTRAINT fk_d19ed3b4a53aee6');
$this->addSql('ALTER TABLE tables_tables DROP CONSTRAINT fk_d19ed3b413b6fe69');
$this->addSql('DROP TABLE tables_tables');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
$this->addSql('CREATE TABLE tables_tables (tables_source INT NOT NULL, tables_target INT NOT NULL, PRIMARY KEY(tables_source, tables_target))');
$this->addSql('CREATE INDEX idx_d19ed3b413b6fe69 ON tables_tables (tables_target)');
$this->addSql('CREATE INDEX idx_d19ed3b4a53aee6 ON tables_tables (tables_source)');
$this->addSql('ALTER TABLE tables_tables ADD CONSTRAINT fk_d19ed3b4a53aee6 FOREIGN KEY (tables_source) REFERENCES tables (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE tables_tables ADD CONSTRAINT fk_d19ed3b413b6fe69 FOREIGN KEY (tables_target) REFERENCES tables (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE utilisateurs_tables DROP CONSTRAINT FK_A9A665291E969C5');
$this->addSql('ALTER TABLE utilisateurs_tables DROP CONSTRAINT FK_A9A6652985405FD2');
$this->addSql('DROP TABLE utilisateurs_tables');
}
}

View File

@ -0,0 +1,38 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations\Latest;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20241017141858 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 commandes ADD statut_commande_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE commandes ADD CONSTRAINT FK_35D4282CFB435DFD FOREIGN KEY (statut_commande_id) REFERENCES statut_commandes (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('CREATE INDEX IDX_35D4282CFB435DFD ON commandes (statut_commande_id)');
$this->addSql('ALTER TABLE statut_commandes RENAME COLUMN libellé TO libelle');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
$this->addSql('ALTER TABLE statut_commandes RENAME COLUMN libelle TO "libellé"');
$this->addSql('ALTER TABLE commandes DROP CONSTRAINT FK_35D4282CFB435DFD');
$this->addSql('DROP INDEX IDX_35D4282CFB435DFD');
$this->addSql('ALTER TABLE commandes DROP statut_commande_id');
}
}

View File

@ -0,0 +1,36 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations\Latest;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20241017142439 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 commandes DROP CONSTRAINT fk_35d4282cfb435dfd');
$this->addSql('DROP INDEX idx_35d4282cfb435dfd');
$this->addSql('ALTER TABLE commandes DROP statut_commande_id');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
$this->addSql('ALTER TABLE commandes ADD statut_commande_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE commandes ADD CONSTRAINT fk_35d4282cfb435dfd FOREIGN KEY (statut_commande_id) REFERENCES statut_commandes (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('CREATE INDEX idx_35d4282cfb435dfd ON commandes (statut_commande_id)');
}
}

View File

@ -0,0 +1,42 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations\Latest;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20241017142915 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 commandes ADD statut_commande_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE commandes ADD CONSTRAINT FK_35D4282CFB435DFD FOREIGN KEY (statut_commande_id) REFERENCES statut_commandes (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('CREATE INDEX IDX_35D4282CFB435DFD ON commandes (statut_commande_id)');
$this->addSql('ALTER TABLE statut_commandes DROP CONSTRAINT fk_947abdee82ea2e54');
$this->addSql('DROP INDEX idx_947abdee82ea2e54');
$this->addSql('ALTER TABLE statut_commandes DROP commande_id');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
$this->addSql('ALTER TABLE statut_commandes ADD commande_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE statut_commandes ADD CONSTRAINT fk_947abdee82ea2e54 FOREIGN KEY (commande_id) REFERENCES commandes (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('CREATE INDEX idx_947abdee82ea2e54 ON statut_commandes (commande_id)');
$this->addSql('ALTER TABLE commandes DROP CONSTRAINT FK_35D4282CFB435DFD');
$this->addSql('DROP INDEX IDX_35D4282CFB435DFD');
$this->addSql('ALTER TABLE commandes DROP statut_commande_id');
}
}

View File

@ -0,0 +1,140 @@
<?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 Version20241020235112 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 SEQUENCE clients_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE commandes_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE details_commande_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE plats_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE reductions_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE reservations_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE statut_commandes_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE statut_tables_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE tables_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE utilisateurs_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE TABLE clients (id INT NOT NULL, prenom VARCHAR(255) NOT NULL, nom VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL, telephone VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE clients_tables (clients_id INT NOT NULL, tables_id INT NOT NULL, PRIMARY KEY(clients_id, tables_id))');
$this->addSql('CREATE INDEX IDX_8190D6C6AB014612 ON clients_tables (clients_id)');
$this->addSql('CREATE INDEX IDX_8190D6C685405FD2 ON clients_tables (tables_id)');
$this->addSql('CREATE TABLE commandes (id INT NOT NULL, statut_commande_id INT DEFAULT NULL, date_heure TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, statut BOOLEAN NOT NULL, total DOUBLE PRECISION NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_35D4282CFB435DFD ON commandes (statut_commande_id)');
$this->addSql('CREATE TABLE commandes_clients (commandes_id INT NOT NULL, clients_id INT NOT NULL, PRIMARY KEY(commandes_id, clients_id))');
$this->addSql('CREATE INDEX IDX_C665A6248BF5C2E6 ON commandes_clients (commandes_id)');
$this->addSql('CREATE INDEX IDX_C665A624AB014612 ON commandes_clients (clients_id)');
$this->addSql('CREATE TABLE details_commande (id INT NOT NULL, commande_id INT DEFAULT NULL, quantite INT NOT NULL, prix_unitaire DOUBLE PRECISION NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_4BCD5F682EA2E54 ON details_commande (commande_id)');
$this->addSql('CREATE TABLE plats (id INT NOT NULL, reduction_id INT DEFAULT NULL, nom VARCHAR(255) NOT NULL, description VARCHAR(255) NOT NULL, prix DOUBLE PRECISION NOT NULL, categorie VARCHAR(255) NOT NULL, statut BOOLEAN NOT NULL, nb_de_commande INT NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_854A620AC03CB092 ON plats (reduction_id)');
$this->addSql('CREATE TABLE plats_commandes (plats_id INT NOT NULL, commandes_id INT NOT NULL, PRIMARY KEY(plats_id, commandes_id))');
$this->addSql('CREATE INDEX IDX_7F8CABAAAA14E1C8 ON plats_commandes (plats_id)');
$this->addSql('CREATE INDEX IDX_7F8CABAA8BF5C2E6 ON plats_commandes (commandes_id)');
$this->addSql('CREATE TABLE reductions (id INT NOT NULL, description VARCHAR(255) NOT NULL, prix DOUBLE PRECISION NOT NULL, pourcentage INT NOT NULL, montant_fixe VARCHAR(255) NOT NULL, date_debut TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, date_fin TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE reservations (id INT NOT NULL, tabl_id INT DEFAULT NULL, date_heure TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, nb_de_prsn INT NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_4DA2394DE1870D ON reservations (tabl_id)');
$this->addSql('CREATE TABLE statut_commandes (id INT NOT NULL, libelle VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE statut_tables (id INT NOT NULL, tabl_id INT DEFAULT NULL, libellé VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_33C8A3754DE1870D ON statut_tables (tabl_id)');
$this->addSql('CREATE TABLE tables (id INT NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE utilisateurs (id INT NOT NULL, nom VARCHAR(255) NOT NULL, prenom VARCHAR(255) NOT NULL, mail VARCHAR(255) NOT NULL, mot_de_passe VARCHAR(255) NOT NULL, role VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE utilisateurs_reservations (utilisateurs_id INT NOT NULL, reservations_id INT NOT NULL, PRIMARY KEY(utilisateurs_id, reservations_id))');
$this->addSql('CREATE INDEX IDX_995A78E71E969C5 ON utilisateurs_reservations (utilisateurs_id)');
$this->addSql('CREATE INDEX IDX_995A78E7D9A7F869 ON utilisateurs_reservations (reservations_id)');
$this->addSql('CREATE TABLE utilisateurs_tables (utilisateurs_id INT NOT NULL, tables_id INT NOT NULL, PRIMARY KEY(utilisateurs_id, tables_id))');
$this->addSql('CREATE INDEX IDX_A9A665291E969C5 ON utilisateurs_tables (utilisateurs_id)');
$this->addSql('CREATE INDEX IDX_A9A6652985405FD2 ON utilisateurs_tables (tables_id)');
$this->addSql('CREATE TABLE messenger_messages (id BIGSERIAL NOT NULL, body TEXT NOT NULL, headers TEXT NOT NULL, queue_name VARCHAR(190) NOT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, available_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, delivered_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_75EA56E0FB7336F0 ON messenger_messages (queue_name)');
$this->addSql('CREATE INDEX IDX_75EA56E0E3BD61CE ON messenger_messages (available_at)');
$this->addSql('CREATE INDEX IDX_75EA56E016BA31DB ON messenger_messages (delivered_at)');
$this->addSql('COMMENT ON COLUMN messenger_messages.created_at IS \'(DC2Type:datetime_immutable)\'');
$this->addSql('COMMENT ON COLUMN messenger_messages.available_at IS \'(DC2Type:datetime_immutable)\'');
$this->addSql('COMMENT ON COLUMN messenger_messages.delivered_at IS \'(DC2Type:datetime_immutable)\'');
$this->addSql('CREATE OR REPLACE FUNCTION notify_messenger_messages() RETURNS TRIGGER AS $$
BEGIN
PERFORM pg_notify(\'messenger_messages\', NEW.queue_name::text);
RETURN NEW;
END;
$$ LANGUAGE plpgsql;');
$this->addSql('DROP TRIGGER IF EXISTS notify_trigger ON messenger_messages;');
$this->addSql('CREATE TRIGGER notify_trigger AFTER INSERT OR UPDATE ON messenger_messages FOR EACH ROW EXECUTE PROCEDURE notify_messenger_messages();');
$this->addSql('ALTER TABLE clients_tables ADD CONSTRAINT FK_8190D6C6AB014612 FOREIGN KEY (clients_id) REFERENCES clients (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE clients_tables ADD CONSTRAINT FK_8190D6C685405FD2 FOREIGN KEY (tables_id) REFERENCES tables (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE commandes ADD CONSTRAINT FK_35D4282CFB435DFD FOREIGN KEY (statut_commande_id) REFERENCES statut_commandes (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE commandes_clients ADD CONSTRAINT FK_C665A6248BF5C2E6 FOREIGN KEY (commandes_id) REFERENCES commandes (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE commandes_clients ADD CONSTRAINT FK_C665A624AB014612 FOREIGN KEY (clients_id) REFERENCES clients (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE details_commande ADD CONSTRAINT FK_4BCD5F682EA2E54 FOREIGN KEY (commande_id) REFERENCES commandes (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE plats ADD CONSTRAINT FK_854A620AC03CB092 FOREIGN KEY (reduction_id) REFERENCES reductions (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE plats_commandes ADD CONSTRAINT FK_7F8CABAAAA14E1C8 FOREIGN KEY (plats_id) REFERENCES plats (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE plats_commandes ADD CONSTRAINT FK_7F8CABAA8BF5C2E6 FOREIGN KEY (commandes_id) REFERENCES commandes (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE reservations ADD CONSTRAINT FK_4DA2394DE1870D FOREIGN KEY (tabl_id) REFERENCES tables (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE statut_tables ADD CONSTRAINT FK_33C8A3754DE1870D FOREIGN KEY (tabl_id) REFERENCES tables (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE utilisateurs_reservations ADD CONSTRAINT FK_995A78E71E969C5 FOREIGN KEY (utilisateurs_id) REFERENCES utilisateurs (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE utilisateurs_reservations ADD CONSTRAINT FK_995A78E7D9A7F869 FOREIGN KEY (reservations_id) REFERENCES reservations (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE utilisateurs_tables ADD CONSTRAINT FK_A9A665291E969C5 FOREIGN KEY (utilisateurs_id) REFERENCES utilisateurs (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE utilisateurs_tables ADD CONSTRAINT FK_A9A6652985405FD2 FOREIGN KEY (tables_id) REFERENCES tables (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP SEQUENCE clients_id_seq CASCADE');
$this->addSql('DROP SEQUENCE commandes_id_seq CASCADE');
$this->addSql('DROP SEQUENCE details_commande_id_seq CASCADE');
$this->addSql('DROP SEQUENCE plats_id_seq CASCADE');
$this->addSql('DROP SEQUENCE reductions_id_seq CASCADE');
$this->addSql('DROP SEQUENCE reservations_id_seq CASCADE');
$this->addSql('DROP SEQUENCE statut_commandes_id_seq CASCADE');
$this->addSql('DROP SEQUENCE statut_tables_id_seq CASCADE');
$this->addSql('DROP SEQUENCE tables_id_seq CASCADE');
$this->addSql('DROP SEQUENCE utilisateurs_id_seq CASCADE');
$this->addSql('ALTER TABLE clients_tables DROP CONSTRAINT FK_8190D6C6AB014612');
$this->addSql('ALTER TABLE clients_tables DROP CONSTRAINT FK_8190D6C685405FD2');
$this->addSql('ALTER TABLE commandes DROP CONSTRAINT FK_35D4282CFB435DFD');
$this->addSql('ALTER TABLE commandes_clients DROP CONSTRAINT FK_C665A6248BF5C2E6');
$this->addSql('ALTER TABLE commandes_clients DROP CONSTRAINT FK_C665A624AB014612');
$this->addSql('ALTER TABLE details_commande DROP CONSTRAINT FK_4BCD5F682EA2E54');
$this->addSql('ALTER TABLE plats DROP CONSTRAINT FK_854A620AC03CB092');
$this->addSql('ALTER TABLE plats_commandes DROP CONSTRAINT FK_7F8CABAAAA14E1C8');
$this->addSql('ALTER TABLE plats_commandes DROP CONSTRAINT FK_7F8CABAA8BF5C2E6');
$this->addSql('ALTER TABLE reservations DROP CONSTRAINT FK_4DA2394DE1870D');
$this->addSql('ALTER TABLE statut_tables DROP CONSTRAINT FK_33C8A3754DE1870D');
$this->addSql('ALTER TABLE utilisateurs_reservations DROP CONSTRAINT FK_995A78E71E969C5');
$this->addSql('ALTER TABLE utilisateurs_reservations DROP CONSTRAINT FK_995A78E7D9A7F869');
$this->addSql('ALTER TABLE utilisateurs_tables DROP CONSTRAINT FK_A9A665291E969C5');
$this->addSql('ALTER TABLE utilisateurs_tables DROP CONSTRAINT FK_A9A6652985405FD2');
$this->addSql('DROP TABLE clients');
$this->addSql('DROP TABLE clients_tables');
$this->addSql('DROP TABLE commandes');
$this->addSql('DROP TABLE commandes_clients');
$this->addSql('DROP TABLE details_commande');
$this->addSql('DROP TABLE plats');
$this->addSql('DROP TABLE plats_commandes');
$this->addSql('DROP TABLE reductions');
$this->addSql('DROP TABLE reservations');
$this->addSql('DROP TABLE statut_commandes');
$this->addSql('DROP TABLE statut_tables');
$this->addSql('DROP TABLE tables');
$this->addSql('DROP TABLE utilisateurs');
$this->addSql('DROP TABLE utilisateurs_reservations');
$this->addSql('DROP TABLE utilisateurs_tables');
$this->addSql('DROP TABLE messenger_messages');
}
}

View File

@ -0,0 +1,34 @@
<?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 Version20241024193330 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 utilisateurs ALTER role TYPE JSON USING role::json');
$this->addSql('COMMENT ON COLUMN utilisateurs.role IS NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
$this->addSql('ALTER TABLE utilisateurs ALTER role TYPE TEXT');
$this->addSql('COMMENT ON COLUMN utilisateurs.role IS \'(DC2Type:array)\'');
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

View File

@ -0,0 +1,69 @@
/* Style pour chaque élément d'information de l'utilisateur */
.user-info-item {
display: flex;
padding: 10px 0;
border-bottom: 1px solid #e0e0e0;
}
/* Dernier élément sans bordure */
.user-info-item:last-child {
border-bottom: none;
}
/* Style pour le label de chaque information (Nom, Prénom, etc.) */
.user-info-label {
font-weight: bold;
color: #333;
width: 7%;
}
/* Style pour la valeur de chaque information (la donnée de l'utilisateur) */
.user-info-value {
color: #555;
text-align: left;
width: 65%;
word-wrap: break-word; /* Gère les débordements */
}
.password {
display: flex;
flex-direction: column;
width: 100%;
text-align: left;
}
/* Ajout d'un style pour rendre responsive */
@media (max-width: 600px) {
#InformationUser {
padding: 15px;
}
.user-info-item {
flex-direction: column;
padding: 8px 0;
}
.user-info-label, .user-info-value {
width: 100%;
}
}
#container_gestion_user {
background-color: white;
margin-left: 20%; /* Centrage vertical */
margin-top: 5%;
padding: 20px;
border: 1px solid black;
width: 75%; /* Largeur du contenu de la modal */
height: 100%; /* Hauteur du contenu de la modal */
box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2);
display: none;
}
a{
text-decoration: none;
}
a:visited {
color: initial;
}

152
public/css/modal.css Normal file
View File

@ -0,0 +1,152 @@
.top-bar {
background-color: #db5559;
width: calc(100% - 18%); /*Calcule la totalité de l'écran - le left-background */
height: 60px;
position: fixed;
top: 0;
left: 18%; /*Evite le chauvechement des 2 bars */
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 20px;
color: white;
font-size: 18px;
box-sizing: border-box; /* Inclut le padding dans la largeur totale */
}
.user-role {
background-color: white;
color: black;
padding: 10px 15px;
font-weight: bold;
overflow: hidden;
}
.left-background {
background-color: #db5559;
width: 18%;
height: 100%;
position: fixed;
top: 0;
left: 0;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.index-title-page {
color: #FFFFFF;
font-size: 60px;
padding-bottom: 10px;
font-family: 'Brittany Signature', sans-serif;
}
ul {
list-style-type: none;
padding: 0;
}
li {
padding-bottom: 30px;
}
.btn-custom {
background-color: #FFFFFF;
color: black;
padding: 15px 40px;
font-size: 16px;
font-weight: bold;
cursor: pointer;
display: inline-block;
border-right: 5px solid #db5559;
border-left: 5px solid #db5559;
}
.btn-custom:hover, .btn-info-compte:hover, .btn-info-exit:hover {
background-color: #f8b5b5;
color: #FFFFFF;
}
.icon-medium {
width: 25px;
height: 25px;
}
.icon-container {
display: flex;
align-items: center;
gap: 10px;
}
.Information-perso {
display: flex;
justify-content: space-between;
padding: 20px;
margin-top: auto;
}
.btn-info-compte, .btn-info-exit {
background-color: #FFFFFF;
color: black;
padding: 10px 20px;
font-size: 16px;
font-weight: bold;
cursor: pointer;
border: 1px solid black;
}
.btn-info-compte {
width: 50%;
height: 30px;
}
.btn-info-exit {
width: 10%;
height: 30px;
}
/* Style pour la modal (cachée par défaut) */
.modal {
display: none; /* Masquée par défaut */
position: fixed;
z-index: 1; /* Au-dessus du contenu normal */
left: 18%; /* Commence juste après ton left-background */
top: 0;
width: 82%; /* Prend le reste de la largeur après le left-background */
height: 100%; /* Prend toute la hauteur de l'écran */
background-color: rgba(0, 0, 0, 0.4); /* Couleur d'arrière-plan avec transparence */
overflow: auto; /* Permet le défilement si le contenu dépasse */
}
/* Contenu de la modal */
.modal-content {
background-color: white;
margin: 5% auto; /* Centrage vertical */
padding: 20px;
border: 1px solid black;
width: 80%; /* Largeur du contenu de la modal */
height: 80%; /* Hauteur du contenu de la modal */
box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2);
}
/* Bouton de fermeture */
.close {
color: black;
float: right;
font-size: 28px;
font-weight: bold;
}
.close:hover,
.close:focus {
color: red;
cursor: pointer;
}

29
public/js/test.js Normal file
View File

@ -0,0 +1,29 @@
document.querySelector('.btn-info-compte').addEventListener('click', function(event) {
event.preventDefault();
const contentContainer = document.getElementById('container-gestion-user');
// Vérifie si le contenu est déjà affiché
if (container_gestion_user.style.display === 'block') {
// Masquer la section "Compte" si elle est déjà affichée
container_gestion_user.style.display = 'none';
container_gestion_user.innerHTML = ''; // On efface le contenu pour éviter la réutilisation
} else {
// Afficher le conteneur et charger le contenu via AJAX
fetch('/gestion-user')
.then(response => {
if (!response.ok) {
throw new Error('Erreur de chargement de la section Compte');
}
return response.text();
})
.then(html => {
// Insérer le HTML dans le conteneur et l'afficher
container_gestion_user.innerHTML = html;
container_gestion_user.style.display = 'block';
})
.catch(error => {
console.error('Erreur:', error);
});
}
});

View File

@ -0,0 +1,46 @@
<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
class CuisinierController extends AbstractController
{
#[Route('/cuisinier/ajouter', name: 'ajouter_cuisinier')]
public function ajouter(Request $request, EntityManagerInterface $entityManager): Response
{
$cuisinier = new Cuisinier();
$form = $this->createForm(CuisinierType::class, $cuisinier);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$entityManager->persist($cuisinier);
$entityManager->flush();
$this->addFlash('success', 'Cuisinier ajouté avec succès !');
return $this->redirectToRoute('ajouter_cuisinier');
}
return $this->render('cuisinier/ajouter.html.twig', [
'form' => $form->createView(),
]);
}
#[Route('/cuisinier/supprimer/{id}', name: 'supprimer_cuisinier', methods: ['POST'])]
public function supprimer(int $id, EntityManagerInterface $entityManager): Response
{
$cuisinier = $entityManager->getRepository(Cuisinier::class)->find($id);
if (!$cuisinier) {
throw $this->createNotFoundException('Ce cuisinier n\'existe pas');
}
$entityManager->remove($cuisinier);
$entityManager->flush();
$this->addFlash('success', 'Cuisinier supprimé avec succès !');
return $this->redirectToRoute('ajouter_cuisinier');
}
}

View File

@ -0,0 +1,18 @@
<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
class IndexController extends AbstractController
{
#[Route('/index', name: 'app_index')]
public function index(): Response
{
return $this->render('index/admin.html.twig', [
'controller_name' => 'IndexController',
]);
}
}

View File

@ -0,0 +1,38 @@
<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
class LoginController extends AbstractController
{
#[Route('/login', name: 'app_login')]
public function index(AuthenticationUtils $authenticationUtils): Response
{
// get the login error if there is one
$error = $authenticationUtils->getLastAuthenticationError();
// last username entered by the user
$lastUsername = $authenticationUtils->getLastUsername();
return $this->render('login/index.html.twig', ['last_username' => $lastUsername, 'error' => $error]);
}
#[Route(path: '/logout', name: 'app_logout')]
public function logout(): void
{
throw new \LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.');
}
#[Route('/access/denied', name: 'app_access_denied')]
public function denied(): Response
{
return $this->render('access_denied/index.html.twig', [
'controller_name' => 'AccessDeniedController',
]);
}
}

View File

@ -0,0 +1,93 @@
<?php
namespace App\Controller;
use App\Entity\Utilisateurs;
use App\Form\UpdateUserType;
use App\Repository\UtilisateursRepository;
use App\Form\AddUserFormType;
use App\Security\LoginAuthenticator;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Bundle\SecurityBundle\Security;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface;
class UserController extends AbstractController
{
public function __construct(UtilisateursRepository $utilisateursRepository)
{
$this->utilisateursRepository = $utilisateursRepository;
}
#[Route('/user/add', name: 'add_user')]
public function register(Request $request, UserPasswordHasherInterface $userPasswordHasher, Security $security, EntityManagerInterface $entityManager): Response
{
$user = new Utilisateurs();
$form = $this->createForm(AddUserFormType::class, $user);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
/** @var string $plainPassword */
$plainPassword = $form->get('Password')->getData();
// encode the plain password
$user->setPassword($userPasswordHasher->hashPassword($user, $plainPassword));
$entityManager->persist($user);
$entityManager->flush();
// do anything else you need here, like send an email
return $security->login($user, LoginAuthenticator::class, 'main');
}
return $this->render('user/add.html.twig', [
'registrationForm' => $form,
]);
}
#[Route('/user/update/{id}', name: 'update-user')]
public function update(Request $request, UserPasswordHasherInterface $userPasswordHasher, Security $security, EntityManagerInterface $entityManager, int $id): Response
{
$user = $this->utilisateursRepository->find($id);
$form = $this->createForm(UpdateUserType::class, $user);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
/** @var string $plainPassword */
$plainPassword = $form->get('Password')->getData();
// encode the plain password
$user->setPassword($userPasswordHasher->hashPassword($user, $plainPassword));
$entityManager->persist($user);
$entityManager->flush();
return $this->redirectToRoute('app_index');
}
return $this->render('gestion_user/index.html.twig', [
'form' => $form,
]);
}
#[Route('/user/list', name: 'list_user')]
public function list(): Response
{
$utilisateur = $this->utilisateursRepository->findAll();
return $this->render('user/list.html.twig', [
'utilisateurs' => $utilisateur
]);
}
#[Route('/gestion-user', name: 'gestion_user', methods: ['GET'])]
public function index(): Response
{
return $this->render('gestion_user/index.html.twig');
}
}

151
src/Entity/Clients.php Normal file
View File

@ -0,0 +1,151 @@
<?php
namespace App\Entity;
use App\Repository\ClientsRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: ClientsRepository::class)]
class Clients
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $Prenom = null;
#[ORM\Column(length: 255)]
private ?string $Nom = null;
#[ORM\Column(length: 255)]
private ?string $Email = null;
#[ORM\Column(length: 255)]
private ?string $Telephone = null;
/**
* @var Collection<int, Tables>
*/
#[ORM\ManyToMany(targetEntity: Tables::class, inversedBy: 'Client')]
private Collection $table;
/**
* @var Collection<int, Commandes>
*/
#[ORM\ManyToMany(targetEntity: Commandes::class, mappedBy: 'Client')]
private Collection $commandes;
public function __construct()
{
$this->table = new ArrayCollection();
$this->commandes = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getPrenom(): ?string
{
return $this->Prenom;
}
public function setPrenom(string $Prenom): static
{
$this->Prenom = $Prenom;
return $this;
}
public function getNom(): ?string
{
return $this->Nom;
}
public function setNom(string $Nom): static
{
$this->Nom = $Nom;
return $this;
}
public function getEmail(): ?string
{
return $this->Email;
}
public function setEmail(string $Email): static
{
$this->Email = $Email;
return $this;
}
public function getTelephone(): ?string
{
return $this->Telephone;
}
public function setTelephone(string $Telephone): static
{
$this->Telephone = $Telephone;
return $this;
}
/**
* @return Collection<int, Tables>
*/
public function getTable(): Collection
{
return $this->table;
}
public function addTable(Tables $table): static
{
if (!$this->table->contains($table)) {
$this->table->add($table);
}
return $this;
}
public function removeTable(Tables $table): static
{
$this->table->removeElement($table);
return $this;
}
/**
* @return Collection<int, Commandes>
*/
public function getCommandes(): Collection
{
return $this->commandes;
}
public function addCommande(Commandes $commande): static
{
if (!$this->commandes->contains($commande)) {
$this->commandes->add($commande);
$commande->addClient($this);
}
return $this;
}
public function removeCommande(Commandes $commande): static
{
if ($this->commandes->removeElement($commande)) {
$commande->removeClient($this);
}
return $this;
}
}

189
src/Entity/Commandes.php Normal file
View File

@ -0,0 +1,189 @@
<?php
namespace App\Entity;
use App\Repository\CommandesRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: CommandesRepository::class)]
class Commandes
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
private ?\DateTimeInterface $DateHeure = null;
#[ORM\Column]
private ?bool $Statut = null;
#[ORM\Column]
private ?float $Total = null;
/**
* @var Collection<int, Clients>
*/
#[ORM\ManyToMany(targetEntity: Clients::class, inversedBy: 'commandes')]
private Collection $Client;
/**
* @var Collection<int, DetailsCommande>
*/
#[ORM\OneToMany(targetEntity: DetailsCommande::class, mappedBy: 'Commande')]
private Collection $detailsCommandes;
/**
* @var Collection<int, Plats>
*/
#[ORM\ManyToMany(targetEntity: Plats::class, mappedBy: 'Commande')]
private Collection $plats;
#[ORM\ManyToOne(inversedBy: 'commandes')]
private ?StatutCommandes $StatutCommande = null;
public function __construct()
{
$this->Client = new ArrayCollection();
$this->detailsCommandes = new ArrayCollection();
$this->plats = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getDateHeure(): ?\DateTimeInterface
{
return $this->DateHeure;
}
public function setDateHeure(\DateTimeInterface $DateHeure): static
{
$this->DateHeure = $DateHeure;
return $this;
}
public function isStatut(): ?bool
{
return $this->Statut;
}
public function setStatut(bool $Statut): static
{
$this->Statut = $Statut;
return $this;
}
public function getTotal(): ?float
{
return $this->Total;
}
public function setTotal(float $Total): static
{
$this->Total = $Total;
return $this;
}
/**
* @return Collection<int, Clients>
*/
public function getClient(): Collection
{
return $this->Client;
}
public function addClient(Clients $client): static
{
if (!$this->Client->contains($client)) {
$this->Client->add($client);
}
return $this;
}
public function removeClient(Clients $client): static
{
$this->Client->removeElement($client);
return $this;
}
/**
* @return Collection<int, DetailsCommande>
*/
public function getDetailsCommandes(): Collection
{
return $this->detailsCommandes;
}
public function addDetailsCommande(DetailsCommande $detailsCommande): static
{
if (!$this->detailsCommandes->contains($detailsCommande)) {
$this->detailsCommandes->add($detailsCommande);
$detailsCommande->setCommande($this);
}
return $this;
}
public function removeDetailsCommande(DetailsCommande $detailsCommande): static
{
if ($this->detailsCommandes->removeElement($detailsCommande)) {
// set the owning side to null (unless already changed)
if ($detailsCommande->getCommande() === $this) {
$detailsCommande->setCommande(null);
}
}
return $this;
}
/**
* @return Collection<int, Plats>
*/
public function getPlats(): Collection
{
return $this->plats;
}
public function addPlat(Plats $plat): static
{
if (!$this->plats->contains($plat)) {
$this->plats->add($plat);
$plat->addCommande($this);
}
return $this;
}
public function removePlat(Plats $plat): static
{
if ($this->plats->removeElement($plat)) {
$plat->removeCommande($this);
}
return $this;
}
public function getStatutCommande(): ?StatutCommandes
{
return $this->StatutCommande;
}
public function setStatutCommande(?StatutCommandes $StatutCommande): static
{
$this->StatutCommande = $StatutCommande;
return $this;
}
}

View File

@ -0,0 +1,65 @@
<?php
namespace App\Entity;
use App\Repository\DetailsCommandeRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: DetailsCommandeRepository::class)]
class DetailsCommande
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column]
private ?int $Quantite = null;
#[ORM\Column]
private ?float $PrixUnitaire = null;
#[ORM\ManyToOne(inversedBy: 'detailsCommandes')]
private ?Commandes $Commande = null;
public function getId(): ?int
{
return $this->id;
}
public function getQuantite(): ?int
{
return $this->Quantite;
}
public function setQuantite(int $Quantite): static
{
$this->Quantite = $Quantite;
return $this;
}
public function getPrixUnitaire(): ?float
{
return $this->PrixUnitaire;
}
public function setPrixUnitaire(float $PrixUnitaire): static
{
$this->PrixUnitaire = $PrixUnitaire;
return $this;
}
public function getCommande(): ?Commandes
{
return $this->Commande;
}
public function setCommande(?Commandes $Commande): static
{
$this->Commande = $Commande;
return $this;
}
}

162
src/Entity/Plats.php Normal file
View File

@ -0,0 +1,162 @@
<?php
namespace App\Entity;
use App\Repository\PlatsRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: PlatsRepository::class)]
class Plats
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $Nom = null;
#[ORM\Column(length: 255)]
private ?string $Description = null;
#[ORM\Column]
private ?float $Prix = null;
#[ORM\Column(length: 255)]
private ?string $Categorie = null;
#[ORM\Column]
private ?bool $Statut = null;
#[ORM\Column]
private ?int $Nb_de_commande = null;
/**
* @var Collection<int, Commandes>
*/
#[ORM\ManyToMany(targetEntity: Commandes::class, inversedBy: 'plats')]
private Collection $Commande;
#[ORM\ManyToOne(inversedBy: 'plats')]
private ?Reductions $Reduction = null;
public function __construct()
{
$this->Commande = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getNom(): ?string
{
return $this->Nom;
}
public function setNom(string $Nom): static
{
$this->Nom = $Nom;
return $this;
}
public function getDescription(): ?string
{
return $this->Description;
}
public function setDescription(string $Description): static
{
$this->Description = $Description;
return $this;
}
public function getPrix(): ?float
{
return $this->Prix;
}
public function setPrix(float $Prix): static
{
$this->Prix = $Prix;
return $this;
}
public function getCategorie(): ?string
{
return $this->Categorie;
}
public function setCategorie(string $Categorie): static
{
$this->Categorie = $Categorie;
return $this;
}
public function isStatut(): ?bool
{
return $this->Statut;
}
public function setStatut(bool $Statut): static
{
$this->Statut = $Statut;
return $this;
}
public function getNbDeCommande(): ?int
{
return $this->Nb_de_commande;
}
public function setNbDeCommande(int $Nb_de_commande): static
{
$this->Nb_de_commande = $Nb_de_commande;
return $this;
}
/**
* @return Collection<int, Commandes>
*/
public function getCommande(): Collection
{
return $this->Commande;
}
public function addCommande(Commandes $commande): static
{
if (!$this->Commande->contains($commande)) {
$this->Commande->add($commande);
}
return $this;
}
public function removeCommande(Commandes $commande): static
{
$this->Commande->removeElement($commande);
return $this;
}
public function getReduction(): ?Reductions
{
return $this->Reduction;
}
public function setReduction(?Reductions $Reduction): static
{
$this->Reduction = $Reduction;
return $this;
}
}

154
src/Entity/Reductions.php Normal file
View File

@ -0,0 +1,154 @@
<?php
namespace App\Entity;
use App\Repository\ReductionsRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: ReductionsRepository::class)]
class Reductions
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $Description = null;
#[ORM\Column]
private ?float $Prix = null;
#[ORM\Column]
private ?int $Pourcentage = null;
#[ORM\Column(length: 255)]
private ?string $MontantFixe = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
private ?\DateTimeInterface $DateDebut = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
private ?\DateTimeInterface $DateFin = null;
/**
* @var Collection<int, Plats>
*/
#[ORM\OneToMany(targetEntity: Plats::class, mappedBy: 'Reduction')]
private Collection $plats;
public function __construct()
{
$this->plats = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getDescription(): ?string
{
return $this->Description;
}
public function setDescription(string $Description): static
{
$this->Description = $Description;
return $this;
}
public function getPrix(): ?float
{
return $this->Prix;
}
public function setPrix(float $Prix): static
{
$this->Prix = $Prix;
return $this;
}
public function getPourcentage(): ?int
{
return $this->Pourcentage;
}
public function setPourcentage(int $Pourcentage): static
{
$this->Pourcentage = $Pourcentage;
return $this;
}
public function getMontantFixe(): ?string
{
return $this->MontantFixe;
}
public function setMontantFixe(string $MontantFixe): static
{
$this->MontantFixe = $MontantFixe;
return $this;
}
public function getDateDebut(): ?\DateTimeInterface
{
return $this->DateDebut;
}
public function setDateDebut(\DateTimeInterface $DateDebut): static
{
$this->DateDebut = $DateDebut;
return $this;
}
public function getDateFin(): ?\DateTimeInterface
{
return $this->DateFin;
}
public function setDateFin(\DateTimeInterface $DateFin): static
{
$this->DateFin = $DateFin;
return $this;
}
/**
* @return Collection<int, Plats>
*/
public function getPlats(): Collection
{
return $this->plats;
}
public function addPlat(Plats $plat): static
{
if (!$this->plats->contains($plat)) {
$this->plats->add($plat);
$plat->setReduction($this);
}
return $this;
}
public function removePlat(Plats $plat): static
{
if ($this->plats->removeElement($plat)) {
// set the owning side to null (unless already changed)
if ($plat->getReduction() === $this) {
$plat->setReduction(null);
}
}
return $this;
}
}

106
src/Entity/Reservations.php Normal file
View File

@ -0,0 +1,106 @@
<?php
namespace App\Entity;
use App\Repository\ReservationsRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: ReservationsRepository::class)]
class Reservations
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
private ?\DateTimeInterface $DateHeure = null;
#[ORM\Column]
private ?int $Nb_de_prsn = null;
#[ORM\ManyToOne(inversedBy: 'reservations')]
private ?Tables $Table = null;
/**
* @var Collection<int, Utilisateurs>
*/
#[ORM\ManyToMany(targetEntity: Utilisateurs::class, mappedBy: 'Reservation')]
private Collection $utilisateurs;
public function __construct()
{
$this->utilisateurs = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getDateHeure(): ?\DateTimeInterface
{
return $this->DateHeure;
}
public function setDateHeure(\DateTimeInterface $DateHeure): static
{
$this->DateHeure = $DateHeure;
return $this;
}
public function getNbDePrsn(): ?int
{
return $this->Nb_de_prsn;
}
public function setNbDePrsn(int $Nb_de_prsn): static
{
$this->Nb_de_prsn = $Nb_de_prsn;
return $this;
}
public function getTable(): ?Tables
{
return $this->Table;
}
public function setTable(?Tables $Table): static
{
$this->Table = $Table;
return $this;
}
/**
* @return Collection<int, Utilisateurs>
*/
public function getUtilisateurs(): Collection
{
return $this->utilisateurs;
}
public function addUtilisateur(Utilisateurs $utilisateur): static
{
if (!$this->utilisateurs->contains($utilisateur)) {
$this->utilisateurs->add($utilisateur);
$utilisateur->addReservation($this);
}
return $this;
}
public function removeUtilisateur(Utilisateurs $utilisateur): static
{
if ($this->utilisateurs->removeElement($utilisateur)) {
$utilisateur->removeReservation($this);
}
return $this;
}
}

View File

@ -0,0 +1,78 @@
<?php
namespace App\Entity;
use App\Repository\StatutCommandesRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: StatutCommandesRepository::class)]
class StatutCommandes
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $Libelle = null;
/**
* @var Collection<int, Commandes>
*/
#[ORM\OneToMany(targetEntity: Commandes::class, mappedBy: 'StatutCommande')]
private Collection $commandes;
public function __construct()
{
$this->commandes = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getLibelle(): ?string
{
return $this->Libelle;
}
public function setLibelle(string $Libelle): static
{
$this->Libelle = $Libelle;
return $this;
}
/**
* @return Collection<int, Commandes>
*/
public function getCommandes(): Collection
{
return $this->commandes;
}
public function addCommande(Commandes $commande): static
{
if (!$this->commandes->contains($commande)) {
$this->commandes->add($commande);
$commande->setStatutCommande($this);
}
return $this;
}
public function removeCommande(Commandes $commande): static
{
if ($this->commandes->removeElement($commande)) {
// set the owning side to null (unless already changed)
if ($commande->getStatutCommande() === $this) {
$commande->setStatutCommande(null);
}
}
return $this;
}
}

View File

@ -0,0 +1,50 @@
<?php
namespace App\Entity;
use App\Repository\StatutTablesRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: StatutTablesRepository::class)]
class StatutTables
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $Libellé = null;
#[ORM\ManyToOne(inversedBy: 'statutTables')]
private ?Tables $Table = null;
public function getId(): ?int
{
return $this->id;
}
public function getLibellé(): ?string
{
return $this->Libellé;
}
public function setLibellé(string $Libellé): static
{
$this->Libellé = $Libellé;
return $this;
}
public function getTable(): ?Tables
{
return $this->Table;
}
public function setTable(?Tables $Table): static
{
$this->Table = $Table;
return $this;
}
}

168
src/Entity/Tables.php Normal file
View File

@ -0,0 +1,168 @@
<?php
namespace App\Entity;
use App\Repository\TablesRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: TablesRepository::class)]
class Tables
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
/**
* @var Collection<int, Clients>
*/
#[ORM\ManyToMany(targetEntity: Clients::class, mappedBy: 'table')]
private Collection $Clients;
/**
* @var Collection<int, Reservations>
*/
#[ORM\OneToMany(targetEntity: Reservations::class, mappedBy: 'Table')]
private Collection $reservations;
/**
* @var Collection<int, StatutTables>
*/
#[ORM\OneToMany(targetEntity: StatutTables::class, mappedBy: 'Table')]
private Collection $statutTables;
/**
* @var Collection<int, Utilisateurs>
*/
#[ORM\ManyToMany(targetEntity: Utilisateurs::class, mappedBy: 'table')]
private Collection $utilisateurs;
public function __construct()
{
$this->Clients = new ArrayCollection();
$this->reservations = new ArrayCollection();
$this->statutTables = new ArrayCollection();
$this->utilisateurs = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
/**
* @return Collection<int, Clients>
*/
public function getClient(): Collection
{
return $this->Clients;
}
public function addClient(Clients $table): static
{
if (!$this->Clients->contains($table)) {
$this->Clients->add($table);
$table->addTable($this);
}
return $this;
}
public function removeClient(Clients $table): static
{
if ($this->Clients->removeElement($table)) {
$table->removeTable($this);
}
return $this;
}
/**
* @return Collection<int, Reservations>
*/
public function getReservations(): Collection
{
return $this->reservations;
}
public function addReservation(Reservations $reservation): static
{
if (!$this->reservations->contains($reservation)) {
$this->reservations->add($reservation);
$reservation->setTable($this);
}
return $this;
}
public function removeReservation(Reservations $reservation): static
{
if ($this->reservations->removeElement($reservation)) {
// set the owning side to null (unless already changed)
if ($reservation->getTable() === $this) {
$reservation->setTable(null);
}
}
return $this;
}
/**
* @return Collection<int, StatutTables>
*/
public function getStatutTables(): Collection
{
return $this->statutTables;
}
public function addStatutTable(StatutTables $statutTable): static
{
if (!$this->statutTables->contains($statutTable)) {
$this->statutTables->add($statutTable);
$statutTable->setTable($this);
}
return $this;
}
public function removeStatutTable(StatutTables $statutTable): static
{
if ($this->statutTables->removeElement($statutTable)) {
// set the owning side to null (unless already changed)
if ($statutTable->getTable() === $this) {
$statutTable->setTable(null);
}
}
return $this;
}
/**
* @return Collection<int, Utilisateurs>
*/
public function getUtilisateurs(): Collection
{
return $this->utilisateurs;
}
public function addUtilisateur(Utilisateurs $utilisateur): static
{
if (!$this->utilisateurs->contains($utilisateur)) {
$this->utilisateurs->add($utilisateur);
$utilisateur->addTable($this);
}
return $this;
}
public function removeUtilisateur(Utilisateurs $utilisateur): static
{
if ($this->utilisateurs->removeElement($utilisateur)) {
$utilisateur->removeTable($this);
}
return $this;
}
}

180
src/Entity/Utilisateurs.php Normal file
View File

@ -0,0 +1,180 @@
<?php
namespace App\Entity;
use App\Repository\UtilisateursRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
#[ORM\Entity(repositoryClass: UtilisateursRepository::class)]
class Utilisateurs implements UserInterface, PasswordAuthenticatedUserInterface
{
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'SEQUENCE')]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $Nom = null;
#[ORM\Column(length: 255)]
private ?string $Prenom = null;
#[ORM\Column(length: 255, unique: true)]
private ?string $Mail = null;
#[ORM\Column(length: 255)]
private ?string $MotDePasse = null;
#[ORM\Column(type: 'json', length: 255)]
private array $Role = [];
/**
* @var Collection<int, Reservations>
*/
#[ORM\ManyToMany(targetEntity: Reservations::class, inversedBy: 'utilisateurs')]
private Collection $Reservation;
/**
* @var Collection<int, Tables>
*/
#[ORM\ManyToMany(targetEntity: Tables::class, inversedBy: 'utilisateurs')]
private Collection $table;
public function __construct()
{
$this->Reservation = new ArrayCollection();
$this->table = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getNom(): ?string
{
return $this->Nom;
}
public function setNom(string $Nom): static
{
$this->Nom = $Nom;
return $this;
}
public function getPrenom(): ?string
{
return $this->Prenom;
}
public function setPrenom(string $Prenom): static
{
$this->Prenom = $Prenom;
return $this;
}
public function getUserIdentifier(): string
{
return $this->Mail;
}
public function setUserIdentifier(string $userIdentifier): self
{
$this->Mail = $userIdentifier;
return $this;
}
public function getPassword(): ?string
{
return $this->MotDePasse;
}
public function setPassword(string $MotDePasse): static
{
$this->MotDePasse = $MotDePasse;
return $this;
}
public function getRoles(): array
{
return $this->Role;
}
public function getRolesAsString(): string
{
// Supprime le préfixe "ROLE_" et formate en majuscule seulement la première lettre
$roles = array_map(function($role) {
return ucfirst(strtolower(str_replace('ROLE_', '', $role)));
}, $this->Role);
return implode(', ', $roles);
}
public function setRoles(array $Role): self
{
$this->Role = $Role;
return $this;
}
public function eraseCredentials(): void
{
// Méthode pour effacer les données sensibles (ex : plaintext password)
}
/**
* @return Collection<int, Reservations>
*/
public function getReservation(): Collection
{
return $this->Reservation;
}
public function addReservation(Reservations $reservation): static
{
if (!$this->Reservation->contains($reservation)) {
$this->Reservation->add($reservation);
}
return $this;
}
public function removeReservation(Reservations $reservation): static
{
$this->Reservation->removeElement($reservation);
return $this;
}
/**
* @return Collection<int, Tables>
*/
public function getTable(): Collection
{
return $this->table;
}
public function addTable(Tables $table): static
{
if (!$this->table->contains($table)) {
$this->table->add($table);
}
return $this;
}
public function removeTable(Tables $table): static
{
$this->table->removeElement($table);
return $this;
}
}

View File

@ -0,0 +1,61 @@
<?php
namespace App\Form;
use App\Entity\Utilisateurs;
use App\Entity\Tables;
use App\Entity\Clients;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\CallbackTransformer;
use Symfony\Component\Validator\Constraints\Length;
use Symfony\Component\Validator\Constraints\NotBlank;
class AddUserFormType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('UserIdentifier', EmailType::class, )
->add('Password', PasswordType::class, [
// instead of being set onto the object directly,
// this is read and encoded in the controller
'mapped' => false,
'attr' => ['autocomplete' => 'new-password'],
'constraints' => [
new NotBlank([
'message' => 'Entrer un mot de passe',
]),
],
])
->add('Nom')
->add('Prenom')
->add('Roles', ChoiceType::class, [
'choices' => [
'Admin' => 'ROLE_ADMIN',
'User' => 'ROLE_USER',
'Cuisinier' => 'ROLE_CUISINIER',
'Serveur' => 'ROLE_SERVEUR',
],
'expanded' => true,
'multiple' => true,
])
->add('Enregistrer', SubmitType::class);
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Utilisateurs::class,
]);
}
}

View File

@ -0,0 +1,34 @@
<?php
namespace App\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class LoginFormType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('email', EmailType::class, [
'label' => 'Email',
])
->add('password', PasswordType::class, [
'label' => 'Mot de passe',
])
->add('confirm', SubmitType::class, [
'label' => 'Connexion',
]);
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
// Configure your form options here
]);
}
}

View File

@ -0,0 +1,57 @@
<?php
namespace App\Form;
use App\Entity\Reservations;
use App\Entity\Tables;
use App\Entity\Utilisateurs;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Validator\Constraints\NotBlank;
class UpdateUserType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('UserIdentifier', EmailType::class, )
->add('Password', PasswordType::class, [
// instead of being set onto the object directly,
// this is read and encoded in the controller
'mapped' => false,
'attr' => ['autocomplete' => 'new-password'],
'constraints' => [
new NotBlank([
'message' => 'Entrer un mot de passe',
]),
],
])
->add('Nom')
->add('Prenom')
->add('Roles', ChoiceType::class, [
'choices' => [
'Admin' => 'ROLE_ADMIN',
'User' => 'ROLE_USER',
],
'expanded' => true,
'multiple' => true,
'data' => $options['data']->getRoles(),
])
->add('Modifier', SubmitType::class);
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Utilisateurs::class,
]);
}
}

View File

@ -0,0 +1,43 @@
<?php
namespace App\Repository;
use App\Entity\Clients;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<Clients>
*/
class ClientsRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Clients::class);
}
// /**
// * @return Commandes[] Returns an array of Commandes objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('c')
// ->andWhere('c.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('c.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?Commandes
// {
// return $this->createQueryBuilder('c')
// ->andWhere('c.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}

View File

@ -0,0 +1,43 @@
<?php
namespace App\Repository;
use App\Entity\Commandes;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<Commandes>
*/
class CommandesRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Commandes::class);
}
// /**
// * @return Commandes[] Returns an array of Commandes objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('c')
// ->andWhere('c.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('c.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?Commandes
// {
// return $this->createQueryBuilder('c')
// ->andWhere('c.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}

View File

@ -0,0 +1,43 @@
<?php
namespace App\Repository;
use App\Entity\DetailsCommande;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<DetailsCommande>
*/
class DetailsCommandeRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, DetailsCommande::class);
}
// /**
// * @return DetailsCommande[] Returns an array of DetailsCommande objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('d')
// ->andWhere('d.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('d.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?DetailsCommande
// {
// return $this->createQueryBuilder('d')
// ->andWhere('d.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}

View File

@ -0,0 +1,43 @@
<?php
namespace App\Repository;
use App\Entity\Plats;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<Plats>
*/
class PlatsRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Plats::class);
}
// /**
// * @return Plats[] Returns an array of Plats objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('p')
// ->andWhere('p.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('p.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?Plats
// {
// return $this->createQueryBuilder('p')
// ->andWhere('p.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}

View File

@ -0,0 +1,43 @@
<?php
namespace App\Repository;
use App\Entity\Reductions;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<Reductions>
*/
class ReductionsRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Reductions::class);
}
// /**
// * @return Reductions[] Returns an array of Reductions objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('r')
// ->andWhere('r.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('r.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?Reductions
// {
// return $this->createQueryBuilder('r')
// ->andWhere('r.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}

View File

@ -0,0 +1,43 @@
<?php
namespace App\Repository;
use App\Entity\Reservations;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<Reservations>
*/
class ReservationsRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Reservations::class);
}
// /**
// * @return Commandes[] Returns an array of Commandes objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('c')
// ->andWhere('c.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('c.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?Commandes
// {
// return $this->createQueryBuilder('c')
// ->andWhere('c.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}

View File

@ -0,0 +1,43 @@
<?php
namespace App\Repository;
use App\Entity\StatutCommandes;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<StatutCommandes>
*/
class StatutCommandesRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, StatutCommandes::class);
}
// /**
// * @return StatutCommandes[] Returns an array of StatutCommandes objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('s')
// ->andWhere('s.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('s.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?StatutCommandes
// {
// return $this->createQueryBuilder('s')
// ->andWhere('s.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}

View File

@ -0,0 +1,43 @@
<?php
namespace App\Repository;
use App\Entity\StatutTables;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<StatutTables>
*/
class StatutTablesRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, StatutTables::class);
}
// /**
// * @return StatutTables[] Returns an array of StatutTables objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('s')
// ->andWhere('s.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('s.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?StatutTables
// {
// return $this->createQueryBuilder('s')
// ->andWhere('s.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}

View File

@ -0,0 +1,43 @@
<?php
namespace App\Repository;
use App\Entity\Tables;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<Tables>
*/
class TablesRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Tables::class);
}
// /**
// * @return Commandes[] Returns an array of Commandes objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('c')
// ->andWhere('c.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('c.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?Commandes
// {
// return $this->createQueryBuilder('c')
// ->andWhere('c.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}

View File

@ -0,0 +1,43 @@
<?php
namespace App\Repository;
use App\Entity\Utilisateurs;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<Utilisateurs>
*/
class UtilisateursRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Utilisateurs::class);
}
// /**
// * @return Commandes[] Returns an array of Commandes objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('c')
// ->andWhere('c.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('c.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?Commandes
// {
// return $this->createQueryBuilder('c')
// ->andWhere('c.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}

View File

@ -0,0 +1,66 @@
<?php
namespace App\Security;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Http\Authenticator\AbstractLoginFormAuthenticator;
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\CsrfTokenBadge;
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\RememberMeBadge;
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge;
use Symfony\Component\Security\Http\Authenticator\Passport\Credentials\PasswordCredentials;
use Symfony\Component\Security\Http\Authenticator\Passport\Passport;
use Symfony\Component\Security\Http\SecurityRequestAttributes;
use Symfony\Component\Security\Http\Util\TargetPathTrait;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
class LoginAuthenticator extends AbstractLoginFormAuthenticator
{
use TargetPathTrait;
public const LOGIN_ROUTE = 'app_login';
public function __construct(private UrlGeneratorInterface $urlGenerator)
{
}
public function authenticate(Request $request): Passport
{
$mail = $request->getPayload()->getString('UserIdentifier');
$request->getSession()->set(SecurityRequestAttributes::LAST_USERNAME, $mail);
return new Passport(
new UserBadge($mail),
new PasswordCredentials($request->getPayload()->getString('Password')),
[
new CsrfTokenBadge('authenticate', $request->getPayload()->getString('_csrf_token')),
new RememberMeBadge(),
]
);
}
public function onAuthenticationSuccess(Request $request, TokenInterface $token, string $firewallName): ?Response
{
if ($targetPath = $this->getTargetPath($request->getSession(), $firewallName)) {
return new RedirectResponse($targetPath);
}
// For example:
return new RedirectResponse($this->urlGenerator->generate('app_index'));
}
public function start(Request $request, ?AuthenticationException $authException = null): RedirectResponse
{
return new RedirectResponse($this->urlGenerator->generate('app_access_denied'));
}
protected function getLoginUrl(Request $request): string
{
return $this->urlGenerator->generate(self::LOGIN_ROUTE);
}
}

View File

@ -248,6 +248,18 @@
"templates/base.html.twig"
]
},
"symfony/ux-icons": {
"version": "2.21",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "2.17",
"ref": "803a3bbd5893f9584969ab8670290cdfb6a0a5b5"
},
"files": [
"./assets/icons/symfony.svg"
]
},
"symfony/ux-turbo": {
"version": "v2.20.0"
},

View File

@ -0,0 +1,58 @@
<div id="compteModal" class="modal" tabindex="-1" aria-labelledby="compteModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<span class="close" data-modal="compteModal">&times;</span>
<h2 class="modal-header" id="compteModalLabel">Gestion Compte</h2>
<div class="modal-body">
<!-- Contenu de la modal Gestion Utilisateur -->
<div id="InformationUser">
<div id="NomUser">
<span>Nom : {{ app.user.nom }}</span>
</div>
<div id="NomUser">
<span>Prenom : {{ app.user.prenom }}</span>
</div>
<div id="NomUser">
<span>Email : {{ app.user.userIdentifier }}</span>
</div>
<div id="NomUser">
<span>Roles : {{ app.user.getRolesAsString() }}</span>
</div>
<div class="btn-custom icon-container" data-bs-toggle="modal" data-bs-target="#modifModal">
<i class="icon-medium"> {{ ux_icon('fluent-emoji-high-contrast:ten-oclock') }}</i>
<span>Modifier</span>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Modal de Modification des Informations Utilisateur -->
<div id="modifModal" class="modal" tabindex="-1" aria-labelledby="modifModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="modifModalLabel">Modifier Informations Utilisateur</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<form>
<div class="mb-3">
<label for="newEmail" class="form-label">Nouvel Email</label>
<input type="email" class="form-control" id="newEmail" placeholder="Entrez votre nouvel email">
</div>
<div class="mb-3">
<label for="newNom" class="form-label">Nouveau Nom</label>
<input type="text" class="form-control" id="newNom" placeholder="Entrez votre nouveau nom">
</div>
<div class="mb-3">
<label for="newPrenom" class="form-label">Nouveau Prenom</label>
<input type="text" class="form-control" id="newPrenom" placeholder="Entrez votre nouveau prenom">
</div>
<button type="submit" class="btn btn-primary">Confirmer</button>
</form>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,28 @@
{% extends 'base.html.twig' %}
{% block title %}Accès Refusé{% endblock %}
{% block body %}
<style>
.container {
margin-top: 50px;
text-align: center;
background-color: orange;
}
h1 {
color: #dc3545;
}
.btn {
margin-top: 20px;
}
</style>
<div class="container">
<h1>Accès Refusé</h1>
<p>Vous n'avez pas les permissions nécessaires pour accéder à cette page.</p>
<a href="{{ path('app_login') }}" class="btn btn-primary">Se connecter</a>
</div>
{% endblock %}

View File

@ -3,7 +3,13 @@
<head>
<meta charset="UTF-8">
<title>{% block title %}Welcome!{% endblock %}</title>
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 128 128%22><text y=%221.2em%22 font-size=%2296%22>⚫️</text><text y=%221.3em%22 x=%220.2em%22 font-size=%2276%22 fill=%22%23fff%22>sf</text></svg>">
<link rel="" href="">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Qwitcher+Grypen:wght@400;700&display=swap" rel="stylesheet">
{# bootstrap#}
{# <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">#}
{% block stylesheets %}
{% endblock %}
@ -13,5 +19,8 @@
</head>
<body>
{% block body %}{% endblock %}
{# bootstrap#}
{# <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.8/dist/umd/popper.min.js" integrity="sha384-I7E8VVD/ismYTF4hNIPjVp/Zjvgyol6VFvRkX/vR+Vc4jQkC+hVqc2pM8ODewa9r" crossorigin="anonymous"></script>#}
{# <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.min.js" integrity="sha384-0pUGZvbkm6XF6gxjEnlmuGrJXVbNuzT9qBBavbLwCsOGabYfZo0T0to5eqruptLy" crossorigin="anonymous"></script> </body>#}
</body>
</html>

View File

@ -0,0 +1,38 @@
{% extends 'base.html.twig' %}
{% block title %}Gestion User{% endblock %}
{% block body %}
<style>
</style>
<form id="UpdateUser" action="{{ path('update-user', { 'id': app.user.id }) }}" method="post">
<div id="InformationUser">
<div class="user-info-item">
<span class="user-info-label">Nom :</span>
<span class="user-info-value">{{ app.user.nom }}</span>
</div>
<div class="user-info-item">
<span class="user-info-label">Prénom :</span>
<span class="user-info-value">{{ app.user.prenom }}</span>
</div>
<div class="user-info-item">
<span class="user-info-label">Email :</span>
<span class="user-info-value">{{ app.user.userIdentifier }}</span>
</div>
<div class="user-info-item">
<span class="user-info-label">Roles :</span>
<span class="user-info-value">{{ app.user.getRolesAsString() }}</span>
</div>
<div class="btn">
<button type="submit" class="submit-button">Mettre à jour</button>
</div>
</div>
</form>
{% endblock %}

View File

@ -0,0 +1,135 @@
{% extends 'base.html.twig' %}
{% block head %}
<head>
<meta charset="UTF-8">
<title>{% block title %}Accueil{% endblock %}</title>
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 128 128%22><text y=%221.2em%22 font-size=%2296%22>⚫️</text><text y=%221.3em%22 x=%220.2em%22 font-size=%2276%22 fill=%22%23fff%22>sf</text></svg>">
<link href="https://fonts.cdnfonts.com/css/brittany-signature" rel="stylesheet">
</head>
{% endblock %}
{% block stylesheets %}
<link rel="stylesheet" href="{{ asset('css/modal.css') }}"> <!-- Ajout du fichier CSS -->
<link rel="stylesheet" href="{{ asset('css/compte/index.css') }}"> <!-- Ajout du fichier CSS -->
{% endblock %}
{% block body %}
<style>
</style>
<!-- Top Bar -->
<div class="top-bar">
<div>
Bonjour, {{ app.user.prenom }}
</div>
</div>
<!-- Left Menu -->
<div class="left-background">
<img class="LogoHegre" src="{{ asset('asset/image/LogoHegre.png') }}">
{% if is_granted('ROLE_ADMIN') %}
<div class="nav-bar">
<ul>
<li>
<div class="btn-custom icon-container">
<i class="icon-medium"> {{ ux_icon('grommet-icons:group') }}</i>
<span>Gérer Utilisateur</span>
</div>
</li>
<li>
<div class="btn-custom icon-container">
<i class="icon-medium"> {{ ux_icon('ic:outline-table-bar') }}</i>
<span>Gérer Table</span>
</div>
</li>
<li>
<div class="btn-custom icon-container">
<i class="icon-medium"> {{ ux_icon('bx:food-menu') }}</i>
<span>Gestion Menu</span>
</div>
</li>
<li>
<div class="btn-custom icon-container">
<i class="icon-medium"> {{ ux_icon('lsicon:badge-promotion-outline') }}</i>
<span>Gestion Promotion</span>
</div>
</li>
<li>
<div class="btn-custom icon-container">
<i class="icon-medium"> {{ ux_icon('fluent-emoji-high-contrast:ten-oclock') }}</i>
<span>Voir tendances</span>
</div>
</li>
</ul>
</div>
{% elseif is_granted('ROLE_CUISINIER') %}
<div class="nav-bar">
<ul>
<li>
<div class="btn-custom icon-container">
<i class="icon-medium"> {{ ux_icon('icon-park-outline:view-list') }}</i>
<span>Liste des commandes</span>
</div>
</li>
</ul>
<ul>
<li>
<div class="btn-custom icon-container">
<i class="icon-medium"> {{ ux_icon('grommet-icons:group') }}</i>
<span>Je sais pas encore</span>
</div>
</li>
</ul>
</div>
{% elseif is_granted('ROLE_SERVEUR') %}
<div class="nav-bar">
<ul>
<li>
<div class="btn-custom icon-container">
<i class="icon-medium"> {{ ux_icon('fluent-mdl2:reservation-orders') }}</i>
<span>Réservation</span>
</div>
</li>
</ul>
<ul>
<li>
<div class="btn-custom icon-container">
<i class="icon-medium"> {{ ux_icon('icon-park-outline:view-list') }}</i>
<span>Commande</span>
</div>
</li>
</ul>
</div>
{% endif %}
<div class="Information-perso">
<div class="btn-info-compte icon-container">
<i class="icon-medium"> {{ ux_icon('ph:user-circle-fill') }}</i>
<span>Compte</span>
</div>
<div class="btn-info-exit icon-container">
<a href="{{ path('app_logout') }}" class="icon-medium">
{{ ux_icon('iconamoon:exit-bold') }}
</a>
</div>
</div>
</div>
<div id="container_gestion_user">
<!-- Contenu par défaut, ou vous pouvez laisser vide -->
</div>
<script>
</script>
<!-- Include modals -->
{% include 'Modals/gestionCompteModal.html.twig' %}
{% endblock %}
{% block javascripts %}
<script src="{{ asset('js/test.js') }}" defer></script>
{% endblock %}

View File

@ -0,0 +1,134 @@
{% extends 'base.html.twig' %}
{% block stylesheets %}
<link rel="stylesheet" href="../../../assets/styles/login.css">
{% endblock %}
{% block title %}Login{% endblock %}
{% block body %}
<style>
html {
background-image: url("asset/image/BackgroundLogin.jpg"); background-repeat: no-repeat; background-size: cover;
height: 100%;
width: 100%;
}
body {
height: 100%;
width: 100%;
}
.Login {
width: 100%;
height: 100%;
}
.Circle {
background: #db5559;
width: 41%;
height: 80%;
margin: 0 auto;
border-style: solid;
border-radius: 50%;
border-color: white;
border-width: 5px;
}
.Form {
background: #791c1c;
height: 40%;
width: 55%;
margin: auto;
border-style: solid;
border-radius: 50px;
border-color: white;
border-width: 2px;
text-align: center;
font-family: "Qwitcher Grypen", cursive;
font-size: 40px;
font-style: italic;
color: white;
padding-bottom: 0;
}
.Logo {
display: flex;
margin: auto;
margin-top: 8%;
}
.Title1 {
font-size: 60px;
margin: 0;
padding: 0;
}
.Title2 {
display: grid;
place-items: center;
height: 7vh;
color: black;
font-family: "Qwitcher Grypen", cursive;
font-size: 40px;
margin: 0;
}
.form-group{
display: grid;
place-items: center;
height: 7vh;
align-items: center;
text-align: center;
/*margin-bottom: 10px;*/
}
.form-control{
background-color: #f19595;
margin-left: 10px;
border-radius: 5px;
}
.btn{
background-color: #279b63;
border-radius: 6px;
height: 30px;
}
</style>
<div class="Login">
<div class="Circle">
<img src="asset/image/LogoHegre.png" class="Logo">
<div class="Form">
<form method="post">
<h1 class="Title1">Bienvenue !</h1>
<div class="form-group">
<label for="UserIdentifier">Email:</label>
<input type="text" id="UserIdentifier" name="UserIdentifier" value="{{ last_username }}" required autofocus>
</div>
<div class="form-group">
<label for="Password">Mot de passe:</label>
<input type="password" id="Password" name="Password" required>
</div>
<input type="hidden" name="_csrf_token"
value="{{ csrf_token('authenticate') }}"
>
<div class="form-group">
<button class="btn btn-lg btn-primary" type="submit">
Connexion
</button>
</div>
<h1 class="Title2">Volaille en fête, Saveurs parfaites !</h1>
</form>
</div>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,105 @@
{% extends 'base.html.twig' %}
{% block stylesheets %}
<style>
.form-container {
max-width: 500px;
margin: 0 auto;
padding: 20px;
background-color: #f8f9fa;
border: 1px solid #dee2e6;
border-radius: 8px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
font-family: sans-serif;
}
.form-container h1 {
text-align: center;
margin-bottom: 20px;
font-size: 24px;
}
.form-group {
margin-bottom: 15px;
}
.form-input {
display: flex;
justify-content: center;
margin-bottom: 20px;
width: 95%;
padding: 10px;
border: 1px solid #ced4da;
border-radius: 4px;
font-size: 16px;
}
.form-input:focus {
border-color: #007bff;
box-shadow: 0 0 5px rgba(0, 123, 255, 0.25);
outline: none;
}
.btn-container {
display: flex;
justify-content: center;
margin-bottom: 20px;
}
.btn-save {
padding: 5px 10px;
text-decoration: none;
color: white;
background-color: #007bff;
border-radius: 5px;
font-weight: bold;
margin-top: 25px;
}
.btn-list {
padding: 5px 10px;
text-decoration: none;
color: white;
background-color: orange;
border-radius: 5px;
font-weight: bold;
}
</style>
{% endblock %}
{% block title %}Nouvelle Utilisateur{% endblock %}
{% block body %}
<div class="form-container">
<h1>Nouvelle Utilisateur ! ✅</h1>
{{ form_start(registrationForm) }}
{{ form_errors(registrationForm) }}
<div class="form-group">
{{ form_row(registrationForm.Nom, {'attr': {'class': 'form-input'}, 'label': 'Nom'}) }}
</div>
<div class="form-group">
{{ form_row(registrationForm.Prenom, {'attr': {'class': 'form-input'}, 'label': 'Prénom'}) }}
</div>
<div class="form-group">
{{ form_row(registrationForm.UserIdentifier, {'attr': {'class': 'form-input'}, 'label': 'Email'}) }}
</div>
<div class="form-group">
{{ form_row(registrationForm.Password, {'attr': {'class': 'form-input'}, 'label': 'Password'}) }}
</div>
<div class="form-group">
{{ form_row(registrationForm.Roles, {'attr': {'class': 'form-input'}, 'label': 'Roles'}) }}
</div>
<div class="btn-container">
{{ form_row(registrationForm.Enregistrer, {'attr': {'class': 'btn-save'}, 'label': 'Enregistrer'}) }}
</div>
{{ form_end(registrationForm) }}
<div class="btn-container">
<a href="{{ path('list_user') }}" class="btn-list btn-primary">Liste des Utilisateur</a>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,84 @@
{% extends 'base.html.twig' %}
{% block title %}Liste Utilisateur{% endblock %}
{% block body %}
<style>
.user-table {
width: 100%;
border-collapse: collapse;
font-family: sans-serif;
}
.user-table th,
.user-table td {
border: 1px solid #ddd;
padding: 8px;
text-align: left;
}
.user-table th {
background-color: #f2f2f2;
font-weight: bold;
}
.user-table tr:nth-child(even) {
background-color: #f9f9f9;
}
.user-table tr:hover {
background-color: #f1f1f1;
}
.btn-container {
display: flex;
justify-content: center;
margin-bottom: 20px;
}
.btn {
padding: 5px 10px;
text-decoration: none;
color: white;
background-color: #007bff;
border-radius: 5px;
font-weight: bold;
margin-top: 25px;
}
</style>
<div class="example-wrapper">
<h1>Liste des Utilisateurs ! ✅</h1>
<table class="user-table">
<thead>
<tr>
<th>ID</th>
<th>Nom</th>
<th>Prenom</th>
<th>Mail</th>
<th>Roles</th>
</tr>
</thead>
<tbody>
{% for utilisateur in utilisateurs %}
<tr>
<td>{{ utilisateur.id }}</td>
<td>{{ utilisateur.nom }}</td>
<td>{{ utilisateur.prenom }}</td>
<td>{{ utilisateur.UserIdentifier }}</td>
<td>{{ utilisateur.roles|join }}</td>
</tr>
{% else %}
<tr>
<td colspan="5">Aucun utilisateur trouvé.</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="btn-container">
<a href="{{ path('add_user') }}" class="btn btn-primary">Ajouter un Utilisateur</a>
</div>
</div>
{% endblock %}