Compare commits

...

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

140 changed files with 8041 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/ /web/js/
# End of https://www.toptal.com/developers/gitignore/api/symfony,phpstorm,git # End of https://www.toptal.com/developers/gitignore/api/symfony,phpstorm,git
.idea/
/vendor/ /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", "php": ">=8.2",
"ext-ctype": "*", "ext-ctype": "*",
"ext-iconv": "*", "ext-iconv": "*",
"amphp/http-client": "4.2.1",
"doctrine/dbal": "^3", "doctrine/dbal": "^3",
"doctrine/doctrine-bundle": "^2.13", "doctrine/doctrine-bundle": "^2.13",
"doctrine/doctrine-migrations-bundle": "^3.3", "doctrine/doctrine-migrations-bundle": "^3.3",
@ -38,6 +39,7 @@
"symfony/string": "7.1.*", "symfony/string": "7.1.*",
"symfony/translation": "7.1.*", "symfony/translation": "7.1.*",
"symfony/twig-bundle": "7.1.*", "symfony/twig-bundle": "7.1.*",
"symfony/ux-icons": "^2.21",
"symfony/ux-turbo": "^2.20", "symfony/ux-turbo": "^2.20",
"symfony/validator": "7.1.*", "symfony/validator": "7.1.*",
"symfony/web-link": "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\SecurityBundle\SecurityBundle::class => ['all' => true],
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true], Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true], Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
Symfony\UX\Icons\UXIconsBundle::class => ['all' => true],
]; ];

View File

