diff --git a/src/schedule-2.0/src/Controller/TaskController.php b/src/schedule-2.0/src/Controller/TaskController.php index fb27118..6828d2f 100755 --- a/src/schedule-2.0/src/Controller/TaskController.php +++ b/src/schedule-2.0/src/Controller/TaskController.php @@ -55,6 +55,7 @@ class TaskController extends AbstractController $data = new Entity(); $defaultnature = $em->getRepository("App:Nature")->findOneBy(['name' => 'Prestation']); $data->setNature($defaultnature); + $data->setActive(true); // Création du formulaire $form = $this->createForm(Form::class,$data,array("mode"=>"submit")); diff --git a/src/schedule-2.0/src/Entity/Task.php b/src/schedule-2.0/src/Entity/Task.php index 3a9f470..89577f4 100644 --- a/src/schedule-2.0/src/Entity/Task.php +++ b/src/schedule-2.0/src/Entity/Task.php @@ -70,7 +70,11 @@ class Task * @ORM\OneToMany(targetEntity="Penalty", mappedBy="task", cascade={"persist"}, orphanRemoval=false) */ private $penaltys; - + /** + * @ORM\Column(name="active", type="boolean") + * + */ + private $active; /** * Calculate Displayname */ @@ -227,6 +231,19 @@ class Task return $this; } + + public function getActive(): ?bool + { + return $this->active; + } + + public function setActive(bool $active): self + { + $this->active = $active; + + return $this; + } + /** * @return Collection|Penalty[] diff --git a/src/schedule-2.0/src/Form/TaskType.php b/src/schedule-2.0/src/Form/TaskType.php index e861bfd..bbf56f9 100644 --- a/src/schedule-2.0/src/Form/TaskType.php +++ b/src/schedule-2.0/src/Form/TaskType.php @@ -56,6 +56,13 @@ class TaskType extends AbstractType "choice_label" => "name", ] ); + + $builder->add("active", + ChoiceType::class,[ + "label" => "Actif", + "choices" => ["Non"=>false, "Oui"=>true] + ] + ); $builder->add('color', TextType::class, [ diff --git a/src/schedule-2.0/templates/Event/list.html.twig b/src/schedule-2.0/templates/Event/list.html.twig index e9dbf6d..1996800 100644 --- a/src/schedule-2.0/templates/Event/list.html.twig +++ b/src/schedule-2.0/templates/Event/list.html.twig @@ -99,7 +99,9 @@ {% for project in projects|sort((a, b) => a.displayname <=> b.displayname) %} {% endfor %} diff --git a/src/schedule-2.0/templates/Task/edit.html.twig b/src/schedule-2.0/templates/Task/edit.html.twig index 2bf54ae..7d6b4fb 100755 --- a/src/schedule-2.0/templates/Task/edit.html.twig +++ b/src/schedule-2.0/templates/Task/edit.html.twig @@ -54,6 +54,7 @@ {{ form_row(form.name) }} {{ form_row(form.project) }} {{ form_row(form.nature) }} + {{ form_row(form.active) }} {{ form_row(form.quantity) }} {{ form_row(form.color) }} diff --git a/src/schedule-2.0/templates/Task/list.html.twig b/src/schedule-2.0/templates/Task/list.html.twig index a53d1ad..188522e 100644 --- a/src/schedule-2.0/templates/Task/list.html.twig +++ b/src/schedule-2.0/templates/Task/list.html.twig @@ -63,6 +63,7 @@