Refactor signature rendering logic

Reorganized the signature rendering loop for better readability. Moved the row alignment inside the loop and added text alignment for signed statements. Simplified the conditional checks within the loop to enhance code maintainability.
This commit is contained in:
Julien Fastré 2024-09-04 17:24:11 +02:00
parent ce781a5b58
commit 71d3aa3969
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB

View File

@ -1,24 +1,24 @@
<h2>{{ 'workflow.signature_zone.title'|trans }}</h2>
<div class="container">
<div class="row align-items-center">
{% for s in signatures %}
<div class="col-sm-12 col-md-8"><span>{{ s.signer|chill_entity_render_box }}</span></div>
<div class="col-sm-12 col-md-4">
<ul class="record_actions">
{% if s.isSigned %}
<p>{{ 'workflow.signature_zone.has_signed_statement'|trans({ 'datetime' : s.stateDate }) }}</p>
{% else %}
<li>
<a class="btn btn-misc" href="{{ chill_path_add_return_path('chill_main_workflow_signature_metadata', { 'signature_id': s.id}) }}"><i class="fa fa-pencil-square-o"></i> {{ 'workflow.signature_zone.button_sign'|trans }}</a>
{% if s.state is same as('signed') %}
<p class="updatedBy">{{ s.stateDate }}</p>
{% endif %}
</li>
{% endif %}
</ul>
</div>
{% endfor %}
</div>
{% for s in signatures %}
<div class="row align-items-center">
<div class="col-sm-12 col-md-8"><span>{{ s.signer|chill_entity_render_box }}</span></div>
<div class="col-sm-12 col-md-4">
{% if s.isSigned %}
<p class="text-end">{{ 'workflow.signature_zone.has_signed_statement'|trans({ 'datetime' : s.stateDate }) }}</p>
{% else %}
<ul class="record_actions">
<li>
<a class="btn btn-misc" href="{{ chill_path_add_return_path('chill_main_workflow_signature_metadata', { 'signature_id': s.id}) }}"><i class="fa fa-pencil-square-o"></i> {{ 'workflow.signature_zone.button_sign'|trans }}</a>
{% if s.state is same as('signed') %}
<p class="updatedBy">{{ s.stateDate }}</p>
{% endif %}
</li>
</ul>
{% endif %}
</div>
</div>
{% endfor %}
</div>