resultat vote
This commit is contained in:
@ -4,6 +4,7 @@ namespace App\Controller;
|
||||
|
||||
use App\Entity\Project;
|
||||
use App\Form\ProjectType;
|
||||
use App\Form\ProjectVotedType;
|
||||
use App\Repository\ProjectRepository;
|
||||
use App\Security\ProjectVoter;
|
||||
use Bnine\FilesBundle\Service\FileService;
|
||||
@ -121,7 +122,20 @@ class ProjectController extends AbstractController
|
||||
$attribute = constant(ProjectVoter::class.'::MOVE'.$status);
|
||||
$this->denyAccessUnlessGranted($attribute, $project);
|
||||
|
||||
if (Project::VOTED == $status) {
|
||||
if ('VOTED' == $status && Project::ARCHIVED != $project->getStatus()) {
|
||||
$form = $this->createForm(ProjectVotedType::class, $project);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if (!$form->isSubmitted() || !$form->isValid()) {
|
||||
return $this->render('project/vote.html.twig', [
|
||||
'usemenu' => true,
|
||||
'usesidebar' => false,
|
||||
'title' => 'Vote Projet = '.$project->getTitle(),
|
||||
'routecancel' => 'app_user_project_view',
|
||||
'form' => $form,
|
||||
'project' => $project,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
$project->setStatus(constant(Project::class.'::'.$status));
|
||||
|
@ -6,7 +6,9 @@ use App\Entity\Project;
|
||||
use App\Form\Type\ProjectOptionType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
@ -20,6 +22,24 @@ class ProjectVotedType extends AbstractType
|
||||
'attr' => ['class' => 'btn btn-success no-print me-1'],
|
||||
])
|
||||
|
||||
->add('resultVote', TextareaType::class, [
|
||||
'label' => 'Résultats',
|
||||
'required' => true,
|
||||
'attr' => [
|
||||
'rows' => 7,
|
||||
],
|
||||
])
|
||||
|
||||
->add('nbVoteWhite', IntegerType::class, [
|
||||
'label' => 'Votes blancs',
|
||||
'required' => false,
|
||||
])
|
||||
|
||||
->add('nbVoteNull', IntegerType::class, [
|
||||
'label' => 'Votes nuls',
|
||||
'required' => false,
|
||||
])
|
||||
|
||||
->add('options', CollectionType::class, [
|
||||
'entry_type' => ProjectOptionType::class,
|
||||
'entry_options' => ['label' => false],
|
||||
|
Reference in New Issue
Block a user