mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-04 23:09:50 +00:00
Display names and sign buttons for person or user signatures
This commit is contained in:
parent
fd216ff66e
commit
57a07af3db
@ -23,6 +23,7 @@ use Chill\MainBundle\Security\Authorization\EntityWorkflowVoter;
|
|||||||
use Chill\MainBundle\Security\ChillSecurity;
|
use Chill\MainBundle\Security\ChillSecurity;
|
||||||
use Chill\MainBundle\Workflow\EntityWorkflowManager;
|
use Chill\MainBundle\Workflow\EntityWorkflowManager;
|
||||||
use Chill\MainBundle\Workflow\WorkflowTransitionContextDTO;
|
use Chill\MainBundle\Workflow\WorkflowTransitionContextDTO;
|
||||||
|
use Chill\PersonBundle\Entity\Person;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\FormType;
|
use Symfony\Component\Form\Extension\Core\Type\FormType;
|
||||||
@ -277,6 +278,22 @@ class WorkflowController extends AbstractController
|
|||||||
$handler = $this->entityWorkflowManager->getHandler($entityWorkflow);
|
$handler = $this->entityWorkflowManager->getHandler($entityWorkflow);
|
||||||
$workflow = $this->registry->get($entityWorkflow, $entityWorkflow->getWorkflowName());
|
$workflow = $this->registry->get($entityWorkflow, $entityWorkflow->getWorkflowName());
|
||||||
$errors = [];
|
$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) {
|
if (\count($workflow->getEnabledTransitions($entityWorkflow)) > 0) {
|
||||||
// possible transition
|
// possible transition
|
||||||
@ -347,6 +364,8 @@ class WorkflowController extends AbstractController
|
|||||||
'transition_form' => isset($transitionForm) ? $transitionForm->createView() : null,
|
'transition_form' => isset($transitionForm) ? $transitionForm->createView() : null,
|
||||||
'entity_workflow' => $entityWorkflow,
|
'entity_workflow' => $entityWorkflow,
|
||||||
'transition_form_errors' => $errors,
|
'transition_form_errors' => $errors,
|
||||||
|
'signatures' => $signatures,
|
||||||
|
'signaturesByPerson' => $signaturesByPerson,
|
||||||
// 'comment_form' => $commentForm->createView(),
|
// 'comment_form' => $commentForm->createView(),
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
@ -1,21 +1,22 @@
|
|||||||
<h2>{{ 'workflow.signature_zone.title'|trans }}</h2>
|
<h2>{{ 'workflow.signature_zone.title'|trans }}</h2>
|
||||||
|
|
||||||
<div class="flex-table">
|
<div class="flex-table justify-content-center">
|
||||||
<div class="item-bloc">
|
<div class="item-bloc">
|
||||||
<div class="item-row">
|
{% for s in signatures %}
|
||||||
<div class="item-col">
|
<div class="item-row mb-2">
|
||||||
{# todo: check if there are signatures to display names of persons/users + date down below #}
|
{% if signaturesByPerson %}
|
||||||
<p>name placeholder</p>
|
<div class="col-sm-6"><span class="chill-entity entity-person badge-person">{{ s.getSigner|chill_entity_render_box }}</span></div>
|
||||||
<p>name placeholder</p>
|
{% else %}
|
||||||
</div>
|
<div class="col-sm-6"><span>{{ s.getSigner.username }}</span></div>
|
||||||
<div class="item-col flex-column align-items-end">
|
{% endif %}
|
||||||
{# todo button should direct to form page for extra details if a person needs to sign #}
|
<div class="col-sm-6">
|
||||||
<a class="btn btn-show href="">{{ 'workflow.signature_zone.button_sign'|trans }}</a>
|
<a class="btn btn-show" href="#">{{ 'workflow.signature_zone.button_sign'|trans }}</a>
|
||||||
<div>
|
{% if s.state is same as('signed') %}
|
||||||
<span>date placeholder</span>
|
<p class="updatedBy">{{ s.stateDate }}</p>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -57,7 +57,9 @@
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="step my-4">{% include '@ChillMain/Workflow/_follow.html.twig' %}</section>
|
<section class="step my-4">{% include '@ChillMain/Workflow/_follow.html.twig' %}</section>
|
||||||
<section class="step my-4">{% include '@ChillMain/Workflow/_signature.html.twig' %}</section>
|
{% if signatures is not empty %}
|
||||||
|
<section class="step my-4">{% include '@ChillMain/Workflow/_signature.html.twig' %}</section>
|
||||||
|
{% endif %}
|
||||||
<section class="step my-4">{% include '@ChillMain/Workflow/_decision.html.twig' %}</section>{#
|
<section class="step my-4">{% include '@ChillMain/Workflow/_decision.html.twig' %}</section>{#
|
||||||
<section class="step my-4">{% include '@ChillMain/Workflow/_comment.html.twig' %}</section> #}
|
<section class="step my-4">{% include '@ChillMain/Workflow/_comment.html.twig' %}</section> #}
|
||||||
<section class="step my-4">{% include '@ChillMain/Workflow/_history.html.twig' %}</section>
|
<section class="step my-4">{% include '@ChillMain/Workflow/_history.html.twig' %}</section>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user