@ -2,38 +2,52 @@ security:
# https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords # https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords
password_hashers: password_hashers:
Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto' Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto'
# https://symfony.com/doc/current/security.html#loading-the-user-the-user-provider
providers: providers:
users_in_memory: { memory: null } app_user_provider:
entity:
class: App\Entity\Utilisateurs
property: Mail
firewalls: firewalls:
dev: dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/ pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false security: false
main: main:
lazy: true 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 logout:
# https://symfony.com/doc/current/security.html#the-firewall 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]
access_control: access_control:
# - { path: ^/admin, roles: ROLE_ADMIN } # - { path: ^/, roles: ROLE_USER }
# - { path: ^/profile, roles: ROLE_USER } - { path: ^/login, roles: PUBLIC_ACCESS }
- { path: ^/logout, roles: ROLE_USER }
- { path: ^/index, roles: ROLE_ADMIN }
- { path: ^/user, roles: ROLE_ADMIN }
when@test: #when@test:
security: # security:
password_hashers: # password_hashers:
# By default, password hashers are resource intensive and take time. This is # # By default, password hashers are resource intensive and take time. This is
# important to generate secure password hashes. In tests however, secure hashes # # important to generate secure password hashes. In tests however, secure hashes
# are not important, waste resources and increase test times. The following # # are not important, waste resources and increase test times. The following
# reduces the work factor to the lowest possible values. # # reduces the work factor to the lowest possible values.
Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: # Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface:
algorithm: auto # algorithm: auto
cost: 4 # Lowest possible value for bcrypt # cost: 4 # Lowest possible value for bcrypt
time_cost: 3 # Lowest possible value for argon # time_cost: 3 # Lowest possible value for argon
memory_cost: 10 # 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,109 @@
<?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 Version20241010155711 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 eat_id_seq CASCADE');
$this->addSql('CREATE TABLE customer (id INT NOT NULL, first_name VARCHAR(255) NOT NULL, last_name VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL, number_phone VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE customer_table (customer_id INT NOT NULL, table_id INT NOT NULL, PRIMARY KEY(customer_id, table_id))');
$this->addSql('CREATE INDEX IDX_381CFA7D9395C3F3 ON customer_table (customer_id)');
$this->addSql('CREATE INDEX IDX_381CFA7DECFF285C ON customer_table (table_id)');
$this->addSql('CREATE TABLE discount (id INT NOT NULL, id_dishes_id INT DEFAULT NULL, description VARCHAR(255) NOT NULL, percentage VARCHAR(255) NOT NULL, fixed_amount DOUBLE PRECISION NOT NULL, start_date DATE NOT NULL, date_end DATE NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_E1E0B40E20686F5D ON discount (id_dishes_id)');
$this->addSql('CREATE TABLE dishes (id INT NOT NULL, name VARCHAR(255) NOT NULL, description VARCHAR(255) NOT NULL, price DOUBLE PRECISION NOT NULL, category VARCHAR(255) NOT NULL, status VARCHAR(255) NOT NULL, number_order VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE "order" (id INT NOT NULL, id_order_detail_id INT NOT NULL, id_status_order_id INT NOT NULL, date_time DOUBLE PRECISION NOT NULL, status VARCHAR(255) NOT NULL, total VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_F52993988D09BBCB ON "order" (id_order_detail_id)');
$this->addSql('CREATE INDEX IDX_F5299398F91B0968 ON "order" (id_status_order_id)');
$this->addSql('CREATE TABLE order_user (order_id INT NOT NULL, user_id INT NOT NULL, PRIMARY KEY(order_id, user_id))');
$this->addSql('CREATE INDEX IDX_C062EC5E8D9F6D38 ON order_user (order_id)');
$this->addSql('CREATE INDEX IDX_C062EC5EA76ED395 ON order_user (user_id)');
$this->addSql('CREATE TABLE order_dishes (order_id INT NOT NULL, dishes_id INT NOT NULL, PRIMARY KEY(order_id, dishes_id))');
$this->addSql('CREATE INDEX IDX_9BC2C3888D9F6D38 ON order_dishes (order_id)');
$this->addSql('CREATE INDEX IDX_9BC2C388A05DD37A ON order_dishes (dishes_id)');
$this->addSql('CREATE TABLE order_detail (id INT NOT NULL, quantity DOUBLE PRECISION NOT NULL, unit_price DOUBLE PRECISION NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE reservation (id INT NOT NULL, date_time DOUBLE PRECISION NOT NULL, number_people INT NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE reservation_user (reservation_id INT NOT NULL, user_id INT NOT NULL, PRIMARY KEY(reservation_id, user_id))');
$this->addSql('CREATE INDEX IDX_9BAA1B21B83297E7 ON reservation_user (reservation_id)');
$this->addSql('CREATE INDEX IDX_9BAA1B21A76ED395 ON reservation_user (user_id)');
$this->addSql('CREATE TABLE status_order (id INT NOT NULL, libelle VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE status_table (id INT NOT NULL, libelle VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE "table" (id INT NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE "user" (id INT NOT NULL, first_name VARCHAR(255) NOT NULL, last_name VARCHAR(255) NOT NULL, mail VARCHAR(255) NOT NULL, role VARCHAR(255) NOT NULL, password VARCHAR(255) NOT NULL, PRIMARY KEY(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 customer_table ADD CONSTRAINT FK_381CFA7D9395C3F3 FOREIGN KEY (customer_id) REFERENCES customer (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE customer_table ADD CONSTRAINT FK_381CFA7DECFF285C FOREIGN KEY (table_id) REFERENCES "table" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE discount ADD CONSTRAINT FK_E1E0B40E20686F5D FOREIGN KEY (id_dishes_id) REFERENCES dishes (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE "order" ADD CONSTRAINT FK_F52993988D09BBCB FOREIGN KEY (id_order_detail_id) REFERENCES order_detail (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE "order" ADD CONSTRAINT FK_F5299398F91B0968 FOREIGN KEY (id_status_order_id) REFERENCES status_order (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE order_user ADD CONSTRAINT FK_C062EC5E8D9F6D38 FOREIGN KEY (order_id) REFERENCES "order" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE order_user ADD CONSTRAINT FK_C062EC5EA76ED395 FOREIGN KEY (user_id) REFERENCES "user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE order_dishes ADD CONSTRAINT FK_9BC2C3888D9F6D38 FOREIGN KEY (order_id) REFERENCES "order" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE order_dishes ADD CONSTRAINT FK_9BC2C388A05DD37A FOREIGN KEY (dishes_id) REFERENCES dishes (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE reservation_user ADD CONSTRAINT FK_9BAA1B21B83297E7 FOREIGN KEY (reservation_id) REFERENCES reservation (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE reservation_user ADD CONSTRAINT FK_9BAA1B21A76ED395 FOREIGN KEY (user_id) REFERENCES "user" (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('CREATE SEQUENCE eat_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('ALTER TABLE customer_table DROP CONSTRAINT FK_381CFA7D9395C3F3');
$this->addSql('ALTER TABLE customer_table DROP CONSTRAINT FK_381CFA7DECFF285C');
$this->addSql('ALTER TABLE discount DROP CONSTRAINT FK_E1E0B40E20686F5D');
$this->addSql('ALTER TABLE "order" DROP CONSTRAINT FK_F52993988D09BBCB');
$this->addSql('ALTER TABLE "order" DROP CONSTRAINT FK_F5299398F91B0968');
$this->addSql('ALTER TABLE order_user DROP CONSTRAINT FK_C062EC5E8D9F6D38');
$this->addSql('ALTER TABLE order_user DROP CONSTRAINT FK_C062EC5EA76ED395');
$this->addSql('ALTER TABLE order_dishes DROP CONSTRAINT FK_9BC2C3888D9F6D38');
$this->addSql('ALTER TABLE order_dishes DROP CONSTRAINT FK_9BC2C388A05DD37A');
$this->addSql('ALTER TABLE reservation_user DROP CONSTRAINT FK_9BAA1B21B83297E7');
$this->addSql('ALTER TABLE reservation_user DROP CONSTRAINT FK_9BAA1B21A76ED395');
$this->addSql('DROP TABLE customer');
$this->addSql('DROP TABLE customer_table');
$this->addSql('DROP TABLE discount');
$this->addSql('DROP TABLE dishes');
$this->addSql('DROP TABLE "order"');
$this->addSql('DROP TABLE order_user');
$this->addSql('DROP TABLE order_dishes');
$this->addSql('DROP TABLE order_detail');
$this->addSql('DROP TABLE reservation');
$this->addSql('DROP TABLE reservation_user');
$this->addSql('DROP TABLE status_order');
$this->addSql('DROP TABLE status_table');
$this->addSql('DROP TABLE "table"');
$this->addSql('DROP TABLE "user"');
$this->addSql('DROP TABLE messenger_messages');
}
}

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,119 @@
/* Global styles */
body {
font-family: 'Arial', sans-serif;
background-color: #f9f9f9;
color: #333;
margin: 0;
padding: 20px;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
}
/* Page container */
.page-container {
width: 100%;
max-width: 600px;
margin: 20px auto;
padding: 20px;
background-color: #fff;
border-radius: 10px;
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
border: 2px solid #db5559;
}
/* Title */
.page-title {
text-align: center;
font-size: 28px;
color: #db5559;
margin-bottom: 20px;
font-weight: bold;
text-transform: uppercase;
letter-spacing: 1px;
}
/* Form styles */
form {
display: flex;
flex-direction: column;
gap: 15px;
}
.form-group {
display: flex;
flex-direction: column;
}
label {
font-weight: bold;
color: #db5559;
margin-bottom: 5px;
}
input[type="text"],
input[type="email"],
input[type="number"],
textarea,
select {
padding: 10px;
border: 1px solid #ddd;
border-radius: 5px;
font-size: 14px;
color: #333;
transition: border-color 0.3s ease-in-out;
}
input[type="text"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
border-color: #db5559;
outline: none;
}
/* Submit and Delete buttons */
button {
background-color: #db5559;
color: white;
font-weight: bold;
padding: 12px 20px;
border: none;
border-radius: 5px;
font-size: 16px;
cursor: pointer;
text-transform: uppercase;
transition: background-color 0.3s ease-in-out;
}
button:hover {
background-color: #bf494d;
}
.delete-button {
background-color: #d9534f;
margin-top: 10px;
}
.delete-button:hover {
background-color: #c9302c;
}
/* Back to list link */
.actions {
text-align: center;
margin-top: 15px;
}
.actions a {
text-decoration: none;
color: #db5559;
font-weight: bold;
transition: color 0.3s ease-in-out;
}
.actions a:hover {
color: #a02326;
}

View File

