mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-04 14:59:53 +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\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(),
|
||||
]
|
||||
);
|
||||
|
@ -1,21 +1,22 @@
|
||||
<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-row">
|
||||
<div class="item-col">
|
||||
{# todo: check if there are signatures to display names of persons/users + date down below #}
|
||||
<p>name placeholder</p>
|
||||
<p>name placeholder</p>
|
||||
</div>
|
||||
<div class="item-col flex-column align-items-end">
|
||||
{# todo button should direct to form page for extra details if a person needs to sign #}
|
||||
<a class="btn btn-show href="">{{ 'workflow.signature_zone.button_sign'|trans }}</a>
|
||||
<div>
|
||||
<span>date placeholder</span>
|
||||
{% for s in signatures %}
|
||||
<div class="item-row mb-2">
|
||||
{% if signaturesByPerson %}
|
||||
<div class="col-sm-6"><span class="chill-entity entity-person badge-person">{{ s.getSigner|chill_entity_render_box }}</span></div>
|
||||
{% else %}
|
||||
<div class="col-sm-6"><span>{{ s.getSigner.username }}</span></div>
|
||||
{% endif %}
|
||||
<div class="col-sm-6">
|
||||
<a class="btn btn-show" href="#">{{ 'workflow.signature_zone.button_sign'|trans }}</a>
|
||||
{% if s.state is same as('signed') %}
|
||||
<p class="updatedBy">{{ s.stateDate }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -57,7 +57,9 @@
|
||||
</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/_comment.html.twig' %}</section> #}
|
||||
<section class="step my-4">{% include '@ChillMain/Workflow/_history.html.twig' %}</section>
|
||||
|
Loading…
x
Reference in New Issue
Block a user