diff --git a/migrations/Version20241114160014.php b/migrations/Version20241114160014.php new file mode 100644 index 0000000..c219157 --- /dev/null +++ b/migrations/Version20241114160014.php @@ -0,0 +1,52 @@ +addSql('ALTER TABLE reservations DROP CONSTRAINT fk_4da2394de1870d'); + $this->addSql('DROP INDEX idx_4da2394de1870d'); + $this->addSql('ALTER TABLE reservations RENAME COLUMN tabl_id TO table_id'); + $this->addSql('ALTER TABLE reservations ADD CONSTRAINT FK_4DA239ECFF285C FOREIGN KEY (table_id) REFERENCES tables (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('CREATE INDEX IDX_4DA239ECFF285C ON reservations (table_id)'); + $this->addSql('ALTER TABLE statut_tables DROP CONSTRAINT fk_33c8a3754de1870d'); + $this->addSql('DROP INDEX idx_33c8a3754de1870d'); + $this->addSql('ALTER TABLE statut_tables RENAME COLUMN tabl_id TO table_id'); + $this->addSql('ALTER TABLE statut_tables ADD CONSTRAINT FK_33C8A375ECFF285C FOREIGN KEY (table_id) REFERENCES tables (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('CREATE INDEX IDX_33C8A375ECFF285C ON statut_tables (table_id)'); + $this->addSql('CREATE UNIQUE INDEX UNIQ_497B315E5126AC48 ON utilisateurs (mail)'); + } + + 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 INDEX UNIQ_497B315E5126AC48'); + $this->addSql('ALTER TABLE statut_tables DROP CONSTRAINT FK_33C8A375ECFF285C'); + $this->addSql('DROP INDEX IDX_33C8A375ECFF285C'); + $this->addSql('ALTER TABLE statut_tables RENAME COLUMN table_id TO tabl_id'); + $this->addSql('ALTER TABLE statut_tables ADD CONSTRAINT fk_33c8a3754de1870d FOREIGN KEY (tabl_id) REFERENCES tables (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('CREATE INDEX idx_33c8a3754de1870d ON statut_tables (tabl_id)'); + $this->addSql('ALTER TABLE reservations DROP CONSTRAINT FK_4DA239ECFF285C'); + $this->addSql('DROP INDEX IDX_4DA239ECFF285C'); + $this->addSql('ALTER TABLE reservations RENAME COLUMN table_id TO tabl_id'); + $this->addSql('ALTER TABLE reservations ADD CONSTRAINT fk_4da2394de1870d FOREIGN KEY (tabl_id) REFERENCES tables (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('CREATE INDEX idx_4da2394de1870d ON reservations (tabl_id)'); + } +} diff --git a/migrations/Version20241114160729.php b/migrations/Version20241114160729.php new file mode 100644 index 0000000..8011f79 --- /dev/null +++ b/migrations/Version20241114160729.php @@ -0,0 +1,50 @@ +addSql('ALTER TABLE reservations DROP CONSTRAINT fk_4da239ecff285c'); + $this->addSql('DROP INDEX idx_4da239ecff285c'); + $this->addSql('ALTER TABLE reservations RENAME COLUMN table_id TO tables_id'); + $this->addSql('ALTER TABLE reservations ADD CONSTRAINT FK_4DA23985405FD2 FOREIGN KEY (tables_id) REFERENCES tables (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('CREATE INDEX IDX_4DA23985405FD2 ON reservations (tables_id)'); + $this->addSql('ALTER TABLE statut_tables DROP CONSTRAINT fk_33c8a375ecff285c'); + $this->addSql('DROP INDEX idx_33c8a375ecff285c'); + $this->addSql('ALTER TABLE statut_tables RENAME COLUMN table_id TO tables_id'); + $this->addSql('ALTER TABLE statut_tables ADD CONSTRAINT FK_33C8A37585405FD2 FOREIGN KEY (tables_id) REFERENCES tables (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('CREATE INDEX IDX_33C8A37585405FD2 ON statut_tables (tables_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_tables DROP CONSTRAINT FK_33C8A37585405FD2'); + $this->addSql('DROP INDEX IDX_33C8A37585405FD2'); + $this->addSql('ALTER TABLE statut_tables RENAME COLUMN tables_id TO table_id'); + $this->addSql('ALTER TABLE statut_tables ADD CONSTRAINT fk_33c8a375ecff285c FOREIGN KEY (table_id) REFERENCES tables (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('CREATE INDEX idx_33c8a375ecff285c ON statut_tables (table_id)'); + $this->addSql('ALTER TABLE reservations DROP CONSTRAINT FK_4DA23985405FD2'); + $this->addSql('DROP INDEX IDX_4DA23985405FD2'); + $this->addSql('ALTER TABLE reservations RENAME COLUMN tables_id TO table_id'); + $this->addSql('ALTER TABLE reservations ADD CONSTRAINT fk_4da239ecff285c FOREIGN KEY (table_id) REFERENCES tables (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('CREATE INDEX idx_4da239ecff285c ON reservations (table_id)'); + } +} diff --git a/migrations/Version20241114164216.php b/migrations/Version20241114164216.php new file mode 100644 index 0000000..65df11e --- /dev/null +++ b/migrations/Version20241114164216.php @@ -0,0 +1,46 @@ +addSql('CREATE TABLE tables_clients (tables_id INT NOT NULL, clients_id INT NOT NULL, PRIMARY KEY(tables_id, clients_id))'); + $this->addSql('CREATE INDEX IDX_80F8906E85405FD2 ON tables_clients (tables_id)'); + $this->addSql('CREATE INDEX IDX_80F8906EAB014612 ON tables_clients (clients_id)'); + $this->addSql('ALTER TABLE tables_clients ADD CONSTRAINT FK_80F8906E85405FD2 FOREIGN KEY (tables_id) REFERENCES tables (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE tables_clients ADD CONSTRAINT FK_80F8906EAB014612 FOREIGN KEY (clients_id) REFERENCES clients (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE clients_tables DROP CONSTRAINT fk_8190d6c6ab014612'); + $this->addSql('ALTER TABLE clients_tables DROP CONSTRAINT fk_8190d6c685405fd2'); + $this->addSql('DROP TABLE clients_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 clients_tables (clients_id INT NOT NULL, tables_id INT NOT NULL, PRIMARY KEY(clients_id, tables_id))'); + $this->addSql('CREATE INDEX idx_8190d6c685405fd2 ON clients_tables (tables_id)'); + $this->addSql('CREATE INDEX idx_8190d6c6ab014612 ON clients_tables (clients_id)'); + $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 tables_clients DROP CONSTRAINT FK_80F8906E85405FD2'); + $this->addSql('ALTER TABLE tables_clients DROP CONSTRAINT FK_80F8906EAB014612'); + $this->addSql('DROP TABLE tables_clients'); + } +} diff --git a/public/css/modal.css b/public/css/modal.css new file mode 100644 index 0000000..f09f4d3 --- /dev/null +++ b/public/css/modal.css @@ -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; +} + diff --git a/src/Controller/LoginController.php b/src/Controller/LoginController.php index eb3d2cc..c40906c 100644 --- a/src/Controller/LoginController.php +++ b/src/Controller/LoginController.php @@ -18,7 +18,7 @@ class LoginController extends AbstractController // last username entered by the user $lastUsername = $authenticationUtils->getLastUsername(); - return $this->render('login/index.html.twig', ['last_username' => $lastUsername, 'error' => $error]); + return $this->render('login/gestion.html.twig', ['last_username' => $lastUsername, 'error' => $error]); } @@ -31,7 +31,7 @@ class LoginController extends AbstractController #[Route('/access/denied', name: 'app_access_denied')] public function denied(): Response { - return $this->render('access_denied/index.html.twig', [ + return $this->render('access_denied/gestion.html.twig', [ 'controller_name' => 'AccessDeniedController', ]); } diff --git a/src/Controller/UserController.php b/src/Controller/UserController.php index 0586fa5..c99f38c 100644 --- a/src/Controller/UserController.php +++ b/src/Controller/UserController.php @@ -69,7 +69,7 @@ class UserController extends AbstractController return $this->redirectToRoute('app_index'); } - return $this->render('gestion_user/index.html.twig', [ + return $this->render('user/update.html.twig', [ 'form' => $form, ]); } @@ -88,6 +88,6 @@ class UserController extends AbstractController #[Route('/gestion-user', name: 'gestion_user', methods: ['GET'])] public function index(): Response { - return $this->render('gestion_user/index.html.twig'); + return $this->render('user/gestion.html.twig'); } } diff --git a/templates/Modals/gestionCompteModal.html.twig b/templates/Modals/gestionCompteModal.html.twig deleted file mode 100644 index a5d43af..0000000 --- a/templates/Modals/gestionCompteModal.html.twig +++ /dev/null @@ -1,58 +0,0 @@ - - - - diff --git a/templates/index/admin.html.twig b/templates/index/admin.html.twig index c6a8bed..7554c1c 100644 --- a/templates/index/admin.html.twig +++ b/templates/index/admin.html.twig @@ -126,7 +126,6 @@ - {% include 'Modals/gestionCompteModal.html.twig' %} {% endblock %} diff --git a/templates/gestion_user/index.html.twig b/templates/user/gestion.html.twig similarity index 87% rename from templates/gestion_user/index.html.twig rename to templates/user/gestion.html.twig index f82de26..f00eef9 100644 --- a/templates/gestion_user/index.html.twig +++ b/templates/user/gestion.html.twig @@ -26,9 +26,13 @@
- +
{% endblock %} + +{% block javascripts %} + +{% endblock %} diff --git a/templates/user/update.html.twig b/templates/user/update.html.twig new file mode 100644 index 0000000..df18571 --- /dev/null +++ b/templates/user/update.html.twig @@ -0,0 +1,105 @@ +{% extends 'base.html.twig' %} + +{% block stylesheets %} + +{% endblock %} + +{% block title %}Nouvelle Utilisateur{% endblock %} + +{% block body %} +
+

Modifier Utilisateurs ! ✅

+ + {{ form_start(form) }} + {{ form_errors(form) }} + +
+ {{ form_row(form.Nom, {'attr': {'class': 'form-input'}, 'label': 'Nom'}) }} +
+
+ {{ form_row(form.Prenom, {'attr': {'class': 'form-input'}, 'label': 'Prénom'}) }} +
+
+ {{ form_row(form.UserIdentifier, {'attr': {'class': 'form-input'}, 'label': 'Email'}) }} +
+
+ {{ form_row(form.Password, {'attr': {'class': 'form-input'}, 'label': 'Password'}) }} +
+
+ {{ form_row(form.Roles, {'attr': {'class': 'form-input'}, 'label': 'Roles'}) }} +
+
+ {{ form_row(form.Modifier, {'attr': {'class': 'btn-save'}, 'label': 'Enregistrer'}) }} +
+ + {{ form_end(form) }} + +
+ Annuler +
+
+{% endblock %}