@ -0,0 +1,77 @@
/* Global styles */
body {
font-family: Arial, sans-serif;
margin: 20px;
background-color: #f9f9f9;
color: #333;
}
h1 {
text-align: center;
color: #db5559;
margin-bottom: 20px;
}
/* Table styles */
.table {
width: 100%;
border-collapse: collapse;
margin-bottom: 20px;
background-color: #fff;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
.table th, .table td {
padding: 12px;
text-align: left;
border: 1px solid #ddd;
}
.table th {
background-color: #db5559;
color: white;
}
.table tr:nth-child(even) {
background-color: #f2f2f2;
}
.table tr:hover {
background-color: #ddd;
}
/* Action links */
a {
text-decoration: none;
color: #db5559;
font-weight: bold;
}
a:hover {
color: #38538e;
text-decoration: underline;
}
/* New client button */
a[href*="app_clients_new"] {
display: inline-block;
margin-top: 20px;
padding: 10px 20px;
background-color: #4CAF50;
color: white;
border-radius: 5px;
font-size: 16px;
text-align: center;
transition: background-color 0.3s ease;
}
a[href*="app_clients_new"]:hover {
background-color: #388E3C;
}
/* Empty table row message */
.table td[colspan="6"] {
text-align: center;
font-style: italic;
color: #666;
}

View File

@ -0,0 +1,125 @@
/* Global styles */
body {
font-family: 'Arial', sans-serif;
background-color: #fff5f5;
color: #333;
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
align-items: center;
min-height: 100vh;
}
/* Page container */
.page-container {
width: 100%;
max-width: 600px;
margin: 20px auto;
padding: 20px;
background-color: #fff;
border-radius: 10px;
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
border: 2px solid #ff4d4d;
}
/* Title */
.page-title {
text-align: center;
font-size: 28px;
color: #ff4d4d;
margin-bottom: 20px;
font-weight: bold;
text-transform: uppercase;
letter-spacing: 1px;
}
/* Form styles */
form {
display: flex;
flex-direction: column;
gap: 15px;
}
.form-group {
display: flex;
flex-direction: column;
}
label {
font-weight: bold;
color: #ff4d4d;
margin-bottom: 5px;
}
input[type="text"],
input[type="email"],
input[type="number"],
textarea,
select {
padding: 10px;
border: 1px solid #ccc;
border-radius: 5px;
font-size: 14px;
color: #333;
transition: border-color 0.3s ease-in-out;
}
input[type="text"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
border-color: #ff4d4d;
outline: none;
}
/* Submit button */
button {
background-color: #ff4d4d;
color: white;
font-weight: bold;
padding: 12px 20px;
border: none;
border-radius: 5px;
font-size: 16px;
cursor: pointer;
text-transform: uppercase;
transition: background-color 0.3s ease-in-out;
}
button:hover {
background-color: #e60000;
}
/* Links */
.actions {
text-align: center;
margin-top: 15px;
}
.actions a {
text-decoration: none;
color: #ff4d4d;
font-weight: bold;
transition: color 0.3s ease-in-out;
}
.actions a:hover {
color: #e60000;
}
/* Error messages */
.error-message {
color: #d9534f;
font-size: 14px;
margin-top: 5px;
font-style: italic;
}
/* Empty space below */
body::after {
content: '';
height: 20px;
display: block;
}

View File

@ -0,0 +1,65 @@
#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;
}
body {
width: 100%;
height: 100%;
}
/* 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: right;
width: 65%;
word-wrap: break-word; /* Gère les débordements */
}
.btn-update {
margin-top: 1%;
}
/* 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%;
}
}

152
public/css/Index.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;
}

38
public/js/modal.js Normal file
View File

@ -0,0 +1,38 @@
document.addEventListener('DOMContentLoaded', function() {
// Fonction pour ouvrir la modal
function openModal(modalId) {
const modal = document.getElementById(modalId);
if (modal) {
modal.style.display = "block";
}
}
// Fonction pour fermer la modal
function closeModal(modalId) {
const modal = document.getElementById(modalId);
if (modal) {
modal.style.display = "none";
}
}
// Ouvre les modals lorsqu'un bouton est cliqué
document.body.addEventListener('click', function(event) {
if (event.target.matches('span[data-modal]')) {
const modalId = event.target.getAttribute('data-modal');
openModal(modalId);
}
// Ferme la modal lorsqu'on clique sur le bouton de fermeture
if (event.target.matches('.close[data-modal]')) {
const modalId = event.target.getAttribute('data-modal');
closeModal(modalId);
}
// Ferme la modal lorsqu'on clique en dehors du contenu
document.querySelectorAll('.modal').forEach(modal => {
if (event.target === modal) {
modal.style.display = "none";
}
});
});
});

View File

@ -0,0 +1,74 @@
<?php
namespace App\Controller;
use App\Entity\Clients;
use App\Form\ClientsType;
use App\Repository\ClientsRepository;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
#[Route('/clients')]
final class ClientsController extends AbstractController
{
#[Route(name: 'app_clients_index', methods: ['GET'])]
public function index(ClientsRepository $clientsRepository): Response
{
return $this->render('clients/index.html.twig', [
'clients' => $clientsRepository->findAll(),
]);
}
#[Route('/new', name: 'app_clients_new', methods: ['GET', 'POST'])]
public function new(Request $request, EntityManagerInterface $entityManager): Response
{
$client = new Clients();
$form = $this->createForm(ClientsType::class, $client);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$entityManager->persist($client);
$entityManager->flush();
return $this->redirectToRoute('app_clients_index', [], Response::HTTP_SEE_OTHER);
}
return $this->render('clients/new.html.twig', [
'client' => $client,
'form' => $form,
]);
}
#[Route('/{id}/edit', name: 'app_clients_edit', methods: ['GET', 'POST'])]
public function edit(Request $request, Clients $client, EntityManagerInterface $entityManager): Response
{
$form = $this->createForm(ClientsType::class, $client);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$entityManager->flush();
return $this->redirectToRoute('app_clients_index', [], Response::HTTP_SEE_OTHER);
}
return $this->render('clients/edit.html.twig', [
'client' => $client,
'form' => $form,
]);
}
#[Route('/{id}', name: 'app_clients_delete', methods: ['POST'])]
public function delete(Request $request, Clients $client, EntityManagerInterface $entityManager): Response
{
if ($this->isCsrfTokenValid('delete'.$client->getId(), $request->getPayload()->getString('_token'))) {
$entityManager->remove($client);
$entityManager->flush();
}
return $this->redirectToRoute('app_clients_index', [], Response::HTTP_SEE_OTHER);
}
}

View File

@ -0,0 +1,81 @@
<?php
namespace App\Controller;
use App\Entity\Commandes;
use App\Form\CommandesType;
use App\Repository\CommandesRepository;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
#[Route('/commandes')]
final class CommandesController extends AbstractController
{
#[Route(name: 'app_commandes_index', methods: ['GET'])]
public function index(CommandesRepository $commandesRepository): Response
{
return $this->render('commandes/index.html.twig', [
'commandes' => $commandesRepository->findAll(),
]);
}
#[Route('/new', name: 'app_commandes_new', methods: ['GET', 'POST'])]
public function new(Request $request, EntityManagerInterface $entityManager): Response
{
$commande = new Commandes();
$form = $this->createForm(CommandesType::class, $commande);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$entityManager->persist($commande);
$entityManager->flush();
return $this->redirectToRoute('app_commandes_index', [], Response::HTTP_SEE_OTHER);
}
return $this->render('commandes/new.html.twig', [
'commande' => $commande,
'form' => $form,
]);
}
#[Route('/{id}', name: 'app_commandes_show', methods: ['GET'])]
public function show(Commandes $commande): Response
{
return $this->render('commandes/show.html.twig', [
'commande' => $commande,
]);
}
#[Route('/{id}/edit', name: 'app_commandes_edit', methods: ['GET', 'POST'])]
public function edit(Request $request, Commandes $commande, EntityManagerInterface $entityManager): Response
{
$form = $this->createForm(CommandesType::class, $commande);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$entityManager->flush();
return $this->redirectToRoute('app_commandes_index', [], Response::HTTP_SEE_OTHER);
}
return $this->render('commandes/edit.html.twig', [
'commande' => $commande,
'form' => $form,
]);
}
#[Route('/{id}', name: 'app_commandes_delete', methods: ['POST'])]
public function delete(Request $request, Commandes $commande, EntityManagerInterface $entityManager): Response
{
if ($this->isCsrfTokenValid('delete'.$commande->getId(), $request->getPayload()->getString('_token'))) {
$entityManager->remove($commande);
$entityManager->flush();
}
return $this->redirectToRoute('app_commandes_index', [], Response::HTTP_SEE_OTHER);
}
}

View File

@ -0,0 +1,74 @@
<?php
namespace App\Controller;
use App\Entity\DetailsCommande;
use App\Form\DetailsCommandeType;
use App\Repository\DetailsCommandeRepository;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
#[Route('/details/commande')]
final class DetailsCommandeController extends AbstractController
{
#[Route(name: 'app_details_commande_index', methods: ['GET'])]
public function index(DetailsCommandeRepository $detailsCommandeRepository): Response
{
return $this->render('details_commande/index.html.twig', [
'details_commandes' => $detailsCommandeRepository->findAll(),
]);
}
#[Route('/new', name: 'app_details_commande_new', methods: ['GET', 'POST'])]
public function new(Request $request, EntityManagerInterface $entityManager): Response
{
$detailsCommande = new DetailsCommande();
$form = $this->createForm(DetailsCommandeType::class, $detailsCommande);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$entityManager->persist($detailsCommande);
$entityManager->flush();
return $this->redirectToRoute('app_details_commande_index', [], Response::HTTP_SEE_OTHER);
}
return $this->render('details_commande/new.html.twig', [
'details_commande' => $detailsCommande,
'form' => $form,
]);
}
#[Route('/{id}/edit', name: 'app_details_commande_edit', methods: ['GET', 'POST'])]
public function edit(Request $request, DetailsCommande $detailsCommande, EntityManagerInterface $entityManager): Response
{
$form = $this->createForm(DetailsCommandeType::class, $detailsCommande);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$entityManager->flush();
return $this->redirectToRoute('app_details_commande_index', [], Response::HTTP_SEE_OTHER);
}
return $this->render('details_commande/edit.html.twig', [
'details_commande' => $detailsCommande,
'form' => $form,
]);
}
#[Route('/{id}', name: 'app_details_commande_delete', methods: ['POST'])]
public function delete(Request $request, DetailsCommande $detailsCommande, EntityManagerInterface $entityManager): Response
{
if ($this->isCsrfTokenValid('delete'.$detailsCommande->getId(), $request->getPayload()->getString('_token'))) {
$entityManager->remove($detailsCommande);
$entityManager->flush();
}
return $this->redirectToRoute('app_details_commande_index', [], Response::HTTP_SEE_OTHER);
}
}

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/index.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,75 @@
<?php
namespace App\Controller;
use App\Entity\Plats;
use App\Form\PlatsType;
use App\Repository\PlatsRepository;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
#[Route('/plats')]
final class PlatsController extends AbstractController
{
#[Route(name: 'app_plats_index', methods: ['GET'])]
public function index(PlatsRepository $platsRepository): Response
{
return $this->render('plats/index.html.twig', [
'plats' => $platsRepository->findAll(),
]);
}
#[Route('/new', name: 'app_plats_new', methods: ['GET', 'POST'])]
public function new(Request $request, EntityManagerInterface $entityManager): Response
{
$plat = new Plats();
$form = $this->createForm(PlatsType::class, $plat);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$entityManager->persist($plat);
$entityManager->flush();
return $this->redirectToRoute('app_plats_index', [], Response::HTTP_SEE_OTHER);
}
return $this->render('plats/new.html.twig', [
'plat' => $plat,
'form' => $form,
]);
}
#[Route('/{id}/edit', name: 'app_plats_edit', methods: ['GET', 'POST'])]
public function edit(Request $request, Plats $plat, EntityManagerInterface $entityManager): Response
{
$form = $this->createForm(PlatsType::class, $plat);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$entityManager->flush();
return $this->redirectToRoute('app_plats_index', [], Response::HTTP_SEE_OTHER);
}
return $this->render('plats/edit.html.twig', [
'plat' => $plat,
'form' => $form,
]);
}
#[Route('/{id}', name: 'app_plats_delete', methods: ['POST'])]
public function delete(Request $request, Plats $plat, EntityManagerInterface $entityManager): Response
{
if ($this->isCsrfTokenValid('delete'.$plat->getId(), $request->getPayload()->getString('_token'))) {
$entityManager->remove($plat);
$entityManager->flush();
}
return $this->redirectToRoute('app_plats_index', [], Response::HTTP_SEE_OTHER);
}
}

View File

@ -0,0 +1,74 @@
<?php
namespace App\Controller;
use App\Entity\Reductions;
use App\Form\ReductionsType;
use App\Repository\ReductionsRepository;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
#[Route('/reductions')]
final class ReductionsController extends AbstractController
{
#[Route(name: 'app_reductions_index', methods: ['GET'])]
public function index(ReductionsRepository $reductionsRepository): Response
{
return $this->render('reductions/index.html.twig', [
'reductions' => $reductionsRepository->findAll(),
]);
}
#[Route('/new', name: 'app_reductions_new', methods: ['GET', 'POST'])]
public function new(Request $request, EntityManagerInterface $entityManager): Response
{
$reduction = new Reductions();
$form = $this->createForm(ReductionsType::class, $reduction);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$entityManager->persist($reduction);
$entityManager->flush();
return $this->redirectToRoute('app_reductions_index', [], Response::HTTP_SEE_OTHER);
}
return $this->render('reductions/new.html.twig', [
'reduction' => $reduction,
'form' => $form,
]);
}
#[Route('/{id}/edit', name: 'app_reductions_edit', methods: ['GET', 'POST'])]
public function edit(Request $request, Reductions $reduction, EntityManagerInterface $entityManager): Response
{
$form = $this->createForm(ReductionsType::class, $reduction);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$entityManager->flush();
return $this->redirectToRoute('app_reductions_index', [], Response::HTTP_SEE_OTHER);
}
return $this->render('reductions/edit.html.twig', [
'reduction' => $reduction,
'form' => $form,
]);
}
#[Route('/{id}', name: 'app_reductions_delete', methods: ['POST'])]
public function delete(Request $request, Reductions $reduction, EntityManagerInterface $entityManager): Response
{
if ($this->isCsrfTokenValid('delete'.$reduction->getId(), $request->getPayload()->getString('_token'))) {
$entityManager->remove($reduction);
$entityManager->flush();
}
return $this->redirectToRoute('app_reductions_index', [], Response::HTTP_SEE_OTHER);
}
}

View File

@ -0,0 +1,74 @@
<?php
namespace App\Controller;
use App\Entity\Reservations;
use App\Form\ReservationsType;
use App\Repository\ReservationsRepository;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
#[Route('/reservations')]
final class ReservationsController extends AbstractController
{
#[Route(name: 'app_reservations_index', methods: ['GET'])]
public function index(ReservationsRepository $reservationsRepository): Response
{
return $this->render('reservations/index.html.twig', [
'reservations' => $reservationsRepository->findAll(),
]);
}
#[Route('/new', name: 'app_reservations_new', methods: ['GET', 'POST'])]
public function new(Request $request, EntityManagerInterface $entityManager): Response
{
$reservation = new Reservations();
$form = $this->createForm(ReservationsType::class, $reservation);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$entityManager->persist($reservation);
$entityManager->flush();
return $this->redirectToRoute('app_reservations_index', [], Response::HTTP_SEE_OTHER);
}
return $this->render('reservations/new.html.twig', [
'reservation' => $reservation,
'form' => $form,
]);
}
#[Route('/{id}/edit', name: 'app_reservations_edit', methods: ['GET', 'POST'])]
public function edit(Request $request, Reservations $reservation, EntityManagerInterface $entityManager): Response
{
$form = $this->createForm(ReservationsType::class, $reservation);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$entityManager->flush();
return $this->redirectToRoute('app_reservations_index', [], Response::HTTP_SEE_OTHER);
}
return $this->render('reservations/edit.html.twig', [
'reservation' => $reservation,
'form' => $form,
]);
}
#[Route('/{id}', name: 'app_reservations_delete', methods: ['POST'])]
public function delete(Request $request, Reservations $reservation, EntityManagerInterface $entityManager): Response
{
if ($this->isCsrfTokenValid('delete'.$reservation->getId(), $request->getPayload()->getString('_token'))) {
$entityManager->remove($reservation);
$entityManager->flush();
}
return $this->redirectToRoute('app_reservations_index', [], Response::HTTP_SEE_OTHER);
}
}

View File

@ -0,0 +1,74 @@
<?php
namespace App\Controller;
use App\Entity\StatutCommandes;
use App\Form\StatutCommandesType;
use App\Repository\StatutCommandesRepository;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
#[Route('/statut/commandes')]
final class StatutCommandesController extends AbstractController
{
#[Route(name: 'app_statut_commandes_index', methods: ['GET'])]
public function index(StatutCommandesRepository $statutCommandesRepository): Response
{
return $this->render('statut_commandes/index.html.twig', [
'statut_commandes' => $statutCommandesRepository->findAll(),
]);
}
#[Route('/new', name: 'app_statut_commandes_new', methods: ['GET', 'POST'])]
public function new(Request $request, EntityManagerInterface $entityManager): Response
{
$statutCommande = new StatutCommandes();
$form = $this->createForm(StatutCommandesType::class, $statutCommande);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$entityManager->persist($statutCommande);
$entityManager->flush();
return $this->redirectToRoute('app_statut_commandes_index', [], Response::HTTP_SEE_OTHER);
}
return $this->render('statut_commandes/new.html.twig', [
'statut_commande' => $statutCommande,
'form' => $form,
]);
}
#[Route('/{id}/edit', name: 'app_statut_commandes_edit', methods: ['GET', 'POST'])]
public function edit(Request $request, StatutCommandes $statutCommande, EntityManagerInterface $entityManager): Response
{
$form = $this->createForm(StatutCommandesType::class, $statutCommande);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$entityManager->flush();
return $this->redirectToRoute('app_statut_commandes_index', [], Response::HTTP_SEE_OTHER);
}
return $this->render('statut_commandes/edit.html.twig', [
'statut_commande' => $statutCommande,
'form' => $form,
]);
}
#[Route('/{id}', name: 'app_statut_commandes_delete', methods: ['POST'])]
public function delete(Request $request, StatutCommandes $statutCommande, EntityManagerInterface $entityManager): Response
{
if ($this->isCsrfTokenValid('delete'.$statutCommande->getId(), $request->getPayload()->getString('_token'))) {
$entityManager->remove($statutCommande);
$entityManager->flush();
}
return $this->redirectToRoute('app_statut_commandes_index', [], Response::HTTP_SEE_OTHER);
}
}

View File

@ -0,0 +1,74 @@
<?php
namespace App\Controller;
use App\Entity\StatutTables;
use App\Form\StatutTablesType;
use App\Repository\StatutTablesRepository;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
#[Route('/statut/tables')]
final class StatutTablesController extends AbstractController
{
#[Route(name: 'app_statut_tables_index', methods: ['GET'])]
public function index(StatutTablesRepository $statutTablesRepository): Response
{
return $this->render('statut_tables/index.html.twig', [
'statut_tables' => $statutTablesRepository->findAll(),
]);
}
#[Route('/new', name: 'app_statut_tables_new', methods: ['GET', 'POST'])]
public function new(Request $request, EntityManagerInterface $entityManager): Response
{
$statutTable = new StatutTables();
$form = $this->createForm(StatutTablesType::class, $statutTable);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$entityManager->persist($statutTable);
$entityManager->flush();
return $this->redirectToRoute('app_statut_tables_index', [], Response::HTTP_SEE_OTHER);
}
return $this->render('statut_tables/new.html.twig', [
'statut_table' => $statutTable,
'form' => $form,
]);
}
#[Route('/{id}/edit', name: 'app_statut_tables_edit', methods: ['GET', 'POST'])]
public function edit(Request $request, StatutTables $statutTable, EntityManagerInterface $entityManager): Response
{
$form = $this->createForm(StatutTablesType::class, $statutTable);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$entityManager->flush();
return $this->redirectToRoute('app_statut_tables_index', [], Response::HTTP_SEE_OTHER);
}
return $this->render('statut_tables/edit.html.twig', [
'statut_table' => $statutTable,
'form' => $form,
]);
}
#[Route('/{id}', name: 'app_statut_tables_delete', methods: ['POST'])]
public function delete(Request $request, StatutTables $statutTable, EntityManagerInterface $entityManager): Response
{
if ($this->isCsrfTokenValid('delete'.$statutTable->getId(), $request->getPayload()->getString('_token'))) {
$entityManager->remove($statutTable);
$entityManager->flush();
}
return $this->redirectToRoute('app_statut_tables_index', [], Response::HTTP_SEE_OTHER);
}
}

View File

@ -0,0 +1,75 @@
<?php
namespace App\Controller;
use App\Entity\Tables;
use App\Form\TablesType;
use App\Repository\TablesRepository;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
#[Route('/tables')]
final class TablesController extends AbstractController
{
#[Route(name: 'app_tables_index', methods: ['GET'])]
public function index(TablesRepository $tablesRepository): Response
{
return $this->render('tables/index.html.twig', [
'tables' => $tablesRepository->findAll(),
]);
}
#[Route('/new', name: 'app_tables_new', methods: ['GET', 'POST'])]
public function new(Request $request, EntityManagerInterface $entityManager): Response
{
$table = new Tables();
$form = $this->createForm(TablesType::class, $table);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$entityManager->persist($table);
$entityManager->flush();
return $this->redirectToRoute('app_tables_index', [], Response::HTTP_SEE_OTHER);
}
return $this->render('tables/new.html.twig', [
'table' => $table,
'form' => $form,
]);
}
#[Route('/{id}/edit', name: 'app_tables_edit', methods: ['GET', 'POST'])]
public function edit(Request $request, Tables $table, EntityManagerInterface $entityManager): Response
{
$form = $this->createForm(TablesType::class, $table);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$entityManager->flush();
return $this->redirectToRoute('app_tables_index', [], Response::HTTP_SEE_OTHER);
}
return $this->render('tables/edit.html.twig', [
'table' => $table,
'form' => $form,
]);
}
#[Route('/{id}', name: 'app_tables_delete', methods: ['POST'])]
public function delete(Request $request, Tables $table, EntityManagerInterface $entityManager): Response
{
if ($this->isCsrfTokenValid('delete'.$table->getId(), $request->getPayload()->getString('_token'))) {
$entityManager->remove($table);
$entityManager->flush();
}
return $this->redirectToRoute('app_tables_index', [], Response::HTTP_SEE_OTHER);
}
}

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');
}
}

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

@ -0,0 +1,152 @@
<?php
namespace App\Entity;
use AllowDynamicProperties;
use App\Repository\ClientsRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[AllowDynamicProperties] #[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, mappedBy: 'Clients')]
public Collection $tables;
/**
* @var Collection<int, Commandes>
*/
#[ORM\ManyToMany(targetEntity: Commandes::class, mappedBy: 'Client')]
private Collection $commandes;
public function __construct()
{
$this->tables = 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 getTables(): Collection
{
return $this->tables;
}
public function addTable(Tables $tables): static
{
if (!$this->tables->contains($tables)) {
$this->tables->add($tables);
}
return $this;
}
public function removeTable(Tables $tables): static
{
$this->tables->removeElement($tables);
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 $tables = 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 getTables(): ?Tables
{
return $this->tables;
}
public function setTable(?Tables $tables): static
{
$this->tables = $tables;
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 $tables = 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 getTables(): ?Tables
{
return $this->tables;
}
public function setTable(?Tables $tables): static
{
$this->tables = $tables;
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, inversedBy: 'tables')]
private Collection $Clients;
/**
* @var Collection<int, Reservations>
*/
#[ORM\OneToMany(targetEntity: Reservations::class, mappedBy: 'tables')]
private Collection $reservations;
/**
* @var Collection<int, StatutTables>
*/
#[ORM\OneToMany(targetEntity: StatutTables::class, mappedBy: 'tables')]
private Collection $statutTables;
/**
* @var Collection<int, Utilisateurs>
*/
#[ORM\ManyToMany(targetEntity: Utilisateurs::class, mappedBy: 'tables')]
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 getClients(): 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->getTables() === $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->getTables() === $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 $tables;
public function __construct()
{
$this->Reservation = new ArrayCollection();
$this->tables = 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 getTables(): Collection
{
return $this->tables;
}
public function addTable(Tables $tables): static
{
if (!$this->tables->contains($tables)) {
$this->tables->add($tables);
}
return $this;
}
public function removeTable(Tables $tables): static
{
$this->tables->removeElement($tables);
return $this;
}
}

View File

@ -0,0 +1,59 @@
<?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',
],
'expanded' => true,
'multiple' => true,
])
->add('Enregistrer', SubmitType::class);
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Utilisateurs::class,
]);
}
}

