Compare commits
No commits in common. "78515d6c876b9d23da24ac355b872e3da085ca3c" and "7882fffe4e81e29b9dbc315ba7f2ded955fc8c32" have entirely different histories.
78515d6c87
...
7882fffe4e
@ -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 }
|
||||||
|
|
||||||
|
@ -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);
|
|
||||||
});
|
|
||||||
}
|
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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', [
|
||||||
|
@ -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>
|
||||||
@ -119,7 +119,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="container_modal">
|
<div id="container_modal">
|
||||||
<!-- Contenu par défaut, ou vous p ouvez laisser vide -->
|
<!-- Contenu par défaut, ou vous pouvez laisser vide -->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@ -133,5 +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>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
@ -32,11 +32,11 @@
|
|||||||
<td>{{ reduction.DateDebut ? reduction.DateDebut|date('Y-m-d H:i:s') : '' }}</td>
|
<td>{{ reduction.DateDebut ? reduction.DateDebut|date('Y-m-d H:i:s') : '' }}</td>
|
||||||
<td>{{ reduction.DateFin ? reduction.DateFin|date('Y-m-d H:i:s') : '' }}</td>
|
<td>{{ reduction.DateFin ? reduction.DateFin|date('Y-m-d H:i:s') : '' }}</td>
|
||||||
<td>
|
<td>
|
||||||
<form method="post" action="{{ path('app_reductions_delete', {'id': reduction.id}) }}" onsubmit="return confirm('Es-tu sur de vouloir le supprimer ?'); ">
|
<form method="post" action="{{ path('app_reductions_delete', {'id': reduction.id}) }}" onsubmit="return confirm('Es-tu sur de vouloir le supprimer ?');">
|
||||||
<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 %}
|
Loading…
x
Reference in New Issue
Block a user