diff --git a/src/Bundle/ChillMainBundle/Controller/WorkflowController.php b/src/Bundle/ChillMainBundle/Controller/WorkflowController.php index 3a8626f26..6cf5e763e 100644 --- a/src/Bundle/ChillMainBundle/Controller/WorkflowController.php +++ b/src/Bundle/ChillMainBundle/Controller/WorkflowController.php @@ -23,6 +23,7 @@ use Chill\MainBundle\Security\Authorization\EntityWorkflowVoter; use Chill\MainBundle\Security\ChillSecurity; use Chill\MainBundle\Workflow\EntityWorkflowManager; use Chill\MainBundle\Workflow\WorkflowTransitionContextDTO; +use Chill\PersonBundle\Entity\Person; use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\Form\Extension\Core\Type\FormType; @@ -277,6 +278,22 @@ class WorkflowController extends AbstractController $handler = $this->entityWorkflowManager->getHandler($entityWorkflow); $workflow = $this->registry->get($entityWorkflow, $entityWorkflow->getWorkflowName()); $errors = []; + $signaturesByPerson = false; + + $signatures = $entityWorkflow->getCurrentStep()->getSignatures(); + if (!$signatures->isEmpty()) { + $signaturesByPerson = $signatures[0]->getSigner() instanceof Person; + } +/* $personSignatures = []; + $userSignatures = [];*/ + +/* foreach ($signatures as $signature) { + if ($signature->getSigner() instanceof Person) { + $personSignatures[] = $signature->getSigner(); + } else { + $userSignatures[] = $signature->getSigner(); + } + }*/ if (\count($workflow->getEnabledTransitions($entityWorkflow)) > 0) { // possible transition @@ -347,6 +364,8 @@ class WorkflowController extends AbstractController 'transition_form' => isset($transitionForm) ? $transitionForm->createView() : null, 'entity_workflow' => $entityWorkflow, 'transition_form_errors' => $errors, + 'signatures' => $signatures, + 'signaturesByPerson' => $signaturesByPerson, // 'comment_form' => $commentForm->createView(), ] ); diff --git a/src/Bundle/ChillMainBundle/Resources/views/Workflow/_signature.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Workflow/_signature.html.twig index 77c11b9b7..644d540a1 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Workflow/_signature.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Workflow/_signature.html.twig @@ -1,21 +1,22 @@

{{ 'workflow.signature_zone.title'|trans }}

-
+
-
-
-{# todo: check if there are signatures to display names of persons/users + date down below #} -

name placeholder

-

name placeholder

-
-
-{# todo button should direct to form page for extra details if a person needs to sign #} - {{ 'workflow.signature_zone.button_sign'|trans }} -
- date placeholder + {% for s in signatures %} +
+ {% if signaturesByPerson %} +
{{ s.getSigner|chill_entity_render_box }}
+ {% else %} +
{{ s.getSigner.username }}
+ {% endif %} +
+ {{ 'workflow.signature_zone.button_sign'|trans }} + {% if s.state is same as('signed') %} +

{{ s.stateDate }}

+ {% endif %}
-
+ {% endfor %}
diff --git a/src/Bundle/ChillMainBundle/Resources/views/Workflow/index.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Workflow/index.html.twig index 57d14346c..730d0808e 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Workflow/index.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Workflow/index.html.twig @@ -57,7 +57,9 @@
{% include '@ChillMain/Workflow/_follow.html.twig' %}
-
{% include '@ChillMain/Workflow/_signature.html.twig' %}
+ {% if signatures is not empty %} +
{% include '@ChillMain/Workflow/_signature.html.twig' %}
+ {% endif %}
{% include '@ChillMain/Workflow/_decision.html.twig' %}
{#
{% include '@ChillMain/Workflow/_comment.html.twig' %}
#}
{% include '@ChillMain/Workflow/_history.html.twig' %}