41
src/Form/ClientsType.php Normal file
View File

@ -0,0 +1,41 @@
<?php
namespace App\Form;
use App\Entity\Clients;
use App\Entity\Commandes;
use App\Entity\Tables;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class ClientsType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('Prenom')
->add('Nom')
->add('Email')
->add('Telephone')
->add('Tables', EntityType::class, [
'class' => Tables::class,
'choice_label' => 'id',
'multiple' => true,
])
->add('Commandes', EntityType::class, [
'class' => Commandes::class,
'choice_label' => 'id',
'multiple' => true,
])
;
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Clients::class,
]);
}
}

View File

@ -0,0 +1,47 @@
<?php
namespace App\Form;
use App\Entity\Clients;
use App\Entity\Commandes;
use App\Entity\Plats;
use App\Entity\StatutCommandes;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class CommandesType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('DateHeure', null, [
'widget' => 'single_text',
])
->add('Statut')
->add('Total')
->add('Client', EntityType::class, [
'class' => Clients::class,
'choice_label' => 'id',
'multiple' => true,
])
->add('plats', EntityType::class, [
'class' => Plats::class,
'choice_label' => 'id',
'multiple' => true,
])
->add('StatutCommande', EntityType::class, [
'class' => StatutCommandes::class,
'choice_label' => 'id',
])
;
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Commandes::class,
]);
}
}

