Adjustment to signature block

Hello,

I’d like to add a piece of text in my attendance list that becomes visible as well in the signature block.

The sentence “vertegenwoordigd door {% input custom.text.name_rep.name %}” would need to visible after the name of the represented director. However, I don’t know how to implement it in the current code and literally tried to past it everywhere.

I have attached both the code of the current attendance list and the signature block for reference.

Can someone please have a look?

Thank you in advance!

1 Like

Hi @lieels01

could you please paste the actual code here?
You can use the preformatted text button in the editor or follow this guide on how to add it by using quotes.

Thanks!
Kind regards,
Romy

1 Like

Hi Romy,

Please find below the actual code (please note this is in a permanent text so I don’t have the option showing on your printscreen).

The selection block:
{% ic %}{::infotext}{% input custom.represented.selection as:boolean %}Vertegenwoordigd{:/infotext}{% endic %}
{% if custom.represented.selection == true %}
{% stripnewlines %}
|Vertegenwoordigd: {{ warning_representant }}
{% endstripnewlines %}
{% unless show_no_options %}
{% fori name in zkv_names %}
{% capture name_id %}{{ name | replace: ‘.’,‘’ | replace: ’ ‘,’’ | remove:‘-’ }}{% endcapture %}
{% ic %}{% input period.custom.[name_id].attendance_represent as:boolean default:true %}{% endic %}{% assign name_attendance_represent = period.custom.[name_id].attendance_represent | default:true %}{% if name_attendance_represent %}{% nic %}{% endnic %}{{ name }}{% else %}{% assign not_all_present = true %}{% ic %}{{ name }}*{% endic %}{% capture not_present_var %}not_present_{{ forloop.index }}{% endcapture %}{% assign [not_present_var] = name %}{% endif %}
{% endfori %}
{% endunless %}
{% endif %}

The signature block:
{% comment %}below will not be shown is no date is filled in{% endcomment %}
{% unless show_no_options %}

{% assign aantal_zaakvoerders = count %}

{% if aantal_zaakvoerders == 0 %}
{% ic %}{::warningtext}
Er zijn geen geldige mandaten van zaakvoerders/bestuurders op datum van de vergadering van de zaakvoerders/raad van bestuur.
{:/warningtext}{% endic %}
{% endif %}

{% assign present_signatures = 0 %}
{% assign represent_signatures = 0 %}
{% assign columns = 2 %}
{% if aantal_zaakvoerders > columns %}{% assign aantal_kolommen = columns %}{% elsif aantal_zaakvoerders == 0 %}{% assign aantal_kolommen = 1 %}{% else %}{% assign aantal_kolommen = aantal_zaakvoerders %}{% endif %}

{% stripnewlines %}
{% newline %}
{% for i in (1…aantal_kolommen) %}
|----{{ 100/aantal_kolommen | integer }}%------
{% endfor %}
+
{% newline %}
|
{% for signature in zkv_signatures %}
{% assign name_attendance_present = false %}
{% assign name_attendance_represent = false %}
{% comment %}we need to access info from the zkv_names array to see which are present - !! duplicate code from where the present booleans are made !!{% endcomment %}
{% assign name = zkv_names[forloop.index0] %}
{% capture name_id %}{{ name | replace: ‘.’,‘’ | replace: ’ ‘,’’ | remove:‘-’ }}{% endcapture %}
{% assign name_attendance_present = period.custom.[name_id].attendance_present | default:true %}
{% assign name_attendance_represent = period.custom.[name_id].attendance_represent | default:true %}
{% if name_attendance_present or name_attendance_represent %}
{% assign present_signatures = present_signatures | plus:1 %}
{% assign represent_signatures = represent_signatures | plus:1 %}






{{ signature }}
|
{% assign modulo = present_signatures | modulo:2 %}
{% assign modulo = represent_signatures | modulo:2 %}
{% if modulo == 0 %}
{% unless forloop.last %}
{% newline %}
|
{% endunless %}
{% endif %}
{% endif %}
{% endfor %}
{% newline %}
|

{% endstripnewlines %}
{% endunless %}
{:/group}

Hi @lieels01

thanks for the code!

