Skip to content

Commit ff32942

Browse files
authored
add numerical tabs to eg008 and eg016 (#112)
* add numerical tabs to eg008 and eg016 * removing unnecessary inputs * fixing typo * DEVDOCS-9546 unlocking tab
1 parent 410b3f4 commit ff32942

File tree

5 files changed

+36
-34
lines changed

5 files changed

+36
-34
lines changed

app/consts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
minimum_buffer_min = 3
1616

1717
# Template name for create template example
18-
template_name = "Example Signer and CC template"
18+
template_name = "Example Signer and CC template v2"
1919

2020
# Name of static doc file
2121
doc_file = "World_Wide_Corp_fields.pdf"

app/eSignature/examples/eg008_create_template.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from os import path
33

44
from docusign_esign import Document, Signer, CarbonCopy, SignHere, Tabs, Recipients, \
5-
TemplatesApi, Checkbox, List, ListItem, Number, Radio, RadioGroup, Text, EnvelopeTemplate
5+
TemplatesApi, Checkbox, List, ListItem, Numerical, Radio, RadioGroup, Text, EnvelopeTemplate
66
from flask import session
77

88
from ...consts import demo_docs_path, doc_file, template_name
@@ -132,15 +132,17 @@ def make_template_req(cls):
132132
ListItem(text="Violet", value="violet")
133133
]
134134
)
135-
number1 = Number(
135+
numerical = Numerical(
136136
document_id="1",
137+
validation_type="Currency",
137138
page_number="1",
138139
x_position="163",
139140
y_position="260",
140141
font="helvetica",
141142
font_size="size14",
142-
tab_label="numbersOnly",
143+
tab_label="numericalCurrency",
143144
width="84",
145+
height="23",
144146
required="false"
145147
)
146148
radio_group = RadioGroup(
@@ -179,7 +181,7 @@ def make_template_req(cls):
179181
sign_here_tabs=[sign_here],
180182
checkbox_tabs=[check1, check2, check3, check4],
181183
list_tabs=[list1],
182-
number_tabs=[number1],
184+
numerical_tabs=[numerical],
183185
radio_group_tabs=[radio_group],
184186
text_tabs=[text]
185187
)

app/eSignature/examples/eg016_set_tab_values.py

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from os import path
33

44
from docusign_esign import EnvelopesApi, EnvelopeDefinition, Document, Signer, SignHere, Tabs, Recipients, \
5-
CustomFields, TextCustomField, Text, RecipientViewRequest
5+
Numerical, LocalePolicyTab, CustomFields, TextCustomField, Text, RecipientViewRequest
66
from flask import current_app as app, session, url_for, request
77

88
from ...consts import demo_docs_path, authentication_method, signer_client_id, pattern
@@ -128,32 +128,43 @@ def make_envelope(cls, args):
128128
bold="true", value=args["signer_name"],
129129
locked="false", tab_id="familar_name",
130130
tab_label="Familiar name")
131+
132+
locale_policy_tab = LocalePolicyTab(
133+
culture_name="en-US",
134+
currency_code="usd",
135+
currency_positive_format="csym_1_comma_234_comma_567_period_89",
136+
currency_negative_format="minus_csym_1_comma_234_comma_567_period_89",
137+
use_long_currency_format="true"
138+
)
131139

132-
salary = 123000
133-
134-
text_salary = Text(
135-
anchor_string="/salary/",
136-
anchor_units="pixels",
137-
anchor_y_offset="-9",
138-
anchor_x_offset="5",
140+
numerical_salary = Numerical(
141+
page_number="1",
142+
document_id="1",
143+
x_position="210",
144+
y_position="235",
145+
validation_type="Currency",
139146
font="helvetica",
140147
font_size="size11",
141148
bold="true",
142-
value="${:.2f}".format(salary),
143-
locked="true",
149+
locked="false",
150+
height="23",
144151
tab_id="salary",
145-
tab_label="Salary")
152+
tab_label="Salary",
153+
numerical_value="123000",
154+
locale_policy=locale_policy_tab
155+
156+
)
146157

147158
salary_custom_field = TextCustomField(
148159
name="salary",
149160
required="false",
150161
show="true", # Yes, include in the CoC
151-
value=str(salary)
162+
value=str(123000)
152163
)
153164
cf = CustomFields(text_custom_fields=[salary_custom_field])
154165
# Add the tabs model (including the SignHere tab) to the signer
155166
# The Tabs object wants arrays of the different field/tab types
156-
signer.tabs = Tabs(sign_here_tabs=[sign_here], text_tabs=[text_legal, text_familar, text_salary])
167+
signer.tabs = Tabs(sign_here_tabs=[sign_here], text_tabs=[text_legal, text_familar], numerical_tabs=[numerical_salary])
157168

158169
# Create the top level envelope definition and populate it
159170
envelope_definition = EnvelopeDefinition(

app/templates/eSignature/eg016_set_tab_values.html

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
{% include 'example_info.html' %}
44

55
{% set recipient_form_index = 0 %}
6-
{% set signer_email_index = 0 %}
7-
{% set signer_name_index = 1 %}
8-
{% set cc_email_index = 0 %}
9-
{% set cc_name_index = 1 %}
6+
{% set signer_email_index = 1 %}
7+
{% set signer_name_index = 0 %}
8+
{% set cc_email_index = 1 %}
9+
{% set cc_name_index = 0 %}
1010

1111
<form class="eg" action="" method="post" data-busy="form">
1212
{% if 'FormName' in example['Forms'][recipient_form_index] %}
@@ -25,17 +25,6 @@
2525
<input type="text" class="form-control" id="signer_name" placeholder="{{ example['Forms'][recipient_form_index]['Inputs'][signer_name_index]['InputPlaceholder'] }}" name="signer_name"
2626
value="{{ signer_name }}" required>
2727
</div>
28-
<div class="form-group">
29-
<label for="cc_email">{{ example['Forms'][recipient_form_index]['Inputs'][cc_email_index]['InputName'] }}</label>
30-
<input type="email" class="form-control" id="cc_email" name="cc_email"
31-
aria-describedby="emailHelp" placeholder="{{ example['Forms'][recipient_form_index]['Inputs'][cc_email_index]['InputPlaceholder'] }}" required >
32-
<small id="emailHelp" class="form-text text-muted">The email for the cc recipient must be different from the signer's email.</small>
33-
</div>
34-
<div class="form-group">
35-
<label for="cc_name">{{ example['Forms'][recipient_form_index]['Inputs'][cc_name_index]['InputName'] }}</label>
36-
<input type="text" class="form-control" id="cc_name" placeholder="{{ example['Forms'][recipient_form_index]['Inputs'][cc_name_index]['InputPlaceholder'] }}" name="cc_name"
37-
required >
38-
</div>
3928
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
4029
{% include 'submit_button.html' %}
4130
</form>

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ cffi==1.14.3
44
chardet==3.0.4
55
Click
66
cryptography==3.3.2
7-
docusign-esign==3.16.0
7+
docusign-esign==3.20.0
88
docusign-rooms==1.1.0
99
docusign-monitor==1.1.0
1010
docusign-click==1.2.2

0 commit comments

Comments
 (0)