View File

@ -0,0 +1,32 @@
<?php
namespace App\Form;
use App\Entity\Commandes;
use App\Entity\DetailsCommande;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class DetailsCommandeType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('Quantite')
->add('PrixUnitaire')
->add('Commande', EntityType::class, [
'class' => Commandes::class,
'choice_label' => 'id',
])
;
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => DetailsCommande::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
]);
}
}

43
src/Form/PlatsType.php Normal file
View File

@ -0,0 +1,43 @@
<?php
namespace App\Form;
use App\Entity\Commandes;
use App\Entity\Plats;
use App\Entity\Reductions;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class PlatsType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('Nom')
->add('Description')
->add('Prix')
->add('Categorie')
->add('Statut')
->add('Nb_de_commande')
->add('Commande', EntityType::class, [
'class' => Commandes::class,
'choice_label' => 'id',
'multiple' => true,
'expanded' => true,
])
->add('Reduction', EntityType::class, [
'class' => Reductions::class,
'choice_label' => 'description',
])
;
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Plats::class,
]);
}
}

View File

@ -0,0 +1,34 @@
<?php
namespace App\Form;
use App\Entity\Reductions;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class ReductionsType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('Description')
->add('Prix')
->add('Pourcentage')
->add('MontantFixe')
->add('DateDebut', null, [
'widget' => 'single_text',
])
->add('DateFin', null, [
'widget' => 'single_text',
])
;
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Reductions::class,
]);
}
}