I had a look and if I understand correctly, I think this is what you need to add:

  1. To add the text + new input to the list of attendees
    You would print this right after the name ( {{ name }} ), probably only if the boolean is ticked.
    If you also want to print it when the boolean is not ticked, you’d have to include it in the “else” part of this if-statement as well.
{% ic %}{::infotext}{% input custom.represented.selection as:boolean %}Vertegenwoordigd{:/infotext}{% endic %}
{% if custom.represented.selection == true %}
{% stripnewlines %}
|_Vertegenwoordigd:_ {{ warning_representant }}
{% endstripnewlines %}
{% unless show_no_options %}
{% fori name in zkv_names %}
{% capture name_id %}{{ name | replace: '.','' | replace: ' ','' | remove:'-' }}{% endcapture %}
{% ic %}{% input period.custom.[name_id].attendance_represent as:boolean default:true %}{% endic %}{% assign name_attendance_represent = period.custom.[name_id].attendance_represent | default:true %}{% if name_attendance_represent %}{% nic %}*{% endnic %}{{ name }} vertegenwoordigd door {% input custom.text.name_rep.name placeholder:"Naam" %}{% else %}{% assign not_all_present = true %}{% ic %}*{{ name }}*{% endic %}{% capture not_present_var %}not_present_{{ forloop.index }}{% endcapture %}{% assign [not_present_var] = name %}{% endif %}
{% endfori %}
{% endunless %}
{% endif %} 
  1. Have the text + name from the input also in the signatures.
    This part is a bit more tricky, because you’re printing the signature from the collection zkv_signatures
    You need to trace back where this collection gets populated.
    Since it’s not visible in the code you shared here, I took the liberty of taking a peek at the full template in your SF environment :smiling_face:

You’ll need to add it here:

      {% if person.custom.represented_by_name != blank and type == "legal" %}
        {% assign names = names | append:" met als vaste vertegenwoordiger " | append:person.custom.represented_by_name %}
        {% assign signatures = signatures | append:"<br>" | append:"met als vaste vertegenwoordiger " | append:person.custom.represented_by_name %}

which will now become:

      {% capture name_id %}{{ person.name | replace: '.','' | replace: ' ','' | remove:'-' }}{% endcapture %}
      {% if person.custom.represented_by_name != blank and type == "legal" %}
        {% assign names = names | append:" met als vaste vertegenwoordiger " | append:person.custom.represented_by_name %}
        {% assign signatures = signatures | append:"<br>" | append:"met als vaste vertegenwoordiger " | append:person.custom.represented_by_name %}
      {% elsif period.custom.[name_id].attendance_represent != false and custom.text.name_rep.name != blank %}  
        {% assign signatures = signatures | append:"<br>" | append:"vertegenwoordigd door " | append:custom.text.name_rep.name %}
      {% endif %}

So, first you need the name_id, otherwise we can’t access the value of the boolean.
Then you can add an elsif statement, that in case there isn’t a fixed representative, will look whether a representative was filled out in this template.
And then you add the name to the signature in case one has been filled out.
You could also flip this logic around and make the new code the if-condition and the existing code the elsif-condition, depending on how you want it to function.

I have two remarks though.

Firstly, with the current setup you’ll only be able to define one representative because the input field is not tied to anything. Instead it would make sense to tie it to the boolean of the person being represented, so name it something like this:
e.g. period.custom.[name_id].rep_name

Secondly, this name_id isn’t the best approach to store data. You can run into issues when names contain special characters for example. If this code isn’t in use already, I’d recommend changing it. Looping over the people drop instead and using the persistent_id is the preferred way to tie custom data to people.

Hope this was useful,
Kind regards,
Romy

Hi Romy,

Thank you for the explanation.

I tried out the mentioned code, but now 'vertegenwoordigd door" appears under all names instead of only the ones selected… As you can see below, ‘Albert’ should be mentioned normally and ‘Anne’ should be represented, but in the signature block, both are represented.

Furthermore, the name of the person representing a director is the same for all represented persons. We should be able to insert different names for different directors.

Hi @lieels01

I think it’s this piece of code.
If the boolean is unticked by default, then this piece of the previously shared code

elsif period.custom.[name_id].attendance_represent != false

should be changed into the following

elsif period.custom.[name_id].attendance_represent == true

The difference is that in my example I assumed everyone is always represented unless you uncheck the boolean. So the vertegenwoordig door is currently included when the boolean has not been touched and when it is checked.

Can you try changing it as suggested and see if that sorts this out?

Your second comment is something I also addressed in my previous reply. It’s because of the naming of that input field. You should change it so that it’s tied to the director.

Firstly, with the current setup you’ll only be able to define one representative because the input field is not tied to anything. Instead it would make sense to tie it to the boolean of the person being represented, so name it something like this:
e.g. period.custom.[name_id].rep_name

Kind regards,
Romy