laisse la
This commit is contained in:
parent
f8569d8db3
commit
432d7ba4de
@ -71,11 +71,14 @@ final class DegreeController extends AbstractController
|
|||||||
#[Route('/{id}', name: 'app_degree_delete', methods: ['POST'])]
|
#[Route('/{id}', name: 'app_degree_delete', methods: ['POST'])]
|
||||||
public function delete(Request $request, Degree $degree, EntityManagerInterface $entityManager): Response
|
public function delete(Request $request, Degree $degree, EntityManagerInterface $entityManager): Response
|
||||||
{
|
{
|
||||||
if ($this->isCsrfTokenValid('delete'.$degree->getId(), $request->getPayload()->getString('_token'))) {
|
// Vérification du token CSRF pour la sécurité
|
||||||
|
if ($this->isCsrfTokenValid('delete'.$degree->getId(), $request->request->get('_token'))) {
|
||||||
|
// Suppression du diplôme
|
||||||
$entityManager->remove($degree);
|
$entityManager->remove($degree);
|
||||||
$entityManager->flush();
|
$entityManager->flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->redirectToRoute('app_degree_index', [], Response::HTTP_SEE_OTHER);
|
return $this->redirectToRoute('app_degree_index', [], Response::HTTP_SEE_OTHER);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ class Company
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getAddress(): ?string
|
public function getAddress(): ?stringz
|
||||||
{
|
{
|
||||||
return $this->address;
|
return $this->address;
|
||||||
}
|
}
|
||||||
|
@ -3,12 +3,18 @@
|
|||||||
{% block title %}Bienvenue sur Hegreshpere{% endblock %}
|
{% block title %}Bienvenue sur Hegreshpere{% endblock %}
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
|
<script src="{{ asset('js/map.js') }}"></script>
|
||||||
<style>
|
<style>
|
||||||
.example-wrapper { margin: 1em auto; max-width: 800px; width: 95%; font: 18px/1.5 sans-serif; }
|
#map {
|
||||||
.example-wrapper code { background: #F5F5F5; padding: 2px 6px; }
|
height: 500px; /* Ajuste la taille selon tes besoins */
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<h1> Liste des annonces</h1>
|
<h1> Liste des annonces</h1>
|
||||||
|
|
||||||
|
<div id="map"></div> <!-- Conteneur pour la carte -->
|
||||||
|
|
||||||
{% for ann in announcements %}
|
{% for ann in announcements %}
|
||||||
<h2> {{ ann.title }} </h2>
|
<h2> {{ ann.title }} </h2>
|
||||||
<h3> {{ ann.company.name }} </h3>
|
<h3> {{ ann.company.name }} </h3>
|
||||||
@ -17,6 +23,4 @@
|
|||||||
|
|
||||||
<p> {{ ann.creationDate|date("d-m-y") }} </p>
|
<p> {{ ann.creationDate|date("d-m-y") }} </p>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
@ -1,26 +1,37 @@
|
|||||||
{% extends 'base.html.twig' %}
|
{% extends 'base.html.twig' %}
|
||||||
|
|
||||||
{% block title %}Degree{% endblock %}
|
{% block title %}Degrees{% endblock %}
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<h1>Degree</h1>
|
<h1>List of Degrees</h1>
|
||||||
|
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<tbody>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Id</th>
|
<th>Id</th>
|
||||||
<td>{{ degree.id }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>Label</th>
|
<th>Label</th>
|
||||||
<td>{{ degree.label }}</td>
|
<th>Actions</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for degree in degrees %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ degree.id }}</td>
|
||||||
|
<td>{{ degree.label }}</td>
|
||||||
|
<td>
|
||||||
|
<a href="{{ path('app_degree_show', {'id': degree.id}) }}" class="btn btn-info">View</a>
|
||||||
|
<a href="{{ path('app_degree_edit', {'id': degree.id}) }}" class="btn btn-warning">Edit</a>
|
||||||
|
<!-- Form for deleting a degree -->
|
||||||
|
<form method="post" action="{{ path('app_degree_delete', {'id': degree.id}) }}" style="display:inline;">
|
||||||
|
<input type="hidden" name="_method" value="DELETE">
|
||||||
|
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ degree.id) }}">
|
||||||
|
<button class="btn btn-danger" type="submit">Delete</button>
|
||||||
|
</form>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<a href="{{ path('app_degree_index') }}">back to list</a>
|
<a href="{{ path('app_degree_new') }}" class="btn btn-success">Add New Degree</a>
|
||||||
|
|
||||||
<a href="{{ path('app_degree_edit', {'id': degree.id}) }}">edit</a>
|
|
||||||
|
|
||||||
{{ include('degree/_delete_form.html.twig') }}
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
Loading…
Reference in New Issue
Block a user