View File

@ -0,0 +1,40 @@
<?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\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class ReservationsType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('DateHeure', null, [
'widget' => 'single_text',
])
->add('Nb_de_prsn')
->add('tables', EntityType::class, [
'class' => Tables::class,
'choice_label' => 'id',
])
->add('utilisateurs', EntityType::class, [
'class' => Utilisateurs::class,
'choice_label' => 'id',
'multiple' => true,
])
;
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Reservations::class,
]);
}
}

View File

@ -0,0 +1,25 @@
<?php
namespace App\Form;
use App\Entity\StatutCommandes;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class StatutCommandesType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('Libelle')
;
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => StatutCommandes::class,
]);
}
}

View File

@ -0,0 +1,31 @@
<?php
namespace App\Form;
use App\Entity\StatutTables;
use App\Entity\Tables;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class StatutTablesType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('Libellé')
->add('tables', EntityType::class, [
'class' => Tables::class,
'choice_label' => 'id',
])
;
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => StatutTables::class,
]);
}
}

37
src/Form/TablesType.php Normal file
View File

@ -0,0 +1,37 @@
<?php
namespace App\Form;
use App\Entity\Clients;
use App\Entity\Tables;
use App\Entity\Utilisateurs;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class TablesType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('Clients', EntityType::class, [
'class' => Clients::class,
'choice_label' => 'id',
'multiple' => true,
])
->add('utilisateurs', EntityType::class, [
'class' => Utilisateurs::class,
'choice_label' => 'id',
'multiple' => true,
])
;
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Tables::class,
]);
}
}

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" "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": { "symfony/ux-turbo": {
"version": "v2.20.0" "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,8 @@
<div id="tableModal" class="modal">
<div class="modal-content">
<span class="close" data-modal="tableModal">&times;</span>
<h2>Gestion Table</h2>
<!-- Contenu de la modal Gestion Table -->
<p>Ajouter ici le formulaire ou les informations pour gérer les tables.</p>
</div>
</div>

