Finition Section "Compte"

This commit is contained in:
Joshua 2024-11-21 15:45:32 +01:00
parent e3b7926fa4
commit cbc2d65041
10 changed files with 414 additions and 64 deletions

View File

@ -0,0 +1,52 @@
<?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 Version20241114160014 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 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)');
}
}

View File

@ -0,0 +1,50 @@
<?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 Version20241114160729 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 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)');
}
}

View File

@ -0,0 +1,46 @@
<?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 Version20241114164216 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_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');
}
}

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

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

View File

@ -18,7 +18,7 @@ class LoginController extends AbstractController
// last username entered by the user // last username entered by the user
$lastUsername = $authenticationUtils->getLastUsername(); $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')] #[Route('/access/denied', name: 'app_access_denied')]
public function denied(): Response public function denied(): Response
{ {
return $this->render('access_denied/index.html.twig', [ return $this->render('access_denied/gestion.html.twig', [
'controller_name' => 'AccessDeniedController', 'controller_name' => 'AccessDeniedController',
]); ]);
} }

View File

@ -69,7 +69,7 @@ class UserController extends AbstractController
return $this->redirectToRoute('app_index'); return $this->redirectToRoute('app_index');
} }
return $this->render('gestion_user/index.html.twig', [ return $this->render('user/update.html.twig', [
'form' => $form, 'form' => $form,
]); ]);
} }
@ -88,6 +88,6 @@ class UserController extends AbstractController
#[Route('/gestion-user', name: 'gestion_user', methods: ['GET'])] #[Route('/gestion-user', name: 'gestion_user', methods: ['GET'])]
public function index(): Response public function index(): Response
{ {
return $this->render('gestion_user/index.html.twig'); return $this->render('user/gestion.html.twig');
} }
} }

View File

@ -1,58 +0,0 @@
<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

@ -126,7 +126,6 @@
</script> </script>
<!-- Include modals --> <!-- Include modals -->
{% include 'Modals/gestionCompteModal.html.twig' %}
{% endblock %} {% endblock %}

View File

@ -26,9 +26,13 @@
</div> </div>
<div class="btn-update"> <div class="btn-update">
<button>Modifier</button> <button class="btn-update">Modifier</button>
</div> </div>
</div> </div>
</form> </form>
{% endblock %} {% endblock %}
{% block javascripts %}
<script src="{{ asset('js/test.js') }}" defer></script>
{% endblock %}

View File

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