Ajout protection contre catégorie
This commit is contained in:
@@ -44,15 +44,6 @@ class CategoryController extends AbstractController
|
|||||||
): Response {
|
): Response {
|
||||||
$this->appLogger->record('VIEW', 'Consultation de la page de catégorie');
|
$this->appLogger->record('VIEW', 'Consultation de la page de catégorie');
|
||||||
|
|
||||||
foreach (['2-7 Ans','3-15 Ans','3-99 Ans','Barnums','Alimentaire','Options'] as $catName) {
|
|
||||||
$cat = $categoryRepository->findOneBy(['name'=>$catName]);
|
|
||||||
if(!$cat instanceof Category) {
|
|
||||||
$cat = new Category();
|
|
||||||
$cat->setName($catName);
|
|
||||||
$this->em->persist($cat);
|
|
||||||
}
|
|
||||||
$this->em->flush();
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->render('dashboard/category/list.twig', [
|
return $this->render('dashboard/category/list.twig', [
|
||||||
'categorys' => $categoryRepository->findAll(),
|
'categorys' => $categoryRepository->findAll(),
|
||||||
|
|||||||
@@ -41,6 +41,7 @@
|
|||||||
{# ACTIONS #}
|
{# ACTIONS #}
|
||||||
<td class="px-6 py-4 text-right">
|
<td class="px-6 py-4 text-right">
|
||||||
<div class="flex items-center justify-end space-x-2">
|
<div class="flex items-center justify-end space-x-2">
|
||||||
|
{% if category.name != "2-7 Ans" %}
|
||||||
<a data-turbo="false" href="{{ path('app_crm_category_edit', {id: category.id}) }}" class="p-2 bg-blue-600/10 hover:bg-blue-600 text-blue-500 hover:text-white rounded-xl transition-all border border-blue-500/20 shadow-lg shadow-blue-600/5">
|
<a data-turbo="false" href="{{ path('app_crm_category_edit', {id: category.id}) }}" class="p-2 bg-blue-600/10 hover:bg-blue-600 text-blue-500 hover:text-white rounded-xl transition-all border border-blue-500/20 shadow-lg shadow-blue-600/5">
|
||||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z" /></svg>
|
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z" /></svg>
|
||||||
</a>
|
</a>
|
||||||
@@ -50,6 +51,7 @@
|
|||||||
class="p-2 bg-rose-500/10 hover:bg-rose-600 text-rose-500 hover:text-white rounded-xl transition-all border border-rose-500/20">
|
class="p-2 bg-rose-500/10 hover:bg-rose-600 text-rose-500 hover:text-white rounded-xl transition-all border border-rose-500/20">
|
||||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16" /></svg>
|
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16" /></svg>
|
||||||
</a>
|
</a>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
Reference in New Issue
Block a user