Add signer type differentiation for workflows

Added a method to determine if the signer is a 'person' or 'user'. Updated the signature template to handle both types accordingly, ensuring the correct entity type is displayed in workflow signatures.
This commit is contained in:
Julien Fastré 2024-09-10 14:19:14 +02:00
parent 669b967899
commit 1ddd283f26
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB
2 changed files with 26 additions and 6 deletions

View File

@ -140,4 +140,16 @@ class EntityWorkflowStepSignature implements TrackCreationInterface, TrackUpdate
{ {
return EntityWorkflowSignatureStateEnum::SIGNED == $this->getState(); return EntityWorkflowSignatureStateEnum::SIGNED == $this->getState();
} }
/**
* @return 'person'|'user'
*/
public function getSignerKind(): string
{
if ($this->personSigner instanceof Person) {
return 'person';
}
return 'user';
}
} }

View File

@ -4,12 +4,20 @@
{% for s in signatures %} {% for s in signatures %}
<div class="row row-hover align-items-center"> <div class="row row-hover align-items-center">
<div class="col-sm-12 col-md-8"> <div class="col-sm-12 col-md-8">
{% if s.signerKind == 'person' %}
{% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with { {% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with {
action: 'show', displayBadge: true, action: 'show', displayBadge: true,
targetEntity: { name: 'person', id: s.signer.id }, targetEntity: { name: 'person', id: s.signer.id },
buttonText: s.signer|chill_entity_render_string, buttonText: s.signer|chill_entity_render_string,
isDead: s.signer.deathDate is not null isDead: s.signer.deathDate is not null
} %} } %}
{% else %}
{% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with {
action: 'show', displayBadge: true,
targetEntity: { name: 'user', id: s.signer.id },
buttonText: s.signer|chill_entity_render_string,
} %}
{% endif %}
</div> </div>
<div class="col-sm-12 col-md-4"> <div class="col-sm-12 col-md-4">
{% if s.isSigned %} {% if s.isSigned %}