diff --git a/config/routes/actors.yaml b/config/routes/actors.yaml
new file mode 100644
index 0000000..c0f1dcd
--- /dev/null
+++ b/config/routes/actors.yaml
@@ -0,0 +1,3 @@
+actors_actors:
+ path: /
+ controller: App\Controller\ActorsController::actors
\ No newline at end of file
diff --git a/config/routes/settings.yaml b/config/routes/settings.yaml
deleted file mode 100644
index 79a3d25..0000000
--- a/config/routes/settings.yaml
+++ /dev/null
@@ -1,3 +0,0 @@
-settings_actors:
- path: /
- controller: App\Controller\SettingsController::actors
\ No newline at end of file
diff --git a/src/Controller/ActorsController.php b/src/Controller/ActorsController.php
new file mode 100644
index 0000000..b681098
--- /dev/null
+++ b/src/Controller/ActorsController.php
@@ -0,0 +1,88 @@
+getDoctrine()->getManager();
+ /** @var ActorRepository $actorRepository */
+ $actorRepository = $entityManager->getRepository(ActorEntity::class);
+
+ // Actor add form
+ /** @var ActorAddForm $actorAddFom */
+ $actorAddFom = $this->createNamedCustomForm('actorAdd', ActorAddForm::class);
+ $actorAddFom->handleRequest($request);
+ if ($actorAddFom->isSubmitted() && $actorAddFom->isValid()) {
+ $errors = $actorAddFom->validate();
+ if (empty($errors)) {
+ $actor = $actorAddFom->getActor();
+ $entityManager->persist($actor);
+ $entityManager->flush();
+
+ return $this->ajaxFormAnswer([
+ 'refresh' => true,
+ 'reset' => true,
+ ]);
+ } else {
+ return $this->ajaxFormAnswer([
+ 'error' => join('
', $errors),
+ 'code' => Response::HTTP_BAD_REQUEST,
+ ]);
+ }
+ }
+
+ // Actor delete form
+ /** @var ActorDeleteForm $actorDeleteForm */
+ $actorDeleteForm = $this->createNamedCustomForm('actorDelete', ActorDeleteForm::class);
+ $actorDeleteForm->handleRequest($request);
+ if ($actorDeleteForm->isSubmitted() && $actorDeleteForm->isValid()) {
+ $errors = $actorAddFom->validate();
+ if (empty($errors)) {
+ $actor = $actorDeleteForm->getActor($actorRepository);
+ if (!is_null($actor)) {
+ $entityManager->remove($actor);
+ $entityManager->flush();
+ return $this->ajaxFormAnswer([
+ 'refresh' => true,
+ ]);
+ } else {
+ return $this->ajaxFormAnswer([
+ 'error' => 'Utilisateur non trouvé',
+ 'code' => Response::HTTP_BAD_REQUEST,
+ ]);
+ }
+ } else {
+ return $this->ajaxFormAnswer([
+ 'error' => join('
', $errors),
+ 'code' => Response::HTTP_BAD_REQUEST,
+ ]);
+ }
+ }
+
+ // Get actors
+ $actors = $actorRepository->findAll();
+
+ return $this->render('actors/actors.html.twig', [
+ 'actorAddForm' => $actorAddFom,
+ 'actorDeleteForm' => $actorDeleteForm,
+ 'actors' => $actors,
+ ]);
+ }
+}
+
diff --git a/src/Controller/SettingsController.php b/src/Controller/SettingsController.php
deleted file mode 100644
index f20a7a2..0000000
--- a/src/Controller/SettingsController.php
+++ /dev/null
@@ -1,88 +0,0 @@
-getDoctrine()->getManager();
- /** @var ActorRepository $actorRepository */
- $actorRepository = $entityManager->getRepository(ActorEntity::class);
-
- // Actor add form
- /** @var ActorAddForm $actorAddFom */
- $actorAddFom = $this->createNamedCustomForm('actorAdd', ActorAddForm::class);
- $actorAddFom->handleRequest($request);
- if ($actorAddFom->isSubmitted() && $actorAddFom->isValid()) {
- $errors = $actorAddFom->validate();
- if (empty($errors)) {
- $actor = $actorAddFom->getActor();
- $entityManager->persist($actor);
- $entityManager->flush();
-
- return $this->ajaxFormAnswer([
- 'refresh' => true,
- 'reset' => true,
- ]);
- } else {
- return $this->ajaxFormAnswer([
- 'error' => join('
', $errors),
- 'code' => Response::HTTP_BAD_REQUEST,
- ]);
- }
- }
-
- // Actor delete form
- /** @var ActorDeleteForm $actorDeleteForm */
- $actorDeleteForm = $this->createNamedCustomForm('actorDelete', ActorDeleteForm::class);
- $actorDeleteForm->handleRequest($request);
- if ($actorDeleteForm->isSubmitted() && $actorDeleteForm->isValid()) {
- $errors = $actorAddFom->validate();
- if (empty($errors)) {
- $actor = $actorDeleteForm->getActor($actorRepository);
- if (!is_null($actor)) {
- $entityManager->remove($actor);
- $entityManager->flush();
- return $this->ajaxFormAnswer([
- 'refresh' => true,
- ]);
- } else {
- return $this->ajaxFormAnswer([
- 'error' => 'Utilisateur non trouvé',
- 'code' => Response::HTTP_BAD_REQUEST,
- ]);
- }
- } else {
- return $this->ajaxFormAnswer([
- 'error' => join('
', $errors),
- 'code' => Response::HTTP_BAD_REQUEST,
- ]);
- }
- }
-
- // Get actors
- $actors = $actorRepository->findAll();
-
- return $this->render('actors.html.twig', [
- 'actorAddForm' => $actorAddFom,
- 'actorDeleteForm' => $actorDeleteForm,
- 'actors' => $actors,
- ]);
- }
-}
-
diff --git a/src/Form/ActorAddForm.php b/src/Form/ActorAddForm.php
deleted file mode 100644
index 2d62e4c..0000000
--- a/src/Form/ActorAddForm.php
+++ /dev/null
@@ -1,52 +0,0 @@
-form->getData();
- $actor = new ActorEntity();
- $actor->generateId();
- $actor->setFirstName($data['firstName']);
- $actor->setLastName($data['lastName']);
- $actor->setNickname($data['nickname']);
-
- return $actor;
- }
-
- /**
- * {@inheritdoc}
- */
- public function getTemplate(): string
- {
- return '_includes/html/form/actorAdd.html.twig';
- }
-
- /**
- * {@inheritdoc}
- */
- protected function addFields($formBuilder, $options): void
- {
- $formBuilder->add('firstName', TextType::class, [
- 'required' => true
- ])
- ->add('lastName', TextType::class, [
- 'required' => true
- ])
- ->add('nickname', TextType::class, [
- 'required' => false
- ])
- ->add('submit', SubmitType::class);
- }
-}
\ No newline at end of file
diff --git a/src/Form/ActorDeleteForm.php b/src/Form/ActorDeleteForm.php
deleted file mode 100644
index 84106fe..0000000
--- a/src/Form/ActorDeleteForm.php
+++ /dev/null
@@ -1,39 +0,0 @@
-form->getData();
- return $actorRepository->find($data['id']);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getTemplate(): string
- {
- return '_includes/html/form/actorDelete.html.twig';
- }
-
- /**
- * {@inheritdoc}
- */
- protected function addFields($formBuilder, $options): void
- {
- $formBuilder->add('id', HiddenType::class)->add('submit', SubmitType::class);
- }
-}
\ No newline at end of file
diff --git a/src/Form/Actors/ActorAddForm.php b/src/Form/Actors/ActorAddForm.php
new file mode 100644
index 0000000..f4989a6
--- /dev/null
+++ b/src/Form/Actors/ActorAddForm.php
@@ -0,0 +1,53 @@
+form->getData();
+ $actor = new ActorEntity();
+ $actor->generateId();
+ $actor->setFirstName($data['firstName']);
+ $actor->setLastName($data['lastName']);
+ $actor->setNickname($data['nickname']);
+
+ return $actor;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getTemplate(): string
+ {
+ return '_includes/html/form/actors/add.html.twig';
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function addFields($formBuilder, $options): void
+ {
+ $formBuilder->add('firstName', TextType::class, [
+ 'required' => true
+ ])
+ ->add('lastName', TextType::class, [
+ 'required' => true
+ ])
+ ->add('nickname', TextType::class, [
+ 'required' => false
+ ])
+ ->add('submit', SubmitType::class);
+ }
+}
\ No newline at end of file
diff --git a/src/Form/Actors/ActorDeleteForm.php b/src/Form/Actors/ActorDeleteForm.php
new file mode 100644
index 0000000..424558e
--- /dev/null
+++ b/src/Form/Actors/ActorDeleteForm.php
@@ -0,0 +1,40 @@
+form->getData();
+ return $actorRepository->find($data['id']);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getTemplate(): string
+ {
+ return '_includes/html/form/actors/delete.html.twig';
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function addFields($formBuilder, $options): void
+ {
+ $formBuilder->add('id', HiddenType::class)->add('submit', SubmitType::class);
+ }
+}
\ No newline at end of file
diff --git a/templates/_includes/html/base.html.twig b/templates/_includes/html/base.html.twig
index 97eae4a..46ccd98 100644
--- a/templates/_includes/html/base.html.twig
+++ b/templates/_includes/html/base.html.twig
@@ -46,7 +46,7 @@
Paramètres
- {% include "_includes/html/component/navLink.html.twig" with {route: "settings_actors", icon: "icofont-people", name: "Acteurs"} %}
+ {% include "_includes/html/component/navLink.html.twig" with {route: "actors_actors", icon: "icofont-people", name: "Acteurs"} %}
diff --git a/templates/_includes/html/form/actorAdd.html.twig b/templates/_includes/html/form/actorAdd.html.twig
deleted file mode 100644
index c52af26..0000000
--- a/templates/_includes/html/form/actorAdd.html.twig
+++ /dev/null
@@ -1,17 +0,0 @@
-{{ form_start(form, {'attr': {'class': 'ajax-form'}}) }}
-
- {{ form_label(form.firstName, 'Prénom', {'label_attr': {'class': 'input-text-label'}}) }}
- {{ form_widget(form.firstName, {'attr': {'class': 'w-100'}}) }}
-
-
- {{ form_label(form.lastName, 'Nom', {'label_attr': {'class': 'input-text-label'}}) }}
- {{ form_widget(form.lastName, {'attr': {'class': 'w-100'}}) }}
-
-
- {{ form_label(form.nickname, 'Surnom', {'label_attr': {'class': 'input-text-label'}}) }}
- {{ form_widget(form.nickname, {'attr': {'class': 'w-100', 'title': 'Le nom tel qu\'il sera affiché.\nS\'il n\'est pas définit, il sera sous la form Prénom NOM.'}}) }}
-
-{{ form_widget(form.submit, {'attr': {'class': 'w-100'}, 'label': 'Nouvel acteur'}) }}
-
-
-{{ form_end(form) }}
\ No newline at end of file
diff --git a/templates/_includes/html/form/actorDelete.html.twig b/templates/_includes/html/form/actorDelete.html.twig
deleted file mode 100644
index 176cdad..0000000
--- a/templates/_includes/html/form/actorDelete.html.twig
+++ /dev/null
@@ -1,17 +0,0 @@
-{{ form_start(form, {'attr': {'class': 'ajax-form', 'data-form-confirmation': "Voulez-vous supprimer l'acteur "~data.actor.displayName~" ?\nCette action ne supprimera pas les activités et actions qui lui sont attribués."}}) }}
-{{ form_widget(form.id, {'value': data.actor.id}) }}
-{% if data.variant|default('icon') == 'icon' %}
-{{ form_widget(form.submit, {
- 'label': '',
- 'label_html': true,
- 'attr': {
- 'class': 'icon-button',
- 'title': 'Supprimer l\'acteur',
- }
-})}}
-{% elseif data.variant == 'full' %}
-{{ form_widget(form.submit, {'label': 'Supprimer l\'acteur'})}}
-{% endif %}
-
-
-{{ form_end(form) }}
\ No newline at end of file
diff --git a/templates/_includes/html/form/actors/add.html.twig b/templates/_includes/html/form/actors/add.html.twig
new file mode 100644
index 0000000..c52af26
--- /dev/null
+++ b/templates/_includes/html/form/actors/add.html.twig
@@ -0,0 +1,17 @@
+{{ form_start(form, {'attr': {'class': 'ajax-form'}}) }}
+
+ {{ form_label(form.firstName, 'Prénom', {'label_attr': {'class': 'input-text-label'}}) }}
+ {{ form_widget(form.firstName, {'attr': {'class': 'w-100'}}) }}
+
+
+ {{ form_label(form.lastName, 'Nom', {'label_attr': {'class': 'input-text-label'}}) }}
+ {{ form_widget(form.lastName, {'attr': {'class': 'w-100'}}) }}
+
+
+ {{ form_label(form.nickname, 'Surnom', {'label_attr': {'class': 'input-text-label'}}) }}
+ {{ form_widget(form.nickname, {'attr': {'class': 'w-100', 'title': 'Le nom tel qu\'il sera affiché.\nS\'il n\'est pas définit, il sera sous la form Prénom NOM.'}}) }}
+
+{{ form_widget(form.submit, {'attr': {'class': 'w-100'}, 'label': 'Nouvel acteur'}) }}
+
+
+{{ form_end(form) }}
\ No newline at end of file
diff --git a/templates/_includes/html/form/actors/delete.html.twig b/templates/_includes/html/form/actors/delete.html.twig
new file mode 100644
index 0000000..176cdad
--- /dev/null
+++ b/templates/_includes/html/form/actors/delete.html.twig
@@ -0,0 +1,17 @@
+{{ form_start(form, {'attr': {'class': 'ajax-form', 'data-form-confirmation': "Voulez-vous supprimer l'acteur "~data.actor.displayName~" ?\nCette action ne supprimera pas les activités et actions qui lui sont attribués."}}) }}
+{{ form_widget(form.id, {'value': data.actor.id}) }}
+{% if data.variant|default('icon') == 'icon' %}
+{{ form_widget(form.submit, {
+ 'label': '',
+ 'label_html': true,
+ 'attr': {
+ 'class': 'icon-button',
+ 'title': 'Supprimer l\'acteur',
+ }
+})}}
+{% elseif data.variant == 'full' %}
+{{ form_widget(form.submit, {'label': 'Supprimer l\'acteur'})}}
+{% endif %}
+
+
+{{ form_end(form) }}
\ No newline at end of file
diff --git a/templates/actors.html.twig b/templates/actors.html.twig
deleted file mode 100644
index 0b9e418..0000000
--- a/templates/actors.html.twig
+++ /dev/null
@@ -1,48 +0,0 @@
-{% extends '_includes/html/base.html.twig' %}
-
-{% set page="Acteurs" %}
-
-{% block pageContent %}
-
-
-
-
-
-
-
- Nom |
- Prénom |
- Surnom |
- Actif |
- |
-
-
-
- {% for actor in actors %}
-
- {{ actor.firstName }} |
- {{ actor.lastName }} |
- {{ actor.nickname }} |
- {% if actor.active %} {% endif %} |
- {% include '_includes/html/genericForm.html.twig' with {'form': actorDeleteForm, 'data': {'actor': actor, 'variant': 'icon'}} only %} |
-
- {% endfor %}
-
-
-
-
-
-
-
-
-
- {% include '_includes/html/genericForm.html.twig' with {'form': actorAddForm} only %}
-
-
-
-{% endblock %}
\ No newline at end of file
diff --git a/templates/actors/actor.html.twig b/templates/actors/actor.html.twig
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/templates/actors/actor.html.twig
diff --git a/templates/actors/actors.html.twig b/templates/actors/actors.html.twig
new file mode 100644
index 0000000..0b9e418
--- /dev/null
+++ b/templates/actors/actors.html.twig
@@ -0,0 +1,48 @@
+{% extends '_includes/html/base.html.twig' %}
+
+{% set page="Acteurs" %}
+
+{% block pageContent %}
+
+
+
+
+
+
+
+ Nom |
+ Prénom |
+ Surnom |
+ Actif |
+ |
+
+
+
+ {% for actor in actors %}
+
+ {{ actor.firstName }} |
+ {{ actor.lastName }} |
+ {{ actor.nickname }} |
+ {% if actor.active %} {% endif %} |
+ {% include '_includes/html/genericForm.html.twig' with {'form': actorDeleteForm, 'data': {'actor': actor, 'variant': 'icon'}} only %} |
+
+ {% endfor %}
+
+
+
+
+
+
+
+
+
+ {% include '_includes/html/genericForm.html.twig' with {'form': actorAddForm} only %}
+
+
+
+{% endblock %}
\ No newline at end of file