View File

@ -0,0 +1,8 @@
<div id="userModal" class="modal">
<div class="modal-content">
<span class="close" data-modal="userModal">&times;</span>
<h2>Gestion Utilisateur</h2>
<!-- Contenu de la modal Gestion Utilisateur -->
<p>Ajouter ici le formulaire ou les informations pour gérer les utilisateurs.</p>
</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">Ce connecter</a>
</div>
{% endblock %}

View File

@ -3,7 +3,13 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>{% block title %}Welcome!{% endblock %}</title> <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 %} {% block stylesheets %}
{% endblock %} {% endblock %}
@ -13,5 +19,8 @@
</head> </head>
<body> <body>
{% block body %}{% endblock %} {% 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> </body>
</html> </html>

View File

@ -0,0 +1,4 @@
<form method="post" action="{{ path('app_clients_delete', {'id': client.id}) }}" onsubmit="return confirm('Are you sure you want to delete this item?');">
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ client.id) }}">
<button class="btn">Delete</button>
</form>

View File

@ -0,0 +1,4 @@
{{ form_start(form) }}
{{ form_widget(form) }}
<button class="btn">{{ button_label|default('Save') }}</button>
{{ form_end(form) }}

View File

@ -0,0 +1,21 @@
{% extends 'base.html.twig' %}
{% block title %}Edit Client{% endblock %}
{% block stylesheets %}
<link rel="stylesheet" href="{{ asset('css/ControllerVues/edit.css') }}">
{% endblock %}
{% block body %}
<div class="page-container">
<h1 class="page-title">Edit Client</h1>
{{ include('clients/_form.html.twig', {'button_label': 'Update'}) }}
<div class="actions">
<a href="{{ path('app_clients_index') }}">Back to list</a>
</div>
{{ include('clients/_delete_form.html.twig') }}
</div>
{% endblock %}

View File

@ -0,0 +1,43 @@
{% extends 'base.html.twig' %}
{% block title %}Clients index{% endblock %}
{% block stylesheets %}
<link rel="stylesheet" href="{{ asset('css/ControllerVues/list.css') }}"> <!-- Ajout du fichier CSS -->
{% endblock %}
{% block body %}
<h1>Clients index</h1>
<table class="table">
<thead>
<tr>
<th>Id</th>
<th>Prenom</th>
<th>Nom</th>
<th>Email</th>
<th>Telephone</th>
<th>actions</th>
</tr>
</thead>
<tbody>
{% for client in clients %}
<tr>
<td>{{ client.id }}</td>
<td>{{ client.Prenom }}</td>
<td>{{ client.Nom }}</td>
<td>{{ client.Email }}</td>
<td>{{ client.Telephone }}</td>
<td>
<a href="{{ path('app_clients_edit', {'id': client.id}) }}">edit</a>
</td>
</tr>
{% else %}
<tr>
<td colspan="6">no records found</td>
</tr>
{% endfor %}
</tbody>
</table>
<a href="{{ path('app_clients_new') }}">Créer un nouveau client</a>
{% endblock %}

View File

@ -0,0 +1,14 @@
{% extends 'base.html.twig' %}
{% block title %}New Clients{% endblock %}
{% block stylesheets %}
<link rel="stylesheet" href="{{ asset('css/ControllerVues/new.css') }}"> <!-- Ajout du fichier CSS -->
{% endblock %}
{% block body %}
<h1>Create new Clients</h1>
{{ include('clients/_form.html.twig') }}
<a href="{{ path('app_clients_index') }}">back to list</a>
{% endblock %}

View File

@ -0,0 +1,38 @@
{% extends 'base.html.twig' %}
{% block title %}Clients{% endblock %}
{% block body %}
<h1>Clients</h1>
<table class="table">
<tbody>
<tr>
<th>Id</th>
<td>{{ client.id }}</td>
</tr>
<tr>
<th>Prenom</th>
<td>{{ client.Prenom }}</td>
</tr>
<tr>
<th>Nom</th>
<td>{{ client.Nom }}</td>
</tr>
<tr>
<th>Email</th>
<td>{{ client.Email }}</td>
</tr>
<tr>
<th>Telephone</th>
<td>{{ client.Telephone }}</td>
</tr>
</tbody>
</table>
<a href="{{ path('app_clients_index') }}">back to list</a>
<a href="{{ path('app_clients_edit', {'id': client.id}) }}">edit</a>
{{ include('clients/_delete_form.html.twig') }}
{% endblock %}

View File

@ -0,0 +1,4 @@
<form method="post" action="{{ path('app_commandes_delete', {'id': commande.id}) }}" onsubmit="return confirm('Are you sure you want to delete this item?');">
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ commande.id) }}">
<button class="btn">Delete</button>
</form>

View File

