Skip to content

Commit 8afc595

Browse files
update dynamic table
1 parent 05286e0 commit 8afc595

File tree

5 files changed

+113
-38
lines changed

5 files changed

+113
-38
lines changed

lib/eSignature/controllers/eg042DocumentGeneration.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ eg042DocumentGeneration.createController = async (req, res) => {
4545
managerName: validator.escape(body.manager_name),
4646
jobTitle: validator.escape(body.job_title),
4747
salary: validator.escape(body.salary),
48+
rsus: validator.escape(body.rsus),
4849
startDate: validator.escape(body.start_date),
4950
docFile: path.resolve(demoDocsPath, docFile),
5051
};

lib/eSignature/examples/documentGeneration.js

Lines changed: 30 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ const recipientTabs = () => {
133133
});
134134

135135
const dateSigned = docusign.DateSigned.constructFromObject({
136-
anchorString: 'Date',
136+
anchorString: 'Date Signed',
137137
anchorUnits: 'pixels',
138138
anchorYOffset: '-22'
139139
});
@@ -181,6 +181,7 @@ const makeEnvelope = (templateId, args) => {
181181
*/
182182
//ds-snippet-start:eSign42Step7
183183
const formFields = (documentId, args) => {
184+
const bonusValue = '20%';
184185
const docGenFormFieldRequest = {
185186
docGenFormFields: [
186187
{
@@ -202,36 +203,48 @@ const formFields = (documentId, args) => {
202203
name: 'Start_Date',
203204
value: args.startDate
204205
}),
205-
{
206+
docusign.DocGenFormField.constructFromObject({
206207
name: 'Compensation_Package',
207208
type: 'TableRow',
208209
rowValues: [
209-
{
210+
docusign.DocGenFormFieldRowValue.constructFromObject({
210211
docGenFormFieldList: [
211-
{
212+
docusign.DocGenFormField.constructFromObject({
212213
name: 'Compensation_Component',
213214
value: 'Salary'
214-
},
215-
{
215+
}),
216+
docusign.DocGenFormField.constructFromObject({
216217
name: 'Details',
217-
value: args.salary
218-
}
218+
value: `$${args.salary}`
219+
})
219220
]
220-
},
221-
{
221+
}),
222+
docusign.DocGenFormFieldRowValue.constructFromObject({
222223
docGenFormFieldList: [
223-
{
224+
docusign.DocGenFormField.constructFromObject({
224225
name: 'Compensation_Component',
225226
value: 'Bonus'
226-
},
227-
{
227+
}),
228+
docusign.DocGenFormField.constructFromObject({
229+
name: 'Details',
230+
value: bonusValue
231+
})
232+
]
233+
}),
234+
docusign.DocGenFormFieldRowValue.constructFromObject({
235+
docGenFormFieldList: [
236+
docusign.DocGenFormField.constructFromObject({
237+
name: 'Compensation_Component',
238+
value: 'RSUs'
239+
}),
240+
docusign.DocGenFormField.constructFromObject({
228241
name: 'Details',
229-
value: 'You will be eligible for a bonus of up to 20 percent based on your performance.'
230-
}
242+
value: args.rsus
243+
})
231244
]
232-
}
245+
})
233246
]
234-
}
247+
})
235248
]
236249
}
237250
]

package-lock.json

Lines changed: 54 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"csurf": "^1.11.0",
3535
"docusign-admin": "^2.3.0",
3636
"docusign-click": "^2.2.0",
37-
"docusign-esign": "^6.5.1",
37+
"docusign-esign": "^6.6.0-rc2",
3838
"docusign-monitor": "^2.1.0",
3939
"docusign-rooms": "^2.0.0",
4040
"docusign-webforms": "^1.0.0",

views/pages/examples/eg042DocumentGeneration.ejs

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,42 +2,56 @@
22

33
<%- include("../../partials/exampleInfo") %>
44

5+
<% var form_index = 0 %>
6+
<% var candidate_email_index = 0 %>
7+
<% var candidate_name_index = 1 %>
8+
<% var manager_name_index = 2 %>
9+
<% var job_title_index = 3 %>
10+
<% var salary_index = 4 %>
11+
<% var start_date_index = 5 %>
12+
<% var rsus_index = 6 %>
13+
514
<form class="eg" action="" method="post" data-busy="form">
6-
<% if(example.Forms && example.Forms[0].FormName) { %>
7-
<%- example.Forms[0].FormName %>
15+
<% if(example.Forms && example.Forms[form_index].FormName) { %>
16+
<%- example.Forms[form_index].FormName %>
817
<% } %>
918

1019
<div class="form-group">
11-
<label for="candidate_email"><%= example.Forms[0].Inputs[0].InputName %></label>
20+
<label for="candidate_email"><%= example.Forms[form_index].Inputs[candidate_email_index].InputName %></label>
1221
<input type="email" class="form-control" id="candidate_email" name="candidate_email"
13-
aria-describedby="emailHelp" placeholder="<%= example.Forms[0].Inputs[0].InputPlaceholder %>" required>
22+
aria-describedby="emailHelp" placeholder="<%= example.Forms[form_index].Inputs[candidate_email_index].InputPlaceholder %>" required>
1423
<small id="emailHelp" class="form-text text-muted"><%= locals.manifest.SupportingTexts.HelpingTexts.EmailWontBeShared %></small>
1524
</div>
1625
<div class="form-group">
17-
<label for="candidate_name"><%= example.Forms[0].Inputs[1].InputName %></label>
18-
<input type="text" class="form-control" id="candidate_name" placeholder="<%= example.Forms[0].Inputs[1].InputPlaceholder %>" name="candidate_name"
26+
<label for="candidate_name"><%= example.Forms[form_index].Inputs[candidate_name_index].InputName %></label>
27+
<input type="text" class="form-control" id="candidate_name" placeholder="<%= example.Forms[form_index].Inputs[candidate_name_index].InputPlaceholder %>" name="candidate_name"
1928
required>
2029
</div>
2130
<div class="form-group">
22-
<label for="manager_name"><%= example.Forms[0].Inputs[2].InputName %></label>
31+
<label for="manager_name"><%= example.Forms[form_index].Inputs[manager_name_index].InputName %></label>
2332
<input type="text" class="form-control" id="manager_name" name="manager_name"
24-
aria-describedby="emailHelp" placeholder="<%= example.Forms[0].Inputs[2].InputPlaceholder %>" required>
33+
aria-describedby="emailHelp" placeholder="<%= example.Forms[form_index].Inputs[manager_name_index].InputPlaceholder %>" required>
2534
</div>
2635
<div class="form-group">
27-
<label for="job_title"><%= example.Forms[0].Inputs[3].InputName %></label>
36+
<label for="job_title"><%= example.Forms[form_index].Inputs[job_title_index].InputName %></label>
2837
<select class="form-control" id="job_title" name="job_title">
2938
<option value="Software Engineer">Software Engineer</option>
3039
<option value="Account Executive">Account Executive</option>
3140
</select>
3241
</div>
3342
<div class="form-group">
34-
<label for="salary"><%= example.Forms[0].Inputs[4].InputName %></label>
35-
<input type="text" class="form-control" id="salary" placeholder="<%= example.Forms[0].Inputs[4].InputPlaceholder %>" name="salary"
43+
<label for="salary"><%= example.Forms[form_index].Inputs[salary_index].InputName %></label>
44+
<input type="text" class="form-control" id="salary" placeholder="<%= example.Forms[form_index].Inputs[salary_index].InputPlaceholder %>" name="salary"
3645
required>
46+
</div>
47+
<div class="form-group">
48+
<label for="rsus"><%= example.Forms[form_index].Inputs[rsus_index].InputName %></label>
49+
<input type="number" class="form-control" id="rsus" placeholder="<%= example.Forms[form_index].Inputs[rsus_index].InputPlaceholder %>" name="rsus"
50+
min="0" required>
3751
</div>
3852
<div class="form-group">
39-
<label for="start_date"><%= example.Forms[0].Inputs[5].InputName %></label>
40-
<input type="date" class="form-control" id="start_date" placeholder="<%= example.Forms[0].Inputs[5].InputPlaceholder %>" name="start_date"
53+
<label for="start_date"><%= example.Forms[form_index].Inputs[start_date_index].InputName %></label>
54+
<input type="date" class="form-control" id="start_date" placeholder="<%= example.Forms[form_index].Inputs[start_date_index].InputPlaceholder %>" name="start_date"
4155
required>
4256
</div>
4357

0 commit comments

Comments
 (0)