Skip to content

Commit 44a5357

Browse files
committed
Update docgen example for dynamic tables
1 parent edb7a70 commit 44a5357

File tree

4 files changed

+40
-15
lines changed

4 files changed

+40
-15
lines changed

ds_config_example.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
'target_account_id' => false, // Set if you want a specific DocuSign AccountId, If false, the user's default account will be used.
2222
'demo_doc_path' => 'demo_documents',
2323
'doc_docx' => 'World_Wide_Corp_Battle_Plan_Trafalgar.docx',
24-
'offer_doc_docx' => 'Offer_Letter_Demo.docx',
24+
'offer_doc_docx' => 'Offer_Letter_Dynamic_Table.docx',
2525
'doc_html' => 'doc_1.html',
2626
'doc_pdf' => 'World_Wide_Corp_lorem.pdf',
2727
'doc_txt' => 'Check_If_Approved.txt',
36.3 KB
Binary file not shown.

src/Services/Examples/eSignature/DocumentGenerationService.php

Lines changed: 38 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use DocuSign\eSign\Model\DocGenFormField;
88
use DocuSign\eSign\Model\TemplateTabs;
99
use DocuSign\eSign\Model\DocGenFormFieldRequest;
10+
use DocuSign\eSign\Model\DocGenFormFieldRowValue;
1011
use DocuSign\eSign\Model\DocGenFormFields;
1112
use DocuSign\eSign\Model\Envelope;
1213
use DocuSign\eSign\Model\EnvelopeDefinition;
@@ -103,17 +104,16 @@ public static function makeTemplate(): EnvelopeTemplate
103104
public static function prepareTabs(): TemplateTabs
104105
{
105106
$signHere = new SignHere([
106-
'document_id' => '1',
107-
'page_number' => '1',
108-
'x_position' => '75',
109-
'y_position' => '415'
107+
'anchor_string' => 'Employee Signature',
108+
'anchor_units' => 'pixels',
109+
'anchor_x_offset' => '5',
110+
'anchor_y_offset' => '-22'
110111
]);
111112

112113
$dateSigned = new DateSigned([
113-
'document_id' => '1',
114-
'page_number' => '1',
115-
'x_position' => '290',
116-
'y_position' => '435'
114+
'anchor_string' => 'Date Signed',
115+
'anchor_units' => 'pixels',
116+
'anchor_y_offset' => '-22'
117117
]);
118118

119119
return new TemplateTabs([
@@ -185,13 +185,39 @@ public static function formFields(array $args, $documentId): DocGenFormFieldRequ
185185
'name' => 'Job_Title',
186186
'value' => $args['job_title']
187187
]),
188-
new DocGenFormField([
189-
'name' => 'Salary',
190-
'value' => $args['salary']
191-
]),
192188
new DocGenFormField([
193189
'name' => 'Start_Date',
194190
'value' => $args['start_date']
191+
]),
192+
new DocGenFormField([
193+
'name' => 'Compensation_Package',
194+
'type' => 'TableRow',
195+
'row_values' => [
196+
new DocGenFormFieldRowValue([
197+
'doc_gen_form_field_list' => [
198+
new DocGenFormField([
199+
'name' => 'Compensation_Component',
200+
'value' => 'Salary'
201+
]),
202+
new DocGenFormField([
203+
'name' => 'Details',
204+
'value' => $args['salary']
205+
])
206+
]
207+
]),
208+
new DocGenFormFieldRowValue([
209+
'doc_gen_form_field_list' => [
210+
new DocGenFormField([
211+
'name' => 'Compensation_Component',
212+
'value' => 'Bonus'
213+
]),
214+
new DocGenFormField([
215+
'name' => 'Details',
216+
'value' => 'You will be eligible for a bonus of up to 20 percent based on your performance.'
217+
])
218+
]
219+
])
220+
]
195221
])
196222
]
197223
])

templates/esignature/eg042_document_generation.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,7 @@ <h4>{{ code_example_text['ExampleName'] | raw }}</h4>
9494

9595
<select class="form-control" id="job_title" name="job_title">
9696
<option value="Software Engineer">Software Engineer</option>
97-
<option value="Product Manager">Product Manager</option>
98-
<option value="Sales Representative">Sales Representative</option>
97+
<option value="Account Executive">Account Executive</option>
9998
</select>
10099
</div>
101100

0 commit comments

Comments
 (0)