@ -0,0 +1,4 @@
{{ form_start(form) }}
{{ form_widget(form) }}
<button class="btn">{{ button_label|default('Save') }}</button>
{{ form_end(form) }}

View File

@ -0,0 +1,21 @@
{% extends 'base.html.twig' %}
{% block title %}Edit Commandes{% endblock %}
{% block stylesheets %}
<link rel="stylesheet" href="{{ asset('css/ControllerVues/edit.css') }}">
{% endblock %}
{% block body %}
<div class="page-container">
<h1 class="page-title">Edit Commandes</h1>
{{ include('commandes/_form.html.twig', {'button_label': 'Update'}) }}
<div class="actions">
<a href="{{ path('app_commandes_index') }}">Back to list</a>
</div>
{{ include('commandes/_delete_form.html.twig') }}
</div>
{% endblock %}

View File

@ -0,0 +1,46 @@
{% extends 'base.html.twig' %}
{% block title %}Commandes index{% endblock %}
{% block stylesheets %}
<link rel="stylesheet" href="{{ asset('css/ControllerVues/list.css') }}"> <!-- Ajout du fichier CSS -->
{% endblock %}
{% block body %}
<h1>Commandes index</h1>
<table class="table">
<thead>
<tr>
<th>Id</th>
<th>DateHeure</th>
<th>Statut</th>
<th>Total</th>
<th>actions</th>
</tr>
</thead>
<tbody>
{% for commande in commandes %}
<tr>
<td>{{ commande.id }}</td>
<td>{{ commande.DateHeure ? commande.DateHeure|date('Y-m-d H:i:s') : '' }}</td>
<td>{{ commande.Statut ? 'Yes' : 'No' }}</td>
<td>{{ commande.Total }}</td>
<td>
<form method="post" action="{{ path('app_commandes_delete', {'id': commande.id}) }}" onsubmit="return confirm('Are you sure you want to delete this item?');">
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ commande.id) }}">
<button class="btn">Delete</button>
</form>
<a href="{{ path('app_commandes_edit', {'id': commande.id}) }}">edit</a>
</td>
</tr>
{% else %}
<tr>
<td colspan="5">pas de commande crée</td>
</tr>
{% endfor %}
</tbody>
</table>
<a href="{{ path('app_commandes_new') }}">Créer une nouvelle commande</a>
{% endblock %}

View File

@ -0,0 +1,15 @@
{% extends 'base.html.twig' %}
{% block title %}New Commandes{% endblock %}
{% block stylesheets %}
<link rel="stylesheet" href="{{ asset('css/ControllerVues/new.css') }}"> <!-- Ajout du fichier CSS -->
{% endblock %}
{% block body %}
<h1>Create new Commandes</h1>
{{ include('commandes/_form.html.twig') }}
<a href="{{ path('app_commandes_index') }}">back to list</a>
{% endblock %}

View File

@ -0,0 +1,4 @@
<form method="post" action="{{ path('app_details_commande_delete', {'id': details_commande.id}) }}" onsubmit="return confirm('Are you sure you want to delete this item?');">
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ details_commande.id) }}">
<button class="btn">Delete</button>
</form>

View File

@ -0,0 +1,4 @@
{{ form_start(form) }}
{{ form_widget(form) }}
<button class="btn">{{ button_label|default('Save') }}</button>
{{ form_end(form) }}

View File

@ -0,0 +1,21 @@
{% extends 'base.html.twig' %}
{% block title %}Edit Détails Commande{% endblock %}
{% block stylesheets %}
<link rel="stylesheet" href="{{ asset('css/ControllerVues/edit.css') }}">
{% endblock %}
{% block body %}
<div class="page-container">
<h1 class="page-title">Edit Détails Commande</h1>
{{ include('details_commande/_form.html.twig', {'button_label': 'Update'}) }}
<div class="actions">
<a href="{{ path('app_details_commande_index') }}">Back to list</a>
</div>
{{ include('details_commande/_delete_form.html.twig') }}
</div>
{% endblock %}

View File

@ -0,0 +1,40 @@
{% extends 'base.html.twig' %}
{% block title %}DetailsCommande index{% endblock %}
{% block stylesheets %}
<link rel="stylesheet" href="{{ asset('css/ControllerVues/list.css') }}">
{% endblock %}
{% block body %}
<h1>DetailsCommande index</h1>
<table class="table">
<thead>
<tr>
<th>Id</th>
<th>Quantite</th>
<th>PrixUnitaire</th>
<th>actions</th>
</tr>
</thead>
<tbody>
{% for details_commande in details_commandes %}
<tr>
<td>{{ details_commande.id }}</td>
<td>{{ details_commande.Quantite }}</td>
<td>{{ details_commande.PrixUnitaire }}</td>
<td>
<a href="{{ path('app_details_commande_edit', {'id': details_commande.id}) }}">edit</a>
</td>
</tr>
{% else %}
<tr>
<td colspan="4">pas de détails de commande disponible</td>
</tr>
{% endfor %}
</tbody>
</table>
<a href="{{ path('app_details_commande_new') }}">Créer le détails d'une commande</a>
{% endblock %}

View File

@ -0,0 +1,15 @@
{% extends 'base.html.twig' %}
{% block title %}New DetailsCommande{% endblock %}
{% block stylesheets %}
<link rel="stylesheet" href="{{ asset('css/ControllerVues/new.css') }}"> <!-- Ajout du fichier CSS -->
{% endblock %}
{% block body %}
<h1>Create new DetailsCommande</h1>
{{ include('details_commande/_form.html.twig') }}
<a href="{{ path('app_details_commande_index') }}">back to list</a>
{% endblock %}

View File

@ -0,0 +1,30 @@
{% extends 'base.html.twig' %}
{% block title %}DetailsCommande{% endblock %}
<link rel="stylesheet" href="{{ asset('css/ControllerVues/list.css') }}"> <!-- Ajout du fichier CSS -->
{% block body %}
<h1>DetailsCommande</h1>
<table class="table">
<tbody>
<tr>
<th>Id</th>
<td>{{ details_commande.id }}</td>
</tr>
<tr>
<th>Quantite</th>
<td>{{ details_commande.Quantite }}</td>
</tr>
<tr>
<th>PrixUnitaire</th>
<td>{{ details_commande.PrixUnitaire }}</td>
</tr>
</tbody>
</table>
<a href="{{ path('app_details_commande_index') }}">back to list</a>
<a href="{{ path('app_details_commande_edit', {'id': details_commande.id}) }}">edit</a>
{{ include('details_commande/_delete_form.html.twig') }}
{% endblock %}

View File

@ -0,0 +1,34 @@
{% 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-update">
<button>Modifier</button>
</div>
</div>
</form>
{% endblock %}

Some files were not shown because too many files have changed in this diff Show More