Compare commits

..

No commits in common. "8fb4b64ab50cab6120b3fc494ecaed162a5aa45d" and "9965cffecc33f30b2556ec52f90792278be42abf" have entirely different histories.

11 changed files with 52 additions and 195 deletions

View File

@ -36,8 +36,8 @@ security:
access_control: access_control:
# - { path: ^/, roles: ROLE_USER } # - { path: ^/, roles: ROLE_USER }
- { path: ^/logout, roles: IS_AUTHENTICATED }
- { path: ^/login, roles: PUBLIC_ACCESS } - { path: ^/login, roles: PUBLIC_ACCESS }
- { path: ^/logout, roles: ROLE_USER }
- { path: ^/index, roles: [ROLE_ADMIN, ROLE_CUISINIER, ROLE_SERVEUR]} - { path: ^/index, roles: [ROLE_ADMIN, ROLE_CUISINIER, ROLE_SERVEUR]}
- { path: ^/user, roles: ROLE_ADMIN } - { path: ^/user, roles: ROLE_ADMIN }

View File

@ -1,3 +1,15 @@
/* 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 */
.page-container { .page-container {

View File

@ -1,10 +1,16 @@
/* Global styles */
body {
font-family: Arial, sans-serif;
margin: 20px;
background-color: #f9f9f9;
color: #333;
}
h1 {
/*h1 {*/ text-align: center;
/* text-align: center;*/ color: #db5559;
/* color: #db5559;*/ margin-bottom: 20px;
/* margin-bottom: 20px;*/ }
/*}*/
/* Table styles */ /* Table styles */
.table { .table {

View File

@ -1,3 +1,15 @@
/* 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 */
.page-container { .page-container {

View File

@ -1,77 +0,0 @@
document.querySelector('.btn-gestion-promotion').addEventListener('click', function(event) {
event.preventDefault();
document.getElementById('container_modal');
fetch('/reductions')
.then(response => {
if (!response.ok) {
throw new Error('Erreur de chargement de la section Promotions');
}
return response.text();
})
.then(html => {
// Insérer le HTML dans le conteneur et l'afficher
container_modal.innerHTML = html;
container_modal.style.display = 'block';
})
.catch(error => {
console.error('Erreur:', error);
});
});
function addPromotion (event) {
document.getElementById('container_modal');
fetch(`/reductions/new`)
.then(response => {
return response.text();
})
.then(html => {
// Insérer le HTML dans le conteneur et l'afficher
container_modal.innerHTML = html;
container_modal.style.display = 'block';
})
.catch(error => {
console.error('Erreur:', error);
});
}
function updatePromotion (event) {
document.getElementById('container_modal');
const reductionsIdString = event.getAttribute('data-id');
let reductionsId = parseInt(reductionsIdString);
fetch(`/reductions/${reductionsId}/edit`)
.then(response => {
return response.text();
})
.then(html => {
// Insérer le HTML dans le conteneur et l'afficher
container_modal.innerHTML = html;
container_modal.style.display = 'block';
})
.catch(error => {
console.error('Erreur:', error);
});
}
function deletePromotion (event) {
document.getElementById('container_modal');
const reductionsIdString = event.getAttribute('data-id');
let reductionsId = parseInt(reductionsIdString);
fetch(`/reductions/${reductionsId}`)
.then(response => {
return response.text();
})
.then(html => {
// Insérer le HTML dans le conteneur et l'afficher
container_modal.innerHTML = html;
container_modal.style.display = 'block';
})
.catch(error => {
console.error('Erreur:', error);
});
}

View File

@ -1,77 +0,0 @@
document.querySelector('.btn-gestion-table').addEventListener('click', function(event) {
event.preventDefault();
document.getElementById('container_modal');
fetch('/tables')
.then(response => {
if (!response.ok) {
throw new Error('Erreur de chargement de la section Promotions');
}
return response.text();
})
.then(html => {
// Insérer le HTML dans le conteneur et l'afficher
container_modal.innerHTML = html;
container_modal.style.display = 'block';
})
.catch(error => {
console.error('Erreur:', error);
});
});
function addTable (event) {
document.getElementById('container_modal');
fetch(`/tables/new`)
.then(response => {
return response.text();
})
.then(html => {
// Insérer le HTML dans le conteneur et l'afficher
container_modal.innerHTML = html;
container_modal.style.display = 'block';
})
.catch(error => {
console.error('Erreur:', error);
});
}
function updateTable (event) {
document.getElementById('container_modal');
const reductionsIdString = event.getAttribute('data-id');
let reductionsId = parseInt(reductionsIdString);
fetch(`/reductions/${reductionsId}/edit`)
.then(response => {
return response.text();
})
.then(html => {
// Insérer le HTML dans le conteneur et l'afficher
container_modal.innerHTML = html;
container_modal.style.display = 'block';
})
.catch(error => {
console.error('Erreur:', error);
});
}
function deletePromotion (event) {
document.getElementById('container_modal');
const reductionsIdString = event.getAttribute('data-id');
let reductionsId = parseInt(reductionsIdString);
fetch(`/reductions/${reductionsId}`)
.then(response => {
return response.text();
})
.then(html => {
// Insérer le HTML dans le conteneur et l'afficher
container_modal.innerHTML = html;
container_modal.style.display = 'block';
})
.catch(error => {
console.error('Erreur:', error);
});
}

View File

@ -26,17 +26,14 @@ final class ReductionsController extends AbstractController
public function new(Request $request, EntityManagerInterface $entityManager): Response public function new(Request $request, EntityManagerInterface $entityManager): Response
{ {
$reduction = new Reductions(); $reduction = new Reductions();
$form = $this->createForm(ReductionsType::class, $reduction, [ $form = $this->createForm(ReductionsType::class, $reduction);
'action' => $this->generateUrl('app_reductions_new')
] );
$form->handleRequest($request); $form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) { if ($form->isSubmitted() && $form->isValid()) {
$entityManager->persist($reduction); $entityManager->persist($reduction);
$entityManager->flush(); $entityManager->flush();
return $this->redirectToRoute('app_index', [], Response::HTTP_SEE_OTHER); return $this->redirectToRoute('app_reductions_index', [], Response::HTTP_SEE_OTHER);
} }
return $this->render('reductions/new.html.twig', [ return $this->render('reductions/new.html.twig', [
@ -49,15 +46,13 @@ final class ReductionsController extends AbstractController
#[Route('/{id}/edit', name: 'app_reductions_edit', methods: ['GET', 'POST'])] #[Route('/{id}/edit', name: 'app_reductions_edit', methods: ['GET', 'POST'])]
public function edit(Request $request, Reductions $reduction, EntityManagerInterface $entityManager): Response public function edit(Request $request, Reductions $reduction, EntityManagerInterface $entityManager): Response
{ {
$form = $this->createForm(ReductionsType::class, $reduction, [ $form = $this->createForm(ReductionsType::class, $reduction);
'action' => $this->generateUrl('app_reductions_edit', ['id' => $reduction->getId()])
]);
$form->handleRequest($request); $form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) { if ($form->isSubmitted() && $form->isValid()) {
$entityManager->flush(); $entityManager->flush();
return $this->redirectToRoute('app_index', [], Response::HTTP_SEE_OTHER); return $this->redirectToRoute('app_reductions_index', [], Response::HTTP_SEE_OTHER);
} }
return $this->render('reductions/edit.html.twig', [ return $this->render('reductions/edit.html.twig', [
@ -74,6 +69,6 @@ final class ReductionsController extends AbstractController
$entityManager->flush(); $entityManager->flush();
} }
return $this->redirectToRoute('app_index', [], Response::HTTP_SEE_OTHER); return $this->redirectToRoute('app_reductions_index', [], Response::HTTP_SEE_OTHER);
} }
} }

View File

@ -26,9 +26,7 @@ class UserController extends AbstractController
public function register(Request $request, UserPasswordHasherInterface $userPasswordHasher, Security $security, EntityManagerInterface $entityManager): Response public function register(Request $request, UserPasswordHasherInterface $userPasswordHasher, Security $security, EntityManagerInterface $entityManager): Response
{ {
$user = new Utilisateurs(); $user = new Utilisateurs();
$form = $this->createForm(AddUserFormType::class, $user, [ $form = $this->createForm(AddUserFormType::class, $user);
'action' => $this->generateUrl('add_user')
]);
$form->handleRequest($request); $form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) { if ($form->isSubmitted() && $form->isValid()) {
@ -55,9 +53,7 @@ class UserController extends AbstractController
public function update(Request $request, UserPasswordHasherInterface $userPasswordHasher, Security $security, EntityManagerInterface $entityManager, int $id): Response public function update(Request $request, UserPasswordHasherInterface $userPasswordHasher, Security $security, EntityManagerInterface $entityManager, int $id): Response
{ {
$user = $this->utilisateursRepository->find($id); $user = $this->utilisateursRepository->find($id);
$form = $this->createForm(UpdateUserType::class, $user , [ $form = $this->createForm(UpdateUserType::class, $user);
'action' => $this->generateUrl('update-user', ['id' => $user->getId()])
]);
$form->handleRequest($request); $form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) { if ($form->isSubmitted() && $form->isValid()) {
@ -70,7 +66,7 @@ class UserController extends AbstractController
$entityManager->persist($user); $entityManager->persist($user);
$entityManager->flush(); $entityManager->flush();
return $security->login($user, LoginAuthenticator::class, 'main'); return $this->redirectToRoute('app_index');
} }
return $this->render('user/update.html.twig', [ return $this->render('user/update.html.twig', [

View File

@ -41,7 +41,7 @@
</div> </div>
</li> </li>
<li> <li>
<div class="btn-custom btn-gestion-table icon-container"> <div class="btn-custom icon-container">
<i class="icon-medium"> {{ ux_icon('ic:outline-table-bar') }}</i> <i class="icon-medium"> {{ ux_icon('ic:outline-table-bar') }}</i>
<span>Gérer Table</span> <span>Gérer Table</span>
</div> </div>
@ -53,7 +53,7 @@
</div> </div>
</li> </li>
<li> <li>
<div class="btn-custom btn-gestion-promotion icon-container"> <div class="btn-custom icon-container">
<i class="icon-medium"> {{ ux_icon('lsicon:badge-promotion-outline') }}</i> <i class="icon-medium"> {{ ux_icon('lsicon:badge-promotion-outline') }}</i>
<span>Gestion Promotion</span> <span>Gestion Promotion</span>
</div> </div>
@ -133,6 +133,4 @@
{% block javascripts %} {% block javascripts %}
<script src="{{ asset('js/Compte/CompteModal.js') }}" defer></script> <script src="{{ asset('js/Compte/CompteModal.js') }}" defer></script>
<script src="{{ asset('js/GestionUtilisateurs/GestionUtilisateurs.js') }}" defer></script> <script src="{{ asset('js/GestionUtilisateurs/GestionUtilisateurs.js') }}" defer></script>
<script src="{{ asset('js/GestionPromotion/GestionPromotion.js') }}" defer></script>
<script src="{{ asset('js/GestionTables/GestionTables.js') }}" defer></script>
{% endblock %} {% endblock %}

View File

@ -36,7 +36,7 @@
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ reduction.id) }}"> <input type="hidden" name="_token" value="{{ csrf_token('delete' ~ reduction.id) }}">
{{ include('reductions/_delete_form.html.twig') }} {{ include('reductions/_delete_form.html.twig') }}
</form> </form>
<button onclick="updatePromotion(this)" data-id="{{ reduction.id }}" href="{{ path('app_reductions_edit', {'id': reduction.id}) }}">Modifier</button> <a href="{{ path('app_reductions_edit', {'id': reduction.id}) }}">Modifier</a>
</td> </td>
</tr> </tr>
{% else %} {% else %}
@ -47,9 +47,5 @@
</tbody> </tbody>
</table> </table>
<button onclick="addPromotion(this)" href="{{ path('app_reductions_new') }}">Créer une réduction</button> <a href="{{ path('app_reductions_new') }}">Créer une réduction</a>
{% endblock %}
{% block javascripts %}
<script src="{{ asset('js/GestionPromotion/GestionPromotion.js') }}" defer></script>
{% endblock %} {% endblock %}

View File

@ -35,9 +35,5 @@
</tbody> </tbody>
</table> </table>
<button onclick="addTable(this)" href="{{ path('app_reductions_new') }}">Créer une tables</button> <a href="{{ path('app_tables_new') }}">Créer une nouvelle table</a>
{% endblock %}
{% block javascripts %}
<script src="{{ asset('js/GestionPromotion/GestionPromotion.js') }}" defer></script>
{% endblock %} {% endblock %}