Ajout notion de tâche active, et affichage uniquement des taches active lors de la création d'événements #55

This commit is contained in:
2020-12-17 10:53:52 +01:00
parent 5037b0945e
commit 2ba143e5a2
6 changed files with 31 additions and 1 deletions

View File

@@ -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"));

View File

@@ -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[]

View File

@@ -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, [

View File

@@ -99,7 +99,9 @@
{% for project in projects|sort((a, b) => a.displayname <=> b.displayname) %}
<optgroup label="{{project.displayname}}">
{% for task in project.tasks|sort((a, b) => a.displayname <=> b.displayname) %}
{% if task.active %}
<option value="{{task.id}}">{{task.displayname}}</option>
{% endif %}
{% endfor %}
</optgroup>
{% endfor %}

View File

@@ -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) }}
</div>

View File

@@ -63,6 +63,7 @@
<th width="100px">Nature</th>
<th width="100px">Projet</th>
<th>Tâche</th>
<th>Actif</th>
<th width="100px" class="text-center no-string">Estimation</th>
<th width="100px" class="text-center no-string">Validé</th>
<th width="100px" class="text-center no-string">Planifié</th>
@@ -99,6 +100,7 @@
<td>{{task.nature.name}}</td>
<td>{{task.project.name}}</td>
<td>{{task.name}}</td>
<td>{{task.active ? "actif":"non-actif"}}</td>
<td class="text-right">{{task.quantity|number_format(2, '.', ' ')}}</td>
<td class="text-right">{{(totvalidate*-1)|number_format(2, '.', ' ')}}</td>
<td class="text-right">{{((totplanified-totvalidate)*-1)|number_format(2, '.', ' ')}}</td>